:root {
  --bg: #f2f4f1; --surface: #ffffff; --ink: #14211f; --muted: #587069; --line: #dbe3df;
  --accent: #0f5e52; --accent-ink: #fff; --accent-soft: #dcefe9; --ring: #1f6feb;
  --amber: #8a5300; --amber-soft: #fbeccb; --blue: #1f4f9a; --blue-soft: #dfe9f9; --green: #176b3a; --green-soft: #d9f0e1; --gray: #4f5b57; --gray-soft: #e7ebe9;
  --danger: #a3261c;
  --shadow: 0 1px 2px rgb(10 30 25 / 6%), 0 10px 28px rgb(10 30 25 / 7%);
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: ui-serif, 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  color-scheme: light;
}
[data-theme='dark'] {
  --bg: #0f1715; --surface: #17211e; --ink: #e9f1ee; --muted: #9db3ab; --line: #28362f;
  --accent: #52c2a8; --accent-ink: #06201a; --accent-soft: #1c3a33; --ring: #79b0ff;
  --amber: #f0b95c; --amber-soft: #3a2d12; --blue: #8db6f5; --blue-soft: #1a2a46; --green: #7fd6a0; --green-soft: #16341f; --gray: #b4c2bc; --gray-soft: #25312c;
  --danger: #ff8a7d;
  --shadow: 0 1px 2px rgb(0 0 0 / 35%), 0 10px 28px rgb(0 0 0 / 30%);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); overflow-x: hidden; }
h1, h2 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.15; }
h2 { font-size: 1.1rem; margin-bottom: 12px; }
h2.mt { margin-top: 22px; }
a { color: var(--accent); }
p { margin: 0 0 12px; }
.mb0 { margin-bottom: 2px; }
h1:focus { outline: none; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; z-index: 20; }
.skip:focus { top: 8px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.muted-title { color: var(--muted); font-weight: 500; font-size: .7em; }
.eyebrow { text-transform: uppercase; letter-spacing: .09em; font-size: .72rem; font-weight: 700; color: var(--accent); margin: 0 0 4px; }

/* boot */
.boot { display: flex; align-items: center; gap: 12px; justify-content: center; min-height: 100vh; color: var(--muted); font-weight: 600; }
.boot-mark, .logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font: 700 1.1rem var(--serif); }
.boot-mark { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.88); opacity: .7; } }

/* top bar */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 12px clamp(14px, 4vw, 40px); border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; font: 600 1.3rem var(--serif); color: var(--ink); text-decoration: none; }
nav[aria-label='Principal'] { display: flex; gap: 4px; flex: 1; }
nav[aria-label='Principal'] a { padding: 8px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .94rem; }
nav[aria-label='Principal'] a:hover { color: var(--ink); }
nav[aria-label='Principal'] a.active { background: var(--accent-soft); color: var(--accent); }
.tools { display: flex; gap: 8px; align-items: center; }
@media (max-width: 640px) {
  .top { gap: 8px 12px; }
  nav[aria-label='Principal'] { order: 3; flex-basis: 100%; overflow-x: auto; }
  .tools { margin-left: auto; }
}

main { max-width: 1120px; margin: 0 auto; padding: clamp(18px, 4vw, 36px) clamp(14px, 4vw, 40px) 36px; }
.foot { text-align: center; color: var(--muted); font-size: .84rem; padding: 0 16px 28px; max-width: 760px; margin: 0 auto; }
.link { background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; padding: 0 2px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: .86rem; color: var(--muted); margin-bottom: 8px; }
.crumb a { color: var(--muted); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 .92rem var(--sans); text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.icon { padding: 0; width: 40px; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: .84rem; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--danger); border-color: var(--line); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 26px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi .k-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kpi strong { font: 600 clamp(1.5rem, 3vw, 2rem) var(--serif); font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: .82rem; color: var(--muted); }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, 1fr); } }

/* board */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.col { background: color-mix(in srgb, var(--surface) 55%, var(--bg)); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.col h2 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 2px; font-family: var(--sans); }
.count { color: var(--muted); font: 600 .85rem var(--sans); }
.card-os { display: flex; flex-direction: column; gap: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.card-os:hover { border-color: var(--accent); transform: translateY(-1px); }
.code { font-family: var(--mono); font-size: .8rem; font-weight: 600; color: var(--accent); text-decoration: none; }
a.code:hover { text-decoration: underline; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.amount { font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 1000px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .board { grid-template-columns: minmax(0, 1fr); } }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px 3px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.badge i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.s-received { background: var(--blue-soft); color: var(--blue); }
.s-diagnosing { background: var(--amber-soft); color: var(--amber); }
.s-ready { background: var(--green-soft); color: var(--green); }
.s-delivered { background: var(--gray-soft); color: var(--gray); }

/* stepper */
.stepper { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 22px; padding: 0; counter-reset: s; }
.stepper li { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; color: var(--muted); font-weight: 600; font-size: .88rem; min-width: 0; }
.stepper .dot { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); font-size: .8rem; }
.stepper li.done { color: var(--ink); }
.stepper li.done .dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stepper li.now { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.stepper li.now .dot { border-color: var(--accent); color: var(--accent); }
@media (max-width: 640px) { .stepper { grid-template-columns: repeat(2, 1fr); } }

/* panels & forms */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
@media (max-width: 880px) { .split { grid-template-columns: minmax(0, 1fr); } }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: clamp(14px, 3vw, 22px); box-shadow: var(--shadow); min-width: 0; }
.form { display: flex; flex-direction: column; gap: 18px; max-width: 820px; margin-bottom: 22px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
legend { font: 600 1.1rem var(--serif); margin-bottom: 10px; padding: 0; }
label { display: flex; flex-direction: column; gap: 5px; font-size: .84rem; font-weight: 600; color: var(--muted); min-width: 0; }
label.block { margin-top: 14px; }
label.inline { flex-direction: row; align-items: center; gap: 8px; }
input, select, textarea { font: 400 1rem var(--sans); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-height: 42px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label.inline select { width: auto; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); } }
.actions { display: flex; justify-content: flex-end; gap: 10px; }
.error { color: var(--danger); font-weight: 600; margin: 4px 0 0; }
.notice { background: var(--amber-soft); color: var(--amber); border-radius: 10px; padding: 10px 14px; font-weight: 600; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; align-self: flex-start; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font: 600 .88rem var(--sans); color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 18px; margin: 0; }
.facts dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--muted); }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.facts .wide { grid-column: 1 / -1; }
@media (max-width: 640px) { .facts { grid-template-columns: minmax(0, 1fr); } }

.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.timeline li { display: flex; flex-direction: column; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -22px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* toolbar */
.toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.search input { max-width: 460px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 14px; font: 600 .86rem var(--sans); cursor: pointer; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* tables */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.panel .table-wrap { box-shadow: none; margin-bottom: 14px; }
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.act { text-align: right; width: 1%; white-space: nowrap; }
@media (max-width: 640px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; text-align: left; }
  .table td.act { width: 100%; justify-content: flex-end; }
  .table td.act::before { content: none; }
}

/* quote editor */
.add-line { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 4px; }
.add-line .grow { flex: 1 1 200px; }
.add-line .qty { flex: 0 0 76px; }
.add-line .price { flex: 0 0 130px; }
@media (max-width: 640px) { .add-line .qty, .add-line .price { flex: 1 1 40%; } .add-line .btn { width: 100%; } }
.totals { margin: 18px 0 0 auto; max-width: 320px; display: flex; flex-direction: column; gap: 8px; }
.totals div { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.totals dt { color: var(--muted); font-weight: 600; font-size: .9rem; }
.totals dt label { font-size: inherit; }
.totals dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.totals .disc { width: 120px; text-align: right; min-height: 36px; }
.totals .grand { border-top: 1px solid var(--line); padding-top: 10px; }
.totals .grand dd { font: 700 1.4rem var(--serif); color: var(--accent); }

.empty { text-align: center; padding: 56px 16px; color: var(--muted); }

/* receipt */
.receipt { background: #fff; color: #111; border: 1px solid var(--line); border-radius: 12px; max-width: 760px; padding: clamp(18px, 4vw, 40px); box-shadow: var(--shadow); }
.receipt header { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid #111; padding-bottom: 14px; margin-bottom: 16px; }
.receipt .brand { color: #111; }
.receipt .logo { background: #111; color: #fff; }
.receipt .muted { color: #555; }
.receipt .r-code { display: flex; flex-direction: column; text-align: right; }
.receipt .r-code strong { font: 700 1.6rem var(--mono); }
.receipt section { margin-bottom: 16px; }
.receipt h2 { font: 700 .74rem var(--sans); text-transform: uppercase; letter-spacing: .08em; color: #555; margin-bottom: 6px; }
.table.plain th, .table.plain td { padding: 6px 4px; color: #111; border-color: #ccc; }
.table.plain tr:hover { background: none; }
.table.plain tfoot td { border-bottom: 0; }
.table.plain .grand td { font-weight: 700; font-size: 1.05rem; border-top: 2px solid #111; }
.terms { color: #444; }
.sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 48px; font-size: .82rem; text-align: center; color: #333; }
.sign span { display: block; border-top: 1px solid #111; margin-bottom: 4px; }
@media (max-width: 640px) {
  .receipt .r-code { text-align: left; }
  .table.plain thead { display: table-header-group; }
  .table.plain, .table.plain tbody, .table.plain tfoot { display: table; width: 100%; }
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .receipt { border: 0; box-shadow: none; max-width: none; padding: 0; }
}

#blazor-error-ui { background: #fbeccb; color: #6b3f00; bottom: 0; box-shadow: 0 -1px 2px rgb(0 0 0 / 20%); display: none; left: 0; padding: .6rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
