:root {
  --bg: #f4f2ee; --panel: #ffffff; --ink: #15171a; --ink2: #3d4148; --muted: #6b6f76; --line: #e3e0da; --grid: #efece6;
  --accent: #0f5c4d; --accent-ink: #fff; --accent-soft: #e3efeb;
  --good: #1e7a3c; --warn: #a35a00; --warn-soft: #fff1dc; --bad: #b3261e; --bad-soft: #fde8e6;
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111315; --panel: #1a1d20; --ink: #eceae6; --ink2: #c9c6c0; --muted: #9aa0a6; --line: #2c3035; --grid: #24282c;
    --accent: #3fb59a; --accent-ink: #08130f; --accent-soft: #17302a; --warn-soft: #3a2a10; --bad-soft: #3a1714; --good: #5cc283; --warn: #e0a24a; --bad: #f08a80; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); padding: 7px 12px; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
input, select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--panel); }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.muted { color: var(--muted); }
.num { text-align: right; font-family: var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums; }

.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.nav { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; padding: 18px 12px; background: var(--panel); border-right: 1px solid var(--line); }
.nav .brand { padding: 4px 10px 16px; display: flex; flex-direction: column; }
.nav .brand b { font-size: 17px; }
.nav a { padding: 8px 10px; border-radius: 8px; color: var(--ink2); text-decoration: none; }
.nav a:hover { background: var(--bg); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .me { margin-top: auto; padding: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.view { padding: 24px 28px 48px; max-width: 1360px; }

.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 22px; }
.head .ctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 14px; }
.two { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .two, .even { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .app { grid-template-columns: 1fr; } .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; } .nav .me { margin: 0; border: 0; } .view { padding: 16px; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card h2 { margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--ink2); display: flex; justify-content: space-between; align-items: baseline; }
.card h2 small { font-weight: 400; color: var(--muted); font-size: 12px; }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.kpi .val { font: 600 26px var(--mono); margin: 4px 0 2px; letter-spacing: -.01em; }
.kpi .cmp { font-size: 12px; color: var(--muted); }
.up { color: var(--good); } .down { color: var(--bad); }
.kpi.hero { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.kpi.hero .label, .kpi.hero .cmp { color: inherit; opacity: .75; }
.kpi.hero .up, .kpi.hero .down { color: inherit; font-weight: 600; opacity: 1; }

table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.t td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t tr.click { cursor: pointer; } .t tr.click:hover td { background: var(--bg); }
.t .sub { display: block; color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); vertical-align: middle; }
.dot.on { background: var(--good); }
.badge { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; background: var(--warn-soft); }
.alert b { font-family: var(--mono); color: var(--warn); }
.ok { color: var(--good); }

/* charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font: 11px var(--sans); }
.chart .bar { fill: var(--accent); }
.chart .bar.dim { opacity: .35; }
.chart .hit { fill: transparent; }
.chart .hit:hover + .bar, .chart g.b:hover .bar { opacity: .8; }
.hbar { display: grid; grid-template-columns: 90px minmax(0,1fr) auto; gap: 10px; align-items: center; margin: 7px 0; }
.hbar .track { height: 10px; border-radius: 0 4px 4px 0; background: var(--grid); overflow: hidden; }
.hbar .fill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.tip { position: fixed; pointer-events: none; z-index: 30; background: var(--ink); color: var(--bg); padding: 6px 10px; border-radius: 8px; font: 12px var(--sans); white-space: nowrap; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.tip b { font-family: var(--mono); }

/* forms */
.form { display: grid; gap: 12px; max-width: 560px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.form > *, .form label { min-width: 0; } .form select, .form input { max-width: 100%; min-width: 0; text-overflow: ellipsis; }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; font-size: 14px !important; color: var(--ink) !important; }
.err { color: var(--bad); min-height: 1.2em; }
.warnbox { background: var(--warn-soft); color: var(--warn); padding: 8px 12px; border-radius: 8px; }

/* gate (login/setup) */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.gate .card { width: min(440px, 100%); padding: 28px; }
.gate h1 { margin: 0 0 4px; font-size: 22px; }
.gate .primary { width: 100%; padding: 11px; margin-top: 6px; }

.drawer { position: fixed; inset: 0 0 0 auto; width: min(560px, 100%); background: var(--panel); border-left: 1px solid var(--line); box-shadow: -10px 0 40px rgba(0,0,0,.15); padding: 22px; overflow: auto; z-index: 20; }
.drawer h2 { margin-top: 0; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 10px; z-index: 40; font-weight: 600; }
.toast.bad { background: var(--bad); color: #fff; }
.pol input { width: 80px; }

/* purchases */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.pgrid input, .pgrid select { width: 100%; padding: 6px 8px; font-family: var(--mono); }
.pgrid td { padding: 4px; vertical-align: middle; }
.pgrid .w-item { min-width: 220px; }
.pgrid .w-n { width: 78px; }
.pgrid .w-r { width: 100px; }
.pgrid tr.bad td { background: var(--bad-soft); }
.pgrid .new { font-size: 11px; }
.ac { position: relative; }
.ac ul { position: absolute; z-index: 10; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: 4px; list-style: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.15); max-height: 260px; overflow: auto; }
.ac li { padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.ac li.on, .ac li:hover { background: var(--accent-soft); }
.hdr { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.hdr label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.totals { display: flex; gap: 22px; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; margin-top: 12px; }
.totals b { font-family: var(--mono); font-size: 18px; color: var(--ink); }
.totals .grand b { font-size: 24px; }
.issues { margin: 12px 0; padding: 0; list-style: none; }
.issues li { padding: 6px 10px; border-radius: 6px; margin-bottom: 4px; background: var(--bad-soft); color: var(--bad); }
.issues li.warn { background: var(--warn-soft); color: var(--warn); }
.done { padding: 16px; border-radius: var(--radius); background: var(--accent-soft); margin-bottom: 14px; }
.sizegrid { display: grid; grid-template-columns: 90px repeat(var(--n), 70px); gap: 6px; align-items: center; margin: 10px 0; }
.sizegrid input { width: 100%; padding: 6px; text-align: right; font-family: var(--mono); }
.modal { position: fixed; inset: 0; background: rgba(10,12,14,.55); display: grid; place-items: center; z-index: 30; padding: 16px; }
.modal .card { width: min(720px, 100%); max-height: 92vh; overflow: auto; }

button:disabled, button.primary:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.4); }

.pgrid .w-h { width: 96px; }
.gstcard { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; background: var(--bg); }
.gstcard > div { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.gstcard span { display: flex; flex-direction: column; font-size: 13px; }
.gstcard small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.gstcard p { margin: 8px 0 0; }

/* scanned bill review */
.scanwrap { display: grid; grid-template-columns: minmax(240px, 28%) 1fr; gap: 14px; align-items: start; }
.scanwrap > .card { margin: 0; min-width: 0; }
.scanimg { position: sticky; top: 10px; }
.billview { width: 100%; height: 70vh; border: 1px solid var(--line, #ddd); border-radius: 6px; margin-top: 8px; object-fit: contain; background: #fff; }
img.billview { height: auto; max-height: 70vh; }
.checks { list-style: none; padding: 0; margin: 10px 0; font-size: 13px; }
.checks li { padding: 2px 0; }
.checks li.ok { color: var(--accent, #1a7f4b); }
.checks li.no { color: var(--warn); font-weight: 600; }
label.lowc input { background: var(--warn-soft); border-color: var(--warn); }
tr.lowrow td input { background: var(--warn-soft); }
.billtxt { display: block; }
.billtxt.guess { color: var(--warn); }
.drop.over { outline: 2px dashed var(--accent, #1a7f4b); }
@media (max-width: 900px) { .scanwrap { grid-template-columns: 1fr; } .scanimg { position: static; } }
.drop { display: block; border: 2px dashed var(--accent); border-radius: 10px; padding: 28px; text-align: center; cursor: pointer; color: var(--accent); margin: 12px 0; }
.scanwrap .pgrid .w-h input { min-width: 64px; }
.scanwrap .pgrid .w-n input { min-width: 44px; }
.scanwrap .pgrid .w-r input { min-width: 76px; }

.dl { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.dlbtn { flex: 1 1 240px; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 10px; text-decoration: none; color: inherit; background: var(--accent-soft); }
.dlbtn b { color: var(--accent); }
.dlbtn span { font-size: 13px; opacity: .8; }

/* catalogue */
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--accent-soft); }
.thumbcell { width: 56px; }
.thumbcell img { width: 48px; height: 60px; object-fit: cover; border-radius: 6px; display: block; }
.nophoto { display: inline-block; width: 48px; height: 60px; border: 1px dashed var(--line); border-radius: 6px; font-size: 10px; color: var(--muted); text-align: center; line-height: 1.2; padding-top: 18px; }
.meter { display: inline-block; width: 70px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.meter i { display: block; height: 100%; background: var(--accent); }
.meter.big { width: 140px; height: 8px; }
.btnlink { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: inherit; }
.back { color: var(--muted); text-decoration: none; }
.switch { display: flex; align-items: center; gap: 6px; }
.lgrid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.lgrid > div > .card, .lgrid > .card { margin: 0 0 14px; }
.lhead { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.lform { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 12px; }
.lform label.lf { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.lform label.lf:has(textarea), .lform label.lf:has([data-k="title"]) { grid-column: 1 / -1; }
.lform textarea { width: 100%; font: inherit; }
.badge.src { font-size: 10px; }
.badge.gen { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--accent-soft); color: var(--good); }
tr.uncertain td { background: var(--warn-soft); }
.attrs td { vertical-align: top; }
ul.plain { margin: 4px 0; padding-left: 18px; font-size: 13px; }
.small { font-size: 12px; }
.imgrow { border-top: 1px solid var(--line); padding: 8px 0; }
.imghead { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.imghead .up { margin-left: auto; cursor: pointer; font-weight: 500; }
.sw { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line); padding: 0; cursor: pointer; }
.sw.on { outline: 2px solid var(--accent); outline-offset: 2px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.thumbs figure { margin: 0; width: 104px; }
.thumbs img { width: 104px; height: 130px; object-fit: cover; border-radius: 6px; display: block; background: var(--line); }
.thumbs figcaption { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: 12px; }
.thumbs figcaption select { font-size: 11px; max-width: 64px; padding: 1px; }
.shopcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.shopcard { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.shopcard .ph { aspect-ratio: 4 / 5; background: var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.shopcard .ph img { width: 100%; height: 100%; object-fit: cover; }
.shopcard .ti { font-size: 13px; font-weight: 600; padding: 8px 10px 2px; }
.shopcard .pr { padding: 0 10px; font-family: var(--mono); }
.shopcard .sws, .shopcard .szs, .shopcard > .muted { padding: 6px 10px 0; display: flex; gap: 6px; flex-wrap: wrap; }
.shopcard .slug { padding: 6px 10px 8px; word-break: break-all; }
.sz { font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.sz.out { opacity: .4; text-decoration: line-through; }
@media (max-width: 1000px) { .lgrid { grid-template-columns: 1fr; } .lform { grid-template-columns: 1fr; } }
.lfh { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lfh .cnt { margin-left: auto; }
td.bad { color: var(--bad); font-weight: 600; }
.ok { color: var(--good); }
tr.tot td { border-top: 2px solid var(--line); }
.link.bad { color: var(--bad); }
.insight { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.insight:last-of-type { border-bottom: 0; }
.insight .badge { min-width: 48px; text-align: center; }
.answer { margin-top: 10px; padding: 10px 12px; background: var(--soft, rgba(0,0,0,.03)); border-radius: 8px; }
.answer .pre { white-space: pre-wrap; line-height: 1.5; }
.an-row, #an .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#an .row.between { justify-content: space-between; margin-bottom: 8px; }
#an .row.between h2 { margin: 0; }
#an .row .tabs { margin: 0; }
#an td .track { height: 8px; background: var(--grid); border-radius: 4px; overflow: hidden; }
#an td .track .fill { height: 100%; background: var(--accent); }
#an tfoot td { font-weight: 600; border-top: 1px solid var(--ink2); }
#an td.bad { color: var(--bad); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: inherit; cursor: pointer; font-size: 13px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #fff); }

.nav a.gobizato { margin-top: 10px; border: 1px solid var(--accent); color: var(--accent); text-align: center; font-weight: 600; }

.starmark { color: #d4a017; }
.badge.auto { background: transparent; border: 1px dashed var(--line); color: var(--muted); }
.chip.star.on { background: #d4a017; border-color: #d4a017; color: #fff; }

.cms { display: grid; grid-template-columns: 220px minmax(360px, 1fr) minmax(360px, 1.1fr); gap: 14px; align-items: start; }
.cms-list .cms-pg { display: block; width: 100%; text-align: left; margin-bottom: 6px; padding: 8px 10px; }
.cms-list .cms-pg.on { border-color: var(--accent); background: var(--accent-soft); }
.cms-list form { display: grid; gap: 6px; }
.cms-head { display: flex; gap: 10px; align-items: flex-start; }
.cms-title { font-size: 18px; font-weight: 600; width: 100%; }
.cms-slug { width: 160px; padding: 3px 6px; }
.cms-actions { display: flex; gap: 6px; }
.cms-blk { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; background: var(--panel); }
.cms-blk-h { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg); border-radius: 10px 10px 0 0; }
.cms-tools button { padding: 2px 6px; font-size: 15px; }
.cms-blk-b { padding: 10px 12px; display: grid; gap: 8px; }
.cms-f { display: grid; gap: 3px; font-size: 13px; }
.cms-f > span { color: var(--muted); font-size: 12px; }
.cms-f textarea { width: 100%; font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--panel); color: inherit; }
.cms-img { display: flex; align-items: center; gap: 10px; }
.cms-img img { width: 84px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.cms-items { display: grid; gap: 8px; }
.cms-item { border: 1px dashed var(--line); border-radius: 8px; padding: 8px; display: grid; gap: 6px; }
.cms-add { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.cms-add button { font-size: 13px; padding: 6px 10px; }
.cms-prev { position: sticky; top: 12px; padding: 0; overflow: hidden; }
.cms-prev-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.cms-prev iframe { width: 100%; height: 78vh; border: 0; display: block; margin: 0 auto; background: #fff; }
.cms-pick { width: min(760px, 94vw); border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: inherit; }
.cms-pick::backdrop { background: rgba(0,0,0,.35); }
.cms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 12px; max-height: 60vh; overflow: auto; }
.cms-grid button { padding: 4px; display: grid; gap: 4px; font-size: 12px; text-align: left; }
.cms-grid img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; }
.small.warn { color: var(--warn); }
@media (max-width: 1200px) { .cms { grid-template-columns: 200px 1fr; } .cms-prev { grid-column: 1 / -1; position: static; } }

.sptab input { min-width: 0; }
.sptab .n { width: 130px; }

.lblpick { display: inline-flex; gap: 6px; align-items: center; }
.btn-primary-link { padding: 8px 14px; border-radius: 8px; text-decoration: none; background: var(--accent); color: var(--accent-ink, #fff); font-weight: 600; }

/* ===================================================================================
   UI polish (benchmark: Odoo 18 + Zoho Books/Inventory — see docs/UI_BENCHMARK.md)
   =================================================================================== */
:root { --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 1px 1px rgba(20, 20, 20, .03); --h: 34px; --accent-hover: #0b4a3e; }
@media (prefers-color-scheme: dark) { :root { --shadow: none; --accent-hover: #57c9ad; } }
body { -webkit-font-smoothing: antialiased; }

/* Sidebar: grouped sections with icons (Zoho), clear active state */
.nav { gap: 1px; padding: 16px 10px; overflow-y: auto; }
.nav .brand { padding: 2px 10px 12px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; font-size: 13.5px; position: relative; }
.nav a .ic { flex: none; }
.nav a.on { background: var(--accent-soft); }
.nav a.on::before { content: ""; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.navsec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 4px; font-weight: 600; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.navtools { display: flex; gap: 6px; padding: 0 2px 8px; position: relative; }
.newbtn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; height: var(--h); }
.newbtn:hover { background: var(--accent-hover); }
.findbtn { display: inline-flex; align-items: center; gap: 6px; height: var(--h); padding: 0 8px; color: var(--muted); }
.findbtn kbd, .palfoot kbd { font: 10.5px var(--mono); border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; color: var(--muted); }
.newmenu { position: absolute; z-index: 20; left: 12px; top: 96px; width: 196px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.14); padding: 6px; display: grid; }
.newmenu a { padding: 8px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 13.5px; }
.newmenu a:hover { background: var(--accent-soft); color: var(--accent); }
.nav a.gobizato { margin-top: 12px; justify-content: center; }

/* Control panel (Odoo): sticky page header with title, actions and view tabs */
.view { padding: 0 28px 48px; }
.view > .head { position: sticky; top: 0; z-index: 6; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); margin: 0 -28px 18px; padding: 16px 28px 12px; border-bottom: 1px solid var(--line); }
.head h1 { font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.head h1 .back { color: var(--muted); text-decoration: none; font-weight: 500; }
.head h1 .back:hover { color: var(--accent); }

/* Tabs: underline style (Zoho) instead of boxed buttons */
.tabs { gap: 2px; margin-bottom: 0; border-bottom: 0; }
.tabs button { border: 0; border-radius: 0; background: none; padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { background: none; color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* Controls: one height, clear hover and keyboard focus */
button, input, select { min-height: var(--h); }
button.link, .chip, .spcell, .cms-tools button, .tabs button { min-height: 0; }
button:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
button.primary:hover, .btn-primary-link:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btnlink { display: inline-flex; align-items: center; min-height: var(--h); padding: 0 12px; background: var(--panel); }
.btnlink:hover { border-color: var(--accent); color: var(--accent); }

/* Cards and lists */
.card { box-shadow: var(--shadow); border-radius: 10px; }
.card h2 { font-size: 13.5px; color: var(--ink); }
.t th { font-size: 10.5px; padding: 8px; background: color-mix(in srgb, var(--bg) 55%, var(--panel)); }
.t th:first-child { border-top-left-radius: 6px; } .t th:last-child { border-top-right-radius: 6px; }
.t tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.t td { padding: 9px 8px; }
.t tr.click { cursor: pointer; }

/* Status pills (Odoo statusbar colours, Zoho shape) */
.badge { border-radius: 999px; padding: 2px 9px; font-weight: 600; font-size: 11px; letter-spacing: .01em; display: inline-flex; align-items: center; gap: 5px; }
.badge.ok::before, .badge.warn::before, .badge.bad::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }

/* Empty states (Zoho): calm, centred, with a hint */
.empty { padding: 28px 12px; font-size: 13.5px; }
td.empty::before, p.empty::before { content: ""; display: block; width: 34px; height: 34px; margin: 0 auto 8px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--accent-soft) 60%, transparent 61%); }

/* KPI tiles */
.kpi { padding: 14px 16px; }
.kpi .val { font-size: 24px; }

/* Command palette (Odoo Ctrl+K) */
.palette { width: min(640px, 94vw); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); box-shadow: 0 24px 64px rgba(0,0,0,.25); margin-top: 12vh; }
.palette::backdrop { background: rgba(20, 20, 20, .35); }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0; padding: 16px 18px; font-size: 16px; outline: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.palette li { display: flex; gap: 10px; align-items: baseline; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.palette li.on { background: var(--accent-soft); }
.palette .pk { font-size: 11px; color: var(--muted); width: 64px; flex: none; text-transform: uppercase; letter-spacing: .05em; }
.palette .ps { margin-left: auto; color: var(--muted); font-size: 12px; }
.palfoot { padding: 8px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; display: flex; gap: 6px; align-items: center; }

/* Drawer (record side panel, Zoho split-view feel) */
.drawer { box-shadow: -18px 0 48px rgba(0,0,0,.12); }

@media (max-width: 760px) {
  .view { padding: 0 14px 40px; } .view > .head { margin: 0 -14px 14px; padding: 12px 14px; }
  .navsec, .navtools kbd { display: none; } .nav a.on::before { display: none; }
}
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 16px; height: 16px; padding: 0; accent-color: var(--accent); vertical-align: middle; }
input[type="color"] { padding: 2px; width: 64px; }
input[type="file"] { min-height: 0; }
.cms-list form input { width: 100%; min-width: 0; }
.cms-list .cms-pg .sub { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.cms-head > div:first-child > .muted.small { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.cms-head > div:first-child > .muted.small label { display: inline-flex; align-items: center; gap: 4px; }
.cms-slug { min-height: 28px; padding: 3px 8px; width: 180px; }
.cms-title { min-height: 38px; }

.ra-steps { display: grid; gap: 12px; margin: 10px 0; }
.ra-row { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.ra-row input { flex: 1; min-width: 180px; }
.ra-qr { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; margin-top: 10px; }
.ra-qr svg { border: 1px solid var(--line); border-radius: 8px; flex: none; }
.ra-qr > div { flex: 1; min-width: 200px; }


/* ===================================================================================
   Phone and tablet
   =================================================================================== */
.mtop, .navshade { display: none; }
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .mtop { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; height: 52px; padding: 0 8px; padding-top: env(safe-area-inset-top);
    background: var(--panel); border-bottom: 1px solid var(--line); }
  .mtop b { flex: 1; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mbtn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; padding: 0; }
  .mbtn .ic { width: 22px; height: 22px; }
  .nav { position: fixed !important; z-index: 40; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); height: 100% !important; transform: translateX(-102%);
    transition: transform .2s ease; flex-direction: column !important; flex-wrap: nowrap !important; box-shadow: 10px 0 40px rgba(0,0,0,.18); padding-top: calc(16px + env(safe-area-inset-top)); }
  .nav.open { transform: none; }
  .nav a { padding: 11px 10px; font-size: 15px; }
  .navsec { display: block !important; }
  .navshade { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.35); }
  .navshade[hidden] { display: none; }
  .nav .me { margin-top: auto !important; border-top: 1px solid var(--line) !important; }
  .view { padding: 0 16px 40px; max-width: none; }
  .view > .head { position: static; margin: 0 -16px 14px; padding: 14px 16px 0; backdrop-filter: none; background: var(--bg); }
  .head { gap: 10px; }
  .head h1 { font-size: 19px; width: 100%; }
  .head .tabs { width: calc(100% + 32px); min-width: 0; max-width: calc(100% + 32px); overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
  .head .tabs::-webkit-scrollbar { display: none; }
  .head .tabs button { white-space: nowrap; flex: none; padding: 10px 12px; }
  .head .ctl { width: 100%; padding-bottom: 10px; }
  .two, .even, .cms { grid-template-columns: 1fr !important; }
  .cms-prev { position: static; } .cms-prev iframe { height: 70vh; }
  .drawer { width: 100%; padding: 16px; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; } .kpi .val { font-size: 20px; } .kpi .label { font-size: 11px; }
  .card { padding: 14px; border-radius: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card > table.t, .card > div > table.t { min-width: 560px; }
  .form .row, .row { grid-template-columns: 1fr !important; }
  .form { max-width: none; }
  input, select, button, textarea { font-size: 16px; } /* no zoom-on-focus on iPhone */
  :root { --h: 42px; }
  .head .ctl input[type=date] { flex: 1; min-width: 0; }
  .palette { margin-top: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .newmenu { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; width: auto; }
  .gate .card { padding: 20px; }
  .toast { left: 12px; right: 12px; transform: none; bottom: calc(12px + env(safe-area-inset-bottom)); }
}

/* ===================================================================================
   Purchase entry: summary, % pricing, spreadsheet, size-wise, scanning
   =================================================================================== */
.plhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 18px 0 8px; }
.plhead h2 { margin: 0; font-size: 16px; }
.plbtns { display: flex; gap: 8px; flex-wrap: wrap; }
button.primary-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
.ptable td { vertical-align: top; }
.ptable tbody tr { cursor: pointer; }
.ptable tbody tr:hover td { background: var(--grid); }
.ptable tr.bad td { background: var(--bad-soft); }
.ptable tr.lowrow td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.pname { font-weight: 600; }
.pact { white-space: nowrap; text-align: right; }
.pact .link { margin-left: 6px; }
.neg { color: var(--bad); }
.sub.billtxt.guess { color: var(--warn); }

.pricing { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: linear-gradient(0deg, var(--panel), var(--accent-soft) 300%); }
.prhead { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 10px; }
.prgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.prgrid > label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink2); }
.prgrid small { color: var(--muted); font-size: 11.5px; }
.prgrid small .check { display: inline-flex; gap: 6px; align-items: center; color: var(--ink2); }
.pin { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); overflow: hidden; }
.pin input { border: 0; width: 100%; min-width: 0; font-family: var(--mono); font-size: 18px; font-weight: 600; padding: 6px 10px; outline-offset: -2px; }
.pin i { font-style: normal; color: var(--muted); padding: 0 10px; }

.psummary { margin-top: 14px; display: grid; gap: 10px; }
.ps-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.ps-cards.sell { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ps-cards > div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; background: var(--panel); }
.ps-cards small { color: var(--muted); font-size: 12px; }
.ps-cards b { font-family: var(--mono); font-size: 17px; font-variant-numeric: tabular-nums; }
.ps-cards .grand { background: var(--accent-soft); border-color: transparent; }
.ps-cards .grand b { font-size: 20px; color: var(--accent); }
.ps-cards .badge { align-self: flex-start; margin-top: 2px; }
.pactions { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.pactions .sp { flex: 1; }

/* Spreadsheet editor */
.modal.sheet { place-items: stretch; padding: 12px; }
.modal.sheet > .card { width: 100%; max-width: none; max-height: none; height: 100%; display: flex; flex-direction: column; }
.sheethead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.sheethead h2 { margin: 0; font-size: 16px; }
.sheetwrap { flex: 1; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.sheetgrid { border-collapse: separate; border-spacing: 0; margin: 0; }
.sheetgrid th { position: sticky; top: 0; z-index: 2; background: var(--panel); font-size: 12px; white-space: nowrap; }
.sheetgrid td { padding: 0; border-bottom: 1px solid var(--grid); border-right: 1px solid var(--grid); }
.sheetgrid td:first-child { padding: 0 8px; position: sticky; left: 0; background: var(--panel); z-index: 1; }
.sheetgrid input, .sheetgrid select { width: 100%; border: 0; border-radius: 0; background: transparent; padding: 8px; font-family: var(--mono); font-size: 13px; min-height: 36px; }
.sheetgrid input:focus, .sheetgrid select:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--panel); }
.sheetgrid input[readonly] { color: var(--muted); }
.sheetgrid input.auto { color: var(--accent); font-style: italic; }
.sheetgrid tr.grp td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.sheetgrid .ac { position: relative; }
.sheetgrid .ac ul { position: absolute; z-index: 5; left: 0; top: 100%; min-width: 360px; }

/* Size-wise */
.szw .row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; }
.szw label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.szstep { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.szstep .pin input { font-size: 15px; }
.sizegrid b { font-size: 12px; }

/* Scanning */
.scanbtns { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.bigbtn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 600; }
.bigbtn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.scpages { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.scpages figure { margin: 0; width: 110px; }
.scpages img, .scpages .pdfic { width: 110px; height: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: grid; place-items: center; background: var(--grid); font-weight: 700; color: var(--muted); }
.scpages figcaption { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btnlink { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; background: var(--panel); color: var(--ink); text-decoration: none; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -1px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) { .prgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ps-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .prgrid, .ps-cards, .ps-cards.sell { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ps-cards .grand { grid-column: 1 / -1; }
  .plbtns { width: 100%; } .plbtns button { flex: 1; padding: 10px 8px; }
  /* each purchase line becomes a card */
  .card.pcard { overflow-x: visible; }
  .card > div > table.ptable, .psum table.ptable { min-width: 0 !important; }
  .ptable thead { display: none; }
  .ptable, .ptable tbody, .ptable tr, .ptable td { display: block; width: 100%; }
  .ptable tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
  .ptable td { padding: 0; border: 0; text-align: left !important; }
  .ptable td[data-l="#"] { display: none; }
  .ptable td[data-l="Item"] { grid-column: 1 / -1; }
  .ptable td[data-l]:not([data-l="Item"])::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); font-family: var(--sans); }
  .ptable td.pact { grid-column: 1 / -1; display: flex; gap: 16px; justify-content: flex-end; border-top: 1px solid var(--grid); padding-top: 8px; margin-top: 4px; }
  .ptable td.pact .link { font-size: 15px; margin: 0; }
  .modal.sheet { padding: 0; } .modal.sheet > .card { border-radius: 0; }
  .szw .row { grid-template-columns: 1fr; }
  .scanbtns .bigbtn { flex: 1; }
  .pactions .switch { width: 100%; } .pactions button { flex: 1; min-height: 46px; }
}

/* Move data in */
.mvgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 14px 0; }
.mvstep { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.mvstep h3 { margin: 0; font-size: 15px; }
.mvstep .btnlink { align-self: flex-start; margin-top: auto; }
.mvmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.mvmap label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.mvmap label span { color: var(--ink2); }
.mvsample { overflow: auto; max-height: 280px; border: 1px solid var(--line); border-radius: 8px; }
.mvsample td, .mvsample th { white-space: nowrap; }
.okbox { background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 10px 14px; }
.okbox p, .warnbox p { margin: 4px 0 0; color: var(--ink2); }
@media (max-width: 1100px) { .mvgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .mvgrid { grid-template-columns: 1fr; } }

/* Payables / receivables */
.mcards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 8px 0 12px; }
.mcards > div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.mcards small { color: var(--muted); font-size: 12px; }
.mcards b { font-family: var(--mono); font-size: 18px; font-variant-numeric: tabular-nums; }
.mcards .bad { border-color: var(--bad); background: var(--bad-soft); }
.mcards .bad b { color: var(--bad); }
