/* ============================================================
   AEKAM AI · JOB INTELLIGENCE
   (Reference: AEKAM AI · BAXTER JOB INTELLIGENCE)
   Design tokens & component styles
   ============================================================ */

:root {
  --bg: #faf9f6;
  --paper: #ffffff;
  --surface: #f4f2ec;
  --surface-2: #efece4;
  --line: #e7e3da;
  --line-strong: #d4cfc1;
  --ink: #1a1a17;
  --ink-2: #4a463d;
  --ink-3: #807a6c;
  --accent: #c4451c;
  --accent-soft: #fbeae3;
  --accent-deep: #7a2a10;
  --blue: #1f5fb3;
  --blue-soft: #e3edfa;
  --ok: #2d7a44;
  --ok-soft: #e3f2e6;
  --warn: #a85d00;
  --warn-soft: #fbecd3;
  --bad: #aa2620;
  --bad-soft: #fbe1df;
  --info: #1f5fb3;
  --info-soft: #e3edfa;
  --purple: #6b46a8;
  --purple-soft: #efe7f7;
  --radius: 7px;
  --radius-lg: 11px;
  --radius-xl: 16px;
  --font: 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --hand: 'Caveat', cursive;
  --shadow-sm: 0 1px 2px rgba(26, 26, 23, .06);
  --shadow: 0 4px 14px rgba(26, 26, 23, .08);
  --shadow-lg: 0 12px 40px rgba(26, 26, 23, .16);
}

/* ============ RESET ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
::selection { background: var(--accent-soft); color: var(--accent-deep); }
svg { display: inline-block; vertical-align: middle; stroke-width: 2; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
.mono { font-family: var(--mono); }
.hand { font-family: var(--hand); }

/* ============ SHELL ============ */
.shell { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  height: 54px;
  flex: 0 0 54px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.5px;
  box-shadow: var(--shadow-sm);
}
.brand .dot { width: 6px; height: 6px; border-radius: 50%; background: #4aa3ff; margin-left: -6px; margin-top: -12px; }
.brand .sub {
  font-weight: 400;
  font-size: 12px;
  color: var(--ink-3);
  border-left: 1px solid var(--line-strong);
  padding-left: 10px;
  margin-left: 4px;
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  font-size: 13px;
  transition: .16s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--accent-deep); }
.btn svg { width: 15px; height: 15px; }
.btn-ghost { background: var(--surface); color: var(--ink-2); box-shadow: none; border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-blue { background: var(--blue); }
.btn-blue:hover { background: #164a8f; }

.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 11px; }

.main { flex: 1; display: flex; overflow: hidden; }

/* ============ SIDEBAR ============ */
.sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), flex-basis 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-right-width 0.2s ease, opacity 0.15s ease;
}
.sidebar.collapsed {
  width: 0 !important;
  flex: 0 0 0 !important;
  border-right-width: 0 !important;
  overflow: hidden !important;
  opacity: 0;
  pointer-events: none;
}
.sb-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  color: var(--ink-2);
  background: var(--surface);
  transition: all 0.15s ease;
}
.sb-toggle-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line-strong);
}
.sb-toggle-btn svg {
  width: 16px;
  height: 16px;
}
.sb-section { padding: 14px 12px 6px; }
.sb-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 8px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ind { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ok); font-size: 10px; }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(45, 122, 68, .5); }
  70% { box-shadow: 0 0 0 6px rgba(45, 122, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(45, 122, 68, 0); }
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--ink-2);
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  transition: .13s;
  margin-bottom: 1px;
  position: relative;
}
.nav-item svg { width: 17px; height: 17px; color: var(--ink-3); flex: 0 0 17px; }
.nav-item:hover { background: var(--surface); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-deep); }
.nav-item.active svg { color: var(--accent); }
.nav-item .count { margin-left: auto; font-size: 11px; background: var(--surface); color: var(--ink-3); padding: 1px 7px; border-radius: 10px; font-weight: 600; }
.nav-item.active .count { background: #fff; color: var(--accent); }
.nav-item .modnum { margin-left: auto; font-size: 10px; font-weight: 600; color: var(--ink-3); width: 18px; height: 18px; border-radius: 5px; background: var(--surface); display: flex; align-items: center; justify-content: center; }
.nav-item.active .modnum { background: #fff; color: var(--accent); }
.nav-sub { font-size: 11px; color: var(--ink-3); padding: 2px 10px 8px 37px; line-height: 1.4; margin-top: -2px; }
.sb-divider { height: 1px; background: var(--line); margin: 8px 14px; }

.job-pill {
  margin: 6px 12px 4px;
  padding: 11px 12px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #1d1c19, #2c2a25);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: .16s;
}
.job-pill:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.job-pill .jp-label { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: #b8b3a6; font-weight: 600; }
.job-pill .jp-num { font-family: var(--mono); font-size: 16px; font-weight: 600; margin-top: 2px; letter-spacing: -.5px; }
.job-pill .jp-cust { font-size: 11.5px; color: #cfc9bd; margin-top: 1px; }
.job-pill .jp-bar { height: 4px; border-radius: 3px; background: rgba(255, 255, 255, .18); margin-top: 9px; overflow: hidden; }
.job-pill .jp-bar > span { display: block; height: 100%; background: #4aa3ff; border-radius: 3px; transition: width .8s; }
.job-pill .jp-pct { font-size: 10px; color: #cfc9bd; margin-top: 4px; display: flex; justify-content: space-between; }

.sb-cta { margin-top: auto; padding: 12px; }
.cta-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  transition: .16s;
  box-shadow: var(--shadow-sm);
}
.cta-button:hover { background: var(--accent-deep); }
.cta-button svg { width: 16px; height: 16px; }

/* ============ CONTENT ============ */
.content { flex: 1; overflow-y: auto; position: relative; background: var(--bg); }
.content-inner { padding: 26px 34px 60px; max-width: 100%; margin: 0 auto; }
.page-head { margin-bottom: 22px; }
.page-eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.page-eyebrow .mn { background: var(--accent); color: #fff; width: 18px; height: 18px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
.page-title { font-size: 25px; font-weight: 700; letter-spacing: -.5px; line-height: 1.15; }
.page-sub { color: var(--ink-2); font-size: 14.5px; margin-top: 7px; max-width: 680px; line-height: 1.55; }

.crumb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 14px; }
.crumb a { color: var(--ink-3); cursor: pointer; text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.crumb svg { width: 13px; height: 13px; }

/* ============ CARDS ============ */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 9px; }
.card-head h3 svg { width: 17px; height: 17px; color: var(--accent); }
.card-head .sub { font-size: 12px; color: var(--ink-3); font-weight: 400; }

/* ============ GRID ============ */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ============ BADGES ============ */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; letter-spacing: .01em; }
.badge svg { width: 11px; height: 11px; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-neutral { background: var(--surface); color: var(--ink-3); }
.b-purple { background: var(--purple-soft); color: var(--purple); }
.b-accent { background: var(--accent-soft); color: var(--accent-deep); }
.b-pulse .dt { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; }

/* ============ STAT TILES ============ */
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 15px 16px; box-shadow: var(--shadow-sm); }
.stat .lbl { font-size: 11.5px; color: var(--ink-3); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat .lbl svg { width: 14px; height: 14px; }
.stat .val { font-size: 27px; font-weight: 700; letter-spacing: -1px; margin-top: 6px; line-height: 1; }
.stat .meta { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; }

/* ============ TABLES ============ */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: .1s; }
.tbl tbody tr:hover { background: var(--surface); }
.tbl .mono { font-family: var(--mono); font-size: 12px; }
.cell-edit { background: var(--warn-soft); border-radius: 4px; padding: 2px 6px; cursor: text; outline: 1px dashed var(--warn); display: inline-block; }
.bom-row-low td { background: rgba(245, 158, 11, .04); }
.bom-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.scan-card.bom-viewer { width: min(100%, 96vw); max-height: 96vh; min-height: 94vh; overflow: auto; text-align: left; }
.bom-viewer-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.bom-viewer-tab { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; cursor: pointer; }
.bom-viewer-tab.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.bom-viewer-frame { width: 100%; min-height: 420px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.bom-viewer-frame img { max-width: 100%; max-height: 70vh; object-fit: contain; }
.bom-viewer-frame iframe, .bom-viewer-frame embed { width: 100%; height: 70vh; border: none; }

/* ============ CATEGORY FILTER TABS ============ */
.bom-filter-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  padding-bottom: 2px;
}
.bom-filter-tab {
  padding: 8px 16px;
  border-radius: 8px 8px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease-in-out;
  margin-bottom: -3px;
}
.bom-filter-tab:hover {
  color: var(--ink);
  background: var(--surface);
}
.bom-filter-tab.disabled,
.bom-filter-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.5);
  display: none;
}
.bom-filter-tab.disabled:hover,
.bom-filter-tab:disabled:hover {
  background: transparent;
  color: var(--ink-3);
}
.bom-filter-tab.active {
  border-color: var(--line) var(--line) var(--paper);
  background: var(--paper);
  color: var(--accent);
  font-weight: 600;
  position: relative;
  z-index: 2;
}
.bom-filter-tab-badge {
  background: var(--surface);
  color: var(--ink-3);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 12px;
  font-weight: 600;
}
.bom-filter-tab.active .bom-filter-tab-badge {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ============ SUB TABS (inside module cards) ============ */
.bom-sub-tabs {
  display: inline-flex;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
}
.bom-sub-tab {
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease-in-out;
}
.bom-sub-tab:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.04);
}
.bom-sub-tab.active {
  background: #fff;
  color: var(--purple);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.bom-sub-tab-badge {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-3);
  font-weight: 600;
}
.bom-sub-tab.active .bom-sub-tab-badge {
  background: var(--purple-soft);
  color: var(--purple);
}

/* ============ FLOWBAR (top of modules) ============ */
.flowbar { display: flex; align-items: stretch; gap: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 22px; box-shadow: var(--shadow-sm); }
.flowstep { flex: 1; padding: 11px 12px; display: flex; align-items: center; gap: 9px; border-right: 1px solid var(--line); position: relative; cursor: pointer; transition: .13s; min-width: 0; }
.flowstep:last-child { border-right: none; }
.flowstep:hover { background: var(--surface); }
.flowstep .fs-num { width: 24px; height: 24px; border-radius: 7px; background: var(--surface); color: var(--ink-3); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex: 0 0 24px; }
.flowstep .fs-txt { min-width: 0; }
.flowstep .fs-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flowstep .fs-state { font-size: 10.5px; color: var(--ink-3); }
.flowstep.done .fs-num { background: var(--ok-soft); color: var(--ok); }
.flowstep.active { background: var(--accent-soft); }
.flowstep.active .fs-num { background: var(--accent); color: #fff; }
.flowstep.active .fs-name { color: var(--accent-deep); }

/* ============ UPLOAD DROPZONE ============ */
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); padding: 34px; text-align: center; transition: .16s; cursor: pointer; }
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .dz-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; box-shadow: var(--shadow-sm); }
.dropzone .dz-icon svg { width: 23px; height: 23px; color: var(--accent); }
.dropzone h4 { font-size: 15px; font-weight: 600; }
.dropzone p { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }

/* ============ FILE CHIPS ============ */
.filechip { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); margin-bottom: 7px; transition: .13s; }
.filechip:hover { border-color: var(--line-strong); }
.filechip .fc-ic { width: 32px; height: 32px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex: 0 0 32px; }
.filechip .fc-ic svg { width: 16px; height: 16px; }
.fc-pdf { background: var(--bad-soft); color: var(--bad); }
.fc-xls { background: var(--ok-soft); color: var(--ok); }
.fc-img { background: var(--blue-soft); color: var(--blue); }
.filechip .fc-name { font-weight: 500; font-size: 13px; }
.filechip .fc-meta { font-size: 11px; color: var(--ink-3); }
.filechip .fc-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.filechip.is-extracting {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-soft);
  position: relative;
  overflow: hidden;
}
.filechip.is-extracting::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, #3b82f6 100%);
  animation: pulseExtract 1.4s ease-in-out infinite alternate;
}
@keyframes pulseExtract {
  from { opacity: 0.4; }
  to { opacity: 1; }
}
.filechip.is-extracted {
  border-color: rgba(34, 197, 94, 0.35);
}
.scan-spin-sm {
  width: 13px;
  height: 13px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

/* ============ FORM ============ */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field label .req { color: var(--accent); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  transition: .13s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .hint { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ============ CLASSIFICATION GROUP HEADERS ============ */
.classgroup { margin-bottom: 14px; }
.classgroup-head { display: flex; align-items: center; gap: 9px; padding: 8px 0; font-weight: 600; font-size: 13px; }
.classgroup-head .cg-ic { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex: 0 0 26px; }
.classgroup-head .cg-ic svg { width: 14px; height: 14px; }
.cg-count { margin-left: auto; font-size: 11px; color: var(--ink-3); font-weight: 500; }

/* ============ EXTRACTION ANIMATION ============ */
.scan-overlay { position: absolute; inset: 0; background: rgba(26, 26, 23, .55); display: flex; align-items: center; justify-content: center; z-index: 50; border-radius: var(--radius-lg); }
.scan-card { background: var(--paper); border-radius: var(--radius-lg); padding: 26px 30px; box-shadow: var(--shadow-lg); width: 380px; text-align: center; }
.scan-spin { width: 42px; height: 42px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; margin: 0 auto 16px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.scan-log { text-align: left; font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); margin-top: 14px; max-height: 120px; overflow: hidden; }
.scan-log .ln { opacity: 0; animation: fadein .3s forwards; padding: 2px 0; display: flex; gap: 7px; align-items: center; }
.scan-log .ln svg { width: 12px; height: 12px; color: var(--ok); flex: 0 0 12px; }
@keyframes fadein { to { opacity: 1; } }

/* ============ PHONE MOCKUP ============ */
.device { width: 300px; flex: 0 0 300px; background: #1a1a17; border-radius: 32px; padding: 11px; box-shadow: var(--shadow-lg); position: relative; }
.device::before { content: ''; position: absolute; top: 20px; left: 50%; transform: translateX(-50%); width: 80px; height: 5px; background: #3a382f; border-radius: 3px; z-index: 5; }
.device-screen { background: var(--bg); border-radius: 24px; overflow: hidden; height: 600px; display: flex; flex-direction: column; }
.device-status { height: 30px; background: var(--paper); display: flex; align-items: center; justify-content: space-between; padding: 0 18px; font-size: 11px; font-weight: 600; color: var(--ink-2); flex: 0 0 30px; padding-top: 6px; }
.dev-app-head { background: var(--accent); color: #fff; padding: 12px 16px; flex: 0 0 auto; }
.dev-app-head .dah-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.dev-app-head .dah-sub { font-size: 11px; opacity: .85; margin-top: 2px; }
.dev-body { flex: 1; overflow-y: auto; padding: 14px; }
.dev-body::-webkit-scrollbar { width: 0; }

/* ============ CAMERA FRAME ============ */
.cam-frame { background: #23221d; border-radius: 14px; aspect-ratio: 3/4; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.cam-corner { position: absolute; width: 22px; height: 22px; border: 3px solid #fff; opacity: .85; }
.cam-corner.tl { top: 14px; left: 14px; border-right: none; border-bottom: none; border-radius: 5px 0 0 0; }
.cam-corner.tr { top: 14px; right: 14px; border-left: none; border-bottom: none; border-radius: 0 5px 0 0; }
.cam-corner.bl { bottom: 14px; left: 14px; border-right: none; border-top: none; border-radius: 0 0 0 5px; }
.cam-corner.br { bottom: 14px; right: 14px; border-left: none; border-top: none; border-radius: 0 0 5px 0; }
.cam-scan-line { position: absolute; left: 14px; right: 14px; height: 2px; background: #4aa3ff; box-shadow: 0 0 12px #4aa3ff; animation: scanmove 2.2s ease-in-out infinite; }
@keyframes scanmove { 0%, 100% { top: 18%; } 50% { top: 82%; } }
.cam-doc { background: #f0ede4; width: 78%; height: 86%; border-radius: 4px; transform: rotate(-1.5deg); padding: 11px; font-size: 6px; color: #999; line-height: 1.5; overflow: hidden; box-shadow: 0 8px 20px rgba(0, 0, 0, .4); }
.cam-doc .l { height: 3px; background: #d6d1c4; border-radius: 2px; margin-bottom: 4px; }

.dev-btn { width: 100%; padding: 13px; border-radius: 11px; background: var(--accent); color: #fff; font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: var(--shadow-sm); }
.dev-btn svg { width: 18px; height: 18px; }
.dev-btn.ghost { background: var(--paper); color: var(--ink-2); border: 1px solid var(--line); }
.dev-card { background: var(--paper); border: 1px solid var(--line); border-radius: 11px; padding: 13px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.dev-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 12.5px; border-bottom: 1px solid var(--line); }
.dev-row:last-child { border-bottom: none; }
.dev-row .k { color: var(--ink-3); }
.dev-row .v { font-weight: 600; font-family: var(--mono); font-size: 12px; }

/* ============ MATERIAL LABEL ============ */
.matlabel { background: #fff; border: 2px solid #1a1a17; border-radius: 5px; padding: 11px; font-family: var(--mono); position: relative; }
.matlabel .ml-co { font-weight: 700; font-size: 11px; letter-spacing: .04em; }
.matlabel .ml-code { font-size: 26px; font-weight: 700; letter-spacing: 1px; text-align: center; padding: 6px 0; border-top: 1px dashed #999; border-bottom: 1px dashed #999; margin: 7px 0; }
.matlabel .ml-row { display: flex; justify-content: space-between; font-size: 9.5px; padding: 1px 0; }
.matlabel .ml-barcode { height: 30px; margin-top: 8px; background: repeating-linear-gradient(90deg, #1a1a17 0, #1a1a17 2px, #fff 2px, #fff 3px, #1a1a17 3px, #1a1a17 4px, #fff 4px, #fff 6px); border-radius: 2px; }

/* ============ STAMP ============ */
.stamp { display: inline-block; border: 2.5px solid var(--ok); border-radius: 6px; padding: 9px 13px; color: var(--ok); transform: rotate(-4deg); font-family: var(--mono); background: rgba(45, 122, 68, .04); }
.stamp .st-t { font-weight: 700; font-size: 12px; letter-spacing: .04em; text-align: center; }
.stamp .st-r { font-size: 9.5px; display: flex; justify-content: space-between; gap: 14px; padding: 1px 0; }

/* ============ VALIDATION ROWS ============ */
.valrow { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; background: var(--paper); }
.valrow .vr-ic { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: 0 0 30px; }
.valrow .vr-ic svg { width: 16px; height: 16px; }
.valrow .vr-body { flex: 1; min-width: 0; }
.valrow .vr-name { font-weight: 600; font-size: 13px; }
.valrow .vr-detail { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.valrow .vr-val { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }

/* ============ SPEC LIBRARY CARDS ============ */
.speccard { border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; background: var(--paper); transition: .13s; }
.speccard:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.speccard .sc-code { font-family: var(--mono); font-weight: 600; font-size: 14px; color: var(--accent-deep); }
.speccard .sc-desc { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.speccard .sc-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.sc-tag { font-size: 10px; background: var(--surface); color: var(--ink-3); padding: 2px 7px; border-radius: 5px; font-family: var(--mono); }

/* ============ DATA BOOK CHECKLIST ============ */
.dbcat { margin-bottom: 10px; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--paper); }
.dbcat-head { padding: 12px 15px; display: flex; align-items: center; gap: 11px; cursor: pointer; transition: .1s; }
.dbcat-head:hover { background: var(--surface); }
.dbcat-head .dc-ic { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: 0 0 30px; }
.dbcat-head .dc-ic svg { width: 15px; height: 15px; }
.dbcat-head .dc-name { font-weight: 600; font-size: 13.5px; }
.dbcat-head .dc-meta { font-size: 11.5px; color: var(--ink-3); }
.dbcat-body { padding: 0 15px 8px 56px; }
.dbitem { display: flex; align-items: center; gap: 9px; padding: 7px 0; font-size: 12.5px; border-top: 1px solid var(--line); }
.dbitem .di-check { width: 18px; height: 18px; border-radius: 5px; display: flex; align-items: center; justify-content: center; flex: 0 0 18px; }
.dbitem .di-check svg { width: 12px; height: 12px; }
.di-ok { background: var(--ok-soft); color: var(--ok); }
.di-miss { background: var(--bad-soft); color: var(--bad); }
.dbitem .di-name { flex: 1; }
.dbitem .di-src { font-size: 10.5px; color: var(--ink-3); font-family: var(--mono); }

/* ============ CO-PILOT ============ */
.copilot-fab { position: fixed; bottom: 24px; right: 24px; width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-lg); z-index: 60; transition: .18s; }
.copilot-fab:hover { transform: scale(1.06); background: var(--accent-deep); }
.copilot-fab svg { width: 25px; height: 25px; }
.copilot-panel { position: fixed; bottom: 24px; right: 24px; width: 392px; height: 558px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); z-index: 61; display: none; flex-direction: column; overflow: hidden; }
.copilot-panel.open { display: flex; }
.cp-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; background: linear-gradient(135deg, #1d1c19, #2c2a25); color: #fff; }
.cp-avatar { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); display: flex; align-items: center; justify-content: center; flex: 0 0 34px; }
.cp-avatar svg { width: 19px; height: 19px; color: #fff; }
.cp-head .cp-t { font-weight: 600; font-size: 14px; }
.cp-head .cp-s { font-size: 11px; color: #b8b3a6; }
.cp-head .cp-close { margin-left: auto; width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; color: #cfc9bd; }
.cp-head .cp-close:hover { background: rgba(255, 255, 255, .12); }
.cp-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.cp-msg { max-width: 86%; padding: 10px 13px; border-radius: 13px; font-size: 13px; line-height: 1.5; }
.cp-msg.bot { background: var(--surface); color: var(--ink); align-self: flex-start; border-bottom-left-radius: 4px; }
.cp-msg.user { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.cp-msg.bot .cp-data { margin-top: 8px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--paper); }
.cp-msg.bot .cp-data .cdr { display: flex; justify-content: space-between; padding: 6px 10px; font-size: 11.5px; border-bottom: 1px solid var(--line); }
.cp-msg.bot .cp-data .cdr:last-child { border-bottom: none; }
.cp-msg.bot .cp-data .cdr .ck { color: var(--ink-3); }
.cp-msg.bot .cp-data .cdr .cv { font-family: var(--mono); font-weight: 600; font-size: 11px; }
.cp-typing { display: flex; gap: 4px; padding: 12px 14px; background: var(--surface); border-radius: 13px; align-self: flex-start; width: fit-content; }
.cp-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: typing 1.2s infinite; }
.cp-typing span:nth-child(2) { animation-delay: .2s; }
.cp-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typing {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}
.cp-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.cp-chip { font-size: 11.5px; padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: 18px; color: var(--ink-2); cursor: pointer; transition: .12s; background: var(--paper); }
.cp-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.cp-input { padding: 12px 14px; border-top: 1px solid var(--line); display: flex; gap: 9px; align-items: center; }
.cp-input input { flex: 1; padding: 10px 13px; border: 1px solid var(--line-strong); border-radius: 22px; background: var(--surface); }
.cp-input input:focus { outline: none; border-color: var(--accent); background: var(--paper); }
.cp-input button { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: 0 0 38px; }
.cp-input button svg { width: 17px; height: 17px; }

/* ============ MISC ============ */
.empty { text-align: center; padding: 46px 20px; color: var(--ink-3); }
.empty svg { width: 42px; height: 42px; color: var(--line-strong); margin-bottom: 12px; }
.empty h4 { font-size: 16px; color: var(--ink-2); font-weight: 600; }
.empty p { font-size: 13px; margin-top: 5px; max-width: 380px; margin-left: auto; margin-right: auto; }
.divider-txt { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 12px; margin: 18px 0; }
.divider-txt::before, .divider-txt::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.fade-in { animation: fadeUp .4s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1a1a17; color: #fff; padding: 12px 20px; border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 90; font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 9px; opacity: 0; transition: .28s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 16px; height: 16px; color: #4ade80; }
.link { color: var(--accent); cursor: pointer; font-weight: 500; }
.link:hover { text-decoration: underline; }
.tag-key { font-family: var(--mono); font-size: 11px; background: var(--blue-soft); color: var(--blue); padding: 2px 7px; border-radius: 5px; font-weight: 600; }
.tag-job { font-family: var(--mono); font-size: 11px; background: #1d1c19; color: #fff; padding: 2px 7px; border-radius: 5px; font-weight: 600; }
.progress-thin { height: 6px; border-radius: 4px; background: var(--surface); overflow: hidden; }
.progress-thin > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .8s; }

/* ============ SCROLLBARS ============ */
.content::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.cp-body::-webkit-scrollbar { width: 9px; }
.content::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.cp-body::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 5px; }
.content::-webkit-scrollbar-track { background: transparent; }

/* ============ AUTHENTICATION SCREEN ============ */
.auth-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 10% 20%, rgb(242, 239, 232) 0%, rgb(249, 248, 245) 90.1%);
  padding: 24px;
}
.auth-card {
  width: 440px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 36px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.auth-logo-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.auth-logo-header .logo {
  width: 46px;
  height: 46px;
  font-size: 26px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.auth-logo-header h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.auth-logo-header p {
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
}
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  font-weight: 600;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  font-size: 13px;
}
.auth-tab:hover {
  color: var(--ink);
}
.auth-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.auth-error {
  background: var(--bad-soft);
  color: var(--bad);
  border: 1px solid rgba(170, 38, 32, 0.2);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============ SPEC MODAL STYLES ============ */
.modal-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.modal-tab {
  padding: 10px 20px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  transition: .15s;
  cursor: pointer;
}
.modal-tab:hover {
  color: var(--ink-2);
}
.modal-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius) var(--radius) 0 0;
}
.chem-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}
.chem-table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.chem-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.chem-table .elem-label {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 12px;
  width: 100%;
  box-shadow: var(--shadow-sm);
  text-transform: capitalize;
}
.chem-table input {
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  width: 100%;
  font-size: 12px;
}
.chem-table input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ============ INTERACTIVE DOCUMENT ZOOM & PAN ============ */
.zoom-container {
  position: relative !important;
  overflow: hidden !important;
}

.zoom-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  transition: transform 0.05s ease-out;
  will-change: transform;
}

.zoom-wrapper img {
  pointer-events: none; /* Delegate drag capture to JS */
}

/* Grab handles for panning */
.zoom-wrapper.pan-mode {
  cursor: grab !important;
}
.zoom-wrapper.pan-mode:active,
.zoom-wrapper.dragging {
  cursor: grabbing !important;
}

/* Semi-transparent overlay to block iframe mouse swallow and capture pan drags */
.zoom-pan-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.01); /* intercept all events over iframes */
  z-index: 5;
  cursor: grab;
}
.zoom-pan-overlay:active {
  cursor: grabbing;
}

/* Elegant floating glassmorphic toolbar */
.zoom-toolbar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  border: 1px solid rgba(26, 26, 23, 0.12);
  border-radius: 30px;
  padding: 4px 6px;
  box-shadow: 0 8px 32px rgba(26, 26, 23, 0.08), 0 1px 2px rgba(26, 26, 23, 0.04);
  z-index: 10;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.zoom-toolbar:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(26, 26, 23, 0.2);
  transform: translateX(-50%) scale(1.03);
  box-shadow: 0 12px 38px rgba(26, 26, 23, 0.12);
}

.zoom-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  background: transparent;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
  cursor: pointer;
}

.zoom-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
  transform: scale(1.08);
}

.zoom-btn:active {
  transform: scale(0.92);
}

.zoom-btn.active {
  background: var(--accent);
  color: #fff !important;
  box-shadow: var(--shadow-sm);
}

.zoom-divider {
  width: 1px;
  height: 14px;
  background: var(--line-strong);
  margin: 0 4px;
}

.zoom-info {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  min-width: 38px;
  text-align: center;
  user-select: none;
}

/* ============ PO COMPARISON ROW STYLING ============ */
.match-row-ok:hover {
  background: rgba(45, 122, 68, 0.03) !important;
}
.match-row-warn {
  background: rgba(181, 124, 0, 0.015);
}
.match-row-warn:hover {
  background: rgba(181, 124, 0, 0.04) !important;
}
.match-row-err {
  background: rgba(170, 38, 32, 0.015);
}
.match-row-err:hover {
  background: rgba(170, 38, 32, 0.04) !important;
}

/* ============ BOM EXTRACTION PROGRESS BAR ============ */
.bom-progress-container {
  width: 100%;
  background: var(--surface);
  border-radius: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  margin-top: 14px;
  text-align: left;
  box-sizing: border-box;
}
.bom-progress-track {
  width: 100%;
  background: var(--line);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
  position: relative;
}
.bom-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #e1c070);
  width: 0%;
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.bom-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-2);
}

/* ============ DYNAMIC ROW DESCRIPTION TEXTAREA ============ */
textarea.row-desc,textarea.row-size {
  width: 100%;
  height: 31px;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 12.5px;
  background: #fff;
  resize: none;
  overflow: hidden;
  display: block;
  box-sizing: border-box;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: min-height 0.2s ease, max-height 0.2s ease, height 0.2s ease, box-shadow 0.15s ease;
}

textarea.row-desc:focus,textarea.row-size:focus {
  min-height: 80px;
  max-height: 250px;
  overflow-y: auto;
  white-space: normal;
  word-break: break-word;
  resize: vertical;
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
  outline: none;
}

/* ============ BACKGROUND UPLOAD INDICATOR BADGE ============ */
/* ============ BACKGROUND UPLOAD INDICATOR BADGE ============ */
#bg-upload-container {
  display: none !important;
  pointer-events: none;
}

.bg-upload-pill {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  animation: slideUpIn 0.3s ease;
  min-width: 300px;
}

.bg-upload-header {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.bg-upload-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  overflow: hidden;
}

.bg-upload-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bg-upload-progress-track {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}

.bg-upload-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #3b82f6 100%);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.bg-upload-subtext {
  font-size: 11.5px;
  color: var(--ink-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.module-bg-task-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  margin-bottom: 16px;
  animation: slideUpIn 0.25s ease;
}

.module-bg-task-banner .banner-text {
  flex: 1;
  font-size: 13px;
  color: var(--ink);
}

.module-bg-task-banner .banner-sub {
  font-size: 11.5px;
  color: var(--ink-2);
  margin-top: 2px;
}

@keyframes slideUpIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============ CONNECTED DRAGGABLE LISTS FOR RECEIVING DOCUMENT SPLIT ============ */
.connected-lists-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 20px;
  margin-top: 18px;
  align-items: stretch;
  width: 100%;
}

@media (max-width: 768px) {
  .connected-lists-grid {
    grid-template-columns: 1fr !important;
  }
}

.drag-column {
  background: var(--surface);
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-lg, 12px);
  padding: 16px;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
}

.drag-column.drag-over {
  background: var(--accent-soft, #f0f7ff);
  border-color: var(--accent, #0284c7);
  border-style: solid;
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.15);
}

.drag-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.drag-column-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}

.drag-column-count {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
}

.drag-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 400px;
  padding: 4px;
}

.drag-list-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-3);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(0,0,0,0.01);
  font-size: 13px;
}

.doc-card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: grab;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  width: 100%;
  box-sizing: border-box;
}

.doc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.doc-card.dragging {
  opacity: 0.4;
  cursor: grabbing;
  transform: scale(0.98);
  border-color: var(--accent);
}

.doc-card-handle {
  color: var(--ink-3);
  cursor: grab;
  display: flex;
  align-items: center;
  padding-top: 2px;
}

.doc-card-thumb {
  width: 54px;
  height: 70px;
  border-radius: 6px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #f8fafc;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.doc-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.doc-card-content {
  flex: 1;
  min-width: 0;
}

.doc-card-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-card-snippet {
  font-size: 11.5px;
  color: var(--ink-2);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}

.doc-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.doc-card-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.doc-card-badge.badge-matlog {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.doc-card-badge.badge-mtr {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #d8b4fe;
}

.doc-card-move-btn {
  font-size: 11px;
  padding: 2px 8px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.doc-card-move-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--ink-2);
}

.extract-action-bar {
  position: sticky;
  bottom: 20px;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.12);
  margin-top: 24px;
  backdrop-filter: blur(10px);
}

/* ============ DOCUMENT CONFIDENCE SCORE & FIELD FLAGGING ============ */
.conf-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.conf-badge-pill svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Green for >= 90% */
.conf-badge-green {
  background-color: #ecfdf5 !important;
  color: #065f46 !important;
  border: 1.5px solid #10b981 !important;
}
.conf-badge-green svg {
  stroke: #059669;
}

/* Yellow warning for < 90% */
.conf-badge-yellow {
  background-color: #fffbeb !important;
  color: #92400e !important;
  border: 1.5px solid #f59e0b !important;
  animation: pulse-yellow 2.5s infinite;
}
.conf-badge-yellow svg {
  stroke: #d97706;
}

@keyframes pulse-yellow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.3);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
  }
}

/* Form Top Banners (Hidden per user request) */
.conf-form-banner {
  display: none !important;
}

.conf-form-banner.banner-green {
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.conf-form-banner.banner-yellow {
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.conf-form-banner svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ============ CONFIDENCE THRESHOLD BAR ON EDIT PAGES ============ */
.confidence-threshold-bar {
  background: var(--surface-soft, #f8fafc);
  border: 1.5px solid var(--line, #e2e8f0);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  transition: all 0.2s ease;
}

.conf-thresh-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.conf-thresh-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.conf-thresh-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft, #e0e7ff);
  color: var(--accent, #4f46e5);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(79, 70, 229, 0.22);
}

.conf-thresh-badge strong {
  color: var(--accent, #4338ca);
}

.conf-thresh-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.conf-preset-btns {
  display: inline-flex;
  gap: 3px;
  background: var(--surface, #f1f5f9);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--line, #e2e8f0);
}

.conf-preset-btn {
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--ink-2, #475569);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.conf-preset-btn:hover {
  background: rgba(0,0,0,0.06);
  color: var(--ink, #0f172a);
}

.conf-preset-btn.active {
  background: var(--ink, #0f172a) !important;
  color: #fff !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.conf-thresh-slider {
  accent-color: var(--accent, #4f46e5);
  cursor: pointer;
  height: 4px;
}

.conf-thresh-input {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  border: 1px solid var(--line-strong, #cbd5e1);
  border-radius: 4px;
  background: #fff;
  color: var(--ink, #1e293b);
  width: 46px;
  height: 24px;
  padding: 2px 4px;
}

.conf-thresh-input:focus {
  outline: none;
  border-color: var(--accent, #4f46e5);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

/* Field-level confidence badges */
.field-conf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
  vertical-align: middle;
  line-height: 1.2;
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
}

.field-conf-badge.conf-badge-green {
  background-color: #ecfdf5 !important;
  color: #065f46 !important;
  border: 1px solid #a7f3d0 !important;
}

.field-conf-badge.conf-badge-green svg {
  width: 11px;
  height: 11px;
  stroke: #059669;
}

.field-conf-badge.conf-badge-yellow {
  background-color: #fffbeb !important;
  color: #92400e !important;
  border: 1px solid #fde68a !important;
}

.field-conf-badge.conf-badge-yellow svg {
  width: 11px;
  height: 11px;
  stroke: #d97706;
}

/* Field-level warnings for < 90% */
.low-conf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  margin-left: 6px;
  vertical-align: middle;
}

.low-conf-helper {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #b45309;
  font-size: 11px;
  margin-top: 4px;
  font-weight: 500;
}

.low-conf-helper svg {
  width: 12px;
  height: 12px;
  stroke: #d97706;
}

.low-conf-input,
input.low-conf-input,
select.low-conf-input,
textarea.low-conf-input {
  border: 1.5px solid #f59e0b !important;
  background-color: #fffdf5 !important;
}

.input-verified,
input.input-verified,
select.input-verified,
textarea.input-verified {
  border-color: #10b981 !important;
  background-color: #f0fdf4 !important;
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  margin-left: 6px;
  vertical-align: middle;
}

/* ============ BUG TRACKER & STATUS TABLE ============ */
.dash-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.metric-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.metric-card .mc-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  margin-bottom: 6px;
}

.metric-card .mc-val {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.1;
  color: var(--ink);
}

.metric-card .mc-sub {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

#bugs-table-body tr {
  transition: background-color 0.12s ease;
}

#bugs-table-body tr:hover {
  background: var(--surface);
}

.b-purple {
  background: var(--purple-soft);
  color: var(--purple);
}

.severity-pill-critical {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.severity-pill-high {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.severity-pill-medium {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.severity-pill-low {
  background: var(--surface);
  color: var(--ink-3);
  border: 1px solid var(--line);
}

#app-error-modal {
  animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Hide floating bottom-right background task widget completely */
#bg-upload-container {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}



