/* ═══════════════════════════════════════════════════════════════════════════
   BCC design system (2026-10 redesign)
   One palette for every page: desktop shell, the pages that define their own
   :root tokens (Browsers, Login Monitor, ID Manager, Basilisk) and mobile.
   `html:root` (higher specificity than `:root`) so these values win over the
   per-page :root blocks no matter where those appear in the document.
   Status colours carry meaning only: green ok · amber waiting · red problem.
   ═══════════════════════════════════════════════════════════════════════════ */

html:root {
  /* surfaces */
  --c-bg:        #0b0d12;
  --c-surface:   #12151c;
  --c-surface-2: #171b24;
  --c-surface-3: #1e2330;
  --c-line:      #252b39;
  --c-line-2:    #313a4e;

  /* text */
  --c-text:   #e8ebf2;
  --c-text-2: #a2aabd;
  --c-text-3: #6a7388;
  --c-text-4: #454d60;

  /* brand + status */
  --c-accent:      #5b8cff;
  --c-accent-2:    #3f72f0;
  --c-accent-soft: rgba(91, 140, 255, 0.14);
  --c-green:  #2fd27e;  --c-green-soft:  rgba(47, 210, 126, 0.13);
  --c-amber:  #f5b23d;  --c-amber-soft:  rgba(245, 178, 61, 0.13);
  --c-red:    #ff5c5c;  --c-red-soft:    rgba(255, 92, 92, 0.13);
  --c-purple: #a78bfa;  --c-purple-soft: rgba(167, 139, 250, 0.13);
  --c-cyan:   #22d3ee;
  --c-orange: #fb923c;
  --c-yellow: #facc15;

  /* shape + type */
  --r-lg: 14px; --r-md: 10px; --r-sm: 7px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.35), 0 0 0 1px var(--c-line);
  --shadow-2: 0 8px 24px rgba(0,0,0,.35), 0 0 0 1px var(--c-line);
  --f-ui:   "Inter", "Segoe UI", system-ui, -apple-system, "Noto Sans", sans-serif;
  --f-mono: "JetBrains Mono", "Fira Code", ui-monospace, "DejaVu Sans Mono", monospace;

  /* ── aliases: main.css names ── */
  --bg-base: var(--c-bg);       --bg-panel: var(--c-surface);   --bg-panel-alt: var(--c-surface-2);
  --bg-input: var(--c-surface-3); --bg-hover: var(--c-surface-3);
  --border: var(--c-line);      --border-light: var(--c-line-2);
  --text-primary: var(--c-text); --text-secondary: var(--c-text-2);
  --text-muted: var(--c-text-3); --text-dim: var(--c-text-4);
  --accent: var(--c-accent);    --accent-hover: var(--c-accent-2); --accent-glow: var(--c-accent-soft);
  --green: var(--c-green);      --green-dim: var(--c-green-soft);
  --amber: var(--c-amber);      --amber-dim: var(--c-amber-soft);
  --red: var(--c-red);          --red-dim: var(--c-red-soft);
  --blue: var(--c-accent);      --blue-dim: var(--c-accent-soft);
  --purple: var(--c-purple);    --purple-dim: var(--c-purple-soft);
  --radius-sm: var(--r-sm);     --radius: var(--r-md);           --radius-lg: var(--r-lg);
  --font-ui: var(--f-ui);       --font-mono: var(--f-mono);
  --shadow-panel: var(--shadow-1);

  /* ── aliases: per-page :root names (browser_control, login_monitor,
        creds_manager, basilisk, mobile) ── */
  --bg: var(--c-bg);  --panel: var(--c-surface);  --panel2: var(--c-surface-2);
  --border2: var(--c-line-2);
  --text: var(--c-text);  --muted: var(--c-text-2);  --dim: var(--c-text-3);
  --orange: var(--c-orange);  --yellow: var(--c-yellow);  --cyan: var(--c-cyan);
  --green-glow: var(--c-green-soft);  --blue-glow: var(--c-accent-soft);
  --amber-glow: var(--c-amber-soft);  --red-glow: var(--c-red-soft);  --purple-glow: var(--c-purple-soft);
  --font: var(--f-ui);
}

/* ── Base ─────────────────────────────────────────────────────────────── */
html body { background: var(--c-bg); color: var(--c-text); font-family: var(--f-ui);
            -webkit-font-smoothing: antialiased; }
/* Solid, high-contrast highlight so Ctrl+A / line selection inside inputs,
   textareas and code boxes is obvious (the old 14% tint was near-invisible). */
html body ::selection { background: #3f72f0; color: #fff; }
html body ::-moz-selection { background: #3f72f0; color: #fff; }
html body :focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
html body * { scrollbar-width: thin; scrollbar-color: var(--c-line-2) transparent; }
html body *::-webkit-scrollbar { width: 9px; height: 9px; }
html body *::-webkit-scrollbar-thumb { background: var(--c-line-2); border-radius: 9px; border: 2px solid var(--c-bg); }
html body *::-webkit-scrollbar-track { background: transparent; }
code, kbd, .mono { font-family: var(--f-mono); }

/* ── Shared components (desktop pages) ────────────────────────────────── */
html body .panel, html body .card {
  background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg);
  box-shadow: 0 1px 0 rgba(255,255,255,.02) inset;
}
html body .card-title, html body .panel-title {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c-text-3);
}
html body .page-header { margin-bottom: 18px; }
html body .page-title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
html body .page-sub { color: var(--c-text-3); font-size: 13px; }

html body .btn, html body .lg-btn, html body .cmd-btn, html body .top-btn {
  border-radius: var(--r-sm); font-family: var(--f-ui); font-weight: 600;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}
html body .btn:active, html body .lg-btn:active, html body .cmd-btn:active { transform: translateY(1px); }
html body .btn-ghost, html body .lg-btn-ghost {
  background: transparent; border: 1px solid var(--c-line-2); color: var(--c-text-2);
}
html body .btn-ghost:hover, html body .lg-btn-ghost:hover { background: var(--c-surface-3); color: var(--c-text); }

html body .field-input, html body .url-input, html body .cred-input, html body .inp, html body .search,
html body select.field-input {
  background: var(--c-surface-2); border: 1px solid var(--c-line); color: var(--c-text);
  border-radius: var(--r-sm); font-family: var(--f-ui);
}
html body .field-input:focus, html body .url-input:focus, html body .cred-input:focus, html body .inp:focus {
  border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); outline: none;
}

html body .pc-tab { border-radius: 999px; }
html body .pc-tab.active { background: var(--c-accent-soft); border-color: var(--c-accent); color: var(--c-text); }

html body table th { color: var(--c-text-3); font-weight: 600; }

/* ── App shell: top status bar ────────────────────────────────────────── */
.appbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 14px;
  height: 50px; padding: 0 22px; margin: -28px -28px 22px;   /* full-bleed inside .main-content padding */
  background: rgba(11, 13, 18, .82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--c-line);
}
.appbar .ab-title { font-weight: 700; font-size: 14px; letter-spacing: .01em; }
.appbar .ab-pcs { display: flex; gap: 6px; }
.appbar .ab-pc {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--c-surface-2); border: 1px solid var(--c-line); font-size: 12px; font-weight: 600; color: var(--c-text-2);
}
.appbar .ab-pc i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-text-4); }
.appbar .ab-pc.up i { background: var(--c-green); box-shadow: 0 0 0 3px var(--c-green-soft); }
.appbar .ab-pc.down i { background: var(--c-red); box-shadow: 0 0 0 3px var(--c-red-soft); }
.appbar .ab-pc small { color: var(--c-text-3); font-weight: 500; }
.appbar .ab-spacer { flex: 1; }
.appbar .ab-win {
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: var(--c-surface-2); border: 1px solid var(--c-line); color: var(--c-text-3);
}
.appbar .ab-win.live { color: #0b0d12; background: var(--c-green); border-color: var(--c-green); }
.appbar .ab-win.soon { color: #0b0d12; background: var(--c-amber); border-color: var(--c-amber); }
.appbar .ab-clock { font-family: var(--f-mono); font-size: 15px; font-weight: 600; color: var(--c-text); min-width: 96px; text-align: right; }
html body .main-content { max-width: 1480px; }
@media (max-width: 768px) { .appbar { margin: -12px -12px 14px; } }
@media (max-width: 400px) { .appbar { margin: -10px -10px 12px; } }
@media (max-width: 900px) {
  .appbar { gap: 8px; padding: 0 12px; }
  .appbar .ab-title, .appbar .ab-pc small { display: none; }
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */
html body .sidebar { background: #0e1016; border-right: 1px solid var(--c-line); }
html body .sidebar-logo .logo-icon { color: var(--c-accent); }
html body .nav-section-label {
  padding: 18px 20px 6px; font-size: 10px; font-weight: 700; letter-spacing: .12em; color: var(--c-text-4); opacity: 1;
}
html body .nav-divider { display: none; }
html body .nav-item {
  margin: 1px 10px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--c-text-2); font-size: 13.5px;
}
html body .nav-item:hover { background: var(--c-surface-2); color: var(--c-text); }
html body .nav-item.active {
  background: var(--c-accent-soft); color: var(--c-text);
  box-shadow: inset 2px 0 0 var(--c-accent);
}
html body .nav-item.active .nav-icon { color: var(--c-accent); }
html body .nav-badge { background: var(--c-surface-3); color: var(--c-text-2); }
html body .nav-badge.green { background: var(--c-green-soft); color: var(--c-green); }

/* ── Mobile page (mobile.html) ────────────────────────────────────────── */
html body .mob-header {
  background: rgba(11, 13, 18, .86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--c-line);
}
html body .mob-card {
  background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg);
}
html body .mob-card-title {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c-text-3);
}
html body .mob-input, html body .mob-select {
  background: var(--c-surface-2); border: 1px solid var(--c-line); border-radius: var(--r-sm); color: var(--c-text);
}
html body .mob-input:focus, html body .mob-select:focus { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); }
html body .mob-btn, html body .mob-bigbtn { border-radius: var(--r-md); font-weight: 600; }
html body .drawer, html body .mob-drawer { background: #0e1016; }
html body .nav-link.active { background: var(--c-accent-soft); color: var(--c-text); }

/* Bottom tab bar (mobile) */
.mtabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: rgba(14, 16, 22, .94); backdrop-filter: blur(12px); border-top: 1px solid var(--c-line);
}
.mtabbar button {
  flex: 1; background: none; border: 0; color: var(--c-text-3); font: 600 10.5px var(--f-ui);
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; border-radius: var(--r-sm);
}
.mtabbar button svg { width: 21px; height: 21px; }
.mtabbar button.on { color: var(--c-accent); }
.mtabbar button .dot { position: absolute; margin-left: 18px; margin-top: -2px; width: 8px; height: 8px;
                       border-radius: 50%; background: var(--c-green); display: none; }
.mtabbar button.alert .dot { display: block; }
body.has-mtabbar .mob-content { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }

/* ── Highlight tags: mobile number / vehicle / stockyard ─────────────────── */
.hl-phone, .hl-veh, .hl-yard {
  display: inline-block; padding: 1px 7px; border-radius: 6px; font-weight: 700;
  font-family: var(--f-mono); font-size: .95em; letter-spacing: .01em; white-space: nowrap;
}
.hl-phone { background: rgba(91, 140, 255, .18); color: #9bbcff; border: 1px solid rgba(91, 140, 255, .45); }
.hl-veh   { background: rgba(250, 204, 21, .16); color: #fde047; border: 1px solid rgba(250, 204, 21, .45); }
.hl-yard  { background: rgba(34, 211, 238, .14); color: #67e8f9; border: 1px solid rgba(34, 211, 238, .4);
            font-family: var(--f-ui); white-space: normal; }
