/* TechPumps — calm, clear, fast. No framework. */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f1728;
  --ink-2: #475467;
  --muted: #6b7486;
  --line: #e6e9ef;
  --line-2: #d3d8e0;
  --brand: #0f4c81;
  --brand-2: #1366b3;
  --brand-ink: #ffffff;
  --brand-soft: #eaf2fb;
  --bar: #3b82c4;
  --side: #0c2340; --side-ink: #c9d6e8; --side-on: #ffffff; --side-hover: rgba(255,255,255,.07); --side-active: rgba(255,255,255,.12);
  --good: #157347; --good-bg: #e3f4ea;
  --warn: #946200; --warn-bg: #fdf1d6;
  --bad: #c0362c;  --bad-bg: #fde8e6;
  --info: #1366b3; --info-bg: #e7f0fb;
  --neutral-bg: #eef0f4;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --side-w: 240px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --surface: #161b22; --surface-2: #1c222b; --ink: #e8ebf0; --ink-2: #b4bcc8; --muted: #8b94a3;
    --line: #2a313b; --line-2: #3a424e; --brand: #5aa2e6; --brand-2: #7bb6ee; --brand-ink: #08121f; --brand-soft: #172a40; --bar: #5b9be0;
    --side: #0a0f16; --side-ink: #a9b4c4;
    --good: #6fcf97; --good-bg: #16301f; --warn: #f0c060; --warn-bg: #362b12; --bad: #f2867e; --bad-bg: #3a1c1a;
    --info: #7ab6f0; --info-bg: #172a40; --neutral-bg: #252c36; color-scheme: dark;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; margin: 1rem 0 .25rem; }
small, .muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.snav svg, .tabbar svg, .iconbtn svg, .gsearch svg, .newmenu svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- app shell: sidebar + main ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: var(--side-w); flex: none; background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 70; }
.brand { display: flex; align-items: center; gap: .65rem; color: #fff; font-weight: 750; font-size: 1.02rem; padding: 1.1rem 1.1rem .9rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand small { display: block; font-size: .72rem; font-weight: 500; color: var(--side-ink); letter-spacing: .01em; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #2f8be0, #0f4c81); display: grid; place-items: center; color: #fff; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.brand-mark svg { width: 20px; height: 20px; }
.snav { flex: 1; overflow-y: auto; padding: .25rem .65rem 1rem; scrollbar-width: thin; }
.sgroup { font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 700; color: #7f93ad; padding: 1rem .6rem .35rem; }
.snav a { display: flex; align-items: center; gap: .7rem; padding: .5rem .6rem; margin: 1px 0; border-radius: 8px; color: var(--side-ink); font-weight: 500; font-size: .92rem; }
.snav a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.snav a.on { background: var(--side-active); color: var(--side-on); box-shadow: inset 3px 0 0 #5aa9f0; }
.snav .ab { margin-left: auto; font-size: .66rem; font-weight: 700; letter-spacing: .05em; padding: .05rem .35rem; border-radius: 4px; background: rgba(255,255,255,.08); color: #9fb3cc; }
.me { display: flex; align-items: center; gap: .55rem; padding: .8rem .9rem; border-top: 1px solid rgba(255,255,255,.08); }
.me form { margin: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #1f4f80; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.me-name { flex: 1; min-width: 0; color: #fff; font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-name small { display: block; color: var(--side-ink); font-weight: 400; font-size: .74rem; }
.iconbtn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0; }
.iconbtn:hover { background: var(--side-hover); text-decoration: none; }
.me .iconbtn { color: var(--side-ink); }
.me .iconbtn:hover { color: #fff; }
.maincol { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.scrim { display: none; }

.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: .75rem; padding: .7rem 1.5rem; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.menu-btn, .brand-sm { display: none; }
.gsearch { flex: 1; max-width: 620px; position: relative; display: flex; align-items: center; }
.gsearch > svg { position: absolute; left: .8rem; color: var(--muted); pointer-events: none; }
.gsearch input { width: 100%; padding: .55rem 2.5rem .55rem 2.4rem; border-radius: 10px; background: var(--surface); border-color: var(--line-2); min-height: 40px; }
.gsearch kbd { position: absolute; right: .7rem; }
.newmenu { position: relative; margin-left: auto; }
.newmenu summary { list-style: none; }
.newmenu summary::-webkit-details-marker { display: none; }
.newmenu-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .35rem; z-index: 80; }
.newmenu-pop a { display: flex; align-items: center; gap: .65rem; padding: .6rem .7rem; border-radius: 8px; color: var(--ink); font-weight: 550; }
.newmenu-pop a:hover { background: var(--brand-soft); text-decoration: none; }
.newmenu-pop a svg { color: var(--brand-2); }
.newmenu-pop kbd { margin-left: auto; }
kbd { font: 11px/1.6 ui-monospace, monospace; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 .35rem; color: var(--muted); background: var(--surface); }

main { width: 100%; max-width: 1320px; margin: 0 auto; padding: 1.5rem; }
.page-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.page-head .actions { min-width: 0; max-width: 100%; margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.crumbs { font-size: .84rem; color: var(--muted); margin-bottom: .35rem; }
.crumbs a { color: var(--muted); }

.tabbar { display: none; }

@media (max-width: 960px) {
  .side { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); width: min(290px, 85vw); }
  .side.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(8, 15, 28, .45); z-index: 65; }
  .menu-btn, .brand-sm { display: inline-grid; }
  .brand-sm { padding: 0; }
  .brand-sm .brand-mark { width: 32px; height: 32px; }
  .topbar { padding: .6rem 1rem; gap: .5rem; }
  .topbar .menu-btn { color: var(--ink); }
  .topbar .menu-btn:hover { background: var(--neutral-bg); }
  main { padding: 1rem 1rem calc(5rem + env(safe-area-inset-bottom)); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: var(--surface); border-top: 1px solid var(--line); padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .35rem 0; font-size: .7rem; font-weight: 600; color: var(--muted); border-radius: 8px; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--brand-2); }
  .tabbar a:hover { text-decoration: none; }
}

/* ---------- cards & layout ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.15rem 1.25rem; margin-bottom: 1.25rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .right { min-width: 0; max-width: 100%; margin-left: auto; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: .9rem; }
.grid { display: grid; gap: 1.25rem; }
.grid > .card { margin-bottom: 0; }
.grid > *, .split > * { min-width: 0; }
.grid + .card, .grid + section { margin-top: 1.25rem; }
.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)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1280px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .card > .tbl-wrap { margin: 0 -1rem; padding: 0 1rem; }
  :not(.tbl-wrap) > table:not(.est) { display: block; overflow-x: auto; }
  dl.kv { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
}
@media (max-width: 640px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .gsearch kbd, .hide-sm { display: none; } .card { padding: 1rem; border-radius: 10px; } h1 { font-size: 1.25rem; } }

/* ---------- stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .9rem; margin-bottom: 1.25rem; }
.tile { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem 1rem .95rem; display: flex; flex-direction: column; gap: .15rem; color: var(--ink); overflow: hidden; transition: border-color .15s, transform .15s, box-shadow .15s; }
a.tile:hover { text-decoration: none; border-color: var(--line-2); box-shadow: 0 4px 14px rgba(16,24,40,.08); transform: translateY(-1px); }
.tile .k { font-size: .8rem; color: var(--ink-2); font-weight: 550; order: 1; }
.tile .v { margin-top: auto; padding-top: .2rem; font-size: 1.85rem; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.1; letter-spacing: -.02em; order: 2; }
.tile .s { font-size: .76rem; color: var(--muted); order: 3; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
.tile.alert { background: linear-gradient(0deg, var(--surface), var(--surface)) padding-box; border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.tile.alert::before { background: var(--bad); }
.tile.alert .v { color: var(--bad); }
.tile.warn::before { background: var(--warn); }
.tile.warn .v { color: var(--warn); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem .95rem; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; white-space: nowrap; min-height: 38px; box-shadow: 0 1px 2px rgba(16,24,40,.05); transition: background .12s, border-color .12s, filter .12s; }
.btn:hover { text-decoration: none; border-color: var(--ink-2); background: var(--surface-2); }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand-2) 35%, transparent); outline-offset: 1px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.good:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-bg); }
.btn.small { padding: .25rem .65rem; min-height: 30px; font-size: .82rem; border-radius: 7px; }
.btn.big { padding: .7rem 1.15rem; font-size: 1rem; }
.btn kbd { margin-left: .25rem; }
.btn.primary kbd { color: inherit; border-color: rgba(255,255,255,.4); background: transparent; }
.linkbtn { background: none; border: 0; color: var(--brand-2); cursor: pointer; font: inherit; padding: 0; }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1.25rem; align-items: stretch; }
.qa { display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); font-weight: 650; transition: border-color .15s, box-shadow .15s; }
.qa:hover { text-decoration: none; border-color: var(--brand-2); box-shadow: 0 4px 14px rgba(19,102,179,.12); }
.qa .qi { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-2); flex: none; }
.qa .qi svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.qa > span:not(.qi) { min-width: 0; }
.qa small { display: block; font-weight: 450; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qa kbd { margin-left: auto; }
.quick .seg { align-self: center; }
@media (max-width: 1100px) { .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); } .quick .seg { grid-column: 1 / -1; justify-self: start; } }
@media (max-width: 640px) { .qa { padding: .7rem .75rem; gap: .6rem; font-size: .9rem; } .qa kbd, .qa small { display: none; } .qa .qi { width: 34px; height: 34px; } }

/* ---------- forms ---------- */
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: .5rem .7rem; width: 100%; min-height: 40px; transition: border-color .12s, box-shadow .12s; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
textarea { min-height: 0; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 20%, transparent); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--brand-2); box-shadow: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field label, .field > .lbl { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .25rem; }
.field .req { color: var(--bad); margin-left: .15rem; }
.field .opt { color: var(--muted); font-weight: 400; font-size: .78rem; margin-left: .25rem; }
.field .help { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.field .err, .errorlist { color: var(--bad); font-size: .82rem; margin: .2rem 0 0; padding: 0; list-style: none; }
.field.has-err input, .field.has-err select, .field.has-err textarea { border-color: var(--bad); }
.form-actions { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; align-items: center; }
.radios { display: flex; flex-wrap: wrap; gap: .4rem; }
.radios label, .radios > div > label { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .7rem; border: 1px solid var(--line-2); border-radius: 6px; cursor: pointer; font-weight: 500; font-size: .92rem; margin: 0; }
.radios label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.radios div { display: contents; }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 500; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 .4rem; color: var(--ink-2); font-size: .9rem; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .75rem; }
.filters input, .filters select { width: auto; min-width: 140px; }
.filters input[type=search] { min-width: 220px; flex: 1; max-width: 360px; }
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; display: inline-flex; padding: 3px; gap: 2px; background: var(--neutral-bg); border-radius: 10px; }
.seg a { padding: .35rem .8rem; color: var(--ink-2); font-size: .86rem; font-weight: 600; white-space: nowrap; border-radius: 8px; }
.seg a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(16,24,40,.12); }
.seg a:hover { text-decoration: none; }

/* ---------- picker (autocomplete) ---------- */
.picker { position: relative; }
.picker .chosen { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--brand); background: var(--brand-soft); border-radius: 6px; padding: .45rem .6rem; min-height: 38px; }
.picker .chosen .t { flex: 1; font-weight: 600; }
.picker .chosen .t small { font-weight: 400; margin-left: .35rem; }
.picker .chosen button { background: none; border: 0; color: var(--ink-2); cursor: pointer; font-size: .85rem; }
.ac-list { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 2px); background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.14); max-height: 340px; overflow: auto; }
.ac-item { padding: .5rem .7rem; cursor: pointer; border-bottom: 1px solid var(--line); }
.ac-item:last-child { border-bottom: 0; }
.ac-item .l { font-weight: 600; }
.ac-item .s { font-size: .82rem; color: var(--muted); }
.ac-item.on, .ac-item:hover { background: var(--brand-soft); }
.ac-item.add { color: var(--brand); font-weight: 700; }
.ac-empty { padding: .5rem .7rem; color: var(--muted); font-size: .9rem; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
.card > .tbl-wrap { margin: 0 -1.25rem; padding: 0 1.25rem; }
.card.tbl-wrap { padding-top: .5rem; padding-bottom: .5rem; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .65rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: transparent; white-space: nowrap; border-bottom-color: var(--line-2); }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tr.inactive td { color: var(--muted); }
tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
td.actions { white-space: nowrap; text-align: right; }
tfoot td { font-weight: 700; border-top: 2px solid var(--line-2); }
.empty { padding: 1.5rem; text-align: center; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: .7rem 0; border-bottom: 1px solid var(--line); display: flex; gap: .4rem .7rem; align-items: center; flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.list .r { margin-left: auto; text-align: right; display: flex; align-items: center; gap: .6rem; }
.list .r small { line-height: 1.35; }
.rows li { flex-wrap: nowrap; align-items: center; }
.rows .rm { flex: 1; min-width: 0; }
.rows .l1 { display: flex; gap: .3rem .6rem; align-items: baseline; flex-wrap: wrap; }
.rows .l2 { font-size: .84rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .phone { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: .9rem; }
.rows .r { flex: none; }
.rows .meta { display: flex; flex-direction: column; align-items: flex-end; font-size: .84rem; line-height: 1.3; }
.rows .meta span { font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.rows .meta small { white-space: nowrap; }
.late { color: var(--bad) !important; font-weight: 600; }
@media (max-width: 640px) { .rows .meta small { display: none; } }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 650; text-transform: capitalize; white-space: nowrap; background: var(--neutral-bg); color: var(--ink-2); line-height: 1.5; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.s-open, .s-received, .s-pending, .s-in_progress { background: var(--info-bg); color: var(--info); }
.s-estimated { background: var(--warn-bg); color: var(--warn); }
.s-in_repair, .s-approved { background: var(--warn-bg); color: var(--warn); }
.s-ready, .s-converted, .s-closed, .s-delivered, .s-finished, .s-active { background: var(--good-bg); color: var(--good); }
.s-lost, .s-cancelled, .s-returned, .s-inactive, .s-overdue { background: var(--bad-bg); color: var(--bad); }
.tag { display: inline-block; padding: .08rem .45rem; border-radius: 6px; font-size: .74rem; font-weight: 550; background: var(--neutral-bg); color: var(--ink-2); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 650; font-size: .88em; color: var(--ink); letter-spacing: -.01em; padding: .08rem .4rem; border-radius: 6px; background: var(--neutral-bg); white-space: nowrap; }
a .code, a.code { color: var(--brand-2); background: var(--brand-soft); }
a.code:hover { text-decoration: none; filter: brightness(.97); }
h1 .code { font-size: .8em; vertical-align: .1em; }

/* ---------- messages ---------- */
.msgs { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.msgs li { padding: .7rem 1rem; border-radius: var(--radius-sm); margin-bottom: .5rem; border: 1px solid transparent; font-weight: 550; }
.msgs .success { background: var(--good-bg); color: var(--good); border-color: color-mix(in srgb, var(--good) 25%, transparent); }
.msgs .error { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.msgs .info, .msgs .warning { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.note { padding: .7rem .9rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: .9rem; color: var(--ink-2); }
.note.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }

/* ---------- definition lists ---------- */
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .35rem 1rem; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .88rem; }
dl.kv dd { min-width: 0; overflow-wrap: anywhere; margin: 0; font-weight: 500; white-space: pre-line; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { border-left: 3px solid var(--line-2); padding: .25rem 0 .9rem 1rem; position: relative; }
.tl-item::before { content: ""; position: absolute; left: -7px; top: .55rem; width: 11px; height: 11px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.tl-item.k-enquiry::before { border-color: var(--good); }
.tl-item.k-ic::before { border-color: var(--warn); }
.tl-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.tl-sub { margin: .35rem 0 0 .25rem; padding-left: .9rem; border-left: 2px dotted var(--line-2); }
.tl-body { font-size: .9rem; color: var(--ink-2); margin-top: .2rem; }

/* ---------- bars (single-hue magnitude) ---------- */
.bar { height: 8px; background: var(--neutral-bg); border-radius: 4px; min-width: 60px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; }
td.barcell { width: 30%; min-width: 90px; vertical-align: middle; }
.small-n { color: var(--warn); font-size: .75rem; cursor: help; }
.trend { display: flex; gap: 4px; align-items: flex-end; height: 90px; padding-top: .5rem; }
.trend .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 2px; }
.trend .col i { display: block; width: 100%; max-width: 34px; background: var(--bar); border-radius: 4px 4px 0 0; min-height: 2px; }
.trend .col span { font-size: .7rem; color: var(--muted); white-space: nowrap; }
.trend .col b { font-size: .75rem; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: .5rem .8rem; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 600; }
.tabs a.on { color: var(--brand-2); border-bottom-color: var(--brand-2); }
.tabs a:hover { text-decoration: none; }

/* ---------- modal ---------- */
dialog.modal { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog.modal::backdrop { background: rgba(10, 15, 25, .45); }
.modal-head { display: flex; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; }
.modal-head button { margin-left: auto; }
.modal-body { padding: 1rem; max-height: 70vh; overflow: auto; }

/* ---------- estimate table ---------- */
.est td { padding: .3rem .35rem; vertical-align: middle; }
.est input { min-height: 34px; padding: .35rem .45rem; }
.est .c-tn { width: 150px; } .est .c-qty { width: 80px; } .est .c-rate { width: 110px; } .est .c-amt { width: 110px; } .est .c-rm { width: 170px; } .est .c-x { width: 34px; }
.est .amt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.est-total { font-size: 1.3rem; font-weight: 800; }
.est .ac-list { min-width: 360px; }
@media (max-width: 760px) {
  .est thead { display: none; }
  .est tr { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
  .est td { border: 0; padding: 0; width: auto !important; }
  .est td.c-desc, .est td.c-rm { grid-column: 1 / -1; }
}

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; background: radial-gradient(1200px 600px at 10% -10%, #1d5d99 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #0f4c81 0%, transparent 55%), var(--side); }
.login-card { width: min(400px, 100%); padding: 2rem 1.75rem 1.5rem; border: 0; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.login-card .brand { color: var(--ink); padding: 0 0 1.25rem; font-size: 1.15rem; }
.login-card .brand small { color: var(--muted); font-size: .8rem; }
.login-card .brand-mark { width: 42px; height: 42px; border-radius: 12px; }
.login-card .brand-mark svg { width: 24px; height: 24px; }
.print-only { display: none; }
@media print {
  .topbar, .no-print, .msgs, .side, .tabbar { display: none !important; }
  .shell { display: block; }
  .print-only { display: block; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 0; padding: 0; }
  main { padding: 0; }
}
