:root {
  /* forest green and roast copper on a mint wash, cream top bar */
  --forest: #0e4a40;
  --forest-deep: #0a352e;
  --forest-lit: #13695a;
  --copper: #a4592a;
  --copper-deep: #6b3418;
  --cream: #f7f0e1;
  --brand: var(--forest);
  --brand-2: var(--forest-lit);
  --accent: var(--copper);
  --bg: #eef5f1;
  --panel: #ffffff;
  --text: #12302a;
  --muted: #587069;
  --line: #d5e5de;
  --field: #c3d8cf;
  --ok: #1c7a4c;
  --ok-bg: #dcefe3;
  --warn: #8f5310;
  --warn-bg: #f7e9d0;
  --crit: #a4592a;
  --crit-bg: #f6e4d6;
  --bad: #a3311d;
  --bad-bg: #f8e0d9;
  --info-bg: #e2f0ea;
  --radius: 14px;
  --shadow: none;
  --sidebar: 248px;
  --sans: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
  --serif: "Alegreya", Georgia, "Times New Roman", serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans); font-variant-numeric: lining-nums;
  background: var(--bg); color: var(--text); line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.25; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.num { text-align: right; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--brand); color: #d9ebe4; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; display: flex; flex-direction: column; z-index: 40;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1rem .8rem; color: #fff; font-weight: 700; }
.brand img { width: 34px; height: 34px; }
.brand small { display: block; font-weight: 400; color: #b9d6cb; font-size: .75rem; }
.nav { padding: .25rem .5rem 1rem; flex: 1; }
.nav .sec { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #8fbcae; padding: .9rem .75rem .3rem; }
.nav a {
  display: flex; align-items: center; gap: .65rem; color: #d9ebe4; padding: .6rem .75rem;
  border-radius: 8px; text-decoration: none; font-size: .95rem;
}
.nav a:hover { background: rgba(255, 255, 255, .08); }
.nav a.active { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 600; }
.nav .ico { width: 20px; text-align: center; }
.nav .pill { margin-left: auto; background: var(--bad); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 .45rem; font-weight: 700; }
.sidebar-foot { padding: .8rem 1rem 1.2rem; border-top: 1px solid rgba(255, 255, 255, .1); font-size: .85rem; }
.sidebar-foot button { margin-top: .5rem; width: 100%; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .75rem; padding: .6rem 1.25rem; min-height: 56px;
}
.topbar .title { font-weight: 650; font-size: 1.05rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { display: none; }
.bell { position: relative; }
.bell .count {
  position: absolute; top: -4px; right: -4px; background: var(--bad); color: #fff; font-size: .7rem; font-weight: 700;
  border-radius: 999px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px;
}
.content { padding: 1.25rem 1.5rem; max-width: 2000px; width: 100%; margin: 0 auto; }
.backdrop { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .2s ease; }
  .shell.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .shell.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 35; }
  .menu-btn { display: inline-flex; }
  .content { padding: 1rem; }
  .topbar { padding: .5rem 1rem; }
}

/* ---------- buttons & forms ---------- */
button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: 8px; padding: .55rem .95rem; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 40px; text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { background: #e6f1ec; text-decoration: none; }
button.primary, .btn.primary { background: var(--brand-2); color: #fff; border-color: var(--brand-2); }
button.primary:hover, .btn.primary:hover { background: var(--forest-deep); }
button.danger, .btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
button.danger:hover { background: #991b1b; }
button.warn { background: var(--accent); color: #1c1917; border-color: var(--accent); }
button.ghost { background: transparent; border-color: transparent; }
button.ghost:hover { background: rgba(0, 0, 0, .05); }
button.sm, .btn.sm { padding: .3rem .6rem; min-height: 32px; font-size: .85rem; }
button.icon { padding: .4rem .55rem; }
button:disabled { opacity: .55; cursor: not-allowed; }
.sidebar button { background: rgba(255, 255, 255, .1); color: #fff; border-color: transparent; }

label { display: block; font-size: .82rem; font-weight: 600; color: #2b4a43; margin-bottom: .3rem; }
input, select, textarea {
  font: inherit; width: 100%; padding: .55rem .7rem; border: 1px solid var(--field); border-radius: 8px; background: #fff;
  color: var(--text); min-height: 42px;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(19, 105, 90, .35); border-color: var(--brand-2); }
input[type=checkbox] { width: auto; min-height: 0; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.field { margin-bottom: .9rem; }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: .25rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; margin-top: .5rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; }
.toolbar .field { margin-bottom: 0; min-width: 150px; flex: 1 1 150px; max-width: 260px; }
.toolbar .spacer { flex: 1 1 auto; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- panels & cards ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; margin-bottom: 1rem; }
.panel > h2:first-child { margin-bottom: .8rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); display: block; color: inherit; }
a.kpi:hover { text-decoration: none; border-color: var(--brand-2); }
.kpi .label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 1.55rem; font-weight: 700; margin-top: .15rem; font-variant-numeric: lining-nums tabular-nums; }
.kpi .sub { font-size: .78rem; color: var(--muted); }
.kpi.bad { border-left: 4px solid var(--bad); }
.kpi.crit { border-left: 4px solid var(--crit); }
.kpi.warn { border-left: 4px solid var(--accent); }
.kpi.ok { border-left: 4px solid var(--ok); }
.kpi.info { border-left: 4px solid var(--brand-2); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.cols > .panel { margin-bottom: 0; }

/* ---------- dashboard charts ---------- */
.chart-grid {
  --series-1: #13695a; --series-2: #a4592a; --bar: #13695a; --track: #e3eee9;
  --st-expired: #a3311d; --st-critical: #c7652a; --st-warning: #d9a23a; --st-good: #1c7a4c; --st-none: #a7b9b2;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem;
}
.chart-grid > .panel { margin-bottom: 0; min-width: 0; }
.chart-panel.wide { grid-column: 1 / -1; }
@media (min-width: 1250px) {
  .chart-grid { grid-template-columns: 2fr 1fr; }
  .chart-panel.wide { grid-column: auto; }
}
@media (max-width: 760px) { .chart-grid { grid-template-columns: minmax(0, 1fr); } }
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .5rem 1rem; margin-bottom: .8rem; }
.chart-head h2 { margin: 0 0 .1rem; }
.legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .82rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; vertical-align: -1px; }
.sw.s1 { background: var(--series-1); } .sw.s2 { background: var(--series-2); }
.chart-box { position: relative; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .base { stroke: var(--field); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: lining-nums tabular-nums; }
@media (max-width: 600px) { .chart .tick { font-size: 19px; } }
.chart path.s1 { fill: var(--series-1); } .chart path.s2 { fill: var(--series-2); }
.chart .hit { fill: transparent; }
.chart .col-grp.hover .hit { fill: rgba(14, 74, 64, .07); }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: .9rem; }
.chart-empty-inline { padding: 1.5rem 0; text-align: center; font-size: .9rem; }

.exp-hero { display: flex; align-items: center; gap: .8rem; margin-bottom: .9rem; }
.exp-num { font-size: 2.1rem; font-weight: 800; line-height: 1; color: var(--text); font-variant-numeric: lining-nums tabular-nums; }
.text { color: var(--text); }
.seg { display: flex; gap: 2px; height: 22px; margin-bottom: .9rem; }
.seg-part { min-width: 4px; flex-basis: 0; transition: filter .15s; }
.seg-part:first-child { border-radius: 6px 0 0 6px; } .seg-part:last-child { border-radius: 0 6px 6px 0; }
.seg-part:only-child { border-radius: 6px; }
.seg-part.hover { filter: brightness(.88); }
.st-expired { background: var(--st-expired); } .st-critical { background: var(--st-critical); }
.st-warning { background: var(--st-warning); } .st-good { background: var(--st-good); } .st-no_expiry { background: var(--st-none); }
.seg-legend { list-style: none; margin: 0; padding: 0; }
.seg-legend a { display: grid; grid-template-columns: 10px 1fr auto 2.6rem; align-items: center; gap: .55rem; padding: .32rem .25rem; color: var(--text); border-radius: 6px; font-size: .88rem; }
.seg-legend a:hover { background: var(--bg); text-decoration: none; }
.seg-legend .pct { text-align: right; font-size: .8rem; }

.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.hbars li { display: grid; grid-template-columns: minmax(6rem, 38%) 1fr 3.4rem; align-items: center; gap: .6rem; font-size: .88rem; cursor: default; }
.hbars .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbars .track { height: 12px; background: var(--track); border-radius: 0 4px 4px 0; }
.hbars .bar { display: block; height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; transition: filter .15s; }
.hbars li.hover .bar { filter: brightness(1.2); }

.chart-tip {
  position: fixed; z-index: 100; pointer-events: none; display: none; max-width: 260px;
  background: var(--forest-deep); color: #f2f7f4; padding: .5rem .65rem; border-radius: 8px; font-size: .8rem; line-height: 1.5;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .25); font-variant-numeric: lining-nums tabular-nums;
}
.chart-tip .muted { color: #8aa39b; }
@media print { .chart-grid, .chart-tip { display: none !important; } }
.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .6rem 1.2rem; }
.dl div > span { display: block; font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }

.badge { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warning { background: var(--warn-bg); color: var(--warn); }
.b-critical { background: var(--crit-bg); color: var(--crit); }
.b-expired, .b-void { background: var(--bad-bg); color: var(--bad); }
.b-depleted, .b-none { background: #e3ebe7; color: #4b5f59; }
.b-info, .b-dispatched { background: var(--info-bg); color: var(--forest-lit); }
.b-delivered { background: var(--ok-bg); color: var(--ok); }
.alert-box { border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.alert-box.bad { background: var(--bad-bg); border-color: #fca5a5; color: #7f1d1d; }
.alert-box.warn { background: var(--warn-bg); border-color: #fcd34d; color: #78350f; }
.alert-box.info { background: var(--info-bg); border-color: #7dd3fc; color: #0c4a6e; }

.tabs { display: flex; gap: .35rem; overflow-x: auto; margin-bottom: 1rem; border-bottom: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
.tabs button { border: none; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: .6rem .8rem; color: var(--muted); font-weight: 600; }
.tabs button.active { color: var(--brand-2); border-bottom-color: var(--brand-2); }
.tabs .count { background: #e2e8f0; color: #2b4a43; border-radius: 999px; padding: 0 .45rem; font-size: .75rem; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #f3f8f5; position: sticky; top: 0; }
table.data tbody tr:hover { background: #f3f8f5; }
table.data tr.clickable { cursor: pointer; }
table.data tfoot td { font-weight: 700; background: #f3f8f5; }
table.data td.num, table.data th.num { text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }

@media (max-width: 700px) {
  table.data.stack thead { display: none; }
  table.data.stack, table.data.stack tbody, table.data.stack tr, table.data.stack td, table.data.stack tfoot { display: block; width: 100%; }
  table.data.stack tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: .7rem; padding: .35rem .2rem; background: #fff; }
  table.data.stack td { border: none; display: flex; justify-content: space-between; gap: 1rem; padding: .3rem .7rem; text-align: right; }
  table.data.stack td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-align: left; font-size: .8rem; flex: 0 0 auto; }
  table.data.stack td.num { white-space: normal; }
  table.data.stack td[data-label=""]::before { content: none; }
  table.data.stack tfoot tr { background: #f3f8f5; }
}

/* ---------- line editor (stock in / transfer / write-off) ---------- */
.lines { display: flex; flex-direction: column; gap: .7rem; }
.line {
  display: grid; gap: .6rem; align-items: end; padding: .8rem; border: 1px solid var(--line); border-radius: 10px; background: #f7fbf9;
  grid-template-columns: var(--cols);
}
.line .field { margin: 0; min-width: 0; }
.line .line-no { font-weight: 700; color: var(--muted); align-self: center; }
.line .info { font-size: .8rem; color: var(--muted); grid-column: 1 / -1; margin-top: -.2rem; }
.line .rm { align-self: end; }
@media (max-width: 900px) {
  .line { grid-template-columns: 1fr 1fr !important; }
  .line .wide { grid-column: 1 / -1; }
  .line .line-no { grid-column: 1 / 2; }
  .line .rm { grid-column: 2 / 3; justify-self: end; grid-row: 1; }
}
.totals-bar { display: flex; justify-content: flex-end; gap: 1.5rem; flex-wrap: wrap; padding: .8rem 0 0; font-weight: 600; }

/* ---------- modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; max-height: calc(100vh - 2rem); overflow: auto; padding: 1.2rem; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.modal h2 { margin-bottom: 1rem; }
@media (max-width: 600px) {
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal { border-radius: 14px 14px 0 0; max-height: 92vh; }
}
#toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 200; display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, calc(100vw - 2rem)); }
.toast { background: var(--forest-deep); color: #fff; padding: .7rem 1rem; border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); font-size: .9rem; }
.toast.error { background: var(--bad); }
.toast.success { background: var(--ok); }
.toast.warn { background: #b45309; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: clamp(2rem, 6vw, 6rem); padding: 2rem 1.25rem;
  background: radial-gradient(900px 520px at 8% 12%, rgba(200, 16, 46, .22), transparent 60%), radial-gradient(700px 500px at 95% 95%, rgba(47, 93, 58, .6), transparent 60%), linear-gradient(160deg, #1f120a 0%, var(--brand) 45%, #6b3a1c 100%); }
.auth-wrap.wide { align-items: flex-start; }
.auth-brand { color: #fff; flex: 1 1 340px; max-width: 470px; }
.auth-wrap.wide .auth-brand { position: sticky; top: 3rem; }
.ab-logo { display: flex; align-items: center; gap: .75rem; font-size: 1.7rem; font-weight: 800; letter-spacing: -.01em; }
.ab-logo img { width: 50px; height: 50px; }
.auth-brand h1 { font-size: clamp(1.9rem, 3.2vw, 2.7rem); line-height: 1.12; margin: 1.8rem 0 .9rem; letter-spacing: -.02em; }
.auth-brand h1 em { font-style: normal; color: #f2c46d; display: block; }
.ab-lead { color: #cfe0ee; font-size: 1.05rem; margin: 0 0 1.5rem; max-width: 40ch; }
.ab-points { list-style: none; padding: 0; margin: 0 0 2.2rem; display: grid; gap: .7rem; }
.ab-points li { display: flex; gap: .65rem; align-items: center; color: #e6f0f7; }
.ab-points li::before { content: "\2713"; flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: rgba(255, 255, 255, .13); color: #fbbf24; display: grid; place-items: center; font-size: .8rem; font-weight: 700; }
.ab-by { display: flex; align-items: center; gap: .65rem; padding-top: 1.25rem; border-top: 1px solid rgba(255, 255, 255, .18); color: #cfe0ee; font-size: .9rem; }
.ab-by img { width: 32px; height: 32px; flex: none; }
.ab-by strong { color: #fff; }
.auth-main { flex: 0 1 400px; width: 100%; display: flex; justify-content: center; }
.auth-wrap.wide .auth-main { flex-basis: 680px; }
.auth-sub { margin: -.2rem 0 1.1rem; }
@media (max-width: 900px) {
  .auth-wrap, .auth-wrap.wide { flex-direction: column; align-items: center; justify-content: flex-start; gap: 1.1rem; padding-top: 1.5rem; }
  .auth-brand, .auth-wrap.wide .auth-brand { position: static; flex: none; width: 100%; max-width: 400px; }
  .auth-wrap.wide .auth-brand { max-width: 680px; }
  .auth-brand h1, .ab-lead, .ab-points { display: none; }
  .ab-logo { font-size: 1.35rem; }
  .ab-logo img { width: 40px; height: 40px; }
  .ab-by { border-top: 0; padding-top: .35rem; font-size: .82rem; }
  .ab-by img { width: 24px; height: 24px; }
  .auth-main, .auth-wrap.wide .auth-main { flex: none; }
}
.auth { background: #fff; border-radius: 14px; padding: 1.6rem; width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.auth .logo { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.2rem; }
.auth .logo img { width: 42px; }
.auth button.primary { width: 100%; margin-top: .4rem; }
.err { color: var(--bad); font-size: .88rem; min-height: 1.2em; margin: .3rem 0; }

.loading { padding: 3rem; text-align: center; color: var(--muted); }

/* ---------- print ---------- */
#print-root { display: none; }
.doc { font-family: "IBM Plex Sans", "Segoe UI", Arial, sans-serif; color: #000; font-size: 12px; padding: 0; }
.doc .doc-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 12px; gap: 16px; }
.doc .co { font-size: 18px; font-weight: 700; }
.doc .doc-title { font-size: 18px; font-weight: 700; text-align: right; text-transform: uppercase; }
.doc .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; margin-bottom: 12px; }
.doc .meta div span { font-weight: 600; display: inline-block; min-width: 110px; }
.doc table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.doc th, .doc td { border: 1px solid #555; padding: 4px 6px; text-align: left; vertical-align: top; }
.doc th { background: #e5e7eb; font-size: 11px; text-transform: uppercase; }
.doc td.num, .doc th.num { text-align: right; }
.doc tfoot td { font-weight: 700; }
.doc .sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 40px; }
.doc .sign div { border-top: 1px solid #000; padding-top: 4px; font-size: 11px; }
.doc .foot { margin-top: 16px; font-size: 10px; color: #444; }
.doc .stamp { border: 2px solid #b91c1c; color: #b91c1c; display: inline-block; padding: 2px 10px; font-weight: 700; transform: rotate(-4deg); }

@media print {
  @page { margin: 12mm; }
  body { background: #fff; }
  #app, #toasts, .modal-bg { display: none !important; }
  #print-root { display: block; }
}

/* ---------- multi-tenant: auth, warehouse switcher, subscription ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.auth.wide { max-width: 680px; }
.auth h3.form-sec { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.1rem 0 .5rem; }
.auth-alt { text-align: center; margin: 1rem 0 0; font-size: .9rem; color: var(--muted); }
.ok-text { color: var(--ok) !important; } .bad-text { color: var(--bad) !important; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .6rem; margin-bottom: .6rem; }
.plan-card { display: flex; flex-direction: column; gap: .15rem; border: 1.5px solid var(--line); border-radius: 10px; padding: .7rem .8rem; cursor: pointer; position: relative; }
.plan-card input { position: absolute; opacity: 0; pointer-events: none; }
.plan-card:has(input:checked) { border-color: var(--brand-2); background: var(--info-bg); box-shadow: 0 0 0 2px rgba(19, 105, 90, .15); }
.plan-card:has(input:focus-visible) { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.plan-name { font-weight: 700; }
.plan-price { font-size: 1.05rem; font-weight: 650; font-variant-numeric: lining-nums tabular-nums; }
.plan-price small { font-weight: 400; color: var(--muted); font-size: .75rem; }
.plan-card:has(input:disabled) { cursor: default; }

.wh-switch { flex: 0 1 auto; min-width: 0; }
.wh-switch select { max-width: 230px; padding: .4rem 2rem .4rem .6rem; font-weight: 600; border-color: var(--brand-2); background-color: var(--info-bg); color: var(--brand); }
.wh-fixed { font-size: .88rem; font-weight: 600; color: var(--brand); background: var(--info-bg); padding: .35rem .6rem; border-radius: 8px; white-space: nowrap; }
@media (max-width: 600px) {
  .wh-switch select { max-width: 150px; font-size: .85rem; }
  .wh-fixed { max-width: 140px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }
}
.wh-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .7rem; }
.wh-pick button { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; text-align: left; padding: .9rem 1rem; height: auto; }
.wh-pick button:hover { border-color: var(--brand-2); background: var(--info-bg); }

.sub-banner { padding: .55rem 1.25rem; font-size: .9rem; border-bottom: 1px solid; }
.sub-banner.info { background: var(--info-bg); border-color: #7dd3fc; color: #0c4a6e; }
.sub-banner.warn { background: var(--warn-bg); border-color: #fcd34d; color: #78350f; }
.sub-banner.bad { background: var(--bad-bg); border-color: #fca5a5; color: #7f1d1d; }
@media print { .sub-banner, .wh-switch { display: none !important; } }
/* platform console uses a darker, neutral sidebar so it is never confused with a company's app */
.platform .sidebar { background: linear-gradient(180deg, #4a2a17, #2e1a0e); }
.platform-auth { background: linear-gradient(160deg, #2e1a0e 0%, #6b3418 100%); }
.chart-grid > .chart-panel.full { grid-column: 1 / -1; }

/* ---------- searchable dropdowns (select.js) ---------- */
select.ss-native { display: none !important; }
.ss-btn {
  font: inherit; width: 100%; min-height: 42px; padding: .55rem 2.1rem .55rem .7rem; border: 1px solid var(--field); border-radius: 8px;
  background: #fff; color: var(--text); text-align: left; display: flex; align-items: center; position: relative; cursor: pointer; font-weight: 400;
}
.ss-btn:hover { border-color: #8aa39b; background: #fff; }
.ss-btn:focus-visible, .ss-btn.ss-open { outline: 2px solid rgba(19, 105, 90, .35); border-color: var(--brand-2); }
.ss-btn:disabled { background: #e6f1ec; color: var(--muted); cursor: not-allowed; opacity: 1; }
.ss-btn.ss-placeholder .ss-label { color: var(--muted); }
.ss-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.ss-caret { position: absolute; right: .8rem; top: 50%; width: 8px; height: 8px; margin-top: -6px; border-right: 2px solid #587069; border-bottom: 2px solid #587069; transform: rotate(45deg); transition: transform .15s; }
.ss-btn.ss-open .ss-caret { transform: rotate(-135deg); margin-top: -2px; }
.ss-pop { position: fixed; z-index: 300; background: #fff; border: 1px solid var(--field); border-radius: 10px; box-shadow: 0 14px 40px rgba(15, 23, 42, .22); display: flex; flex-direction: column; overflow: hidden; }
.ss-search { padding: .5rem; border-bottom: 1px solid var(--line, #e2e8f0); }
.ss-search input { min-height: 36px; padding: .4rem .6rem; font-size: .92rem; }
.ss-list { list-style: none; margin: 0; padding: .3rem; overflow-y: auto; flex: 1; outline: none; }
.ss-opt { padding: .5rem .65rem; border-radius: 6px; cursor: pointer; font-size: .93rem; line-height: 1.3; }
.ss-opt.ss-active { background: #e2f0ea; }
.ss-opt.ss-cur { font-weight: 600; color: var(--brand); }
.ss-opt.ss-cur::after { content: "\2713"; float: right; margin-left: .5rem; }
.ss-opt.ss-dis { color: #8aa39b; cursor: not-allowed; }
.ss-group { padding: .55rem .65rem .25rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ss-empty { padding: .7rem .65rem; color: var(--muted); font-size: .9rem; }
.wh-switch .ss-btn { max-width: 230px; min-height: 0; padding: .4rem 2rem .4rem .6rem; font-weight: 600; border-color: var(--brand-2); background: var(--info-bg); color: var(--brand); }
@media (max-width: 600px) { .wh-switch .ss-btn { max-width: 150px; font-size: .85rem; } }
@media print { .ss-pop { display: none; } }

/* pick-or-add fields (item category / unit) */
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.label-row label { margin-bottom: .3rem; }
button.link-add { background: none; border: 0; padding: 0; min-height: 0; color: var(--brand-2); font-size: .8rem; font-weight: 600; cursor: pointer; }
button.link-add:hover { background: none; text-decoration: underline; }
.add-inline { display: flex; gap: .4rem; margin-top: .45rem; }
.add-inline input { min-height: 36px; padding: .4rem .6rem; }
.add-inline.hidden { display: none; }

/* scanning, stock count, labels */
.panel-head-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .6rem; }
.panel-head-row h2 { margin: 0; }
.scan-box { display: flex; align-items: center; gap: .4rem; flex: 0 1 360px; min-width: 220px; position: relative; }
.scan-box input { padding-left: 2rem; min-height: 38px; }
.scan-ico { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1rem; pointer-events: none; }
.count-table input { min-height: 36px; padding: .35rem .5rem; }
.count-table input.cnt { max-width: 120px; text-align: right; margin-left: auto; display: block; }
.count-table tr.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { background: #fef3c7; } 100% { background: transparent; } }
strong.neg, .neg { color: var(--bad, #b91c1c); }
strong.pos { color: #15803d; }
.ok-msg { color: #15803d; font-size: .9rem; margin: .3rem 0; }
video.cam { width: 100%; max-height: 60vh; background: #000; border-radius: 10px; }
.alert-box.info { background: var(--info-bg, #e2f0ea); border: 1px solid #bcd6ea; color: var(--brand); }
.labels { display: none; }
@media print {
  @page { margin: 10mm; }
  #print-root .labels { display: grid; grid-template-columns: repeat(3, 63.5mm); grid-auto-rows: 38.1mm; gap: 0 2.5mm; }
  .label { box-sizing: border-box; padding: 2mm 3mm; overflow: hidden; break-inside: avoid; font-family: Arial, sans-serif; color: #000; display: flex; flex-direction: column; }
  .label .lb-co { font-size: 6.5pt; color: #444; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .label .lb-item { font-size: 9pt; font-weight: 700; line-height: 1.15; max-height: 2.3em; overflow: hidden; }
  .label .lb-meta { font-size: 7pt; line-height: 1.25; }
  .label svg.bc { width: 100%; height: 12mm; margin-top: auto; }
}

/* ---------------------------------------------------------------- CoffeeTrail (coffee) */
.buy-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 1rem; align-items: start; }
.buy-grid > .panel { margin-bottom: 0; }
@media (max-width: 980px) { .buy-grid { grid-template-columns: minmax(0, 1fr); } }
.calc { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem 1.2rem; background: var(--cream); border: 1px solid #e6d8bb;
  border-radius: var(--radius); padding: .8rem 1rem; margin: .8rem 0; }
.calc > div > span { display: block; font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.calc .big { font-size: 1.25rem; font-weight: 700; color: var(--brand); }
.calc .bad-note { grid-column: 1 / -1; color: var(--bad); font-weight: 600; }
.gps-row { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-top: .4rem; }
.qty-in { width: 7.5rem; text-align: right; }
.tree, .tree ul { list-style: none; margin: 0; padding-left: 1.1rem; }
.tree { padding-left: 0; }
.tree ul { border-left: 2px solid var(--line); margin-left: .45rem; }
.tree li { margin: .45rem 0; }
.tree .tnode { padding: .35rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* cupping score sheet: narrow score boxes so all ten attributes fit */
.cup-table th, .cup-table td { padding: .35rem .3rem; }
.cup-table th { font-size: .7rem; white-space: normal; min-width: 3.6rem; }
.cup-table input.qty-in { width: 3.6rem; min-width: 0; padding: .3rem; text-align: right; }
.cup-table select { min-width: 11rem; max-width: 15rem; }
.cup-table [data-k=sample_code] { width: 3rem; }
.cup-table [data-k=cupper] { width: 7rem; }
.cup-table [data-k=descriptors] { min-width: 9rem; }


/* ================================================================== CoffeeTrail theme
   Forest green and roast copper on a mint wash; Alegreya Sans for work, Alegreya serif for page titles.
   The solid figure tiles are the one bold element; everything else stays quiet. */
@font-face { font-family: "Alegreya Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/alegreya-sans-400.woff2) format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url(fonts/alegreya-sans-500.woff2) format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/alegreya-sans-700.woff2) format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-weight: 800; font-style: normal; font-display: swap; src: url(fonts/alegreya-sans-800.woff2) format("woff2"); }
@font-face { font-family: "Alegreya"; font-weight: 500; font-style: normal; font-display: swap; src: url(fonts/alegreya-500.woff2) format("woff2"); }
@font-face { font-family: "Alegreya"; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/alegreya-700.woff2) format("woff2"); }

/* type scale (1.25): 16 / 20 / 25 / 31 */
h1 { font-family: var(--serif); font-weight: 700; font-size: 1.95rem; line-height: 1.15; color: var(--forest-deep); letter-spacing: -.005em; }
h2 { font-size: 1.25rem; font-weight: 700; color: var(--forest-deep); }
h3 { font-size: 1.05rem; font-weight: 700; color: var(--forest-deep); }
.page-head { margin-bottom: 1.25rem; }
.small { font-size: .88rem; }
a { color: var(--forest-lit); font-weight: 500; }
:focus-visible { outline: 3px solid rgba(164, 89, 42, .55); outline-offset: 2px; }

/* sidebar: deep forest, the active page sits on a cream tab */
.sidebar { background: linear-gradient(180deg, var(--forest) 0%, var(--forest-deep) 100%); color: #d9ebe4; }
.brand { font-family: var(--serif); font-size: 1.35rem; letter-spacing: .005em; padding: 1.1rem 1.1rem .9rem; }
.brand small { font-family: var(--sans); font-size: .8rem; letter-spacing: 0; }
.nav .sec { text-transform: none; letter-spacing: 0; font-size: .82rem; font-weight: 700; color: #8fbcae; padding: 1.1rem .8rem .3rem; }
.nav a { border-radius: 999px; padding: .5rem .85rem; font-size: 1rem; }
.nav a:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }
.nav a.active { background: var(--cream); color: var(--forest-deep); font-weight: 700; }
.nav .pill { background: var(--copper); }
.sidebar-foot { border-top-color: rgba(255, 255, 255, .12); }
.sidebar button { border-radius: 999px; }

/* top bar: cream, like a paper sack label */
.topbar { background: var(--cream); border-bottom: 1px solid #e6dcc4; min-height: 60px; }
.topbar .title { font-weight: 700; color: var(--forest-deep); }
.sub-banner.info { background: #e6f1ec; border-color: var(--line); color: var(--forest-deep); }

/* buttons: pills */
button, .btn { border-radius: 999px; padding: .5rem 1.1rem; font-weight: 600; border-color: var(--field); color: var(--forest-deep); }
button:hover, .btn:hover { background: #e6f1ec; }
button.primary, .btn.primary { background: var(--forest); border-color: var(--forest); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--forest-deep); }
button.danger, .btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.danger:hover, .btn.danger:hover { background: #7f2416; }
button.ghost { color: var(--muted); }
button.sm, .btn.sm { padding: .28rem .75rem; }
button.icon { padding: .4rem .6rem; }
.tabs button { border-radius: 0; }
.tabs button.active { color: var(--forest); border-bottom-color: var(--copper); }

/* fields */
label { font-size: .9rem; font-weight: 700; color: #2b4a43; }
input, select, textarea { border-color: var(--field); border-radius: 10px; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(19, 105, 90, .22); border-color: var(--forest-lit); }
.ss-btn { border-radius: 10px; }
.ss-pop { border-radius: 12px; border-color: var(--field); box-shadow: 0 16px 40px rgba(10, 53, 46, .2); }
.ss-group { text-transform: none; letter-spacing: 0; font-size: .82rem; }
.field .hint { font-size: .84rem; }

/* store switcher: a dark pill, like the currency toggle */
.wh-switch .ss-btn, .wh-switch select { background: var(--forest); color: #fff; border-color: var(--forest); border-radius: 999px; }
.wh-switch .ss-btn:hover { background: var(--forest-deep); }
.wh-switch .ss-caret { border-color: #fff; }
.wh-fixed { background: var(--forest); color: #fff; border-radius: 999px; padding: .35rem .85rem; }

/* panels: white sheets with a thin mint edge, no drop shadows */
.panel { border-color: var(--line); border-radius: var(--radius); box-shadow: none; padding: 1.2rem 1.3rem; }
.panel > h2:first-child, .panel-head-row h2 { font-size: 1.2rem; }
.dl div > span { text-transform: none; letter-spacing: 0; font-size: .84rem; font-weight: 700; }
.calc > div > span { text-transform: none; letter-spacing: 0; font-size: .84rem; }
.calc .big { font-size: 1.45rem; font-weight: 800; color: var(--forest); }

/* figure tiles: solid forest; copper where something needs attention */
.kpis { gap: .9rem; }
.kpi {
  position: relative; overflow: hidden; border: 0; border-radius: 12px; padding: 1rem 1.15rem 1.1rem; min-height: 108px; color: #fff;
  background:
    radial-gradient(circle at 112% -18%, rgba(255, 255, 255, .11) 0 36%, transparent 37%),
    linear-gradient(155deg, var(--forest-lit) 0%, var(--forest) 55%, #0b3d35 100%);
}
.kpi.ok, .kpi.info, .kpi.bad, .kpi.crit, .kpi.warn { border-left: 0; }
.kpi.warn, .kpi.crit {
  background:
    radial-gradient(circle at 112% -18%, rgba(255, 255, 255, .12) 0 36%, transparent 37%),
    linear-gradient(155deg, #b0652f 0%, #8a4721 55%, var(--copper-deep) 100%);
}
.kpi.bad {
  background:
    radial-gradient(circle at 112% -18%, rgba(255, 255, 255, .1) 0 36%, transparent 37%),
    linear-gradient(155deg, #a63a22 0%, #842a17 55%, #5e1d10 100%);
}
.kpi .label { color: rgba(255, 255, 255, .88); font-size: .92rem; font-weight: 700; }
.kpi .value { color: #fff; font-size: clamp(1.35rem, .85rem + 1vw, 1.95rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 800; line-height: 1.15; margin-top: .3rem; letter-spacing: -.01em; font-variant-numeric: lining-nums tabular-nums; }
.kpi .sub { color: rgba(255, 255, 255, .78); font-size: .88rem; margin-top: .2rem; }
.kpi .sub a, .kpi a { color: #fff; }
a.kpi:hover { text-decoration: none; filter: brightness(1.07); }
a.kpi:focus-visible { outline: 3px solid var(--copper); outline-offset: 3px; }

/* tables: sentence-case headers, mint rules */
table.data { font-size: .95rem; font-variant-numeric: lining-nums tabular-nums; }
table.data th { text-transform: none; letter-spacing: 0; font-size: .84rem; font-weight: 700; color: #45605a; background: #f3f8f5; }
table.data th, table.data td { border-bottom-color: #e2eee8; }
table.data tbody tr:hover { background: #f3f8f5; }
table.data tfoot td { background: #eef5f1; color: var(--forest-deep); }
@media (max-width: 700px) { table.data.stack tr { border-radius: 12px; } }

/* badges and alerts */
.badge { font-size: .8rem; padding: .1rem .55rem; }
.b-info, .b-dispatched { background: var(--info-bg); color: var(--forest-lit); }
.alert-box { border-radius: 12px; }
.alert-box.info { background: #e6f1ec; border-color: var(--line); color: var(--forest-deep); }

/* line editors, modal, toasts */
.line { border-radius: 12px; border-color: var(--line); }
.modal { border-radius: 18px; padding: 1.4rem 1.5rem; }
.modal h2 { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; }
.modal-bg { background: rgba(10, 53, 46, .5); }
.toast { border-radius: 12px; font-size: .95rem; }
.toast.success { background: var(--forest); }
.tree .tnode { border-radius: 10px; }
.chart .tick { font-family: var(--sans); font-size: 12px; }
.hbars .bar, .hbars .track { border-radius: 0 6px 6px 0; }

/* sign-in */
.auth-wrap {
  background:
    radial-gradient(760px 520px at 96% 104%, rgba(164, 89, 42, .62), transparent 62%),
    radial-gradient(620px 420px at 0% 0%, rgba(19, 105, 90, .55), transparent 60%),
    linear-gradient(160deg, var(--forest-deep) 0%, var(--forest) 60%, #0f5a4d 100%);
}
.ab-logo { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; }
.auth-brand h1 { font-family: var(--serif); color: var(--cream); font-size: clamp(2.1rem, 3.4vw, 3rem); line-height: 1.08; letter-spacing: -.01em; }
.ab-lead { color: #cfe5dc; font-size: 1.12rem; }
.ab-points li { color: #e4f1ec; font-size: 1.02rem; }
.ab-points li::before { background: rgba(247, 240, 225, .14); color: #efb98c; }
.ab-by { color: #cfe5dc; }
.auth { border-radius: 20px; padding: 1.8rem; box-shadow: 0 24px 60px rgba(5, 30, 26, .35); }
.auth h2 { font-family: var(--serif); font-size: 1.6rem; }
.auth h3.form-sec { text-transform: none; letter-spacing: 0; font-size: .95rem; color: var(--forest-deep); }
.plan-card { border-radius: 12px; }
.plan-card:has(input:checked) { border-color: var(--forest-lit); background: var(--info-bg); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (max-width: 600px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .kpi { min-height: 0; padding: .8rem .85rem .9rem; }
  .kpi .value { font-size: 1.3rem; white-space: normal; overflow-wrap: anywhere; }
  .kpi .label { font-size: .85rem; }
  .kpi .sub { font-size: .8rem; }
  h1 { font-size: 1.65rem; }
}

/* ================================================================== typography pass
   Alegreya Sans has a small x-height, so the whole scale moves up a step (16 → 17px).
   The serif carries every heading and every big figure, like a trader's ledger;
   Alegreya Sans SC (true small caps) marks labels, italic serif marks notes. */
@font-face { font-family: "Alegreya"; font-weight: 400; font-style: italic; font-display: swap; src: url(fonts/alegreya-400-italic.woff2) format("woff2"); }
@font-face { font-family: "Alegreya"; font-weight: 800; font-style: normal; font-display: swap; src: url(fonts/alegreya-800.woff2) format("woff2"); }
@font-face { font-family: "Alegreya Sans SC"; font-weight: 500; font-style: normal; font-display: swap; src: url(fonts/alegreya-sans-sc-500.woff2) format("woff2"); }
@font-face { font-family: "Alegreya Sans SC"; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/alegreya-sans-sc-700.woff2) format("woff2"); }
:root { --caps: "Alegreya Sans SC", "Alegreya Sans", "Segoe UI", system-ui, sans-serif; }

html { font-size: 106.25%; }
body { text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; font-kerning: normal; }

/* headings: serif throughout, a clear 1.25 step between levels */
h1 { font-size: 2.15rem; font-weight: 800; letter-spacing: -.01em; }
h2, .panel > h2:first-child, .panel-head-row h2 { font-family: var(--serif); font-weight: 700; font-size: 1.35rem; letter-spacing: -.003em; line-height: 1.2; }
h3, h3.form-sec { font-family: var(--serif); font-weight: 700; font-size: 1.12rem; }
.topbar .title { font-family: var(--serif); font-size: 1.12rem; }
.brand { font-weight: 800; font-size: 1.4rem; line-height: 1.1; }

/* notes and captions: italic serif, so they read as annotation rather than data */
.page-head h1 + .muted, .chart-head .muted, .panel > h2 + .muted, .panel-head-row + .muted {
  font-family: var(--serif); font-style: italic; font-weight: 400; font-size: .98rem; color: var(--muted);
}

/* column and section labels: true small caps with a little air (tile and field labels stay in sentence case) */
.nav .sec, table.data th, .dl div > span, .ss-group {
  font-family: var(--caps); letter-spacing: .035em;
}
.nav .sec { font-size: .95rem; font-weight: 700; color: #9cc8ba; }
table.data th { font-size: .9rem; font-weight: 700; color: #3f5d56; }
.kpi .label { font-size: 1rem; font-weight: 700; letter-spacing: .005em; }
label:not(.check):not(.plan-card) { font-size: .95rem; font-weight: 700; }
.dl div > span { font-size: .9rem; font-weight: 500; }

/* figures: heavy serif numerals, lining and tabular so columns line up */
.kpi .value, .calc .big, .plan-price {
  font-family: var(--serif); font-weight: 800; letter-spacing: -.01em; font-variant-numeric: lining-nums tabular-nums;
}
.kpi .value { font-size: clamp(1.45rem, .9rem + 1.05vw, 2.05rem); }
.plan-price small { font-family: var(--sans); font-weight: 500; }

/* body text: one step heavier where it is small, so it does not look faint */
.small, .kpi .sub, .field .hint, .badge, .toast { font-weight: 500; }
.nav a { font-weight: 500; font-size: 1.02rem; }
.nav a.active { font-weight: 700; }
table.data td { font-size: .97rem; }
button, .btn { font-weight: 700; letter-spacing: .01em; }

@media (max-width: 600px) {
  h1 { font-size: 1.8rem; }
  .kpi .value { font-size: 1.35rem; }
  .topbar .title { font-size: 1rem; }
}

/* ================================================================== line icons (icons.js)
   One stroke weight, drawn in the text colour, sized to the text they sit in. */
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav .ico { display: inline-flex; align-items: center; justify-content: center; width: 22px; margin-right: .15rem; opacity: .9; }
.nav .ico .ic { width: 19px; height: 19px; vertical-align: 0; }
.nav a.active .ico { opacity: 1; color: var(--copper); }

/* ================================================================== dashboard
   (chart colours are declared on :root so every chart can use them) */
:root { --series-1: #13695a; --series-2: #a4592a; --bar: #13695a; --track: #e3eee9; }
/*   One forest band for the month, light working cards under it, then charts and lists on a six-column grid. */
.dash-band {
  background: linear-gradient(160deg, var(--forest) 0%, var(--forest-deep) 100%); color: var(--cream);
  border-radius: 16px; padding: 1.15rem 1.4rem 1.25rem; margin-bottom: 1rem;
}
.band-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; margin-bottom: .9rem; }
.band-head h2 { margin: 0; color: var(--cream); font-size: 1.3rem; }
.band-head span { font-family: var(--serif); font-style: italic; color: #a9cfc2; font-size: .98rem; }
.band-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.band-figs .fig { display: flex; flex-direction: column; gap: .15rem; padding: .2rem 1.2rem; color: inherit; border-left: 1px solid rgba(247, 240, 225, .16); min-width: 0; }
.band-figs .fig:first-child { padding-left: 0; border-left: 0; }
.band-figs .fig:hover { text-decoration: none; }
.band-figs .fig:hover .fig-v { color: #fff; }
.fig-l { font-weight: 500; font-size: .98rem; color: #bfded3; }
.fig-v { font-family: var(--serif); font-weight: 800; font-size: clamp(1.4rem, .9rem + 1.1vw, 2.05rem); line-height: 1.15; letter-spacing: -.01em;
  font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-band .chg { font-size: .9rem; color: #bfded3; }
.dash-band .chg b { color: var(--cream); font-weight: 700; }
.dash-band .chg.down b { color: #f0c3a0; }

.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; margin-bottom: 1rem; }
.stat { display: flex; flex-direction: column; gap: .2rem; background: var(--panel, #fff); border: 1px solid var(--line); border-radius: 14px;
  padding: .95rem 1.1rem 1rem; color: var(--text); min-width: 0; position: relative; }
.stat:hover { text-decoration: none; border-color: var(--field); }
.stat.attn::before { content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--copper); }
.stat-l { font-weight: 700; font-size: .97rem; color: #3f5d56; }
.stat-v { font-family: var(--serif); font-weight: 800; font-size: 1.6rem; line-height: 1.15; color: var(--forest-deep);
  font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.attn .stat-v { color: var(--copper-deep); }
.stat-v small { font-family: var(--sans); font-weight: 500; font-size: .95rem; color: var(--muted); }
.stat-s { font-size: .9rem; font-weight: 500; color: var(--muted); }
.meter { height: 6px; border-radius: 6px; background: #e2eee8; overflow: hidden; margin: .25rem 0 .15rem; }
.meter span { display: block; height: 100%; background: var(--forest-lit); border-radius: 6px; }
.stat.attn .meter span { background: var(--copper); }

.dash-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.dash-grid > .panel { grid-column: span 3; margin: 0; min-width: 0; }
.dash-grid > .dash-chart:first-child { grid-column: span 4; }
.dash-grid > .dash-chart:nth-child(2) { grid-column: span 2; }
.panel-head-row { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; margin-bottom: .7rem; }
.panel-head-row h2 { margin: 0; }
.head-fig { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; color: var(--forest-deep); font-variant-numeric: lining-nums tabular-nums; }

.seg-toggle { display: inline-flex; border: 1px solid var(--field); border-radius: 999px; padding: 2px; background: #f3f8f5; }
.seg-toggle button { border: 0; background: transparent; padding: .3rem .85rem; font-size: .9rem; font-weight: 700; color: var(--muted); border-radius: 999px; }
.seg-toggle button:hover { background: transparent; color: var(--forest-deep); }
.seg-toggle button[aria-pressed="true"] { background: var(--forest); color: #fff; }
.legend { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; font-size: .9rem; font-weight: 500; color: var(--muted); margin: -.2rem 0 .4rem; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; }
.legend .ln { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--copper); }
.chart .avg-line { fill: none; stroke: var(--copper); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.chart .price-line { fill: none; stroke: var(--forest); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .price-area { fill: rgba(19, 105, 90, .09); }
.chart .dot { fill: var(--forest); stroke: #fff; stroke-width: 2; transition: r .12s; }
.chart .pt.hover .dot { r: 6.5; fill: var(--copper); }
.chart .pt .hit { fill: transparent; }
.price-now { display: flex; align-items: baseline; gap: .5rem; margin: -.2rem 0 .3rem; }
.price-now .fig-v { font-size: 1.55rem; color: var(--forest-deep); }

.rank { list-style: none; margin: 0; padding: 0; }
.rank li + li { border-top: 1px solid #e2eee8; }
.rank a { display: grid; gap: .3rem; padding: .6rem 0; color: var(--text); }
.rank a:hover { text-decoration: none; }
.rank a:hover .rank-track span { background: var(--forest-lit); }
.rank-top { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.rank-l { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-v { font-family: var(--serif); font-weight: 700; color: var(--forest-deep); white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.rank-track { height: 6px; border-radius: 6px; background: #e2eee8; overflow: hidden; }
.rank-track span { display: block; height: 100%; background: var(--forest); border-radius: 6px; }
.rank-s { font-size: .88rem; font-weight: 500; color: var(--muted); }

@media (max-width: 1100px) {
  .dash-grid > .panel, .dash-grid > .dash-chart:first-child, .dash-grid > .dash-chart:nth-child(2) { grid-column: span 6; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .band-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 1rem; }
  .band-figs .fig:nth-child(3) { padding-left: 0; border-left: 0; }
}
@media (max-width: 600px) {
  .dash-band { padding: 1rem 1.05rem; }
  .band-figs .fig { padding: 0 .75rem; }
  .fig-v { font-size: 1.3rem; }
  .stat-row { gap: .6rem; }
  .stat { padding: .8rem .85rem; }
  .stat-v { font-size: 1.3rem; }
  .stat-v, .fig-v { white-space: normal; overflow-wrap: anywhere; }
  .stat-s { font-size: .84rem; }
}
@media print { .dash-band, .stat-row, .dash-grid { display: none !important; } }

/* ================================================================== EUDR */
.eudr-panel.attn { border-left: 4px solid var(--copper); }
.eudr-issues { margin: .8rem 0 0; padding-left: 1.2rem; color: var(--copper-deep); font-weight: 500; }
.eudr-issues li + li { margin-top: .2rem; }
.doc .eudr-status { border: 1.5px solid #333; border-radius: 6px; padding: .5rem .75rem; margin: .4rem 0 .8rem; }
.doc .eudr-status.bad { border-color: #8a3a12; background: #fbf1ea; }
.doc .eudr-status.ok { border-color: #0e4a40; background: #edf6f2; }
.doc .eudr-status ul { margin: .35rem 0 0; padding-left: 1.1rem; }
.doc table.eudr-plots { font-size: 8.5pt; }
.doc table.eudr-plots td { vertical-align: top; }
.doc h3 { margin: .9rem 0 .35rem; }

/* ================================================================== IBM Plex type system
   Plex Sans does the work (screens, forms, tables); Plex Serif marks page titles and big figures.
   Plex has a large x-height, so the base size goes back to 16px and weights step down to 600. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/ibm-plex-sans-400.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: italic; font-display: swap; src: url(fonts/ibm-plex-sans-400-italic.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url(fonts/ibm-plex-sans-500.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url(fonts/ibm-plex-sans-600.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700 800; font-style: normal; font-display: swap; src: url(fonts/ibm-plex-sans-700.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Serif"; font-weight: 400; font-style: italic; font-display: swap; src: url(fonts/ibm-plex-serif-400-italic.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Serif"; font-weight: 500; font-style: normal; font-display: swap; src: url(fonts/ibm-plex-serif-500.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Serif"; font-weight: 600; font-style: normal; font-display: swap; src: url(fonts/ibm-plex-serif-600.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Serif"; font-weight: 700 800; font-style: normal; font-display: swap; src: url(fonts/ibm-plex-serif-700.woff2) format("woff2"); }
:root {
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --caps: var(--sans);
}
html { font-size: 100%; }
body { font-size: 1rem; line-height: 1.5; }

h1 { font-family: var(--serif); font-weight: 600; font-size: 1.95rem; letter-spacing: -.015em; line-height: 1.15; }
h2, .panel > h2:first-child, .panel-head-row h2 { font-family: var(--serif); font-weight: 600; font-size: 1.25rem; letter-spacing: -.01em; }
h3, h3.form-sec { font-family: var(--sans); font-weight: 600; font-size: 1rem; letter-spacing: 0; }
.brand { font-weight: 600; font-size: 1.3rem; letter-spacing: -.01em; }
.topbar .title { font-family: var(--sans); font-weight: 600; font-size: 1rem; }
.page-head h1 + .muted, .chart-head .muted, .panel > h2 + .muted, .panel-head-row + .muted { font-size: .95rem; }

.nav .sec { font-family: var(--sans); font-size: .78rem; font-weight: 600; letter-spacing: .02em; color: #93c0b2; }
.nav a { font-size: .95rem; font-weight: 500; }
.nav a.active { font-weight: 600; }
table.data { font-size: .925rem; }
table.data td { font-size: .925rem; }
table.data th { font-family: var(--sans); font-size: .8rem; font-weight: 600; letter-spacing: .01em; color: #4a655e; }
.dl div > span { font-family: var(--sans); font-size: .8rem; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.kpi .label, .stat-l, .fig-l { font-weight: 500; font-size: .9rem; }
.kpi .value, .calc .big, .plan-price, .fig-v, .stat-v, .rank-v, .head-fig { font-weight: 600; letter-spacing: -.02em; }
button, .btn { font-weight: 600; letter-spacing: 0; font-size: .925rem; }
.small, .kpi .sub, .badge, .toast { font-weight: 400; }
.small { font-size: .85rem; }
.badge { font-weight: 600; font-size: .75rem; }
.calc > div > span { font-size: .8rem; font-weight: 500; }

/* ================================================================== forms
   A 12-column grid. Fields say how wide they are (w-full / w-half / w-third / w-quarter / w-5);
   unmarked fields take half the row, or a third on a wide page. Sections get a title and a hairline. */
label:not(.check):not(.plan-card) { font-size: .875rem; font-weight: 600; color: #23403a; margin-bottom: .35rem; letter-spacing: 0; }
.req { color: var(--copper); margin-left: .2rem; font-weight: 600; }
input, select, textarea, .ss-btn {
  min-height: 44px; border-radius: 8px; border: 1px solid #c6d9d1; background: #fff; font-size: .95rem;
  transition: border-color .12s, box-shadow .12s;
}
input, select, textarea { padding: .55rem .75rem; }
input:hover, textarea:hover, .ss-btn:hover { border-color: #9dbbb0; }
input:focus, select:focus, textarea:focus, .ss-btn:focus-visible, .ss-btn.ss-open {
  outline: none; border-color: var(--forest-lit); box-shadow: 0 0 0 3px rgba(19, 105, 90, .16);
}
input::placeholder, textarea::placeholder { color: #94aba4; }
input[readonly], input:disabled, textarea:disabled { background: #f3f8f5; color: var(--muted); }
textarea { min-height: 92px; line-height: 1.45; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--forest); flex: none; }
.field { margin-bottom: 1.1rem; }
.field .hint { font-size: .8rem; font-weight: 400; color: var(--muted); margin-top: .35rem; line-height: 1.4; }

.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1.1rem 1.15rem; align-items: start; container-type: inline-size; }
.form-grid > * { grid-column: span 6; min-width: 0; }
.form-grid > .field { margin: 0; }
@container (min-width: 880px) { .form-grid > * { grid-column: span 4; } }
.form-grid > .w-half { grid-column: span 6; }
.form-grid > .w-third { grid-column: span 4; }
.form-grid > .w-quarter { grid-column: span 3; }
.form-grid > .w-5 { grid-column: span 5; }
.form-grid > .w-full, .form-grid > .fs-head, .form-grid > .fs-html { grid-column: 1 / -1; }
@container (max-width: 700px) { .form-grid > .field.w-quarter, .form-grid > .field.w-third { grid-column: span 6; } .form-grid > .field.w-5 { grid-column: 1 / -1; } }
@container (max-width: 520px) {
  .form-grid > .field, .form-grid > .field[class*="w-"] { grid-column: 1 / -1; }
  .form-grid > .field.w-quarter { grid-column: span 6; }
}

/* section headings inside a form */
.fs-head { padding-top: 1.15rem; margin-top: .2rem; border-top: 1px solid var(--line); }
.form-grid > .fs-head:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
.fs-head h3 { margin: 0; font-family: var(--sans); font-size: .98rem; font-weight: 600; color: var(--forest-deep); }
.fs-head p { margin: .2rem 0 0; font-size: .85rem; color: var(--muted); max-width: 70ch; }
.fs-html .gps-row { margin-top: -.3rem; }

/* check boxes sit in a quiet box with their explanation */
.check-field label.check { display: flex; align-items: flex-start; gap: .7rem; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: 10px;
  background: #f7fbf9; font-size: .925rem; font-weight: 600; color: var(--text); cursor: pointer; margin: 0; }
.check-field label.check:hover { border-color: #b9d2c8; }
.check-field label.check input { margin-top: .1rem; }
.check-field label.check .hint { margin-top: .15rem; font-weight: 400; }

/* settings pages: each titled block below the first is a new section */
.panel .form-grid + h2, .panel .form-grid + h3 { margin-top: 1.5rem !important; padding-top: 1.25rem; border-top: 1px solid var(--line); }

/* page forms: actions sit on a hairline, primary action last */
form.panel > .form-actions, form .panel + .form-actions, .panel > form > .form-actions { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1.2rem; }

/* modal: fixed title bar and action bar, the body scrolls between them */
.modal { display: flex; flex-direction: column; padding: 0; overflow: hidden; max-width: 600px; border-radius: 16px; box-shadow: 0 24px 64px rgba(6, 36, 31, .3); }
.modal.wide { max-width: 860px; }
.modal > h2 { margin: 0; padding: 1.15rem 1.5rem 1rem; border-bottom: 1px solid var(--line); font-family: var(--serif); font-size: 1.3rem; font-weight: 600; flex: none; }
.modal > .modal-body { padding: 1.3rem 1.5rem 1.2rem; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal > .modal-body > p:first-child { margin-top: 0; }
.modal > .err { margin: 0; padding: 0 1.5rem; min-height: 0; }
.modal > .err:not(:empty) { padding: .6rem 1.5rem; background: var(--bad-bg); border-top: 1px solid #f0c9bf; font-weight: 500; }
.modal > .form-actions { margin: 0; padding: .85rem 1.5rem; border-top: 1px solid var(--line); background: #f6faf8; flex: none; }
@media (max-width: 600px) {
  .modal { border-radius: 16px 16px 0 0; max-height: 94vh; }
  .modal > h2 { padding: 1rem 1.1rem .85rem; font-size: 1.2rem; }
  .modal > .modal-body { padding: 1.1rem 1.1rem 1rem; }
  .modal > .form-actions { padding: .75rem 1.1rem; }
  .modal > .form-actions button { flex: 1 1 auto; }
}
.fs-gap { margin-top: 1.15rem; padding-top: 1.15rem; border-top: 1px solid var(--line); }

/* ================================================================== v2: the "field ledger" design
   A light work surface, a deep forest rail, one green accent, copper only for what needs attention.
   Plex Sans for work and card titles; Plex Serif for page titles and big figures. */
:root {
  --bg: #F6F7F5; --panel: #fff; --text: #17211E; --muted: #5C6B66; --line: #E3E8E5; --field: #CBD6D1;
  --forest: #0E3B33; --forest-deep: #0E3B33; --forest-lit: #1B6B5A; --brand: #0E3B33; --brand-2: #1B6B5A;
  --cream: #F3E6D3; --copper: #B4622E; --copper-deep: #8A4419; --accent: #B4622E;
  --ok: #145646; --ok-bg: #E4F1EC; --info-bg: #E4F1EC; --warn: #8A4419; --warn-bg: #FBF1EA; --crit: #8A4419; --crit-bg: #FBF1EA;
  --bad: #A3311D; --bad-bg: #FBE8E3; --soft: #FAFBFA; --rule: #EEF1EF;
  --series-1: #1B6B5A; --series-2: #B4622E; --bar: #1B6B5A; --track: #ECEFED;
}
body { background: var(--bg); color: var(--text); }
a { color: var(--forest-lit); font-weight: 500; }

/* rail */
.sidebar { background: #0E3B33; color: #CFE3DC; }
.brand { padding: 18px 18px 14px; gap: 10px; font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand small { color: #9EC2B6; font-family: var(--sans); font-size: .75rem; font-weight: 400; }
.nav { padding: 0 12px 12px; }
.nav .sec { font-size: .75rem; font-weight: 600; color: #86B3A5; padding: 16px 10px 6px; letter-spacing: .01em; }
.nav a { border-radius: 8px; min-height: 40px; padding: 0 10px; gap: 11px; font-size: .9rem; font-weight: 500; color: #CFE3DC; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a.active { background: var(--cream); color: #0E3B33; font-weight: 600; }
.nav a.active .ico { color: #0E3B33; }
.nav .ico .ic { width: 18px; height: 18px; }
.nav .pill { background: var(--copper); }
.sidebar-foot { display: flex; align-items: center; gap: 10px; padding: 14px 16px 16px; border-top: 1px solid rgba(255, 255, 255, .12); }
.sidebar-foot .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--cream); color: #0E3B33; display: grid; place-items: center; font-weight: 600; font-size: .8rem; flex: none; }
.sidebar-foot .who { flex: 1; min-width: 0; line-height: 1.25; }
.sidebar-foot .who a { color: #fff; font-weight: 500; font-size: .9rem; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .who span { color: #9EC2B6; font-size: .75rem; }
.sidebar-foot button { width: 36px; height: 36px; min-height: 0; margin: 0; padding: 0; border-radius: 8px; background: transparent; color: #CFE3DC; border: 0; }
.sidebar-foot button:hover { background: rgba(255, 255, 255, .08); }

/* top bar: white, breadcrumb, search */
.topbar { background: #fff; border-bottom: 1px solid var(--line); min-height: 64px; padding: 0 28px; gap: 14px; }
.topbar .title { font-family: var(--sans); font-size: .9rem; font-weight: 400; color: var(--muted); }
.topbar .title b { color: var(--text); font-weight: 600; }
.topbar .crumb-sep { margin: 0 6px; color: #A5B3AE; }
.gsearch { position: relative; width: 300px; max-width: 34vw; }
.gsearch input { height: 40px; min-height: 40px; padding: 0 64px 0 36px; background: var(--soft); font-size: .9rem; }
.gsearch .ic { position: absolute; left: 12px; top: 12px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.gsearch kbd { position: absolute; right: 10px; top: 10px; font: 500 11px var(--sans); border: 1px solid var(--field); border-radius: 4px; padding: 1px 5px; background: #fff; color: var(--muted); }
.gsearch-pop { position: absolute; top: 46px; left: 0; right: 0; min-width: 320px; z-index: 50; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 40px rgba(6, 36, 31, .18); padding: 6px; max-height: 60vh; overflow: auto; }
.gsearch-pop a { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
.gsearch-pop a span { font-size: .8rem; color: var(--muted); font-weight: 400; }
.gsearch-pop a.on, .gsearch-pop a:hover { background: var(--ok-bg); }
.gsearch-pop .none { padding: 10px; color: var(--muted); font-size: .9rem; }
@media (max-width: 760px) { .gsearch { display: none; } }
.bell { width: 40px; height: 40px; border: 1px solid var(--field) !important; border-radius: 8px; color: var(--text); }
.bell .count { background: var(--copper); }
.sub-banner.info { background: var(--ok-bg); border-color: var(--line); color: #0E3B33; }

/* page */
.content { padding: 28px 32px 48px; max-width: 1340px; }
.page-head { margin-bottom: 22px; align-items: flex-end; }
.page-head h1, h1 { font-family: var(--serif); font-weight: 600; font-size: 1.75rem; letter-spacing: -.01em; color: var(--text); }
.page-head h1 + .muted, .page-head .muted { font-family: var(--sans); font-style: normal; font-size: .95rem; color: var(--muted); margin-top: 4px; }
h2, .panel > h2:first-child, .panel-head-row h2, .chart-head h2 { font-family: var(--sans); font-weight: 600; font-size: 1rem; letter-spacing: 0; color: var(--text); }
.chart-head .muted, .panel > h2 + .muted, .panel-head-row + .muted { font-family: var(--sans); font-style: normal; font-size: .85rem; }

/* buttons: 8px corners, one green */
button, .btn { border-radius: 8px; min-height: 40px; padding: 0 16px; font-size: .9rem; font-weight: 600; border-color: var(--field); color: var(--text); background: #fff; }
button:hover, .btn:hover { background: var(--soft); border-color: #B3C4BD; }
button.primary, .btn.primary { background: var(--forest-lit); border-color: var(--forest-lit); color: #fff; }
button.primary:hover, .btn.primary:hover { background: #145646; border-color: #145646; }
button.sm, .btn.sm { min-height: 32px; padding: 0 12px; font-size: .84rem; }
.sidebar button { border-radius: 8px; }

/* cards */
.panel { border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; background: #fff; }
.panel-head-row { margin-bottom: 14px; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush > .panel-head-row { padding: 18px 22px 0; }
.card-flush .table-wrap { border-top: 1px solid var(--line); margin-top: 4px; }

/* figure cards: white, quiet; copper only when something needs attention */
.kpi { background: #fff !important; color: var(--text); border: 1px solid var(--line); border-radius: 12px; min-height: 0; padding: 16px 20px; }
.kpi .label { color: var(--muted); font-size: .85rem; font-weight: 500; }
.kpi .value { color: var(--text); font-size: 1.5rem; font-weight: 600; }
.kpi .sub, .kpi .sub a, .kpi a { color: var(--muted); }
.kpi.warn .value, .kpi.crit .value, .kpi.bad .value { color: var(--copper-deep); }

/* tables */
table.data { font-size: .9rem; }
table.data th { font-family: var(--sans); background: var(--soft); color: var(--muted); font-size: .78rem; font-weight: 600; letter-spacing: .01em; padding: 10px 16px; border-bottom: 1px solid var(--line); }
table.data td { padding: 12px 16px; border-bottom-color: var(--rule); font-size: .9rem; }
table.data tbody tr:hover { background: #F7FAF8; }
table.data tfoot td { background: var(--soft); }

/* chips */
.badge { border-radius: 999px; font-size: .75rem; font-weight: 600; padding: 3px 9px; }
.b-ok, .b-delivered { background: var(--ok-bg); color: var(--ok); }
.b-warning, .b-critical { background: var(--warn-bg); color: var(--warn); }
.b-info, .b-dispatched { background: #E6EEF6; color: #1F4B73; }
.b-none, .b-depleted { background: #ECEFED; color: #4B5A55; }

/* tabs and segmented controls */
.tabs { gap: 4px; border-bottom-color: var(--line); }
.tabs button { min-height: 44px; padding: 0 14px; font-size: .9rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; }
.tabs button.active { color: #0E3B33; border-bottom-color: var(--forest-lit); }
.seg-toggle { background: #ECEFED; border: 0; border-radius: 9px; padding: 3px; }
.seg-toggle button { min-height: 32px; border-radius: 7px; font-size: .84rem; }
.seg-toggle button[aria-pressed="true"] { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(23, 33, 30, .14); }

/* alerts */
.alert-box { border-radius: 10px; border: 0; padding: 12px 16px; }
.alert-box.info { background: var(--ok-bg); color: #0E3B33; }
.alert-box.warn { background: var(--warn-bg); color: #7A3A12; }
.alert-box.bad { background: var(--bad-bg); color: #8A2A14; }

/* ---------- shared v2 pieces ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); white-space: nowrap; }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: #E6EEF6; color: #1F4B73; }
.chip.none { background: #ECEFED; color: #4B5A55; }
.avatar-lg { width: 64px; height: 64px; border-radius: 50%; background: var(--cream); color: #6B3A16; display: grid; place-items: center; font: 600 1.35rem var(--serif); flex: none; }
.avatar-sm { width: 42px; height: 42px; border-radius: 50%; background: var(--cream); color: #6B3A16; display: grid; place-items: center; font-weight: 600; flex: none; }
.v2-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: start; margin-bottom: 20px; }
.v2-grid > * { min-width: 0; margin: 0; }
.v2-grid > .span2 { grid-column: span 2; }
.v2-grid.even { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.v2-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.v2-side > .panel { margin: 0; }
@media (max-width: 1100px) { .v2-grid { grid-template-columns: minmax(0, 1fr); } .v2-grid > .span2 { grid-column: auto; } }
.figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
@media (max-width: 1000px) { .figs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fig-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; color: var(--text); min-width: 0; }
a.fig-card:hover { text-decoration: none; border-color: #B9CEC6; }
.fig-card .fl { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .85rem; font-weight: 500; color: var(--muted); }
.fig-card .fv { font: 600 1.6rem/1.2 var(--serif); letter-spacing: -.02em; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fig-card.attn .fv { color: var(--copper-deep); }
.fig-card .fs { font-size: .82rem; color: var(--muted); }
.fig-card svg.spark { width: 100%; height: 28px; display: block; }
.spark polyline { fill: none; stroke: var(--forest-lit); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.fig-card.attn .spark polyline { stroke: var(--copper); }
@media (max-width: 600px) { .fig-card .fv { font-size: 1.25rem; white-space: normal; } .figs { gap: 10px; } }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 12px; padding: 11px 0; border-top: 1px solid var(--rule); }
.checklist li:first-child { border-top: 0; }
.checklist .t { font-size: .92rem; font-weight: 500; }
.checklist .s { font-size: .82rem; color: var(--muted); }
.ck { width: 22px; height: 22px; flex: none; }
.dl2 { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dl2 dt { font-size: .78rem; color: var(--muted); }
.dl2 dd { margin: 2px 0 0; font-size: .92rem; font-weight: 500; overflow-wrap: anywhere; }
.dl2 .full { grid-column: 1 / -1; }
.big-money { font: 600 1.9rem/1.2 var(--serif); letter-spacing: -.02em; font-variant-numeric: lining-nums tabular-nums; }
.big-money.owed { color: var(--copper-deep); }
.steps { list-style: none; margin: 0 0 20px; padding: 16px 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.steps li { display: flex; align-items: center; gap: 10px; }
.steps .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 600; flex: none; background: #ECEFED; color: var(--muted); }
.steps li.done .dot { background: var(--forest-lit); color: #fff; }
.steps li.cur .dot { background: #fff; color: var(--forest-lit); border: 2px solid var(--forest-lit); }
.steps .sl { font-size: .88rem; font-weight: 600; line-height: 1.3; display: block; }
.steps li.todo .sl { color: var(--muted); }
.steps .stw { display: block; font-size: .78rem; color: var(--muted); }
.ready-banner { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 10px; background: #E9F4EF; color: #0E3B33; }
.ready-banner.warn { background: var(--warn-bg); color: #7A3A12; }
.ready-banner strong { display: block; }
.ready-banner span { font-size: .88rem; }
.count-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); border: 1px solid var(--rule); border-radius: 10px; margin: 16px 0; }
.count-strip > div { padding: 12px 14px; border-right: 1px solid var(--rule); }
.count-strip > div:last-child { border-right: 0; }
.count-strip b { display: block; font: 600 1.25rem var(--serif); }
.count-strip span { font-size: .78rem; color: var(--muted); }
.plot-map { display: flex; flex-wrap: wrap; border-top: 1px solid var(--rule); margin: 14px -22px -20px; }
.plot-map svg { flex: 2 1 360px; min-width: 0; height: auto; background: #F1F5F2; display: block; }
.plot-map .dl2 { flex: 1 1 200px; padding: 18px 22px; align-content: start; border-left: 1px solid var(--rule); }
.plot-empty { flex: 2 1 360px; display: grid; place-items: center; min-height: 220px; background: #F1F5F2; color: var(--muted); text-align: center; padding: 24px; font-size: .9rem; }
.ring-row { display: flex; align-items: center; gap: 18px; }
.ring-row b { display: block; font: 600 1.35rem var(--serif); }
.ring-row span { font-size: .85rem; color: var(--muted); }
.kv { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 9px; font-size: .9rem; }
.kv li { display: flex; justify-content: space-between; gap: 10px; }
.kv b { font-weight: 600; font-variant-numeric: tabular-nums; }
.note-warn { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--warn-bg); color: #7A3A12; font-size: .86rem; }
.note-warn a { color: #7A3A12; font-weight: 600; text-decoration: underline; }
.bar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.bar-list a { display: flex; flex-direction: column; gap: 6px; color: var(--text); text-decoration: none; font-weight: 400; }
.bar-list .top { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; }
.bar-list .top b { font-weight: 500; }
.bar-list .top span { font-variant-numeric: tabular-nums; }
.bar-list .trk { height: 6px; border-radius: 6px; background: #ECEFED; overflow: hidden; }
.bar-list .trk i { display: block; height: 100%; background: var(--forest-lit); border-radius: 6px; }
.bar-list .sub { font-size: .78rem; color: var(--muted); }
/* forms laid out as a card: body, then a footer bar of actions */
.form-card { padding: 0; overflow: hidden; }
.form-card .form-body { padding: 22px 24px; }
.form-card .err:empty { display: none; }
.form-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px 24px; background: var(--soft); border-top: 1px solid var(--line); }
.form-foot > :first-child { margin-right: auto; }
.fs-head h3 { display: flex; align-items: center; gap: 10px; }
.fs-head .num { width: 24px; height: 24px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; font-size: .78rem; font-weight: 600; flex: none; }
.mc-bar { position: relative; height: 8px; border-radius: 8px; margin: -4px 0 2px;
  background: linear-gradient(90deg, #CFE6DD 0 var(--std), #F4DEC9 var(--std) var(--rej), #F1C9BD var(--rej)); }
.mc-bar i { position: absolute; top: -4px; width: 16px; height: 16px; border-radius: 50%; background: var(--forest-lit); border: 3px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); box-sizing: border-box; transition: left .15s; }
.mc-bar i.warn { background: var(--copper); } .mc-bar i.bad { background: var(--bad); }
.farmer-pick { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--field); border-radius: 10px; margin-top: -4px; }
.farmer-pick .who { flex: 1; min-width: 0; line-height: 1.35; }
.farmer-pick .who a { color: var(--text); font-weight: 600; }
.farmer-pick .who span { display: block; font-size: .84rem; color: var(--muted); }
.slip-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: .9rem; font-variant-numeric: tabular-nums; }
.slip-row > span:first-child { color: var(--muted); }
.slip-row.strong { border-top: 1px solid var(--rule); font-weight: 600; }
.slip-row.strong > span:first-child { color: var(--text); font-weight: 500; }
.slip-total { margin-top: 10px; padding: 16px; border-radius: 10px; background: #0E3B33; color: #fff; display: flex; flex-direction: column; gap: 2px; }
.slip-total span { font-size: .82rem; color: #A9CFC2; }
.slip-total b { font: 600 1.75rem/1.2 var(--serif); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.slip-alert { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--bad-bg); color: #8A2A14; font-size: .86rem; font-weight: 500; }
.today-list { list-style: none; margin: 0; padding: 0; }
.today-list a { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--rule); color: var(--text); font-weight: 400; text-decoration: none; font-size: .9rem; }
.today-list small { display: block; font-size: .78rem; color: var(--muted); }
.today-list b { font-weight: 500; }
.today-list .r { text-align: right; font-variant-numeric: tabular-nums; }
.v2-side .panel > h2 { margin-bottom: 8px; }
/* profile header */
.profile-head { align-items: center; gap: 18px; }
.profile-head .title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.profile-head h1 { margin: 0; }
.tabs .count { background: #ECEFED; color: var(--muted); font-weight: 600; }
.plot-map .dl2 dd a { font-size: .85rem; }
.tabs { scrollbar-width: none; } .tabs::-webkit-scrollbar { display: none; }
.doc-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--rule); }
.card-flush > .panel-head-row .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- certification and bulk lots */
.chip.cert { background: var(--cream, #F3E6D3); color: #8A4419; }
.cert-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cert-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.cert-opt { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--field, #CBD6D1); border-radius: 8px; background: #fff; cursor: pointer; font-weight: 500; }
.cert-opt input { width: 16px; height: 16px; margin: 0; accent-color: #1B6B5A; }
.cert-opt:has(input:checked) { border-color: #B4622E; background: #FBF4EC; color: #8A4419; }
.cert-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cert-choice button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 12px 14px; border: 1px solid var(--field, #CBD6D1);
  border-radius: 10px; background: #fff; color: var(--text); font: inherit; cursor: pointer; min-height: 0; height: auto; }
.cert-choice button b { font-weight: 600; font-size: .95rem; }
.cert-choice button span { font-size: .8rem; color: var(--muted); }
.cert-choice button[aria-checked="true"] { border-color: #1B6B5A; box-shadow: 0 0 0 1px #1B6B5A inset; background: #F1F7F4; }
.cert-choice button[data-sell="certified"][aria-checked="true"] { border-color: #B4622E; box-shadow: 0 0 0 1px #B4622E inset; background: #FBF4EC; }
@media (max-width: 520px) { .cert-choice { grid-template-columns: 1fr; } }
.vol { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line, #E3E8E5); }
.vol-row { display: flex; align-items: baseline; gap: 6px; margin: 2px 0 8px; }
.vol-row strong { font: 600 1.25rem/1.2 var(--serif); }
.vol .meter { margin-bottom: 6px; }
.cert-split { margin-top: 14px; }
.cs-bar { display: flex; gap: 2px; height: 8px; border-radius: 99px; overflow: hidden; background: #ECEFED; }
.cs-bar i { display: block; min-width: 2px; }
.cs-bar .c, .cs-leg i.c { background: #B4622E; }
.cs-bar .v, .cs-leg i.v { background: #1F8A70; }
.cs-leg { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: .85rem; }
.cs-leg a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.cs-leg a b { color: var(--text); font-weight: 600; }
.cs-leg i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.lot-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
@media (max-width: 700px) { .lot-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pick-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.pick-table tr.picked td { background: #F1F7F4; }
.pick-table td:first-child, .pick-table th:first-child { width: 36px; }
.pick-table input[type=checkbox] { width: 16px; height: 16px; accent-color: #1B6B5A; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.title-row h1 { margin: 0; }
.lot-strip { background: #fff; margin-top: 0; }
.cert-choice button, .cert-choice button span { white-space: normal; overflow: visible; }

/* dashboard: certification, grades, bulk lots */
.cs-leg span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.dash-cert .cs-leg { margin: 0 0 12px; }
.split-row { margin-bottom: 14px; }
.split-top { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; margin-bottom: 6px; color: var(--muted); }
.split-top b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.split-top > span:last-child { font-variant-numeric: tabular-nums; }
.split-bar, .grade-bar { display: flex; gap: 2px; height: 12px; border-radius: 4px; overflow: hidden; background: #ECEFED; }
.split-bar a, .grade-bar a { display: block; min-width: 3px; }
.split-bar a.c { background: #B4622E; }
.split-bar a.v { background: #1F8A70; }
.split-bar a:hover, .grade-bar a:hover, .split-bar a.hover, .grade-bar a.hover { filter: brightness(1.12); }
.split-bar a:focus-visible, .grade-bar a:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.grade-bar { height: 24px; }
.grade-block { margin-bottom: 16px; }
.grade-leg { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 5px; font-size: .85rem; }
.grade-leg li { display: grid; grid-template-columns: 10px 1fr auto 3.2em; align-items: center; gap: 8px; }
.grade-leg i { width: 10px; height: 10px; border-radius: 2px; }
.grade-leg b { font-weight: 600; font-variant-numeric: tabular-nums; }
.grade-leg em { font-style: normal; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.mini-h { font-size: .8rem; font-weight: 600; color: var(--muted); margin: 18px 0 10px; display: flex; align-items: center; gap: 8px; }
.bar-list.copper .trk i { background: #B4622E; }
.bar-list .trk.q.warn i { background: #C98A1B; }
.bar-list .trk.q.bad i { background: #B3261E; }
.dash-lots .bar-list .top b { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

/* coffee flow tracker on purchase and lot pages */
.flow-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 20px 6px; margin: 0 0 20px; }
.flow-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.flow-head h2 { margin: 0; font-size: 1rem; }
.steps.flow { border: 0; padding: 14px 0 10px; margin: 0; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.steps.flow .sl a { color: inherit; }
.steps.flow li.done .sl a { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.flow-moves { margin: 0 0 10px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); }

/* dashboard: coffee flow stages */
.flow-dash { margin-bottom: 20px; }
.flow-stages { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.flow-stages li { border-right: 1px solid var(--line); position: relative; min-width: 0; }
.flow-stages li:last-child { border-right: 0; }
.flow-stages li:not(:last-child)::after { content: ''; position: absolute; right: -6px; top: 22px; width: 10px; height: 10px; background: #fff;
  border-top: 1px solid var(--line); border-right: 1px solid var(--line); transform: rotate(45deg); z-index: 1; }
.flow-stages a { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 14px; color: var(--text); text-decoration: none; font-weight: 400; height: 100%; }
.flow-stages a:hover, .flow-stages a.hover { background: #F6F8F7; }
.flow-stages a:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
.flow-stages .fst { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); line-height: 1.25; min-height: 2.1em; }
.flow-stages .fno { flex: none; width: 20px; height: 20px; border-radius: 50%; background: #ECEFED; display: grid; place-items: center; font-size: .72rem; font-weight: 600; color: var(--muted); }
.flow-stages .fkg { font: 600 1.45rem var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.flow-stages .fkg small { font: 500 .8rem var(--sans, inherit); color: var(--muted); }
.flow-stages .ftr { height: 6px; border-radius: 4px; background: #ECEFED; overflow: hidden; }
.flow-stages .ftr i { display: block; height: 100%; background: #1B6B5A; border-radius: 4px; }
.flow-stages .fsub { font-size: .78rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.flow-stages li.wait .fno { background: #F3E6D3; color: #8A4419; }
@media (max-width: 1100px) { .flow-stages { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .flow-stages li:nth-child(3n) { border-right: 0; } .flow-stages li:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .flow-stages li::after { display: none; } }
@media (max-width: 600px) { .flow-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow-stages li { border-bottom: 1px solid var(--line); } .flow-stages li:nth-child(3n) { border-right: 1px solid var(--line); }
  .flow-stages li:nth-child(2n) { border-right: 0; } .flow-stages li:nth-last-child(-n+2) { border-bottom: 0; } }

.flow-failed { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; font-size: .85rem; color: var(--text); font-weight: 400; }
.pick-table tr.failed td { color: var(--muted); }
.steps li.bad .dot { background: #FBE9E7; color: #B3261E; border: 2px solid #B3261E; }
.steps li.bad .stw { color: #B3261E; }

/* buyer payments */
.pay-list { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--line); }
.pay-list li { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; row-gap: 2px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.pay-list span { color: var(--muted); grid-column: 1 / -1; grid-row: 2; font-size: .8rem; }
.fig-card .fv small { font: 500 .8rem var(--sans, inherit); color: var(--muted); letter-spacing: 0; }
.pay-list b { font-variant-numeric: tabular-nums; }
.pay-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.row-acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
input.alloc { width: 9em; text-align: right; }
.grade-bar a[tabindex] { cursor: default; }

/* dashboard: owed by buyers */
.recv-cols { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px; }
@media (max-width: 900px) { .recv-cols { grid-template-columns: minmax(0, 1fr); gap: 12px; } }
.count-strip > div.bad b { color: var(--bad); }

/* buyer contracts */
.sub-grid { padding: 0; margin: 0; }
.sub-grid.hidden { display: none; }
.con-prog { display: grid; gap: 5px; min-width: 150px; }
.con-prog .trk { height: 6px; border-radius: 6px; background: #ECEFED; overflow: hidden; display: block; }
.con-prog .trk i { display: block; height: 100%; background: var(--forest-lit); border-radius: 6px; }
.fix-calc { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; background: #F3F6F4; font-size: .9rem; font-variant-numeric: tabular-nums; }
.count-strip > div.warn b { color: var(--warn); }
.dash-cons .bar-list .sub .chip { margin-left: 4px; white-space: normal; }
.dash-recv .count-strip b { font-size: 1.05rem; white-space: nowrap; }
.dash-recv .count-strip > div { padding: 10px 12px; }
.dash-recv .rank-top { flex-wrap: wrap; row-gap: 2px; }
.dash-recv .recv-cols { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }

/* accounting export */
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: grid; grid-template-columns: minmax(0, 1fr) 9rem auto; gap: 16px; align-items: center; padding: 14px 22px; border-top: 1px solid var(--line); }
.file-list li > div:first-child { display: grid; gap: 2px; }
.file-list .fl-meta { display: grid; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .file-list li { grid-template-columns: 1fr auto; } .file-list .fl-meta { text-align: left; grid-column: 1; } }

/* ---------- printed documents: one professional house style for every report ---------- */
.doc { --ink: #17211E; --acc: #0E3B33; --rule: #CBD5D1; --soft: #F1F5F3; --mut: #5A6662;
  font: 11.5px/1.45 "IBM Plex Sans", "Segoe UI", Arial, sans-serif; color: var(--ink); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc .doc-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end; border-bottom: 3px solid var(--acc); padding-bottom: 10px; margin-bottom: 14px; }
.doc .co { font: 700 17px/1.2 var(--serif, Georgia, serif); color: var(--acc); }
.doc .dh-addr { color: var(--mut); font-size: 10.5px; }
.doc .doc-title { font: 600 20px/1.15 var(--serif, Georgia, serif); color: var(--ink); text-align: right; text-transform: none; letter-spacing: -.01em; }
.doc .dh-ref { margin: 6px 0 0 auto; width: auto; border-collapse: collapse; }
.doc .dh-ref th, .doc .dh-ref td { border: 0; padding: 1px 0 1px 12px; background: none; font-size: 10.5px; text-transform: none; text-align: right; }
.doc .dh-ref th { color: var(--mut); font-weight: 500; }
.doc .dh-ref td { font-weight: 700; font-variant-numeric: tabular-nums; }
.doc .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 24px; margin: 0 0 14px; padding: 9px 12px; border: 1px solid var(--rule); border-radius: 4px; background: #fff; }
.doc .meta div span { color: var(--mut); font-weight: 500; min-width: 118px; }
.doc h3 { font: 700 11px/1.3 "IBM Plex Sans", Arial, sans-serif; color: var(--acc); letter-spacing: .02em; margin: 16px 0 6px; padding-bottom: 3px; border-bottom: 1px solid var(--rule); }
.doc table { width: 100%; border-collapse: collapse; margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.doc th, .doc td { border: 0; border-bottom: 1px solid #E1E7E4; padding: 5px 7px; text-align: left; vertical-align: top; }
.doc thead th { background: var(--soft); color: var(--acc); font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1.5px solid var(--acc); }
.doc tbody tr:nth-child(even) td { background: #FAFBFA; }
.doc tfoot td { font-weight: 700; border-top: 1.5px solid var(--acc); border-bottom: 0; background: none; }
.doc tbody th { color: var(--mut); font-weight: 600; width: 22%; background: none; }
.doc .sign { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 28px; margin-top: 42px; break-inside: avoid; }
.doc .sign div { border-top: 1px solid var(--ink); padding-top: 4px; font-size: 10px; font-weight: 600; }
.doc .sign div::after { content: "Name, signature and date"; display: block; font-weight: 400; color: var(--mut); }
.doc .foot { display: flex; justify-content: space-between; gap: 16px; margin-top: 22px; padding-top: 6px; border-top: 1px solid var(--rule); font-size: 9.5px; color: var(--mut); }
/* building blocks for reports */
.doc .facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: 4px; margin: 0 0 12px; }
.doc .facts > div { padding: 6px 10px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.doc .facts > div:nth-child(4n) { border-right: 0; }
.doc .facts dt { color: var(--mut); font-size: 9.5px; margin: 0; }
.doc .facts dd { margin: 1px 0 0; font-weight: 600; }
.doc .verdict { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; padding: 10px 14px; border-radius: 4px; margin: 0 0 12px; border: 1.5px solid; break-inside: avoid; }
.doc .verdict b { font: 700 18px/1 var(--serif, Georgia, serif); }
.doc .verdict.pass { border-color: #1F6B4A; background: #EEF7F2; color: #134B33; }
.doc .verdict.hold { border-color: #A86A10; background: #FBF3E4; color: #6E4508; }
.doc .verdict.fail { border-color: #9B2C1F; background: #FBEDEA; color: #74180E; }
.doc .verdict span { color: var(--ink); }
.doc .ok-t { color: #1F6B4A; font-weight: 600; } .doc .warn-t { color: #A86A10; font-weight: 600; } .doc .bad-t { color: #9B2C1F; font-weight: 600; }
.doc .bar { display: block; height: 8px; background: #E6ECE9; border-radius: 2px; overflow: hidden; min-width: 120px; }
.doc .bar i { display: block; height: 100%; background: var(--acc); }
.doc table.dense th, .doc table.dense td { padding: 3px 5px; font-size: .92em; }
.doc table.dense thead th { font-size: 8.5px; letter-spacing: .02em; white-space: normal; vertical-align: bottom; }
.doc table.dense { table-layout: auto; }
.doc .small { font-size: .88em; }
.doc .score-bar { position: relative; overflow: visible; }
.doc .score-bar::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; border-left: 1.5px solid var(--ink); opacity: .55; }
.doc .total-box { display: grid; grid-template-columns: 1fr 1fr 1.4fr; margin: 12px 0 0; border: 1.5px solid var(--acc); border-radius: 4px; break-inside: avoid; }
.doc .total-box > div { padding: 8px 12px; border-right: 1px solid var(--rule); display: flex; flex-direction: column; gap: 2px; }
.doc .total-box > div:last-child { border-right: 0; }
.doc .total-box span { color: var(--mut); font-size: .85em; }
.doc .total-box b { font-size: 1.15em; font-variant-numeric: tabular-nums; }
.doc .total-box .main { background: var(--soft); text-align: right; }
.doc .total-box .main b { font: 700 1.5em/1.1 var(--serif, Georgia, serif); color: var(--acc); }
.doc .words { margin: 6px 0 0; font-style: italic; } .doc .words span { font-style: normal; color: var(--mut); }
.doc .lot-label { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 8px 12px; border: 1px dashed var(--rule); border-radius: 4px; break-inside: avoid; }
.doc .lot-label svg.bc { display: block; width: 190px; height: 40px; }
.doc .lot-label b { display: block; font-size: 1.1em; } .doc .lot-label span { color: var(--mut); font-size: .88em; }
.doc .parties p { margin: 0; line-height: 1.5; }
.doc .parties h3 { margin-top: 0; }
.doc .receive-box { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; padding: 10px 12px 12px; border: 1px solid var(--rule); border-radius: 4px; break-inside: avoid; }
.doc .receive-box > div { display: flex; flex-direction: column; gap: 18px; } .doc .receive-box .full { grid-column: 1 / -1; }
.doc .receive-box span { color: var(--mut); font-size: .88em; } .doc .receive-box i { border-bottom: 1px solid var(--ink); opacity: .6; }
@media (max-width: 700px) { .doc .total-box, .doc .receive-box { grid-template-columns: 1fr; } .doc .total-box > div { border-right: 0; border-bottom: 1px solid var(--rule); } .doc .total-box .main { text-align: left; } }
.doc .note-box { border: 1px solid var(--rule); border-radius: 4px; padding: 8px 12px; min-height: 34px; white-space: pre-wrap; }
.doc .cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.doc .cols2 > div { min-width: 0; }
/* a report shown on screen, as it prints */
.doc.on-screen { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 28px 32px; max-width: 900px; font-size: 13px; }
@media (max-width: 700px) { .doc.on-screen { padding: 16px; } .doc .facts { grid-template-columns: 1fr 1fr; } .doc .facts > div:nth-child(4n) { border-right: 1px solid var(--rule); } .doc .facts > div:nth-child(2n) { border-right: 0; } .doc .cols2 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ surveys */
.sv-filter { display: inline-flex; gap: 2px; padding: 3px; margin: 0 0 16px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.sv-filter a { padding: 5px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .9rem; text-decoration: none; }
.sv-filter a.on { background: var(--forest); color: #fff; }
.sv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.sv-card { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; background: #fff; border: 1px solid var(--line); border-radius: 12px; text-align: left; font: inherit; color: var(--text); }
.sv-card h3 { margin: 0; font: 600 1.15rem/1.25 var(--serif); } .sv-card h3 a { color: var(--text); }
.sv-card p { margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sv-top { display: flex; gap: 6px; flex-wrap: wrap; }
.sv-cov { margin-top: auto; padding-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.sv-foot { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.sv-act { display: flex; gap: 8px; flex-wrap: wrap; }
button.sv-pick { cursor: pointer; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; height: auto; min-height: 150px; white-space: normal; text-align: left; font-weight: 400; }
button.sv-pick * { white-space: normal; text-align: left; } button.sv-pick:hover, button.sv-pick:focus-visible { border-color: var(--forest-lit); box-shadow: 0 0 0 3px var(--info-bg); }
button.sv-pick .sv-foot { margin-top: auto; }
.sv-aud { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sv-aud-opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--field); border-radius: 10px; cursor: pointer; font-weight: 400; }
.sv-aud-opt:has(input:checked) { border-color: var(--forest-lit); background: var(--info-bg); }
.sv-aud-opt > span { display: flex; flex-direction: column; gap: 2px; } .sv-aud-opt input { margin-top: 4px; }
.sq-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sq-card { border: 1px solid var(--line); border-left: 3px solid var(--forest-lit); border-radius: 10px; background: #fbfdfc; }
.sq-card.is-section { border-left-color: var(--copper); background: #fff; }
.sq-card.is-archived { opacity: .6; }
.sq-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 0 12px; flex-wrap: wrap; }
.sq-head select { width: auto; min-width: 150px; }
.sq-tools { margin-left: auto; display: flex; gap: 2px; }
.sq-n { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; background: var(--info-bg); color: var(--forest); font-weight: 700; font-size: .85rem; }
.sq-body { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; }
.sq-body .sq-label { font-weight: 600; font-size: 1rem; }
.sq-body .sq-help { font-size: .88rem; }
.sq-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; }
.sq-row > label:not(.check) { display: flex; flex-direction: column; gap: 3px; min-width: 120px; flex: 1; font-weight: 400; }
.sq-row .sq-wide { flex: 3 1 260px; }
.sq-opts { align-items: center; padding-top: 4px; border-top: 1px dashed var(--line); }
.sq-cond, .sq-ff { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sq-cond select, .sq-ff select, .sq-cond input { width: auto; max-width: 260px; }
.sq-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.sv-intro { white-space: normal; color: var(--muted); }
.sv-farmer { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--info-bg); }
.sv-farmer > div:nth-child(2) { flex: 1; }
.sv-farmer .avatar { width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; background: var(--forest); color: #fff; font-weight: 700; font-size: .85rem; }
.sv-qs { padding-top: 6px; }
.sq-sec { padding: 14px 0 4px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.sq-sec h2 { margin: 0; font-size: 1.15rem; }
.sq { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 14px 0; border-bottom: 1px solid #edf3f0; }
.sq:last-child { border-bottom: 0; }
.sq-q { display: flex; gap: 10px; align-items: flex-start; }
.sq-label-t { font-weight: 600; font-size: 1rem; margin: 0; display: block; }
.sq-a { padding-left: 36px; max-width: 640px; }
.sq-ff-note { color: var(--forest-lit); }
.sq-cond-t { color: var(--copper-deep); }
.pill-opts { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.pill-opts label { position: relative; margin: 0; }
.pill-opts input { position: absolute; opacity: 0; inset: 0; }
.pill-opts span { display: inline-grid; place-items: center; min-width: 48px; padding: 7px 14px; border: 1px solid var(--field); border-radius: 999px; background: #fff; font-weight: 600; cursor: pointer; }
.pill-opts input:checked + span { background: var(--forest); border-color: var(--forest); color: #fff; }
.pill-opts input:focus-visible + span { outline: 2px solid var(--forest-lit); outline-offset: 2px; }
.rating-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.opt-list { display: flex; flex-direction: column; gap: 4px; }
.opt-list label { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid transparent; border-radius: 8px; font-weight: 400; margin: 0; cursor: pointer; }
.opt-list label:hover { background: var(--bg); }
.opt-list label:has(input:checked) { border-color: var(--forest-lit); background: var(--info-bg); }
.opt-list input[type=radio], .opt-list input[type=checkbox] { width: 18px; height: 18px; flex: none; }
.opt-list .opt-other input:not([type]) { flex: 1; }
.sq-num { display: flex; align-items: center; gap: 8px; max-width: 280px; } .sq-num span { color: var(--muted); }
.gps-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } .gps-row input { width: 150px; }
.gps-row .small { flex-basis: 100%; }
.sv-progress { margin: 4px 0 10px; }
.sv-desc { margin: -6px 0 16px; max-width: 80ch; }
.sr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; align-items: start; }
.sr-card { margin: 0; }
.sr-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.sr-head h3 { margin: 0 0 2px; font-size: 1rem; }
.sr-bars { width: 100%; border-collapse: collapse; }
.sr-bars td { padding: 4px 6px 4px 0; vertical-align: middle; font-size: .92rem; }
.sr-bars td:first-child { width: 42%; }
.sr-bar { width: 40%; }
.sr-bars .bar, .sr-print .bar { display: block; height: 10px; background: #e6eeea; border-radius: 3px; overflow: hidden; }
.sr-bars .bar i, .sr-print .bar i { display: block; height: 100%; background: var(--forest-lit); border-radius: 3px; }
.sr-big { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; } .sr-big b { font: 600 2rem/1 var(--serif); color: var(--forest); } .sr-big span { color: var(--muted); }
.sr-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; margin: 0; }
.sr-stats dt { font-size: .8rem; color: var(--muted); } .sr-stats dd { margin: 0; font-weight: 700; font-size: 1.05rem; }
.sr-texts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sr-texts li { padding-left: 10px; border-left: 2px solid var(--line); }
.sq-preview { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.sq-preview li { display: flex; gap: 10px; align-items: flex-start; }
.sq-preview li.sec { display: block; padding-top: 8px; border-top: 1px solid var(--line); } .sq-preview li.sec h3 { margin: 0; }
.sv-todo { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sv-todo li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.sv-todo li > div { display: flex; flex-direction: column; }
.doc table.qa td:first-child { color: var(--mut); width: 5%; }
.doc table.qa td:nth-child(2) { color: var(--mut); }
.doc table.qa td:nth-child(3) { font-weight: 600; }
.doc .sr-print { break-inside: avoid; }
.doc .sr-print .sr-bars td { font-size: inherit; padding: 2px 6px 2px 0; border: 0; background: none; }
.doc .sr-print .sr-stats { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 700px) { .sv-aud { grid-template-columns: 1fr; } .sq-a { padding-left: 0; } .sr-grid { grid-template-columns: 1fr; } .sq-tools { margin-left: 0; } }
.sv-aud-opt input[type=radio] { width: 18px; height: 18px; flex: none; margin: 3px 0 0; }
.sq-head .ss-btn, .sq-cond .ss-btn, .sq-ff .ss-btn, .sq-row .ss-btn { width: auto; min-width: 150px; flex: 0 1 auto; }
.sq-cond .ss-btn { max-width: 280px; }
.sq-head { padding-bottom: 2px; }
.opt-list input[type=radio], .opt-list input[type=checkbox], .sv-aud-opt input[type=radio] { min-height: 0; margin: 0; }
.opt-list label { margin: 0; }
.pill-opts input { min-height: 0; margin: 0; }
.doc .sr-stats dd { font-size: 1.05em; } .doc .sr-stats dt { font-size: .85em; } .doc .sr-texts li { border-left-color: var(--rule); }
.doc .total-box.four { grid-template-columns: 1fr 1fr 1fr 1.4fr; }
.doc table.terms tbody th { width: 24%; color: var(--mut); font-weight: 600; }
.doc table.terms td { line-height: 1.45; }
.doc table.ageing { margin-top: 8px; }
.doc table.ageing thead th { font-size: 8.5px; white-space: normal; }
@media (max-width: 700px) { .doc .total-box.four { grid-template-columns: 1fr; } }

/* survey skip logic, validation, calculations and paged filling */
.sq-intro { margin: -4px 0 12px; max-width: 90ch; } .sq-intro code, .sq-more code, .sq-row code { font-size: .85em; background: var(--bg); padding: 1px 4px; border-radius: 4px; }
.sq-card.is-note { border-left-color: #6b8fb3; background: #f7fafd; }
.sq-card.is-calc { border-left-color: #8a6bb3; background: #faf8fd; }
.sq-mores { display: flex; flex-direction: column; gap: 6px; }
.sq-more { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.sq-more > summary { display: flex; gap: 10px; align-items: baseline; padding: 7px 10px; cursor: pointer; list-style: none; flex-wrap: wrap; }
.sq-more > summary::-webkit-details-marker { display: none; }
.sq-more > summary::before { content: '▸'; color: var(--muted); font-size: .8rem; }
.sq-more[open] > summary::before { content: '▾'; }
.sq-more-t { font-weight: 600; font-size: .9rem; white-space: nowrap; }
.sq-more > summary .small { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sq-more[open] > summary .small { white-space: normal; }
.sq-more-b { display: flex; flex-direction: column; gap: 10px; padding: 4px 12px 12px; border-top: 1px dashed var(--line); }
.sq-join { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 8px; font-size: .92rem; }
.sq-rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sq-rules li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; border-radius: 8px; background: var(--bg); }
.sq-rules select, .sq-rules input:not([type=checkbox]), .sq-join select { width: auto; max-width: 280px; }
.sq-rules .ss-btn, .sq-join .ss-btn, .sq-inline .ss-btn, .sq-row .ss-btn { width: auto; min-width: 120px; max-width: 300px; }
.sq-in { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; } .sq-in .check { margin: 0; font-weight: 400; }
.sq-more-b > .sm { align-self: flex-start; }
.sq-inline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sq-formula { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.sq-note { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; padding: 12px 14px; border-radius: 10px; background: #eef4fa; border: 1px solid #d3e2f0; }
.sq-note .sq-label-t { font-weight: 500; }
.sq-note-i { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 999px; background: #3f6c97; color: #fff; font: 700 .8rem/1 var(--serif, serif); font-style: italic; }
.sq-calc output { display: inline-block; padding: 6px 12px; border-radius: 8px; background: #f3effa; font-weight: 700; font-size: 1.05rem; }
.sq-calc output.muted { font-weight: 400; font-size: .92rem; }
.sq-err { padding-left: 36px; color: #b3261e; font-size: .88rem; font-weight: 600; } .sq-err:empty { display: none; }
.sq.has-err .sq-a input, .sq.has-err .sq-a textarea { border-color: #b3261e; }
.sq.has-err .sq-n { background: #fbe9e7; color: #b3261e; }
.sv-unit.off-page { display: none; }
.sv-pager { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; margin-bottom: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.sv-pbar { flex: 1 1 100%; height: 6px; border-radius: 999px; background: #e6eeea; overflow: hidden; } .sv-pbar i { display: block; height: 100%; background: var(--forest-lit); transition: width .2s; }
.sv-ptext { flex: 1; } .sv-pager .ss-btn, .sv-jump { width: auto; max-width: 320px; }
.sv-nav { display: flex; justify-content: space-between; gap: 10px; padding-top: 14px; margin-top: 6px; border-top: 1px solid var(--line); }
.sv-nav button { min-width: 120px; }
.sv-review h2 { margin: 6px 0 4px; } .sv-review h3 { margin: 16px 0 6px; font-size: 1rem; }
.sv-rev { width: 100%; border-collapse: collapse; } .sv-rev td { padding: 7px 6px; border-bottom: 1px solid #edf3f0; vertical-align: top; }
.sv-rev td:first-child { color: var(--muted); width: 50%; } .sv-rev td:nth-child(2) { font-weight: 600; } .sv-rev td:last-child { text-align: right; width: 1%; white-space: nowrap; }
.sv-draft { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.sv-preview { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: var(--bg); }
.sv-preview-h { display: flex; gap: 10px; align-items: center; padding: 12px 18px; background: #fff; border-bottom: 1px solid var(--line); }
.sv-preview-h > div { flex: 1; }
.sv-preview-b { flex: 1; overflow: auto; padding: 18px; }
.sv-preview-in { max-width: 760px; margin: 0 auto; }
@media (max-width: 700px) { .sq-err { padding-left: 0; } .sv-nav button { min-width: 0; flex: 1; } .sv-preview-b { padding: 10px; } }
@media print { .sv-pager, .sv-nav { display: none; } }

/* repeat groups */
.sq-card.is-repeat { border-left-color: #2f7d6b; background: #f3faf7; }
.sq-card.in-repeat { margin-left: 22px; border-left-style: dashed; }
.sq-rep { margin: 12px 0; padding: 12px 14px; border: 1px solid #cfe3dc; border-radius: 12px; background: #f6fbf9; }
.sq-rep-h h2 { margin: 0 0 2px; font-size: 1.1rem; }
.sq-items { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.sq-item { padding: 4px 12px 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.sq-item-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0 2px; border-bottom: 1px solid #edf3f0; }
.sq-item .sq:last-child { border-bottom: 0; }
.sq-add-item { margin-top: 10px; }
.sq-rep > .sq-err { padding-left: 0; margin-top: 6px; }
.sq-preview li.rep h3 { color: #2f7d6b; }
.sq-preview li.in-rep { margin-left: 26px; padding-left: 10px; border-left: 2px dashed #cfe3dc; }

/* offline and the outbox */
#offline-bar { position: sticky; top: 0; z-index: 900; padding: 8px 14px; background: #5b4a12; color: #fff; font-size: .9rem; text-align: center; }
#outbox-pill { position: fixed; left: 14px; bottom: 14px; z-index: 800; padding: 9px 14px; border-radius: 999px; background: var(--forest); color: #fff; font-weight: 600; font-size: .9rem; text-decoration: none; box-shadow: 0 4px 14px rgba(14, 74, 64, .25); }
#outbox-pill.bad { background: var(--bad); }
#outbox-pill:focus-visible { outline: 3px solid var(--forest-lit); outline-offset: 2px; }
.ob-table { width: 100%; border-collapse: collapse; } .ob-table th, .ob-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
@media (max-width: 700px) { .sq-card.in-repeat { margin-left: 10px; } #outbox-pill { left: 10px; bottom: 10px; } }
@media print { #offline-bar, #outbox-pill { display: none; } }

/* farmer list import, long lists, cooperatives */
.more-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .8rem .2rem .2rem; }
.imp-sum { border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; margin-top: .6rem; background: #f6faf8; }
.imp-sum.ok { border-color: #9cc9b4; background: #eef7f2; }
.imp-sum .small { margin-top: .3rem; }
.imp-h { font-size: 1rem; margin: 1rem 0 .4rem; }
.imp-iss td { vertical-align: top; }
.imp-iss td.num { width: 4.5rem; font-weight: 600; }
tr.org-child td:first-child { padding-left: 2rem; }
.danger-t { color: var(--danger, #b3261e); }
.plot-map .plots-wrap { flex: 1 1 100%; max-height: 280px; overflow: auto; border-top: 1px solid var(--rule); padding: 6px 22px 14px; }
.plot-map .plots-wrap table { width: 100%; }
.plot-map .plots-wrap th { text-align: left; }
.plot-map .plots-wrap th.num { text-align: right; }
