/* v3 style browser. Builds on style.css tokens. */
:root { --s-cp: #eb6834; --s-md: #6a5bd0; --s-fc: #2a78d6; --s-band: #2a78d6; --s-ly: #1baf7a; --warn-bg: #fff6e5; --warn-line: #e9b44c;
  --src-ocs: #8a5a00; --src-crx: #1f6fbf; --src-a2k: #6b4fb3; --src-mdl: #0a7d3b; --hdr: 52px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --s-cp: #e0703f; --s-md: #9085e9; --s-fc: #3987e5; --s-band: #3987e5; --s-ly: #199e70; --warn-bg: #2a2416; --warn-line: #8a6a22;
    --src-ocs: #e9b44c; --src-crx: #6fb0f2; --src-a2k: #b3a5f2; --src-mdl: #4cc27c; }
}
:root[data-theme="dark"] { --s-cp: #e0703f; --s-md: #9085e9; --s-fc: #3987e5; --s-band: #3987e5; --s-ly: #199e70; --warn-bg: #2a2416; --warn-line: #8a6a22;
  --src-ocs: #e9b44c; --src-crx: #6fb0f2; --src-a2k: #b3a5f2; --src-mdl: #4cc27c; }

a.home { color: inherit; text-decoration: none; }
.brand { align-items: center; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.tabs a { padding: 5px 12px; border-radius: 6px; color: var(--fg2); text-decoration: none; font-size: 13.5px; border: 1px solid transparent; }
.tabs a:hover { background: var(--bg); }
.tabs a.on { background: var(--hilite); color: var(--fg); font-weight: 600; border-color: var(--line); }

.grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: calc(100vh - var(--hdr)); }
#side { border-right: 1px solid var(--line); background: var(--surface); padding: 12px; position: sticky; top: var(--hdr);
  height: calc(100vh - var(--hdr)); display: flex; flex-direction: column; gap: 8px; }
#q { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); font: inherit; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.filters select { width: 100%; font-size: 12.5px; }
.filters select.on { border-color: var(--accent); color: var(--accent); }
#list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
#list li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; padding: 7px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 4px; }
#list li:hover { background: var(--bg); }
#list li.sel { background: var(--hilite); }
.thumb { width: 44px; height: 44px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); object-fit: cover; display: block; }
.thumb.none { display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--muted); text-align: center; line-height: 1.1; }
.li-top { display: flex; justify-content: space-between; gap: 6px; }
.li-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-num { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.li-meta, .li-stat { font-size: 11.5px; color: var(--muted); }
.li-stat { color: var(--fg2); }
.li-warn { font-size: 11px; color: var(--src-ocs); }

#main { padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; max-width: 1500px; }

.st { display: inline-block; font-size: 11.5px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--fg2); background: var(--bg); white-space: nowrap; }
.st.cp { border-color: var(--s-cp); color: var(--s-cp); }
.st.md { border-color: var(--s-md); color: var(--s-md); }
.st.up { border-style: dashed; }

/* source labels: every number says where it came from */
.src { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .03em; padding: 0 5px; border-radius: 3px; border: 1px solid currentColor; vertical-align: 1px; margin-left: 4px; white-space: nowrap; }
.src.ocs { color: var(--src-ocs); } .src.crx { color: var(--src-crx); } .src.a2k { color: var(--src-a2k); } .src.mdl { color: var(--src-mdl); } .src.est { color: var(--muted); border-style: dashed; }
.kpi .k .src { margin-left: 3px; }

.hero { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; }
.hero .photo { width: 180px; height: 180px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); object-fit: contain; }
.hero .photo.none { display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); font-size: 12px; padding: 10px; }
.hero h2 { font-size: 1.3rem; margin: 0 0 2px; }
.hero .ids { color: var(--muted); font-size: 12.5px; }
.verdict { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--bg); border-radius: 4px; font-size: 13.5px; }
.verdict ul { margin: 2px 0 0; padding-left: 18px; }
.warns { border: 1px solid var(--warn-line); background: var(--warn-bg); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.warns ul { margin: 2px 0 0; padding-left: 18px; }
.good { color: var(--good); } .bad { color: var(--bad); }

.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.kpi.wide { grid-column: span 2; }
.kpi .v.small { font-size: 0.98rem; }
.rng { color: var(--muted); font-size: 12px; }
.note-list { margin: 6px 0 0; padding-left: 18px; color: var(--fg2); font-size: 12.5px; }
.note-list li { margin: 2px 0; }
td.l, th.l { text-align: left; }
td.terms { text-align: left; white-space: normal; min-width: 120px; max-width: 260px; font-size: 12px; }
td.path { text-align: left; white-space: normal; font-size: 11.5px; color: var(--muted); max-width: 380px; word-break: break-all; }
details { margin-top: 8px; }
details summary { cursor: pointer; color: var(--fg2); font-size: 12.5px; }
.placeholder { border: 1px dashed var(--warn-line); background: var(--warn-bg); border-radius: 8px; padding: 8px 12px; font-size: 12.5px; color: var(--fg2); margin: 6px 0; }
table.sortable th { cursor: pointer; user-select: none; }
table.sortable th.sorted::after { content: ' ▾'; }
table.sortable th.sorted.asc::after { content: ' ▴'; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--bg); }
tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
.h180 { height: 180px; } .h200 { height: 200px; } .h240 { height: 250px; } .h300 { height: 300px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sec-h h2 { margin: 0 0 6px; }
dialog#how { width: min(860px, 94vw); max-height: 88vh; border: 1px solid var(--line); border-radius: 10px; padding: 0; background: var(--surface); color: var(--fg); overflow-x: hidden; }
.how-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.how-tabs button.on { border-color: var(--accent); color: var(--accent); }
.bar { height: 8px; border-radius: 4px; background: var(--grid); position: relative; overflow: hidden; min-width: 60px; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--s-fc); }

@media (max-width: 1150px) { .two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  #side { position: static; height: auto; max-height: 360px; border-right: none; border-bottom: 1px solid var(--line); }
  #main { padding: 12px 16px; }
  .kpi.wide { grid-column: span 1; }
  .hero { grid-template-columns: 96px minmax(0, 1fr); gap: 10px; }
  .hero .photo { width: 96px; height: 96px; }
}
@media (max-width: 620px) {
  #dates { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero .photo { width: 100%; height: 220px; }
}

#ptable th, #ptable td { padding: 6px 8px; }
#ptable td:first-child { max-width: 260px; }
#ptable td .rng { white-space: normal; }
#ptable td:last-child { min-width: 130px; white-space: normal; }
thead th { min-width: 0; }
#ptable td:first-child { white-space: normal; }
#ptable td:first-child { min-width: 190px; }
#ptable td:nth-child(3) { white-space: normal; min-width: 120px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.chip { font-size: 11px; padding: 0 6px; border-radius: 10px; background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--fg2); }
.kpis.big { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 10px; }
.kpis.big .v { font-size: 1.25rem; }
.ptabs { display: flex; gap: 4px; margin-top: 10px; border-bottom: 1px solid var(--line); }
.ptabs a { padding: 6px 14px; text-decoration: none; color: var(--fg2); border: 1px solid transparent; border-bottom: none; border-radius: 6px 6px 0 0; font-weight: 600; }
.ptabs a.on { background: var(--hilite); color: var(--fg); border-color: var(--line); }
#ptab-body { display: flex; flex-direction: column; gap: 14px; }
/* Definitions show at once on hover (David, 2026-10-22: the native title tooltip showed only a "?" cursor). */
.term { border-bottom: 1px dotted var(--muted); cursor: help; position: relative; }
.term:hover::after, .term:focus::after { content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px); z-index: 50;
  width: max-content; max-width: 320px; white-space: normal; text-align: left; font-size: 12px; font-weight: 400; line-height: 1.4;
  color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px;
  box-shadow: 0 4px 14px rgba(0,0,0,.18); text-transform: none; letter-spacing: 0; }
table.pnl td, table.pnl th { padding: 5px 8px; }
table.pnl tr.strong td { font-weight: 700; border-top: 1px solid var(--line); }
table.pnl td.pl-label { white-space: normal; }
a.drill { color: inherit; text-decoration: underline dotted; }
.ocs-vals { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.ocs-val { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; font-size: 12px; cursor: pointer; }
.ocs-val .k { color: var(--muted); font-size: 11px; } .ocs-val .v { font-weight: 700; font-size: 13px; }
.ocs-val.on { border-color: var(--src-ocs); box-shadow: 0 0 0 2px var(--warn-line); }
.ocs-doc { margin-top: 8px; max-height: 80vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 8px; }
.pdf-page { position: relative; margin: 0 auto 10px; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.pdf-page canvas { display: block; }
.hl { position: absolute; background: rgba(255, 196, 0, .45); outline: 2px solid #e09a00; border-radius: 2px; pointer-events: none; }
.ocs-doc td.hl-cell { background: rgba(255, 196, 0, .55) !important; outline: 2px solid #e09a00; }
.ocs-doc .xl table { font-size: 11px; color: #111; } .ocs-doc .xl td { border: 1px solid #ddd; white-space: nowrap; }
.ocs-doc h3 { color: #111; }
.table-wrap.tall { max-height: 520px; overflow: auto; }
a.sheet-pick { color: var(--fg2); text-decoration: none; } a.sheet-pick.on { color: var(--fg); text-decoration: underline; }
#ptable { font-size: 12.5px; }
#ptable th, #ptable td { padding: 5px 6px; }
/* 2026-10-23 review: extended coupons, A2000 vs OCS, report builder */
:root { --s-ext: #d0417e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --s-ext: #e0679b; } }
:root[data-theme="dark"] { --s-ext: #e0679b; }
.kpi .s .warn-line { color: var(--bad); }
.rb-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.rb-controls fieldset { border: 1px solid var(--line, #ddd); border-radius: 8px; padding: 6px 10px; margin: 0; }
.rb-controls legend { font-size: 12px; font-weight: 600; padding: 0 4px; }
.rb-controls label { display: block; font-size: 12.5px; line-height: 1.6; }
.rb-progs { max-height: 260px; overflow: auto; }
.rb-table th, .rb-table td { white-space: nowrap; }
.rb-table img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; }
.rb-table .none { width: 72px; height: 72px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); border: 1px dashed var(--line, #ccc); border-radius: 6px; }
.rb-table td.l, .rb-table th.l { position: sticky; left: 0; background: var(--card, var(--bg)); z-index: 1; }
/* portfolio program table: 15 columns (David, Teams 2026-10-23) */
#ptable th, #ptable td { padding: 4px 5px; font-size: 12.5px; }
#ptable th { white-space: normal; min-width: 56px; }
/* where a number comes from (David, Teams 2026-10-23) */
.why { cursor: pointer; border-bottom: 1px dotted currentColor; }
.why:hover, .why:focus { color: var(--accent, #2a78d6); outline: none; }
.whydlg { max-width: 560px; border: 1px solid var(--line, #ccc); border-radius: 10px; padding: 14px 16px; background: var(--card, var(--bg)); color: var(--fg); font-size: 13.5px; line-height: 1.55; }
.whydlg::backdrop { background: rgba(0,0,0,.35); }
.whydlg .x { float: right; margin: -4px -4px 6px 8px; }
.why-t td { padding: 2px 8px; font-size: 12.5px; } .why-t { margin-top: 6px; max-height: 50vh; display: block; overflow: auto; }
.warn-txt { color: var(--warn-line); }
#ptable td:first-child { min-width: 160px; max-width: 210px; white-space: normal; }
#ptable .rng { font-size: 11.5px; }
