:root {
  --ink: #17273e;
  --sub: #51637a;
  --blue: #204fbf;
  --blue-deep: #153d9a;
  --line: #d7dfe9;
  --rule: #e3e8ef;
  --edge: #becbdb;
  --field: #8191a4;
  --fog: #f5f7fa;
  --mist: #e9f0fb;
  --hover: #edf2f8;
  --pick: #e5edfc;
  --paper-back: #e4eaf2;
  --amber: #7a4310;
  --amber-bg: #fff5e4;
  --amber-line: #ecc68c;
  --red: #922c1f;
  --red-bg: #fff3f1;
  --red-line: #efbdb4;
  --green: #1f5c3c;
  --green-bg: #ebf6ef;
  --green-line: #b5d9c3;
  --info: #1c3f8f;
  --info-bg: #eef3fd;
  --info-line: #c6d5f4;
  color: var(--ink);
  background: var(--fog);
  font: 16px/1.48 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box }
body { margin: 0; min-height: 100dvh; background: var(--fog) }
h1, h2, h3, p, dl, dd, ol, ul, figure { margin: 0 }
ol, ul { padding: 0 }
[hidden], #paper { display: none !important }
h1, h2, h3 { line-height: 1.18; letter-spacing: -.022em; text-wrap: balance }
h1 { font-size: 1.9rem }
h2 { font-size: 1.18rem }
h3 { font-size: 1rem }
p { text-wrap: pretty }
a { color: var(--blue); text-underline-offset: .17em }
code { font: .84em/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--sub); overflow-wrap: anywhere }
::selection { color: var(--ink); background: #cddeff }
:focus-visible { outline: 3px solid #3971d8; outline-offset: 3px }
* { scrollbar-width: thin; scrollbar-color: #b6c4d6 transparent }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap }
.icon { width: 19px; height: 19px; flex: none; vertical-align: middle }
.wrap { width: min(calc(100% - 48px), 1240px); margin-inline: auto }

button, .button, input, select, textarea { font: inherit; font-size: .9375rem; color: inherit }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 42px; padding: 8px 14px; background: white; border: 1px solid var(--edge);
  border-radius: 7px; color: var(--ink); font-weight: 600; line-height: 1.32;
  cursor: pointer; text-decoration: none; text-align: center;
  transition: background-color .15s, border-color .15s, color .15s;
}
button:hover, .button:hover { background: var(--hover); border-color: #899db5 }
button:disabled, button[aria-disabled="true"] { opacity: .5; cursor: default }
button:disabled:hover { background: white; border-color: var(--edge) }
.primary { color: white; background: var(--blue); border-color: var(--blue) }
.primary:hover { color: white; background: var(--blue-deep); border-color: var(--blue-deep) }
.primary:disabled:hover { background: var(--blue); border-color: var(--blue) }
.plain, .link { background: transparent; border-color: transparent }
.plain:hover { background: var(--hover); border-color: transparent }
.link { min-height: 36px; padding: 4px 0; color: var(--blue); font-weight: 600 }
.link:hover { background: transparent; border-color: transparent; text-decoration: underline }
.danger { color: var(--red) }
.danger:hover { color: var(--red); background: var(--red-bg); border-color: var(--red-line) }
.square { min-width: 42px; padding: 8px }
.busy { position: relative; color: transparent !important }
.busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border: 2px solid currentColor; border-color: var(--blue) transparent var(--blue) var(--blue); border-radius: 50%; animation: spin .8s linear infinite }
.primary.busy::after { border-color: white transparent white white }
@keyframes spin { to { transform: rotate(1turn) } }

input, select, textarea {
  display: block; width: 100%; min-width: 0; min-height: 42px; padding: 9px 10px;
  background: white; border: 1px solid var(--field); border-radius: 6px; caret-color: var(--blue);
}
textarea { resize: vertical; line-height: 1.45 }
input[readonly] { background: var(--fog) }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; margin: 0; flex: none; accent-color: var(--blue) }
input[type="file"] { padding: 6px; background: var(--fog) }
input[type="file"]::file-selector-button { margin-right: 10px; padding: 6px 12px; border: 1px solid var(--edge); border-radius: 6px; background: white; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer }
input[type="number"] { appearance: textfield }
input[type="number"]::-webkit-inner-spin-button { appearance: none }
::placeholder { color: #607087; opacity: 1 }
[aria-invalid="true"] { border-color: #a4382b }
.field { display: grid; gap: 5px; font-size: .9rem; font-weight: 600; min-width: 0 }
.field > span:first-child { display: flex; justify-content: space-between; gap: 8px }
.hint { color: var(--sub); font-size: .82rem; font-weight: 400 }
.field-error { color: var(--red); font-size: .84rem; font-weight: 500 }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: .92rem; cursor: pointer }
.check input { margin-top: 2px }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0 }
legend { padding: 0; font-size: .9rem; font-weight: 600 }

.notice { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border: 1px solid var(--info-line); border-radius: 8px; background: var(--info-bg); color: var(--info); font-size: .9rem; overflow-wrap: anywhere }
.notice .icon { margin-top: 1px }
.notice p + p, .notice ul { margin-top: 4px }
.notice ul { padding-left: 18px }
.notice.warn { border-color: var(--amber-line); background: var(--amber-bg); color: var(--amber) }
.notice.bad { border-color: var(--red-line); background: var(--red-bg); color: var(--red) }
.notice.ok { border-color: var(--green-line); background: var(--green-bg); color: var(--green) }
.notice b { color: inherit }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border: 1px solid var(--amber-line); border-radius: 999px; background: var(--amber-bg); color: var(--amber); font-size: .78rem; font-weight: 650; line-height: 1.5; white-space: nowrap }
.chip.bad { border-color: var(--red-line); background: var(--red-bg); color: var(--red) }
.chip.ok { border-color: var(--green-line); background: var(--green-bg); color: var(--green) }
.chip.calm { border-color: var(--line); background: var(--fog); color: var(--sub) }
.fine { color: var(--sub); font-size: .86rem }
.muted { color: var(--sub) }

#note { position: fixed; bottom: 16px; left: 50%; z-index: 20; width: max-content; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 8px; background: var(--ink); color: white; font-size: .9rem; box-shadow: 0 6px 22px rgb(23 39 62 / 26%); transform: translateX(-50%) }
#note:empty { display: none }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 1.22rem; font-weight: 750; letter-spacing: -.035em; text-decoration: none; white-space: nowrap }
.product-mark { flex: none }
.by { font-size: .94rem; font-weight: 500; letter-spacing: normal; white-space: nowrap }
.by img { width: auto; height: 1.1em; vertical-align: -.23em }

.boot { display: grid; place-items: center; align-content: center; gap: 14px; min-height: 100dvh; color: var(--sub) }

/* Sign-in */
.signin { display: grid; place-items: center; min-height: 100dvh; padding: 32px 16px }
.signin-sheet { position: relative; width: min(100%, 430px) }
.signin-sheet::before { content: ""; position: absolute; inset: 10px -8px -8px 10px; border-radius: 16px; background: #d6e2fb; transform: rotate(2.2deg); z-index: -1 }
.signin-card { display: grid; gap: 18px; padding: 30px 30px 28px; background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 2px rgb(23 39 62 / 5%), 0 18px 40px -26px rgb(23 39 62 / 35%) }
.signin .brand { margin-bottom: 6px }
.signin h1 { font-size: 1.65rem }
.signin p { color: var(--sub) }
.signin form { display: grid; gap: 14px }
.signin .primary { min-height: 46px }
.signin-foot { color: var(--sub); font-size: .82rem }

/* Shell */
.app-header { background: white; border-bottom: 1px solid var(--line) }
.bar { display: flex; align-items: stretch; gap: 26px; min-height: 64px }
.bar .brand { align-self: center }
.sections { display: flex; gap: 2px }
.sections a { display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; margin-bottom: -1px; border-bottom: 3px solid transparent; color: var(--sub); font-weight: 600; font-size: .95rem; text-decoration: none }
.sections a:hover { color: var(--blue) }
.sections a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--blue) }
.sections a:focus-visible { outline-offset: -3px }
.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: currentColor }
.dot.warn { background: #c27713 }
.dot.bad { background: #c23b2a }
.account { display: flex; align-items: center; gap: 6px; margin-left: auto; min-width: 0 }
.account-name { display: grid; justify-items: end; min-width: 0; font-size: .84rem; line-height: 1.3; text-align: right }
.account-name b { max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650 }
.account-name span { max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--sub) }
.account .plain { color: var(--sub); font-size: .88rem }
.demo-reset-trigger { min-height: 36px; margin-inline-start: 4px; padding: 6px 10px; white-space: nowrap; font-size: .85rem }
.demo-reset-trigger .icon { width: 16px; height: 16px }
#demo-reset-dialog { width: min(440px, calc(100% - 32px)); max-height: calc(100dvh - 40px); padding: 24px; border: 1px solid var(--edge); border-radius: 12px; color: var(--ink); background: white; box-shadow: 0 16px 60px #10274630 }
#demo-reset-dialog::backdrop { background: #14283f66 }
#reset-description { margin-top: 12px; color: var(--sub) }
#reset-description p + p { margin-top: 8px }
#demo-reset-dialog .panel-actions { justify-content: flex-end; margin-top: 18px }
.strip { border-top: 1px solid var(--line); background: var(--fog); color: var(--sub); font-size: .86rem }
.strip .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; min-height: 40px; padding-block: 6px }
.strip-state { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600 }
.strip .link { min-height: 30px; padding: 0; font-size: .86rem }
.strip[data-tone="warn"] { background: var(--amber-bg); color: var(--amber); border-top-color: var(--amber-line) }
.strip[data-tone="bad"] { background: var(--red-bg); color: var(--red); border-top-color: var(--red-line) }
.strip[data-tone="warn"] .strip-state, .strip[data-tone="bad"] .strip-state { color: inherit }
.strip[data-tone="ok"] .dot { color: #2e8b57 }
.strip[data-tone="busy"] .dot { color: var(--blue); animation: pulse 1.2s ease-in-out infinite }
@keyframes pulse { 50% { opacity: .35 } }

/* Quotes workspace */
.workspace { display: grid; grid-template-columns: minmax(240px, 280px) minmax(0, 1fr); gap: 40px; align-items: start; padding-block: 28px 56px }
.rail { min-width: 0 }
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px }
.rail-head h2 { font-size: 1.2rem }
.rail-head .primary { min-height: 40px; padding-inline: 12px; font-size: .9rem }
.search { position: relative; display: flex; align-items: center }
.search .icon { position: absolute; left: 11px; width: 16px; color: var(--sub); pointer-events: none }
.search input { padding-left: 34px }
.entries { display: grid; gap: 2px; margin-top: 12px }
.entry { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid transparent; border-radius: 8px; color: var(--ink); text-decoration: none; overflow-wrap: anywhere }
.entry:hover { background: #e9eef5 }
.entry[aria-current="page"] { background: var(--pick); border-color: #b7ccef; color: #173f95 }
.entry-client { font-weight: 650 }
.entry-meta { display: flex; flex-wrap: wrap; gap: 2px 8px; color: var(--sub); font-size: .8rem }
.entry-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-variant-numeric: tabular-nums }
.entry-total strong { font-size: .88rem }
.rail-empty { margin-top: 14px; color: var(--sub); font-size: .9rem }
.rail-empty .link { display: inline; min-height: 0; font-size: inherit }

.detail { min-width: 0 }
.back { display: none }
.detail-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 20px }
.detail-title { min-width: 0 }
.detail-title h1 { overflow-wrap: anywhere }
.detail-title h1:focus { outline: none }
.facts { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 6px; color: var(--sub); font-size: .9rem }
.facts > span { display: inline-flex; align-items: center; gap: 6px }
.facts .icon { width: 16px; height: 16px }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px }
.head-actions button { min-height: 40px }
.stale-note { margin-bottom: 14px }

/* Version tabs: paper sheets stacked behind the open one */
.tabs { position: relative; z-index: 1; display: flex; align-items: flex-end; gap: 5px; margin-bottom: -1px; padding-inline: 14px; overflow-x: auto; scrollbar-width: none }
.tabs::-webkit-scrollbar { display: none }
.tab { flex: none; display: grid; justify-items: start; gap: 0; min-height: 0; padding: 8px 16px 9px; border: 1px solid var(--line); border-bottom: 0; border-radius: 9px 9px 0 0; background: var(--paper-back); color: var(--sub); font-weight: 650; line-height: 1.25; text-align: left }
.tab small { color: inherit; font-size: .8rem; font-weight: 500; font-variant-numeric: tabular-nums }
.tab:hover { background: #dfe6f0; border-color: var(--line); color: var(--ink) }
.tab[aria-selected="true"] { padding-block: 11px 10px; background: white; color: var(--ink) }
.tab[aria-selected="true"] small { color: var(--sub) }
.tab:focus-visible { outline-offset: -3px }
.tab-latest { color: var(--blue); font-weight: 650 }

.sheet { background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgb(23 39 62 / 4%), 0 10px 28px -18px rgb(23 39 62 / 22%); font-variant-numeric: tabular-nums }
.sheet:focus { outline: none }
.sheet-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; padding: 18px 22px 12px }
.sheet-head h2 { font-size: 1.05rem }
.sheet-head span { color: var(--sub); font-size: .84rem }
.lines { width: 100%; border-collapse: collapse }
.lines th { padding: 8px 12px; background: #f7f9fb; border-block: 1px solid var(--line); color: var(--sub); font-size: .8rem; font-weight: 600; text-align: right; white-space: nowrap }
.lines td { padding: 12px; border-bottom: 1px solid var(--rule); text-align: right; vertical-align: top; white-space: nowrap }
.lines :is(th, td):first-child { width: 52%; padding-left: 22px; text-align: left; white-space: normal }
.lines :is(th, td):last-child { padding-right: 22px }
.lines tbody tr:last-child td { border-bottom: 0 }
.item-name { display: block; font-weight: 600; overflow-wrap: anywhere }
.item-meta { display: block; margin-top: 2px; color: var(--sub); font-size: .82rem; overflow-wrap: anywhere }
.item-meta code { font-size: .95em }
.cell-detail { display: none }
.line-total { font-weight: 600 }
.was { display: block; color: var(--sub); font-size: .82rem; text-decoration: line-through; text-decoration-color: #b4652a }
.now { display: block; color: var(--amber); font-weight: 650 }
.unit-delta { display: block; margin-top: 2px; color: var(--amber); font-size: .8rem; font-weight: 600 }
tr[data-change] td { background: #fffaf1 }
tr[data-change="missing"] td, tr[data-change="identity"] td { background: #fff8f6 }
.line-flag { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px }
.line-flag .hint { font-size: .8rem }
.accept { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; font-size: .86rem; font-weight: 600; cursor: pointer }
.sheet-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 18px 22px 22px; border-top: 1px solid var(--line) }
.kept { display: flex; align-items: flex-start; gap: 8px; max-width: 34ch; color: var(--sub); font-size: .85rem }
.kept b { color: var(--ink) }
.kept p { margin-top: 2px; font-size: .82rem }
.sums { width: min(100%, 340px); margin-left: auto; font-size: .92rem; font-variant-numeric: tabular-nums }
.sums div { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding-block: 3px }
.sums dt { color: var(--sub) }
.sums dd { font-weight: 550; white-space: nowrap }
.sums .grand { margin-top: 8px; padding-top: 11px; border-top: 1px solid var(--line); font-weight: 650 }
.sums .grand dt { color: var(--ink) }
.sums .grand dd { font-size: 1.3rem; font-weight: 700 }
.history { margin-top: 12px; font-size: .86rem }

/* Price comparison */
.compare { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 28px; margin-bottom: 18px; padding: 18px 20px; border: 1px solid var(--amber-line); border-radius: 12px; background: var(--amber-bg) }
.compare.calm { border-color: var(--green-line); background: var(--green-bg) }
.compare h2 { font-size: 1.12rem }
.compare-copy { display: grid; gap: 6px; align-content: start }
.compare-copy p { color: var(--sub); font-size: .9rem }
.compare-counts { display: flex; flex-wrap: wrap; gap: 6px }
.compare-totals { display: grid; gap: 4px; min-width: 260px; font-variant-numeric: tabular-nums; font-size: .92rem }
.compare-totals div { display: flex; justify-content: space-between; gap: 16px }
.compare-totals dt { color: var(--sub) }
.compare-totals dd { font-weight: 600; white-space: nowrap }
.compare-totals .delta { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--amber-line); font-size: 1.05rem }
.compare-totals .delta dd { color: var(--amber); font-weight: 750 }
.compare.calm .compare-totals .delta { border-top-color: var(--green-line) }
.compare.calm .compare-totals .delta dd { color: var(--green) }
.compare-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px }
.compare-actions .fine { margin-right: auto }

/* Editor */
.editor { background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgb(23 39 62 / 4%), 0 10px 28px -18px rgb(23 39 62 / 22%) }
.editor-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; padding: 18px 22px 0 }
.editor-head h1 { font-size: 1.5rem }
.editor-head h1:focus { outline: none }
.editor-body { display: grid; gap: 22px; padding: 18px 22px 22px }
.editor-fields { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 14px }
.parts { border-top: 1px solid var(--line) }
.parts-head, .part { display: grid; grid-template-columns: minmax(0, 1fr) 140px 128px 42px; align-items: center; column-gap: 14px }
.parts-head { padding-block: 8px; border-bottom: 1px solid var(--line); color: var(--sub); font-size: .8rem; font-weight: 600 }
.parts-head :nth-child(2), .parts-head :nth-child(3) { text-align: right }
.part { min-height: 62px; padding-block: 9px; border-bottom: 1px solid var(--rule); font-size: .92rem }
.part-price { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap }
.part-price small { display: block; color: var(--sub); font-size: .78rem }
.part [data-act="remove-line"] { width: 42px; color: var(--sub) }
.part [data-act="remove-line"]:hover { color: var(--red); background: var(--red-bg) }
.parts-empty { padding: 16px 0; color: var(--sub); font-size: .9rem; border-bottom: 1px solid var(--rule) }
.stepper { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; align-items: stretch; border: 1px solid #aebed0; border-radius: 7px; background: white }
.stepper button { min-height: 38px; padding: 0; border: 0; border-radius: 6px; color: var(--blue) }
.stepper button .icon { width: 15px; height: 15px }
.stepper input { min-height: 38px; padding: 4px 0; border: 0; border-radius: 0; text-align: center; font-variant-numeric: tabular-nums }
.stepper :focus-visible { position: relative; z-index: 1; outline-offset: -2px }
.stepper:has([aria-invalid="true"]) { border-color: #a4382b }
.picker { display: grid; gap: 8px }
.picker-results { max-height: min(46dvh, 26rem); overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--edge); border-radius: 8px; background: white }
.picker-results:empty { display: none }
.pick-group { padding: 7px 13px 5px; background: var(--fog); border-top: 1px solid var(--line); color: var(--sub); font-size: .8rem; font-weight: 600 }
.pick-group:first-child { border-top: 0 }
.pick { display: grid; grid-template-columns: minmax(0, 1fr) max-content; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 8px 13px; border: 0; border-top: 1px solid var(--rule); border-radius: 0; background: white; font-weight: 500; text-align: left }
.pick:first-child, .pick-group + .pick { border-top: 0 }
.pick:hover, .pick:focus-visible { background: var(--fog) }
.pick:focus-visible { outline-offset: -3px }
.pick strong { display: block; font-weight: 600; overflow-wrap: anywhere }
.pick small { display: block; color: var(--sub); font-size: .8rem; overflow-wrap: anywhere }
.pick-price { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .9rem }
.pick:disabled { opacity: 1; cursor: default; background: white }
.pick:disabled .pick-price { color: var(--sub); font-weight: 600 }
.picker-note { padding: 12px 13px; color: var(--sub); font-size: .88rem }
.editor-foot { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 14px 22px; border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; background: rgb(255 255 255 / 96%) }
.editor-sum { display: grid; gap: 1px; color: var(--sub); font-size: .86rem; font-variant-numeric: tabular-nums }
.editor-sum strong { color: var(--ink); font-size: 1.3rem }
.editor-actions { display: flex; flex-wrap: wrap; gap: 8px }
.discard { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; width: 100% }
.discard p { margin-right: auto; font-weight: 600 }
.form-error { flex-basis: 100%; color: var(--red); font-size: .9rem; font-weight: 500 }
.form-error:empty { display: none }

/* First run / empty detail */
.firstrun { display: grid; gap: 20px; max-width: 640px; padding: 30px; background: white; border: 1px solid var(--line); border-radius: 12px }
.firstrun h1 { font-size: 1.6rem }
.firstrun > p { color: var(--sub) }
.steps { display: grid; gap: 0; list-style: none; counter-reset: step }
.steps li { position: relative; display: grid; gap: 2px; padding: 0 0 18px 44px; counter-increment: step }
.steps li::before { content: counter(step); position: absolute; left: 0; top: -2px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--mist); color: var(--blue); font-size: .85rem; font-weight: 700 }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 13.5px; top: 30px; bottom: 2px; width: 1px; background: var(--line) }
.steps li[data-done]::before { content: "✓"; background: var(--green-bg); color: var(--green) }
.steps b { font-weight: 650 }
.steps span { color: var(--sub); font-size: .88rem }
.firstrun-actions { display: flex; flex-wrap: wrap; gap: 8px }

/* Pages: catalogue and supplier */
.page { padding-block: 30px 60px }
.page-head { display: grid; gap: 6px; margin-bottom: 22px; max-width: 70ch }
.page-head p { color: var(--sub) }
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 28px; align-items: start }
.panel { display: grid; gap: 16px; padding: 22px; background: white; border: 1px solid var(--line); border-radius: 12px }
.panel + .panel { margin-top: 20px }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px }
.panel-head h2 { display: flex; align-items: center; gap: 9px }
.status-title .dot { width: 10px; height: 10px }
.status-title[data-tone="ok"] .dot { color: #2e8b57 }
.status-title[data-tone="warn"] .dot { color: #c27713 }
.status-title[data-tone="bad"] .dot { color: #c23b2a }
.status-title[data-tone="busy"] .dot { color: var(--blue); animation: pulse 1.2s ease-in-out infinite }
.status-title[data-tone="empty"] .dot { color: var(--edge) }
.facts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 22px; font-size: .92rem }
.facts-grid dt { color: var(--sub); font-size: .8rem }
.facts-grid dd { font-weight: 600; overflow-wrap: anywhere }
.facts-grid dd small { display: block; color: var(--sub); font-weight: 400 }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px }
.aside { display: grid; gap: 14px; padding: 20px; background: white; border: 1px solid var(--line); border-radius: 12px; font-size: .9rem }
.aside h2 { font-size: 1.05rem }
.aside ol { display: grid; gap: 8px; padding-left: 20px }
.aside li { padding-left: 2px }
.aside p { color: var(--sub) }
.ui-label { color: var(--ink); font-weight: 650 }

/* Import wizard */
.wizard-steps { display: flex; flex-wrap: wrap; gap: 6px 4px; list-style: none; font-size: .85rem }
.wizard-steps li { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--fog); color: var(--sub); font-weight: 600 }
.wizard-steps li span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: white; border: 1px solid var(--line); font-size: .75rem }
.wizard-steps li[aria-current="step"] { background: var(--mist); color: var(--blue) }
.wizard-steps li[aria-current="step"] span { border-color: var(--blue); background: var(--blue); color: white }
.wizard-steps li[data-done] { color: var(--green) }
.wizard-steps li[data-done] span { border-color: var(--green-line); background: var(--green-bg) }
.drop { display: grid; justify-items: start; gap: 10px; padding: 18px; border: 1.5px dashed #a9bad0; border-radius: 10px; background: var(--fog) }
.drop[data-over] { border-color: var(--blue); background: var(--mist) }
.drop p { color: var(--sub); font-size: .88rem }
.choices { display: grid; gap: 10px }
.choice { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 14px 16px; border: 1px solid var(--edge); border-radius: 10px; background: white; cursor: pointer }
.choice:hover { border-color: #899db5 }
.choice:has(input:checked) { border-color: var(--blue); background: #f6f9ff; box-shadow: 0 0 0 1px var(--blue) }
.choice:has(input:focus-visible) { outline: 3px solid #3971d8; outline-offset: 2px }
.choice input { margin-top: 3px }
.choice-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-weight: 650 }
.choice-body { grid-column: 2; display: grid; gap: 8px; min-width: 0 }
.samples { width: 100%; border-collapse: collapse; font-size: .84rem; font-variant-numeric: tabular-nums }
.samples td { padding: 4px 0; border-top: 1px solid var(--rule); vertical-align: top }
.samples td:first-child { width: 7.5rem; padding-right: 10px; color: var(--sub); overflow-wrap: anywhere }
.samples td:last-child { padding-left: 12px; text-align: right; white-space: nowrap; font-weight: 600 }
.samples .blank { color: var(--red); font-weight: 600 }
.tax { display: grid; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--fog) }
.tax-row { display: flex; flex-wrap: wrap; gap: 8px 18px }
.tax .field { max-width: 160px }
.counts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px }
.count { display: grid; gap: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: white; font-size: .8rem; color: var(--sub); text-align: left; font-weight: 600 }
.count b { color: var(--ink); font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums }
button.count { min-height: 0; align-items: start; justify-content: start }
button.count[aria-pressed="true"] { border-color: var(--blue); background: var(--pick); color: var(--blue) }
.count[data-kind="updated"] b { color: var(--amber) }
.count[data-kind="missing"] b, .count[data-kind="invalid"] b { color: var(--red) }
.count[data-kind="added"] b { color: var(--green) }
.table-scroll { max-height: min(60dvh, 34rem); overflow: auto; border: 1px solid var(--line); border-radius: 9px; overscroll-behavior: contain }
.grid-table { width: 100%; border-collapse: collapse; font-size: .86rem; font-variant-numeric: tabular-nums }
.grid-table th { position: sticky; top: 0; z-index: 1; padding: 8px 10px; background: var(--fog); color: var(--sub); font-size: .78rem; font-weight: 600; text-align: left; white-space: nowrap; box-shadow: inset 0 -1px var(--line) }
.grid-table td { padding: 8px 10px; border-top: 1px solid var(--rule); vertical-align: top; overflow-wrap: anywhere }
.grid-table tr:first-child td { border-top: 0 }
.grid-table .num { text-align: right; white-space: nowrap }
.grid-table .was { display: inline; margin-right: 6px }
.grid-table small { display: block; color: var(--sub); font-size: .78rem }
.errors { display: grid; gap: 4px; padding-left: 18px; font-size: .88rem }
.wizard-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 4px }
.wizard-foot .check { margin-right: auto }
.more { color: var(--sub); font-size: .84rem; padding: 8px 10px }

/* Supplier */
.supplier-form { display: grid; gap: 14px }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px }
.logo-box { display: grid; place-items: center; min-height: 120px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: repeating-conic-gradient(#f2f5f9 0 25%, white 0 50%) 0 0 / 16px 16px }
.logo-box img { display: block; max-width: 100%; max-height: 110px; object-fit: contain }
.logo-box p { color: var(--sub); font-size: .88rem }
.file-button { position: relative; overflow: hidden }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; width: 100%; height: 100% }
.file-button:has(input:focus-visible) { outline: 3px solid #3971d8; outline-offset: 3px }
.letterhead { padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: 0 2px 10px rgb(23 39 62 / 7%) }
.letterhead .offer-paper { font-size: .78rem }

/* A4 customer document (shared by print and letterhead preview) */
.offer-paper { color: #172a42; background: white; font-size: 10.5pt; line-height: 1.42; font-variant-numeric: tabular-nums; text-align: left }
.paper-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 14px; border-bottom: 2px solid #244e99 }
.paper-supplier { display: flex; align-items: flex-start; gap: 14px; min-width: 0 }
.paper-logo { display: block; max-width: 46mm; max-height: 20mm; width: auto; height: auto; object-fit: contain }
.paper-supplier-text { display: grid; gap: 1px; min-width: 0; color: #43556c; font-size: .88em; overflow-wrap: anywhere }
.paper-supplier-text strong { color: #172a42; font-size: 1.12em }
.paper-supplier-text span { white-space: pre-line }
.paper-title { flex: none; text-align: right }
.paper-title h1 { color: #244e99; font-size: 1.6em; letter-spacing: -.02em }
.paper-title p { margin-top: 2px; color: #43556c; font-size: .92em }
.paper-parties { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; margin-block: 16px 4px }
.paper-parties dt { color: #506078; font-size: .8em }
.paper-parties dd { font-weight: 650; overflow-wrap: anywhere }
.paper-lines { width: 100%; margin-top: 16px; border-collapse: collapse; font-size: .92em }
.paper-lines th { padding: 7px 6px; background: #eef2f6; color: #384b63; font-size: .86em; font-weight: 650; text-align: right; white-space: nowrap }
.paper-lines td { padding: 8px 6px; border-bottom: 1px solid #d4dce6; text-align: right; vertical-align: top; white-space: nowrap }
.paper-lines :is(th, td):first-child { width: 46%; padding-left: 0; text-align: left; white-space: normal; overflow-wrap: anywhere }
.paper-lines th:first-child { padding-left: 6px }
.paper-lines :is(th, td):last-child { padding-right: 0 }
.paper-lines th:last-child { padding-right: 6px }
.paper-lines td small { display: block; color: #506078; font-size: .86em }
.paper-lines td b { font-weight: 600 }
.paper-bottom { display: flex; justify-content: flex-end; margin-top: 14px }
.paper-sums { width: 58%; font-size: .95em }
.paper-sums div { display: flex; justify-content: space-between; gap: 14px; padding-block: 2px }
.paper-sums dt { color: #43556c }
.paper-sums dd { white-space: nowrap; font-weight: 550 }
.paper-sums .grand { margin-top: 6px; padding-top: 8px; border-top: 1.5px solid #244e99; font-weight: 700 }
.paper-sums .grand dt { color: #172a42 }
.paper-sums .grand dd { font-size: 1.2em; font-weight: 750 }
.paper-foot { margin-top: 22px; padding-top: 8px; border-top: 1px solid #d4dce6; color: #506078; font-size: .8em }

@media (max-width: 1030px) {
  .workspace { grid-template-columns: minmax(210px, 240px) minmax(0, 1fr); gap: 24px }
  .bar { gap: 16px }
  .account-name { display: none }
  .editor-fields { grid-template-columns: 1fr 1fr }
  .editor-fields .field:first-child { grid-column: 1 / -1 }
  .sheet-foot { flex-direction: column; align-items: stretch }
  .kept { max-width: none }
  .compare { grid-template-columns: 1fr }
  .page-grid { grid-template-columns: 1fr }
  .counts { grid-template-columns: repeat(3, minmax(0, 1fr)) }
}

@media (max-width: 760px) {
  .wrap { width: calc(100% - 32px) }
  h1 { font-size: 1.55rem }
  .bar { flex-wrap: wrap; gap: 0; min-height: 0 }
  .bar .brand { min-height: 54px }
  .account { margin-left: auto }
  .account .plain span { display: none }
  .demo-reset-trigger { min-height: 42px; margin: 0; padding-inline: 8px }
  .sections { order: 3; width: calc(100% + 32px); margin-inline: -16px; border-top: 1px solid var(--line) }
  .sections a { flex: 1; justify-content: center; min-height: 46px; padding: 0 6px; font-size: .92rem }
  .strip[data-tone="ok"] { display: none }
  .workspace { display: block; padding-block: 18px 40px }
  .workspace[data-pane="detail"] .rail, .workspace[data-pane="list"] .detail { display: none }
  .back { display: inline-flex; margin: -6px 0 6px; min-height: 40px }
  .detail-head { margin-bottom: 16px }
  .head-actions { width: 100% }
  .head-actions button { flex: 1 1 auto }
  .tabs { padding-inline: 8px }
  .tab { padding-inline: 12px }
  .sheet { border-radius: 10px }
  .sheet-head { padding: 14px 14px 10px }
  .lines thead { display: none }
  .lines, .lines tbody { display: block }
  .lines tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--rule) }
  .lines tbody tr:last-child { border-bottom: 0 }
  .lines td { padding: 0; border: 0 }
  .lines tr[data-change] { background: #fffaf1 }
  .lines tr[data-change="missing"], .lines tr[data-change="identity"] { background: #fff8f6 }
  .lines td:first-child { grid-column: 1 / -1; width: auto; padding: 0 }
  .lines .cell-qty, .lines .cell-unit, .lines .cell-vat { display: none }
  .lines .cell-detail { display: block; grid-column: 1; color: var(--sub); font-size: .86rem; text-align: left; white-space: normal }
  .lines .cell-detail .was, .lines .cell-detail .now { display: inline }
  .lines td:last-child { grid-column: 2; grid-row: 2; padding: 0; align-self: end }
  .sheet-foot { padding: 14px }
  .sums { width: 100% }
  .compare { padding: 14px }
  .compare-totals { min-width: 0 }
  .compare-actions button { flex: 1 1 auto }
  .editor-head, .editor-body { padding-inline: 14px }
  .editor-fields { grid-template-columns: 1fr 1fr; gap: 12px }
  .parts-head { display: none }
  .part { grid-template-columns: minmax(0, 1fr) 44px; grid-template-areas: "name name" "price price" "qty remove"; row-gap: 6px; padding-block: 12px }
  .part-name { grid-area: name }
  .part-price { grid-area: price; text-align: left }
  .part-price small { display: inline }
  .part .stepper { grid-area: qty; width: 150px; grid-template-columns: 42px 1fr 42px }
  .stepper button, .stepper input { min-height: 42px }
  .part [data-act="remove-line"] { grid-area: remove; width: 44px; min-height: 44px }
  .editor-foot { padding: 12px 14px }
  .editor-actions { width: 100% }
  .editor-actions button { flex: 1 1 auto }
  .firstrun { padding: 20px }
  .page { padding-block: 22px 40px }
  .panel, .aside { padding: 16px }
  .pair { grid-template-columns: 1fr }
  .counts { grid-template-columns: repeat(2, minmax(0, 1fr)) }
  .letterhead .paper-head { flex-direction: column; gap: 10px }
  .letterhead .paper-title { text-align: left }
}

@media (max-width: 420px) {
  .brand { gap: 6px; font-size: 1.08rem }
  .brand .product-mark { width: 26px; height: 28px }
  .by { font-size: .84rem }
  .editor-fields { grid-template-columns: 1fr }
  .facts { font-size: .86rem }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important }
}

@media print {
  @page { size: A4; margin: 0 }
  :root, body { background: white; color: #172a42 }
  body > * { display: none !important }
  body > #paper { display: block !important; padding: 16mm 16mm 15mm; -webkit-box-decoration-break: clone; box-decoration-break: clone }
  .offer-paper { font-size: 10.5pt }
  .paper-lines thead { display: table-header-group }
  .paper-lines .closing-sums > td { border: 0; padding: 0; text-align: left; width: auto }
  .closing-lines, .paper-lines tr, .paper-bottom, .paper-head, .paper-parties, .paper-foot { break-inside: avoid }
  .paper-bottom { break-before: avoid }
}
