:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #f8f9fa;
  --line: #e2e5e9;
  --line-2: #cfd4da;
  --text: #1b2129;
  --muted: #69727d;
  --accent: #2357d9;
  --accent-soft: #e8eefc;
  --ok: #17803d;
  --ok-soft: #e4f4e9;
  --warn: #a35b00;
  --warn-soft: #fdf1df;
  --bad: #c42b2b;
  --bad-soft: #fbe6e6;
  --side: #13213C;
  --side-text: #c3cbd9;
  --brand-ink: #13213C;
  --brand-amber: #F2A33A;
  --brand-steel: #8FA0BC;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1318;
    --panel: #171c23;
    --panel-2: #1c222a;
    --line: #2a313b;
    --line-2: #39424e;
    --text: #e5e9ee;
    --muted: #8d97a3;
    --accent: #6c95ff;
    --accent-soft: #1d2a47;
    --ok: #4cc27a;
    --ok-soft: #15301f;
    --warn: #f0a83e;
    --warn-soft: #36280f;
    --bad: #ff7272;
    --bad-soft: #3b1a1a;
    --side: #0d1729;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 16px; }

/* Layout */
.app { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { color: #fff; font-weight: 700; font-size: 16px; padding: 4px 10px 18px; display: flex; gap: 10px; align-items: center; }
.brand .mark { width: 26px; height: 26px; border-radius: 6px; background: var(--accent); display: grid; place-items: center; font-size: 13px; color: #fff; }
.brand small { display: block; font-weight: 400; font-size: 11px; color: var(--side-text); opacity: 0.8; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--side-text); padding: 8px 10px; border-radius: 6px; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, 0.06); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(255, 255, 255, 0.1); color: #fff; }
.nav svg { width: 17px; height: 17px; opacity: 0.85; flex: none; }
.side .me { margin-top: auto; padding: 10px; font-size: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.side .me button { background: none; border: 0; color: var(--side-text); padding: 0; cursor: pointer; text-decoration: underline; font: inherit; }
main { padding: 24px 28px 64px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.mobile-top { display: none; }

/* Panels */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .hd { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.card > .bd { padding: 16px; }
.card > .bd.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.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)); }
.job-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }

/* KPI tiles */
.tile { padding: 14px 16px; }
.tile .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.tile .value { font-size: 24px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tile.bad .value { color: var(--bad); }

/* Forms */
label.f { display: block; }
label.f > span { display: block; font-size: 12px; font-weight: 550; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: 6px;
  padding: 7px 9px; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type="checkbox"] { width: auto; }
input.in-cell, select.in-cell { padding: 5px 6px; border-color: transparent; background: transparent; }
input.in-cell:hover, select.in-cell:hover { border-color: var(--line-2); }
input.in-cell:focus, select.in-cell:focus { background: var(--panel); border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.help { font-size: 12px; color: var(--muted); margin-top: 4px; }
code, .code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--panel-2); border: 1px solid var(--line); padding: 2px 6px; border-radius: 4px; word-break: break-all; }

/* Buttons */
.btn {
  font: inherit; font-weight: 550; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px;
  border-radius: 6px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 8px; font-size: 12px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn svg { width: 15px; height: 15px; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 4px; line-height: 0; }
.icon-btn:hover { color: var(--text); background: var(--panel-2); }
.icon-btn svg { width: 15px; height: 15px; }
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 4px; z-index: 30; min-width: 210px; }
.menu-list button, .menu-list a { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 5px; font: inherit; color: var(--text); cursor: pointer; }
.menu-list button:hover, .menu-list a:hover { background: var(--panel-2); text-decoration: none; }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* Tables */
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover td { background: var(--panel-2); }
table.t th.num, table.t td.num { text-align: right; }
.table-wrap { overflow-x: auto; }
table.lines { min-width: 1020px; }
table.lines td { padding: 4px 6px; }
table.lines th { padding: 8px 6px; }
table.lines tr.heading td { background: var(--panel-2); }
table.lines tr.heading input { font-weight: 650; }
table.lines .type { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--muted); letter-spacing: 0.04em; }
table.lines tr.short td { background: var(--bad-soft); }
.empty { padding: 32px; text-align: center; color: var(--muted); }

/* Badges */
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.st-draft { }
.st-sent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.st-provisional { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.st-accepted { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.st-dispatched { background: #6b3fd4; color: #fff; border-color: transparent; }
.st-returned { background: var(--panel-2); color: var(--text); }
.st-invoiced { background: #13213C; color: #fff; border-color: transparent; }
.st-cancelled { background: var(--panel-2); color: var(--muted); text-decoration: line-through; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; font: inherit; font-weight: 550; padding: 9px 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--text); border-color: var(--accent); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pills button { font: inherit; font-size: 13px; border: 1px solid var(--line-2); background: var(--panel); padding: 5px 11px; border-radius: 999px; cursor: pointer; color: var(--text); }
.pills button.active { background: var(--text); color: var(--panel); border-color: var(--text); }

/* Totals */
.totals { width: 100%; }
.totals td { padding: 5px 0; }
.totals td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.totals tr.grand td { font-weight: 700; font-size: 17px; border-top: 1px solid var(--line); padding-top: 10px; }
.sync-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }

/* Stock picker */
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.14); max-height: 340px; overflow: auto; z-index: 40; }
.picker-list .opt { display: flex; gap: 10px; justify-content: space-between; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.picker-list .opt:last-child { border-bottom: 0; }
.picker-list .opt.hl, .picker-list .opt:hover { background: var(--accent-soft); }

/* Scan box */
.scan { display: flex; gap: 10px; align-items: stretch; }
.scan input { font-size: 18px; padding: 10px 12px; }
.seg { flex: none; display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button { white-space: nowrap; font: inherit; font-weight: 600; border: 0; background: var(--panel); padding: 0 16px; cursor: pointer; color: var(--muted); }
.seg button.active.out { background: #6b3fd4; color: #fff; }
.seg button.active.in { background: var(--ok); color: #fff; }
.flash { padding: 10px 14px; border-radius: 8px; font-weight: 600; margin-top: 10px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.bad { background: var(--bad-soft); color: var(--bad); }
.progress { height: 6px; background: var(--panel-2); border-radius: 999px; overflow: hidden; min-width: 60px; }
.progress > i { display: block; height: 100%; background: var(--ok); }

/* Toasts & modal */
#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--text); color: var(--panel); padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 380px; font-weight: 500; }
.toast.bad { background: var(--bad); color: #fff; }
.modal-bg { position: fixed; inset: 0; background: rgba(10, 14, 20, 0.45); display: grid; place-items: center; z-index: 80; padding: 16px; }
.modal { background: var(--panel); border-radius: 10px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal .hd { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal .bd { padding: 18px; }
.modal .ft { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .card { width: min(400px, 100%); }
.auth .bd > * + * { margin-top: 12px; }
.err { color: var(--bad); font-size: 13px; }
.dirty-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }

@media (max-width: 1100px) {
  .job-layout { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 90; transform: translateX(-100%); transition: transform .2s; height: 100%; }
  .side.open { transform: none; }
  .mobile-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--side); color: #fff; position: sticky; top: 0; z-index: 20; }
  .mobile-top button { background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; }
  main { padding: 16px 16px 64px; }
  .g2, .g3, .form-grid { grid-template-columns: minmax(0, 1fr); }
}
@media print { .side, .mobile-top, .page-head .btn { display: none; } .app { display: block; } }

/* Packages in the quote editor */
table.lines tr.pkg-line td { background: var(--accent-soft); }
table.lines tr.pkg-item td { background: var(--panel-2); font-size: 13px; }
table.lines tr.pkg-item .type { text-transform: none; letter-spacing: 0; font-weight: 500; }

/* Quote branding */
.brand-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; align-items: start; }
.logo-drop { border: 1px dashed var(--line-2); border-radius: 8px; height: 96px; display: grid; place-items: center; background: #fff; padding: 10px; }
.logo-drop img { max-height: 76px; max-width: 100%; }
input.swatch { width: 44px; height: 34px; padding: 2px; cursor: pointer; }
.quote-mini { background: #fff; color: #1d232b; border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; font-size: 12px; box-shadow: var(--shadow); }
.qm-head { display: flex; justify-content: space-between; gap: 12px; border-bottom: 3px solid; padding-bottom: 10px; margin-bottom: 10px; }
.qm-title { font-size: 18px; font-weight: 700; }
.qm-proj { font-weight: 600; font-size: 13px; }
.qm-muted { color: #66707c; }
.qm-co { text-align: right; } .qm-co img { display: block; max-height: 40px; max-width: 140px; margin: 0 0 4px auto; }
.qm-th, .qm-row, .qm-total { display: flex; justify-content: space-between; padding: 5px 0; }
.qm-th { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; border-bottom: 2px solid; }
.qm-row { border-bottom: 1px solid; }
.qm-total { font-weight: 700; font-size: 14px; border-top: 3px solid; margin-top: 8px; padding-top: 7px; margin-left: 45%; }

/* Calendar */
.cal-wrap { overflow-x: auto; }
#cal { min-width: 760px; }
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.cal-head div { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 3px; border-bottom: 1px solid var(--line); min-height: 96px; }
.cal-week:last-child { border-bottom: 0; }
.cal-day { border-right: 1px solid var(--line); padding: 5px 8px; font-size: 12px; font-weight: 600; color: var(--text); }
.cal-day:nth-child(7) { border-right: 0; }
.cal-day.other { background: var(--panel-2); color: var(--muted); font-weight: 400; }
.cal-day.today span { background: var(--accent); color: #fff; border-radius: 999px; padding: 2px 7px; }
.cal-bar { position: relative; z-index: 1; margin: 0 4px; padding: 3px 8px; border-radius: 5px; font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); }
.cal-bar:hover { text-decoration: none; filter: brightness(0.96); }
.cal-bar.cl { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal-bar.cr { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line-2); background: var(--panel-2); }
@media (max-width: 760px) { .brand-grid { grid-template-columns: minmax(0, 1fr); } }

.totals tr.grand td { font-size: 19px; }
.totals tr.minor td { font-size: 12.5px; color: var(--muted); font-weight: 400; padding: 2px 0; }
.qm-minor { display: flex; justify-content: space-between; margin-left: 45%; color: #66707c; font-size: 11px; padding: 1px 0; }
.cal-bar.st-sent, .cal-dot.st-sent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.cal-bar.st-provisional, .cal-dot.st-provisional { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); border-style: dashed; }
.cal-bar.st-accepted, .cal-dot.st-accepted { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.cal-bar.st-dispatched, .cal-dot.st-dispatched { background: #6b3fd4; color: #fff; border-color: #6b3fd4; }
.cal-bar.st-returned, .cal-dot.st-returned { background: var(--panel); color: var(--text); border-color: var(--line-2); }
.cal-bar.st-invoiced, .cal-dot.st-invoiced { background: var(--panel-2); color: var(--muted); border-color: var(--line); }
.cal-bar.st-cancelled { background: var(--panel-2); color: var(--muted); text-decoration: line-through; }
.cal-bar.st-draft, .cal-dot.st-draft { background: var(--panel); color: var(--text); border-color: var(--muted); border-style: dotted; }

/* Categories */
.cat-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; }
.cat-label i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
h1 .cat-label { font-size: 22px; } h1 .cat-label i { width: 14px; height: 14px; border-radius: 4px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.choice { position: relative; display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 18px 18px 16px 22px; min-height: 128px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); color: var(--text); font: inherit; cursor: pointer; overflow: hidden; }
.choice:hover { border-color: var(--c, var(--accent)); text-decoration: none; transform: translateY(-1px); }
.choice strong { font-size: 16px; display: flex; align-items: center; gap: 6px; }
.choice strong svg { width: 16px; height: 16px; }
.choice-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--c, var(--accent)); }
.choice-count { margin-top: auto; color: var(--text); font-weight: 550; }
.choice.dashed { border-style: dashed; background: transparent; box-shadow: none; }
.cat-card { border-left: 4px solid var(--c); }
.swatch-pick input { display: none; }
.swatch-pick i { display: inline-block; width: 26px; height: 26px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; box-shadow: inset 0 0 0 2px var(--panel); }
.swatch-pick input:checked + i { border-color: var(--text); }

/* Reports */
.chart { position: relative; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .base-line { stroke: var(--line-2); stroke-width: 1; }
.chart .axis-text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .seg { transition: opacity .12s; }
.chart .seg.dim { opacity: 0.35; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text); }
.legend-item i { width: 10px; height: 10px; border-radius: 3px; }
.tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.14); border-radius: 8px; padding: 9px 11px; font-size: 12.5px; min-width: 200px; z-index: 5; }
.tip-row { display: flex; align-items: center; gap: 7px; margin-top: 4px; }
.tip-row span { flex: 1; }
.tip-row b { font-variant-numeric: tabular-nums; font-weight: 600; }
.tip-row i { width: 9px; height: 9px; border-radius: 3px; }
.tip-total { border-top: 1px solid var(--line); padding-top: 5px; margin-top: 6px; }
.report-table td, .report-table th { white-space: nowrap; }
.report-table tr.total-row td { font-weight: 700; border-top: 2px solid var(--line-2); }
.hbars { display: grid; gap: 9px; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 32%) 1fr auto 38px; gap: 10px; align-items: center; font-size: 13px; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 12px; background: transparent; }
.hbar-track i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.hbar-val { font-weight: 600; }
details.card > summary { list-style: none; } details.card > summary::-webkit-details-marker { display: none; }
@media (max-width: 760px) { .hbar-row { grid-template-columns: minmax(80px, 34%) 1fr auto; } .hbar-pct { display: none; } }
.tpl-table { table-layout: fixed; min-width: 760px; } .tpl-table td:first-child { overflow: hidden; text-overflow: ellipsis; }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
.pat-box { border-top: 1px solid var(--line); padding-top: 12px; }
.pat-result { height: 36px; }
.pat-result label { display: flex; align-items: center; cursor: pointer; }
.pat-result input { display: none; }
.pat-result b { padding: 0 18px; line-height: 34px; color: var(--muted); }
.pat-result input[value=pass]:checked + b { background: var(--ok); color: #fff; }
.pat-result input[value=fail]:checked + b { background: var(--bad); color: #fff; }
.safety-strip { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--text); border-color: var(--warn); flex-wrap: wrap; }
.safety-strip:hover { text-decoration: none; background: var(--panel-2); }
.safety-strip svg { width: 18px; height: 18px; color: var(--warn); }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; }
.imp-table td { vertical-align: top; }
.imp-table tr.imp-error td { background: var(--bad-soft); }
.imp-table tr.imp-duplicate td { color: var(--muted); }
.imp-table select.dec { max-width: 280px; }
table.lines tr.subheading td { background: transparent; border-top: 1px dashed var(--line-2); }
table.lines tr.subheading input[data-k=description] { font-weight: 600; padding-left: 18px; }
table.lines tr.sec-total td { background: var(--panel-2); font-weight: 600; border-top: 1px solid var(--line-2); }
table.lines tr.sec-total.subheading td { background: transparent; font-weight: 500; color: var(--muted); }
.menu-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px 2px; }
.menu-list.up { top: auto; bottom: calc(100% + 4px); left: 0; right: auto; }
table.lines { min-width: 1100px; }
table.lines tr.group-line td { background: var(--ok-soft); border-top: 2px solid var(--line-2); }
table.lines tr.group-line .badge { background: var(--panel); color: var(--ok); }
table.lines tr.member td { background: color-mix(in srgb, var(--ok-soft) 35%, transparent); }
table.lines tr.member td:nth-child(3) { padding-left: 22px; }
table.lines select.person { color: var(--muted); font-size: 12px; }

/* ---- Production Pal brand ---- */
.brand { gap: 11px; padding: 6px 10px 20px; }
.brand { flex-direction: column; align-items: flex-start; gap: 6px; }
.brand-logo { height: 27px; width: auto; display: block; max-width: 100%; }
.brand small { margin-top: 1px; padding-left: 38px; }
.nav a { position: relative; }
.nav a.active { background: rgba(255, 255, 255, 0.08); }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-amber); }
.nav a.active svg { color: var(--brand-amber); opacity: 1; }
.mobile-top { gap: 8px; }
.mobile-top img { display: block; }
.auth { background: radial-gradient(1200px 600px at 50% -10%, #23365c 0%, var(--brand-ink) 60%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; }
.auth-logo { height: 54px; margin-bottom: 8px; }
.auth-tag { color: #aeb9cc; margin: 0 0 22px; font-size: 14px; letter-spacing: 0.01em; }
.auth .card { box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); border: 0; }

/* ---------- Team & access ---------- */
[hidden] { display: none !important; }
.side .me-role { font-size: 11px; opacity: 0.65; margin: 1px 0 6px; }
.access-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.access-opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; font-weight: 400; }
.access-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.access-opt:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }
.access-opt input { margin-top: 3px; width: auto; flex: none; }
.access-opt > div { flex: 1; }
.page-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.chk { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; cursor: pointer; }
@media (max-width: 640px) { .access-choice { grid-template-columns: 1fr; } }

/* ---------- Project pipeline ---------- */
.pipeline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; }
.pipeline.cancelled { justify-content: flex-start; }
.steps { display: flex; align-items: center; gap: 0; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); padding-right: 14px; }
.steps li + li::before { content: ''; width: 26px; height: 2px; background: var(--line-2, var(--line)); margin-right: 14px; border-radius: 2px; }
.steps li.done + li::before, .steps li.done + li.now::before { background: var(--ok); }
.steps .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--panel-2); border: 1px solid var(--line); flex: none; }
.steps li.done { color: var(--text); }
.steps li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps li.now { color: var(--text); font-weight: 600; }
.steps li.now .dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.steps small { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); }
@media (max-width: 760px) { .steps li + li::before { width: 12px; margin-right: 8px; } .steps li { padding-right: 8px; } }
.locked input:disabled, .locked select:disabled, .locked textarea:disabled { background: var(--panel-2); color: var(--text); opacity: 1; cursor: default; }
.locked .lines button:disabled { visibility: hidden; }
.lock-note { grid-column: 1 / -1; font-size: 13px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }

/* ---------- Per diem calculator ---------- */
.pd-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font: inherit; font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.pd-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.pd-total { font-size: 22px; font-weight: 700; color: var(--text); }
.pd-table input.in-cell { width: 100%; }

/* ---------- Quote versions ---------- */
.badge.ver { background: var(--panel-2); color: var(--text); font-variant-numeric: tabular-nums; }
.versions tr.current td { background: var(--accent-soft); }
.versions .up { color: var(--ok); }
.versions .down { color: var(--bad); }

/* ---------- Services & hire-ins ---------- */
.line-extra { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; padding: 2px 7px 4px; font-size: 12px; color: var(--muted); }
.line-extra .in-cell { font-size: 12px; padding: 2px 5px; height: 24px; }
.line-extra .lx-mode { width: 108px; }
.line-extra .lx-size { display: inline-flex; align-items: center; gap: 4px; }
.line-extra .lx-size input { width: 46px; }
.line-extra .lx-size b { color: var(--text); font-weight: 600; }
.line-extra .lx-cost { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; margin: 0; }
.line-extra .lx-cost input { width: 64px; }
.costs { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px dashed var(--line); font-size: 13px; }
.costs .row { display: flex; justify-content: space-between; margin-top: 3px; }
.costs .neg, .svc .neg { color: var(--bad); }
.svc tr.off td { opacity: 0.6; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg label { display: flex; align-items: center; gap: 6px; padding: 7px 14px; font-weight: 500; font-size: 13.5px; cursor: pointer; margin: 0; border-right: 1px solid var(--line); }
.seg label:last-child { border-right: 0; }
.seg label:has(input:checked) { background: var(--accent-soft); color: var(--accent); }
.seg input { width: auto; margin: 0; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; }
.linkish:hover { text-decoration: underline; }

/* ---------- Line descriptions ---------- */
textarea.note-in { display: block; width: 100%; resize: none; color: var(--muted); font-size: 12.5px; line-height: 1.4; padding: 3px 7px; min-height: 0; margin-top: 2px; }
textarea.note-in:focus { color: var(--text); }
tr.heading textarea.note-in { font-weight: 400; text-transform: none; letter-spacing: 0; }
/* the "+ Description" / "+ Size or cost" links appear when you point at a line (always shown on touch screens) */
@media (hover: hover) {
  table.lines .add-links { opacity: 0; transition: opacity 0.12s; }
  table.lines tr:hover .add-links, table.lines tr:focus-within .add-links { opacity: 1; }
}

/* ---------- Adding items at a position ---------- */
.row-acts { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
@media (hover: hover) {
  table.lines .icon-btn.ins { opacity: 0; }
  table.lines tr:hover .icon-btn.ins, table.lines .icon-btn.ins:focus { opacity: 1; }
}
table.lines .icon-btn.ins { color: var(--accent); }
.add-bar .ins-head { display: none; }
.add-bar.inserting { border-top: 0 !important; background: var(--accent-soft); border: 2px dashed var(--accent); border-radius: 10px; margin: 6px 8px; }
.add-bar.inserting .ins-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-size: 13px; color: var(--accent); }
.add-bar.inserting .ins-head svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
tr.insert-row > td { padding: 0 !important; background: var(--panel); }

/* ---------- monday.com import ---------- */
.monday-cta { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 0 0 18px; cursor: pointer; font: inherit; color: inherit; }
.monday-cta:hover { border-color: var(--accent); }
.monday-cta > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.monday-cta .mc-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.mi-list { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.mi-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.mi-row:last-child { border-bottom: 0; }
.mi-main { flex: 1; min-width: 0; }
