/* Economic Classification Portal - Bureau of Statistics house style.
   Blue #05668e, orange #f47f20. */
:root {
  --blue: #05668e; --blue-dark: #03445e; --blue-light: #e8f1f5;
  --accent: #f47f20; --accent-dark: #c9640f; --accent-light: #fdf0e3;
  --ink: #1b2430; --muted: #4a5561; --line: #dde3e8;
  --ok: #1c7a3d; --ok-light: #e6f4ea;
  --err: #b3261e; --err-light: #fdecea;
  --warn: #a5680a; --warn-light: #fbedd3;
  --bg: #f4f6f8;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 "Segoe UI", Arial, sans-serif; color: var(--ink); background: var(--bg); }

/* modern form controls, everywhere */
select, input[type="text"], input[type="number"], input[type="date"],
input[type="search"], input:not([type]), textarea {
  padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; color: var(--ink);
  transition: border-color .12s, box-shadow .12s; }
select:hover, input:hover, textarea:hover { border-color: #b9c3d2; }
select:focus, input:focus, textarea:focus { outline: none;
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(5,102,142,.16); }
select:not([multiple]) { appearance: none; -webkit-appearance: none;
  padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236a7482' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
select[multiple] { border-radius: 8px; padding: 6px; }
select[multiple] option { padding: 5px 8px; border-radius: 5px; }
input[type="file"] { padding: 7px; border: 1.5px dashed var(--line); border-radius: 8px;
  background: #fbfcfe; font: inherit; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--blue); }
label { font-size: 13.5px; }

.inline { display: inline; margin: 0; }
.linkish { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; }

/* ---- shell: sidebar + main, following the sidebar-over-top-tabs call for a
   dozen-plus admin destinations (recognition over recall, Fitts's law) ---- */
.shell { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar { width: 220px; flex: 0 0 220px; background: var(--blue); color: #fff;
  display: flex; flex-direction: column; padding: 16px 10px; position: sticky;
  top: 0; height: 100vh; overflow-y: auto; }

.side-nav { flex: 1; }
.side-foot { flex: 0 0 auto; margin-top: 14px; padding: 12px 10px 2px;
  border-top: 1px solid rgba(255,255,255,.14); font-size: 11px; opacity: .6;
  letter-spacing: .02em; }
.side-group { margin: 18px 0 0; }
.side-group-title { font-size: 10px; letter-spacing: .09em; text-transform: uppercase;
  opacity: .58; padding: 0 10px; margin-bottom: 6px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  color: #dbeafe; text-decoration: none; font-size: 13px; font-weight: 500;
  border-radius: 6px; margin-bottom: 2px; }
.side-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.side-link-on { background: rgba(255,255,255,.16); color: #fff; font-weight: 650;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.nav-icon { width: 16px; height: 16px; flex: 0 0 16px; }

/* collapsible sidebar: shrink to an icon rail, freeing width for the grid.
   The 3-line toggle lives at the bottom of the sidebar and stays visible when
   collapsed so the menu can be reopened; hovering an icon shows its label. */
.sidebar { transition: width .15s, flex-basis .15s; }
.nav-collapsed .sidebar { width: 58px; flex-basis: 58px; padding: 16px 6px; }
.nav-collapsed .side-link { justify-content: center; gap: 0; padding: 9px 0; }
.nav-collapsed .side-link span { display: none; }
.nav-collapsed .side-group-title, .nav-collapsed .side-foot { display: none; }
.nav-collapsed .side-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.12); }
.side-toggle { flex: 0 0 auto; margin-top: 10px; display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px; border: 0; border-radius: 6px; cursor: pointer;
  background: rgba(255,255,255,.08); color: #dbeafe; font: inherit; font-size: 13px; }
.side-toggle:hover { background: rgba(255,255,255,.16); color: #fff; }
.side-toggle svg { width: 18px; height: 18px; flex: 0 0 18px; }
.nav-collapsed .side-toggle { justify-content: center; gap: 0; padding: 9px 0; }
.nav-collapsed .side-toggle span { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 26px; border-bottom: 1px solid var(--line); background: #fff;
  min-height: 62px; }
.topbar-brand { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.topbar .crest { height: 46px; width: auto; flex: 0 0 auto; }
.topbar .mast-text .app { font-size: 16px; font-weight: 700; color: var(--blue-dark); line-height: 1.2; white-space: nowrap; }
.topbar .mast-text .sub { font-size: 11px; font-weight: 700; color: var(--accent-dark);
  text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 18px; flex: 0 0 auto; }
.stamp { font-size: 11px; white-space: nowrap; }
.user-chip { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%;
  background: var(--blue-light); color: var(--blue);
  display: flex; align-items: center; justify-content: center; overflow: hidden; }
.avatar svg { width: 22px; height: 22px; display: block; }
.user-info { line-height: 1.3; white-space: nowrap; }
.user-name { font-size: 12.5px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.user-role { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.topbar-link { font-size: 12px; color: var(--blue); text-decoration: none; white-space: nowrap; }
.topbar-link:hover { text-decoration: underline; }

.content { max-width: 1100px; margin: 26px auto; padding: 0 22px; width: 100%; }
h1 { font-size: 21px; margin: 0 0 6px; color: var(--blue-dark); font-weight: 650; }
.muted { color: var(--muted); }

.flash { max-width: 1100px; margin: 14px auto 0; padding: 10px 16px; border-radius: 6px; }
.flash-ok { background: var(--ok-light); color: var(--ok); }
.flash-info { background: var(--blue-light); color: var(--blue-dark); }
.flash-error { background: var(--err-light); color: var(--err); }

.status-pill { display: inline-block; margin-left: 6px; padding: 1px 9px; border-radius: 9px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.status-draft, .status-exported { background: var(--blue-light); color: var(--blue-dark); }
.status-staging { background: var(--warn-light); color: var(--warn); }
.status-released, .status-in_progress { background: var(--ok-light); color: var(--ok); }
.status-closed { background: #edf0f4; color: var(--muted); }
.status-rejected { background: var(--err-light); color: var(--err); }

/* equal-width KPI tiles that share a row rather than orphaning a lone card:
   as many columns as fit at >=175px, each stretched to fill its track */
.tiles { display: grid; gap: 14px; margin: 18px 0;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); }
.tile { background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--accent);
  border-radius: 8px; padding: 14px 20px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.tile-num { font-size: 25px; font-weight: 700; color: var(--blue-dark); line-height: 1.2; }
.tile-label { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tile-warn { border-top-color: var(--warn); }
.tile-warn .tile-num { color: var(--warn); }
.tile-ok { border-top-color: var(--ok); }

.login-card { max-width: 380px; margin: 60px auto; background: #fff; padding: 28px;
  border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: 8px; }
.login-card label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 13px; }
.login-card input { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }

.pw-field { position: relative; }
.pw-field input { padding-right: 38px !important; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; padding: 0; border: none; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--muted); border-radius: 6px; }
.pw-eye:hover { color: var(--blue-dark); background: var(--blue-light); }
.pw-eye svg { width: 18px; height: 18px; }
.pw-eye .eye-off { display: none; }
.pw-eye.pw-shown .eye-on { display: none; }
.pw-eye.pw-shown .eye-off { display: block; }

.btn { display: inline-block; padding: 9px 18px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--blue-dark); font-weight: 600; text-decoration: none;
  cursor: pointer; font: inherit; margin: 16px 8px 0 0; transition: background .12s, border-color .12s; }
.btn:hover { border-color: var(--blue); background: var(--blue-light); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.table { border-collapse: collapse; background: #fff; }
.table th, .table td { border: 1px solid var(--line); padding: 8px 14px; text-align: left; }
.tbl-compact { width: 100%; table-layout: auto; }
.tbl-compact th, .tbl-compact td { padding: 5px 6px; font-size: 13px; }
.tbl-compact .btn { padding: 4px 8px; font-size: 13px; }
.tbl-compact .inline-form { gap: 5px; }
.tbl-compact .inline-form input, .tbl-compact .inline-form select { padding: 5px 6px; }
.table th { background: var(--blue-light); color: var(--blue-dark); }
table.sortable th[data-sort]:hover { background: #d9e9f0; }
table.sortable th.sort-asc::after { content: " \25B2"; font-size: 10px; }
table.sortable th.sort-desc::after { content: " \25BC"; font-size: 10px; }

.footer { max-width: 1100px; margin: 40px auto 20px; padding: 0 22px;
  color: var(--muted); font-size: 12px; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 16px 20px; margin: 18px 0; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.panel h2 { font-size: 15px; margin: 0 0 10px; color: var(--blue-dark); font-weight: 650; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin: 0; }
.range-form { display: flex; align-items: center; gap: 8px; }
.range-form label { color: var(--muted); font-size: 12px; }
.range-form select { padding: 5px 28px 5px 10px; font-size: 12.5px; }
.chart-sub { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; margin: 16px 0 6px; }
.error-panel { border-left: 4px solid var(--err); }
.info-box { display: flex; gap: 10px; align-items: flex-start; background: var(--blue-light);
  color: var(--blue-dark); border-radius: 8px; padding: 12px 14px; font-size: 13px; line-height: 1.5; }
.info-box svg { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 1px; }
.info-box p { margin: 0 0 6px; }
.info-box p:last-child { margin-bottom: 0; }
.panel-icon-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.panel-icon-head svg { flex: 0 0 20px; width: 20px; height: 20px; color: var(--blue); }
.panel-icon-head h2 { margin: 0; }
.qc-family-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 14px; max-height: 240px; overflow-y: auto; padding: 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); }
/* stacked label-over-input fields that stay together when the row wraps */
.form-row { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field .btn { margin: 0; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; }
.inline-form input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.inline-form select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; background: #fff; }
.inline-form .btn, .panel .btn { margin-top: 0; }
.btn.danger { background: #fff; border-color: var(--err); color: var(--err); }
.btn.danger:hover { background: var(--err-light); border-color: var(--err); }
.crank li { margin: 10px 0; }

/* completed-page export actions - a small icon + label pill, distinguishing
   the everyday download (completed only) from the rarer full-data pull */
.exp-actions { display: flex; gap: 8px; }
.exp-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px;
  border-radius: 7px; border: 1px solid var(--line); background: #fff; color: var(--blue-dark);
  font-weight: 600; font-size: 13px; text-decoration: none;
  transition: background .12s, border-color .12s, transform .08s, box-shadow .12s; }
.exp-btn svg { width: 15px; height: 15px; flex: 0 0 auto; }
.exp-btn:hover { border-color: var(--blue); background: var(--blue-light);
  box-shadow: 0 2px 6px rgba(5,102,142,.12); transform: translateY(-1px); }
.exp-btn:active { transform: translateY(0); box-shadow: none; }
.exp-btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.exp-btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.comp-head-row { margin-bottom: 16px; }

.gridbar { display: flex; gap: 10px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
/* status legend under the grid toolbar */
.legend { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 2px 0 10px;
  font-size: 12px; color: var(--muted); }
.legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 5px; vertical-align: middle; }
.dot-AUTO { background: var(--ok); } .dot-REVIEW { background: var(--warn); }
.dot-AMBIG { background: var(--err); } .dot-NOVEL { background: var(--muted); }

/* coding workspace (multi-view bottom edit panel) */
.ev-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 10px; }
.ev-head h2 { margin: 0; }
.ev-nav { display: flex; gap: 8px; }
.ev-nav .btn { margin: 0; }
.ws-cols { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 18px; }
@media (max-width: 1000px) { .ws-cols { grid-template-columns: 1fr; } }
.tabulator-row.row-active { box-shadow: inset 0 0 0 2px var(--blue); }
#grid { background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.tabulator .tabulator-header { background: var(--blue); color: #fff; }
.tabulator .tabulator-header .tabulator-col { background: var(--blue); color: #fff; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-title { color: #fff; }
#evidence h3 { margin: 12px 0 4px; color: var(--blue-dark); font-size: 14px; }
#evidence .btn { margin-top: 0; padding: 3px 10px; font-size: 12px; }

.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .twocol { grid-template-columns: 1fr; } }
.tile-label a { color: inherit; }

.approvals td { vertical-align: top; padding: 12px 14px; }
.approvals tr.appr-row + tr.appr-row td { border-top: 1px solid var(--line); }
/* more breathing room inside the selected-record panel - was reading as one
   dense block of text with no visual separation between sub-sections */
.aside-body .aside-sect { margin-bottom: 16px; }
.aside-body .ev-record { margin-bottom: 16px; }
.aside-body .fromto { margin-bottom: 4px; }
.aside-body .evid, .aside-body .sim { margin-top: 10px; padding-top: 8px; }
.aside-body .aside-cmt-lbl { margin-top: 12px; }
.aside-body > .aside-cmt-lbl:first-of-type,
.aside-body > select.aside-cmt { margin-top: 4px; }
/* scrollable approvals queue with a sticky header, so a long queue stays usable */
.table-scroll { max-height: 68vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.table-scroll .table { border: 0; }
.table-scroll thead th { position: sticky; top: 0; z-index: 2; }
.act-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.act-btns .btn { margin: 0; padding: 6px 12px; font-size: 12.5px; }
.act-approve.act-on { background: var(--ok); border-color: var(--ok); color: #fff; }
.act-return.act-on, .act-keep.act-on { background: var(--warn); border-color: var(--warn); color: #fff; }
.rec-occ { font-size: 14px; }
.rec-biz { font-size: 13px; margin-top: 2px; }
.rec-meta { font-size: 12px; margin-top: 6px; }
.tag-ref { background: var(--warn-light); color: var(--warn); padding: 1px 7px; border-radius: 9px; font-weight: 600; }
.row-referred { background: #fffdf2; }
.row-qc { background: #f4f5f7; }
.dec { margin-bottom: 6px; }
.evid { font-size: 12px; border-top: 1px dashed var(--line); padding-top: 5px; }
.evid .cand { padding-left: 8px; }
.cand-ex { color: #9099a5; padding-left: 12px; font-style: italic; }
.act { width: 100%; padding: 6px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.signals { font-size: 12px; }
.warn { padding: 3px 8px; border-radius: 5px; margin-bottom: 4px; }
.warn-hard { background: var(--err-light); color: var(--err); }
.warn-soft { background: var(--warn-light); color: var(--warn); }
.ctx { padding: 1px 0; }
.sim { margin-top: 5px; padding-top: 4px; border-top: 1px dashed var(--line); }
.hist-badge { background: var(--err); color: #fff; border-radius: 9px; padding: 0 7px;
  font-weight: 700; font-size: 11px; }
.hist-btn { margin-top: 6px; padding: 3px 10px; font-size: 12px; }
.sig-group { margin-bottom: 9px; padding-bottom: 7px; border-bottom: 1px dashed var(--line); }
.sig-group:last-child { border-bottom: 0; }
.sig-title { font-weight: 700; color: var(--blue-dark); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }

/* exchange modal */
.modal-back { display: none; position: fixed; inset: 0; background: rgba(10,20,40,.45);
  z-index: 60; align-items: center; justify-content: center; }
.modal-back.open { display: flex; }
/* freeze the page behind an open modal - scrolling the sheet underneath while
   reading the code index loses your place in both at once */
body.modal-open { overflow: hidden; }
.modal { background: #fff; border-radius: 10px; border-top: 4px solid var(--blue);
  max-width: 560px; width: 92%; max-height: 76vh; overflow-y: auto; padding: 18px 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; color: var(--blue-dark); }
.modal-head .linkish { color: var(--err); }
.msg { border-radius: 8px; padding: 8px 12px; margin: 8px 0; max-width: 88%; }
.msg-sup { background: var(--blue-light); margin-right: auto; }
.msg-editor { background: var(--accent-light); margin-left: auto; }
.msg-meta { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.modal-wide { max-width: 760px; }

/* ---- code index modal: bigger stage, its own chrome ---- */
.modal-index { max-width: 980px; width: 94%; max-height: 82vh; padding: 0; border-radius: 14px;
  box-shadow: 0 18px 50px rgba(10,20,40,.28); display: flex; flex-direction: column;
  overflow: hidden; animation: ciPop .16s ease-out; }
@keyframes ciPop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
.ci-head { margin: 0; padding: 16px 22px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfcfe, #f6f8fa); border-radius: 14px 14px 0 0; }
.ci-head-title { display: flex; align-items: baseline; gap: 9px; }
.ci-head-icon { font-size: 15px; filter: grayscale(1) opacity(.7); }
.ci-head-sub { font-size: 12px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; }
.ci-manual-link { font-size: 12px; margin-left: auto; padding-left: 12px; white-space: nowrap; }
.ci-close { font-size: 13px; padding: 4px 8px; border-radius: 6px; }
.ci-close:hover { background: var(--err-light); }
.ci-bar { display: flex; align-items: center; gap: 10px; padding: 14px 22px 12px; flex-wrap: wrap; }
.ci-search-wrap { position: relative; flex: 1; min-width: 220px; }
.ci-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 13px; line-height: 1; opacity: .45; pointer-events: none; }
input.ci-search { width: 100%; padding-left: 38px; padding-right: 30px; }
.ci-search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: none; color: var(--muted); font-size: 16px; line-height: 1;
  cursor: pointer; padding: 4px 6px; border-radius: 50%; }
.ci-search-clear:hover { background: #eef1f5; color: var(--ink); }
.ci-split { display: grid; grid-template-columns: 38% 62%; gap: 0; flex: 1; min-height: 0;
  padding: 0 22px 20px; }
@media (max-width: 760px) {
  .ci-split { grid-template-columns: 1fr; }
  .modal-index.ci-detail-open .ci-list { display: none; }
  .modal-index:not(.ci-detail-open) .ci-detail { display: none; }
  .ci-list, .ci-detail { border-radius: 8px; border-right: 1px solid var(--line); }
}
.ci-list { max-height: none; min-height: 0; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px 0 0 8px;
  border-right: none; scrollbar-width: thin; }
/* wrap long class names - an ellipsis here hid the very words a coder is
   scanning for, and the list has the room to show them */
.ci-row { padding: 8px 14px; border-bottom: 1px solid #eef1f5; cursor: pointer; font-size: 13px;
  white-space: normal; overflow-wrap: anywhere; line-height: 1.35;
  display: flex; align-items: baseline; gap: 8px; border-left: 3px solid transparent;
  transition: background .1s, border-color .1s; }
.ci-row:hover { background: var(--blue-light); }
.ci-row-active { background: var(--blue-light); border-left-color: var(--blue); }
.ci-row-active .ci-code { color: var(--blue-dark); }
.ci-code { font-weight: 700; color: var(--blue-dark); flex: 0 0 auto;
  background: #eef2f7; border-radius: 5px; padding: 1px 7px; font-size: 12px; }
.ci-row-active .ci-code { background: var(--blue); color: #fff; }
.ci-row-label { flex: 1 1 auto; min-width: 0; }
/* section headers group the flat division list the way the book itself is
   organised (A Agriculture... through U Extraterritorial...) */
.ci-sec-hd { position: sticky; top: 0; z-index: 1; display: flex; align-items: baseline; gap: 7px;
  padding: 6px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--blue-dark); background: var(--blue-light);
  border-bottom: 1px solid var(--line); }
.ci-sec-hd:first-child { border-top: none; }
.ci-sec-letter { display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 4px; background: var(--blue); color: #fff;
  font-size: 10px; }
.ci-crumb { display: flex; align-items: baseline; gap: 7px; font-size: 11.5px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; }
.ci-crumb-letter { display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 4px; background: #eef2f7; color: var(--blue-dark);
  font-size: 10px; font-weight: 700; text-transform: none; }
mark.ci-hit { background: #fde7a8; color: inherit; border-radius: 3px; padding: 0 1px; }
.ci-list::-webkit-scrollbar, .ci-detail::-webkit-scrollbar, .ci-items::-webkit-scrollbar { width: 8px; }
.ci-list::-webkit-scrollbar-thumb, .ci-detail::-webkit-scrollbar-thumb, .ci-items::-webkit-scrollbar-thumb {
  background: #d7dde3; border-radius: 8px; }
.ci-empty { display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 8px; padding: 32px 16px; }
.ci-empty-icon { font-size: 22px; opacity: .35; }
.ci-loading { display: flex; align-items: center; gap: 10px; padding: 20px; color: var(--muted); }
.ci-spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line);
  border-top-color: var(--blue); animation: ciSpin .7s linear infinite; }
@keyframes ciSpin { to { transform: rotate(360deg); } }
.ci-detail { max-height: none; min-height: 0; overflow-y: auto; border: 1px solid var(--line); border-radius: 0 8px 8px 0;
  padding: 16px 18px; scrollbar-width: thin; }
.ci-back { display: none; }
@media (max-width: 760px) {
  .ci-back { display: inline-block; background: none; border: none; color: var(--blue);
    font-size: 12.5px; font-weight: 600; padding: 0 0 10px; cursor: pointer; }
}
.ci-detail-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--line);
  position: sticky; top: -16px; background: #fff; z-index: 2; }
.ci-code-lg { font-size: 21px; font-weight: 800; color: var(--blue-dark);
  background: var(--blue-light); border-radius: 6px; padding: 1px 9px; }
.ci-title-lg { font-size: 15px; font-weight: 650; color: var(--ink); }
.ci-sect { margin-bottom: 12px; }
.ci-sect-t { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--accent-dark); margin-bottom: 3px; }
.ci-sect-b { font-size: 13px; line-height: 1.5; white-space: pre-line; }

/* the division's own words, before the item lists */
.ci-summary { font-size: 13.5px; line-height: 1.55; white-space: pre-line;
  background: var(--blue-light); border-radius: 8px; padding: 11px 14px;
  margin-bottom: 14px; }

/* the two lists that decide a coding call: what belongs here, what doesn't */
.ci-list-block { border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 14px; overflow: hidden; }
.ci-list-h { display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  cursor: pointer; user-select: none; }
.ci-list-h:hover { filter: brightness(.97); }
.ci-mark { display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; font-size: 11px; color: #fff; }
.ci-n { margin-left: auto; font-size: 11px; font-weight: 700; letter-spacing: 0;
  background: rgba(255,255,255,.6); border-radius: 9px; padding: 1px 8px; }
.ci-chev { font-size: 40px; line-height: 1; transition: transform .15s; }
.ci-collapsed .ci-chev { transform: rotate(-90deg); }
.ci-collapsed .ci-items { display: none; }
.ci-inc { border-color: #bfe3cb; }
.ci-inc .ci-list-h { background: var(--ok-light); color: var(--ok); }
.ci-inc .ci-mark { background: var(--ok); }
.ci-exc { border-color: #f3c9c5; }
.ci-exc .ci-list-h { background: var(--err-light); color: var(--err); }
.ci-exc .ci-mark { background: var(--err); }
.ci-items { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
.ci-items li { display: flex; align-items: baseline; gap: 8px; padding: 7px 14px;
  font-size: 13px; line-height: 1.45; border-top: 1px solid #eef1f5;
  flex-wrap: wrap; overflow-wrap: anywhere; }
.ci-items li:first-child { border-top: 0; }
.ci-items li:nth-child(even) { background: #fbfcfd; }
.ci-txt { flex: 1 1 60%; min-width: 0; }
.ci-note { color: var(--muted); font-size: 12px; }
.ci-src { margin-left: auto; flex: 0 0 auto; font-size: 11px; font-weight: 700;
  color: var(--muted); background: #eef2f7; border-radius: 5px; padding: 1px 7px; }
/* the codes an exclusion points at, as tappable chips rather than a run-on
   "see ..." clause buried in the sentence */
.ci-refs { margin-left: auto; flex: 0 0 auto; display: flex; gap: 4px; flex-wrap: wrap; }
.ci-see { font-size: 11px; font-weight: 700; color: var(--blue);
  background: var(--blue-light); border-radius: 5px; padding: 1px 7px; cursor: pointer; }
.ci-see:hover { background: var(--blue); color: #fff; }
.ci-see-flat { color: var(--muted); background: #eef2f7; cursor: default; }
.ci-see-flat:hover { background: #eef2f7; color: var(--muted); }
.ci-more-btn { display: block; margin-top: 6px; color: var(--blue);
  font-size: 12.5px; font-weight: 600; }
.ci-more-btn:hover { text-decoration: underline; }

/* ============ spreadsheet-style data grid (multi-record view) ============ */
#grid.tabulator, .tabulator { font-size: 13px; border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; background: #fff;
  box-shadow: 0 1px 3px rgba(16,24,40,.05); }
/* Tabulator's own stylesheet loads after ours - win on specificity + !important.
   Light, calm header (no blue fill) so the grid reads like a spreadsheet. */
#grid .tabulator-header,
#grid .tabulator-header .tabulator-col {
  background: #f7f9fc !important; color: #475467 !important;
  border-right: 1px solid #edf1f6 !important; }
#grid .tabulator-header { border-bottom: 1px solid var(--line) !important; }
#grid .tabulator-header .tabulator-col .tabulator-col-title {
  color: #475467 !important; font-weight: 650; font-size: 12px; letter-spacing: .01em; }
#grid .tabulator-header .tabulator-col.tabulator-sortable:hover { background: #eef2f7 !important; }
#grid .tabulator-header .tabulator-header-filter input,
#grid .tabulator-header .tabulator-header-filter select {
  background: #fff; color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 8px; font-size: 12px; }
#grid .tabulator-row { border-bottom: 1px solid #eef1f5; }
#grid .tabulator-row.tabulator-row-even,
#grid .tabulator-row.tabulator-row-odd { background: #fff !important; }
#grid .tabulator-row:hover { background: #f7fafc !important; }
/* a row ticked (via its row number) for "Submit selected" */
#grid .tabulator-row.row-picked { background: #eaf3f7 !important; }
/* spreadsheet row-number gutter (replaces the old far-left select checkbox) */
#grid .g-gutter { background: #f7f9fc !important; color: #98a2b3; font-size: 12px;
  font-weight: 600; border-right: 1px solid #edf1f6 !important; cursor: pointer; }
#grid .tabulator-row:hover .g-gutter { background: #eef2f7 !important; color: #475467; }
#grid .tabulator-row.row-picked .g-gutter { background: var(--blue) !important; color: #fff; }
/* the spreadsheet cell-range (clipboard copy/paste) highlight - kept calm so it
   never competes with the row-pick colour; the gutter keeps its own look */
#grid .tabulator-range { border: 1px solid rgba(5,102,142,.45) !important; }
#grid .tabulator-cell.tabulator-range-selected:not(.g-gutter) {
  background-color: rgba(5,102,142,.07) !important; }
#grid .g-gutter.tabulator-range-selected { background: #f7f9fc !important; }
#grid .tabulator-row.row-picked .g-gutter.tabulator-range-selected {
  background: var(--blue) !important; }
.tabulator-cell.wrapcell { white-space: normal !important; line-height: 1.25; }
.g-top { line-height: 1.25; }
.g-sub { color: var(--muted); font-size: 11.5px; line-height: 1.2; }
/* soft, spreadsheet-style tier / verdict chips (paired with .ev-pill-*) */
.g-pill { display: inline-block; border-radius: 6px; padding: 2px 8px; font-size: 10.5px;
  font-weight: 700; letter-spacing: .03em; text-transform: uppercase; border: 1px solid transparent; }
/* record-status dot chip in the Status column */
.g-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.g-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; display: inline-block; }
.g-status-ok { color: var(--ok); } .g-status-ok .g-dot { background: var(--ok); }
.g-status-warn { color: var(--warn); } .g-status-warn .g-dot { background: var(--warn); }
.g-status-info { color: var(--blue); } .g-status-info .g-dot { background: var(--blue); }
.g-status-todo { color: var(--muted); } .g-status-todo .g-dot { background: #cbd5e1; }
/* status legend + record count under the sheet */
.sheet-legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 4px 0; font-size: 12px; color: var(--muted); }
.sheet-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.sheet-legend .lg-title { font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  font-size: 11px; }
.sheet-legend .lg-sep { width: 1px; height: 14px; background: var(--line); }
.sheet-legend .lg-hint { font-style: italic; }
.sheet-count { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 8px;
  background: #eef2f7; border-radius: 20px; padding: 2px 10px; vertical-align: 3px; }
/* subtle "needs input" signal on empty decision cells only - not a permanent
   wash on every editable cell, which read as clutter rather than signal */
.g-needs { box-shadow: inset 3px 0 0 var(--warn); }
.g-note { background: var(--err-light); color: var(--err); border-radius: 6px; padding: 3px 8px;
  font-size: 12px; white-space: normal; }
.return-note { background: var(--err-light); color: #7A1712; border-radius: 6px;
  padding: 10px 14px; font-size: 15px; font-weight: 600; white-space: normal;
  border-left: 4px solid #7A1712; }
.g-sugg { cursor: pointer; }
.g-sugg:hover { background: var(--blue-light) !important; }
.g-unc { background: var(--muted); color: #fff; border-radius: 9px; padding: 1px 9px;
  font-size: 11px; font-weight: 700; }

/* view modes */
.mode-switch .btn { border-radius: 0; }
.mode-switch .btn:first-child { border-radius: 6px 0 0 6px; }
.mode-switch .btn:last-child { border-radius: 0 6px 6px 0; }
.mode-switch .mode-on { background: var(--blue); color: #fff; border-color: var(--blue); }
.count-badge { display: inline-block; min-width: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--warn); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.mode-on .count-badge { background: #fff; color: var(--blue); }
.split { display: grid; grid-template-columns: minmax(380px, 44%) 1fr; gap: 16px; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }
.s-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.s-nav .btn { margin-top: 0; }
.s-block { margin-bottom: 16px; }
/* clear separation between the ISCO / ISIC / wrap-up sections */
.s-card { border: 1px solid var(--line); border-left: 4px solid var(--blue);
  border-radius: 8px; padding: 12px 16px; margin-bottom: 14px; background: #fbfcfe; }
.s-card-isic { border-left-color: var(--accent); }
.s-card-title { font-weight: 700; color: var(--blue-dark); font-size: 12px;
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px;
  padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.s-text { font-size: 15px; margin: 4px 0 8px; }
.s-final { margin-bottom: 6px; }
.s-input { width: 62%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
#s-record textarea { width: 100%; padding: 8px; border: 1px solid var(--line);
  border-radius: 6px; font: inherit; resize: vertical; }

/* organized model-information blocks */
.ev-record { background: var(--blue-light); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }
.ev-record .sig-title { margin-right: 6px; }
.ev-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .ev-cols { grid-template-columns: 1fr; } }
.ev-block { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }
.ev-title { font-weight: 700; color: var(--blue-dark); margin-bottom: 8px;
  text-transform: uppercase; font-size: 12px; letter-spacing: .05em; }
.ev-verdict { margin-bottom: 6px; }
.ev-pill-AUTO { background: var(--ok-light); color: var(--ok); border-color: #bfe3cb; }
.ev-pill-REVIEW { background: var(--warn-light); color: var(--warn); border-color: #ecd7ab; }
.ev-pill-AMBIG { background: var(--err-light); color: var(--err); border-color: #f3c9c5; }
.ev-pill-NOVEL { background: #eef1f5; color: var(--muted); border-color: #dde3e8; }
.ev-table { width: 100%; margin-top: 8px; }
.ev-table td, .ev-table th { font-size: 12.5px; }
.ev-example { color: var(--muted); }
.ev-table .btn { margin-top: 0; padding: 3px 10px; font-size: 12px; }
#grid .tabulator-row.row-returned { background: #fffdf2 !important; }
.approvals textarea { width: 100%; margin-top: 6px; padding: 8px; border: 1px solid var(--line);
  border-radius: 6px; font: inherit; resize: vertical; min-height: 64px; }
.s-onfile { color: var(--muted); font-size: 13px; margin-bottom: 4px; padding: 4px 8px;
  background: #f0f3f8; border-radius: 5px; display: inline-block; }
.g-refer { background: var(--warn); color: #fff; border-radius: 9px; padding: 1px 9px;
  font-size: 11px; font-weight: 700; }
#grid .tabulator-row.row-refer { background: var(--warn-light) !important; }
/* tier signal, left edge only - stays visible under refer/returned tints */
.tabulator-row.row-tier-AUTO { box-shadow: inset 3px 0 0 var(--ok); }
.tabulator-row.row-tier-REVIEW { box-shadow: inset 3px 0 0 var(--warn); }
.tabulator-row.row-tier-AMBIG { box-shadow: inset 3px 0 0 var(--err); }
.tabulator-row.row-tier-NOVEL { box-shadow: inset 3px 0 0 var(--muted); }
.s-card-refer { border-left-color: var(--warn); background: var(--warn-light); }
.refer-banner { background: var(--warn-light); color: var(--warn); border-radius: 6px;
  padding: 7px 12px; margin-bottom: 8px; font-weight: 600; }
.pair-dec { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 8px; }
.decide-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.decide-or { color: var(--muted); font-size: 13px; }
.return-box { display: flex; flex-direction: column; gap: 8px; background: #fbfcfe;
  border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.return-box .act { max-width: 340px; }
.return-actions { display: flex; justify-content: flex-end; }
.rc-tag { display: inline-block; background: var(--blue); color: #fff; border-radius: 5px;
  padding: 0 6px; font-size: 10px; font-weight: 700; letter-spacing: .03em; vertical-align: 1px; }
.rc-tag-isic { background: var(--accent); color: #6b3208; }
.fromto { line-height: 1.45; }
.ft-k { display: inline-block; width: 40px; color: var(--muted); font-size: 11px;
  text-transform: uppercase; }
.hist-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }
.hist-item-head { font-size: 13px; margin-bottom: 6px; }
.hist-status { float: right; color: var(--muted); font-size: 12px; }
.adj-box { border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; }
.adj-box .btn { margin-top: 8px; }

/* ============ editor worklist + coding panel (plain, calm) ============ */
.worklist { width: 100%; border-collapse: collapse; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.worklist th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700;
  padding: 8px 12px; background: var(--blue-light); border-bottom: 1px solid var(--line); }
.worklist td { padding: 10px 12px; border-bottom: 1px solid #eef1f5; vertical-align: top; }
.worklist tr:not(.worklist-head) { cursor: pointer; }
.worklist tr:not(.worklist-head):hover td { background: #f6f9fb; }
.wl-active td { background: var(--blue-light) !important; }
.wl-active td:first-child { box-shadow: inset 3px 0 0 var(--blue); }
.wl-returned td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.wl-occ { font-size: 14px; font-weight: 600; }
.wl-biz { font-size: 12.5px; margin-top: 2px; }
.tag-ret { display: inline-block; margin-top: 4px; background: var(--warn-light); color: var(--warn);
  font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 9px; }
.cell-done { color: var(--ok); font-weight: 700; }
.cell-code { font-weight: 700; color: var(--blue-dark); font-size: 15px; }
.cell-unc { color: var(--err); font-weight: 600; }
.cell-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px;
  border-radius: 9px; white-space: nowrap; }
.conf-auto { background: var(--ok-light); color: var(--ok); }
.conf-review { background: var(--warn-light); color: var(--warn); }
.conf-ambig { background: var(--err-light); color: var(--err); }
.conf-novel { background: #edf0f4; color: var(--muted); }

#workspace { margin-top: 16px; }
.ws-top { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 12px; }
.ws-nav { display: flex; gap: 8px; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; margin: 0; }
.ret-note { background: var(--warn-light); color: var(--warn); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 14px; }
.code-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .code-cols { grid-template-columns: 1fr; } }
.code-block { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.code-block-h { font-weight: 700; color: var(--blue-dark); margin-bottom: 2px; font-size: 14px; }
.block-hint { font-size: 12px; margin-bottom: 10px; }
.onfile { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.suggest { background: var(--blue-light); border-radius: 6px; padding: 9px 11px;
  margin-bottom: 8px; font-size: 13.5px; line-height: 1.5; }
.alts { margin-bottom: 8px; }
.alt { background: #fff; margin: 2px 4px 2px 0; }
.your { font-size: 14px; margin: 10px 0 6px; }
.done-line { color: var(--ok); font-size: 14px; }
.wrapup { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-top: 16px; }
.wrapup-refer { border-left: 4px solid var(--warn); background: var(--warn-light); }
.note-h { font-size: 12px; font-weight: 700; color: var(--blue-dark); text-transform: uppercase;
  letter-spacing: .04em; margin: 10px 0 4px; }
.wrapup textarea { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; resize: vertical; }
.wrapup-actions { margin-top: 10px; }

/* ---- table view (Tabulator) extras ---- */
.cl-a { line-height: 1.25; }
.cl-b { color: var(--muted); font-size: 11.5px; line-height: 1.2; margin-top: 1px; }
.stdot { font-size: 15px; font-weight: 700; }
.st-done { color: var(--ok); } .st-ret { color: var(--warn); } .st-todo { color: #c2c8d0; }
#grid .tabulator-row.row-returned { background: #fffaf0 !important; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--blue); }
.btn.ghost:hover { background: var(--blue-light); border-color: transparent; }
.kbd-hint { margin: 8px 2px 0; font-size: 12px; }
.kbd { display: inline-block; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; padding: 0 6px; font-size: 11px; background: #fff; color: var(--ink); }
.ws-top-l { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ============ today's progress header (grid + approvals) ============ */
.progress-head { display: flex; align-items: stretch; gap: 18px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 18px; margin: 6px 0 16px; }
.ph-bar { flex: 1 1 320px; min-width: 260px; display: flex; flex-direction: column;
  justify-content: center; }
.ph-bar-top { display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px; }
.ph-title { font-size: 12.5px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .03em; }
.ph-count { font-size: 15px; font-weight: 700; color: var(--blue-dark); }
.ph-count .ph-pct { color: var(--muted); font-weight: 600; margin-left: 6px; }
.ph-track { height: 10px; border-radius: 6px; background: var(--blue-light); overflow: hidden; }
.ph-fill { height: 100%; border-radius: 6px; background: var(--accent);
  transition: width .4s ease; }
.ph-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-card { border: 1px solid var(--line); border-radius: 10px; padding: 8px 16px;
  min-width: 104px; text-align: center; background: #fff; }
.stat-num { font-size: 21px; font-weight: 700; color: var(--blue-dark); line-height: 1.1; }
.stat-lbl { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.stat-card.tone-ok { border-color: #bfe3cb; } .stat-card.tone-ok .stat-num { color: var(--ok); }
.stat-card.tone-warn { border-color: #ecd7ab; } .stat-card.tone-warn .stat-num { color: var(--warn); }
.stat-card.tone-info .stat-num { color: var(--blue); }

/* ============ two-column working layout: grid/table + selected panel ==== */
.work-layout { display: flex; gap: 16px; align-items: flex-start; }
.work-main { flex: 1 1 auto; min-width: 0; }
.work-aside { flex: 0 0 386px; width: 386px; position: sticky; top: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  max-height: calc(100vh - 30px); overflow-y: auto; }
@media (max-width: 1180px) { .work-aside { flex-basis: 330px; width: 330px; } }
.aside-head { display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: #fff; z-index: 2; border-radius: 12px 12px 0 0; }
.aside-head strong { color: var(--blue-dark); font-size: 15px; }
.aside-close { border: none; background: none; cursor: pointer; font-size: 20px;
  color: var(--muted); line-height: 1; padding: 0 4px; }
.aside-close:hover { color: var(--ink); }
.aside-body { padding: 14px 16px; }
.aside-id { display: inline-block; background: var(--blue-light); color: var(--blue-dark);
  border-radius: 6px; padding: 1px 9px; font-size: 12px; font-weight: 600; }
.aside-actions { position: sticky; bottom: 0; background: #fff; padding: 12px 16px;
  border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap;
  border-radius: 0 0 12px 12px; }
.aside-actions .btn { flex: 1 1 auto; justify-content: center; }
.aside-sect { border: 1px solid var(--line); border-left: 4px solid var(--blue);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.aside-sect.side-isic { border-left-color: var(--accent); }
.aside-sect-t { font-weight: 700; font-size: 11.5px; letter-spacing: .03em;
  text-transform: uppercase; color: var(--blue-dark); margin-bottom: 6px; }
.aside-sect.side-isic .aside-sect-t { color: var(--accent-dark); }
.aside-cmt { width: 100%; margin-top: 8px; }
.aside-cmt-lbl { font-size: 11.5px; color: var(--muted); margin: 6px 0 3px; }

/* decide on the left, evidence on the right - the panel is full page width
   when docked at the bottom, so one narrow column wasted most of it */
.aside-cols2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 18px; align-items: start; }
@media (max-width: 900px) { .aside-cols2 { grid-template-columns: 1fr; } }
.aside-sect-ev { border-left-color: var(--muted); background: #fbfcfd; }
/* the decision itself, big enough to read at a glance */
.verdict { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 2px; }
.verdict-code { font-size: 22px; font-weight: 800; color: var(--blue-dark); letter-spacing: .01em; }
.verdict-ok { font-size: 12px; font-weight: 700; color: var(--ok);
  background: var(--ok-light); border-radius: 9px; padding: 2px 10px; }
.verdict-p { font-size: 11.5px; }
.verdict-lbl { font-size: 13px; line-height: 1.4; margin-bottom: 6px; }
.was { font-size: 12.5px; color: var(--muted); padding-top: 6px;
  border-top: 1px dashed var(--line); }
.tier-why { font-size: 12px; margin-top: 4px; line-height: 1.4; }
/* model candidates / prior verified matches, as a tidy ranked list */
.ev-rank { display: flex; flex-direction: column; }
.ev-rank-row { display: flex; align-items: baseline; gap: 7px; font-size: 12.5px;
  padding: 4px 0; border-top: 1px solid #eef1f5; }
.ev-rank-row:first-child { border-top: 0; }
.ev-rank-n { flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%;
  background: #eef2f7; color: var(--muted); font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; }
.ev-rank-sim { margin-left: auto; flex: 0 0 auto; font-size: 11px; font-weight: 700;
  color: var(--muted); background: #eef2f7; border-radius: 5px; padding: 1px 7px; }
/* inline grid cells for Refer / Comment (real controls, not editors) */
.g-refer-cb { cursor: pointer; }
.g-cmt-in { width: 100%; border: 1px solid transparent !important; background: transparent;
  border-radius: 5px !important; padding: 3px 6px !important; font: inherit; font-size: 12.5px; }
.g-cmt-in:hover { border-color: var(--line) !important; background: #fff; }
.g-cmt-in:focus { border-color: var(--blue) !important; background: #fff;
  box-shadow: 0 0 0 3px rgba(5,102,142,.14); }

/* clear "what state is this record in" cues */
.state-pill { display: inline-block; border-radius: 20px; padding: 2px 10px;
  font-size: 11px; font-weight: 700; }
.state-ready { background: var(--ok-light); color: var(--ok); }
.state-draft { background: #eef1f4; color: var(--muted); }
.state-return { background: var(--warn-light); color: var(--warn); }
.row-selected .tabulator-cell, tr.row-selected > td { background: var(--blue-light) !important; }
tr.appr-row { cursor: pointer; }
tr.appr-row:hover > td { background: var(--blue-light); }
tr.appr-row.row-selected > td { box-shadow: inset 3px 0 0 var(--accent); }
.appr-done > td { opacity: .5; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--blue-dark); color: #fff; padding: 11px 20px; border-radius: 9px;
  font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.22); z-index: 60;
  opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.toast-ok { background: var(--ok); } .toast.toast-warn { background: var(--warn); }
.toast.toast-err { background: var(--err); }

/* ============ approvals staging ============ */
.stage-bar { position: sticky; top: 8px; z-index: 20; display: flex; align-items: center;
  gap: 12px; background: var(--blue-dark); color: #fff; border-radius: 10px;
  padding: 6px 16px; margin: 4px 0 14px; box-shadow: 0 4px 14px rgba(3,68,94,.25); }
.stage-bar .stage-count { font-size: 14px; }
.stage-bar .stage-spacer { flex: 1; }
.stage-bar .btn { background: rgba(255,255,255,.14); color: #fff; border-color: transparent; }
.stage-bar .btn:hover { background: rgba(255,255,255,.26); }
.stage-bar .btn.primary { background: var(--accent); border-color: var(--accent); }
.stage-bar .btn.primary:hover { background: var(--accent-dark); }
.staged-note { background: var(--accent-light); border: 1px solid #f0cfa6; color: var(--accent-dark);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }
.dec-cell { white-space: nowrap; }
.dec-undo { margin-left: 8px; font-size: 12px; color: var(--blue); }
.dec-select { width: 100%; max-width: 100%; padding: 4px 22px 4px 8px !important;
  font-size: 12.5px; border-radius: 6px !important; }
.dec-staged { margin-top: 4px; display: flex; align-items: center; gap: 4px; }
tr.appr-row.row-staged-approve > td { box-shadow: inset 4px 0 0 var(--ok); }
tr.appr-row.row-staged-return > td { box-shadow: inset 4px 0 0 var(--warn); }
tr.appr-row.row-staged-approve.row-selected > td,
tr.appr-row.row-staged-return.row-selected > td { box-shadow: inset 4px 0 0 var(--accent); }

/* ============ spreadsheet toolbar (above the grid) ============ */
.sheet-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-bottom: 0;
  border-radius: 10px 10px 0 0; padding: 8px 12px; }
/* square the grid's top corners so it fuses with the toolbar */
.sheet-toolbar + #grid.tabulator { border-top-left-radius: 0 !important; border-top-right-radius: 0 !important; }
.st-search { display: flex; align-items: center; gap: 7px; flex: 0 1 300px; min-width: 200px;
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; background: #fff; }
.st-search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(5,102,142,.14); }
.st-search svg { width: 15px; height: 15px; color: var(--muted); flex: 0 0 15px; }
.st-search input { border: 0 !important; padding: 3px 0 !important; box-shadow: none !important;
  width: 100%; font-size: 13px; background: transparent; }
.sheet-toolbar select { padding: 6px 30px 6px 10px; font-size: 13px; border-radius: 8px; }
.st-field { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.st-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.st-clear { color: var(--blue); font-size: 12.5px; font-weight: 600; }
.st-clear:hover { text-decoration: underline; }
.st-sep { width: 1px; height: 20px; background: var(--line); }
.st-spacer { flex: 1 1 auto; }
.st-tool { color: var(--muted); font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; }
.st-tool:hover { color: var(--blue); }

/* native dropdown header filters (click to pick — no typing in the table) */
.hf-select { width: 100%; max-width: 100%; padding: 3px 20px 3px 7px !important; font-size: 12px;
  border: 1px solid var(--line) !important; border-radius: 6px !important;
  background-color: #fff !important; color: var(--ink) !important; }
/* searchable in-cell code editor: a text box + a popup list of matching codes */
#grid .code-ac-input { width: 100%; height: 100%; min-height: 30px; font: inherit; font-size: 12.5px;
  padding: 2px 8px; border: 1px solid var(--blue) !important; border-radius: 4px !important;
  background-color: #fff !important; color: var(--ink) !important;
  box-shadow: 0 0 0 3px rgba(5,102,142,.14); }
.code-ac-list { position: fixed; z-index: 100; max-height: 260px; overflow-y: auto;
  overscroll-behavior: contain;   /* scrolling the list never scrolls the page */
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(16,24,40,.18); margin-top: 2px; }
.code-ac-item { padding: 6px 10px; font-size: 12.5px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.code-ac-item:hover, .code-ac-item.hi { background: var(--blue-light); }

/* ============ pagination footer (10 records per page) ============ */
#grid .tabulator-footer { background: #fff; border-top: 1px solid var(--line); padding: 8px 12px; }
#grid .tabulator-footer .tabulator-paginator { display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap; justify-content: flex-end; color: var(--muted); font-size: 12.5px; }
#grid .tabulator-footer .tabulator-paginator label { color: var(--muted); font-size: 12.5px; margin-right: 4px; }
#grid .tabulator-page { border: 1px solid var(--line); background: #fff; color: var(--blue-dark);
  border-radius: 6px; padding: 4px 11px; margin: 0; font: inherit; font-size: 12.5px; cursor: pointer;
  min-width: 34px; transition: background .12s, border-color .12s; }
#grid .tabulator-page:hover:not([disabled]) { background: var(--blue-light); border-color: var(--blue); }
#grid .tabulator-page.active { background: var(--blue); border-color: var(--blue); color: #fff; }
#grid .tabulator-page[disabled] { opacity: .45; cursor: default; }
#grid .tabulator-paginator .tabulator-page-size { border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 8px; font-size: 12.5px; }
#grid .tabulator-paginator .tabulator-pages { display: inline-flex; gap: 6px; margin: 0 4px; }

/* ============ detail panel docked at the BOTTOM (moved from the side) ======= */
.work-layout { display: block; }
.work-main { width: 100%; min-width: 0; }
.work-aside { position: static; width: 100%; flex: none; margin-top: 16px;
  top: auto; max-height: none; overflow: visible;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  box-shadow: 0 2px 16px rgba(16,24,40,.08); }
.work-aside .aside-head { border-radius: 12px 12px 0 0; }
/* docked at the bottom the panel does not scroll, so a sticky action bar
   detaches and floats over the content - keep it in normal flow instead */
.work-aside .aside-actions { position: static; border-radius: 0 0 12px 12px; }
/* two model-information blocks side by side to use the full width */
.work-aside .ev-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .work-aside .ev-cols { grid-template-columns: 1fr; } }

/* ============ row-height density (Row height dropdown) ============ */
#grid.dense-compact .tabulator-cell { padding-top: 4px; padding-bottom: 4px; }
#grid.dense-standard .tabulator-cell { padding-top: 8px; padding-bottom: 8px; }
#grid.dense-comfortable .tabulator-cell { padding-top: 15px; padding-bottom: 15px; }

/* ============ frozen identity columns (Freeze toggle) ============ */
#grid .tabulator-header .tabulator-col.tabulator-frozen { background: #f7f9fc !important; }
#grid .tabulator-row .tabulator-cell.tabulator-frozen { background: #fff; }
#grid .tabulator-row:hover .tabulator-cell.tabulator-frozen { background: #f7fafc; }
#grid .tabulator-row.row-picked .tabulator-cell.tabulator-frozen { background: #eaf3f7; }
#grid .tabulator-row.row-returned .tabulator-cell.tabulator-frozen { background: #fffdf2; }
#grid .tabulator-row.row-refer .tabulator-cell.tabulator-frozen { background: var(--warn-light); }
#grid .tabulator-row .g-gutter.tabulator-frozen { background: #f7f9fc; }
#grid .tabulator-row.row-picked .g-gutter.tabulator-frozen { background: var(--blue); }
#grid .tabulator-frozen.tabulator-frozen-left { border-right: 1px solid var(--line) !important; }

/* ============ full-screen grid (Full screen toggle) ============ */
#multiwrap.grid-max { position: fixed; inset: 0; z-index: 55; background: #fff;
  margin: 0; padding: 14px 18px; overflow: auto; }
body.grid-max-open { overflow: hidden; }
#multiwrap.grid-max #grid.tabulator { height: calc(100vh - 210px) !important; }

/* the Business · activity cell is the door to the detail panel */
#grid .tabulator-cell[tabulator-field="business_name"] { cursor: pointer; }
#grid .tabulator-cell[tabulator-field="business_name"]:hover { background: var(--blue-light); }

/* ============ submit confirmation modal ============ */
.modal-confirm { max-width: 430px; }
.confirm-msg { font-size: 15px; font-weight: 600; color: var(--ink); margin: 4px 0 6px; }
.confirm-sub { font-size: 12.5px; margin: 0 0 4px; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.confirm-actions .btn { margin: 0; min-width: 110px; text-align: center; }

/* ============ keyboard shortcuts table ============ */
.sc-table { width: 100%; }
.sc-table td { padding: 8px 12px; font-size: 13px; }
.sc-table td:first-child { white-space: nowrap; width: 40%; }

/* quiet "something changed" note from the live poller - deliberately low-key:
   it reports, it never demands a click */
.live-note { position: fixed; right: 18px; bottom: 18px; z-index: 50;
  background: var(--blue-dark); color: #fff; border-radius: 20px;
  padding: 8px 16px; font-size: 13px; box-shadow: 0 4px 16px rgba(3,68,94,.28);
  opacity: 0; transform: translateY(6px); pointer-events: none;
  transition: opacity .18s, transform .18s; }
.live-note.show { opacity: 1; transform: translateY(0); }
.live-pulse { animation: livePulse 1.2s ease-out 1; }
@keyframes livePulse { 0% { background: var(--accent-light); } 100% { background: transparent; } }

/* comments carried alongside a completed record (admin view) */
.cmt-line { font-size: 12.5px; line-height: 1.4; padding: 2px 0;
  border-top: 1px solid #eef1f5; }
.cmt-line:first-child { border-top: 0; }
.cmt-who { display: block; font-size: 11px; font-weight: 700; color: var(--muted); }

/* ============ return history page: one collapsible row per record ======== */
.hist-bar { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; }
.hist-rec { background: #fff; border: 1px solid var(--line); border-radius: 8px;
  margin-bottom: 8px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.hist-rec summary { cursor: pointer; padding: 11px 16px; list-style: none;
  display: flex; align-items: center; gap: 12px; }
.hist-rec summary::-webkit-details-marker { display: none; }
.hist-rec summary::before { content: "\25B8"; color: var(--muted);
  flex: 0 0 auto; transition: transform .12s; }
.hist-rec[open] summary::before { transform: rotate(90deg); }
.hist-rec[open] summary { border-bottom: 1px solid var(--line); }
.hist-rec summary:hover { background: #f7fafc; border-radius: 8px; }
.hist-rec[open] summary:hover { border-radius: 8px 8px 0 0; }

/* ============ allocation: supervisor rows expanding to their editors ===== */
.attr-sup-row { cursor: pointer; }
.attr-sup-row:hover { background: #f7fafc; }
.attr-caret { display: inline-block; color: var(--muted); transition: transform .12s; }
.attr-sup-row.attr-open .attr-caret { transform: rotate(90deg); }
.attr-editor-row td { padding-left: 8px; }
.attr-editor-row .g-sub { padding-left: 16px; }
.attr-legend-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok); margin-right: 5px; vertical-align: middle; }
.hist-rec-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hist-rec-main .muted { font-size: 12.5px; }
.hist-rec-meta { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.hist-rec-body { padding: 12px 16px; }

/* ============ simple server-paged list footer (approvals, completed) ===== */
.pager { display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px; padding: 8px 4px; }
.pager .btn { margin: 0 0 0 8px; }
.btn-disabled { opacity: .4; pointer-events: none; }

/* ============ completed records page: two-tab switch ============ */
.comp-tabs { display: flex; gap: 10px; margin: 14px 0; }
.comp-tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; }
.comp-tab:hover { border-color: var(--blue); }
.comp-tab-on { background: var(--blue); border-color: var(--blue); color: #fff; }
.comp-tab-icon { width: 17px; height: 17px; flex: 0 0 17px; }
.comp-count { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 9px;
  background: var(--blue-light); color: var(--blue-dark); font-size: 11.5px; font-weight: 700; }
.comp-tab-on .comp-count { background: rgba(255,255,255,.22); color: #fff; }

/* ============ completed records page: export tab ============ */
.export-choice { display: flex; flex-direction: column; gap: 8px; max-width: 520px; }
.export-option { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 8px; cursor: pointer; }
.export-option:hover { border-color: var(--blue); }
.export-option input { margin-top: 3px; accent-color: var(--blue); }
.export-option-on { border-color: var(--blue); background: var(--blue-light); }
.export-option strong { display: block; font-size: 14px; }
.export-option .g-sub { display: block; margin-top: 2px; }
.export-count { margin: 14px 0; font-size: 13.5px; color: var(--muted); }
.export-count strong { color: var(--blue-dark); font-variant-numeric: tabular-nums; }
.export-alt { margin-top: 12px; font-size: 12.5px; }

/* ============ small filter popover (admin: editor progress panel) ============ */
.editor-filter-bar { margin-bottom: 10px; }
.popover-wrap { position: relative; display: inline-block; }
.popover { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20;
  background: #fff; border: 1.5px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: 10px; min-width: 220px; }
.popover-actions { display: flex; gap: 10px; margin-bottom: 8px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.popover-list { display: flex; flex-direction: column; gap: 6px;
  max-height: 240px; overflow-y: auto; padding-right: 4px; }
