/* Roast Partner: minimal neutral UI. Navy only on the sidebar and primary buttons; colour only on status bubbles. */
:root {
  --bg: #ffffff; --panel: #ffffff; --panel-2: #fafafa; --hover: #f5f5f5;
  --ink: #202020; --ink-2: #666666; --ink-3: #999999;
  --line: #f0f0f0; --line-2: #e6e6e6;
  --accent: #16295a; --accent-hover: #1f3672; --accent-ink: #ffffff; --accent-soft: #eef1f8; --accent-soft-ink: #16295a;
  --ok: #1a7f4b; --ok-soft: #e4f5ec; --warn: #9a5b00; --warn-soft: #fdf1dc; --bad: #c0352b; --bad-soft: #fde9e7;
  --info: #2860b5; --info-soft: #e6effc;
  --side: #0f1c36; --side-ink: #dfe6f3; --side-ink-2: #8c9ab3; --side-active: #1d2f58; --side-mark: #ffffff;
  --badge-bg: #ffffff; --badge-ink: #0f1c36;
  --radius: 8px; --focus: 0 0 0 3px rgba(22, 41, 90, .14);
  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191919; --panel: #191919; --panel-2: #202020; --hover: #252525;
    --ink: #ebebeb; --ink-2: #b4b4b4; --ink-3: #7f7f7f; --line: #2a2a2a; --line-2: #363636;
    --accent: #2a4592; --accent-hover: #3352aa; --accent-ink: #ffffff; --accent-soft: #1f2840; --accent-soft-ink: #b4c6f5;
    --ok: #5ccb8f; --ok-soft: #16301f; --warn: #e6b450; --warn-soft: #33280f; --bad: #f2786b; --bad-soft: #3a1b18;
    --info: #86b4f3; --info-soft: #172840; --side: #0b1428; --side-active: #182748;
    --focus: 0 0 0 3px rgba(134, 160, 230, .25);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink-3); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 600; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 232px; flex: 0 0 232px; background: var(--side); color: var(--side-ink); padding: 14px 10px 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; font-size: 15px; color: var(--side-title); }
.brand .bean { width: 26px; height: 26px; flex: none; }
.brand small { display: block; font-weight: 400; color: var(--side-ink-2); font-size: 11px; }
.side-close { display: none; margin-left: auto; color: var(--side-ink); font-size: 20px; }
.nav-group { margin-top: 10px; }
.nav-group > .label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-ink-2); padding: 6px 10px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--side-ink); padding: 7px 10px; border-radius: 6px; font-size: 13.5px; text-decoration: none; }
.nav a:hover { background: var(--side-active); }
.nav a.active { background: var(--side-active); color: var(--side-title); box-shadow: inset 3px 0 0 var(--side-mark); }
.nav a .ico { width: 18px; text-align: center; opacity: .85; }
.nav a .badge { margin-left: auto; background: var(--badge-bg); color: var(--badge-ink); border-radius: 10px; font-size: 11px; padding: 0 7px; font-weight: 600; }
.scrim { display: none; }
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px max(40px, calc((100% - 1240px) / 2 + 40px)); border-bottom: 1px solid transparent; background: var(--bg); position: sticky; top: 0; z-index: 5; min-height: 53px; }
.crumbs { color: var(--ink-3); font-size: 13px; flex: 1; min-width: 0; }
.crumbs b { color: var(--ink); font-weight: 500; }
.menu-btn { display: none; }
.main { padding: 24px 40px 80px; max-width: 1240px; width: 100%; margin: 0 auto; }
@media (max-width: 900px) {
  .cols, .cols-even { gap: 32px; }
  .sidebar { position: fixed; z-index: 40; left: -260px; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  .sidebar.open + .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15,15,20,.35); }
  .side-close { display: inline-flex; }
  .menu-btn { display: inline-flex; }
  .main { padding: 18px 16px 60px; }
  .topbar { padding: 8px 16px; }
  .t td:first-child, .t th:first-child { padding-left: 0; }
}

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.page-head > div:first-child { flex: 1 1 420px; min-width: 0; }
.page-head > :not(:first-child) { flex: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); padding: 6px 11px; border-radius: 6px; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; line-height: 1.4; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ok { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ok:hover { background: var(--accent-hover); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.btn.lg { padding: 9px 16px; font-size: 14.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; font-size: 18px; cursor: pointer; color: inherit; padding: 4px 8px; border-radius: 6px; line-height: 1; }
.icon-btn:hover { background: var(--hover); }
.sidebar .icon-btn:hover { background: var(--side-active); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line-2); border-radius: 6px; padding: 7px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input[type=checkbox], input[type=radio] { width: auto; padding: 0; accent-color: var(--accent); }
select:not([multiple]):not([size]) { -webkit-appearance: none; appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238a8f98' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px; }
input[type=radio] { margin: 0 4px 0 0; vertical-align: -2px; }
textarea { min-height: 70px; resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); font-weight: 500; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
@media (max-width: 700px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }
.search { max-width: 260px; }

/* ---------- cards / panels ---------- */
.card { background: transparent; }
.card-h { padding: 0 0 10px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.card-b { padding: 14px 0; }
.card + .card, .stack > * + * { margin-top: 36px; }
.cols > *, .cols-even > * { margin-top: 0 !important; }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 48px; align-items: start; }
.cols-even { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 36px 48px; align-items: start; }
@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 40px; }
.kpi { background: var(--panel-2); border: 0; border-radius: var(--radius); padding: 14px 16px; display: block; color: inherit; text-decoration: none; }
.kpi:hover { background: var(--hover); }
.kpi .v { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-3); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 500; padding: 10px 10px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tr:last-child td { border-bottom: 1px solid var(--line); }
table.t td:first-child, table.t th:first-child { padding-left: 0; }
table.t td:last-child, table.t th:last-child { padding-right: 0; }
.t tfoot td { border-top: 1px solid var(--line); }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: var(--panel-2); }
.t tr.click:hover td:first-child { box-shadow: -10px 0 0 var(--panel-2); }
.t tr.click:hover td:last-child { box-shadow: 10px 0 0 var(--panel-2); }
.t td.num, .t th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t.compact td, .t.compact th { padding: 8px 10px; }

/* ---------- status bubbles (the one place colour lives) ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500; background: var(--hover); color: var(--ink-2); white-space: nowrap; line-height: 1.6; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.accent { background: var(--accent-soft); color: var(--accent-soft-ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.tag-list { display: flex; gap: 4px; flex-wrap: wrap; }

/* ---------- tabs / segmented ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 8px 10px; color: var(--ink-3); border-bottom: 2px solid transparent; font-weight: 500; white-space: nowrap; text-decoration: none; margin-bottom: -1px; }
.tabs a.active { color: var(--ink); border-color: var(--ink); }
.tabs a:hover { color: var(--ink); }
.seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--hover); border-radius: 7px; }
.seg button { border: 0; background: transparent; padding: 4px 10px; font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; border-radius: 5px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--panel); color: var(--ink); font-weight: 500; box-shadow: 0 0 0 1px var(--line-2); }

/* ---------- roast / pack cards ---------- */
.item-card { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 16px 0 18px 16px; }
.item-card.full { box-shadow: inset 3px 0 0 var(--ok); }
.item-card.partial { box-shadow: inset 3px 0 0 var(--warn); }
.item-card.none { box-shadow: inset 3px 0 0 var(--line-2); }
.stack > .item-card + .item-card { margin-top: 0; }
.item-card .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.batch-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.batch-row:first-of-type { border-top: 0; }
.batch-row .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--hover); color: var(--ink-2); font-weight: 600; font-size: 12px; flex: none; }
.batch-row .grow { flex: 1; min-width: 0; }
.bar { height: 6px; background: var(--hover); border-radius: 6px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ok); }
.bar.warn > span { background: var(--warn); }
.bar.bad > span { background: var(--bad); }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: transparent; padding: 0; min-height: 200px; }
.kcol h3 { display: flex; justify-content: space-between; font-size: 12px; font-weight: 500; color: var(--ink-3); margin-bottom: 8px; padding: 0 2px; }
.kcol.drop { outline: 2px dashed var(--line-2); }
.kcard { background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; cursor: grab; }
.kcard:hover { border-color: var(--line-2); }
.kcard .t1 { font-weight: 500; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15,15,20,.35); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: var(--panel); border-radius: 10px; width: 100%; max-width: 640px; box-shadow: 0 16px 48px rgba(0,0,0,.16); border: 1px solid var(--line); }
.modal.wide { max-width: 980px; }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 10px; }
.modal-b { padding: 16px 18px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-f .left { margin-right: auto; }

.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: #191a1c; color: #fff; padding: 9px 14px; border-radius: 7px; box-shadow: 0 6px 20px rgba(0,0,0,.18); max-width: 380px; animation: tin .2s; font-size: 13px; }
.toast.err { background: var(--bad); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

.line-items { width: 100%; border-collapse: collapse; }
.line-items td, .line-items th { padding: 4px; }
.line-items th { font-size: 12px; color: var(--ink-3); text-align: left; font-weight: 500; }
.callout { padding: 10px 12px; border-radius: 6px; background: var(--panel-2); color: var(--ink-2); font-size: 13px; }
.callout.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.callout.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--ink-3); font-size: 12.5px; }
dl.kv dd { margin: 0; }
details > summary { color: var(--ink-2); }
.chart { width: 100%; height: auto; display: block; }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--ink-3); font-size: 10px; font-family: var(--font); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }

/* ---------- delivery note ---------- */
.note-page { max-width: 820px; margin: 0 auto; }
.note-paper { background: #fff; color: #191a1c; border: 1px solid var(--line); border-radius: 8px; padding: 32px 36px; }
.note-paper .t th { color: #7a7d84; }
.note-paper .t td, .note-paper .t th { border-color: #ececee; }
.sig-box { border: 1.5px dashed #c9cbd0; border-radius: 8px; background: #fcfcfd; touch-action: none; width: 100%; height: 190px; display: block; cursor: crosshair; }
.sig-img { max-width: 360px; border-bottom: 1px solid #333; }
@media print {
  .sidebar, .topbar, .no-print, .toasts, .scrim { display: none !important; }
  .main { padding: 0; max-width: none; }
  body { background: #fff; }
  .note-paper { border: 0; padding: 0; }
}

/* ---------- table tools: resize + columns ---------- */
.tbl-tools { position: relative; display: flex; justify-content: flex-end; margin: -4px 0 2px; }
.tbl-tools .btn { color: var(--ink-3); font-size: 12px; padding: 2px 6px; }
.tbl-tools .btn:hover { color: var(--ink); }
.rs-th { position: relative; }
.col-grip { position: absolute; top: 0; right: 0; width: 9px; height: 100%; cursor: col-resize; z-index: 2; }
.col-grip::after { content: ''; position: absolute; top: 25%; bottom: 25%; left: 4px; width: 1px; background: transparent; }
.rs-th:hover .col-grip::after { background: var(--line-2); }
.col-grip:hover::after, .col-grip:active::after { background: var(--accent) !important; }
table.t[style*="fixed"] td { overflow: hidden; text-overflow: ellipsis; }
.col-menu { position: absolute; right: 0; top: 100%; z-index: 20; background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,.12); padding: 6px; min-width: 210px; max-height: 360px; overflow: auto; }
.col-menu label { display: flex; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 5px; font-size: 13px; cursor: pointer; }
.col-menu label:hover { background: var(--hover); }
.col-menu-f { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.t tr.group td { background: var(--panel-2); padding-top: 9px; padding-bottom: 9px; padding-left: 10px !important; border-bottom: 1px solid var(--line-2); }
.t tr.sub td { padding-top: 5px; padding-bottom: 5px; border-bottom-style: dashed; }

/* ---------- packing station (iPad) ---------- */
body.station .sidebar, body.station .topbar, body.station .scrim { display: none !important; }
body.station .main { max-width: none; padding: 20px 24px 40px; }
body.station { -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.st-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.st-head h1 { font-size: 26px; }
.st-actions { display: flex; gap: 8px; }
.st-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; min-width: 52px; padding: 0 22px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); font: inherit; font-size: 17px; font-weight: 600; cursor: pointer; text-decoration: none; }
.st-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.st-btn.ghost { border-color: transparent; background: var(--panel-2); }
.st-btn:disabled { opacity: .5; }
.st-grid { display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: 20px; align-items: start; }
.st-list { max-height: calc(100vh - 110px); overflow-y: auto; }
.st-detail { position: sticky; top: 12px; }
.st-list { display: flex; flex-direction: column; gap: 8px; }
.st-coffee { position: relative; text-align: left; padding: 16px 18px 16px 22px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel); font: inherit; cursor: pointer; }
.st-coffee.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.st-name { display: block; font-size: 17px; font-weight: 600; }
.st-sub { display: block; color: var(--ink-3); font-size: 14px; margin-top: 2px; }
.st-dot { position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 3px 3px 0; background: var(--line-2); }
.st-dot.full { background: var(--ok); } .st-dot.partial { background: var(--warn); } .st-dot.none { background: var(--bad); }
.st-card { background: var(--panel); }
.st-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.st-title h2 { font-size: 24px; }
.st-line { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.st-size { font-size: 22px; font-weight: 700; }
.st-grind { font-size: 16px; color: var(--ink-2); }
.st-meta { font-size: 13px; color: var(--ink-3); margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.st-count { display: flex; align-items: center; gap: 6px; }
.st-count input { width: 92px; height: 52px; font-size: 22px; font-weight: 600; text-align: center; border-radius: 10px; }
.st-step { width: 52px; height: 52px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 26px; color: var(--ink); cursor: pointer; }
.st-left { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center; margin-top: 28px; padding: 16px; background: var(--panel-2); border-radius: 12px; }
.st-left .st-count input { width: 130px; font-size: 18px; }
.st-empty { color: var(--ink-3); font-size: 18px; padding: 60px 0; text-align: center; }
@media (max-width: 900px) { .st-line, .st-left { grid-template-columns: 1fr auto; } .st-line .st-btn, .st-left .st-btn { grid-column: 1 / -1; } }
@media (max-width: 640px) { .st-grid { grid-template-columns: 1fr; } .st-list { max-height: none; } .st-detail { position: static; } }

/* ---------- driver (phone) ---------- */
.dr { max-width: 640px; margin: 0 auto; }
.dr-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; }
.dr-tours { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.dr-tours button { flex: none; display: inline-flex; gap: 6px; align-items: center; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); font: inherit; font-size: 15px; }
.dr-tours button.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; font-weight: 600; }
.dr-wide { width: 100%; margin-top: 12px; }
.dr-stop { display: flex; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.dr-n { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.dr-body { flex: 1; min-width: 0; }
.dr-name { font-size: 19px; font-weight: 700; }
.dr-addr { display: block; font-size: 16px; margin-top: 2px; }
.dr-note { margin-top: 6px; font-size: 14px; background: var(--warn-soft); color: var(--warn); padding: 6px 10px; border-radius: 8px; }
.dr-items { margin-top: 8px; color: var(--ink-2); font-size: 15px; }
.dr-meta { margin-top: 4px; color: var(--ink-3); font-size: 14px; }
.dr-done { max-width: 820px; margin: 0 auto 16px; padding: 16px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); font-size: 15px; line-height: 1.6; }
.dr-done-t { font-size: 19px; font-weight: 700; }
body.station .note-page { max-width: 820px; }
@media (max-width: 600px) { .note-paper { padding: 18px 16px; } body.station .main { padding: 12px 12px 40px; } .note-paper .grid.g2 { grid-template-columns: 1fr; } }

/* ---------- roast console ---------- */
.rc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.rc-title { flex: 1; min-width: 0; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-grid { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 24px; align-items: start; }
.rc-time { font-size: 72px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; color: var(--ink-3); }
.rc-time.live { color: var(--ink); }
.rc-reads { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; }
.rc-reads div { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; }
.rc-reads span { display: block; font-size: 12px; color: var(--ink-3); }
.rc-reads b { font-size: 26px; font-variant-numeric: tabular-nums; }
.rc-reads b.ok { color: var(--ok); } .rc-reads b.warn { color: var(--warn); } .rc-reads b.bad { color: var(--bad); }
.rc-events { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rc-ev { min-height: 64px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel); font: inherit; font-size: 16px; font-weight: 600; color: var(--ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.rc-ev small { font-size: 12px; font-weight: 400; color: var(--ink-3); }
.rc-ev[data-ev=charge] { background: var(--accent); color: #fff; border-color: var(--accent); }
.rc-ev[data-ev=charge] small { color: #c9d3ea; }
.rc-ev[data-ev=drop] { border-color: var(--accent); color: var(--accent); }
.rc-ev.done { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.rc-ev:disabled { opacity: .45; cursor: default; }
.rc-ev.done:disabled { opacity: 1; }
.rc-log { display: flex; gap: 8px; margin-top: 14px; }
.rc-log input, .rc-log select { height: 52px; font-size: 18px; border-radius: 10px; }
.rc-fin { margin-top: 18px; padding: 16px; background: var(--panel-2); border-radius: 12px; }
.rc-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.rc-pick .st-coffee { text-decoration: none; color: inherit; }
@media (max-width: 900px) { .rc-grid { grid-template-columns: 1fr; } .rc-time { font-size: 56px; } }

[hidden] { display: none !important; }

/* ---------- colour themes (Settings → Appearance) ---------- */
:root { --side-title: #ffffff; --logo-bg: #ffffff; --logo-fg: #16295a; }
:root[data-mode="accent"] .sidebar { border-right: 1px solid var(--line); }
:root[data-mode="accent"] .nav a.active { color: var(--accent-soft-ink); }

/* ---------- sign-in & user ---------- */
.shell.signed-out .sidebar, .shell.signed-out .topbar { display: none !important; }
body.auth .main { display: grid; place-items: center; min-height: 100vh; }
.auth-box { width: 100%; max-width: 380px; padding: 8px; }
.auth-logo { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; font-size: 17px; }
.auth-box h1 { margin-bottom: 10px; }
.auth-box form { margin-top: 16px; }
.side-user { display: flex; align-items: center; gap: 4px; margin: 18px 4px 0; padding-top: 14px; border-top: 1px solid rgba(127,127,127,.25); }
.side-user > div { flex: 1; min-width: 0; padding-left: 6px; }
.side-user b { display: block; font-size: 13px; color: var(--side-title); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { color: var(--side-ink-2); font-size: 11px; }
.side-user .icon-btn { color: var(--side-ink); font-size: 16px; }

/* roast list: drag profiles by their header to reorder */
.rhead { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.rgroup.dragging { opacity: .7; position: relative; z-index: 5; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.rgroup.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.rgroup.drop-after { box-shadow: 0 3px 0 var(--accent); }
.small.bad, td.bad { color: var(--bad); }

/* driver: load the van */
.dr-load { border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.dr-load.done { background: var(--ok-soft); border-color: transparent; }
.dr-load-h { display: flex; justify-content: space-between; align-items: center; font-size: 17px; cursor: pointer; }
.dr-load.done .dr-load-h { color: var(--ok); }
.dr-lrow { display: flex; gap: 12px; width: 100%; text-align: left; align-items: flex-start; padding: 12px 4px; border: 0; border-top: 1px solid var(--line); background: none; font: inherit; color: var(--ink); cursor: pointer; }
.dr-check { flex: none; width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--line-2); display: grid; place-items: center; font-weight: 700; font-size: 17px; }
.dr-lrow.on .dr-check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.dr-lrow.on .dr-lbody { opacity: .55; }
.dr-lbody { display: flex; flex-direction: column; gap: 2px; font-size: 16px; }

/* shipping */
.ship-grid { display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: 16px; align-items: start; }
.ship-list { padding: 6px; }
.ship-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 12px; border: 0; border-radius: 10px; background: none; font: inherit; color: var(--ink); cursor: pointer; }
.ship-item > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.ship-item.on { background: var(--accent-soft); }
.ship-to { border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; line-height: 1.45; }
.ship-to.bad { border-color: var(--bad); background: var(--bad-soft); }
.ship-check { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.ship-check input { width: 22px; height: 22px; }
.ship-parcel { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.ship-parcel select { flex: 1; }
.ship-w { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.ship-w input { width: 80px; text-align: right; }
.ship-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.ship-actions select { width: auto; }
@media (max-width: 860px) { .ship-grid { grid-template-columns: 1fr; } }

/* compare / analytics charts */
.cmp-wrap { position: relative; }
.cmp-tip { position: absolute; top: 8px; z-index: 3; background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; font-size: 12.5px; box-shadow: 0 4px 14px rgba(0,0,0,.08); pointer-events: none; white-space: nowrap; }
.cmp-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.cmp-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 12px; font-size: 13px; }
.cmp-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
/* cupping */
.cup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.cup-total { font-size: 26px; font-weight: 700; line-height: 1; }
.cup-row { display: grid; grid-template-columns: 140px 1fr 48px; gap: 10px; align-items: center; padding: 5px 0; font-size: 14px; }
.cup-row b { text-align: right; font-variant-numeric: tabular-nums; }
.cup-row input[type=range] { accent-color: var(--accent); padding: 0; border: 0; }
.cup-cups { display: flex; gap: 4px; }
.cup-cups button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--panel); color: var(--line-2); font-size: 14px; cursor: pointer; }
.cup-cups button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.cup-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 12px; max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.cup-card [data-sca], .cup-card [data-quick] { margin-top: 10px; }
.cup-grid > .card { margin: 0; }

/* tasks */
.task { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.task:last-of-type { border-bottom: 0; }
.task-check { flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--line-2); background: none; cursor: pointer; font-size: 12px; line-height: 1; color: var(--accent-ink); }
.task-check:hover { border-color: var(--accent); }
.task-check.on, .task.task-done .task-check { background: var(--accent); border-color: var(--accent); }
.task.task-done .task-body { opacity: .45; text-decoration: line-through; }
.task-body { flex: 1; min-width: 0; cursor: pointer; }
.task-title { font-size: 14.5px; }
.task.overdue .task-title { color: var(--bad); }
.task-add { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.task-add input[name=title] { flex: 1; }
.task-add input[type=date] { width: 140px; }
.task-card { margin-bottom: 14px; }
.dr-task { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; margin-top: 8px; padding: 10px; border: 1px solid var(--warn); border-radius: 10px; background: var(--warn-soft); font: inherit; color: var(--ink); cursor: pointer; }
.dr-task.on { opacity: .5; }
.dr-task.on .dr-check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
/* machines */
.mach { border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.mach-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.mach-plan { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.task-add { flex-wrap: wrap; }
.task-add input[name=title] { flex: 1 1 100%; }
.task-add input[type=date] { flex: 1; }
.miss { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.miss-i { display: inline-flex; align-items: center; gap: 4px; }

/* service report */
.sj .card { margin-bottom: 14px; }
.sj-plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 12px; }
.sj-part { display: grid; grid-template-columns: 1fr 110px 70px 90px 32px; gap: 6px; margin-bottom: 6px; }
@media (max-width: 600px) { .sj-part { grid-template-columns: 1fr 1fr; } .sj-part [name=pname] { grid-column: 1 / -1; } }
/* top-bar buttons: clear gap between them */
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* department dashboards */
.kpi .v.bad-t { color: var(--bad); }
.kpi .v.warn-t { color: var(--warn); }
.pipe { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pipe-s { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border-radius: 10px; background: var(--panel-2); color: var(--ink); text-decoration: none; }
.pipe-s b { font-size: 22px; }

/* AI helper */
.ai-brief { background: var(--accent-soft); color: var(--ink); border-radius: 10px; padding: 10px 14px; max-width: 560px; }
.ai-brief-h { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.ai-brief ul { margin: 6px 0 0; padding-left: 18px; }
.ai-brief li { margin: 3px 0; }
tr.ai-miss td { background: var(--warn-soft); }
