/* Backstage. Warm black, editorial. Anton for numbers and titles, Manrope for UI, Plex Mono for amounts. */
:root {
  --bg: #111110;
  --surface: #1b1a18;
  --surface2: #232220;
  --line: #2c2a27;
  --line2: #3a3733;
  --text: #f2f0ea;
  --muted: #9a968c;
  --accent: #ff3b30;
  --ok: #34c759;
  --warn: #ffb020;
  --coral: #ff7a59;
  --radius: 14px;
  --display: 'Anton', 'Arial Narrow', Impact, sans-serif;
  --ui: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --serif: Georgia, 'Times New Roman', 'DejaVu Serif', serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 500 15px/1.45 var(--ui); overflow-x: clip; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.offscreen { position: fixed; left: -9999px; top: 0; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.strong { font-weight: 700; }
.muted { color: var(--muted); }
.pad { padding: 12px 0; }
.ico { flex: none; }

/* state colors */
.s-red { color: var(--accent); }
.s-amber { color: var(--warn); }
.s-green { color: var(--ok); }
.s-none { color: var(--muted); }

/* ---------- mark ---------- */
.mark { display: inline-flex; align-items: flex-end; line-height: 1; }
.mark-e { font-family: var(--serif); font-size: 34px; line-height: .8; color: var(--text); }
.mark-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin: 0 0 3px 2px; }
.mark-xl .mark-e { font-size: 168px; }
.mark-xl .mark-dot { width: 26px; height: 26px; margin: 0 0 14px 6px; }

/* ---------- buttons, forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line2); background: var(--surface2); font-weight: 700; font-size: 14px; white-space: nowrap; transition: background-color .15s, border-color .15s, transform .15s; }
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #ff5046; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); }
.btn.danger { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--accent); border-color: var(--line2); }
.btn.block { width: 100%; }
.btn.tiny { min-height: 44px; font-size: 12px; padding: 0 10px; color: var(--muted); }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--muted); }
.icon-btn:hover { color: var(--text); background: var(--surface2); }
.icon-btn:disabled { opacity: .3; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--text); background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; min-height: 44px; padding: 0 12px; width: 100%; min-width: 0; }
textarea { padding: 10px 12px; line-height: 1.45; resize: vertical; }
input::placeholder, textarea::placeholder { color: #6f6b63; }
input:focus, select:focus, textarea:focus { border-color: var(--muted); outline: none; box-shadow: 0 0 0 2px rgba(242, 240, 234, .12); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input[type=search] { appearance: none; }
input[type=date] { min-width: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lab { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-err { color: var(--accent); font-size: 13px; min-height: 1.2em; }
input.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.suffixed { position: relative; display: block; }
.suffixed input { padding-right: 36px; }
.suf { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; pointer-events: none; }
.pill { min-height: 44px; min-width: 48px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; color: var(--muted); font-weight: 700; font-size: 12px; letter-spacing: .06em; }
.pill[aria-pressed=true] { background: var(--text); color: var(--bg); border-color: var(--text); }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; max-width: 100%; overflow-x: auto; }
.seg-btn { min-height: 44px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; font-size: 13px; white-space: nowrap; }
.seg-btn[aria-pressed=true] { background: var(--text); color: var(--bg); }
.chip { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line2); font-size: 10.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
.brand-urbanhouse { background: #3a3835; color: #fff; border-color: #3a3835; }
.brand-3lton { background: var(--accent); color: #fff; border-color: var(--accent); }
.brand-wromd { background: var(--coral); color: #111; border-color: var(--coral); }
.st-inquiry { color: var(--muted); }
.st-quoting { color: var(--warn); border-color: rgba(255, 176, 32, .4); }
.st-sent { color: var(--text); }
.st-accepted, .st-done, .st-paid { color: var(--ok); border-color: rgba(52, 199, 89, .4); }
.st-invoiced { color: var(--text); border-color: var(--muted); }
.st-lost { color: var(--accent); border-color: rgba(255, 59, 48, .4); }
.muted-chip { color: var(--muted); }
.count { display: inline-flex; min-width: 22px; height: 22px; padding: 0 6px; align-items: center; justify-content: center; margin-left: 8px; border-radius: 999px; background: var(--surface2); color: var(--muted); font: 700 11px var(--ui); }

/* ---------- shell ---------- */
.boot-msg { display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center; min-height: 60vh; color: var(--muted); text-align: center; padding: 24px; }
.shell { min-height: 100vh; }
.rail { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(var(--safe-t) + 12px) 16px 8px; }
.brand { display: inline-flex; align-items: flex-end; gap: 10px; }
.brand:hover { text-decoration: none; }
.brand-name { font-family: var(--display); text-transform: uppercase; letter-spacing: .08em; font-size: 15px; line-height: 1; padding-bottom: 3px; color: var(--muted); }
.dock { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(17, 17, 16, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.dock-link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.dock-link:hover { text-decoration: none; color: var(--text); }
.dock-link[aria-current=page] { color: var(--text); }
.dock-link[aria-current=page] .ico { color: var(--accent); }
.sync { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.sync[data-state=saving] .sync-dot { background: var(--warn); }
.sync[data-state=offline] .sync-dot, .sync[data-state=error] .sync-dot { background: var(--accent); }
.view { padding: 8px 16px calc(96px + var(--safe-b)); max-width: 1240px; margin: 0 auto; min-width: 0; outline: none; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 8px 0 18px; }
.page-title { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .01em; font-size: clamp(36px, 9vw, 56px); line-height: 1; }
.empty { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; padding: 24px 0; color: var(--muted); }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 208px minmax(0, 1fr); }
  .rail { position: sticky; top: 0; height: 100vh; flex-direction: column; align-items: stretch; justify-content: flex-start; padding: 28px 20px; gap: 28px; border-right: 1px solid var(--line); }
  .rail .sync { margin-top: auto; }
  .dock { position: static; display: flex; flex-direction: column; background: none; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; gap: 2px; padding: 0; }
  .dock-link { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
  .dock-link:hover { background: var(--surface); }
  .dock-link[aria-current=page] { background: var(--surface); }
  .view { padding: 28px 32px 64px; width: 100%; }
}

/* ---------- board ---------- */
.hero { display: flex; flex-direction: column; gap: 18px; align-items: flex-start; padding: 12px 0 24px; }
.hero-main { display: block; }
.hero-main:hover { text-decoration: none; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.hero-title { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .005em; font-size: clamp(40px, 12.5vw, 88px); line-height: .96; overflow-wrap: anywhere; }
.hero-when { color: var(--accent); white-space: nowrap; }
@media (min-width: 640px) { .hero { flex-direction: row; justify-content: space-between; align-items: flex-end; } }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--surface); min-width: 0; }
.kpi-wide { grid-column: 1 / -1; }
.kpi-l { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.kpi-v { font-family: var(--display); font-size: 34px; line-height: 1.1; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.kpi-v.sm { font-size: 28px; display: block; }
.kpi-lead .kpi-v { font-size: 56px; }
.kpi-s { font-size: 12px; color: var(--muted); }
.bar { display: block; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 6px 0 2px; }
.bar-fill { display: block; height: 100%; background: var(--ok); border-radius: 3px; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
@media (min-width: 900px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis-4 .kpi-v { font-size: 30px; }
}
.note-card { display: flex; flex-direction: column; gap: 14px; padding: 16px; margin-bottom: 20px; border: 1px solid var(--line2); border-left: 3px solid var(--warn); border-radius: var(--radius); background: var(--surface); }
.note-card p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.note-actions { display: flex; gap: 8px; }
@media (min-width: 640px) { .note-card { flex-direction: row; align-items: center; justify-content: space-between; } }
.block { margin-bottom: 24px; }
.block-h { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; }
.attn { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.attn li + li { border-top: 1px solid var(--line); }
.attn-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 14px; }
.attn-row:hover { background: var(--surface2); text-decoration: none; }
.attn-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--warn); }
.attn-row.sev2 .attn-dot { background: var(--accent); }
.attn-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.attn-t span { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.attn-d { color: var(--muted); font: 500 12px var(--mono); flex: none; }
.older { margin-top: 10px; }
.older summary { min-height: 44px; display: flex; align-items: center; color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.kanban { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 12px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: thin; }
.col { flex: 0 0 min(82vw, 300px); scroll-snap-align: start; display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 900px) { .kanban { margin: 0; padding: 0 0 12px; } .col { flex: 1 0 250px; } }
.col-h { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; padding: 0 2px; }
.col-empty { color: #6f6b63; font-size: 13px; padding: 14px; border: 1px dashed var(--line); border-radius: var(--radius); }
.card { display: flex; flex-direction: column; gap: 6px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: transform .18s ease, border-color .18s ease; }
@media (hover: hover) { .card:hover { transform: translateY(-2px); border-color: var(--line2); text-decoration: none; } }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-date { font: 500 12px var(--mono); color: var(--muted); }
.card-title { font-size: 17px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.card-client { color: var(--muted); font-size: 13px; }
.card-nums { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.card-amt { font-size: 17px; font-weight: 500; }
.card-left { font-size: 12.5px; }
.card-foot { display: flex; gap: 10px; align-items: center; min-height: 0; font-size: 12px; color: var(--muted); }
.card-foot:empty { display: none; }
.flag-floor { color: var(--accent); font-weight: 800; }
.open-n { margin-left: auto; }

/* ---------- event ---------- */
.ev-head { display: grid; gap: 10px; padding: 4px 0 14px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; font-weight: 700; min-height: 44px; margin-left: -4px; }
.back:hover { color: var(--text); text-decoration: none; }
.ev-title { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: clamp(34px, 9vw, 60px); line-height: 1; overflow-wrap: anywhere; }
.ev-meta { color: var(--muted); font-size: 14px; margin-top: 8px; }
.ev-chips { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.status-select { width: auto; min-height: 44px; border-radius: 999px; font-weight: 800; font-size: 13px; letter-spacing: .05em; text-transform: uppercase; padding-left: 16px; border-color: var(--line2); }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 8px; color: var(--muted); font-weight: 700; font-size: 13.5px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab[aria-current=page] { color: var(--text); border-bottom-color: var(--accent); }
@media (min-width: 640px) { .tab { flex: 0 0 auto; padding: 0 20px; font-size: 14.5px; } }
@media (min-width: 900px) { .ev-head { grid-template-columns: 1fr auto; align-items: end; } .back { grid-column: 1 / -1; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; min-width: 0; }
.panel-h { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.panel-head .panel-h { margin: 0; }
.panel .field + .field { margin-top: 14px; }
.grid2, .grid3 { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); margin-bottom: 14px; }
@media (min-width: 640px) { .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.danger-zone { margin-top: 24px; display: flex; }
.q-list { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .q-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.q { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 14px; text-align: left; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-weight: 600; font-size: 14px; }
.q.on { color: var(--muted); }
.q.on .ico { color: var(--ok); }
.cl-add { display: flex; gap: 10px; margin-bottom: 14px; }
.cl-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 10px; }
.cl-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; grid-template-areas: "c t x" ". w x" ". d x"; gap: 6px 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.cl-row .check { grid-area: c; }
.cl-text { grid-area: t; }
.cl-who { grid-area: w; }
.cl-due { grid-area: d; }
.cl-row .icon-btn { grid-area: x; }
@media (min-width: 720px) { .cl-row { grid-template-columns: 44px minmax(0, 1fr) 150px 160px 44px; grid-template-areas: "c t w d x"; } }
.cl-row.done .cl-text { text-decoration: line-through; color: var(--muted); }
.cl-row.overdue .cl-due { border-color: var(--accent); color: var(--accent); }
.cl-empty { padding: 14px 0; }
.check { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; padding: 0; position: relative; }
.check::before { content: ''; width: 24px; height: 24px; border: 2px solid var(--line2); border-radius: 7px; position: absolute; transition: background-color .15s, border-color .15s; }
.check .ico { position: relative; color: #fff; }
.check.on::before { background: var(--ok); border-color: var(--ok); }
.outcome { display: flex; flex-wrap: wrap; gap: 8px; }
.btn.out[aria-pressed=true] { background: var(--text); color: var(--bg); border-color: var(--text); }
.timeline li { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.timeline time { font: 500 12px var(--mono); color: var(--muted); padding-top: 2px; }
@media (max-width: 480px) { .timeline li { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- budget ---------- */
.budget { display: flex; flex-direction: column; }
.budget-main { min-width: 0; }
.vbar { display: grid; gap: 12px; margin-bottom: 16px; }
.vchips { display: flex; gap: 8px; flex-wrap: wrap; }
.vchip { min-height: 44px; min-width: 52px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line2); background: transparent; font-weight: 800; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.vchip[aria-pressed=true] { background: var(--text); color: var(--bg); border-color: var(--text); }
.vchip-tag { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ok); }
.vchip[aria-pressed=true] .vchip-tag { color: #0a7a2a; }
.vactions { display: flex; gap: 8px; flex-wrap: wrap; }
.cmp-list { display: grid; gap: 2px; }
.cmp-row { display: flex; justify-content: space-between; gap: 12px; min-height: 36px; align-items: center; font-size: 14px; border-top: 1px solid var(--line); }
.cmp-row b { font-weight: 500; }
.cmp .panel-head select { width: auto; min-width: 90px; }

.row .c { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.row .lab { font-size: 10.5px; }
.row .val { font-size: 15px; }
.row .sub { color: var(--muted); }
.stack { display: flex; flex-direction: column; align-items: flex-end; }
.stack .sub { font-size: 11px; }
.row.head { display: none; }
.tfoot { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; margin-top: 8px; border-top: 1px solid var(--line); }
.tfoot > div, .tfoot .disc { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tfoot .disc input { width: 120px; }
.rate-pair { display: flex; gap: 6px; }
.rate-pair select { flex: 1 1 auto; }
.rate-pair .num { display: none; flex: 0 0 76px; }
.has-custom .rate-pair .num { display: block; }

@media (max-width: 639px) {
  .row:not(.head) { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px 8px; padding: 12px; margin-bottom: 10px; background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; align-items: end; }
  .row .lab { display: block; }
  .row .c-del { grid-column: 6; grid-row: 1; align-self: start; justify-self: end; margin: -6px -6px 0 0; }
  .row .c-label { grid-column: 1 / 6; grid-row: 1; }
  .r-sales .c-qty { grid-column: 1 / 3; } .r-sales .c-unit { grid-column: 3 / 5; } .r-sales .c-price { grid-column: 5 / 7; }
  .r-sales .c-total { grid-column: 1 / 4; } .r-sales .c-contrib { grid-column: 4 / 7; align-items: flex-end; text-align: right; }
  .r-costs .c-qty { grid-column: 1 / 3; } .r-costs .c-unit { grid-column: 3 / 5; } .r-costs .c-per { grid-column: 5 / 7; }
  .r-costs .c-vat { grid-column: 1 / 3; } .r-costs .c-sup { grid-column: 3 / 7; }
  .r-costs .sub { grid-column: 1 / -1; display: grid; gap: 10px; }
  .r-costs .c-total { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: baseline; }
  .r-work .c-qty { grid-column: 1 / 3; } .r-work .c-rate { grid-column: 3 / 7; }
  .r-work .c-total { grid-column: 1 / 3; } .r-work .c-link { grid-column: 3 / 7; }
  .r-lines { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .r-lines .c-label { grid-column: 1 / -1; grid-row: auto; }
  .r-lines .c-a, .r-lines .c-b, .r-lines .c-c { grid-column: span 2; }
  .r-lines .c-d, .r-lines .c-e { grid-column: span 3; }
  .r-lines .c-label span:not(.lab) { font-weight: 700; }
  .r-lines.muted-row { opacity: .8; }
  .r-lines.total-row { border-color: var(--line2); }
  .r-lines.total-row .c-label { flex-direction: row; }
  .r-lines.total-row .c-a, .r-lines.total-row .c-b, .r-lines.total-row .c-d, .r-lines.total-row .c-e { display: none; }
  .r-lines.total-row .c-c { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; }
  .row .c-unit input.num { text-align: right; }
}
@media (min-width: 640px) {
  .row .lab { display: none; }
  .row.head { display: grid; padding: 0 0 6px; }
  .row.head .c { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .row { display: grid; column-gap: 8px; align-items: center; padding: 4px 0; }
  .rows .row { border-top: 1px solid var(--line); padding: 6px 0; }
  .rows .row:first-child { border-top: 0; }
  .r-sales { grid-template-columns: minmax(0, 1fr) 52px 88px 76px 92px 104px 44px; }
  .r-costs { grid-template-columns: minmax(0, 1fr) 52px 72px 52px 60px 112px 88px 44px; }
  .r-costs .sub { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) 220px auto; gap: 8px; align-items: center; padding-bottom: 4px; }
  .r-costs .sub input { font-size: 14px; min-height: 40px; color: var(--muted); }
  .r-costs .sub select { font-size: 14px; min-height: 40px; }
  .r-work { grid-template-columns: minmax(0, 1fr) 64px 190px 90px 170px 44px; }
  .r-lines { grid-template-columns: minmax(0, 1fr) 90px 90px 110px 74px 74px; }
  .c-total, .c-contrib, .r-lines .c-a, .r-lines .c-b, .r-lines .c-c, .r-lines .c-d, .r-lines .c-e { text-align: right; align-items: flex-end; }
  .row.head .c-total, .row.head .c-contrib { align-items: flex-end; }
  .r-lines.total-row { font-weight: 700; }
  .r-lines.muted-row { color: var(--muted); }
  .tfoot { flex-direction: column; }
  .c-vat { align-items: center; }
}

.summary { position: sticky; top: 0; z-index: 30; margin: 0 -16px 14px; padding: calc(var(--safe-t) + 8px) 16px 8px; background: rgba(27, 26, 24, .97); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line2); box-shadow: 0 8px 24px rgba(0, 0, 0, .45); }
.sum-bar { display: grid; grid-template-columns: 1fr 1fr 1fr 44px; gap: 8px; align-items: center; }
.metric { display: flex; flex-direction: column; min-width: 0; }
.ml { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.mv { font-size: 17px; font-weight: 500; white-space: nowrap; }
.summary[data-state=red] .hl .mv { color: var(--accent); }
.summary[data-state=amber] .hl .mv { color: var(--warn); }
.summary[data-state=green] .hl .mv { color: var(--ok); }
.sum-toggle { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line2); background: transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.sum-toggle .ico { transition: transform .2s; }
.summary.open .sum-toggle .ico { transform: rotate(180deg); }
.sum-detail { display: none; max-height: 62vh; overflow-y: auto; padding: 12px 0 8px; }
.summary.open .sum-detail { display: block; }
.whatif { display: none; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--warn); margin-bottom: 4px; }
.whatif.on { display: block; }
.gauge { position: relative; height: 8px; background: var(--line); border-radius: 4px; margin: 10px 0 6px; }
.gauge-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--muted); transition: width .25s ease, background-color .25s ease; }
.summary[data-state=red] .gauge-fill { background: var(--accent); }
.summary[data-state=amber] .gauge-fill { background: var(--warn); }
.summary[data-state=green] .gauge-fill { background: var(--ok); }
.gauge-tick { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--text); opacity: .55; }
.gauge-tick.floor { background: none; width: 0; border-left: 2px dashed var(--text); opacity: .9; }
.gauge-key { display: flex; gap: 14px; font-size: 11px; color: var(--muted); margin-bottom: 12px; }
.gauge-key span::before { content: ''; display: inline-block; width: 2px; height: 10px; background: var(--text); opacity: .55; margin-right: 6px; vertical-align: -1px; }
.gauge-key .fl::before { background: none; width: 0; border-left: 2px dashed var(--text); opacity: .9; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.metrics .mv { font-size: 15px; }
.floor-box { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.floor-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vchip-v { display: inline-flex; align-self: start; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; border: 1px solid var(--line2); width: fit-content; }
.vchip-v.s-red-chip { color: #fff; background: var(--accent); border-color: var(--accent); }
.vchip-v.s-green-chip { color: var(--ok); border-color: rgba(52, 199, 89, .5); }
.vchip-v.none { color: var(--muted); }
.conc { padding: 12px 0; border-top: 1px solid var(--line); }
.conc h3, .sup-box h3 { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.conc-head { display: flex; justify-content: space-between; align-items: baseline; }
.range-wrap { position: relative; height: 48px; display: flex; align-items: center; margin: 4px 0; }
.range-track { position: absolute; left: 16px; right: 16px; height: 8px; border-radius: 4px; opacity: .6; background: linear-gradient(90deg, var(--ok) 0, var(--ok) var(--a, 100%), var(--warn) var(--a, 100%), var(--warn) var(--r, 100%), var(--accent) var(--r, 100%), var(--accent) 100%); }
.floor-tick { position: absolute; top: 8px; bottom: 8px; width: 0; border-left: 2px dashed var(--text); left: calc(16px + (100% - 32px) * var(--p, 0) / 100); pointer-events: none; z-index: 1; }
.floor-tick[hidden] { display: none; }
.range { -webkit-appearance: none; appearance: none; position: relative; width: 100%; height: 48px; background: transparent; border: 0; padding: 0; min-height: 0; box-shadow: none !important; margin: 0; z-index: 2; touch-action: pan-y; }
.range::-webkit-slider-runnable-track { height: 8px; background: transparent; }
.range::-moz-range-track { height: 8px; background: transparent; }
.range::-webkit-slider-thumb { -webkit-appearance: none; box-sizing: border-box; width: 32px; height: 32px; margin-top: -12px; border-radius: 50%; background: var(--text); border: 4px solid var(--bg); box-shadow: 0 0 0 1px var(--muted); }
.range::-moz-range-thumb { box-sizing: border-box; width: 32px; height: 32px; border-radius: 50%; background: var(--text); border: 4px solid var(--bg); box-shadow: 0 0 0 1px var(--muted); }
.range:disabled { opacity: .4; }
.range.plain::-webkit-slider-runnable-track { background: var(--line2); border-radius: 4px; }
.range.plain::-moz-range-track { background: var(--line2); border-radius: 4px; }
.conc-msg { min-height: 1.4em; font-size: 14px; font-weight: 700; }
.conc-lines { display: grid; gap: 4px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.sup-box { padding-top: 12px; border-top: 1px solid var(--line); }
.sup-box:empty { display: none; }
.sup-row { margin-top: 8px; }
.sup-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 700; }
.sup-top .mono { font-weight: 500; font-size: 13px; color: var(--muted); }
.sup-box .hint { margin-top: 6px; }
@media (max-width: 420px) { .sum-bar .mv { font-size: 15px; } .sum-bar { gap: 6px; } }
@media (min-width: 1240px) {
  .budget { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 24px; align-items: start; }
  .budget-main { grid-column: 1; grid-row: 1; }
  .summary { grid-column: 2; grid-row: 1; top: 16px; margin: 0; padding: 18px; border: 1px solid var(--line2); border-radius: var(--radius); max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: none; background: var(--surface); }
  .sum-bar { grid-template-columns: 1fr 1fr; gap: 14px; }
  .sum-bar .metric:first-child { grid-column: 1 / -1; }
  .sum-bar .hl .mv { font-size: 30px; font-family: var(--display); font-weight: 400; letter-spacing: .01em; }
  .sum-toggle { display: none; }
  .sum-detail { display: block; max-height: none; overflow: visible; }
}

/* ---------- quote ---------- */
.quote-tools { margin-bottom: 18px; display: grid; gap: 12px; }
.qt-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sent-info { color: var(--ok); font-weight: 700; font-size: 14px; }
.floor-info { font-weight: 700; font-size: 14px; }
.terms-edit { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px; }
.terms-edit summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; font-weight: 700; color: var(--muted); }
.terms-edit[open] { padding-bottom: 16px; }
.terms-edit .pill { margin-bottom: 12px; }
.paper-wrap { overflow-x: auto; padding-bottom: 8px; }
.doc { background: #fff; color: #111; max-width: 820px; margin: 0 auto; padding: 22px 18px 28px; border-radius: 4px; font: 400 13px/1.5 Arial, Helvetica, sans-serif; }
.doc-title { font: 700 19px/1.25 Arial, Helvetica, sans-serif; padding-bottom: 10px; border-bottom: 3px solid #ff3b30; margin-bottom: 12px; }
.doc-meta { font-weight: 600; }
.doc-by { color: #555; margin: 2px 0 18px; font-size: 12px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.doc-table th { text-align: left; font-weight: 700; padding: 6px 6px; border-bottom: 1.5px solid #111; font-size: 11px; }
.doc-table td { padding: 7px 6px; border-bottom: 1px solid #ddd; vertical-align: top; font-variant-numeric: tabular-nums; }
.doc-table .r { text-align: right; white-space: nowrap; }
.doc-table th.r { text-align: right; }
.doc-table .disc td { font-weight: 700; }
.doc-total { margin: 16px 0 20px; font-size: 15px; text-align: right; }
.doc-h { font: 700 14px Arial, Helvetica, sans-serif; margin-bottom: 8px; }
.doc-term { margin-bottom: 8px; }
@media (min-width: 640px) { .doc { padding: 40px 48px 48px; font-size: 14px; } .doc-title { font-size: 22px; } .doc-table { font-size: 13px; } }

/* ---------- money ---------- */
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 8px; }
.live-row { margin-bottom: 14px; }
.live-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.chart { width: 100%; max-width: 720px; height: auto; display: block; margin: 4px 0 8px; }
.chart .axis { stroke: var(--line2); stroke-width: 1; }
.chart .target { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .bar-rect.under { fill: var(--text); opacity: .85; }
.chart .bar-rect.hit { fill: var(--ok); }
.chart .bar-rect.est { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 3 2; }
.chart .ax { fill: var(--muted); font: 600 10px var(--ui); }
.chart .ax.tgt { fill: var(--accent); font-family: var(--mono); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.lg::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.lg-under::before { background: var(--text); }
.lg-hit::before { background: var(--ok); }
.lg-est::before { background: none; border: 1.2px dashed var(--muted); }
.lg-target::before { height: 0; width: 14px; border-radius: 0; border-top: 2px dashed var(--accent); vertical-align: 3px; }
.mlist { display: flex; flex-direction: column; }
.mrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: center; }
.mrow.head { display: none; }
.mrow:hover { text-decoration: none; background: var(--surface2); }
.m0 { display: flex; flex-direction: column; min-width: 0; }
.m0 small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.mnums { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; }
.mnums span::before { content: attr(data-l) ' '; color: var(--muted); font-family: var(--ui); font-size: 11px; margin-right: 4px; }
@media (min-width: 640px) {
  .mrow, .mrow.head { grid-template-columns: minmax(0, 1fr) 96px 110px 110px 110px; padding: 12px 8px; }
  .mrow.head { display: grid; padding-top: 0; padding-bottom: 6px; border-top: 0; }
  .mrow.head span { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .mrow.head .m2, .mrow.head .m3, .mrow.head .m4 { text-align: right; }
  .mnums { display: contents; }
  .mnums span { text-align: right; font-size: 14px; }
  .mnums span::before { content: none; }
}

/* ---------- gear ---------- */
.search { margin-bottom: 18px; }
.supplier-card .order { display: flex; flex-wrap: wrap; gap: 8px; counter-reset: s; }
.order li { counter-increment: s; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px 0 8px; border: 1px solid var(--line2); border-radius: 999px; font-weight: 700; font-size: 13px; }
.order li::before { content: counter(s); display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 50%; background: var(--text); color: var(--bg); font: 700 11px var(--mono); }
.gear-cat { margin-bottom: 22px; }
.gear-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.gear-list li + li { border-top: 1px solid var(--line); }
.gear-item { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 8px 14px; background: transparent; border: 0; text-align: left; color: var(--text); }
.gear-item:hover { background: var(--surface2); }
.gear-item.blocked { opacity: .5; }
.gi-main { display: flex; flex-direction: column; min-width: 0; }
.gi-main strong { font-weight: 700; font-size: 14.5px; overflow-wrap: anywhere; }
.gi-main small { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.gi-meta { display: flex; align-items: center; gap: 10px; flex: none; color: var(--muted); font-size: 12px; }

/* ---------- settings ---------- */
.live-read { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cmp-chip { text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 600; padding: 6px 12px; }
.cmp-chip.low { color: var(--warn); border-color: rgba(255, 176, 32, .4); }
.cmp-chip.ok { color: var(--ok); border-color: rgba(52, 199, 89, .4); }
.sup-list li { display: grid; grid-template-columns: 24px minmax(0, 1fr) 44px 44px 44px; gap: 4px; align-items: center; margin-bottom: 8px; }
.sup-n { color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- modal, toast ---------- */
.backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .62); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line2); border-bottom: 0; border-radius: 20px 20px 0 0; padding: 22px 20px calc(20px + var(--safe-b)); animation: rise .22s cubic-bezier(.2, .8, .2, 1); }
.sheet-title { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: 28px; letter-spacing: .01em; margin-bottom: 14px; }
.sheet-body { display: flex; flex-direction: column; gap: 14px; }
.sheet-msg { font-size: 16px; line-height: 1.45; }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 640px) { .backdrop { align-items: center; } .sheet { border-radius: 20px; border-bottom: 1px solid var(--line2); padding-bottom: 20px; } }
.toast { position: fixed; z-index: 120; left: 16px; right: 16px; bottom: calc(76px + var(--safe-b)); display: flex; gap: 14px; align-items: center; justify-content: space-between; max-width: 420px; margin: 0 auto; padding: 12px 16px; background: var(--text); color: var(--bg); border-radius: 12px; font-weight: 700; font-size: 14px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: none; pointer-events: auto; }
.toast-action { color: var(--accent); text-decoration: underline; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; padding: 0 4px; }
@media (min-width: 900px) { .toast { bottom: 24px; left: 260px; right: auto; margin: 0; } }

/* ---------- login ---------- */
.login-body { min-height: 100vh; display: flex; }
.login { margin: auto; width: 100%; max-width: 360px; padding: 32px 24px; display: flex; flex-direction: column; align-items: center; gap: 28px; }
.login-form { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.login-form input { min-height: 52px; text-align: center; }
.login-form .btn { min-height: 52px; }

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