:root {
  --navy: #102a43;
  --navy-deep: #0b1d2f;
  --navy-soft: #1b3a59;
  --ink: #1f3348;
  --muted: #62758a;
  --canvas: #eef2f6;
  --surface: #ffffff;
  --line: #d5e0ea;
  --line-strong: #b7c7d6;
  --blue: #1d5fa7;
  --blue-soft: #e7f0fa;
  --teal: #0e766e;
  --teal-soft: #e2f4f0;
  --amber: #a76513;
  --amber-soft: #fff3da;
  --red: #b42318;
  --red-soft: #fde9e7;
  --shadow: 0 1px 2px rgba(16, 42, 67, .05);
  --shadow-hover: 0 8px 24px rgba(16, 42, 67, .12);
  --focus-ring: 0 0 0 3px rgba(29, 95, 167, .2);
  --surface-muted: #f6f8fa;
  font-family: "Segoe UI Variable", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

/* Personal visual modes. They only change presentation; data and permissions
   remain identical for every user. */
html[data-ui-style="table"] {
  --canvas: #eef3f8;
  --surface-muted: #f5f8fb;
  --line: #cbd7e3;
  --line-strong: #aebdcb;
  --shadow: 0 1px 4px rgba(20, 40, 65, 0.035);
  --shadow-hover: 0 3px 10px rgba(20, 40, 65, 0.08);
}
html[data-ui-style="table"] body { font-size: 13px; }
html[data-ui-style="table"] .sidebar { width: 232px; }
html[data-ui-style="table"] .app-shell { margin-left: 232px; }
html[data-ui-style="table"] .card, html[data-ui-style="table"] .panel, html[data-ui-style="table"] .recognition-card, html[data-ui-style="table"] .evidence-card { border-radius: 7px; }

html[data-ui-style="evidence"] {
  --navy: #243447;
  --navy-deep: #182534;
  --navy-soft: #30485f;
  --canvas: #f4f1eb;
  --surface: #fffdf8;
  --surface-muted: #faf7f1;
  --line: #ded8ca;
  --line-strong: #c8bead;
  --blue: #2d668d;
  --blue-soft: #e7f0f5;
  --shadow: 0 2px 8px rgba(77, 61, 42, .06);
}
html[data-ui-style="evidence"] .evidence-pane { background: #f2ede4; }
html[data-ui-style="evidence"] .source-image { background: #eee8dd; }
html[data-ui-style="evidence"] .review-sheet thead th { background: #eef2f2; }

html[data-ui-style="contrast"] {
  --navy: #0b1b2e;
  --navy-deep: #061221;
  --navy-soft: #193654;
  --ink: #122033;
  --muted: #4d6177;
  --canvas: #edf2f7;
  --surface: #ffffff;
  --surface-muted: #f4f7fa;
  --line: #9fb1c3;
  --line-strong: #738ba2;
  --blue: #145bc5;
  --blue-soft: #dce9ff;
  --red: #a51f2b;
  --red-soft: #ffe1e3;
  --amber: #80500b;
  --amber-soft: #fff0c6;
  --shadow: 0 1px 4px rgba(7, 24, 44, .08);
}
html[data-ui-style="contrast"] .status, html[data-ui-style="contrast"] .cell-state { border-width: 2px; }
html[data-ui-style="contrast"] h1, html[data-ui-style="contrast"] h2, html[data-ui-style="contrast"] h3 { letter-spacing: -.01em; }

html[data-ui-style="image"] {
  --navy: #172337;
  --navy-deep: #0d1726;
  --navy-soft: #253c58;
  --canvas: #eef2f6;
  --surface: #ffffff;
  --surface-muted: #f3f6f9;
  --line: #d4dee8;
  --line-strong: #b8c7d5;
  --blue: #2a6bc9;
  --blue-soft: #e3edff;
  --shadow: 0 3px 12px rgba(19,34,56,.07);
}
html[data-ui-style="image"] .review-workbench { grid-template-columns: minmax(440px, 1.15fr) minmax(540px, 1fr); }
html[data-ui-style="image"] .evidence-card { box-shadow: 0 5px 16px rgba(19,34,56,.1); }
html[data-ui-style="image"] .evidence-body { padding: 18px; }
html[data-ui-style="image"] .source-image { max-height: 78vh; background: #e7edf3; }
html[data-ui-style="image"] .evidence-pane pre { background: #0b1726; color: #f1f6fb; }

html[data-ui-style="document"] {
  --navy: #17202a;
  --navy-deep: #0e141b;
  --navy-soft: #273746;
  --ink: #1b2229;
  --muted: #52606d;
  --canvas: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f6f7f8;
  --line: #cfd4d9;
  --line-strong: #8d98a3;
  --blue: #1d4f91;
  --blue-soft: #edf3fb;
  --shadow: none;
  --shadow-hover: 0 2px 6px rgba(20, 30, 40, .12);
}
html[data-ui-style="document"] body { font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif; }
html[data-ui-style="document"] .card, html[data-ui-style="document"] .panel, html[data-ui-style="document"] .recognition-card, html[data-ui-style="document"] .evidence-card { border-radius: 2px; box-shadow: none; }
html[data-ui-style="document"] .review-sheet-wrap, html[data-ui-style="document"] .review-sheet input { border-radius: 2px; }
html[data-ui-style="document"] .review-sheet th, html[data-ui-style="document"] .review-sheet td { border-color: #b9c1c8; }
html[data-ui-style="document"] .review-sheet thead th { background: #f1f3f5; color: #111820; }
html[data-ui-style="document"] .review-sheet .sheet-section th { background: #e9edf0; color: #111820; }
html[data-ui-style="document"] .review-summary-grid > div { border-radius: 2px; background: #fafafa; }

/* Evidence panes must follow the selected mode too.  These blocks override
   the intentionally dark OCR preview used by the default workbench. */
html[data-ui-style="table"] .evidence-card,
html[data-ui-style="table"] .recognition-card { border-top: 3px solid var(--blue); }
html[data-ui-style="table"] .evidence-pane pre,
html[data-ui-style="table"] .ocr-preview-grid {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--line-strong);
}
html[data-ui-style="table"] .ocr-preview-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
html[data-ui-style="table"] .ocr-preview-cell {
  border-color: var(--line);
  border-radius: 2px;
  background: var(--surface-muted);
  color: var(--ink);
}

html[data-ui-style="evidence"] .evidence-card { border-top: 3px solid #8f6b3d; }
html[data-ui-style="evidence"] .evidence-pane pre,
html[data-ui-style="evidence"] .ocr-preview-grid {
  background: #fffdf8;
  color: #3d4650;
  border-color: #c8bead;
}
html[data-ui-style="evidence"] .ocr-preview-cell {
  border-color: #ded8ca;
  background: #f7f1e5;
  color: #3d4650;
}

html[data-ui-style="contrast"] .evidence-card,
html[data-ui-style="contrast"] .recognition-card { border-width: 2px; border-top: 4px solid var(--blue); }
html[data-ui-style="contrast"] .ocr-preview-grid { background: #071321; border-color: #6f88a2; }
html[data-ui-style="contrast"] .ocr-preview-cell { border-color: #6f88a2; background: #12263d; color: #ffffff; }

html[data-ui-style="image"] .evidence-card { border-top: 3px solid #2a6bc9; }
html[data-ui-style="image"] .evidence-pane pre,
html[data-ui-style="image"] .ocr-preview-grid {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--line-strong);
}
html[data-ui-style="image"] .ocr-preview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
html[data-ui-style="image"] .ocr-preview-cell {
  border-color: #d4dee8;
  background: #f3f6f9;
  color: var(--ink);
}

html[data-ui-style="document"] .evidence-card,
html[data-ui-style="document"] .recognition-card { border-top: 2px solid #17202a; }
html[data-ui-style="document"] .evidence-pane { border-radius: 0; background: #ffffff; }
html[data-ui-style="document"] .evidence-pane pre,
html[data-ui-style="document"] .ocr-preview-grid {
  background: #ffffff;
  color: #1b2229;
  border-color: #8d98a3;
  border-radius: 0;
}
html[data-ui-style="document"] .ocr-preview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 0; }
html[data-ui-style="document"] .ocr-preview-cell {
  border-color: #b9c1c8;
  border-width: 0 1px 1px 0;
  border-radius: 0;
  background: #ffffff;
  color: #1b2229;
}

/* Layout modes: these are deliberately structural, not just recolors. */
html[data-ui-style="table"] .review-workbench {
  grid-template-columns: minmax(260px, .58fr) minmax(760px, 1.72fr);
  gap: 12px;
}
html[data-ui-style="table"] .evidence-body { padding: 10px; }
html[data-ui-style="table"] .evidence-grid { gap: 8px; }
html[data-ui-style="table"] .review-sheet { min-width: 900px; }
html[data-ui-style="table"] .recognition-card { position: sticky; top: 14px; }

html[data-ui-style="evidence"] .review-workbench {
  grid-template-columns: minmax(410px, .92fr) minmax(600px, 1.22fr);
  gap: 20px;
}
html[data-ui-style="evidence"] .evidence-body { padding: 16px; }
html[data-ui-style="evidence"] .evidence-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html[data-ui-style="evidence"] .evidence-pane:first-child { grid-column: span 2; }
html[data-ui-style="evidence"] .source-image { max-height: 62vh; }

html[data-ui-style="contrast"] .review-workbench {
  grid-template-columns: minmax(320px, .78fr) minmax(700px, 1.5fr);
  gap: 14px;
}
html[data-ui-style="contrast"] .evidence-card,
html[data-ui-style="contrast"] .recognition-card { position: relative; }
html[data-ui-style="contrast"] .review-sheet th,
html[data-ui-style="contrast"] .review-sheet td { border-bottom-width: 2px; }
html[data-ui-style="contrast"] .evidence-body { padding: 12px; }

html[data-ui-style="image"] .review-workbench {
  grid-template-columns: minmax(540px, 1.38fr) minmax(500px, .96fr);
  gap: 20px;
}
html[data-ui-style="image"] .evidence-body { padding: 20px; }
html[data-ui-style="image"] .evidence-grid { grid-template-columns: 1fr; }
html[data-ui-style="image"] .evidence-grid .ocr-evidence-pane { order: -1; }
html[data-ui-style="image"] .source-image { max-height: 82vh; min-height: 300px; }
html[data-ui-style="image"] .recognition-card { position: sticky; top: 14px; }

html[data-ui-style="document"] .review-workbench {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
html[data-ui-style="document"] .recognition-column { order: 1; }
html[data-ui-style="document"] .evidence-column { order: 2; }
html[data-ui-style="document"] .review-sheet { min-width: 960px; }
html[data-ui-style="document"] .evidence-body {
  display: grid;
  grid-template-columns: minmax(300px, .78fr) minmax(0, 1.22fr);
  gap: 12px;
}
html[data-ui-style="document"] .evidence-body > .evidence-grid { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
html[data-ui-style="document"] .evidence-body > .alert { grid-column: 1 / -1; }
html[data-ui-style="document"] .evidence-card > header,
html[data-ui-style="document"] .recognition-card > header { background: #ffffff; }

/* OCR presentation formats.  This selector is independent from the page
   theme so operators can combine, for example, Document + Excel OCR. */
html[data-ocr-style="raw"] .ocr-preview-grid {
  display: block;
  padding: 10px 12px;
  background: #0d1a2a;
}
html[data-ocr-style="raw"] .ocr-preview-cell {
  display: block;
  padding: 5px 2px;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,.12);
  border-radius: 0;
  background: transparent;
  color: #f3f7fb;
  white-space: pre-wrap;
}

html[data-ocr-style="grid"] .ocr-preview-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

html[data-ocr-style="sheet"] .ocr-preview-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  border-radius: 2px;
  background: #ffffff;
}
html[data-ocr-style="sheet"] .ocr-preview-cell {
  min-height: 34px;
  padding: 8px 9px;
  border-width: 0 1px 1px 0;
  border-color: #b9c5d0;
  border-radius: 0;
  background: #ffffff;
  color: #1b2a3a;
  white-space: normal;
}

html[data-ocr-style="cards"] .ocr-preview-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  background: #eef3f8;
}
html[data-ocr-style="cards"] .ocr-preview-cell {
  min-height: 42px;
  padding: 10px;
  border: 1px solid #c7d4e1;
  border-radius: 7px;
  background: #ffffff;
  color: #1b2a3a;
  white-space: normal;
}

html[data-ocr-style="lines"] .ocr-preview-grid {
  display: block;
  padding: 0;
  border-radius: 4px;
  background: #ffffff;
}
html[data-ocr-style="lines"] .ocr-preview-cell {
  display: block;
  padding: 8px 10px 8px 34px;
  border-width: 0 0 1px;
  border-color: #dce5ee;
  border-radius: 0;
  background: #ffffff;
  color: #1b2a3a;
  white-space: normal;
  counter-increment: ocr-line;
}
html[data-ocr-style="lines"] .ocr-preview-grid { counter-reset: ocr-line; }
html[data-ocr-style="lines"] .ocr-preview-cell::before {
  content: counter(ocr-line);
  display: inline-block;
  width: 22px;
  margin-left: -24px;
  margin-right: 2px;
  color: #7a8a9d;
  font-size: 10px;
  text-align: right;
}

html[data-ocr-style="compact"] .ocr-preview-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;
  padding: 6px;
}
html[data-ocr-style="compact"] .ocr-preview-cell {
  padding: 5px 6px;
  border-radius: 3px;
  font-size: 11px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 9px 13px;
  border-radius: 7px;
  background: var(--navy-deep);
  color: #fff;
  transform: translateY(-160%);
  transition: transform .15s ease;
}
.skip-link:focus { transform: translateY(0); }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
h1 { margin: 0 0 22px; color: var(--navy); font-size: 27px; line-height: 1.2; }
h2 { color: var(--navy); font-size: 19px; line-height: 1.3; }
h3 { margin: 22px 0 9px; color: var(--navy); font-size: 15px; }
button, .btn { transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(39, 100, 216, .22); outline-offset: 2px; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: 248px;
  flex-direction: column;
  background: var(--navy);
  color: #e7eef8;
  border-right: 1px solid rgba(255,255,255,.07);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 24px 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  background: var(--teal);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
}
.brand-name { color: #fff; font-size: 18px; font-weight: 750; letter-spacing: .2px; }
.brand-subtitle { margin-top: 1px; color: #9fb1c7; font-size: 11px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 18px 12px 20px; }
.nav-section { margin: 17px 10px 7px; color: #7f95ad; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.nav-section:first-child { margin-top: 0; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  min-height: 38px;
  margin: 2px 0;
  padding: 8px 11px;
  border-radius: 7px;
  color: #c9d6e5;
  font-size: 13px;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: var(--navy-soft); color: #fff; text-decoration: none; }
.sidebar-nav a.active { box-shadow: inset 3px 0 0 #42b8a9; }
.sidebar-footer { padding: 15px 21px; border-top: 1px solid rgba(255,255,255,.09); color: #9fb1c7; font-size: 12px; }
.sidebar-footer strong { display: block; color: #eef4fb; font-size: 13px; font-weight: 600; }
.sidebar-account { display: block; margin-top: 2px; }
.logout-form { margin-top: 12px; }
.logout-button { width: 100%; min-height: 34px; border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.07); color: #d9e4ef; font-size: 12px; }
.logout-button:hover { border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.14); }

.app-shell { min-width: 0; min-height: 100vh; margin-left: 248px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.topbar-title { color: var(--navy); font-size: 14px; font-weight: 650; }
.topbar-meta { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; }
.health-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--teal); font-weight: 650; }
.health-chip::before { width: 7px; height: 7px; border-radius: 50%; background: #2aa78d; content: ""; }
.role-chip { padding: 5px 9px; border: 1px solid var(--line); border-radius: 5px; background: #f8fafc; color: var(--ink); }
.ui-style-picker, .ocr-style-picker { position: relative; }
.ui-style-trigger { cursor: pointer; list-style: none; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--navy); font-size: 11px; font-weight: 700; }
.ui-style-trigger::-webkit-details-marker { display: none; }
.ui-style-trigger::after { content: "⌄"; margin-left: 5px; color: var(--muted); }
.ui-style-picker[open] .ui-style-trigger, .ocr-style-picker[open] .ui-style-trigger { border-color: var(--blue); box-shadow: var(--focus-ring); }
.ui-style-menu { position: absolute; z-index: 50; top: calc(100% + 7px); right: 0; width: 210px; padding: 6px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-hover); }
.ui-style-menu button { display: block; width: 100%; padding: 8px 9px; border: 0; border-radius: 5px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.ui-style-menu button:hover, .ui-style-menu button.selected { background: var(--blue-soft); color: var(--navy); }
.ui-style-menu strong, .ui-style-menu small { display: block; }
.ui-style-menu strong { font-size: 12px; }
.ui-style-menu small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.ui-style-menu button:hover small, .ui-style-menu button.selected small { color: var(--blue); }
.page-shell { width: min(1480px, 100%); margin: 0 auto; padding: 30px 34px 48px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-heading h1 { margin: 0; color: var(--navy); font-size: 27px; line-height: 1.2; letter-spacing: -.01em; }
.page-heading p { max-width: 720px; margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.eyebrow { margin: 0 0 6px; color: var(--teal); font-size: 11px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.page-footer { padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.login-page { display: grid; min-height: 100vh; place-items: center; overflow: auto; background: var(--navy-deep); }
.login-shell { width: min(440px, calc(100% - 32px)); }
.login-card { position: relative; overflow: hidden; padding: 38px; border: 1px solid rgba(255,255,255,.15); border-radius: 14px; background: var(--surface); box-shadow: 0 18px 42px rgba(0,0,0,.24); }
.login-card .stack-form { display: grid; gap: 14px; margin-top: 24px; }
.login-card .stack-form label { display: grid; gap: 6px; font-weight: 650; }
.login-card .brand.compact { margin-bottom: 24px; }
.login-card::before { position: absolute; inset: 0 0 auto; height: 4px; background: var(--teal); content: ""; }
.login-mark { width: 44px; height: 44px; margin-bottom: 23px; border-radius: 12px; font-size: 21px; }
.login-card h1 { margin-bottom: 8px; font-size: 29px; letter-spacing: -.03em; }
.login-intro { margin: 0 0 24px; color: var(--muted); }
.login-form label { margin-top: 16px; color: var(--navy); font-size: 12px; }
.login-form input { min-height: 44px; border-radius: 8px; }
.login-form button { width: 100%; min-height: 44px; margin-top: 24px; border-radius: 8px; background: var(--navy); }
.login-form button:hover { background: var(--navy-soft); }
.login-error { padding: 10px 12px; border: 1px solid #f0bfc2; border-radius: 8px; background: var(--red-soft); color: #9f3439; font-size: 13px; }
.login-footnote { margin: 22px 0 0; color: var(--muted); font-size: 11px; text-align: center; }

/* Sales project workbench: a calm, dense ledger rather than a reduced admin UI. */
.sales-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 2px 0 24px; padding: 6px 0 22px; border-bottom: 1px solid var(--line); }
.sales-hero h1 { margin: 0; font-size: 30px; letter-spacing: -.025em; text-wrap: balance; }
.sales-hero p:not(.eyebrow) { max-width: 640px; margin: 9px 0 0; color: var(--muted); font-size: 14px; line-height: 1.65; text-wrap: pretty; }
.sales-hero-action { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.sales-live-dot { display: inline-flex; align-items: center; gap: 7px; color: var(--teal); font-size: 12px; font-weight: 700; white-space: nowrap; }
.sales-live-dot::before { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); content: ""; }
.sales-metrics { display: grid; grid-template-columns: 1.35fr repeat(3, 1fr); gap: 10px; margin-bottom: 22px; }
.sales-metric { min-height: 122px; padding: 17px 18px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.sales-metric:hover { border-color: var(--line-strong); box-shadow: var(--shadow-hover); text-decoration: none; transform: translateY(-1px); }
.sales-metric span, .sales-metric small { display: block; color: var(--muted); font-size: 12px; }
.sales-metric strong { display: block; margin: 8px 0 4px; color: var(--navy); font-size: 31px; font-variant-numeric: tabular-nums; letter-spacing: -.03em; line-height: 1; }
.sales-metric-primary { border-color: rgba(14,118,110,.22); background: linear-gradient(135deg, #f2fbf9, var(--surface)); }
.sales-metric-primary strong { color: var(--teal); }
.sales-split { display: grid; grid-template-columns: minmax(0, 1fr) 278px; gap: 18px; margin-bottom: 20px; }
.sales-panel { padding: 0; overflow: hidden; }
.sales-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.sales-panel-heading h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.sales-panel-heading p:not(.section-kicker) { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.section-kicker { margin: 0 0 4px; color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.text-link { align-self: center; font-size: 12px; font-weight: 700; white-space: nowrap; }
.decision-queue { margin: 0; padding: 0; list-style: none; }
.decision-queue li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 66px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.decision-queue li:last-child { border-bottom: 0; }
.queue-index { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; background: var(--surface-muted); color: var(--muted); font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums; }
.queue-main { min-width: 0; }
.queue-main strong, .queue-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-main strong { color: var(--ink); font-size: 13px; }
.queue-main span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.queue-state { display: grid; justify-items: end; gap: 4px; }
.queue-state small { color: var(--amber); font-size: 11px; white-space: nowrap; }
.sales-rail { display: grid; align-content: start; gap: 10px; }
.sales-note { padding: 16px; border: 1px solid rgba(14,118,110,.2); border-radius: 9px; background: var(--teal-soft); }
.sales-note strong, .sales-note span { display: block; }
.sales-note strong { color: var(--navy); font-size: 14px; }
.sales-note span { margin-top: 7px; color: #345e61; font-size: 12px; line-height: 1.55; }
.sales-note-muted { border-color: var(--line); background: var(--surface-muted); }
.sales-note-muted span { color: var(--muted); }
.sales-ledger { padding: 0; overflow: hidden; }
.sales-ledger .panel-heading { padding: 17px 19px; }
.sales-table { width: 100%; min-width: 980px; border-collapse: collapse; font-size: 12px; }
.sales-table th { position: static; padding: 10px 14px; border-bottom: 1px solid var(--line-strong); background: var(--surface-muted); color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
.sales-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.sales-table tbody tr:hover { background: #f8fbfc; }
.sales-table td > strong, .sales-table td > span { display: block; }
.sales-table td > strong { color: var(--ink); font-weight: 700; }
.sales-table td > span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.sales-table .num-col { text-align: right; font-variant-numeric: tabular-nums; }
.sales-table .difference { color: var(--amber); font-weight: 750; }
.source-ribbon { display: flex; flex-wrap: wrap; gap: 4px; }
.source-ribbon span { margin: 0 !important; padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-muted); color: var(--muted) !important; font-size: 10px !important; font-weight: 700; }
.inline-warning { display: block; margin-top: 5px; color: var(--amber); font-size: 11px; white-space: nowrap; }
.sales-empty { display: grid; min-height: 180px; place-content: center; gap: 7px; padding: 28px; color: var(--muted); text-align: center; }
.sales-empty strong { color: var(--navy); font-size: 15px; }
.sales-empty span { max-width: 430px; font-size: 12px; line-height: 1.6; }
.sales-placeholder, .sales-access { padding: 28px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.sales-placeholder { max-width: 720px; }
.sales-placeholder h2, .sales-access h2 { margin: 0; font-size: 20px; letter-spacing: -.015em; }
.sales-placeholder p:not(.section-kicker), .sales-access p:not(.section-kicker) { max-width: 570px; margin: 9px 0 18px; color: var(--muted); line-height: 1.65; }
.sales-access { display: grid; grid-template-columns: 1fr minmax(260px, .7fr); gap: 40px; }
.sales-access dl { display: grid; margin: 0; border-left: 1px solid var(--line); }
.sales-access dl > div { padding: 10px 0 10px 20px; border-bottom: 1px solid var(--line); }
.sales-access dl > div:last-child { border-bottom: 0; }
.sales-access dt { color: var(--muted); font-size: 11px; }
.sales-access dd { margin: 4px 0 0; color: var(--ink); font-size: 13px; font-weight: 700; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .sales-metrics { grid-template-columns: repeat(2, 1fr); }
  .sales-split { grid-template-columns: 1fr; }
  .sales-rail { grid-template-columns: repeat(2, 1fr); }
  .sales-access { grid-template-columns: 1fr; gap: 20px; }
  .sales-access dl { border-top: 1px solid var(--line); border-left: 0; }
  .sales-access dl > div { padding-left: 0; }
}
@media (max-width: 640px) {
  .sales-hero { align-items: flex-start; flex-direction: column; gap: 14px; }
  .sales-hero h1 { font-size: 26px; }
  .sales-hero-action { width: 100%; justify-content: space-between; }
  .sales-metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .sales-metric { min-height: 108px; padding: 14px; }
  .sales-metric strong { font-size: 26px; }
  .sales-rail { grid-template-columns: 1fr; }
  .sales-panel-heading { align-items: flex-start; flex-direction: column; }
  .decision-queue li { grid-template-columns: 28px minmax(0, 1fr); gap: 9px; padding: 11px 13px; }
  .queue-state { grid-column: 2; justify-items: start; }
  .sales-table th { top: 0; }
}

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.finance-kpis { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.card, .panel { border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow); }
.card { position: relative; min-height: 128px; overflow: hidden; padding: 19px 20px 17px; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.card::after { position: absolute; inset: 0 0 auto; height: 3px; background: var(--blue); content: ""; }
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-hover); }
.card.tone-amber::after { background: var(--amber); }
.card.tone-teal::after { background: var(--teal); }
.card.tone-slate::after { background: #7c8da3; }
.card-label { display: flex; min-width: 0; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.card-label::before { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 2px; background: #8ba0b6; content: ""; }
.tone-amber .card-label::before { background: var(--amber); }
.tone-teal .card-label::before { background: var(--teal); }
.num { min-width: 0; margin-top: 17px; color: var(--navy); font-size: clamp(1.45rem, 2.2vw, 1.95rem); font-variant-numeric: tabular-nums; font-weight: 750; line-height: 1; letter-spacing: -.02em; overflow-wrap: anywhere; }
.num.teal { color: var(--teal); }
.num.amber { color: var(--amber); }
.num.red { color: var(--red); }
.panel { padding: 22px; }
.panel + .panel { margin-top: 18px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.panel-heading h2 { margin: 0; color: var(--navy); font-size: 16px; }
.panel-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.settlement-workbench { align-items: start; }
.evidence-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.metric-strip { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.metric-strip span { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: #f8fafc; }
.metric-strip strong { color: var(--navy); margin-left: 4px; }
.ocr-table-summary { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: #f8fafc; margin-bottom: 8px; font-size: 13px; }
.ocr-table-summary span { color: var(--muted); }
.text-danger { color: #b42318 !important; }

.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 0 0 18px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); }
.toolbar label { min-width: 145px; margin: 0; }
.toolbar input, .toolbar select { margin-top: 5px; }
.row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
label { display: block; margin: 12px 0 5px; color: #4e6176; font-size: 12px; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink); padding: 9px 10px; }
input::placeholder, textarea::placeholder { color: #a0adbb; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: var(--focus-ring); outline: 0; }
textarea { resize: vertical; }

button, .btn { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--blue); border-radius: 6px; background: var(--blue); color: #fff; padding: 7px 13px; font-weight: 650; cursor: pointer; text-decoration: none; }
button:hover, .btn:hover { background: #1f52b7; text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
button:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.secondary, button.secondary { border-color: var(--line-strong); background: #fff; color: #4b5f75; }
.btn.secondary:hover, button.secondary:hover { border-color: #9eafc1; background: #f8fafc; }
.btn.success, button.success { border-color: var(--teal); background: var(--teal); }
.btn.success:hover, button.success:hover { background: #0c655d; }
.btn.danger, button.danger { border-color: var(--red); background: var(--red); }
.btn.danger:hover, button.danger:hover { background: #9f3439; }
.icon-btn { width: 36px; height: 36px; padding: 0; }
.muted { color: var(--muted); }
.empty-state { padding: 46px 20px; border: 1px dashed var(--line-strong); border-radius: 9px; background: #fbfdff; color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: 4px; color: var(--navy); font-size: 15px; }

.table-wrap, .scroll-x { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 13px; }
th { position: sticky; top: 0; z-index: 1; background: #f4f7fa; color: #50657b; font-size: 11px; font-weight: 750; letter-spacing: .04em; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfdff; }
td .btn, td button { min-height: 30px; padding: 5px 9px; font-size: 12px; }
td.number, th.number { text-align: right; font-variant-numeric: tabular-nums; }
td.select-cell, th.select-cell { width: 42px; padding-right: 4px; padding-left: 10px; text-align: center; }
td.select-cell input, th.select-cell input { width: 16px; height: 16px; accent-color: var(--blue); }
pre { max-height: 320px; overflow: auto; margin: 0; padding: 14px; border-radius: 7px; background: var(--navy-deep); color: #e7eef8; font: 12px/1.65 Consolas, "Microsoft YaHei", monospace; white-space: pre-wrap; }
.status { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 99px; background: #f3f6f9; color: #536579; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status.confirmed, .status.active, .status.matched, .status.succeeded { border-color: #b7e2d5; background: var(--teal-soft); color: #12675e; }
.status.need_review, .status.warning, .status.pending_review, .status.detected, .status.stale, .status.pending, .status.parsed, .status.processing, .status.retry { border-color: #f1d69d; background: var(--amber-soft); color: #8a5a12; }
.status.rejected, .status.duplicate, .status.disabled, .status.voided, .status.superseded, .status.deleted, .status.failed, .status.mismatch { border-color: #f0bfc2; background: var(--red-soft); color: #a3383d; }
.status.failed::before, .status.duplicate::before, .status.mismatch::before { content: "!"; }
.status::before { display: inline-grid; width: 14px; height: 14px; margin-right: 4px; place-items: center; border-radius: 50%; background: currentColor; color: #fff; font-size: 9px; font-weight: 800; line-height: 1; content: ""; opacity: .75; }
.status.active::before, .status.confirmed::before, .status.matched::before, .status.succeeded::before { content: "✓"; }
.status.pending::before, .status.pending_review::before, .status.detected::before, .status.processing::before { content: "…"; }

.status-list { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.status-list .status { min-height: 28px; }
.status-filter { display: inline-flex; align-items: center; min-height: 32px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none; transition: border-color .15s ease, background-color .15s ease, color .15s ease; }
.status-filter:hover, .status-filter:focus-visible { border-color: var(--navy); color: var(--navy); outline: none; }
.status-filter.active { border-color: var(--navy); background: var(--navy); color: #fff; }
.status-filter.need_review.active { background: #a86b00; border-color: #a86b00; }
.status-filter.failed.active { background: #b42318; border-color: #b42318; }
.status-filter.confirmed.active { background: #0f766e; border-color: #0f766e; }
.queue-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.queue-item { padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); }
.queue-item-link { display: block; color: inherit; text-decoration: none; transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease; }
.queue-item-link:hover, .queue-item-link:focus-visible { border-color: var(--navy); background: var(--surface); box-shadow: 0 2px 8px rgba(19,34,56,.08); outline: none; }
.queue-item-link.selected { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); background: #eef4fb; }
.queue-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.queue-value { margin-top: 3px; color: var(--navy); font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; }
.bulk-toolbar { display: flex; min-height: 46px; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; padding: 8px 10px; border: 1px solid #b8cdf4; border-radius: 8px; background: var(--blue-soft); }
.bulk-toolbar[hidden] { display: none; }
.bulk-toolbar strong { color: var(--navy); font-size: 13px; }
.bulk-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bulk-actions button { min-height: 32px; }
.alert { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-left-width: 3px; border-radius: 8px; background: var(--surface-muted); color: var(--ink); }
.alert strong { display: block; margin-bottom: 2px; color: var(--navy); }
.alert.warning { border-color: #e7c27c; border-left-color: var(--amber); background: var(--amber-soft); }
.alert.error { border-color: #e8b1b5; border-left-color: var(--red); background: var(--red-soft); }
.alert.success { border-color: #a9d8ca; border-left-color: var(--teal); background: var(--teal-soft); }
.review-workbench { display: grid; grid-template-columns: minmax(340px, .82fr) minmax(620px, 1.38fr); gap: 18px; align-items: start; }
.evidence-column, .recognition-column { min-width: 0; }
.evidence-card { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.evidence-card > header, .recognition-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface-muted); }
.evidence-card > header h2, .recognition-card > header h2 { margin: 0; font-size: 15px; }
.evidence-card > header p, .recognition-card > header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.evidence-body { padding: 14px; }
.evidence-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.evidence-pane { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); }
.evidence-pane h3 { margin: 0 0 8px; font-size: 12px; }
.evidence-pane pre { max-height: 260px; }
.ocr-preview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; max-height: 280px; overflow: auto; padding: 8px; border: 1px solid var(--line-strong); border-radius: 7px; background: #f6f8fa; }
.ocr-preview-cell { min-width: 0; overflow: hidden; padding: 8px 9px; border: 1px solid var(--line); border-radius: 4px; background: #ffffff; color: var(--ink); font-size: 12px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.ocr-raw-details { margin-top: 8px; color: var(--muted); font-size: 11px; }
.ocr-raw-details summary { cursor: pointer; color: var(--navy); font-weight: 700; }
.ocr-raw-details pre { margin-top: 7px; max-height: 180px; }
.source-image { display: block; width: 100%; max-width: 100%; max-height: 58vh; object-fit: contain; border: 1px solid var(--line); border-radius: 7px; background: #eef3f8; }
.recognition-card { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.recognition-card > form, .recognition-card > .card-body { padding: 16px; }
.review-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.confidence { display: inline-flex; min-height: 24px; align-items: center; padding: 3px 8px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface-muted); color: var(--muted); font-size: 11px; font-weight: 700; }
.confidence.high { border-color: #a9d8ca; background: var(--teal-soft); color: #12675e; }
.confidence.low { border-color: #e8b1b5; background: var(--red-soft); color: #a3383d; }
.review-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
.review-summary-grid > div { min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-muted); }
.review-summary-grid span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.review-summary-grid strong { display: block; margin-top: 4px; overflow: hidden; color: var(--navy); font-size: 14px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.review-sheet-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.review-sheet { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.review-sheet th, .review-sheet td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; text-align: left; }
.review-sheet thead th { position: sticky; top: 0; z-index: 1; background: #eef3f8; color: var(--navy); font-size: 11px; font-weight: 750; white-space: nowrap; }
.review-sheet tbody tr:last-child td { border-bottom: 0; }
.review-sheet tbody td:first-child { width: 128px; color: var(--navy); font-weight: 700; white-space: nowrap; }
.review-sheet tbody td:nth-child(2) { width: 260px; }
.review-sheet tbody td:nth-child(3) { width: 90px; white-space: nowrap; }
.review-sheet tbody td:last-child { color: var(--muted); font-size: 11px; }
.review-sheet input { width: 100%; min-height: 32px; box-sizing: border-box; padding: 6px 8px; border: 1px solid #c9d5e2; border-radius: 5px; background: #fff; color: var(--ink); font: inherit; }
.review-sheet input:focus { border-color: var(--blue); outline: 2px solid rgba(39, 103, 218, .16); }
.review-sheet .number-input { text-align: right; font-variant-numeric: tabular-nums; }
.review-sheet .sheet-section th { padding: 7px 10px; border-bottom-color: #c9d5e2; background: #f5f8fb; color: var(--navy); font-size: 11px; letter-spacing: .03em; }
.review-sheet .cell-missing td:first-child { border-left: 3px solid var(--red); padding-left: 7px; }
.review-sheet .cell-missing input { border-color: #e7a9ad; background: var(--red-soft); }
.cell-state { display: inline-flex; min-height: 22px; align-items: center; padding: 2px 7px; border: 1px solid var(--line); border-radius: 99px; font-size: 10px; font-weight: 750; }
.cell-state.ok { border-color: #a9d8ca; background: var(--teal-soft); color: #12675e; }
.cell-state.missing { border-color: #e8b1b5; background: var(--red-soft); color: #a3383d; }
.cell-state.neutral { border-color: var(--line); background: #f5f7fa; color: var(--muted); }
.sheet-note { margin: 9px 0 0; color: var(--muted); font-size: 11px; }
.form-section { margin: 0 0 16px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); }
.form-section h3 { margin: 0 0 8px; font-size: 13px; }
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.reconciliation { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.reconciliation-item { padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); }
.reconciliation-item.warn { border-color: #e7c27c; background: var(--amber-soft); }
.reconciliation-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.reconciliation-value { margin-top: 3px; color: var(--navy); font-size: 17px; font-weight: 750; font-variant-numeric: tabular-nums; }
.dialog-warning { margin: 0 0 12px; padding: 9px 10px; border-left: 3px solid var(--red); background: var(--red-soft); color: #8f3036; font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.workbench { display: grid; grid-template-columns: minmax(320px, 40%) minmax(600px, 60%); gap: 18px; align-items: start; }
.workbench > section { min-width: 0; }
.sticky { position: sticky; top: 18px; }
.source-image { max-width: 100%; max-height: 72vh; object-fit: contain; border: 1px solid var(--line); border-radius: 7px; background: #f8fafc; }
.item-table { min-width: 1450px; }
.item-table input, .item-table select { min-width: 90px; padding: 7px; }
.item-table .wide { min-width: 140px; }
.dialog-error, .error { min-height: 18px; color: var(--red); font-size: 12px; }
dialog.reason-dialog { width: min(520px, calc(100vw - 24px)); box-sizing: border-box; border: 1px solid var(--line-strong); border-radius: 10px; padding: 22px; color: var(--ink); box-shadow: 0 20px 70px rgba(13,24,40,.25); }
dialog.reason-dialog::backdrop { background: rgba(13,24,40,.42); }
.reason-dialog form { margin: 0; }
.reason-dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 18px 0 0; }

@media (max-width: 1180px) {
  .sidebar { width: 220px; }
  .app-shell { margin-left: 220px; }
  .topbar { padding: 0 24px; }
  .page-shell { padding: 26px 24px 42px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workbench { grid-template-columns: 1fr; }
  .review-workbench { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: 100%; min-height: auto; }
  .brand { padding: 14px 16px; }
  .sidebar-nav { display: flex; gap: 4px; overflow-x: auto; padding: 9px 10px 11px; }
  .nav-section { display: none; }
  .sidebar-nav a { flex: 0 0 auto; min-height: 34px; padding: 6px 10px; }
  .sidebar-footer { display: none; }
  .app-shell { margin-left: 0; }
  .topbar { min-height: 54px; padding: 0 16px; }
  .topbar-title { font-size: 13px; }
  .topbar-meta { gap: 8px; }
  .ui-style-picker, .ocr-style-picker { display: none; }
  .health-chip { display: none; }
  .page-shell { padding: 22px 14px 32px; }
  .page-heading { display: block; margin-bottom: 18px; }
  .page-heading h1 { font-size: 24px; }
  .page-actions { justify-content: flex-start; margin-top: 14px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { min-height: 104px; padding: 14px; }
  .num { margin-top: 11px; font-size: 25px; }
  .row { grid-template-columns: 1fr; }
  .queue-strip, .reconciliation { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ocr-preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { padding: 14px; }
  th, td { padding: 10px; }
}

/* Project bulk configuration: dense workbench controls for hundreds of groups. */
.bulk-config-panel{border-top:3px solid var(--primary,#1f66b3)}
.bulk-config-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.bulk-config-card{display:flex;flex-direction:column;gap:10px;padding:16px;border:1px solid var(--border,#d7e0ea);border-radius:8px;background:var(--surface,#fff)}
.bulk-config-card h3{margin:0;font-size:16px}.bulk-config-card label{display:grid;gap:6px}.bulk-config-card select[multiple]{min-height:190px}
.project-list-filter{display:flex;align-items:end;gap:12px;margin-top:16px;padding-top:16px;border-top:1px solid var(--border,#d7e0ea)}
.project-list-filter label{display:grid;gap:6px;min-width:min(520px,100%)}
@media(max-width:980px){.bulk-config-grid{grid-template-columns:1fr}.project-list-filter{align-items:stretch;flex-direction:column}}

.report-workspace-tabs{position:static;display:flex;gap:4px;padding:4px;margin:12px 0;background:#fff;border:1px solid var(--border,#d7e0ea);border-radius:8px;box-shadow:0 2px 8px rgba(15,38,64,.06);overflow-x:auto}
.report-workspace-tabs button{appearance:none;border:0;background:transparent;color:var(--muted,#60758a);font-weight:600;white-space:nowrap;padding:10px 14px;border-radius:6px;cursor:pointer}
.report-workspace-tabs button:hover{background:#f1f5f9;color:var(--ink,#102a43)}
.report-workspace-tabs button.active{background:var(--primary,#1f66b3);color:#fff}
.report-workspace-tabs button:focus-visible{outline:3px solid rgba(31,102,179,.24);outline-offset:2px}
.report-workspace-section[hidden]{display:none!important}
@media(max-width:600px){.report-workspace-tabs button{min-height:44px;padding:9px 12px}}
@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr; }
  .queue-strip, .reconciliation { grid-template-columns: 1fr; }
  .topbar-meta .role-chip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* BillBot Audit Desk: a single enterprise/data-dense visual system. */
body { background: var(--canvas); color: var(--ink); font-size: 14px; }
h1 { font-size: 26px; font-weight: 760; letter-spacing: -.025em; }
h2 { font-size: 18px; font-weight: 730; letter-spacing: -.015em; }
h3 { font-size: 14px; font-weight: 720; }
.sidebar {
  width: 256px;
  background: #0d2033;
  border-right: 1px solid #1b3854;
}
.brand { min-height: 72px; padding: 17px 20px; border-bottom-color: #1c3852; }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; background: #1f6fb5; }
.brand-name { font-size: 17px; letter-spacing: 0; }
.brand-subtitle { color: #a5b7c9; }
.sidebar-nav { padding: 16px 12px 20px; }
.nav-section { margin: 20px 10px 7px; color: #88a0b8; font-size: 10px; letter-spacing: .1em; }
.sidebar-nav a { min-height: 40px; border-radius: 6px; color: #c4d2df; font-size: 13px; }
.sidebar-nav a:hover { background: #173652; }
.sidebar-nav a.active { background: #1d466b; box-shadow: inset 3px 0 0 #4fb3a5; color: #ffffff; }
.sidebar-footer { padding: 14px 20px; border-top-color: #1c3852; }
.app-shell { margin-left: 256px; }
.topbar {
  min-height: 60px;
  padding: 0 28px;
  border-bottom-color: #d5e0ea;
  background: #ffffff;
}
.topbar-title { color: #18344e; font-size: 13px; font-weight: 720; }
.topbar-meta { flex-wrap: wrap; gap: 8px 10px; }
.topbar .ui-style-picker { display: none !important; }
.health-chip { padding: 5px 8px; border: 1px solid #bfe3d7; border-radius: 999px; background: #effaf6; font-size: 11px; }
.role-chip { padding: 6px 9px; border-radius: 6px; background: #f5f8fb; }
.ui-style-trigger { min-height: 34px; padding: 7px 10px; border-radius: 6px; background: #ffffff; font-size: 11px; }
.ui-style-menu { top: calc(100% + 8px); width: 224px; padding: 7px; border-radius: 8px; box-shadow: 0 12px 28px rgba(16,42,67,.16); }
.ui-style-menu button { min-height: 44px; padding: 8px 10px; border-radius: 5px; }
.page-shell { max-width: 1600px; padding: 26px 30px 48px; }
.page-heading { margin-bottom: 20px; }
.page-heading h1 { margin-bottom: 0; }
.page-heading p { font-size: 13px; line-height: 1.6; }
.eyebrow { color: var(--blue); font-size: 10px; letter-spacing: .14em; }
.card, .panel { border-radius: 8px; box-shadow: 0 1px 2px rgba(16,42,67,.04); }
.card { min-height: 116px; padding: 16px 17px 15px; }
.card::after { height: 2px; }
.card-label { font-size: 11px; }
.num { margin-top: 14px; font-size: 28px; }
.panel { padding: 18px; }
.panel + .panel { margin-top: 14px; }
.toolbar { gap: 10px; margin-bottom: 14px; padding: 10px; border-radius: 8px; background: #f7f9fb; }
input, select, textarea { min-height: 38px; padding: 8px 10px; border-radius: 6px; border-color: #b9c9d8; }
label { margin-top: 10px; color: #456078; font-size: 12px; }
button, .btn { min-height: 38px; padding: 8px 13px; border-radius: 6px; font-size: 13px; font-weight: 680; }
button:hover, .btn:hover { transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(0); }
table { border-radius: 8px; }
th, td { padding: 11px 12px; }
th { background: #f3f6f9; color: #49627a; font-size: 10px; letter-spacing: .06em; }
tbody tr:hover td { background: #f7fbff; }
.status { min-height: 25px; padding: 3px 9px; font-size: 11px; }
.review-workbench { grid-template-columns: minmax(360px, .8fr) minmax(700px, 1.5fr); gap: 16px; }
.evidence-card, .recognition-card { border-radius: 8px; box-shadow: 0 1px 2px rgba(16,42,67,.05); }
.evidence-card { border-top: 4px solid #2a6eaa; }
.recognition-card { border-top: 4px solid #0f766e; }
.evidence-card > header, .recognition-card > header { padding: 15px 17px; background: #ffffff; }
.evidence-card > header h2, .recognition-card > header h2 { font-size: 16px; }
.evidence-card > header p, .recognition-card > header p { font-size: 12px; line-height: 1.5; }
.evidence-body { padding: 14px; }
.evidence-pane { padding: 12px; border-radius: 6px; background: #f7f9fb; }
.evidence-pane h3 { margin-bottom: 9px; color: #36536e; font-size: 12px; letter-spacing: .01em; }
.source-image { border-radius: 6px; background: #eef3f8; }
.ocr-preview-grid { max-height: 300px; }
.ocr-preview-cell { min-height: 34px; padding: 8px 9px; }
.recognition-card > form, .recognition-card > .card-body { padding: 16px 17px 18px; }
.review-meta { margin-bottom: 12px; }
.review-summary-grid { gap: 8px; margin-bottom: 12px; }
.review-summary-grid > div { padding: 10px 11px; border-radius: 6px; background: #f7f9fb; }
.review-summary-grid strong { font-size: 15px; }
.review-sheet-wrap { border-radius: 7px; }
.review-sheet { font-size: 13px; }
.review-sheet th, .review-sheet td { padding: 10px 11px; }
.review-sheet thead th { background: #edf3f8; font-size: 10px; }
.review-sheet .sheet-section th { padding: 8px 11px; background: #f4f7fa; font-size: 10px; }
.review-sheet input { min-height: 36px; border-radius: 5px; }
.sheet-note { font-size: 12px; line-height: 1.6; }
.action-bar { gap: 8px; margin-top: 18px; padding-top: 16px; }
.alert { border-radius: 7px; line-height: 1.55; }
.empty-state { padding: 34px 18px; border-radius: 7px; }

@media (max-width: 1180px) {
  .sidebar { width: 228px; }
  .app-shell { margin-left: 228px; }
  .topbar { padding: 0 22px; }
  .page-shell { padding: 24px 22px 42px; }
}
@media (max-width: 760px) {
  .sidebar { width: 100%; }
  .app-shell { margin-left: 0; }
  .topbar { min-height: 56px; padding: 0 16px; }
  .topbar-meta { gap: 6px; }
  .page-shell { padding: 20px 14px 32px; }
  .page-heading h1 { font-size: 23px; }
  .card { min-height: 104px; }
  .review-workbench { grid-template-columns: 1fr; }
  .recognition-card { position: static !important; }
}

/* Accuracy-first OCR rendering.  A text-only result is never laid out as a
   fake table; a real table uses the saved row/column coordinates. */
.ocr-structure-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 8px; color: var(--muted); font-size: 11px; }
.ocr-structure-meta strong { color: var(--navy); font-size: 12px; }
.ocr-structured-grid { grid-template-columns: repeat(var(--ocr-columns, 3), minmax(0, 1fr)) !important; grid-auto-rows: minmax(34px, auto); align-items: stretch; }
.ocr-structured-cell { overflow: visible; text-overflow: clip; white-space: normal; word-break: break-word; }
.ocr-preview-text { max-height: 300px; overflow: auto; padding: 0; border: 1px solid var(--line-strong); border-radius: 6px; background: #ffffff; }
.ocr-text-line { min-height: 32px; padding: 7px 10px; border-bottom: 1px solid var(--line); color: var(--ink); font: 12px/1.5 Consolas, "Microsoft YaHei", monospace; white-space: pre-wrap; word-break: break-word; }
.ocr-text-line:last-child { border-bottom: 0; }
.ocr-text-line:nth-child(even) { background: #f8fafc; }
.ocr-accuracy-note { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; padding: 8px 10px; border-left: 3px solid var(--amber); background: var(--amber-soft); color: #79500f; font-size: 11px; line-height: 1.5; }
.ocr-accuracy-note strong { color: #6b430a; font-size: 12px; }
html[data-ocr-style="raw"] .ocr-preview-text { border-color: #263d55; background: #0d1a2a; }
html[data-ocr-style="raw"] .ocr-structured-grid { display: grid !important; }
html[data-ocr-style="raw"] .ocr-text-line { border-color: rgba(255,255,255,.12); background: #0d1a2a; color: #f3f7fb; }
html[data-ocr-style="raw"] .ocr-text-line:nth-child(even) { background: #12263d; }
html[data-ocr-style="sheet"] .ocr-preview-text { border-radius: 2px; }
html[data-ocr-style="sheet"] .ocr-text-line { min-height: 34px; border-color: #b9c1c8; background: #ffffff; color: #1b2229; font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif; }
html[data-ocr-style="sheet"] .ocr-text-line:nth-child(even) { background: #f1f3f5; }
html[data-ocr-style="grid"] .ocr-preview-text { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 8px; border-color: #b8c8d8; background: #eef3f8; }
html[data-ocr-style="grid"] .ocr-text-line { min-height: 38px; padding: 9px 10px; border: 1px solid #c7d4e1; border-radius: 4px; background: #ffffff; color: #1f3348; }
html[data-ocr-style="grid"] .ocr-text-line:nth-child(even) { background: #ffffff; }
html[data-ocr-style="cards"] .ocr-preview-text { padding: 8px; border-color: #c7d4e1; background: #eef3f8; }
html[data-ocr-style="cards"] .ocr-preview-text { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
html[data-ocr-style="cards"] .ocr-text-line { min-height: 48px; margin: 0; padding: 12px; border: 1px solid #c7d4e1; border-radius: 7px; background: #ffffff; box-shadow: 0 1px 2px rgba(16,42,67,.06); }
html[data-ocr-style="cards"] .ocr-text-line:nth-child(even) { background: #ffffff; }
html[data-ocr-style="lines"] .ocr-preview-text { counter-reset: ocr-text-line; border-color: #b7c7d6; background: #ffffff; }
html[data-ocr-style="lines"] .ocr-text-line { counter-increment: ocr-text-line; min-height: 36px; padding: 8px 10px 8px 42px; border-bottom: 1px solid #d5e0ea; background: #ffffff; color: #1f3348; position: relative; }
html[data-ocr-style="lines"] .ocr-text-line::before { content: counter(ocr-text-line, decimal-leading-zero); position: absolute; left: 10px; color: #71859a; font: 11px/1.5 Consolas, monospace; }
html[data-ocr-style="lines"] .ocr-text-line:nth-child(even) { background: #f7f9fb; }
html[data-ocr-style="compact"] .ocr-text-line { min-height: 24px; padding: 4px 7px; font-size: 11px; line-height: 1.3; }

/* Production operations: dense by design, with one clear action per row. */
.ops-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.dashboard-link { display: block; color: inherit; text-decoration: none; }.dashboard-link small { display: block; margin-top: 8px; color: #6c8195; font-size: 11px; }
.ops-metric { display: flex; flex-direction: column; gap: 5px; min-height: 78px; padding: 13px 15px; border: 1px solid #d5e0ea; border-radius: 8px; background: #fff; color: #4a6077; text-decoration: none; box-shadow: 0 1px 2px rgba(16,42,67,.035); }
.ops-metric:hover { border-color: #8eafc9; background: #f8fbfd; }
.ops-metric span { font-size: 11px; font-weight: 650; letter-spacing: .04em; }
.ops-metric strong { color: #173752; font-size: 25px; font-variant-numeric: tabular-nums; line-height: 1; }
.ops-metric.warning { border-top: 3px solid #c48412; }.ops-metric.danger { border-top: 3px solid #c94040; }
.filter-check { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; margin: 0; }.filter-check input { min-height: auto; }
.task-note { max-width: 250px; color: #5d7084; font-size: 12px; line-height: 1.45; word-break: break-word; }
.task-actions { white-space: nowrap; }.task-actions .btn { margin: 2px 4px 2px 0; }
.workbench-section { margin: 0 0 20px; padding: 18px; border: 1px solid #d9e3ec; border-radius: 8px; background: #fff; box-shadow: 0 1px 2px rgba(16,42,67,.035); }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin: 0 0 14px; }.section-heading h2 { margin: 0 0 3px; }.section-heading p { margin: 0; color: #6a7c8e; font-size: 12px; }
.log-section { background: #fbfcfd; }.notice-card { display: flex; gap: 12px; align-items: baseline; margin: 0 0 16px; padding: 12px 14px; border-left: 3px solid #2a6eaa; background: #f2f7fb; color: #486176; font-size: 13px; }.notice-card strong { color: #1b425f; }
.quality-panel { border-top: 3px solid #0f766e; }.quality-score { display: inline-flex; align-items: baseline; gap: 9px; margin: 2px 0 14px; padding: 8px 10px; border-radius: 6px; background: #f3f7fa; color: #526a7f; }.quality-score strong { color: #153a57; font-size: 24px; font-variant-numeric: tabular-nums; }.quality-score em { font-size: 12px; font-style: normal; font-weight: 700; }.quality-score.grade-C,.quality-score.grade-D { background: #fff6e8; color: #8c5a0a; }.quality-score.grade-D strong { color: #b33434; }
.access-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.access-summary > div { display: grid; gap: 4px; min-height: 100px; padding: 14px 16px; border: 1px solid #d7e2eb; border-top: 3px solid #2a6eaa; border-radius: 8px; background: #fff; box-shadow: 0 1px 2px rgba(16,42,67,.035); }
.access-summary > div:nth-child(2) { border-top-color: #0f766e; }.access-summary > div:nth-child(3) { border-top-color: #c48412; }
.access-summary span,.access-summary small { color: #61778b; font-size: 12px; }.access-summary strong { color: #173752; font-size: 27px; line-height: 1; font-variant-numeric: tabular-nums; }
.access-queue td { vertical-align: top; }.access-actions { min-width: 200px; }.access-review { width: min(330px, 100%); }.access-review summary { cursor: pointer; color: #1d5d91; font-size: 12px; font-weight: 700; }.access-review form { display: grid; gap: 8px; margin-top: 9px; padding: 10px; border-left: 2px solid #82a8c9; background: #f7fafc; }.access-review label { display: grid; gap: 5px; margin: 0; }.access-review fieldset { margin: 0; padding: 8px; border: 1px solid #d6e1ea; border-radius: 6px; }.access-review legend { padding: 0 4px; color: #526b81; font-size: 11px; font-weight: 700; }.binding-checklist { display: grid; max-height: 126px; gap: 5px; overflow: auto; }.binding-checklist label { display: flex; align-items: center; gap: 6px; min-height: 28px; margin: 0; font-size: 12px; }.binding-checklist input { min-height: auto; }.text-danger { margin-top: 7px; padding: 0; border: 0; background: transparent; color: #b13a3a; font-size: 12px; }.text-danger:hover { background: transparent; color: #8e2727; }
@media (max-width: 760px) { .ops-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }.workbench-section { padding: 14px; }.task-note { max-width: 170px; } }
@media (max-width: 760px) { .access-summary { grid-template-columns: 1fr; }.access-actions { min-width: 180px; } }

/* Sales channel-report detail: source-first ledger, designed for correction and review. */
.report-detail-shell { display: grid; gap: 14px; min-width: 0; }
.report-detail-shell > *, #detailContent, #detailContent > *, .report-detail-shell .panel,
.report-detail-shell .table-wrap { min-width: 0; max-width: 100%; }
.report-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 2px 0 4px; }
.report-detail-header h1 { margin: 3px 0 7px; }.report-detail-header p { max-width: 760px; margin: 0; color: #60758a; line-height: 1.55; }
.report-detail-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }.detail-loading { padding: 22px; border: 1px dashed #b7c9d9; border-radius: 8px; background: #f7fafc; color: #557087; }
.report-identity { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 18px; border-left: 4px solid #1f6fb5; }
.report-identity-main { display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 12px 24px; width: 100%; }.report-identity-main > div { display: grid; gap: 4px; }.field-label { color: #708499; font-size: 11px; font-weight: 700; letter-spacing: .05em; }.report-identity-main strong { color: #183a56; font-size: 14px; font-variant-numeric: tabular-nums; }
.report-identity-state { display: flex; flex: 0 0 auto; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }.calculation-state { display: inline-flex; min-height: 25px; align-items: center; padding: 3px 8px; border: 1px solid #c9d9e7; border-radius: 999px; color: #4d6b84; background: #f5f8fb; font-size: 11px; font-weight: 700; }
.report-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }.report-kpis article { min-height: 92px; padding: 14px 16px; border: 1px solid #d7e2eb; border-top: 3px solid #2a6eaa; border-radius: 8px; background: #fff; box-shadow: 0 1px 2px rgba(16,42,67,.035); }.report-kpis article:nth-child(2) { border-top-color: #0f766e; }.report-kpis article:nth-child(3) { border-top-color: #bf7a0a; }.report-kpis article:nth-child(4) { border-top-color: #94515b; }.report-kpis span,.report-kpis small { display: block; color: #60778c; font-size: 11px; }.report-kpis strong { display: block; margin: 8px 0 5px; color: #173752; font-size: 25px; line-height: 1; font-variant-numeric: tabular-nums; }
.report-detail-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .9fr); gap: 14px; align-items: start; }.report-detail-grid-wide { grid-template-columns: minmax(0, 1.3fr) minmax(330px, .9fr); }.source-timeline,.exception-panel,.history-panel,.activity-panel { min-width: 0; }.source-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }.source-tag { display: inline-flex; min-height: 23px; align-items: center; padding: 2px 7px; border-radius: 999px; background: #eef3f8; color: #506b82; font-size: 10px; font-weight: 750; }.source-tag.telegram { background: #e9f1fb; color: #28649a; }.source-tag.ocr { background: #eee9fb; color: #644aa1; }.source-tag.ops { background: #e8f7f2; color: #126c5e; }.source-tag.manual { background: #fff3df; color: #8a5706; }
.source-groups { display: grid; gap: 10px; }.source-group { border: 1px solid #dbe5ed; border-radius: 7px; background: #fbfcfd; overflow: hidden; }.source-group > header { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-bottom: 1px solid #e0e8ef; background: #f4f7fa; color: #35536c; font-size: 12px; }.source-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 9px; }.source-fact { min-width: 0; padding: 10px; border: 1px solid #d9e3ec; border-left: 3px solid #7c9ab7; border-radius: 5px; background: #fff; }.source-fact.telegram { border-left-color: #2a6eaa; }.source-fact.ocr { border-left-color: #6c52aa; }.source-fact.ops { border-left-color: #0f766e; }.source-fact.manual { border-left-color: #bf7a0a; }.source-fact-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }.source-fact-head strong { color: #29445b; font-size: 12px; }.official-mark { padding: 2px 5px; border-radius: 3px; background: #e6f5ef; color: #137060; font-size: 10px; font-weight: 750; }.source-fact-value { margin: 9px 0 6px; overflow: hidden; color: #173752; font-size: 19px; font-weight: 730; font-variant-numeric: tabular-nums; text-overflow: ellipsis; }.source-fact-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; color: #6c8195; font-size: 10px; }.source-fact details { margin-top: 8px; color: #42617b; font-size: 11px; }.source-fact summary,.activity-item summary { cursor: pointer; color: #23669d; font-weight: 700; }.source-fact pre,.activity-item pre { max-height: 180px; margin: 7px 0; overflow: auto; padding: 8px; border-radius: 4px; background: #102438; color: #dfeaf3; font: 11px/1.45 Consolas, "Microsoft YaHei", monospace; white-space: pre-wrap; word-break: break-word; }
.calculation-panel { border-top: 3px solid #0f766e; }.calculation-list { display: grid; gap: 0; margin: 0; }.calculation-list > div { display: grid; grid-template-columns: 106px minmax(0, 1fr); gap: 10px; padding: 11px 0; border-bottom: 1px solid #e1e8ee; }.calculation-list > div:last-child { border-bottom: 0; }.calculation-list dt { color: #60778c; font-size: 12px; font-weight: 700; }.calculation-list dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: #193c58; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }.calculation-note { margin: 14px 0 0; padding: 9px 10px; border-left: 3px solid #c48412; background: #fff7e9; color: #79530f; font-size: 11px; line-height: 1.5; }
.exception-list,.history-list,.activity-list { display: grid; gap: 8px; }.exception-item { padding: 11px 12px; border: 1px solid #dae4ed; border-left: 3px solid #c48412; border-radius: 6px; background: #fff; }.exception-item.error { border-left-color: #c23e46; background: #fffafb; }.exception-item > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }.exception-item strong { color: #25435c; font-size: 13px; }.exception-item span { color: #6b7e90; font-size: 11px; }.exception-item p { max-height: 82px; margin: 8px 0 4px; overflow: auto; color: #566d82; font: 11px/1.45 Consolas, "Microsoft YaHei", monospace; white-space: pre-wrap; }.exception-item small { color: #527088; font-size: 11px; }.correction-panel { border-top: 3px solid #c48412; }.correction-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 12px; }.correction-form label { display: grid; gap: 5px; margin: 0; color: #466178; font-size: 12px; font-weight: 700; }.correction-form label:nth-child(3),.correction-form label:nth-child(4),.correction-form .form-help,.correction-form button,.correction-form .form-result { grid-column: 1 / -1; }.correction-form textarea { resize: vertical; }.correction-form input[type="file"] { padding: 7px; background: #f8fafc; }.form-help { margin: 0; color: #657c90; font-size: 11px; line-height: 1.5; }.form-result { min-height: 18px; margin: 0; color: #176f60; font-size: 12px; }
.review-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 18px; border-left: 4px solid #0f766e; }.review-panel h2 { margin: 4px 0; }.review-panel p { margin: 0; color: #657b8e; font-size: 12px; }.review-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; text-align: right; }.review-actions span { max-width: 280px; color: #5f788d; font-size: 12px; }.history-item,.activity-item { padding: 10px 11px; border: 1px solid #dbe5ed; border-radius: 6px; background: #fbfcfd; }.history-item > div,.activity-item { display: grid; gap: 4px; }.history-item > div { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; }.history-item strong,.activity-item strong { color: #24445f; font-size: 12px; }.history-item span,.activity-item span { color: #71869a; font-size: 11px; }.history-item p { margin: 4px 0; color: #193c58; font: 12px/1.4 Consolas, "Microsoft YaHei", monospace; }.history-item small { color: #597187; font-size: 11px; }.history-item .text-link { justify-self: start; margin-top: 3px; }.version-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #e1e8ee; }.version-item { display: grid; min-width: 90px; gap: 2px; padding: 8px 9px; border: 1px solid #d3e0ea; border-radius: 5px; color: #49677f; text-decoration: none; }.version-item:hover,.version-item.current { border-color: #2a6eaa; background: #edf6fc; color: #1b5f96; }.version-item strong { font-size: 13px; }.version-item span,.version-item small { font-size: 10px; }
.sales-detail-link { display: block; width: max-content; margin-top: 7px; font-size: 11px; }
.finance-review-shell { display: grid; gap: 16px; }
.finance-review-hero { margin-bottom: 0; }
.finance-review-metrics .sales-metric { cursor: default; }
.finance-review-metrics .sales-metric:hover { border-color: var(--line); box-shadow: var(--shadow); transform: none; }
.finance-review-table td { vertical-align: middle; }
.finance-review-table td small { display: block; margin-top: 4px; color: #708499; font-size: 11px; }
.finance-open-detail { white-space: nowrap; }
.finance-evidence-panel { border-top: 3px solid #1f6fb5; }
.finance-evidence-points { display: grid; gap: 8px; margin-top: 12px; }
.finance-evidence-points span { position: relative; padding-left: 17px; color: #516e85; font-size: 12px; line-height: 1.45; }
.finance-evidence-points span::before { position: absolute; left: 0; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: #1f6fb5; content: ""; }
.button-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.btn.danger { border-color: #b42318; background: #b42318; color: #fff; }
.btn.danger:hover { background: #8f1c13; border-color: #8f1c13; }
.finance-return-dialog,.finance-confirm-dialog { width: min(500px, calc(100vw - 32px)); border: 1px solid #b9cad8; border-radius: 10px; box-shadow: 0 20px 48px rgba(16,42,67,.24); color: #183a56; }
.finance-return-dialog::backdrop,.finance-confirm-dialog::backdrop { background: rgba(11,29,47,.42); }
.finance-return-dialog form,.finance-confirm-dialog form { display: grid; gap: 12px; padding: 4px; }
.finance-return-dialog h2,.finance-confirm-dialog h2 { margin: 0; font-size: 19px; }
.finance-return-dialog p,.finance-confirm-dialog p { margin: 0; color: #5f788d; font-size: 13px; line-height: 1.55; }
.finance-return-dialog label,.finance-confirm-dialog label { display: grid; gap: 6px; color: #466178; font-size: 12px; font-weight: 700; }
.finance-return-dialog textarea,.finance-confirm-dialog textarea { resize: vertical; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
@media (max-width: 980px) { .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }.report-detail-grid,.report-detail-grid-wide { grid-template-columns: 1fr; }.source-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .report-detail-header,.report-identity,.review-panel { align-items: stretch; flex-direction: column; }.report-detail-actions,.review-actions { justify-content: flex-start; text-align: left; }.report-identity-main { grid-template-columns: repeat(2, minmax(0, 1fr)); }.report-identity-state { justify-content: flex-start; }.source-facts { grid-template-columns: 1fr; }.report-detail-shell .panel { padding: 14px; }.report-kpis article { min-height: 84px; padding: 12px; }.report-kpis strong { font-size: 22px; }.correction-form { grid-template-columns: 1fr; }.calculation-list > div { grid-template-columns: 95px minmax(0, 1fr); }.review-actions { align-items: flex-start; flex-direction: column; }.review-actions span { max-width: none; }.history-item > div { grid-template-columns: 1fr; }.report-detail-header h1 { font-size: 22px; }.button-row { width: 100%; justify-content: flex-start; }.button-row .btn { min-height: 42px; }.finance-open-detail { width: 100%; text-align: center; } }
@media (max-width: 420px) { .report-kpis { grid-template-columns: 1fr; }.report-identity-main { grid-template-columns: 1fr; }.report-detail-actions .btn { flex: 1; text-align: center; }.source-fact-value { font-size: 18px; } }

/* Paired finance output: the report and settlement sheet remain visually
   separate, while their common version and audit trail stay adjacent. */
.paired-output-panel { border-top: 3px solid #2a6eaa; }
.paired-output-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.paired-output-card { min-width: 0; padding: 13px; border: 1px solid #d7e2eb; border-radius: 7px; background: #fbfcfd; }
.report-output-card { border-top: 3px solid #0f766e; }.settlement-output-card { border-top: 3px solid #2a6eaa; }.audit-output-card { border-top: 3px solid #c48412; }
.paired-output-heading { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding-bottom: 10px; border-bottom: 1px solid #e1e8ee; color: #23415c; font-size: 13px; }
.paired-output-list { display: grid; margin: 8px 0 0; }.paired-output-list > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 7px 0; border-bottom: 1px solid #edf1f4; }.paired-output-list > div:last-child { border-bottom: 0; }
.paired-output-list dt { color: #60778c; font-size: 11px; }.paired-output-list dd { margin: 0; color: #183a56; font-size: 12px; font-weight: 720; font-variant-numeric: tabular-nums; text-align: right; }.paired-output-card > p { margin: 11px 0 0; color: #637b8e; font-size: 11px; line-height: 1.5; }
.paired-output-empty { display: grid; gap: 5px; padding: 14px; border: 1px dashed #bdccd9; border-radius: 7px; background: #f8fafc; color: #61798d; font-size: 12px; }.paired-output-empty strong { color: #284963; }
.finance-review-history { display: grid; gap: 7px; margin: 11px 0 0; padding: 10px 0 0; border-top: 1px solid #e1e8ee; list-style: none; }.finance-review-history li { display: grid; gap: 2px; }.finance-review-history strong { color: #2a4b65; font-size: 11px; }.finance-review-history span { color: #698095; font-size: 10px; line-height: 1.45; }
.finance-export-actions { justify-content: flex-end; }
.finance-return-redirect { display: grid; gap: 7px; margin-top: 12px; padding: 12px; border-left: 3px solid #c48412; background: #fff7e9; color: #704b0d; font-size: 12px; line-height: 1.5; }.finance-return-redirect strong { color: #6a430a; }.finance-return-redirect .btn { justify-self: start; }
@media (max-width: 980px) { .paired-output-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .finance-export-actions .btn { flex: 1; text-align: center; } }

/* Guided production decisions: keep blockers and next actions visible. */
.task-note { max-width: 280px; }.task-note strong,.task-note span { display: block; }.task-note strong { margin-bottom: 4px; color: #294760; font-size: 12px; }.task-note span { color: #6a7f92; font-size: 11px; }
.workflow-dock { position: static; top: auto; z-index: auto; box-shadow: var(--shadow); }

/* Workflow simplification: one queue, one status explanation, one primary action. */
.sales-hero-compact { margin-bottom: 16px; padding-bottom: 16px; }
.workflow-groups { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-bottom: 16px; }
.workflow-group { display: grid; gap: 5px; min-height: 112px; padding: 14px 16px; color: var(--ink); text-decoration: none; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: border-color .16s cubic-bezier(.23,1,.32,1), transform .16s cubic-bezier(.23,1,.32,1); }
.workflow-group:hover { border-color: #8fb2cf; transform: translateY(-1px); }
.workflow-group.active { border-color: #1f6fb5; box-shadow: 0 0 0 2px rgba(31,111,181,.1); }
.workflow-group > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.workflow-group > strong { color: #163a57; font-size: 27px; line-height: 1; font-variant-numeric: tabular-nums; }
.workflow-group > small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.unified-work-queue { padding: 16px; }
.work-item-list { display: grid; gap: 8px; }
.work-item { display: grid; grid-template-columns: minmax(190px,.75fr) minmax(420px,1.7fr) auto; align-items: center; gap: 16px; padding: 14px; border: 1px solid #dbe4ec; border-radius: 8px; background: #fff; }
.work-item-identity { display: grid; gap: 5px; min-width: 0; }
.work-item-identity .status { width: max-content; }
.work-item-identity strong,.work-item-identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-item-identity small { color: var(--muted); }
.work-item-guidance { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin: 0; }
.work-item-guidance div { min-width: 0; }
.work-item-guidance dt { margin-bottom: 4px; color: #71869a; font-size: 10px; font-weight: 750; letter-spacing: .04em; }
.work-item-guidance dd { margin: 0; color: #29475f; font-size: 12px; line-height: 1.45; }
.work-item-primary { min-width: 126px; text-align: center; }
.status.business-needs_action { color: #855400; background: #fff5df; border-color: #efd39b; }
.status.business-processing { color: #285f8b; background: #eef6fc; border-color: #c9ddec; }
.status.business-waiting_finance { color: #5f4a89; background: #f3effb; border-color: #d8ccec; }
.status.business-completed { color: #0d6758; background: #e9f7f2; border-color: #b9dfd4; }
.compact-more { position: relative; }
.compact-more > summary { cursor: pointer; list-style: none; }
.compact-more > summary::-webkit-details-marker { display: none; }
.compact-more > div { position: absolute; right: 0; z-index: 15; min-width: 180px; margin-top: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 7px; background: #fff; box-shadow: 0 10px 30px rgba(25,55,80,.12); }
.compact-more > div a,.compact-more > .text-button { display: block; width: 100%; padding: 9px 10px; color: var(--ink); text-align: left; text-decoration: none; border: 0; background: transparent; cursor: pointer; }
.danger-text { color: #a43131 !important; }
.business-state-brief { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1px; overflow: hidden; border: 1px solid #d7e2eb; border-radius: 8px; background: #d7e2eb; }
.business-state-brief > div { display: grid; gap: 5px; padding: 12px 14px; background: #fff; }
.business-state-brief span { color: #708499; font-size: 10px; font-weight: 750; letter-spacing: .04em; }
.business-state-brief strong { color: #23445f; font-size: 12px; line-height: 1.5; }
.folded-detail { padding: 0 !important; }
.folded-detail > summary { min-height: 48px; padding: 14px 16px; color: #23445f; font-weight: 750; cursor: pointer; }
.folded-detail > .panel-heading,.folded-detail > .calculation-list,.folded-detail > .calculation-note { margin-left: 16px; margin-right: 16px; }
.folded-detail > .calculation-note { margin-bottom: 16px; }
.finance-filter-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 16px; padding: 5px; width: max-content; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.finance-filter-tabs a { padding: 8px 14px; color: #526b80; font-size: 12px; font-weight: 700; text-decoration: none; border-radius: 6px; }
.finance-filter-tabs a.active { color: #fff; background: #1f6fb5; }
.workflow-decision { display: grid; min-width: min(520px, 100%); gap: 8px; }.workflow-reasons { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }.workflow-reasons li { position: relative; padding-left: 17px; color: #526d83; font-size: 11px; line-height: 1.45; }.workflow-reasons li::before { position: absolute; left: 0; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: #c48412; content: ""; }.workflow-reasons li.complete::before { background: #0f766e; }.workflow-reasons li.blocking { color: #7a5010; }
.source-comparison-panel { border-top: 3px solid #2a6eaa; }.source-comparison-table th:first-child { color: #29475f; font-size: 12px; text-align: left; }.source-comparison-table td { font-variant-numeric: tabular-nums; text-align: right; }.source-comparison-table td:last-child { text-align: left; }.source-comparison-table tr.has-difference { background: #fffaf0; }.source-comparison-table strong { color: #173752; }
.project-readiness-panel { border-top: 3px solid #c48412; }.project-readiness-panel.is-ready { border-top-color: #0f766e; }.project-readiness-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }.project-readiness-head h2 { margin: 3px 0 5px; }.project-readiness-head p { margin: 0; color: #60768a; font-size: 12px; }.project-readiness-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }.readiness-checklist { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 15px 0; padding: 0; list-style: none; }.readiness-checklist li { display: grid; grid-template-columns: 24px minmax(0,1fr) auto; align-items: center; gap: 7px; min-height: 42px; padding: 8px 10px; border: 1px solid #dbe4ec; border-radius: 6px; background: #f9fbfc; }.readiness-checklist li > span { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; background: #fff1d8; color: #8a5706; font-weight: 800; }.readiness-checklist li.complete > span { background: #e4f5ef; color: #0f766e; }.readiness-checklist strong { color: #29475f; font-size: 12px; }.readiness-checklist small { color: #9a620a; font-size: 10px; }
.project-director-form { margin-top: 16px; }
.project-scope-summary { margin-top: 16px; margin-bottom: 0; }
.project-onboarding-flow { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 0; margin: 8px 0 0; padding: 0; list-style: none; }
.project-onboarding-flow li { position: relative; display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 10px; min-height: 72px; padding: 13px 18px 13px 0; }
.project-onboarding-flow li:not(:last-child)::after { position: absolute; top: 29px; right: 10px; width: 28px; height: 1px; background: #cbd8e3; content: ""; }
.project-onboarding-flow li > span { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid #b9cad7; border-radius: 50%; color: #315b78; background: #f7fafc; font-weight: 800; }
.project-onboarding-flow li.complete > span { border-color: #9bd2c4; color: #0f766e; background: #e8f6f1; }
.project-onboarding-flow strong,.project-onboarding-flow small { display: block; }
.project-onboarding-flow strong { color: var(--navy); font-size: 13px; }
.project-onboarding-flow small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.project-result-sections { display: grid; gap: 8px; }
.project-result-sections details { overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.project-result-sections summary { min-height: 44px; padding: 13px 15px; color: var(--navy); font-size: 13px; font-weight: 700; cursor: pointer; }
.project-result-sections details[open] summary { border-bottom: 1px solid var(--line); background: var(--surface-muted); }
.evidence-progress { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 0 0 14px; }.evidence-progress > div { display: grid; grid-template-columns: 28px minmax(0,1fr); gap: 2px 8px; padding: 10px; border: 1px solid #dce5ed; border-radius: 7px; background: #f8fafc; }.evidence-progress span { grid-row: 1 / 3; display: grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; background: #e7eef5; color: #567086; font-size: 11px; font-weight: 800; }.evidence-progress strong { color: #29475f; font-size: 12px; }.evidence-progress small { color: #6b8194; font-size: 10px; }.evidence-progress .complete { border-color: #b8ddd2; background: #f5fbf9; }.evidence-progress .complete span { background: #dff3ec; color: #0f766e; }.evidence-progress .problem { border-color: #e7c98e; background: #fffaf0; }.evidence-progress .problem span { background: #fff0d1; color: #99610a; }.evidence-next-step { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 14px; padding: 12px 14px; border-left: 3px solid #c48412; background: #fff8ea; }.evidence-next-step.error { border-left-color: #c23e46; background: #fff5f6; }.evidence-next-step strong { color: #65420a; font-size: 13px; }.evidence-next-step p { margin: 4px 0 0; color: #735a31; font-size: 11px; line-height: 1.5; }
.channel-binding-section { display: grid; gap: 12px; margin: 0 0 18px; padding: 14px; border: 1px solid #b9d8d1; border-left: 3px solid #0f766e; border-radius: 7px; background: #f7fbfa; }
.compact-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.compact-heading h3,.compact-heading p { margin: 0; }
.channel-binding-card { display: grid; gap: 12px; padding: 14px; border: 1px solid #d8e4e8; border-radius: 7px; background: #fff; }
.channel-binding-facts { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.channel-binding-facts > div { display: grid; gap: 3px; min-width: 0; padding: 9px 10px; background: #f4f7f9; }
.channel-binding-facts span { color: #657b8d; font-size: 10px; }
.channel-binding-facts strong { overflow-wrap: anywhere; color: #173752; font-size: 12px; }
.channel-binding-state { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: #526d83; font-size: 11px; }
.channel-first-bind-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.inline-search { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.channel-search-results { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.channel-master-option { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid #ccdbe4; border-radius: 6px; background: #fff; color: #173752; text-align: left; cursor: pointer; }
.channel-master-option:hover,.channel-master-option.selected { border-color: #0f766e; background: #eff8f5; box-shadow: inset 3px 0 #0f766e; }
.channel-master-option span { color: #657b8d; font-size: 10px; }
.channel-binding-complete { padding: 10px 12px; border-left: 3px solid #0f766e; background: #eff8f5; color: #0f665f; font-size: 11px; font-weight: 700; }
@media (max-width: 980px) { .readiness-checklist { grid-template-columns: repeat(2,minmax(0,1fr)); }.evidence-progress,.channel-binding-facts { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .workflow-dock { position: static; }.workflow-decision { min-width: 0; }.project-readiness-head,.evidence-next-step,.compact-heading { align-items: stretch; flex-direction: column; }.project-readiness-actions { justify-content: flex-start; }.readiness-checklist,.channel-first-bind-form,.channel-search-results { grid-template-columns: 1fr; }.source-comparison-table { min-width: 760px; } }
@media (max-width: 760px) { .project-onboarding-flow { grid-template-columns: 1fr; }.project-onboarding-flow li { padding-right: 0; }.project-onboarding-flow li:not(:last-child)::after { top: auto; right: auto; bottom: 0; left: 15px; width: 1px; height: 18px; } }

@media (max-width: 1100px) {
  .work-item { grid-template-columns: minmax(180px,.75fr) minmax(0,1.4fr); }
  .work-item-primary { grid-column: 2; justify-self: end; }
}
@media (max-width: 760px) {
  .workflow-groups { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .workflow-group { min-height: 104px; padding: 12px; }
  .work-item { grid-template-columns: 1fr; gap: 12px; }
  .work-item-guidance { grid-template-columns: 1fr; gap: 8px; }
  .work-item-primary { grid-column: 1; width: 100%; justify-self: stretch; }
  .business-state-brief { grid-template-columns: 1fr; }
  .finance-filter-tabs { width: 100%; }
  .finance-filter-tabs a { flex: 1; min-width: 74px; text-align: center; }
}

/* ChannelBillTask is the only Sales decision surface. Evidence stays visible
   as a quiet read-only reference while the business fields carry the focus. */
.task-detail-heading { margin-bottom: 12px; }
.task-state-panel { display: grid; grid-template-columns: minmax(220px,.7fr) minmax(360px,1.35fr) minmax(180px,.45fr); align-items: center; gap: 18px; margin-bottom: 10px; padding: 14px 16px; border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.task-state-panel.business-needs_action { border-left-color: var(--amber); }
.task-state-panel.business-processing { border-left-color: var(--blue); }
.task-state-panel.business-waiting_finance,.task-state-panel.business-completed { border-left-color: var(--teal); }
.task-state-summary { display: grid; align-content: start; gap: 7px; }
.task-state-summary .status { width: max-content; }
.task-state-summary strong { color: var(--ink); font-size: 14px; line-height: 1.45; }
.task-state-guidance { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin: 0; }
.task-state-guidance dt { margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .04em; }
.task-state-guidance dd { margin: 0; color: #29475f; font-size: 12px; line-height: 1.5; }
.task-state-action { display: grid; justify-items: end; gap: 8px; }
.task-state-action .task-primary-action { width: 100%; min-width: 0; }
.task-more-actions { position: relative; font-size: 11px; }
.task-more-actions summary { color: #466178; cursor: pointer; }
.task-more-actions > div { position: absolute; z-index: 10; right: 0; top: calc(100% + 5px); display: grid; width: 170px; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: 0 10px 24px rgba(18,43,63,.14); }
.task-more-actions a,.task-more-actions button { width: 100%; padding: 8px; color: #29475f; text-align: left; text-decoration: none; background: transparent; border: 0; border-radius: 5px; }
.task-more-actions a:hover,.task-more-actions button:hover { background: #f1f5f8; }
.task-return-notice { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; padding: 13px 15px; border: 1px solid #edc3bd; border-left: 4px solid var(--red); border-radius: 8px; background: #fff6f5; }
.task-return-notice > div { display: grid; gap: 4px; }
.task-return-notice span { color: #9a3b32; font-size: 10px; font-weight: 750; }
.task-return-notice strong { color: #6f2a24; font-size: 13px; }
.task-return-notice small { color: #86504a; line-height: 1.45; }
.task-overview { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 1px; overflow: hidden; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.task-overview > div { display: grid; gap: 5px; min-width: 0; padding: 12px 14px; background: var(--surface); }
.task-overview span { color: var(--muted); font-size: 10px; font-weight: 700; }
.task-overview strong { overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.task-detail-grid { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(300px,.75fr); align-items: start; gap: 12px; }
.task-business-panel { border-top: 3px solid var(--blue); }
.task-evidence-panel { border-top: 3px solid var(--line-strong); }
.task-business-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.task-business-form > label { display: grid; gap: 6px; color: #466178; font-size: 11px; font-weight: 700; }
.task-business-form input[readonly],.task-business-form select:disabled { color: #466178; background: #f5f7f9; }
.task-field-alert,.task-confirm-box { grid-column: 1 / -1; }
.task-field-alert { display: grid; gap: 3px; padding: 11px 12px; border-left: 3px solid var(--amber); background: var(--amber-soft); color: #75500f; font-size: 11px; }
.task-confirm-box { display: grid; justify-items: end; gap: 7px; padding-top: 4px; border-top: 1px solid var(--line); }
.task-confirm-box > label { width: 100%; }
.task-confirm-box .muted { margin: 0; text-align: right; }
.task-primary-action { min-width: 210px; text-align: center; }
.task-evidence-image { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: #f2f5f8; }
.task-evidence-image img { display: block; width: 100%; max-height: 420px; object-fit: contain; }
.task-evidence-panel details { margin-top: 10px; border: 1px solid var(--line); border-radius: 7px; }
.task-evidence-panel summary { padding: 10px 12px; color: #29475f; font-size: 11px; font-weight: 700; cursor: pointer; }
.task-evidence-panel pre { max-height: 260px; margin: 0; padding: 12px; overflow: auto; color: #dce9f4; background: #0b1d2f; font: 11px/1.55 Consolas, monospace; white-space: pre-wrap; }
.task-external-panel { margin-top: 12px; border-top: 3px solid var(--teal); }
.task-metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--line); }
.task-metric-grid > div { display: grid; gap: 6px; min-width: 0; padding: 13px; background: var(--surface); }
.task-metric-grid span { color: var(--muted); font-size: 10px; font-weight: 700; }
.task-metric-grid strong { color: var(--ink); font-size: 17px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.task-confirmed-note { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 10px 16px; margin-top: 12px; padding: 11px 14px; border: 1px solid #b9ddd7; border-left: 4px solid var(--teal); border-radius: 8px; background: #f3fbf9; }
.task-confirmed-note span { color: var(--teal); font-size: 11px; font-weight: 750; }
.task-confirmed-note strong { color: #225b54; font-size: 12px; }
.task-confirmed-note small { color: #54766f; }
.form-status { min-height: 18px; margin: 0; color: #466178; font-size: 11px; }
.sales-empty.compact { min-height: 120px; }
@media (max-width: 1180px) { .task-state-panel { grid-template-columns: minmax(210px,.7fr) minmax(0,1.3fr); }.task-state-action { grid-column: 1 / -1; grid-template-columns: minmax(180px,240px) auto; justify-content: end; align-items: center; }.task-metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 980px) { .task-detail-grid { grid-template-columns: 1fr; }.task-overview { grid-template-columns: repeat(2,minmax(0,1fr)); }.task-confirmed-note { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .task-state-panel,.task-state-guidance,.task-business-form,.task-overview,.task-metric-grid { grid-template-columns: 1fr; }.task-state-action { grid-column: auto; grid-template-columns: 1fr; justify-items: stretch; }.task-return-notice { align-items: stretch; flex-direction: column; }.task-return-notice .btn { width: 100%; }.task-confirm-box { justify-items: stretch; }.task-confirm-box .muted { text-align: left; }.task-primary-action { width: 100%; min-width: 0; }.task-evidence-image img { max-height: 300px; }.task-more-actions > div { position: static; width: 100%; margin-top: 6px; box-shadow: none; } }

/* Screen-fit guard: browser zoom and medium-width laptops must not turn the
   fixed navigation into an off-screen page. Tables retain their own scroll
   area while headings and actions reflow inside the available workspace. */
:root { --sidebar-width: 256px; }
html[data-ui-style="table"] { --sidebar-width: 232px; }
.sidebar { width: var(--sidebar-width); }
.app-shell {
  width: calc(100% - var(--sidebar-width));
  max-width: calc(100% - var(--sidebar-width));
  margin-left: var(--sidebar-width);
  background: var(--canvas);
  overflow-x: clip;
}
.topbar, .page-shell, .sales-hero, .sales-hero > div:first-child { min-width: 0; }
.page-shell { width: 100%; background: var(--canvas); }
.sales-hero-action { flex-wrap: wrap; min-width: 0; }
.sales-ledger .table-wrap { width: 100%; }

@media (max-width: 1360px) {
  :root { --sidebar-width: 212px; }
  .brand { padding-right: 14px; padding-left: 14px; }
  .brand-subtitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar-nav { padding-right: 8px; padding-left: 8px; }
  .sidebar-nav a { padding-right: 9px; padding-left: 9px; }
  .topbar { align-items: flex-start; padding: 10px 20px; }
  .topbar-title { overflow: hidden; padding-top: 7px; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-meta { justify-content: flex-end; }
  .page-shell { max-width: none; padding: 22px 24px 40px; }
  .sales-hero { align-items: flex-start; flex-direction: column; gap: 12px; }
  .sales-hero-action { width: 100%; justify-content: space-between; }
}

@media (max-width: 980px) {
  :root { --sidebar-width: 184px; }
  .brand-mark { display: none; }
  .brand { min-height: 60px; }
  .sidebar-footer { padding-right: 12px; padding-left: 12px; }
  .topbar { gap: 8px; padding-right: 14px; padding-left: 14px; }
  .topbar-title { max-width: 45%; }
  .page-shell { padding: 18px 16px 32px; }
  .sales-hero-action { align-items: flex-start; flex-direction: column; }
  .sales-hero-action .btn { width: 100%; text-align: center; }
}

@media (max-width: 760px) {
  :root { --sidebar-width: 0px; }
  .sidebar { width: 100%; }
  .app-shell { width: 100%; max-width: 100%; margin-left: 0; overflow-x: visible; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-title { max-width: 100%; white-space: normal; }
  .topbar-meta { width: 100%; justify-content: space-between; }
}

/* A 768px tablet is a compact workspace, not a narrow desktop.  Collapse the
   fixed rail and keep the bill's state, reason and next action in one readable
   column before the phone breakpoint is reached. */
@media (max-width: 800px) {
  :root { --sidebar-width: 0px; }
  .sidebar { position: static; width: 100%; min-height: auto; }
  .brand { min-height: auto; }
  .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
    padding: 9px 10px 11px;
  }
  .nav-section { display: none; }
  .sidebar-nav a { min-height: 34px; padding: 6px 8px; text-align: center; }
  .sidebar-footer { display: none; }
  .app-shell { width: 100%; max-width: 100%; margin-left: 0; overflow-x: visible; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-title { max-width: 100%; white-space: normal; }
  .topbar-meta { width: 100%; justify-content: space-between; }
  .task-state-panel,
  .task-state-guidance,
  .task-business-form,
  .task-overview,
  .task-metric-grid { grid-template-columns: 1fr; }
  .task-state-action { grid-column: auto; grid-template-columns: 1fr; justify-items: stretch; }
  .task-primary-action { width: 100%; min-width: 0; }
}

/* V1.6 UI-3: site-centered finance workspace.  Financial hierarchy uses
   quiet borders and dense numerals; risk colors are reserved for meaning. */
.finance-site-hero { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin-bottom:18px; padding-bottom:18px; border-bottom:1px solid var(--line); }
.finance-site-hero h1 { margin:3px 0 5px; color:var(--ink); font-size:30px; letter-spacing:-.025em; }
.finance-site-hero p { margin:0; color:var(--muted); }
.finance-site-toolbar { display:flex; align-items:end; gap:8px; }
.finance-site-toolbar label,.finance-filter-bar label,.finance-action-dialog label { display:grid; gap:6px; color:#38546b; font-size:11px; font-weight:700; }
.finance-site-toolbar input { min-width:150px; }
.finance-kpi-grid { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:10px; margin-bottom:16px; }
.finance-kpi-grid article { display:grid; gap:5px; min-height:112px; padding:16px; border:1px solid var(--line); border-top:3px solid #91a5b7; border-radius:9px; background:var(--surface); box-shadow:0 5px 18px rgba(23,48,70,.04); }
.finance-kpi-grid span { color:#536e83; font-size:11px; font-weight:750; }
.finance-kpi-grid strong { color:var(--ink); font-size:27px; font-variant-numeric:tabular-nums; }
.finance-kpi-grid small { color:var(--muted); line-height:1.45; }
.finance-panel { margin-bottom:16px; padding:18px; border:1px solid var(--line); border-radius:10px; background:var(--surface); box-shadow:0 5px 20px rgba(23,48,70,.035); }
.finance-panel-head { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:14px; padding-bottom:12px; border-bottom:1px solid var(--line); }
.finance-panel-head h2 { margin:2px 0 3px; color:var(--ink); font-size:18px; }
.finance-panel-head p { margin:0; color:var(--muted); font-size:11px; }
.finance-message { min-height:22px; margin:8px 0; color:#587187; font-size:11px; }
.finance-card-list { display:grid; gap:9px; }
.finance-work-item { display:grid; grid-template-columns:minmax(155px,.55fr) minmax(280px,1.25fr) minmax(270px,.85fr) auto; align-items:center; gap:16px; padding:14px 15px; border:1px solid var(--line); border-left:4px solid #8da4b7; border-radius:8px; background:#fff; }
.finance-work-item.tone-warning { border-left-color:var(--amber); }.finance-work-item.tone-danger { border-left-color:var(--red); }.finance-work-item.tone-locked { border-left-color:var(--teal); }
.finance-work-identity,.finance-work-numbers span { display:grid; gap:3px; }
.finance-work-identity span,.finance-work-numbers span { color:var(--muted); font-size:10px; }
.finance-work-identity strong { color:var(--ink); font-size:15px; }.finance-work-identity small { color:#71889a; }
.finance-work-item p { margin:3px 0; color:#516b7e; font-size:11px; line-height:1.45; }.finance-work-item p b { color:#29475f; }
.finance-work-numbers { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }.finance-work-numbers strong { color:var(--ink); font-size:14px; font-variant-numeric:tabular-nums; }
.finance-work-action { justify-self:end; }.finance-status { display:inline-flex; width:max-content; margin-bottom:5px; padding:4px 8px; border:1px solid #c7d7e3; border-radius:999px; color:#38546b; background:#f5f8fa; font-size:10px; font-weight:750; }
.finance-filter-bar { display:grid; grid-template-columns:repeat(5,minmax(130px,1fr)) auto auto auto; align-items:end; gap:10px; margin-bottom:14px; padding:14px; border:1px solid var(--line); border-radius:9px; background:var(--surface); }
.finance-checkbox { display:flex!important; align-items:center; min-height:38px; gap:7px!important; }.finance-checkbox input { width:auto; }
.finance-site-table { min-width:960px; }.finance-site-table th { position:sticky; top:0; z-index:1; background:#f2f6f9; }.finance-site-table td { vertical-align:top; }.finance-site-table td small { display:block; margin-top:4px; color:var(--muted); }.finance-site-table .num { text-align:right; font-variant-numeric:tabular-nums; }
.finance-pill { display:inline-flex; padding:3px 7px; border:1px solid #cbd8e2; border-radius:999px; color:#496276; background:#f6f8fa; font-size:10px; font-weight:750; }.finance-pill.ok { color:#176b62; border-color:#b8ded8; background:#eef9f7; }.finance-pill.warn { color:#86580d; border-color:#efd49b; background:#fff8e8; }
.finance-state-card { display:grid; grid-template-columns:minmax(220px,.65fr) minmax(340px,1.35fr) auto; align-items:center; gap:20px; margin-bottom:12px; padding:18px; border:1px solid var(--line); border-left:4px solid var(--teal); border-radius:10px; background:var(--surface); }
.finance-state-card h2 { margin:8px 0 3px; color:var(--ink); }.finance-state-card p { margin:3px 0; color:var(--muted); }
.finance-state-guidance { display:grid; gap:5px; padding-left:18px; border-left:1px solid var(--line); }.finance-state-guidance p { color:#4b6578; font-size:11px; line-height:1.5; }.finance-state-guidance b { color:#263f54; }
.finance-primary-slot { justify-self:end; min-width:150px; text-align:right; }
.finance-money-grid { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:1px; overflow:hidden; margin-bottom:12px; border:1px solid var(--line); border-radius:9px; background:var(--line); }
.finance-money-grid article { display:grid; gap:6px; padding:15px; background:var(--surface); }.finance-money-grid span { color:var(--muted); font-size:10px; font-weight:700; }.finance-money-grid strong { color:var(--ink); font-size:18px; font-variant-numeric:tabular-nums; }.finance-money-grid strong.missing { color:#9b6410; font-size:12px; }
.finance-integrity { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:8px; margin-bottom:12px; }.finance-integrity span { display:grid; gap:4px; padding:10px 12px; border:1px solid var(--line); border-radius:7px; color:var(--muted); font-size:10px; }.finance-integrity strong { color:var(--ink); font-size:17px; }
.finance-empty-inline { padding:20px; border:1px dashed var(--line-strong); border-radius:8px; color:var(--muted); text-align:center; }.finance-all-channels { margin-top:12px; border-top:1px solid var(--line); }.finance-all-channels summary { padding:12px 2px 4px; color:#34536b; font-size:11px; font-weight:750; cursor:pointer; }
.finance-timeline { display:grid; gap:8px; }.finance-timeline article { display:grid; grid-template-columns:100px 120px 170px 1fr; gap:10px; padding:10px 12px; border-left:3px solid #9eb0bf; background:#f7f9fb; }.finance-timeline span { color:#38566e; font-weight:750; }.finance-timeline strong,.finance-timeline time,.finance-timeline p { margin:0; color:#607688; font-size:11px; }
.finance-action-dialog { width:min(640px,calc(100vw - 28px)); padding:0; border:1px solid var(--line); border-radius:10px; box-shadow:0 18px 60px rgba(10,31,48,.24); }.finance-action-dialog::backdrop { background:rgba(10,29,45,.42); }.finance-action-dialog form { display:grid; gap:14px; padding:20px; }.finance-action-dialog h2 { margin:0; color:var(--ink); }.finance-action-dialog textarea { width:100%; }.finance-action-dialog menu { display:flex; justify-content:flex-end; gap:8px; margin:0; padding:0; }
.finance-field-checks { display:grid; grid-template-columns:repeat(4,1fr); gap:7px; }.finance-field-checks label,.finance-confirm-check { display:flex!important; align-items:center; gap:7px!important; padding:9px; border:1px solid var(--line); border-radius:6px; background:#f7f9fb; }.finance-field-checks input,.finance-confirm-check input { width:auto; }.finance-estimate-box { padding:12px; border-left:3px solid var(--amber); background:var(--amber-soft); color:#6e4a0c; }.finance-estimate-box p { margin:6px 0 0; }
.finance-adjustment-card { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px; border:1px solid var(--line); border-left:4px solid var(--red); border-radius:8px; }.finance-adjustment-card h3 { margin:7px 0 3px; color:var(--ink); }.finance-adjustment-card p { margin:0; color:var(--muted); font-size:11px; }
.finance-adjustment-compare { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }.finance-adjustment-compare article { min-width:0; border:1px solid var(--line); border-radius:9px; background:var(--surface); }.finance-adjustment-compare span { display:block; padding:12px 14px; border-bottom:1px solid var(--line); color:#29475f; font-weight:750; }.finance-adjustment-compare pre { min-height:360px; max-height:620px; margin:0; padding:14px; overflow:auto; color:#dce9f4; background:#0b1d2f; font:11px/1.55 Consolas,monospace; white-space:pre-wrap; }
.finance-adjustment-values { display:grid; gap:0; padding:6px 14px 14px; }.finance-adjustment-values div { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:11px 0; border-bottom:1px solid var(--line); }.finance-adjustment-values div:last-child { border-bottom:0; }.finance-adjustment-values span { padding:0; border:0; color:var(--muted); font-size:11px; }.finance-adjustment-values strong { color:var(--ink); font-variant-numeric:tabular-nums; }
@media (max-width:1280px){.finance-kpi-grid,.finance-money-grid{grid-template-columns:repeat(3,minmax(0,1fr));}.finance-work-item{grid-template-columns:minmax(150px,.55fr) minmax(260px,1fr) auto}.finance-work-numbers{grid-column:1/-1}.finance-filter-bar{grid-template-columns:repeat(3,minmax(140px,1fr)) auto auto}}
@media (max-width:800px){.finance-site-hero,.finance-panel-head,.finance-adjustment-card{align-items:stretch; flex-direction:column}.finance-site-toolbar{width:100%}.finance-site-toolbar label{flex:1}.finance-kpi-grid,.finance-money-grid,.finance-integrity{grid-template-columns:repeat(2,minmax(0,1fr))}.finance-work-item,.finance-state-card{grid-template-columns:1fr}.finance-work-numbers{grid-template-columns:repeat(3,1fr)}.finance-work-action,.finance-primary-slot{justify-self:stretch;text-align:left}.finance-work-action .btn,.finance-primary-slot .btn{width:100%;text-align:center}.finance-state-guidance{padding:12px 0 0;border-top:1px solid var(--line);border-left:0}.finance-filter-bar{grid-template-columns:repeat(2,minmax(0,1fr))}.finance-timeline{overflow-x:auto}.finance-timeline article{min-width:620px}.finance-adjustment-compare{grid-template-columns:1fr}.finance-adjustment-compare pre{min-height:220px}}
@media (max-width:430px){.finance-kpi-grid,.finance-money-grid,.finance-integrity,.finance-filter-bar,.finance-work-numbers,.finance-field-checks{grid-template-columns:1fr}.finance-site-toolbar{display:grid;grid-template-columns:1fr auto}.finance-site-hero h1{font-size:25px}.finance-panel{padding:13px}.finance-work-item{padding:12px}.finance-action-dialog form{padding:16px}}

/* V1.6 UI-4: director operating view.  This layer deliberately stays
   read-only and moves from project to site to channel without exposing the
   task, snapshot or worker vocabulary used by the maintenance console. */
.director-hero { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin-bottom:18px; padding-bottom:18px; border-bottom:1px solid var(--line); }
.director-hero h1 { margin:3px 0 5px; color:var(--ink); font-size:30px; letter-spacing:-.025em; }
.director-hero p { max-width:760px; margin:0; color:var(--muted); line-height:1.6; }
.director-date-filter { display:flex; align-items:flex-end; gap:8px; }
.director-date-filter label { display:grid; gap:6px; color:#38546b; font-size:11px; font-weight:750; }
.director-date-filter input { min-width:150px; }
.director-content { display:grid; min-width:0; gap:16px; }
.director-content > *,.director-panel,.director-site-overview,.director-next { min-width:0; max-width:100%; }
.director-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.director-metric { display:grid; gap:5px; min-height:112px; padding:16px; border:1px solid var(--line); border-top:3px solid #91a5b7; border-radius:9px; background:var(--surface); box-shadow:0 5px 18px rgba(23,48,70,.04); }
.director-metric.primary { border-top-color:#2872b5; }.director-metric.warning { border-top-color:var(--amber); }.director-metric.danger { border-top-color:var(--red); }
.director-metric span { color:#536e83; font-size:11px; font-weight:750; }.director-metric strong { color:var(--ink); font-size:27px; font-variant-numeric:tabular-nums; }.director-metric small { color:var(--muted); line-height:1.45; }
.director-panel { padding:18px; border:1px solid var(--line); border-radius:10px; background:var(--surface); box-shadow:0 5px 20px rgba(23,48,70,.035); }
.director-panel-head { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:14px; padding-bottom:12px; border-bottom:1px solid var(--line); }
.director-panel-head h2 { margin:2px 0 3px; color:var(--ink); font-size:18px; }.director-panel-head a { color:#235f96; font-weight:750; }
.director-project-grid,.director-site-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.director-project-card,.director-site-card { min-width:0; padding:16px; border:1px solid var(--line); border-left:4px solid #6d91ad; border-radius:9px; background:#fff; }
.director-site-card { border-left-color:#20847a; }
.director-project-card header,.director-site-title { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.director-project-card h3,.director-site-card h3 { margin:3px 0; color:var(--ink); font-size:17px; }.director-project-card small,.director-site-title small { color:#557084; }.director-site-title span { color:var(--muted); font-size:11px; }
.director-progress { height:7px; margin:14px 0 7px; overflow:hidden; border-radius:99px; background:#e9f0f5; }.director-progress span { display:block; height:100%; border-radius:inherit; background:#278b80; }
.director-progress-copy { margin:0 0 13px; color:#5a7183; font-size:11px; }
.director-project-numbers,.director-site-numbers { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin:0; }
.director-site-numbers { grid-template-columns:repeat(4,minmax(0,1fr)); }
.director-project-numbers div,.director-site-numbers div { min-width:0; padding:9px; border:1px solid #e1e9ef; border-radius:6px; background:#f8fafb; }
.director-project-numbers dt,.director-site-numbers dt { color:var(--muted); font-size:10px; }.director-project-numbers dd,.director-site-numbers dd { margin:4px 0 0; color:var(--ink); font-size:14px; font-weight:750; font-variant-numeric:tabular-nums; }
.director-guidance { display:grid; grid-template-columns:1fr 1fr auto; align-items:center; gap:12px; margin-top:13px; padding-top:12px; border-top:1px solid var(--line); }.director-guidance p { display:grid; gap:3px; margin:0; color:#5d7384; font-size:11px; line-height:1.45; }.director-guidance b { color:#29475f; }
.director-state { display:inline-flex; flex:none; width:max-content; padding:4px 8px; border:1px solid #c7d7e3; border-radius:999px; color:#38546b; background:#f5f8fa; font-size:10px; font-weight:750; }
.director-state-success,.director-state-locked { color:#176b62; border-color:#b8ded8; background:#eef9f7; }.director-state-warning { color:#86580d; border-color:#efd49b; background:#fff8e8; }.director-state-danger { color:#9a363b; border-color:#efc0c2; background:#fff2f2; }
.director-project-summary,.director-site-overview { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:1px; overflow:hidden; border:1px solid var(--line); border-radius:9px; background:var(--line); }
.director-site-overview { grid-template-columns:repeat(5,minmax(0,1fr)); }
.director-project-summary>div,.director-site-overview>div { display:grid; gap:6px; min-height:92px; padding:15px; background:var(--surface); }.director-project-summary span,.director-site-overview span { color:var(--muted); font-size:10px; }.director-project-summary strong,.director-site-overview strong { color:var(--ink); font-size:17px; font-variant-numeric:tabular-nums; }
.director-risk-list { display:grid; gap:8px; margin:0; padding-left:20px; color:#536d80; }.director-risk-list li::marker { color:var(--amber); }
.director-next { display:flex; align-items:center; justify-content:space-between; gap:24px; padding:18px; border:1px solid #b8dbd6; border-left:4px solid var(--teal); border-radius:10px; background:#f4fbfa; }.director-next h2 { margin:3px 0; color:var(--ink); font-size:18px; }.director-next p { margin:0; color:#536d80; }
.director-process-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:9px; }.director-process-grid article { display:grid; gap:5px; min-height:82px; padding:13px; border:1px solid var(--line); border-radius:7px; background:#f8fafb; }.director-process-grid span { color:var(--muted); font-size:10px; }.director-process-grid strong { color:var(--ink); font-size:20px; font-variant-numeric:tabular-nums; }
.director-table-wrap { overflow:auto; border:1px solid var(--line); border-radius:8px; }.director-table { width:100%; min-width:820px; border-collapse:collapse; }.director-table th,.director-table td { padding:11px 12px; border-bottom:1px solid var(--line); text-align:left; }.director-table th { color:#476278; background:#f2f6f9; font-size:10px; }.director-table td { color:#314e65; font-size:11px; }.director-table tbody tr:last-child td { border-bottom:0; }
.director-channel-list { display:grid; gap:8px; }.director-channel-row { display:grid; grid-template-columns:minmax(220px,1fr) minmax(260px,1fr) auto; align-items:center; gap:14px; padding:13px 14px; border:1px solid var(--line); border-radius:7px; }.director-channel-row>div { display:grid; gap:4px; }.director-channel-row span,.director-channel-row small { color:var(--muted); font-size:10px; }.director-channel-row strong { color:var(--ink); }
.director-channel-detail-head { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:14px; }.director-detail-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1px; overflow:hidden; border:1px solid var(--line); border-radius:8px; background:var(--line); }.director-detail-grid div { display:grid; gap:5px; padding:14px; background:#fff; }.director-detail-grid span { color:var(--muted); font-size:10px; }.director-detail-grid strong { color:var(--ink); font-size:14px; font-variant-numeric:tabular-nums; }
.director-channel-row strong { overflow-wrap:anywhere; }
.director-readonly-note { padding:13px 15px; border:1px solid #c8d7e2; border-left:4px solid #7794a9; border-radius:8px; color:#506a7d; background:#f6f9fb; font-size:11px; }
.director-primary { min-width:104px; text-align:center; }.director-empty { padding:34px 20px; border:1px dashed var(--line-strong); border-radius:9px; color:var(--muted); text-align:center; }.director-error { padding:14px; border:1px solid #efc0c2; border-radius:8px; color:#92363b; background:#fff2f2; }

@media (max-width:1280px) {
  .director-metrics { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .director-site-numbers { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .director-process-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media (max-width:800px) {
  .director-hero,.director-panel-head,.director-next { align-items:stretch; flex-direction:column; }
  .director-date-filter { width:100%; }.director-date-filter label { flex:1; }
  .director-metrics,.director-project-summary,.director-site-overview { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .director-project-grid,.director-site-grid,.director-detail-grid { grid-template-columns:1fr; }
  .director-guidance,.director-channel-row { grid-template-columns:1fr; }
  .director-guidance .btn,.director-channel-row .btn,.director-next .btn { width:100%; text-align:center; }
  .director-process-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:430px) {
  .director-hero h1 { font-size:25px; }
  .director-date-filter { display:grid; grid-template-columns:1fr auto; }
  .director-metrics,.director-project-summary,.director-site-overview,.director-process-grid,.director-project-numbers,.director-site-numbers { grid-template-columns:1fr; }
  .director-panel { padding:13px; }
  .director-project-card,.director-site-card { padding:13px; }
  .director-project-card header,.director-site-title { align-items:stretch; flex-direction:column; }
}

/* V1.6: one source bill can contain any number of independently billed rows. */
.bill-items-panel { min-width:0; }
.bill-common-fields { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin:0 0 16px; padding:14px; border:1px solid var(--line); border-radius:8px; background:#f8fafb; }
.bill-common-fields legend { padding:0 7px; color:#36566e; font-size:12px; font-weight:800; }
.bill-common-fields label,.bill-item-fields label { display:grid; min-width:0; gap:6px; color:#405f76; font-size:11px; font-weight:750; }
.bill-common-fields small { color:var(--muted); font-size:10px; font-weight:500; }
.bill-item-list { display:grid; gap:12px; }
.task-candidate-panel { margin-bottom:16px; }
.candidate-channel-form, .candidate-channel-list { display:grid; gap:12px; }
.candidate-channel-list { grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); }
.candidate-channel-option { display:flex; align-items:center; gap:12px; padding:14px; border:1px solid #cddbe6; border-radius:8px; cursor:pointer; }
.candidate-channel-option:has(input:checked) { border-color:#2475b8; background:#eff6ff; }
.candidate-channel-option span, .candidate-channel-option small { display:block; }
.candidate-line-context { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:1px; margin:0 0 14px; overflow:hidden; border:1px solid var(--line); border-radius:8px; background:var(--line); }
.candidate-line-context>div { display:grid; gap:4px; padding:12px 14px; background:#f8fafb; }
.candidate-line-context span { color:var(--muted); font-size:10px; font-weight:700; }
.candidate-line-context strong { overflow-wrap:anywhere; color:#29475f; font-size:12px; }
.group-scope-correction { margin-bottom:16px; border-left:3px solid #b87917; }
.group-scope-correction>summary { display:flex; align-items:center; justify-content:space-between; gap:16px; cursor:pointer; list-style:none; }
.group-scope-correction>summary::-webkit-details-marker { display:none; }
.group-scope-correction>summary>span:first-child { display:grid; gap:4px; }
.group-scope-correction>summary small { color:var(--muted); font-weight:500; }
.group-scope-correction-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-top:16px; padding-top:16px; border-top:1px solid var(--line); }
.group-scope-correction-form label { display:grid; gap:6px; color:#405f76; font-size:11px; font-weight:750; }
.group-scope-correction-form label small { color:var(--muted); font-weight:500; }
.scope-correction-warning { grid-column:1/-1; padding:13px 15px; border:1px solid #ead3a6; border-left:4px solid #b87917; border-radius:7px; color:#6b501e; background:#fffaf0; }
.scope-correction-warning p { margin:5px 0 0; line-height:1.55; }
.group-scope-correction-form .form-actions,.group-scope-correction-form .form-status { grid-column:1/-1; }
.bill-item-card { overflow:hidden; border:1px solid #cddbe6; border-left:4px solid #2475b8; border-radius:9px; background:#fff; box-shadow:0 4px 16px rgba(23,48,70,.035); }
.bill-item-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:11px 14px; border-bottom:1px solid var(--line); background:#f3f7fa; color:#29475f; }
.bill-item-fields { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; padding:14px; }
.bill-item-fields label:first-child,.bill-item-fields label:nth-child(2) { grid-column:span 2; }
.danger-text { color:#a33d42; }
@media (max-width:980px) { .bill-common-fields,.bill-item-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }.candidate-line-context { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:600px) { .bill-common-fields,.bill-item-fields,.candidate-line-context,.group-scope-correction-form { grid-template-columns:1fr; }.bill-item-fields label:first-child,.bill-item-fields label:nth-child(2) { grid-column:auto; }.bill-item-heading { align-items:flex-start; }.group-scope-correction>summary { align-items:stretch; flex-direction:column; }.group-scope-correction>summary .btn { width:100%; text-align:center; } }

/* V1.6 UI-5: the administrator console is grouped by responsibility.  The
   business dashboard keeps business blockers separate from technical ones so
   an administrator can decide who should act without reading queue jargon. */
.admin-nav-group { margin:5px 0; border:1px solid rgba(188,208,224,.12); border-radius:7px; background:rgba(255,255,255,.018); }
.admin-nav-group summary { display:flex; min-height:39px; align-items:center; justify-content:space-between; padding:8px 11px; color:#c9d6e5; font-size:13px; font-weight:700; cursor:pointer; list-style:none; }
.admin-nav-group summary::-webkit-details-marker { display:none; }
.admin-nav-group summary::after { content:'+'; color:#7fa0b9; font-size:16px; font-weight:400; }
.admin-nav-group[open] summary { color:#fff; background:rgba(56,112,154,.18); }
.admin-nav-group[open] summary::after { content:'−'; }
.admin-nav-links { padding:3px 6px 7px; border-top:1px solid rgba(188,208,224,.10); }
.sidebar-nav .admin-nav-links a { min-height:34px; margin:1px 0; padding:6px 9px 6px 15px; border-radius:5px; color:#b7c8d7; font-size:12px; }
.sidebar-nav .admin-history-link { margin-top:12px; border:1px solid rgba(188,208,224,.16); color:#aabccc; }
.admin-page-heading { align-items:flex-end; }
.admin-system-strip { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1px; margin-bottom:12px; overflow:hidden; border:1px solid var(--line); border-radius:9px; background:var(--line); }
.admin-system-strip>div { display:grid; grid-template-columns:auto auto 1fr; align-items:center; gap:7px; min-height:56px; padding:12px 14px; background:#fff; }
.admin-system-strip strong { color:var(--ink); font-size:12px; }.admin-system-strip small { color:var(--muted); font-size:10px; }
.admin-status-dot { width:8px; height:8px; border-radius:50%; background:#9babb7; }.admin-status-dot.ok { background:#1b8a79; }.admin-status-dot.warn { background:#c78318; }
.admin-metric-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-bottom:14px; }
.admin-metric-grid a { display:grid; gap:5px; min-height:116px; padding:15px; border:1px solid var(--line); border-top:3px solid #7894a8; border-radius:9px; background:#fff; color:inherit; text-decoration:none; box-shadow:0 5px 18px rgba(23,48,70,.035); }
.admin-metric-grid a:nth-child(2),.admin-metric-grid a:nth-child(3) { border-top-color:#b87917; }.admin-metric-grid a:nth-child(4) { border-top-color:#a94a4f; }
.admin-metric-grid span { color:#506b80; font-size:11px; font-weight:750; }.admin-metric-grid strong { color:var(--ink); font-size:28px; font-variant-numeric:tabular-nums; }.admin-metric-grid small { color:var(--muted); font-size:10px; }
.admin-dashboard-columns { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:14px; }
.admin-dashboard-panel,.admin-quick-panel { padding:17px; border:1px solid var(--line); border-radius:10px; background:#fff; box-shadow:0 5px 20px rgba(23,48,70,.035); }
.admin-dashboard-panel>header,.admin-quick-panel>header { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:12px; padding-bottom:11px; border-bottom:1px solid var(--line); }
.admin-dashboard-panel h2,.admin-quick-panel h2 { margin:2px 0 0; color:var(--ink); font-size:17px; }.admin-dashboard-panel header>a { color:#275f91; font-size:11px; font-weight:750; }
.admin-blocker-list,.admin-failure-list { display:grid; gap:7px; }
.admin-blocker-list>a,.admin-failure-list>a { display:grid; grid-template-columns:1fr auto; align-items:center; gap:14px; padding:12px; border:1px solid #e0e8ee; border-left:3px solid #c18425; border-radius:7px; color:inherit; background:#fffdfa; text-decoration:none; }
.admin-blocker-list.technical>a { border-left-color:#718da2; background:#f8fafb; }
.admin-blocker-list strong,.admin-failure-list strong { color:#29475f; font-size:12px; }.admin-blocker-list p,.admin-failure-list p { margin:3px 0 0; color:var(--muted); font-size:10px; line-height:1.5; }
.admin-blocker-list>a>span { display:grid; min-width:34px; height:34px; place-items:center; border:1px solid #e5c891; border-radius:50%; color:#845711; background:#fff7e8; font-weight:800; font-variant-numeric:tabular-nums; }
.admin-failure-panel { margin-bottom:14px; }.admin-failure-list>a { border-left-color:#b24c51; background:#fffafa; }.admin-failure-list time { color:var(--muted); font-size:10px; white-space:nowrap; }
.admin-quick-panel>header { justify-content:flex-start; }.admin-quick-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:9px; }
.admin-quick-grid a { display:grid; gap:5px; min-height:74px; padding:13px; border:1px solid var(--line); border-radius:7px; color:inherit; background:#f8fafb; text-decoration:none; }.admin-quick-grid strong { color:#29475f; font-size:12px; }.admin-quick-grid span { color:var(--muted); font-size:10px; line-height:1.45; }
.admin-catalog-panel { padding:18px; }.admin-catalog-toolbar { display:flex; align-items:flex-end; justify-content:space-between; gap:18px; margin-bottom:14px; }.admin-catalog-toolbar label { display:grid; min-width:min(420px,100%); gap:6px; color:#496579; font-size:11px; font-weight:750; }.admin-catalog-toolbar span { color:var(--muted); font-size:11px; }
.admin-catalog-table td { overflow-wrap:anywhere; }.admin-no-result { padding:30px; color:var(--muted); text-align:center; }
.admin-catalog-pagination { display:flex; align-items:center; justify-content:flex-end; gap:10px; margin-top:14px; }.admin-catalog-pagination button { min-width:84px; }.admin-catalog-pagination span { min-width:92px; color:var(--muted); font-size:11px; text-align:center; }.admin-catalog-pagination button:disabled { cursor:not-allowed; opacity:.45; }
.admin-backup-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }.admin-backup-grid article { display:grid; gap:7px; padding:16px; border:1px solid var(--line); border-radius:9px; background:#f8fafb; }.admin-backup-grid span { color:var(--muted); font-size:11px; line-height:1.6; }.admin-backup-guidance { margin-top:16px; padding:16px; border-left:3px solid var(--accent); background:var(--accent-soft); }.admin-backup-guidance ol { margin:10px 0 10px 20px; padding:0; }.admin-backup-guidance li { margin:6px 0; }.admin-backup-guidance p { color:var(--muted); }
.admin-empty-state { display:grid; gap:5px; padding:36px 20px; border:1px dashed var(--line-strong); border-radius:8px; color:var(--muted); text-align:center; }.admin-empty-state strong { color:#3b576d; }.admin-empty-state p { margin:0; }.admin-empty-state.compact { padding:24px 18px; }
.admin-history-notice { margin-bottom:14px; padding:16px; border:1px solid #dec58e; border-left:4px solid #b77a18; border-radius:8px; color:#6b501e; background:#fffaf0; }.admin-history-notice p { margin:5px 0 0; line-height:1.55; }
.legacy-page-banner { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:10px 16px; margin-bottom:14px; padding:12px 14px; border:1px solid #dec58e; border-left:4px solid #b77a18; border-radius:8px; color:#6b501e; background:#fffaf0; }.legacy-page-banner span { line-height:1.45; }.legacy-page-banner a { color:#72500f; font-weight:750; }.legacy-action-disabled { pointer-events:none!important; opacity:.45!important; filter:grayscale(.7); }
.admin-history-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }.admin-history-grid article { display:grid; grid-template-columns:1fr auto; align-items:start; gap:8px 14px; padding:16px; border:1px solid var(--line); border-radius:9px; background:#fff; }.admin-history-grid article>div { display:flex; align-items:center; justify-content:space-between; gap:15px; grid-column:1/-1; }.admin-history-grid span { color:#496579; font-weight:750; }.admin-history-grid strong { color:var(--ink); font-size:22px; font-variant-numeric:tabular-nums; }.admin-history-grid p { margin:0; color:var(--muted); line-height:1.5; }.admin-history-grid .btn { align-self:end; }

@media (max-width:1180px) { .admin-metric-grid,.admin-quick-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:800px) {
  .sidebar-nav .admin-nav-group { min-width:0; margin:0; }
  .sidebar-nav .admin-nav-group[open] { grid-column:1 / -1; }
  .sidebar-nav .admin-nav-group summary { min-height:34px; padding:6px 9px; }
  .sidebar-nav .admin-nav-links { position:static; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); width:auto; max-height:none; overflow:visible; padding:6px; border:0; border-top:1px solid #294b66; border-radius:0; background:transparent; box-shadow:none; }
  .admin-system-strip { grid-template-columns:1fr; }.admin-system-strip>div { grid-template-columns:auto auto 1fr; }
  .admin-dashboard-columns,.admin-history-grid { grid-template-columns:1fr; }
  .admin-backup-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .legacy-page-banner { grid-template-columns:1fr; }
  .admin-page-heading,.admin-dashboard-panel>header { align-items:stretch; flex-direction:column; }
}
@media (max-width:430px) {
  .admin-metric-grid,.admin-quick-grid { grid-template-columns:1fr; }
  .admin-system-strip>div { grid-template-columns:auto 1fr; }.admin-system-strip small { grid-column:2; }
  .admin-dashboard-panel,.admin-quick-panel,.admin-catalog-panel { padding:13px; }
  .admin-catalog-toolbar { align-items:stretch; flex-direction:column; }.admin-catalog-toolbar label { min-width:0; width:100%; }
  .admin-backup-grid { grid-template-columns:1fr; }.admin-catalog-pagination { justify-content:space-between; }.admin-catalog-pagination button { min-width:76px; }
  .sidebar-nav .admin-nav-links { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .admin-failure-list>a { grid-template-columns:1fr; }.admin-failure-list time { white-space:normal; }
}
