* { 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: minmax(0, 1fr) 210px;
      gap: 10px;
      padding: 12px 12px 12px 16px;
      min-height: 0;
    }

    .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: stretch;
      gap: 7px;
      padding: 42px 6px 10px;
      min-height: 0;
      overflow-y: auto;
      overflow-x: hidden;
      scrollbar-width: thin;
      scrollbar-color: #a9b4c2 transparent;
    }

    .side-panel::-webkit-scrollbar { width: 8px; }
    .side-panel::-webkit-scrollbar-track { background: transparent; }
    .side-panel::-webkit-scrollbar-thumb {
      background: #a9b4c2;
      border-radius: 10px;
    }

    .btn {
      width: 100%;
      min-height: 40px;
      border: 1px solid #aeb8c4;
      border-radius: 7px;
      box-shadow: 0 1px 2px rgba(0,0,0,.10);
      font-size: 14px;
      font-weight: 700;
      line-height: 1.15;
      cursor: pointer;
      padding: 7px 9px;
      text-align: center;
      transition: transform .08s ease, box-shadow .12s ease, filter .12s ease;
    }

    .btn:hover:not(:disabled) {
      filter: brightness(.98);
      box-shadow: 0 2px 5px rgba(0,0,0,.14);
    }

    .btn:active:not(:disabled) {
      transform: translateY(1px);
      box-shadow: 0 1px 2px rgba(0,0,0,.10);
    }
    .open { background: #c0ffc0; }
    .copy { background: #fff3a8; }
    .crop { background: #ffb347; color: #111; }
    .ai { background: #ffdca8; }
    .excel { background: #bde7ff; }
    .xml { background: #d7c8ff; }
    .add-row { background: #d8ffd8; }
    .rotate { background: #c0c0ff; }
    .clear { background: #8080ff; color: white; }
    .exit { background: #909090; color: white; }
    .disabled { opacity: .55; cursor: not-allowed; }

    .message {
      width: 100%;
      min-height: 54px;
      text-align: center;
      font-family: Arial, sans-serif;
      font-size: 15px;
      font-weight: 700;
      line-height: 1.25;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 7px;
      background: rgba(255,255,255,.55);
      border: 1px solid #c7cdd5;
      border-radius: 7px;
    }

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

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

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

    .hint {
      width: 100%;
      text-align: center;
      font-size: 12px;
      line-height: 1.35;
      margin-top: 2px;
      color: #4f5966;
      padding: 4px 2px;
    }

    .logo {
      margin-top: 4px;
      width: 100%;
      min-height: 68px;
      border: 1px solid #777;
      background: white;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      font-weight: 800;
      color: #b00000;
      font-size: 21px;
      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: 100%;
      max-height: 90px;
      display: none;
      border: 1px solid #999;
    }


    .grid-panel {
      position: fixed;
      left: 24px;
      right: 232px;
      bottom: 18px;
      height: clamp(220px, 31vh, 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;
}


@media (max-height: 850px) {
  .app {
    grid-template-columns: minmax(0, 1fr) 196px;
    gap: 8px;
    padding: 8px 10px 8px 12px;
  }

  .side-panel {
    padding-top: 38px;
    gap: 5px;
  }

  .btn {
    min-height: 36px;
    font-size: 13px;
    padding: 5px 7px;
  }

  .message {
    min-height: 46px;
    font-size: 13px;
  }

  .grid-panel {
    left: 12px;
    right: 216px;
    bottom: 8px;
    height: clamp(190px, 29vh, 270px);
  }

  .hint { font-size: 11px; }
  .logo { min-height: 58px; font-size: 18px; }
  #cropImg { max-height: 70px; }
}

@media (max-width: 1100px) {
  .app {
    grid-template-columns: minmax(0, 1fr) 190px;
  }

  .grid-panel {
    right: 210px;
  }
}

.btn span {
  font-size: 11px !important;
  font-weight: 600;
  opacity: .78;
}


/* Clickable Product URL and Spec Sheet links in AG Grid. */
.url-cell-link {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 1px 7px;
  border: 1px solid #8ab4df;
  border-radius: 4px;
  background: #eef7ff;
  color: #075ea8;
  font-weight: 700;
  line-height: 18px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.url-cell-link:hover,
.url-cell-link:focus {
  background: #dceeff;
  text-decoration: underline;
}

.manufacturer-fallback-link {
  border-color: #b7a56b;
  background: #fff8dc;
  color: #6c5500;
}

.manufacturer-fallback-link:hover,
.manufacturer-fallback-link:focus {
  background: #fff0b5;
}

.url-cell-invalid {
  color: #a00000;
  text-decoration: underline dotted;
  cursor: text;
}


/* =========================================================
   Product Library 2.2 URL status badges
   ========================================================= */
.url-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 22px;
  padding: 2px 8px 2px 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
  letter-spacing: .25px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.url-status-badge:hover,
.url-status-badge:focus {
  text-decoration: none;
  filter: brightness(.96);
}

.url-status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  min-width: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,.18);
}

.url-status-prod {
  color: #176c2d;
  background: #edf9ef;
  border-color: #8fc99c;
}

.url-status-prod .url-status-dot {
  background: #2fb34a;
}

.url-status-mfg {
  color: #175f99;
  background: #edf6fd;
  border-color: #91bade;
}

.url-status-mfg .url-status-dot {
  background: #2b84d6;
}

.url-status-spec {
  color: #6b3d8b;
  background: #f6effb;
  border-color: #bea3d0;
}

.url-status-spec .url-status-dot {
  background: #8e56b5;
}

.ag-cell:has(.url-status-badge) {
  display: flex;
  align-items: center;
}
