/* ACC Pricing Desk. A side panel and one page per topic; quiet surfaces so the data carries the color.
   Chart colors follow the data-viz reference palette: blue for single series, the fixed status set for states. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --panel: #fcfcfb;
  --side: #f1f0ec;
  --fg: #0b0b0b;
  --fg2: #52514e;
  --muted: #64635d;
  --line: rgba(11, 11, 11, 0.10);
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --accent: #2a78d6;
  --accent-light: #86b6ef;
  --accent-ink: #1c5cab;
  --accent-wash: rgba(42, 120, 214, 0.10);
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --neutral: #a9a79f;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --panel: #1a1a19; --side: #141413; --fg: #f0efec; --fg2: #c3c2b7; --muted: #898781;
    --line: rgba(255, 255, 255, 0.10); --grid: #2c2c2a; --axis: #383835;
    --accent: #3987e5; --accent-light: #1c5cab; --accent-ink: #86b6ef; --accent-wash: rgba(57, 135, 229, 0.16);
    --neutral: #6f6e69;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --panel: #1a1a19; --side: #141413; --fg: #f0efec; --fg2: #c3c2b7; --muted: #898781;
  --line: rgba(255, 255, 255, 0.10); --grid: #2c2c2a; --axis: #383835;
  --accent: #3987e5; --accent-light: #1c5cab; --accent-ink: #86b6ef; --accent-wash: rgba(57, 135, 229, 0.16);
  --neutral: #6f6e69;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--page); color: var(--fg); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
code { font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- controls ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; max-width: 100%; font: inherit; font-size: 14px; font-weight: 600; color: #fff; background: #246aba; border: 0; border-radius: 8px; padding: 7px 16px; cursor: pointer; text-align: center; }
a.btn { text-decoration: none; }
.btn-quiet { color: var(--fg2); background: transparent; border: 1px solid var(--line); font-weight: 500; padding: 5px 12px; }
.btn-quiet:hover { color: var(--fg); border-color: var(--muted); }
.linklike { font: inherit; color: var(--accent-ink); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
input, select { font: inherit; font-size: 14px; color: var(--fg); background: var(--page); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar > *, .form-grid label > *, .stack > * { min-width: 0; max-width: 100%; }
.search { flex: 1 1 14rem; max-width: 24rem; }
.check { display: inline-flex; gap: 8px; align-items: center; min-height: 36px; font-size: 14px; color: var(--fg2); }

/* ---- signed-out screens ---- */
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.panel { width: min(100%, 27rem); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 14px; }
.panel h1 { font-size: 24px; font-weight: 650; }
.panel p { margin: 0; overflow-wrap: anywhere; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.stack label { font-size: 13px; color: var(--fg2); }
.stack input { font-size: 15px; padding: 9px 11px; }
.stack .btn { margin-top: 10px; justify-self: start; padding: 9px 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; }
.mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; }

/* ---- layout: side panel + page ---- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 18px; padding: 18px 12px; }
.side .brand { padding: 0 8px; }
.side-nav { display: grid; gap: 2px; }
.side-group { margin: 14px 10px 4px; font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.side-nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--fg2); text-decoration: none; font-size: 14.5px; }
.side-nav a:hover { background: var(--accent-wash); color: var(--fg); }
.side-nav a.on { background: var(--panel); color: var(--fg); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent), 0 1px 2px rgba(0, 0, 0, .05); }
.badge { font-size: 12px; font-weight: 600; min-width: 24px; padding: 0 7px; border-radius: 999px; text-align: center; background: var(--accent-wash); color: var(--fg); font-variant-numeric: tabular-nums; }
.badge:empty { display: none; }
.side-foot { margin-top: auto; display: grid; gap: 6px; justify-items: start; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.side-foot .who { min-width: 0; max-width: 100%; color: var(--fg2); overflow-wrap: anywhere; }
.topbar, .drawer-close { display: none; }
.main { min-width: 0; padding: 30px clamp(16px, 4vw, 44px) 72px; }
.page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; max-width: 1180px; margin-inline: auto; }
.page-head { display: grid; gap: 6px; padding-bottom: 4px; }
.page-head h1 { font-size: 27px; line-height: 1.2; font-weight: 650; }
.page-head p { margin: 0; color: var(--fg2); max-width: 76ch; }

@media (max-width: 900px) {
  .app { display: block; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; gap: 12px; padding: max(6px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left)); background: var(--side); border-bottom: 1px solid var(--line); }
  .topbar-title { font-weight: 600; }
  .side { position: fixed; z-index: 30; top: 0; left: 0; width: min(290px, 92vw); visibility: hidden; transform: translateX(-102%); transition: transform .18s ease, visibility 0s .18s; padding: max(12px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .app.nav-open .side { visibility: visible; transform: none; transition-delay: 0s; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
  .side .brand { min-height: 44px; padding-right: 90px; }
  .drawer-close { display: inline-flex; position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; min-height: 44px; font-size: 13px; padding-inline: 10px; }
  .side-nav a { min-height: 42px; }
  .side-foot { flex: none; }
  .scrim { position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .35); }
  .main { padding: 18px max(16px, env(safe-area-inset-right)) max(48px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .page-head h1 { font-size: 23px; }
  html { scroll-padding-top: 68px; }
  body:has(.nav-open) { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* ---- tiles and cards ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 12px; }
.tile { display: grid; gap: 2px; align-content: start; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none; }
a.tile:hover { border-color: var(--accent); }
.tile-label { font-size: 13px; color: var(--fg2); }
.tile-num { font-size: clamp(23px, 2.1vw, 30px); line-height: 1.2; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile-note { font-size: 12.5px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 25rem), 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; align-content: start; overflow-wrap: anywhere; }
.desk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.desk-details { display: block; }
.desk-details > summary { cursor: pointer; padding-block: 4px; font-size: 15px; font-weight: 600; }
.desk-details > summary::marker, .portal-submissions summary::marker { color: var(--accent-ink); }
.details-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding-top: 12px; min-width: 0; }
.details-body > section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.details-body > p { margin: 0; max-width: 72ch; }
#p-how .card > ol { margin: 0; padding-left: 1.35rem; max-width: 72ch; }
#p-how .card > ol > li + li { margin-top: 8px; }
.card h2 { font-size: 16px; font-weight: 600; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.card-head > a { font-size: 14px; }
.card-head > a::after { content: " \2192"; }
.note { margin: 0; font-size: 13px; color: var(--fg2); max-width: 80ch; }
.lead { margin: 0; font-size: 15px; }
.lead b { font-variant-numeric: tabular-nums; }

/* ---- short lists on the overview ---- */
.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list li { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.list li:first-child { border-top: 0; padding-top: 2px; }
.list .when { color: var(--fg2); font-size: 13px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.list small { display: block; color: var(--muted); font-size: 12.5px; }
.list .empty { display: block; grid-column: 1 / -1; color: var(--muted); }

/* ---- tables ---- */
.tbl { overflow: auto; overscroll-behavior-x: contain; max-height: 36rem; min-width: 0; max-width: 100%; }
.tbl.tall { max-height: 46rem; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { position: sticky; top: 0; z-index: 1; background: var(--panel); text-align: left; font-weight: 600; font-size: 12.5px; color: var(--fg2); padding: 8px 10px; border-bottom: 1px solid var(--axis); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover td { background: var(--accent-wash); }
td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
td input, td select { font-size: 13px; padding: 4px 8px; width: 100%; min-width: 7rem; }
.saved { color: var(--good); font-size: 12px; margin-left: 4px; }
.empty-note { color: var(--muted); font-size: 13px; margin: 0; }
/* Wide editable tables scroll sideways instead of squeezing their text columns. */
#tb-claims table { min-width: 38rem; }
#tb-claims.with-credit-details table { min-width: 90rem; }
#tb-claims td:nth-child(2) { min-width: 8rem; }
#tb-claims td:nth-child(11) { min-width: 18rem; }
#tb-issues table { min-width: 980px; }
#tb-issues td { max-width: 30rem; overflow-wrap: anywhere; }
#tb-credits td:nth-child(6) { min-width: 16rem; }
#tb-deadlines table, #tb-month table, #tb-cq table { min-width: 38rem; }

/* ---- status: a colored dot beside plain text ---- */
.st { white-space: nowrap; }
.st::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; background: var(--neutral); }
.st-good::before { background: var(--good); }
.st-accent::before { background: var(--accent); }
.st-warning::before { background: var(--warning); }
.st-serious::before { background: var(--serious); }
.st-critical::before { background: var(--critical); }

/* ---- charts ---- */
.chart { position: relative; min-width: 0; min-height: 6rem; }
.chart svg { display: block; max-width: 100%; height: auto; }
.bar-list { display: grid; gap: 14px; list-style: none; padding: 0; margin: 0; }
.bar-list > li { min-width: 0; }
.bar-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 8px; margin-bottom: 4px; font-size: 14px; line-height: 1.4; }
.bar-line > span { min-width: 0; overflow-wrap: anywhere; }
.bar-total { color: var(--fg); font-variant-numeric: tabular-nums; }
summary.bar-line { grid-template-columns: .8rem minmax(0, 1fr) auto; cursor: pointer; align-content: center; min-height: 36px; list-style: none; }
summary.bar-line::-webkit-details-marker { display: none; }
summary.bar-line::before { content: ""; align-self: center; justify-self: center; width: 7px; height: 7px; border-right: 2px solid var(--accent-ink); border-bottom: 2px solid var(--accent-ink); transform: rotate(-45deg); }
details[open] > summary.bar-line::before { transform: rotate(45deg); }
summary.bar-line:hover > span { text-decoration: underline; }
.bar-track { height: 14px; background: var(--grid); border-radius: 0 4px 4px 0; overflow: hidden; }
.bar-fill { display: flex; height: 100%; max-width: 100%; gap: 1px; border-radius: inherit; overflow: hidden; }
.bar-fill > i { flex-basis: 0; min-width: 0; }
.bar-breakdown { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; margin: 4px 0 10px 1.3rem; color: var(--fg2); font-size: 13px; }
.bar-breakdown dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--fg2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--sw); }
.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 22px rgba(0, 0, 0, .16); padding: 7px 10px; font-size: 12.5px; white-space: nowrap; }
.tip-h { font-weight: 600; margin-bottom: 2px; }
.tip-row { display: flex; align-items: center; gap: 6px; color: var(--fg2); }
.tip-row i { width: 8px; height: 8px; border-radius: 2px; background: var(--sw); }
.tip-row b { color: var(--fg); font-weight: 600; margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; }
/* A thin segmented bar: one whole split into parts, 2px surface gaps, fully rounded ends. */
.seg { display: flex; gap: 2px; height: 10px; border-radius: 999px; overflow: hidden; background: var(--panel); margin: 2px 0 8px; }
.seg i { display: block; height: 100%; background: var(--sw); min-width: 4px; }

/* ---- reference lists ---- */
.gloss { display: grid; grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr); gap: 10px 18px; margin: 0; }
.gloss dt { font-weight: 600; font-size: 14px; }
.gloss dd { margin: 0; font-size: 14px; color: var(--fg2); }
@media (max-width: 640px) { .gloss { grid-template-columns: 1fr; gap: 2px; } .gloss dd { margin-bottom: 10px; } }

/* ---- the credit form ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: 8px; align-items: end; font-size: 13px; color: var(--fg2); }
.form-grid label { display: grid; gap: 3px; }
.form-grid .wide { grid-column: span 2; }
@media (max-width: 640px) { .form-grid .wide { grid-column: auto; } }

#p-review { max-width: 54rem; }
#p-submit { max-width: 54rem; }
#submit-fields { padding: 0; border: 0; margin: 0; min-width: 0; }
#submit-fields > label:not(:first-child) { margin-top: 9px; }
#submit-fields input, #submit-fields select, #submit-fields textarea { min-width: 0; max-width: 100%; }
#submit-fields input[type=file] { padding-inline: 0; border: 0; }
#submit-fields input::file-selector-button { margin-right: .6rem; }
#submit-more { justify-self: start; }
.portal-files, .portal-submissions { list-style: none; padding: 0; margin: 0; }
.portal-files li { display: flex; align-items: baseline; gap: .4rem .8rem; flex-wrap: wrap; }
.portal-files li + li { margin-top: .3rem; }
.portal-files button, .portal-files span, .portal-submissions summary, .portal-receipt { overflow-wrap: anywhere; text-align: left; }
.portal-submissions > li + li { border-top: 1px solid var(--line); }
.portal-submissions details { padding-block: .6rem; }
.portal-submissions summary { cursor: pointer; font-weight: 600; }
.portal-source { display: grid; gap: .5rem; min-width: 0; }
.portal-submissions .portal-source { margin: .6rem 0; }
.portal-source .note, .portal-source .review-text { margin: 0; overflow-wrap: anywhere; }
.portal-receipt { border-left: 3px solid var(--good); padding-left: .7rem; }
.portal-ref { display: block; overflow-wrap: anywhere; }
#review-ref { width: 100%; }
.review-text, .review-history p { white-space: pre-wrap; overflow-wrap: anywhere; }
.review-history { padding: 0; margin: 0; list-style: none; }
.review-history li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.review-history p { margin: 4px 0 0; }
.review-history small { color: var(--fg2); }
.review-form { max-width: 44rem; }
.review-form textarea { resize: vertical; min-height: 5rem; font: inherit; color: var(--fg); background: var(--page); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.review-form button:disabled { opacity: .55; cursor: default; }

@media (max-width: 640px) {
  .page { gap: 12px; }
  .card, .tile { padding: 13px 14px; }
  .btn, .check, .side-nav a, .desk-details > summary { min-height: 44px; }
  summary.bar-line { min-height: 44px; }
  .desk-details > summary { display: list-item; align-content: center; }
  .portal-submissions details { padding-block: 0; }
  .portal-submissions summary { padding-block: 11px; }
  .portal-files .linklike { min-height: 40px; }
  .list li { grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; row-gap: 2px; }
  .list .when { grid-column: 1 / -1; font-size: 12px; }
  .list .st { font-size: 13px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tbl { max-height: min(36rem, 68vh); }
  .tbl.tall { max-height: min(46rem, 68vh); }
  #tb-claims :is(th, td):first-child { position: sticky; left: 0; background: var(--panel); box-shadow: 1px 0 var(--grid); }
  #tb-claims td:first-child { min-width: 4rem; max-width: 6.25rem; overflow-wrap: anywhere; }
  #tb-claims th:first-child { z-index: 2; }
  .toolbar > select, .toolbar > .search { flex: 1 1 14rem; width: 100%; max-width: none; }
  input:not([type=checkbox]), select, .stack input, .review-form textarea, td input, td select {
    min-height: 40px; font-size: 16px;
  }
}

@media (max-width: 390px) {
  .tile { grid-template-columns: 1fr auto; column-gap: 10px; align-items: baseline; }
  .tile-note { grid-column: 1 / -1; }
  .tiles { grid-template-columns: 1fr; }
  .desk-actions > .btn { flex: 1 1 100%; }
}
