* { box-sizing: border-box; }
    html, body { height: 100%; margin: 0; }
    body {
      font-family: Arial, sans-serif;
      background: #d9d9d9;
      color: #111;
      overflow: hidden;
    }

    .app {
      height: 100vh;
      display: grid;
      grid-template-columns: 1fr 245px;
      gap: 14px;
      padding: 18px 18px 18px 24px;
    }

    .viewer-panel {
      background: #efefef;
      border: 2px inset #bcbcbc;
      position: relative;
      overflow: auto;
      min-width: 0;
    }

    .empty-state {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #555;
      font-size: 22px;
      text-align: center;
      padding: 40px;
    }

    #imageStage {
      position: relative;
      display: inline-block;
      transform-origin: top left;
    }

    #pageImg {
      display: none;
      user-select: none;
      -webkit-user-drag: none;
      max-width: none;
    }

    #cropBox {
      position: absolute;
      border: 3px solid red;
      background: rgba(255, 0, 0, .12);
      display: none;
      pointer-events: none;
    }

    .side-panel {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      padding-top: 46px;
    }

    .btn {
      width: 205px;
      min-height: 54px;
      border: 2px outset #d0d0d0;
      font-size: 18px;
      font-weight: 700;
      cursor: pointer;
      padding: 8px 10px;
      text-align: center;
    }

    .btn:active { border-style: inset; }
    .open { background: #c0ffc0; }
    .crop { background: #c0c0c0; }
    .ai { background: #ffdca8; }
    .excel { background: #bde7ff; }
    .rotate { background: #c0c0ff; }
    .clear { background: #8080ff; color: white; }
    .exit { background: #909090; color: white; }
    .disabled { opacity: .55; cursor: not-allowed; }

    .message {
      width: 230px;
      min-height: 72px;
      text-align: center;
      font-family: "Arial Narrow", Arial, sans-serif;
      font-size: 23px;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 8px;
    }

    .progress-wrap {
      width: 205px;
      height: 18px;
      border: 1px solid #777;
      background: #eee;
      display: none;
    }

    .progress-fill {
      height: 100%;
      width: 0%;
      background: #5f9cff;
      transition: width .25s ease;
    }

    .progress-text {
      width: 205px;
      text-align: center;
      font-size: 13px;
      min-height: 16px;
    }

    .hint {
      width: 230px;
      text-align: center;
      font-size: 18px;
      line-height: 1.2;
      margin-top: 6px;
    }

    .logo {
      margin-top: auto;
      width: 210px;
      min-height: 100px;
      border: 1px solid #777;
      background: white;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      font-weight: 800;
      color: #b00000;
      font-size: 26px;
      letter-spacing: .5px;
    }

    .logo span {
      color: #111;
      font-size: 13px;
      font-weight: 600;
      margin-top: 6px;
    }

    .top-tools {
      position: fixed;
      left: 36px;
      top: 26px;
      background: rgba(255,255,255,.92);
      border: 1px solid #aaa;
      padding: 6px 8px;
      z-index: 5;
      display: flex;
      gap: 8px;
      align-items: center;
      font-size: 13px;
    }

    .top-tools input[type="number"] { width: 65px; }
    #pdfInput { display: none; }

    #cropImg {
      max-width: 220px;
      max-height: 110px;
      display: none;
      border: 1px solid #999;
    }


    .grid-panel {
      position: fixed;
      left: 24px;
      right: 280px;
      bottom: 18px;
      height: 320px;
      background: rgba(255,255,255,.96);
      border: 1px solid #999;
      display: none;
      overflow: hidden;
      z-index: 8;
    }

    #resultGrid {
      width: 100%;
      height: 100%;
    }

    .ag-theme-quartz {
      --ag-font-family: Arial, sans-serif;
      --ag-font-size: 13px;
      --ag-header-height: 30px;
      --ag-row-height: 28px;
    }

    .del-button {
      width: 28px;
      height: 22px;
      border: 1px solid #999;
      background: #fff;
      color: #a00000;
      font-weight: 800;
      cursor: pointer;
      line-height: 18px;
    }


    .login-screen {
      position: fixed;
      inset: 0;
      z-index: 1000;
      background: #d9d9d9;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .login-box {
      width: 390px;
      background: white;
      border: 2px outset #cfcfcf;
      padding: 26px 28px 24px;
      box-shadow: 0 8px 28px rgba(0,0,0,.18);
      text-align: center;
    }

    .login-title {
      font-size: 30px;
      font-weight: 800;
      color: #b00000;
      margin-bottom: 4px;
    }

    .login-subtitle {
      font-size: 15px;
      margin-bottom: 22px;
      color: #333;
    }

    .login-box label {
      display: block;
      text-align: left;
      font-weight: 700;
      margin: 12px 0 5px;
    }

    .login-box input {
      width: 100%;
      height: 38px;
      font-size: 17px;
      padding: 6px 8px;
      border: 1px solid #888;
    }

    .login-error {
      min-height: 24px;
      color: #b00000;
      font-weight: 700;
      margin: 12px 0 8px;
    }

    .login-button {
      width: 100%;
      height: 48px;
      font-size: 18px;
      font-weight: 800;
      background: #c0ffc0;
      border: 2px outset #d0d0d0;
      cursor: pointer;
    }

    .login-button:active { border-style: inset; }
    .login-button:disabled { opacity: .55; cursor: not-allowed; }
    .hidden-until-login { display: none !important; }

/* Final beta cleanup: never show the old debug/status bar. */
#status,
.bottom-bar {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  border: 0 !important;
}
