/* Billing workbench: neutral back-office palette, one accent colour. */
:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --line: #d9dde3;
  --line-soft: #e8ebef;
  --text: #1c232b;
  --muted: #5f6b7a;
  --accent: #1f5fa8;
  --accent-dark: #174a84;
  --accent-soft: #e6eff9;
  --ok: #1d6b3a;
  --ok-soft: #e3f3e8;
  --warn: #8a5a00;
  --warn-soft: #fdf1d3;
  --bad: #a3261d;
  --bad-soft: #fbe4e1;
  --grey-soft: #eceef1;
  --ev: #50627a;
  --sug: #b07a00;
  --dec: #1d6b3a;
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; line-height: 1.4; }
h1 { font-size: 1.35rem; margin: 0 0 12px; }
h2 { font-size: 1.05rem; margin: 0 0 8px; }
h3 { font-size: 0.95rem; margin: 12px 0 6px; }
a { color: var(--accent); }
p { margin: 0 0 8px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Layout */
.shell { display: grid; grid-template-columns: 190px 1fr; grid-template-rows: auto 1fr; height: 100vh; }
.topbar { grid-column: 1 / 3; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 6px 14px; background: #1c2733; color: #fff; }
.topbar .brand { font-weight: 600; margin-right: 8px; }
.topbar label { font-size: 0.85rem; color: #c5ced9; display: flex; align-items: center; gap: 6px; }
.topbar select, .topbar input { height: 28px; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 0.9rem; }
.topbar .who small { color: #c5ced9; }
.nav { background: var(--panel); border-right: 1px solid var(--line); padding: 8px 0; overflow-y: auto; }
.nav a { display: block; padding: 7px 14px; color: var(--text); text-decoration: none; border-left: 3px solid transparent; }
.nav a:hover { background: var(--grey-soft); }
.nav a.active { border-left-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.main { overflow: auto; padding: 16px 18px 60px; }
.page-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.page-head h1 { margin: 0; }
.page-head .ctx { color: var(--muted); }

/* Cards and grids */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; margin-bottom: 14px; min-width: 0; }
.card > h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card > h2 .grow { flex: 1; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.grid > .card { margin-bottom: 0; }
.grid { margin-bottom: 14px; }
.cols-2 { display: grid; gap: 14px; grid-template-columns: minmax(240px, 320px) 1fr; align-items: start; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.gap-lg { gap: 18px; }
.stack > * + * { margin-top: 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.hidden { display: none !important; }

/* Figures */
.stats { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 8px; }
.stat .v { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .v.sm { font-size: 1.05rem; }
.stat .l { color: var(--muted); font-size: 0.82rem; }
.stat.bad .v { color: var(--bad); }
.stat.unknown .v { color: var(--warn); font-size: 1.05rem; }

/* Tables */
.table-wrap { overflow: auto; max-height: 62vh; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); }
.table-wrap.short { max-height: 300px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 5px 8px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
thead th { position: sticky; top: 0; z-index: 1; background: #eef1f4; border-bottom: 1px solid var(--line); font-size: 0.82rem; font-weight: 600; color: #3a4654; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
tbody tr:hover { background: #f7f9fb; }
tr.clickable { cursor: pointer; }
tr.selected { background: var(--accent-soft) !important; }
tr.excluded td { color: #8a929c; background: #f6f6f6; }
tr.excluded td.strike { text-decoration: line-through; }
tr.revoked td { color: #8a929c; }
tr.total td { font-weight: 600; border-top: 1px solid var(--line); background: #f7f9fb; }
td .sub { display: block; color: var(--muted); font-size: 0.82rem; }
.empty { padding: 18px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: 3px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding-top: 6px; color: var(--muted); font-size: 0.86rem; }

/* Badges */
.badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 0.78rem; font-weight: 600; background: var(--grey-soft); color: #3a4654; white-space: nowrap; border: 1px solid transparent; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--accent-soft); color: var(--accent-dark); }
.badge.origin-ai { background: #efe6fb; color: #5b2a9c; border-color: #cdb5ee; }
.badge.origin-agent { background: #e2f1f4; color: #0d5c6b; border-color: #a9d3da; }
.badge.origin-user { background: var(--accent-soft); color: var(--accent-dark); border-color: #b5cde8; }
.badge.origin-rule { background: #eceef1; color: #3a4654; border-color: #c4cad2; }

/* Forms */
label { font-size: 0.85rem; color: #3a4654; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=password], input[type=month], input[type=date], input[type=number], input[type=file], select, textarea {
  border: 1px solid #b8c0ca; border-radius: 3px; padding: 4px 7px; background: #fff; min-height: 30px; max-width: 100%;
}
textarea { width: 100%; min-height: 64px; resize: vertical; }
input:disabled, select:disabled, textarea:disabled { background: var(--grey-soft); color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.field input:not([type=checkbox]), .field select { width: 100%; }
.field.check { flex-direction: row; align-items: center; gap: 7px; }
.field .help { color: var(--muted); font-size: 0.8rem; }
.field .req { color: var(--bad); }
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.filters .field { margin-bottom: 0; }
.filters .field input:not([type=checkbox]), .filters .field select { width: auto; min-width: 130px; }
td input[type=text], td select { width: 100%; min-width: 80px; }
button, .btn { border: 1px solid #aab3be; background: #fff; border-radius: 3px; padding: 4px 11px; min-height: 30px; cursor: pointer; text-decoration: none; display: inline-block; color: var(--text); white-space: nowrap; }
button:hover:not(:disabled), .btn:hover { background: var(--grey-soft); }
button.primary { background: var(--accent); border-color: var(--accent-dark); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--accent-dark); }
button.danger { color: var(--bad); border-color: #d3a29d; }
button.sm { padding: 1px 8px; min-height: 24px; font-size: 0.85rem; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; min-height: 0; text-decoration: underline; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.busy::after { content: " …"; }
.topbar button { background: transparent; color: #fff; border-color: #6c7885; }
.topbar button:hover:not(:disabled) { background: #2c3a49; }

/* Banners and toasts */
.banner { border: 1px solid var(--line); border-left-width: 4px; border-radius: 3px; padding: 8px 12px; margin-bottom: 12px; background: var(--panel); }
.banner.error { border-left-color: var(--bad); background: var(--bad-soft); }
.banner.warn { border-left-color: #c98a00; background: var(--warn-soft); }
.banner.info { border-left-color: var(--accent); background: var(--accent-soft); }
.banner.ok { border-left-color: var(--ok); background: var(--ok-soft); }
.banner ul { margin: 4px 0 0; padding-left: 18px; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: 440px; }
.toast { background: #1c2733; color: #fff; border-radius: 4px; padding: 9px 12px; box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25); display: flex; gap: 10px; align-items: flex-start; border-left: 4px solid var(--accent); }
.toast.error { border-left-color: #e2574c; }
.toast.ok { border-left-color: #47b36b; }
.toast.warn { border-left-color: #e0a526; }
.toast span { flex: 1; overflow-wrap: anywhere; }
.toast button { background: transparent; border: 0; color: #c5ced9; min-height: 0; padding: 0 4px; }

/* Dialog and drawer */
dialog { border: 1px solid var(--line); border-radius: 5px; padding: 0; width: min(560px, 94vw); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); color: var(--text); }
dialog.wide { width: min(820px, 96vw); }
dialog::backdrop { background: rgba(20, 28, 38, 0.45); }
dialog form { padding: 14px 16px; max-height: 88vh; overflow: auto; }
dialog h2 { margin-bottom: 10px; }
dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 96vw); background: var(--panel); border-left: 1px solid var(--line); box-shadow: -6px 0 24px rgba(0, 0, 0, 0.18); z-index: 20; overflow: auto; padding: 14px 16px 40px; }
.drawer .head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.drawer .head h2 { flex: 1; margin: 0; }
dl.kv { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 3px 12px; margin: 0 0 8px; }
dl.kv dt { color: var(--muted); font-size: 0.86rem; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.rule { background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 7px 10px; border-radius: 2px; margin-bottom: 8px; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { border: 1px solid transparent; border-bottom: 0; border-radius: 3px 3px 0 0; background: transparent; }
.tabs button.active { background: var(--panel); border-color: var(--line); font-weight: 600; position: relative; top: 1px; }

/* Evidence / suggestion / decision layers */
.layer { border-left: 5px solid var(--line); }
.layer.evidence { border-left-color: var(--ev); }
.layer.suggestion { border-left-color: var(--sug); }
.layer.decision { border-left-color: var(--dec); }
.layer-tag { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 700; padding: 1px 6px; border-radius: 2px; color: #fff; }
.layer-tag.evidence { background: var(--ev); }
.layer-tag.suggestion { background: var(--sug); }
.layer-tag.decision { background: var(--dec); }
.proposal { border: 1px solid var(--line); border-left: 5px solid var(--sug); border-radius: 3px; padding: 9px 12px; margin-bottom: 10px; background: #fffdf6; }
.proposal .phead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.proposal .phead .grow { flex: 1; }
.quote { border-left: 4px solid var(--ev); background: #f2f4f7; padding: 6px 10px; margin: 6px 0; border-radius: 2px; }
.quote .src { display: block; color: var(--muted); font-size: 0.8rem; margin-bottom: 2px; }
mark { background: #ffe58a; padding: 0 1px; }
.decision-box { border-left: 4px solid var(--dec); background: var(--ok-soft); padding: 6px 10px; margin-top: 6px; border-radius: 2px; }
.decision-box.rejected { border-left-color: var(--bad); background: var(--bad-soft); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login { width: min(380px, 100%); }
.login h1 { margin-bottom: 4px; }
.token-field { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 150px 1fr; }
  .main { padding: 12px 12px 60px; }
  .cols-2 { grid-template-columns: 1fr; }
  th, td { padding: 4px 6px; }
}

.grow { flex: 1; }

/* Header controls sit on the dark bar but are light themselves: their text must not inherit the bar's white. */
.topbar select, .topbar input { color: var(--text); background: #fff; }
.topbar select option { color: var(--text); background: #fff; }
.banner > .row { margin: 0; }

/* ------------------------------------------------------------------ approved design: paper, ink, pine */
:root {
  --paper: #fffcf7; --ink: #182c2d; --dim: #536560; --signal: #9b421b; --wash: #f8ecdf; --pine: #164f40; --pinetxt: #fffdf5; --sub: #edf2ea;
  --bg: var(--paper); --panel: #ffffff; --line: #cbd4cc; --line-soft: #e2e8e1; --text: var(--ink); --muted: var(--dim);
  --accent: var(--pine); --accent-dark: #0f3a2f; --accent-soft: var(--sub); --warn: var(--signal); --warn-soft: var(--wash); --grey-soft: var(--sub);
  font-size: 14px;
}
body { font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.5; font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.grow { flex: 1; }

/* Shell: one bar, two entries */
.shell { display: flex; flex-direction: column; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 10px clamp(14px, 3.5vw, 44px); background: var(--paper); color: var(--ink); border-bottom: 1px solid var(--line); }
.topbar a.brand { font: bold 24px Georgia, serif; letter-spacing: -1.5px; color: var(--ink); text-decoration: none; margin-right: 4px; }
.topbar .nav { display: flex; gap: 5px; background: none; border: 0; padding: 0; overflow: visible; }
.topbar .nav a, .admin-list a { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 12px; border-radius: 5px; border: 0; color: var(--ink); text-decoration: none; font-weight: 400; }
.topbar .nav a:hover, .admin-list a:hover { background: var(--sub); }
.topbar .nav a.active { background: var(--sub); color: var(--pine); font-weight: 650; border: 0; }
.topbar label { color: var(--dim); }
.topbar .who { color: var(--dim); font-size: 0.92rem; }
.topbar .who small { color: var(--dim); }
.topbar button { background: transparent; color: var(--ink); border: 1px solid var(--line); min-height: 34px; }
.topbar button:hover:not(:disabled) { background: var(--sub); }
.ctx-tools { display: flex; gap: 14px; align-items: center; }
.admin-menu { position: relative; }
.admin-menu > summary { list-style: none; cursor: pointer; color: var(--dim); padding: 6px 10px; border-radius: 5px; }
.admin-menu > summary::-webkit-details-marker { display: none; }
.admin-menu > summary:hover, .admin-menu[open] > summary { background: var(--sub); color: var(--ink); }
.admin-list { position: absolute; right: 0; top: 40px; z-index: 30; display: flex; flex-direction: column; min-width: 230px; padding: 6px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 28px rgba(24, 44, 45, 0.14); }
.admin-list a { min-height: 34px; }
.admin-list a.active { color: var(--pine); font-weight: 650; }
.main { flex: 1; overflow: auto; padding: clamp(18px, 3vw, 44px) clamp(14px, 3.5vw, 44px) 80px; }
.main.admin-view { padding-top: 18px; }
button, .btn { border: 1px solid var(--line); background: transparent; border-radius: 5px; padding: 6px 12px; min-height: 36px; color: var(--ink); }
button:hover:not(:disabled), .btn:hover { background: var(--sub); }
button.primary, .btn.primary, a.primary { background: var(--pine); border-color: var(--pine); color: var(--pinetxt); font-weight: 620; padding: 8px 17px; border-radius: 5px; text-decoration: none; display: inline-block; }
button.primary:hover:not(:disabled), .btn.primary:hover, a.primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
button.danger { color: var(--signal); border-color: #d9b9a6; }
:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; }
input[type=text], input[type=password], input[type=month], input[type=date], input[type=number], select, textarea, .wf input:not([type=checkbox]):not([type=file]) { border: 1px solid var(--line); border-radius: 5px; padding: 7px 8px; background: var(--paper); min-height: 36px; }
dialog { background: var(--paper); border-color: var(--line); border-radius: 10px; }
dialog h2 { font: normal 24px/1.15 Georgia, serif; letter-spacing: -0.02em; }
.toast { background: var(--ink); border-left-color: var(--pine); }
.login h1 { font: normal 30px/1.1 Georgia, serif; letter-spacing: -0.03em; }
.banner.warn { border-left-color: var(--signal); }

/* The two operator entries */
.wf { max-width: 1180px; margin: 0 auto; }
.wf h2 { font: normal clamp(29px, 3.3vw, 45px)/1.08 Georgia, serif; letter-spacing: -0.04em; margin: 0 0 12px; }
.wf h3 { font-size: 18px; font-weight: 600; line-height: 1.3; margin: 0 0 8px; }
.wf h3.month-title { font: normal 26px/1.1 Georgia, serif; letter-spacing: -0.03em; margin-bottom: 8px; }
.wf p { margin: 3px 0 12px; }
.wf small, .wf .soft { color: var(--dim); }
.wf small { font-size: 12.5px; }
.wf td > small, .wf .file-main > small, .wf .param > small, .wf .aside > small { display: block; }
.eyebrow { font-size: 12px; font-weight: 650; letter-spacing: 0.045em; color: var(--dim); margin-bottom: 10px; }
.gold { color: var(--signal); }
.wf a.link, .wf button.link { color: var(--pine); text-decoration: underline; text-underline-offset: 3px; background: none; border: 0; padding: 6px 4px; min-height: 36px; border-radius: 5px; display: inline-flex; align-items: center; white-space: nowrap; }
.wf a.link:hover, .wf button.link:hover:not(:disabled) { background: var(--sub); }
.wf a.breadcrumbs { display: inline-block; color: var(--dim); text-decoration: none; margin: 0 0 8px; padding: 4px 0; }
.wf a.breadcrumbs:hover { color: var(--pine); }
.compact { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.compact.end { justify-content: flex-end; }
.stripe { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stripe h2 { margin: 0; }
label.inline { display: inline-flex; align-items: center; gap: 8px; color: var(--dim); }
.wf label { display: grid; gap: 5px; color: var(--dim); font-size: 13px; }
.wf label.inline { display: inline-flex; }
.wf textarea { width: 100%; border: 1px solid var(--line); border-radius: 5px; padding: 10px; background: var(--paper); color: var(--ink); font: inherit; }

.month { margin-bottom: 44px; }
.ledger { margin-top: 20px; border-top: 2px solid var(--ink); }
.record { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(200px, 1.4fr) minmax(140px, 0.7fr) minmax(170px, auto); gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.record.head { color: var(--dim); font-size: 12px; padding: 8px 0; }
.record strong small { font-weight: 400; }
.amt { text-align: right; white-space: nowrap; }
.inline-details { text-align: right; }
.inline-details[open] { flex-basis: 100%; text-align: left; }
.wf details { padding: 9px 0; border-bottom: 1px solid var(--line); }
.wf details.inline-details, .wf details.more { border-bottom: 0; }
.wf summary { color: var(--pine); font-weight: 600; cursor: pointer; }
.wf details[open] > summary { margin-bottom: 8px; }
.wf details.more { margin-top: 30px; }

.split { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(230px, 0.6fr); gap: 32px; margin-top: 14px; align-items: start; }
.folio { border-top: 2px solid var(--ink); padding: 16px 0; min-width: 0; }
.aside { background: var(--sub); border-radius: 6px; padding: 16px; position: sticky; top: 0; }
.aside p { margin: 0 0 4px; }
.aside .figure { display: block; font: normal 30px/1.15 Georgia, serif; letter-spacing: -0.02em; white-space: nowrap; }
.aside hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0 6px; }
.aside-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.aside #btn-download { margin: 6px 0; }
.wf blockquote { padding: 10px 14px; margin: 12px 0; background: var(--wash); border-left: 3px solid var(--signal); white-space: pre-wrap; overflow-wrap: anywhere; }
.pair { border-bottom: 1px solid var(--line); padding: 9px 0; display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.pair b { font-weight: 600; text-align: right; white-space: nowrap; }
.pair.total { border-bottom: 0; border-top: 2px solid var(--ink); margin-top: -1px; font-size: 16px; }
.foot { margin: 12px 0; color: var(--dim); font-size: 12.5px; }
.next { margin: 0 0 12px; }
.parts { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-bottom: 10px; }
.parts a { color: var(--dim); text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
.parts a:hover { color: var(--ink); }
.parts a[aria-current=true] { color: var(--pine); font-weight: 650; border-bottom-color: var(--pine); }
.parts a small { color: var(--dim); }
.parts a.need small { color: var(--signal); font-weight: 650; }
.part-title { margin-top: 4px; }

/* Tables: quiet, readable */
.wf table.sheet, .wf .table-wrap table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.wf .table-wrap { border: 0; background: none; max-height: none; overflow-x: auto; }
.wf .table-wrap.short { max-height: 320px; }
.wf th { position: static; background: none; color: var(--dim); font-size: 12px; font-weight: 600; text-align: left; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--ink); white-space: nowrap; }
.wf td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.wf th.num, .wf td.num { text-align: right; padding-right: 14px; white-space: nowrap; }
.wf tbody tr:hover { background: none; }
.wf tr.clickable:hover { background: var(--sub); }
.wf tr.total td { background: none; border-top: 2px solid var(--ink); }
.wf .empty { border: 0; background: none; text-align: left; padding: 8px 0; color: var(--dim); }
.pkg-table th:nth-child(1), .pkg-table td:nth-child(1) { width: 26%; }
.pkg-table th:nth-child(2), .pkg-table td:nth-child(2) { width: 20%; }
.pkg-table th:nth-child(3), .pkg-table td:nth-child(3) { width: 22%; }
.pkg-table td { overflow-wrap: anywhere; }

/* Package, files, values */
.dropzone { display: flex; align-items: center; gap: 24px; padding: 22px 24px; border: 1.5px dashed var(--line); border-radius: 8px; margin: 14px 0; }
.dropzone .dz-text { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.dropzone .dz-text strong { font-size: 17px; }
.dropzone .dz-text span { color: var(--dim); max-width: 760px; }
.dropzone.quiet { padding: 10px 14px; margin: 14px 0 0; gap: 16px; }
.dropzone.quiet .dz-text strong { font-size: 14px; }
.dropzone.quiet .dz-text span { font-size: 12.5px; }
.dropzone.over { background: var(--sub); border-color: var(--pine); }
.dropzone label.btn { cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; }
.dropzone:focus-within { outline: 2px solid var(--pine); outline-offset: 2px; }
.pkg { background: var(--sub); border-radius: 8px; padding: 18px 20px; margin: 16px 0; }
.pkg .progress { font-size: 16px; font-weight: 600; }
.pkg .ledger { border-top-width: 1px; margin-top: 12px; }
.pkg-file { padding: 9px 0; border-bottom: 1px solid var(--line); }
.rows { border-top: 1px solid var(--line); }
.file-row { display: flex; justify-content: space-between; gap: 18px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.file-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.file-state { text-align: right; display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; font-weight: 600; }
.file-state.soft { font-weight: 400; }
.param { padding: 12px 0; border-bottom: 1px solid var(--line); }
.param-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 8px; }
.param-form .grow { flex: 1; min-width: 240px; }
.param-form input { width: 100%; }

/* Exceptions */
.case { padding: 18px 0; border-bottom: 1px solid var(--line); }
.case:first-of-type { padding-top: 2px; }
.case .compact { margin-top: 10px; }
.opt-hint { display: block; margin-top: 6px; max-width: 760px; }
.compact.other { margin-top: 18px; }

/* Amount trace */
.wf details.trace > summary { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; color: var(--ink); font-weight: 400; }
.wf details.trace > summary::before { content: "+"; color: var(--pine); font-weight: 700; width: 12px; flex: none; }
.wf details.trace[open] > summary::before { content: "−"; }
.wf details.trace > summary::-webkit-details-marker { display: none; }
.wf details.trace > summary { list-style: none; }
.wf details.trace > summary > span { flex: 1; }
.wf details.trace > summary b { white-space: nowrap; font-weight: 600; }
.wf details.trace.sub { margin-left: 26px; }
.wf details.trace.sub:last-of-type { border-bottom: 0; }
.trace-rows { margin-left: 26px; }
.trace-detail { background: var(--sub); border-radius: 6px; padding: 12px 14px; margin: 8px 0; }
.wf details.trace .pair { margin-left: 26px; }
.wf details.trace .editor { margin-left: 26px; }

/* Customer terms */
.tabs2 { margin: 10px 0 0; }
.tabs2 a.primary { padding: 7px 15px; }
.draft { background: var(--wash); border-left: 3px solid var(--signal); padding: 12px 14px; margin: 10px 0 14px; }
.draft .pair { border-bottom-color: #e6cdb6; }
.editor { padding: 12px 0; display: grid; gap: 10px; max-width: 460px; }

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; gap: 12px; }
  .aside { position: static; }
  .record { grid-template-columns: 1fr auto; gap: 4px 12px; }
  .record .stat { grid-column: 1; grid-row: 2; }
  .record .amt { grid-column: 2; grid-row: 1; }
  .record > :last-child { grid-column: 2; grid-row: 2; }
  .record.head { display: none; }
}
.trace-rows .table-wrap { max-height: 420px; overflow-y: auto; }
.wf tr.detail-row > td { padding: 0 0 6px; border-bottom: 1px solid var(--line); }
.wf tr.picked > td { background: var(--sub); }
.folio h3:not(:first-child) { margin-top: 28px; }
.case h3:not(:first-child), .folio .case h3 { margin-top: 0; }
#part-history table td:nth-child(1) { width: 30%; }
#part-history table td:nth-child(3) { min-width: 300px; }

/* ------------------------------------------------------------------ XBS Logistics identity
   Reference: https://xbslogistics.pl/ (pl-index.css, site-refresh.css; see web/assets/README.md).
   Palette of the site: --ink #172c39, --green #397f31 (refreshed #367b2f), --lime #dbefc9, --pale #f1f5ef,
   --line #dce3db, --muted #62706b. Typography: Poppins. Buttons: green, 5px radius. Surfaces: white and pale green. */
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/poppins-400-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/poppins-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/poppins-500-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/poppins-500-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('/assets/fonts/poppins-600-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('/assets/fonts/poppins-600-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --ink: #172c39; --green: #397f31; --green-dark: #255c21; --lime: #dbefc9; --pale: #f1f5ef; --xline: #dce3db; --xmuted: #62706b;
  --paper: #ffffff; --dim: var(--xmuted); --pine: var(--green); --pinetxt: #ffffff; --sub: var(--pale); --signal: #a4521a; --wash: #fbf3e7;
  --bg: #ffffff; --panel: #ffffff; --line: var(--xline); --line-soft: #e9eee8; --text: var(--ink); --muted: var(--xmuted);
  --accent: var(--green); --accent-dark: var(--green-dark); --accent-soft: var(--pale); --warn: var(--signal); --warn-soft: var(--wash); --grey-soft: var(--pale);
  --ok: #2c6a26; --ok-soft: var(--lime);
  font-size: 14px;
}
body { font-family: 'Poppins', Arial, Helvetica, sans-serif; color: var(--ink); background: #fff; line-height: 1.55; font-variant-numeric: tabular-nums; }
a { color: var(--green); }
:focus-visible { outline: 3px solid #398834; outline-offset: 3px; }

/* Header: white, the logo in its own proportions, quiet divider */
.topbar { min-height: 68px; padding: 8px clamp(14px, 3.5vw, 44px); background: #ffffffed; backdrop-filter: blur(16px); border-bottom: 1px solid var(--xline); gap: 26px; }
.topbar a.brand { display: inline-flex; align-items: center; margin-right: 6px; padding: 0; font: inherit; letter-spacing: 0; }
.topbar a.brand img { display: block; height: 42px; width: auto; }
.topbar .nav a, .admin-list a { font-size: 14px; border-radius: 5px; }
.topbar .nav a:hover, .admin-list a:hover { background: var(--pale); color: var(--green); }
.topbar .nav a.active { background: var(--pale); color: var(--green); font-weight: 600; }
.topbar button { border-radius: 5px; }
.admin-menu > summary { font-size: 14px; }

/* Buttons */
button, .btn, label.btn { font: inherit; border: 1px solid var(--xline); background: #fff; border-radius: 5px; padding: 8px 14px; min-height: 38px; color: var(--ink); cursor: pointer; transition: background .15s, border-color .15s; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
button:hover:not(:disabled), .btn:hover, label.btn:hover { background: var(--pale); border-color: #c6d3c4; }
button.primary, .btn.primary, a.primary, label.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 500; padding: 9px 18px; }
button.primary:hover:not(:disabled), .btn.primary:hover, a.primary:hover, label.btn.primary:hover { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
button.danger { color: #8f2d1c; border-color: #e0c3b8; background: #fff; }
button:disabled { opacity: 0.55; cursor: default; }
.busy { opacity: 0.6; pointer-events: none; }
.file-button { display: inline-flex; }
label.link { color: var(--green); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px 4px; }

/* Typography of the two operator entries */
.wf h2 { font: 500 clamp(30px, 3.4vw, 46px)/1.08 'Poppins', Arial, sans-serif; letter-spacing: -0.045em; color: var(--ink); margin: 0 0 12px; }
.wf h3 { font: 600 18px/1.3 'Poppins', Arial, sans-serif; letter-spacing: -0.01em; }
.wf h3.month-title, dialog h2, .login h1 { font: 500 26px/1.15 'Poppins', Arial, sans-serif; letter-spacing: -0.035em; }
.eyebrow { font-size: 12px; letter-spacing: 2px; font-weight: 700; text-transform: uppercase; color: var(--green); margin: 0 0 14px; }
.wf small, .wf .soft { color: var(--xmuted); }
.wf a.link, .wf button.link { color: var(--green); }
.wf a.link:hover, .wf button.link:hover:not(:disabled) { background: var(--pale); }
.wf a.breadcrumbs:hover { color: var(--green); }
.wf summary { color: var(--green); }
.gold { color: var(--signal); }
.ledger, .folio { border-top: 2px solid var(--ink); }
.pair.total, .wf tr.total td { border-top-color: var(--ink); }
.wf th { border-bottom: 1px solid var(--ink); }
.parts a[aria-current=true] { color: var(--green); border-bottom-color: var(--green); }
.aside { background: var(--pale); border-radius: 8px; border: 1px solid var(--xline); }
.aside .figure { font: 500 30px/1.15 'Poppins', Arial, sans-serif; letter-spacing: -0.04em; color: var(--ink); }
.wf blockquote { background: var(--pale); border-left: 3px solid var(--green); border-radius: 0 5px 5px 0; }
.wf blockquote.answer { background: var(--lime); }
.trace-detail, .pkg { background: var(--pale); }
.wf details.trace > summary::before { color: var(--green); }
.dropzone.over { border-color: var(--green); }
dialog { background: #fff; border: 1px solid var(--xline); border-radius: 8px; box-shadow: 0 18px 60px rgba(23, 44, 57, 0.18); }
.toast { background: var(--ink); border-left-color: var(--green); }
input[type=text], input[type=password], input[type=month], input[type=date], input[type=number], select, textarea, .wf input:not([type=checkbox]):not([type=file]) { font: inherit; background: #fff; border: 1px solid var(--xline); border-radius: 5px; color: var(--ink); }
.banner.ok { background: var(--lime); border-left: 3px solid var(--green); padding: 8px 12px; border-radius: 0 5px 5px 0; }
.banner.warn { background: var(--wash); border-left: 3px solid var(--signal); padding: 8px 12px; border-radius: 0 5px 5px 0; }

/* Sign-in */
.login-wrap { background: linear-gradient(120deg, #fff 44%, #f2f6ee); }
.login { width: min(420px, 100%); padding: 34px 32px 30px; border: 1px solid var(--xline); border-radius: 8px; box-shadow: 0 18px 60px rgba(23, 44, 57, 0.08); }
.login-logo { display: block; width: 119px; height: auto; margin: 0 0 26px; }
.login h1 { font-size: 34px; margin: 0 0 8px; }
.login button.primary { width: 100%; margin-top: 8px; padding: 13px 18px; }

/* Status labels: readable in operational tables */
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.pill.new { background: #fff; border-color: var(--xline); color: var(--ink); }
.pill.work { background: var(--pale); border-color: #cfdccb; color: #24521f; }
.pill.wait { background: var(--wash); border-color: #ecd6bb; color: #7c3d10; }
.pill.done { background: var(--lime); border-color: #c4e2ab; color: #1f4f1a; }
.pill.sim { background: #fff; border: 1px dashed #9aa8a2; color: var(--xmuted); font-weight: 500; }
.demo, .demo-title { color: var(--xmuted); font-weight: 400; font-size: 12.5px; letter-spacing: 0; }
.wf h2 .demo-title { font-size: 14px; vertical-align: middle; }

/* Month: shared sources and the queue */
.queue-tools select, .queue-tools input { min-width: 150px; }
.sources { margin: 22px 0 30px; }
.source-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.source { border: 1px solid var(--xline); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: #fff; }
.source.loaded { background: var(--pale); }
.source-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.source-head strong { font-size: 16px; flex: 1; }
.source .compact { margin-top: 8px; }
.source-file { overflow-wrap: anywhere; }
.queue { margin-top: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 34px; padding: 5px 13px; border-radius: 999px; font-size: 13px; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.on:hover:not(:disabled) { background: var(--ink); }
.chip small { color: inherit; opacity: 0.75; margin-left: 4px; }
.record.queue-row { grid-template-columns: minmax(150px, 1.1fr) 150px minmax(140px, 1fr) minmax(190px, 1.5fr) 130px 215px; align-items: start; padding: 14px 0; }
.record.queue-row.head { align-items: center; }
.queue-row > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.queue-row .gaps small { display: block; }
.queue-row .amt { display: flex; flex-direction: column; align-items: flex-end; font-weight: 500; }
.queue-row .amt small { font-weight: 400; }

/* Jev, questions, dictionary notes under a matter */
.jev-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 10px 14px; margin: 0 0 14px; background: var(--pale); border-radius: 8px; }
.jev { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--xline); border-left: 3px solid var(--ink); border-radius: 0 8px 8px 0; background: #fff; }
.jev.empty { border-left-color: var(--xline); padding: 6px 12px; }
.jev.failed, .jev.invalid { border-left-color: var(--signal); }
.jev-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.jev p { margin: 3px 0 6px; }
.wf details.jev-sent { border-bottom: 0; padding: 4px 0; }
.jev-sent pre { background: var(--pale); border-radius: 5px; padding: 10px; overflow-x: auto; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0; }
.jev-note { margin-top: 4px; }
.question-state { margin-top: 12px; padding: 10px 14px; background: var(--wash); border-radius: 8px; }
.question-state.answered { background: var(--lime); }
.dict-hint { margin-top: 10px; padding: 8px 12px; background: var(--pale); border-radius: 5px; }
.case-more { margin-top: 4px; }
.qcard { padding: 18px 0; border-bottom: 1px solid var(--xline); }
.qcard .stripe h3 { margin: 0; }
.qcard textarea { margin-top: 2px; }
.qcard > small { display: block; margin: 4px 0 8px; }
#file-check .pair b { white-space: normal; }
table.dict td { vertical-align: top; }

@media (max-width: 1000px) {
  .source-grid { grid-template-columns: 1fr; }
  .record.queue-row { grid-template-columns: 1fr auto; gap: 6px 12px; }
  .record.queue-row.head { display: none; }
}
.queue-row > div { align-items: flex-start; }
.wf small.gold, .wf p.gold small { color: var(--signal); }

/* The analyst's entry: working settlement, start, completed example */
.start { margin: 26px 0 34px; padding: 22px 24px; border: 1.5px dashed var(--xline); border-radius: 8px; }
.start h3 { margin: 0 0 6px; }
.example { margin: 44px 0 0; padding: 20px 24px 8px; background: var(--pale); border: 1px solid var(--xline); border-radius: 8px; }
.example .stripe h3 { margin: 0; }
.example .ledger { border-top: 1px solid var(--ink); margin-top: 12px; }
.record.example-row { grid-template-columns: minmax(160px, 1.4fr) 150px minmax(130px, 0.8fr) minmax(300px, auto); }
.example-row .amt { display: flex; flex-direction: column; align-items: flex-end; font-weight: 500; }
.example-row .amt small { font-weight: 400; }
.example .record:last-child { border-bottom: 0; }
#working-note { margin: 0 0 4px; }
.aside #btn-decisions { margin: 8px 0 4px; }
.aside a.btn, .aside a.primary { white-space: normal; text-align: center; }
.record.queue-row { grid-template-columns: minmax(150px, 1.1fr) 150px minmax(140px, 1fr) minmax(190px, 1.5fr) 130px 250px; }
