/* ── CDS Sample Tracker V2 — Design System ── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #1e2f3e;
  --surface:   #2d3e50;
  --surface2:  #1a2b3a;
  --border:    rgba(255,255,255,0.09);
  --text:      #dce6ef;
  --muted:     #8fa5b8;
  --dim:       #4a6070;
  --accent:    #e8722a;
  --accent-bg: rgba(232,114,42,0.12);
  --accent-bd: rgba(232,114,42,0.35);
  --green:     #27ae60;
  --green-bg:  rgba(39,174,96,0.12);
  --blue:      #2980b9;
  --blue-bg:   rgba(41,128,185,0.12);
  --purple:    #8e44ad;
  --purple-bg: rgba(142,68,173,0.12);
  --red:       #c0392b;
  --red-bg:    rgba(192,57,43,0.10);
  --amber:     #e67e22;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Typography ── */
h1, h2, h3 { font-weight: 600; color: var(--text); }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 13px; }
p, span, label { color: var(--muted); font-size: 13px; }
code { font-family: 'Courier New', monospace; font-size: 11px; background: rgba(255,255,255,0.07); padding: 1px 5px; border-radius: 3px; }

/* ── Navigation ── */
.nav {
  background: var(--surface2);
  border-bottom: 1px solid rgba(0,0,0,0.25);
  padding: 0 20px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand { font-size: 15px; font-weight: 600; }
.nav-brand span { color: var(--accent); }
.nav-links { display: flex; gap: 2px; }
.nav-link {
  color: var(--muted);
  background: transparent;
  border: none;
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.nav-link:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-link.active { color: var(--accent); background: var(--accent-bg); }
.nav-meta { display: flex; align-items: center; gap: 9px; }
.dept-badge {
  font-size: 11px;
  background: var(--accent-bg);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 14px;
  border: 1px solid var(--accent-bd);
}
.dept-badge.creative {
  background: var(--purple-bg);
  color: var(--purple);
  border-color: rgba(142,68,173,0.3);
}
.voice-badge {
  font-size: 11px;
  background: var(--purple-bg);
  color: var(--purple);
  padding: 2px 9px;
  border-radius: 14px;
  border: 1px solid rgba(142,68,173,0.3);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
}
.status-dot.offline { background: var(--red); }

/* ── Tabs ── */
.tabs {
  background: var(--surface2);
  border-bottom: 1px solid rgba(0,0,0,0.2);
  padding: 0 20px;
  display: flex;
  gap: 0;
}
.tab-btn {
  padding: 10px 16px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color .15s;
}
.stat-card:hover { border-color: rgba(255,255,255,0.2); }
.stat-card.active { border-color: var(--accent); background: rgba(232,114,42,0.05); }
.stat-card.p1 { border-color: rgba(192,57,43,0.4); }
.stat-card.p1.active { border-color: var(--red); background: rgba(192,57,43,0.07); }
.stat-number { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 3px; text-transform: uppercase; letter-spacing: .05em; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #d4621e; }
.btn-secondary { background: rgba(255,255,255,0.06); border-color: var(--border); color: var(--muted); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.btn-danger { background: rgba(192,57,43,0.1); border-color: rgba(192,57,43,0.35); color: #e57373; }
.btn-sm { padding: 5px 11px; font-size: 11px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Form inputs ── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--dim); }
select.input { cursor: pointer; }

/* ── Tables ── */
.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th { color: var(--dim); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table td { padding: 9px 12px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.table tr:hover td { background: rgba(255,255,255,0.02); }
.sku-mono { font-family: 'Courier New', monospace; font-size: 11px; color: var(--text); }


/* ── Priority badges ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; }
.badge.p1 { background: rgba(192,57,43,0.15); color: #e57373; }
.badge.p2 { background: rgba(232,114,42,0.15); color: var(--accent); }
.badge.p3, .badge.p4 { background: rgba(41,128,185,0.15); color: #5dade2; }
.badge.yes { background: rgba(39,174,96,0.15); color: var(--green); }
.badge.no  { background: rgba(255,255,255,0.07); color: var(--dim); }

/* ── Scanner-specific ── */
.scan-input-wrap {
  background: var(--surface2);
  border: 1px solid rgba(39,174,96,0.4);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.scan-input-wrap.mode-deliver { border-color: rgba(41,128,185,0.5); }
.scan-input-wrap.mode-collect { border-color: rgba(142,68,173,0.5); }
.scan-input-wrap.mode-out { border-color: rgba(192,57,43,0.5); }
.scan-input {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  flex: 1;
  outline: none;
  font-family: inherit;
}
.mode-btn {
  flex: 1;
  padding: 12px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--dim);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.mode-btn.active-in   { border-color: var(--green);  background: var(--green-bg);  color: var(--green);  font-weight: 600; }
.mode-btn.active-deliver { border-color: var(--blue); background: var(--blue-bg); color: var(--blue); font-weight: 600; }
.mode-btn.active-collect { border-color: var(--purple); background: var(--purple-bg); color: var(--purple); font-weight: 600; }
.mode-btn.active-out  { border-color: var(--red);   background: var(--red-bg);   color: #e57373; font-weight: 600; }

/* ── Error flash overlay ── */
#err-overlay {
  display: none;
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
}
#err-overlay.flash {
  display: block;
  animation: errflash .7s ease-out forwards;
}
@keyframes errflash {
  0%   { background: rgba(192,57,43,0.45); }
  100% { background: transparent; }
}

/* ── Error banner ── */
#err-banner {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--red);
  color: white;
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 500;
  z-index: 1000;
  align-items: center;
  gap: 9px;
}

/* ── Confirm flash ── */
.scan-confirm {
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; } }

/* ── Recent scans ── */
.recent-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 7px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.recent-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; }

/* ── Shelf mode panel ── */
.shelf-panel {
  background: var(--surface2);
  border: 1px solid var(--accent-bd);
  border-radius: 9px;
  padding: 13px 15px;
}

/* ── Command barcode card ── */
.cmd-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 13px 12px;
  text-align: center;
  flex: 1;
  min-width: 120px;
}

/* ── Login page ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 40px;
  width: 100%;
  max-width: 380px;
}
.login-logo {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}
.login-logo span { color: var(--accent); }
.login-sub { font-size: 13px; color: var(--muted); margin-bottom: 28px; }

/* ── Modal ── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
  width: 100%;
  max-width: 460px;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

/* ── Label grid (barcode generator) ── */
.label-card {
  background: white;
  border-radius: 5px;
  padding: 10px 8px 8px;
  text-align: center;
}
.label-sku { font-family: 'Courier New', monospace; font-size: 10px; color: #666; margin: 4px 0 2px; }
.label-desc { font-size: 11px; font-weight: 600; color: #000; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Activity feed ── */
.activity-item { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 8px; }
.activity-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }

/* ── Drill-down panel ── */
.drill-panel { display: none; background: var(--surface2); border-radius: 0 0 10px 10px; overflow: hidden; }
.drill-panel.open { display: block; }

/* ── Photo preview ── */
.photo-panel { background: var(--surface2); border-radius: 7px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.photo-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .desktop-only { display: none !important; }
}
@media (min-width: 641px) {
  .mobile-only { display: none !important; }
}

/* ── Broadcast banner ── */
.broadcast-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  position: sticky;
  top: 48px;
  z-index: 90;
  border-bottom: 2px solid transparent;
  transition: background .2s;
}

/* ── Utilities ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.w-full { width: 100%; }
.text-sm { font-size: 11px; }
.text-xs { font-size: 10px; }
.label-row { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .07em; }
.hidden { display: none !important; }
