/* 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: #667283; --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; }

.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; }
.table th { background: var(--blue-light); color: var(--blue-dark); }

.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); }
/* 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 .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; }

.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; }
/* 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; }
.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; }
.modal-index { max-width: 940px; width: 94%; }
.ci-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.ci-split { display: grid; grid-template-columns: 40% 60%; gap: 14px; }
@media (max-width: 760px) { .ci-split { grid-template-columns: 1fr; } }
.ci-list { max-height: 58vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; }
.ci-row { padding: 6px 12px; border-bottom: 1px solid #eef1f5; cursor: pointer; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-row:hover { background: var(--blue-light); }
.ci-code { font-weight: 700; color: var(--blue-dark); margin-right: 6px; }
/* indent + de-emphasise higher levels so the hierarchy reads at a glance */
.ci-lvl-1 { background: #f3f6fa; font-weight: 600; }
.ci-lvl-2 { padding-left: 22px; }
.ci-lvl-3 { padding-left: 34px; color: var(--ink); }
.ci-lvl-4 { padding-left: 46px; }
.ci-detail { max-height: 58vh; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 6px; padding: 14px 16px; }
.ci-detail-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.ci-code-lg { font-size: 20px; font-weight: 800; color: var(--blue-dark); }
.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; }

/* grid facelift */
.tabulator { font-size: 13px; border: 1px solid var(--line); border-radius: 8px; }
/* Tabulator's own stylesheet loads after ours on the grid page - win anyway */
.tabulator .tabulator-header,
.tabulator .tabulator-header .tabulator-col {
  background: var(--blue) !important; color: #fff !important; border-right-color: #0c7ba3 !important; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-title { color: #fff !important; }
.tabulator .tabulator-header .tabulator-header-filter input,
.tabulator .tabulator-header .tabulator-header-filter select {
  background: #fff; color: var(--ink); border-radius: 4px; border: 0; padding: 4px 6px; }
.tabulator-row { border-bottom: 1px solid #edf0f4; }
.tabulator-row.tabulator-row-even { background: #f6f8fb !important; }
.tabulator-row.tabulator-row-odd { background: #fff !important; }
.tabulator-row.tabulator-selected { background: #cfe4ec !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; }
.g-pill { color: #fff; border-radius: 9px; padding: 1px 9px; font-size: 11px; font-weight: 700; }
/* 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; }
.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); } .ev-pill-REVIEW { background: var(--warn); }
.ev-pill-AMBIG { background: var(--err); } .ev-pill-NOVEL { background: var(--muted); }
.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; }
.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; }
.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; }
.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; }

/* 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: 10px 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; }
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); }
