/* Bid Sniper workbench. A quiet admin shell: flat bordered surfaces, neutral greys, one violet
   accent for actions and links, square status tags. Light and dark come from one set of tokens
   (light-dark()), following the system unless the person picks a theme (html[data-theme]).
   Sections: fonts, tokens, base, shell, page, controls, tables, tags, record, document,
   overview, bring in, sign-in, responsive. */

@font-face {
  font-family: "Public Sans";
  src: url("../fonts/public-sans-latin-wght-normal.e4c9b081863a.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Public Sans";
  src: url("../fonts/public-sans-latin-wght-italic.5ac660b00f40.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light dark;
  --ground: light-dark(#f7f7f8, #0e0f12);
  --surface: light-dark(#ffffff, #16171b);
  --surface-2: light-dark(#fafafb, #1b1c21);
  --surface-hover: light-dark(#f4f5f7, #1f2026);
  --surface-active: light-dark(#eceef1, #26282f);
  --ink: light-dark(#17191e, #ececf0);
  --ink-2: light-dark(#5b616b, #a3a6b0);
  --ink-3: light-dark(#6e747e, #8b8e98);
  --border: light-dark(#e4e6ea, #2a2c33);
  --border-soft: light-dark(#eff0f2, #212329);
  --border-strong: light-dark(#d2d6dc, #3a3d46);
  --accent: light-dark(#42246b, #b9a0e8);
  --accent-hover: light-dark(#53308a, #c9b4ef);
  --accent-ink: light-dark(#ffffff, #16171b);
  --accent-text: light-dark(#5a3194, #c3acf0);
  --accent-soft: light-dark(#f4f0fa, #241d34);
  --accent-ring: light-dark(rgb(90 49 148 / 0.25), rgb(185 160 232 / 0.35));

  --go: light-dark(#127a3a, #63d391);        --go-bg: light-dark(#e9f5ed, #132a1d);
  --caution: light-dark(#9a4a06, #f3b24d);   --caution-bg: light-dark(#fcf2e4, #2c2211);
  --review: light-dark(#1f4fd1, #90b3fb);    --review-bg: light-dark(#eaf0fd, #172339);
  --nogo: light-dark(#b02a1f, #f6938a);      --nogo-bg: light-dark(#fdeceb, #311816);
  --neutral-bg: light-dark(#f0f1f3, #24262c);

  --chart-go: light-dark(#15803d, #16a34a);
  --chart-caution: light-dark(#b45309, #d97706);
  --chart-review: light-dark(#1d4ed8, #3b82f6);
  --chart-nogo: light-dark(#b91c1c, #ef4444);
  --chart-bar: light-dark(#5a3194, #a98ae0);

  --shadow-pop: 0 10px 30px -8px light-dark(rgb(16 24 40 / 0.18), rgb(0 0 0 / 0.6));

  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --t-xs: 0.75rem;     /* 12 */
  --t-s: 0.8125rem;    /* 13 */
  --t-m: 0.875rem;     /* 14 */
  --t-l: 1rem;         /* 16 */
  --t-xl: 1.25rem;     /* 20 */
  --t-xxl: 1.375rem;   /* 22 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --radius: 8px;
  --radius-s: 6px;
  --sidebar-w: 224px;
  --topbar-h: 52px;
  --row-h: 40px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 var(--t-m)/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--ground);
  accent-color: var(--accent);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); color: var(--ink); }
h1, h2, h3, h4, p, dl, dd, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.18em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
[x-cloak] { display: none !important; }
.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;
}
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--ink-2); }
.small { font-size: var(--t-s); }
.nowrap { white-space: nowrap; }
.num { text-align: right; }
.label { font-size: var(--t-s); font-weight: 500; color: var(--ink-2); }
kbd { font: 600 11px/1 var(--font); padding: 2px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; color: var(--ink-2); background: var(--surface); }

/* Page-swap progress: a thin accent line while HTMX loads */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 100; opacity: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--accent) 40%, var(--accent) 60%, transparent) 0 0 / 40% 100% no-repeat; }
.progress.htmx-request { opacity: 1; animation: progress 900ms var(--ease) infinite; }
@keyframes progress { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* ------------------------------------------------------------------ app shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(90deg, var(--surface) calc(var(--sidebar-w) - 1px), var(--border) 0 var(--sidebar-w), var(--ground) 0); }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: var(--s4) var(--s3);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 2px var(--s2) var(--s5);
  color: var(--ink); font-weight: 700; font-size: var(--t-m); letter-spacing: -0.005em; line-height: 1.2;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; flex: none; border-radius: 6px;
  display: grid; place-items: center;
  background: #42246b; color: #fff; font-size: 11px; font-weight: 800; letter-spacing: 0.02em;
}
.brand small { display: block; font-size: var(--t-xs); font-weight: 500; color: var(--ink-3); }
.nav { display: grid; gap: 1px; }
.nav-section { margin: var(--s5) var(--s2) var(--s1); font-size: var(--t-xs); font-weight: 600; color: var(--ink-3); }
.nav a {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 var(--s2); border-radius: var(--radius-s);
  color: var(--ink-2); font-weight: 500; font-size: var(--t-m);
  transition: background 120ms var(--ease), color 120ms var(--ease);
}
.nav a:hover { background: var(--surface-hover); color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--surface-active); color: var(--ink); font-weight: 600; }
.nav a[aria-current="page"] .icon { color: var(--accent-text); }
.nav a .icon { width: 17px; height: 17px; }
.nav .ext { margin-left: auto; width: 13px; height: 13px; color: var(--ink-3); }
.sidebar-foot { margin-top: auto; display: grid; gap: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--border-soft); }
.user { display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s1); }
.avatar {
  width: 28px; height: 28px; flex: none; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface-active); color: var(--ink-2);
  font-size: 11px; font-weight: 700;
}
.who { min-width: 0; flex: 1; font-size: var(--t-s); font-weight: 600; line-height: 1.3; }
.who span { display: block; font-weight: 400; color: var(--ink-3); font-size: var(--t-xs); }
.who, .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-s); }
.theme button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 26px; border: 0; border-radius: 4px; background: transparent; color: var(--ink-3); font-size: var(--t-xs); font-weight: 600; cursor: pointer; }
.theme button:hover { color: var(--ink); }
.theme button[aria-pressed="true"] { background: var(--surface-active); color: var(--ink); }
.theme .icon { width: 14px; height: 14px; }
.topbar { display: none; }
.main { min-width: 0; }
.scrim { display: none; }

/* ------------------------------------------------------------------ page frame */
.page { padding: var(--s5) var(--s6) var(--s7); max-width: 1920px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s4); }
.page-header h1 { font-size: var(--t-xxl); font-weight: 700; letter-spacing: -0.015em; line-height: 1.25; }
.page-header p { color: var(--ink-2); margin-top: 2px; max-width: 80ch; font-size: var(--t-s); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 14px var(--s5); border-bottom: 1px solid var(--border-soft); }
.card-header h2 { font-size: var(--t-m); font-weight: 600; }
.card-header p { font-size: var(--t-s); color: var(--ink-2); margin-top: 2px; }
.card-body { padding: var(--s5); }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; padding: 10px var(--s4); border-top: 1px solid var(--border-soft); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.stack { display: grid; gap: var(--s5); align-content: start; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: var(--s5); align-items: start; }

/* ------------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  height: 34px; padding: 0 14px; white-space: nowrap;
  border: 1px solid var(--border-strong); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: var(--t-s); cursor: pointer;
  transition: background 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
}
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--ink); }
.btn-icon { width: 34px; padding: 0; }
.btn-s { height: 28px; padding: 0 10px; }
.btn-s.btn-icon { width: 28px; padding: 0; }
.count-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); font-size: 11px; line-height: 18px; text-align: center; }

.field {
  height: 34px; padding: 0 10px; width: 100%;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-s);
  transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
.field:hover { border-color: var(--ink-3); }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.field::placeholder { color: var(--ink-3); }
select.field[multiple] { height: auto; min-height: 96px; padding: var(--s1); }
textarea.field { height: auto; padding: var(--s2) 10px; resize: vertical; }
.field.file { height: 34px; padding: 2px; min-width: 0; color: var(--ink-2); font-size: var(--t-s); }
.field.file::file-selector-button {
  height: 28px; margin-right: var(--s3); padding: 0 var(--s3); cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface-2);
  color: var(--ink); font: inherit; font-weight: 600;
}
.search { position: relative; display: flex; align-items: center; }
.search > .icon { position: absolute; left: 10px; color: var(--ink-3); pointer-events: none; }
.search .field { padding-left: 32px; padding-right: 36px; }
.search kbd { position: absolute; right: 8px; pointer-events: none; }
.search .field:focus ~ kbd, .search .field:not(:placeholder-shown) ~ kbd { display: none; }
.check { display: flex; align-items: center; gap: var(--s2); cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--s4); }
.label-block { display: block; margin-bottom: 6px; }
.help { font-size: var(--t-s); color: var(--ink-2); margin-top: 6px; }

/* Segmented control */
.segmented { display: inline-flex; gap: 2px; padding: 2px; background: var(--neutral-bg); border-radius: var(--radius-s); max-width: 100%; }
.segmented a, .segmented label {
  position: relative; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  height: 28px; padding: 0 10px; border-radius: 4px;
  color: var(--ink-2); font-weight: 600; font-size: var(--t-s); cursor: pointer;
  transition: background 120ms var(--ease), color 120ms var(--ease);
}
.segmented a:hover, .segmented label:hover { color: var(--ink); text-decoration: none; }
.segmented [aria-current="true"], .segmented label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--border); }
.segmented .n { color: var(--ink-3); font-weight: 500; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }

/* ------------------------------------------------------------------ toolbar and filters */
.toolbar { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
.toolbar .search { flex: 1; min-width: 220px; max-width: 360px; margin-left: auto; }
.filters { position: relative; }
.filters > summary { list-style: none; }
.filters > summary::-webkit-details-marker { display: none; }
.filter-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  width: 380px; max-height: min(72vh, 640px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
}
.filter-panel .card-body { display: grid; gap: var(--s4); }

/* ------------------------------------------------------------------ work area: list + record */
.work { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); align-items: start; }
.list-pane { min-width: 0; }

/* ------------------------------------------------------------------ tables */
.table-card { overflow: hidden; container-type: inline-size; container-name: table; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--t-s); }
.table th {
  height: 34px; padding: 0 var(--s3); text-align: left; white-space: nowrap;
  font-size: var(--t-xs); font-weight: 600; color: var(--ink-2);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table th.num, .table td.num { text-align: right; }
.table td { height: var(--row-h); padding: 0 var(--s3); border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-hover); }
.table tbody tr[aria-selected="true"] td { background: var(--accent-soft); }
.table .sol { font-weight: 600; color: var(--ink); white-space: nowrap; }
.table tbody tr:hover .sol { color: var(--accent-text); text-decoration: none; }
.table .sub { display: block; color: var(--ink-2); font-size: var(--t-xs); margin-top: 1px; }
.table .past, .table .faint { color: var(--ink-3); }
.table .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .reason { display: block; max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.table.dense td { height: auto; padding: 8px var(--s3); }
.table tr.low td { color: var(--accent-text); font-weight: 600; }

/* The solicitations list: one line per row, fixed columns, columns drop as the card narrows */
.list-table { table-layout: fixed; }
.list-table td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-table .w-sol { width: 168px; }
.list-table .w-item { width: 22%; }
.list-table .w-tier { width: 96px; }
.list-table .w-reason { width: auto; }
.list-table .w-nsn { width: 170px; }
.list-table .w-qty { width: 96px; }
.list-table .w-closes { width: 116px; }
.list-table .w-ai { width: 104px; }
.list-table .w-award { width: 118px; }
.list-table .left { color: var(--ink-3); margin-left: 6px; }
.list-table .soon { color: var(--caution); font-weight: 600; }
@container table (max-width: 1280px) { .list-table .c-nsn, .list-table .w-nsn { display: none; } }
@container table (max-width: 1120px) { .list-table .c-qty, .list-table .w-qty { display: none; } }
@container table (max-width: 960px) { .list-table .c-ai, .list-table .w-ai { display: none; } }
@container table (max-width: 820px) { .list-table .c-item, .list-table .w-item { display: none; } }
@container table (max-width: 640px) { .list-table .c-reason, .list-table .w-reason { display: none; } }

.pager { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; font-size: var(--t-s); color: var(--ink-2); }
.pager .field { height: 28px; width: auto; }
.empty { padding: var(--s7) var(--s5); text-align: center; }
.empty .icon { width: 26px; height: 26px; color: var(--ink-3); margin-bottom: var(--s3); }
.empty h2 { font-size: var(--t-l); font-weight: 600; margin-bottom: var(--s1); }
.empty p { color: var(--ink-2); max-width: 52ch; margin: 0 auto var(--s4); }

/* ------------------------------------------------------------------ status tags */
.badge {
  display: inline-flex; align-items: center; white-space: nowrap;
  height: 20px; padding: 0 6px; border-radius: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em; line-height: 1;
  background: var(--neutral-bg); color: var(--ink-2);
}
.badge.b-go { background: var(--go-bg); color: var(--go); }
.badge.b-caution { background: var(--caution-bg); color: var(--caution); }
.badge.b-review { background: var(--review-bg); color: var(--review); }
.badge.b-nogo { background: var(--nogo-bg); color: var(--nogo); }
.badge.b-plain { font-weight: 500; letter-spacing: 0; font-size: var(--t-xs); }
.badge.b-ai { background: transparent; box-shadow: inset 0 0 0 1px currentColor; }
.t-go { color: var(--go); } .t-caution { color: var(--caution); } .t-review { color: var(--review); } .t-nogo { color: var(--nogo); } .t-none { color: var(--ink-3); }
.dot { width: 7px; height: 7px; border-radius: 2px; display: inline-block; flex: none; }
.dot-go { background: var(--chart-go); } .dot-caution { background: var(--chart-caution); } .dot-review { background: var(--chart-review); } .dot-nogo { background: var(--chart-nogo); }

/* ------------------------------------------------------------------ the record */
/* The workspace: a solicitation open. Queue | record | PDF, each pane scrolling on its own so
   nothing pushes anything else away; panes slide in and out with view transitions. */
.pane { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; min-height: 0; }
.list-pane { view-transition-name: queue; }
.queue { view-transition-name: queue; display: flex; flex-direction: column; overflow: hidden; }
.record { view-transition-name: record; overflow: auto; overscroll-behavior: contain; container: record / inline-size; }
@container record (max-width: 620px) {
  .details-2 { grid-template-columns: minmax(0, 1fr); }
  .details-2 .details:first-child > :nth-last-child(-n + 2) { border-bottom: 1px solid var(--border-soft); }
  .record-head, .record-body { padding-left: var(--s4); padding-right: var(--s4); }
}
.pdf-pane { view-transition-name: pdf; display: flex; flex-direction: column; overflow: hidden; }

.queue-head { display: grid; gap: 6px; padding: 10px; border-bottom: 1px solid var(--border-soft); }
.queue-head .field { height: 32px; }
.queue-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 6px 6px 6px 12px; font-size: var(--t-xs); color: var(--ink-3); border-bottom: 1px solid var(--border-soft); }
.queue-list { list-style: none; overflow: auto; overscroll-behavior: contain; flex: 1; padding: 4px; scroll-padding: 8px; }
.q-item { display: grid; gap: 1px; padding: 8px 10px; border-radius: var(--radius-s); color: var(--ink); transition: background 120ms var(--ease); }
.q-item:hover { background: var(--surface-hover); text-decoration: none; }
.q-item[aria-current="true"] { background: var(--accent-soft); box-shadow: inset 2px 0 var(--accent); }
.q-line { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); font-size: var(--t-s); }
.q-line b { font-weight: 600; white-space: nowrap; }
.q-name, .q-meta { font-size: var(--t-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-name { color: var(--ink-2); }
.q-meta { color: var(--ink-3); }
.q-meta.past { opacity: 0.75; }
.queue-empty { padding: var(--s4); color: var(--ink-3); font-size: var(--t-s); }
.queue-foot { display: flex; align-items: center; justify-content: space-between; padding: 6px; border-top: 1px solid var(--border-soft); font-size: var(--t-xs); color: var(--ink-2); }

.record-head { position: sticky; top: 0; z-index: 3; background: var(--surface); padding: 14px var(--s5) 0; border-bottom: 1px solid var(--border); }
.record-bar { display: flex; align-items: flex-start; gap: var(--s3); }
.record-id { min-width: 0; flex: 1; }
.record h1 { font-size: var(--t-l); font-weight: 700; letter-spacing: -0.005em; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.record .item-name { color: var(--ink-2); font-size: var(--t-s); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.record-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.record-actions .steps { display: inline-flex; margin: 0 2px 0 6px; }
.btn.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.why-line { margin-top: 8px; font-size: var(--t-s); color: var(--ink); line-height: 1.45; }
.why-label { font-weight: 600; color: var(--ink-2); margin-right: 6px; }
.why-line .rule { font-size: var(--t-xs); font-weight: 600; color: var(--ink-3); }
.tabs { display: flex; gap: var(--s4); margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 9px 0; white-space: nowrap; color: var(--ink-2); font-weight: 600; font-size: var(--t-s);
  box-shadow: inset 0 -2px transparent; transition: color 120ms var(--ease), box-shadow 120ms var(--ease);
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a[aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -2px var(--accent); }
.tabs .n { margin-left: 4px; color: var(--ink-3); font-weight: 500; }
.record-body { padding: var(--s5); }
.record-body > * + * { margin-top: var(--s6); }
.record-body h3 { font-size: var(--t-m); font-weight: 600; margin-bottom: var(--s3); }

.pdf-head { flex: none; display: grid; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.pdf-bar { display: flex; align-items: center; gap: var(--s2); }
.pdf-bar .spacer { flex: 1; }
.pdf-title { font-size: var(--t-s); margin-right: 4px; }
.pdf-pages { display: inline-flex; align-items: center; gap: 2px; }
.pdf-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pdf-find { flex: 1; min-width: 140px; }
.pdf-find .field { height: 30px; }
.pdf-head .hits { margin-top: 0; }
.hit-clear { background: transparent; color: var(--ink-3); }
.pdf-body { position: relative; flex: 1; overflow: auto; overscroll-behavior: contain; padding: 12px; background: var(--ground); display: grid; gap: 12px; align-content: start; }
.pdf-body .pages { margin: 0; padding: 0; border: 0; background: none; overflow: visible; }
.page-text-block .label { margin-bottom: 4px; }

.details { display: grid; grid-template-columns: minmax(110px, 36%) minmax(0, 1fr); font-size: var(--t-s); }
.details dt, .details dd { padding: 8px 0; border-bottom: 1px solid var(--border-soft); }
.details dt { color: var(--ink-2); padding-right: var(--s4); }
.details dd { font-weight: 500; overflow-wrap: anywhere; }
.details dd .sub { display: block; font-weight: 400; color: var(--ink-2); font-size: var(--t-xs); }
.details > :nth-last-child(-n + 2) { border-bottom: 0; }
.details-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s6); }

.reasons { list-style: none; border: 1px solid var(--border); border-radius: var(--radius-s); font-size: var(--t-s); }
.reasons li { display: flex; gap: var(--s3); align-items: flex-start; padding: 10px var(--s3); border-bottom: 1px solid var(--border-soft); }
.reasons li:last-child { border-bottom: 0; }
.reasons .badge { margin-top: 1px; min-width: 64px; justify-content: center; }
.reasons .text { flex: 1; min-width: 0; }
.reasons .ev, .reasons .ovr { display: block; color: var(--ink-2); font-size: var(--t-xs); margin-top: 2px; }
.reasons .ovr { font-style: italic; }
.prose-pre { white-space: pre-wrap; color: var(--ink-2); font-size: var(--t-s); }
.note { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--radius-s); background: var(--surface-2); border: 1px solid var(--border); font-size: var(--t-s); }
.note > div { flex: 1; min-width: 0; }
.note .icon { margin-top: 1px; color: var(--ink-2); }
.note.warn { background: var(--caution-bg); border-color: transparent; }
.note.warn .icon { color: var(--caution); }
.note.bad { background: var(--nogo-bg); border-color: transparent; }
.note.bad .icon { color: var(--nogo); }
.provenance { font-size: var(--t-xs); color: var(--ink-2); }
.actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }

.ai-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.risk-HIGH { color: var(--nogo); } .risk-MEDIUM { color: var(--caution); } .risk-LOW { color: var(--ink-2); }
.risk-level { font-weight: 700; font-size: var(--t-xs); }
.plan { padding-left: var(--s5); font-size: var(--t-s); }
.plan li + li { margin-top: var(--s1); }

/* ------------------------------------------------------------------ document viewer */
.doc-tools { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.doc-tools + .doc-tools { margin-top: var(--s3); }
.doc-tools .search .field { width: 220px; }
.doc-tools .spacer { flex: 1; }
.hits { display: flex; gap: var(--s1); flex-wrap: wrap; margin-top: var(--s3); }
.hit { font-size: var(--t-xs); font-weight: 600; height: 22px; display: inline-flex; align-items: center; padding: 0 var(--s2); border-radius: 4px; background: var(--neutral-bg); color: var(--ink-2); }
.hit:hover { text-decoration: none; color: var(--ink); }
.hit[aria-current="true"] { background: var(--accent-soft); color: var(--accent-text); }
.pages { margin-top: var(--s3); background: var(--ground); border: 1px solid var(--border); border-radius: var(--radius-s); padding: var(--s3); overflow: auto; }
.pages figure + figure { margin-top: var(--s3); }
.pages img { display: block; width: 100%; height: auto; background: #fff; border: 1px solid var(--border); }
.pages.zoomed img { width: auto; max-width: none; }
.pages figcaption { font-size: var(--t-xs); color: var(--ink-2); margin-top: var(--s1); }
.page-text { white-space: pre-wrap; font-size: var(--t-s); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-s); padding: var(--s3); }

/* ------------------------------------------------------------------ overview */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.stat { display: block; padding: 14px var(--s4); color: var(--ink); transition: border-color 120ms var(--ease); }
.stat:hover { text-decoration: none; border-color: var(--border-strong); }
.stat .label { display: flex; align-items: center; gap: var(--s2); }
.stat .value { display: block; font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.01em; margin-top: 2px; }
.charts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: var(--s4); align-items: stretch; }
.hbars { list-style: none; display: grid; gap: var(--s2); }
.hbars li { display: grid; grid-template-columns: minmax(110px, 36%) minmax(0, 1fr); gap: var(--s3); align-items: center; }
.hb-code { font-size: var(--t-s); font-weight: 500; overflow-wrap: break-word; }
.hb-track { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.hb-bar { height: 14px; min-width: 3px; background: var(--chart-bar); border-radius: 0 3px 3px 0; }
.hb-n { font-size: var(--t-s); color: var(--ink-2); font-weight: 500; }
.legend { list-style: none; display: flex; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s4); font-size: var(--t-s); color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.cols { display: flex; align-items: stretch; gap: 3px; height: 240px; padding-bottom: 24px; border-bottom: 1px solid var(--border); position: relative; overflow-x: auto; }
.col { flex: 1 0 10px; display: flex; flex-direction: column; justify-content: flex-end; position: relative; min-width: 10px; }
.col .bars { height: var(--h); display: flex; flex-direction: column-reverse; gap: 2px; }
.col .bars span { display: block; min-height: 3px; }
.col .bars span:last-child { border-radius: 3px 3px 0 0; }
.col:hover .bars { filter: brightness(1.08); }
.seg-go { background: var(--chart-go); } .seg-caution { background: var(--chart-caution); }
.seg-review { background: var(--chart-review); } .seg-nogo { background: var(--chart-nogo); }
.col-x { position: absolute; bottom: -22px; left: 0; font-size: var(--t-xs); color: var(--ink-2); white-space: nowrap; }
.as-table { margin-top: var(--s4); }
.as-table summary { cursor: pointer; color: var(--accent-text); font-size: var(--t-s); font-weight: 500; }
.as-table[open] summary { margin-bottom: var(--s3); }

/* ------------------------------------------------------------------ bring in */
.run { display: grid; gap: var(--s3); padding: var(--s4); border-radius: var(--radius-s); border: 1px solid var(--border); background: var(--surface-2); margin-bottom: var(--s5); }
.run-line { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.run-line .spacer { flex: 1; }
.meter { height: 4px; border-radius: 2px; background: var(--neutral-bg); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 2px; background: var(--accent); transition: width 400ms var(--ease); }
.tier-line { display: flex; gap: 6px; flex-wrap: wrap; }
.plain { list-style: none; margin-top: var(--s2); display: grid; gap: 2px; }
.fetch-form { display: grid; gap: var(--s5); }

/* ------------------------------------------------------------------ settings */
.settings { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: var(--s6); align-items: start; }
.settings-nav { position: sticky; top: var(--s5); display: grid; gap: 1px; max-height: calc(100vh - var(--s5) * 2); overflow: auto; padding-bottom: var(--s4); }
.settings-nav a { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); height: 30px; padding: 0 var(--s2); border-radius: var(--radius-s); color: var(--ink-2); font-size: var(--t-s); font-weight: 500; }
.settings-nav a:hover { background: var(--surface-hover); color: var(--ink); text-decoration: none; }
.settings-nav a[aria-current="page"] { background: var(--surface-active); color: var(--ink); font-weight: 600; }
.settings-nav .n { color: var(--ink-3); font-weight: 500; font-size: var(--t-xs); }
.settings-group { margin: var(--s4) var(--s2) 2px; font-size: var(--t-xs); font-weight: 600; color: var(--ink-3); }
.settings-main { min-width: 0; max-width: 1100px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s4); align-items: start; }
.link-list { list-style: none; padding: var(--s1) 0; }
.link-list a { display: flex; justify-content: space-between; gap: var(--s3); padding: 8px var(--s5); color: var(--ink); font-size: var(--t-s); }
.link-list a:hover { background: var(--surface-hover); text-decoration: none; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-s); font-weight: 500; color: var(--ink-2); margin-bottom: var(--s2); }
.back-link:hover { color: var(--ink); text-decoration: none; }
.back-link .icon { width: 14px; height: 14px; }
.form-stack { display: grid; gap: var(--s4); max-width: 640px; }
.form-stack .form-row, .check-grid .form-row { margin: 0; }
.form-row textarea.field { min-height: 88px; }
.form-row .help { margin-top: 4px; }
.field-error { color: var(--nogo); font-size: var(--t-s); margin-top: 4px; }
.has-error .field { border-color: var(--nogo); }
.req { color: var(--ink-3); }
.choices ul, .choices > div { list-style: none; display: grid; gap: 6px; padding: 0; margin: 0; }
.choices label { display: flex; align-items: flex-start; gap: var(--s2); font-size: var(--t-s); cursor: pointer; }
.choices input { margin: 2px 0 0; }
.fieldset { border: 0; padding: 0; margin: 0 0 var(--s5); }
.fieldset legend { font-weight: 600; margin-bottom: var(--s3); padding: 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s3) var(--s5); }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-top: var(--s5); padding: var(--s4) var(--s5); border: 1px solid color-mix(in srgb, var(--nogo) 30%, var(--border)); border-radius: var(--radius); background: var(--surface); }
.btn-danger { background: var(--surface); border-color: color-mix(in srgb, var(--nogo) 45%, var(--border-strong)); color: var(--nogo); }
.btn-danger:hover { background: var(--nogo-bg); }
form.inline { display: inline; }
.field-auto { width: auto; }
.rule-select { width: 100%; height: 30px; }
.rules-table { table-layout: fixed; }
.rules-table td { overflow-wrap: anywhere; }
.rules-table .badge { white-space: normal; height: auto; min-height: 20px; padding-block: 3px; line-height: 1.2; }
.field:disabled { background: var(--surface-2); color: var(--ink-2); cursor: not-allowed; }
.settings-table td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }

/* ------------------------------------------------------------------ messages */
.messages { list-style: none; display: grid; gap: var(--s2); margin-bottom: var(--s4); }
.messages li { padding: 10px var(--s4); border-radius: var(--radius-s); background: var(--surface); border: 1px solid var(--border); font-weight: 500; font-size: var(--t-s); }
.messages .success { background: var(--go-bg); color: var(--go); border-color: transparent; }
.messages .error { background: var(--nogo-bg); color: var(--nogo); border-color: transparent; }

/* ------------------------------------------------------------------ sign in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: var(--s5); background: var(--ground); }
.signin-card { width: min(380px, 100%); padding: var(--s6); }
.signin-card .logo { display: block; width: 168px; height: auto; margin-bottom: var(--s5); border-radius: var(--radius-s); }
.signin-card h1 { font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.01em; }
.signin-card .lede { color: var(--ink-2); margin: 2px 0 var(--s5); font-size: var(--t-s); }
.signin-card .form-row { margin-bottom: var(--s4); }
.signin-card .field { height: 38px; }
.signin-card .btn { width: 100%; height: 38px; font-size: var(--t-m); }
.form-error { padding: var(--s2) var(--s3); border-radius: var(--radius-s); background: var(--nogo-bg); color: var(--nogo); font-size: var(--t-s); margin-bottom: var(--s4); }
.signin-foot { margin-top: var(--s5); text-align: center; font-size: var(--t-xs); color: var(--ink-3); }
:root[data-theme="dark"] .signin-card .logo { background: #f7f7f8; padding: 10px 14px; width: 148px; box-sizing: content-box; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .signin-card .logo { background: #f7f7f8; padding: 10px 14px; width: 148px; box-sizing: content-box; }
}

/* ------------------------------------------------------------------ responsive */
/* Workspace sizing: the panes fill the window height and each scrolls on its own. */
.app:has(.workspace) .page { padding: 12px 16px; max-width: none; }
.app:has(.workspace) .messages { margin-bottom: 8px; }
.work.workspace { grid-template-columns: 280px minmax(0, 1fr); gap: 12px; align-items: stretch; height: calc(100vh - 24px); }
.work.workspace.with-pdf { grid-template-columns: 280px minmax(420px, 1fr) minmax(480px, 1.08fr); }
/* Laptops: the app sidebar folds to an icon rail while a solicitation is open */
@media (max-width: 1799px) {
  .app:has(.workspace) { --sidebar-w: 60px; }
  .app:has(.workspace) .sidebar { padding: 12px 8px; }
  .app:has(.workspace) .brand { justify-content: center; padding: 2px 0 var(--s4); }
  .app:has(.workspace) .txt, .app:has(.workspace) .nav-section, .app:has(.workspace) .who, .app:has(.workspace) .nav .ext { display: none; }
  .app:has(.workspace) .nav a { justify-content: center; padding: 0; }
  .app:has(.workspace) .nav a:last-child { margin-top: var(--s4); }
  .app:has(.workspace) .theme { grid-template-columns: 1fr; }
  .app:has(.workspace) .user { flex-direction: column; padding: 0; }
  .work.workspace.with-pdf { grid-template-columns: 248px minmax(380px, 1fr) minmax(420px, 1.1fr); }
}
/* Smaller laptops with the PDF open: the queue narrows to number, tier and closing date */
@media (max-width: 1439px) {
  .work.workspace.with-pdf { grid-template-columns: 188px minmax(360px, 1fr) minmax(400px, 1.05fr); gap: 10px; }
  .with-pdf .queue .q-name, .with-pdf .queue kbd, .with-pdf .queue .ql-txt, .with-pdf .queue-meta > span { display: none; }
  .with-pdf .queue-head { padding: 8px; }
  .with-pdf .queue-meta { justify-content: flex-end; padding: 4px; }
  .with-pdf .q-item { padding: 7px 8px; }
  .with-pdf .q-line { font-size: var(--t-xs); gap: 4px; }
  .with-pdf .q-line .badge { padding: 0 4px; font-size: 10px; height: 18px; }
}

/* Motion: panes slide in and out; switching solicitations crossfades the record only */
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-group(queue), ::view-transition-group(record), ::view-transition-group(pdf) { animation-duration: 260ms; animation-timing-function: var(--ease); }
::view-transition-old(record), ::view-transition-new(record) { animation-duration: 200ms; }
::view-transition-new(pdf):only-child, ::view-transition-new(record):only-child { animation: pane-in-right 280ms var(--ease) both; }
::view-transition-old(pdf):only-child, ::view-transition-old(record):only-child { animation: pane-out-right 180ms cubic-bezier(0.4, 0, 1, 1) both; }
@keyframes pane-in-right { from { transform: translateX(40px); opacity: 0; } }
@keyframes pane-out-right { to { transform: translateX(40px); opacity: 0; } }
@media (max-width: 1180px) {
  .work.workspace, .work.workspace.with-pdf { grid-template-columns: minmax(0, 1fr); height: auto; }
  .work.workspace .queue { display: none; }
  .record { overflow: visible; }
  .pdf-pane { position: fixed; inset: 0; z-index: 70; border-radius: 0; border: 0; }
  .charts, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .settings { grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
  .settings-nav { position: static; max-height: none; display: flex; flex-wrap: wrap; gap: 4px; }
  .settings-nav .settings-group { width: 100%; margin: var(--s2) 0 0; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); background: var(--ground); }
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0; width: 264px;
    transform: translateX(-100%); visibility: hidden;
    transition: transform 200ms var(--ease), visibility 0s linear 200ms;
  }
  .app.nav-open .sidebar { transform: none; visibility: visible; transition: transform 200ms var(--ease); box-shadow: var(--shadow-pop); }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 50; background: rgb(16 24 40 / 0.4); }
  .topbar {
    display: flex; align-items: center; gap: var(--s2);
    position: sticky; top: 0; z-index: 30; height: var(--topbar-h); padding: 0 var(--s3);
    background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .topbar .brand { padding: 0; }
  .page { padding: var(--s4) var(--s4) var(--s7); }
  .record-head { top: var(--topbar-h); }
}
@media (max-width: 760px) {
  .page-header h1 { font-size: var(--t-xl); }
  .toolbar .search { max-width: none; margin-left: 0; flex-basis: 100%; order: 2; }
  .toolbar .segmented { order: 1; flex: 1; flex-wrap: wrap; }
  .toolbar .filters { order: 3; }
  .search kbd { display: none; }
  .filter-panel { position: fixed; left: var(--s3); right: var(--s3); top: auto; bottom: var(--s3); width: auto; max-height: 78vh; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats .stat:first-child { grid-column: 1 / -1; }
  .details-2 { grid-template-columns: minmax(0, 1fr); }
  .details-2 .details:first-child > :nth-last-child(-n + 2) { border-bottom: 1px solid var(--border-soft); }
  .record-head, .record-body, .card-header, .card-body, .card-footer { padding-left: var(--s4); padding-right: var(--s4); }
  /* list rows become stacked items */
  .rows-fold colgroup, .table.rows-fold thead { display: none; }
  .table.rows-fold, .table.rows-fold tbody { display: block; }
  .table.rows-fold tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--s3); padding: 10px var(--s4); border-bottom: 1px solid var(--border-soft); }
  .table.rows-fold tbody tr:last-child { border-bottom: 0; }
  .table.rows-fold td { display: block; height: auto; padding: 0; border: 0; background: none !important; box-shadow: none !important; white-space: normal; }
  .table.rows-fold tbody tr[aria-selected="true"] { background: var(--accent-soft); }
  .table.rows-fold td.c-sol { order: 1; }
  .table.rows-fold td.c-tier { order: 2; text-align: right; }
  .table.rows-fold td.c-item { order: 3; grid-column: 1 / -1; display: block !important; color: var(--ink); }
  .table.rows-fold td.c-reason { order: 4; grid-column: 1 / -1; display: block !important; color: var(--ink-2); }
  .table.rows-fold td.c-closes { order: 5; }
  .table.rows-fold td.c-award { order: 6; text-align: right; }
  .table.rows-fold td.c-ai { order: 7; grid-column: 1 / -1; }
  .table.rows-fold td.c-ai:not(:has(.badge)), .table.rows-fold td.c-nsn, .table.rows-fold td.c-qty { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; animation-iteration-count: 1 !important; }
}
