/* ============================================================================
   Telecom Operator Intelligence Workbench — Terminal & Consulting Design System
   Restrained Palette · Hairline Grid · Zero Box-in-Box Clutter · McKinsey Charts
   ============================================================================ */

:root {
  --bg: #ffffff;
  --surface: #f8fafc;
  --surface-2: #f1f5f9;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --navy: #142d55;
  --navy-hover: #1d3f75;
  --navy-soft: #eef3f9;
  --blue: #2563eb;
  --steel: #2e75b6;

  --teal: #0f766e;
  --teal-bg: #f0fdfa;
  --amber: #b45309;
  --amber-bg: #fffbeb;
  --red: #b91c1c;
  --red-bg: #fef2f2;

  --font: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Menlo", "Consolas", monospace;
  --topbar-h: 54px;
  --radius: 6px;
  --radius-lg: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink-2); }
body {
  font: 13.5px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4, p { margin: 0; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--steel); outline-offset: 2px; }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.skip-link {
  position: fixed; top: -60px; left: 12px; z-index: 200;
  background: var(--navy); color: #fff; padding: 8px 14px; border-radius: var(--radius);
}
.skip-link:focus { top: 10px; }

.ico { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ico svg { width: 15px; height: 15px; }

/* ----------------------------------------------------------------------------
   Top Terminal Bar
   ---------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 24px;
}
.topbar-left { display: flex; align-items: center; gap: 28px; min-width: 0; height: 100%; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none !important; flex-shrink: 0; }
.brand-emblem {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--navy); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px; letter-spacing: .04em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 14px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.brand-meta { font-size: 9.5px; font-weight: 600; letter-spacing: .08em; color: var(--muted); }

.topnav { display: flex; align-items: stretch; gap: 6px; height: 100%; }
.nav-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0 12px; height: 100%;
  font-size: 13px; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color .14s ease, border-color .14s ease;
  text-decoration: none !important; white-space: nowrap;
}
.nav-tab:hover { color: var(--ink); }
.nav-tab.active { color: var(--navy); font-weight: 700; border-bottom-color: var(--navy); }
.nav-tab .pill-count { margin-left: 2px; }

.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.cmd-trigger {
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 10px 0 11px; min-width: 240px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--muted); font-size: 12.5px;
  transition: border-color .14s ease, background .14s ease;
}
.cmd-trigger:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--ink); }
.cmd-placeholder { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-trigger kbd {
  padding: 1px 6px; border: 1px solid var(--border-strong); border-radius: 4px;
  background: #fff; font-size: 10.5px; font-weight: 600; color: var(--muted);
}

.pill-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--navy-soft); color: var(--navy);
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------------------------
   Buttons, Badges, Segmented Pills, Custom Select
   ---------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px; border-radius: var(--radius);
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
  border: 1px solid var(--border-strong); background: #fff; color: var(--ink);
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  text-decoration: none !important;
}
.btn:hover { background: var(--surface); border-color: #94a3b8; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 12px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 11.5px; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--navy-hover); border-color: var(--navy-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--ink); }
.btn-danger { color: var(--red); border-color: #fecaca; background: #fff; }
.btn-danger:hover { background: var(--red-bg); border-color: #fca5a5; }
.icon-btn {
  width: 32px; height: 32px; border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); transition: background .12s ease, color .12s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 4px;
  font-size: 11.5px; font-weight: 500; line-height: 1.5;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.badge-navy { background: var(--navy-soft); color: var(--navy); font-weight: 600; }
.badge-teal { background: var(--teal-bg); color: var(--teal); font-weight: 600; }
.badge-amber { background: var(--amber-bg); color: var(--amber); font-weight: 600; }
.badge-red { background: var(--red-bg); color: var(--red); font-weight: 600; }
.badge-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--muted); }

.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot.active { background: var(--teal); }
.status-dot.unconfirmed { background: #d97706; }
.status-dot.merged, .status-dot.ceased { background: var(--muted-2); }
.status-dot.reporting_entity { background: var(--steel); }

/* Segmented Control */
.seg {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px;
  background: var(--surface-2); border-radius: var(--radius); border: 1px solid var(--border);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg-btn {
  padding: 5px 10px; border-radius: 4px; font-size: 12px; font-weight: 500;
  color: var(--muted); white-space: nowrap; transition: background .12s ease, color .12s ease;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-pressed="true"], .seg-btn.active {
  background: #fff; color: var(--navy); font-weight: 700;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}

/* Form Inputs & Custom Hairline Select */
input[type="text"], input[type="search"], input[type="number"], input[type="date"], input[type="url"], textarea, select.native-clean {
  width: 100%; min-height: 34px; padding: 6px 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: #fff; color: var(--ink); font-size: 13px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, textarea:focus, select.native-clean:focus {
  border-color: var(--steel); box-shadow: 0 0 0 3px rgba(46, 117, 182, .12); outline: none;
}
select.native-clean {
  appearance: none; -webkit-appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.search-input {
  padding-left: 30px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m16.5 16.5 4 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 9px center;
}
.field-label { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }

.cselect { position: relative; display: inline-block; min-width: 140px; }
.cselect-btn {
  width: 100%; height: 34px; padding: 0 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius);
  font-size: 12.5px; font-weight: 500; color: var(--ink); text-align: left;
}
.cselect-btn:hover { border-color: #94a3b8; }
.cselect.open .cselect-btn { border-color: var(--steel); box-shadow: 0 0 0 3px rgba(46, 117, 182, .12); }
.cselect-btn .chev { width: 14px; height: 14px; color: var(--muted); transition: transform .14s ease; flex-shrink: 0; }
.cselect.open .cselect-btn .chev { transform: rotate(180deg); }
.cselect-menu {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: min(380px, 90vw);
  max-height: 290px; overflow-y: auto; z-index: 60;
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 4px;
  box-shadow: 0 14px 36px -6px rgba(15, 23, 42, .16);
  display: none;
}
.cselect.open .cselect-menu { display: block; }
.cselect-opt {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 10px; border-radius: 5px; text-align: left; font-size: 12.5px; color: var(--ink);
}
.cselect-opt:hover { background: var(--surface-2); }
.cselect-opt.active { background: var(--navy-soft); color: var(--navy); font-weight: 600; }
.cselect-opt.dim { color: var(--muted); }

/* Check toggle pill */
.toggle-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 10px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: #fff;
  font-size: 12px; font-weight: 500; color: var(--ink-2);
  transition: all .12s ease; white-space: nowrap;
}
.toggle-chip:hover { border-color: #94a3b8; background: var(--surface); }
.toggle-chip.active, .toggle-chip[aria-pressed="true"] {
  background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600;
}

/* ----------------------------------------------------------------------------
   Workspace Layout & Open Editorial Grids (No Box-in-Box)
   ---------------------------------------------------------------------------- */
.workspace {
  max-width: 1480px;
  margin: 0 auto;
  padding: 20px 28px 64px;
  min-height: calc(100dvh - var(--topbar-h));
}

.view-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.kicker {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--steel); margin-bottom: 4px;
}
.view-head h1 { font-size: 22px; font-weight: 700; color: var(--ink); letter-spacing: -.015em; line-height: 1.25; }
.view-sub { margin-top: 4px; font-size: 13px; color: var(--muted); }

/* Control / Filter Strip */
.control-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.control-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }

/* Region Selector Ribbon */
.region-ribbon {
  display: flex; align-items: stretch; gap: 0; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--border); background: var(--surface);
  margin: 0 -28px; padding: 0 28px;
}
.region-ribbon::-webkit-scrollbar { display: none; }
.reg-pill {
  display: flex; flex-direction: column; justify-content: center;
  padding: 10px 16px; min-width: 112px; border-bottom: 2px solid transparent;
  text-align: left; white-space: nowrap; transition: background .12s ease, border-color .12s ease;
}
.reg-pill:hover { background: var(--surface-2); }
.reg-pill.active { background: #fff; border-bottom-color: var(--navy); }
.reg-pill .reg-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.reg-pill.active .reg-name { color: var(--navy); }
.reg-pill .reg-meta { font-size: 11px; color: var(--muted); margin-top: 1px; }

/* KPI Strip (Hairline Dividers Only) */
.kpi-strip {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.kpi-strip.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-strip.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-cell { padding: 2px 18px; border-right: 1px solid var(--border); min-width: 0; }
.kpi-cell:first-child { padding-left: 0; }
.kpi-cell:last-child { padding-right: 0; border-right: 0; }
.kpi-lbl { font-size: 11.5px; font-weight: 500; color: var(--muted); margin-bottom: 3px; }
.kpi-val { font-size: 21px; font-weight: 700; color: var(--navy); line-height: 1.2; white-space: nowrap; }
.kpi-val .unit { font-size: 11.5px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kpi-foot { font-size: 11px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 6px; }

/* Analytical 2-Col Split (Hairline Separated) */
.analysis-grid {
  display: grid; grid-template-columns: 1.25fr 1fr;
  border-bottom: 1px solid var(--border);
}
.analysis-pane { padding: 18px 24px 18px 0; min-width: 0; }
.analysis-pane + .analysis-pane { padding: 18px 0 18px 24px; border-left: 1px solid var(--border); }
.pane-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 10px;
}
.pane-title {
  font-size: 14px; font-weight: 700; color: var(--ink);
  padding-left: 9px; border-left: 3px solid var(--navy);
}
.pane-note { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* Section Header */
.sec-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 20px 0 12px;
}
.sec-head h2 {
  font-size: 15px; font-weight: 700; color: var(--ink);
  padding-left: 9px; border-left: 3px solid var(--navy);
}
.sec-head p { font-size: 12px; color: var(--muted); margin-top: 2px; padding-left: 12px; }

/* High-Density Terminal Table */
.table-scroll { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th {
  text-align: left; padding: 9px 10px;
  font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .02em;
  border-bottom: 1.5px solid var(--border-strong); background: var(--surface);
  white-space: nowrap; user-select: none;
}
.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { color: var(--navy); }
.data-table th.num, .data-table td.num { text-align: right; }
.data-table td {
  padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
.data-table tbody tr { transition: background .1s ease; }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr:hover { background: var(--surface); }
.data-table tbody tr.selected { background: var(--navy-soft); }
.row-title { font-weight: 600; color: var(--ink); }
.row-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.micro-bar { width: 64px; height: 4px; background: var(--surface-2); display: inline-block; vertical-align: middle; overflow: hidden; }
.micro-bar > span { display: block; height: 100%; background: var(--navy); }

/* Scope / Alert Banner (Thin Left Accent, No Box Clutter) */
.call-strip {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 10px 14px; margin: 12px 0;
  border-left: 3px solid var(--steel); background: var(--surface);
  font-size: 12.5px; color: var(--ink-2);
}
.call-strip.warn { border-left-color: #d97706; background: var(--amber-bg); color: #78350f; }
.call-strip.bad { border-left-color: var(--red); background: var(--red-bg); color: #991b1b; }

/* Operator Country Context Split */
.country-banner {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.reg-info-line {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted);
}

/* Org Tree Node Lines */
.tree-group { border-bottom: 1px solid var(--border); padding: 14px 0; }
.tree-root {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 10px; border-radius: var(--radius); cursor: pointer;
}
.tree-root:hover { background: var(--surface); }
.tree-children {
  margin: 6px 0 0 22px; padding-left: 16px;
  border-left: 1.5px solid var(--border-strong);
}
.tree-child {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 10px; border-radius: var(--radius); cursor: pointer; position: relative;
}
.tree-child::before {
  content: ""; position: absolute; left: -16px; top: 50%; width: 12px; height: 1px; background: var(--border-strong);
}
.tree-child:hover { background: var(--surface); }

/* Slide-Over Operator Dossier Drawer */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(2px);
}
.drawer-backdrop[hidden] { display: none; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 90;
  width: min(720px, 100vw); background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: -16px 0 48px rgba(15, 23, 42, .16);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.22, 1, .36, 1), width .2s ease;
}
.drawer.open { transform: translateX(0); }
.drawer.expanded { width: min(1120px, 100vw); }

.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 22px 12px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.drawer-crumbs { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.drawer-head h2 { font-size: 19px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.drawer-sub { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.drawer-head-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.drawer-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 22px; border-bottom: 1px solid var(--border); background: #fff;
}
.drawer-tabs {
  display: flex; gap: 20px; padding: 0 22px; border-bottom: 1px solid var(--border); background: #fff;
  overflow-x: auto; scrollbar-width: none;
}
.drawer-tabs::-webkit-scrollbar { display: none; }
.d-tab {
  padding: 10px 2px; font-size: 13px; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.d-tab:hover { color: var(--ink); }
.d-tab.active { color: var(--navy); font-weight: 700; border-bottom-color: var(--navy); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 36px; }

/* Fact Matrix (Open Hairline Grid Inside Drawer) */
.fact-matrix {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin: 12px 0 18px;
}
.fact-cell {
  padding: 10px 14px 10px 0; border-bottom: 1px solid var(--border);
}
.fact-cell:nth-child(even) { padding-left: 14px; padding-right: 0; border-left: 1px solid var(--border); }
.fact-cell:nth-last-child(-n+2) { border-bottom: 0; }
.fact-lbl { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.fact-val { font-size: 13px; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }

/* 3 Business Line Matrix */
.biz-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 12px 0 18px; }
.biz-col { padding: 12px 14px 12px 0; }
.biz-col + .biz-col { padding-left: 14px; border-left: 1px solid var(--border); }
.biz-col h4 { font-size: 12.5px; font-weight: 700; color: var(--navy); margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between; }
.biz-col p { font-size: 12px; color: var(--ink-2); line-height: 1.55; }

/* Charts */
.chart-wrap { width: 100%; overflow: hidden; }
.chart-wrap svg { width: 100%; height: auto; }
.scatter-dot { cursor: pointer; transition: r .12s ease, opacity .12s ease; }
.scatter-dot:hover { opacity: 1 !important; }
.chart-tooltip {
  position: fixed; pointer-events: none; z-index: 120;
  background: var(--ink); color: #fff; padding: 7px 10px; border-radius: 6px;
  font-size: 11.5px; line-height: 1.45; box-shadow: 0 8px 24px rgba(15, 23, 42, .25);
  max-width: 240px;
}

/* Bid Pipeline Stage Columns / Table */
.stage-bar {
  display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr));
  gap: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin: 14px 0; overflow-x: auto;
}
.stage-step {
  padding: 10px 12px; border-right: 1px solid var(--border); text-align: left;
  transition: background .12s ease;
}
.stage-step:last-child { border-right: 0; }
.stage-step:hover { background: var(--surface); }
.stage-step.active { background: var(--navy-soft); }
.stage-step .st-num { font-size: 10.5px; font-weight: 700; color: var(--steel); }
.stage-step .st-name { font-size: 12.5px; font-weight: 700; color: var(--ink); margin-top: 2px; }
.stage-step .st-cnt { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.check-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.check-row:last-child { border-bottom: 0; }
.check-q { font-size: 13px; color: var(--ink); flex: 1; }
.check-seg { display: inline-flex; background: var(--surface-2); padding: 2px; border-radius: 6px; gap: 2px; flex-shrink: 0; }
.check-seg button { padding: 4px 10px; font-size: 11.5px; border-radius: 4px; color: var(--muted); font-weight: 500; }
.check-seg button[aria-pressed="true"] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(15,23,42,.08); }
.check-seg button[data-st="ok"][aria-pressed="true"] { background: var(--navy); color: #fff; }
.check-seg button[data-st="block"][aria-pressed="true"] { background: var(--red); color: #fff; }

/* Compare Grid */
.compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.compare-col { padding: 14px 16px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.compare-col:last-child { border-right: 0; }

/* Upload Dropzone (Minimal Hairline) */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: 24px 20px; text-align: center; background: var(--surface);
  transition: border-color .14s ease, background .14s ease;
}
.dropzone.dragover { border-color: var(--navy); background: var(--navy-soft); }

/* Modals */
dialog.modal {
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0;
  width: min(640px, calc(100vw - 24px)); max-height: 86dvh;
  box-shadow: 0 24px 60px -12px rgba(15, 23, 42, .28);
  color: var(--ink);
}
dialog.modal::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
dialog.modal[open] { display: flex; flex-direction: column; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.modal-head h3 { font-size: 15px; font-weight: 700; }
.modal-body { padding: 16px 18px 20px; overflow-y: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-full { grid-column: 1 / -1; }
.cmd-item {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 10px; border-radius: var(--radius); text-align: left;
  border-bottom: 1px solid var(--border);
}
.cmd-item:hover { background: var(--surface); }

/* Toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 150;
  background: var(--ink); color: #fff; padding: 9px 18px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; box-shadow: 0 10px 28px rgba(15, 23, 42, .25);
  display: none; max-width: calc(100vw - 32px);
}
.toast.show { display: block; }

/* Boot State */
.boot-state { padding: 72px 20px; text-align: center; color: var(--muted); }
.boot-spinner {
  width: 24px; height: 24px; margin: 0 auto 12px;
  border: 2.5px solid var(--border); border-top-color: var(--navy); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Mobile Bottom Nav & Print Sheet */
.bottom-nav { display: none; }
.print-sheet { display: none; }

/* ----------------------------------------------------------------------------
   Tablet & Mobile Native Responsive Rules
   ---------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 0; }
  .kpi-cell:nth-child(3n) { border-right: 0; }
  .analysis-grid { grid-template-columns: 1fr; }
  .analysis-pane, .analysis-pane + .analysis-pane { padding: 16px 0; border-left: 0; }
  .analysis-pane + .analysis-pane { border-top: 1px solid var(--border); }
  .biz-grid { grid-template-columns: 1fr; }
  .biz-col + .biz-col { padding-left: 0; border-left: 0; border-top: 1px solid var(--border); }
  .cmd-trigger { min-width: 170px; }
}

@media (max-width: 768px) {
  body { font-size: 14px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .brand-meta, .topnav, .hide-sm { display: none !important; }
  .cmd-trigger { min-width: 0; width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 999px; }
  .cmd-trigger .cmd-placeholder, .cmd-trigger kbd { display: none; }
  .workspace { padding: 14px 14px calc(84px + env(safe-area-inset-bottom)); }
  .region-ribbon { margin: 0 -14px; padding: 0 14px; }
  .reg-pill { min-width: 94px; padding: 9px 12px; }
  .view-head h1 { font-size: 19px; }
  .kpi-strip, .kpi-strip.cols-5, .kpi-strip.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 0; padding: 10px 0; }
  .kpi-cell { padding: 6px 10px 6px 0; border-right: 0; }
  .kpi-cell:nth-child(odd) { border-right: 1px solid var(--border); }
  .kpi-cell:nth-child(even) { padding-left: 12px; padding-right: 0; }
  .kpi-val { font-size: 18px; }

  .drawer { width: 100vw; }
  .drawer-head { padding: 14px 14px 10px; }
  .drawer-toolbar, .drawer-tabs, .drawer-body { padding-left: 14px; padding-right: 14px; }
  .fact-matrix { grid-template-columns: 1fr; }
  .fact-cell:nth-child(even) { padding-left: 0; border-left: 0; }
  .fact-cell:nth-last-child(-n+2) { border-bottom: 1px solid var(--border); }
  .fact-cell:last-child { border-bottom: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .check-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .check-seg { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); }

  /* Responsive Table -> Clean Hairline Cards */
  .mobile-cards thead { display: none; }
  .mobile-cards, .mobile-cards tbody, .mobile-cards tr, .mobile-cards td { display: block; width: 100%; }
  .mobile-cards tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .mobile-cards td {
    padding: 4px 0; border: 0; display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 4px 10px;
    align-items: start; justify-items: start; text-align: left !important;
  }
  .mobile-cards td::before {
    content: attr(data-label); font-size: 11.5px; color: var(--muted); text-align: left; grid-column: 1;
  }
  .mobile-cards td > * { grid-column: 2; }
  .mobile-cards td.td-main { display: block; text-align: left !important; padding-bottom: 6px; }
  .mobile-cards td.td-main::before { display: none; }

  input, select, textarea { font-size: 16px !important; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: rgba(255, 255, 255, 0.96); backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--border);
    padding: 4px 0 calc(4px + env(safe-area-inset-bottom));
    height: calc(58px + env(safe-area-inset-bottom));
  }
  .bnav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font-size: 10.5px; font-weight: 500; color: var(--muted); text-decoration: none !important;
  }
  .bnav-item.active { color: var(--navy); font-weight: 700; }
  .bnav-item .ico svg { width: 18px; height: 18px; }
  .toast { bottom: calc(74px + env(safe-area-inset-bottom)); }
  dialog.modal { width: 100vw; max-width: none; margin: auto 0 0; border-radius: 14px 14px 0 0; max-height: 92dvh; }
}

@media (max-width: 420px) {
  .hide-xs { display: none !important; }
}

@media print {
  .topbar, .bottom-nav, .workspace, .drawer, .drawer-backdrop, dialog, .toast { display: none !important; }
  .print-sheet { display: block !important; padding: 12mm; font: 12px/1.55 var(--font); color: #111; }
  .print-sheet h1 { font-size: 18pt; color: #142d55; margin-bottom: 4pt; }
  .print-sheet h2 { font-size: 12pt; color: #142d55; border-bottom: 1px solid #cbd5e1; padding-bottom: 3pt; margin: 12pt 0 6pt; }
  .print-sheet table { width: 100%; border-collapse: collapse; margin: 6pt 0; }
  .print-sheet th, .print-sheet td { border-bottom: 1px solid #e2e8f0; padding: 4pt 6pt; text-align: left; }
}
