/* ================================================================ tokens */
:root {
  --bg: #f2f3f7; --card: #fff; --card-line: rgba(15, 23, 42, .05); --text: #0f172a; --muted: #64748b; --line: #e6e8ee;
  --field: #f1f3f7; --tonal: #eceef4;
  --brand: #ffc21a; --brand-2: #ffb000; --brand-ink: #1a1300; --brand-strong: #a16207; --brand-soft: rgba(255, 194, 26, .22);
  --accent: #2563eb; --ink: #0f172a; --on-ink: #fff;
  --ok: #15803d; --ok-bg: #dcfce7; --warn: #b45309; --warn-bg: #fef3c7; --bad: #dc2626; --bad-bg: #fee2e2; --info: #2563eb; --info-bg: #dbeafe;
  --glass: rgba(255, 255, 255, .8); --glass-line: rgba(15, 23, 42, .07); --head-bg: rgba(242, 243, 247, .82);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 2px 8px rgba(15, 23, 42, .04);
  --shadow: 0 2px 4px rgba(15, 23, 42, .04), 0 12px 32px rgba(15, 23, 42, .10);
  --r-lg: 22px; --r: 16px; --r-sm: 12px; --nav-h: 64px;
  --nav-space: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom));
  --av-l: 92%; --av-t: 32%; --av-s: 70%;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0c10; --card: #14181f; --card-line: rgba(255, 255, 255, .06); --text: #f1f5f9; --muted: #8a94a6; --line: #242b36;
    --field: #1b212b; --tonal: #1f2631; --brand-strong: #ffd45c; --brand-soft: rgba(255, 194, 26, .16);
    --accent: #7aa2ff; --ink: #f1f5f9; --on-ink: #0a0c10;
    --ok: #4ade80; --ok-bg: rgba(74, 222, 128, .12); --warn: #fbbf24; --warn-bg: rgba(251, 191, 36, .12);
    --bad: #f87171; --bad-bg: rgba(248, 113, 113, .12); --info: #93b4ff; --info-bg: rgba(122, 162, 255, .14);
    --glass: rgba(24, 29, 37, .82); --glass-line: rgba(255, 255, 255, .07); --head-bg: rgba(10, 12, 16, .82);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 12px 32px rgba(0, 0, 0, .45);
    --av-l: 24%; --av-t: 80%; --av-s: 45%;
    color-scheme: dark;
  }
}

/* ================================================================ base */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15.5px/1.45 Inter, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-space) + 24px);
}
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.025em; margin: 0; line-height: 1.15; }
h2 { font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em; margin: 0 0 .7rem; }
h3 { font-size: .9rem; font-weight: 700; margin: 1.1rem 0 .4rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
small { font-size: .8rem; }
b { font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.center { text-align: center; }
.pad { padding: 0 4px; }
.b { font-weight: 650; }
.grow { flex: 1; min-width: 0; }
.warn-t { color: var(--warn); display: inline-flex; align-items: center; gap: 4px; }
.bad-t { color: var(--bad); }
.good-t { color: var(--ok); }
.ic { width: 20px; height: 20px; flex: none; }
.warn-t .ic, .row-ic .ic { width: 15px; height: 15px; }
.row-ic { display: inline-flex; align-items: center; gap: 8px; }
.amt, .line-total, .trow, .item-side b, .hero-amount, .stat b { font-variant-numeric: tabular-nums; }

.view { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.view.enter > * { animation: rise .28s cubic-bezier(.2, .8, .2, 1) both; }
.view.enter > *:nth-child(2) { animation-delay: .03s; }
.view.enter > *:nth-child(3) { animation-delay: .06s; }
.view.enter > *:nth-child(n+4) { animation-delay: .09s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view.enter > * { animation: none; } }

/* ================================================================ header */
.page-head {
  position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 6px;
  margin: 0 -16px 10px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; min-height: 64px;
  background: var(--head-bg); -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
}
.page-head h1 { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.6rem; }
.page-head .icon-btn { margin-left: -8px; color: var(--text); }
.head-actions { display: flex; gap: 6px; }

/* ================================================================ home hero */
.hero {
  position: relative; overflow: hidden; margin: calc(14px + env(safe-area-inset-top)) 0 14px; padding: 18px 20px 20px;
  border-radius: 26px; color: #fff; box-shadow: var(--shadow);
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(255, 194, 26, .45) 0%, rgba(255, 194, 26, 0) 50%),
    radial-gradient(80% 90% at 0% 100%, rgba(37, 99, 235, .35) 0%, rgba(37, 99, 235, 0) 60%),
    linear-gradient(140deg, #0f172a 0%, #1e293b 100%);
}
.hero::after { content: ""; position: absolute; right: -18px; top: 34px; width: 140px; height: 140px; opacity: .08;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13 2L4 14h7l-1 8 9-12h-7z' fill='%23fff'/%3E%3C/svg%3E"); }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.hero-date { font-size: .82rem; opacity: .7; text-transform: capitalize; }
.hero-name { font-size: 1.15rem; font-weight: 750; letter-spacing: -.01em; }
.lang-btn { border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .1); color: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; }
.hero-label { margin-top: 22px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; opacity: .65; font-weight: 600; }
.hero-amount { font-size: 2.3rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin-top: 2px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; background: rgba(255, 255, 255, .1); font-size: .8rem; font-weight: 600; }
.hero-meta .ic { width: 14px; height: 14px; color: var(--brand); }
.hero-meta .sync.on .ic { color: #4ade80; }
.hero-meta .sync.off { background: rgba(248, 113, 113, .22); }
.hero-meta .sync.off .ic { color: #fca5a5; }

.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 14px 16px 16px; min-height: 104px;
  border: 1px solid var(--card-line); border-radius: var(--r-lg); background: var(--card); color: var(--text);
  font: inherit; font-weight: 700; font-size: .98rem; text-align: left; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .12s;
}
.tile:active { transform: scale(.97); }
.tile-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; background: var(--tonal); }
.tile.primary { background: linear-gradient(150deg, var(--brand) 0%, var(--brand-2) 100%); color: var(--brand-ink); border-color: transparent; box-shadow: 0 8px 22px rgba(255, 176, 0, .32); }
.tile.primary .tile-ic { background: rgba(255, 255, 255, .45); }

.sec-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 22px 4px 10px; }
.sec-title h2 { margin: 0; font-size: 1.1rem; }
.sec-title .link { margin: 0; }
.count { min-width: 24px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--bad-bg); color: var(--bad); font-size: .78rem; font-weight: 700; display: inline-grid; place-items: center; }

/* ================================================================ cards & lists */
.card {
  display: block; background: var(--card); color: inherit; border: 1px solid var(--card-line);
  border-radius: var(--r-lg); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm);
}
a.card { transition: transform .12s; }
a.card:active { transform: scale(.985); }
.card.list { padding: 4px 16px; }
.card.item { display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item-main > b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-main small, .row small, .alert-row small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; text-align: right; white-space: nowrap; }
.item-side small { color: var(--muted); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); color: inherit; }
.row:first-child, h2 + .row, .sec-head + .row, p + .row { border-top: 0; }
.card > .row:first-child { padding-top: 4px; }
.card.list > .row:first-child { padding-top: 12px; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.sec-head h2 { margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.empty-card { text-align: center; padding: 24px 20px; }
.empty-card p { color: var(--muted); margin: 10px 0 16px; }
.empty-ic { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--brand-soft); color: var(--brand-strong); }
.link { font-size: .88rem; font-weight: 650; display: inline-flex; align-items: center; gap: 2px; margin-top: 8px; }
.link .ic { width: 16px; height: 16px; }

.avatar {
  --h: 220; flex: none; display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 14px;
  background: hsl(var(--h) var(--av-s) var(--av-l)); color: hsl(var(--h) 60% var(--av-t));
  font-weight: 750; font-size: .88rem; letter-spacing: .02em;
}
.assign .avatar { width: 36px; height: 36px; border-radius: 12px; font-size: .8rem; }

/* alerts */
.alert { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r); margin: 10px 0 0; font-size: .9rem; font-weight: 600; }
.alert .ic { width: 18px; height: 18px; }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.info { background: var(--info-bg); color: var(--info); }
.alert-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); color: var(--text); }
.alert-row:first-child { border-top: 0; }
.alert-row b { display: block; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-row > .ic { color: var(--muted); width: 18px; }
.alert-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; flex: none; }
.alert-ic .ic { width: 18px; height: 18px; }
.alert-ic.warn { background: var(--warn-bg); color: var(--warn); }
.alert-ic.info { background: var(--info-bg); color: var(--info); }

/* ================================================================ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 14px; border: 0;
  background: var(--tonal); color: var(--text); font: inherit; font-weight: 650; font-size: .95rem; cursor: pointer; text-align: center;
  transition: transform .12s, filter .12s;
}
.btn:active { transform: scale(.97); }
.btn .ic { width: 18px; height: 18px; }
.btn.primary { background: linear-gradient(150deg, var(--brand) 0%, var(--brand-2) 100%); color: var(--brand-ink); box-shadow: 0 6px 18px rgba(255, 176, 0, .3); }
.btn.ok { background: var(--ok-bg); color: var(--ok); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.danger { color: var(--bad); }
.btn.viber .ic { color: #7360f2; }
.btn.wa .ic { color: #25d366; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: .86rem; border-radius: 12px; gap: 6px; }
.btn.sm .ic { width: 16px; height: 16px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; }
.icon-btn.sm .ic { width: 16px; height: 16px; }
.icon-btn:active { background: var(--tonal); }
.day .sec-head .icon-btn { background: var(--tonal); color: var(--text); width: 36px; height: 36px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.btn-row.tight { margin: 0 0 10px; }
.btn-row.send .btn { flex: 1 1 30%; }

/* ================================================================ chips & badges */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; margin-bottom: 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border: 0; background: var(--card); color: var(--text); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--card-line); }
.chip.on { background: var(--ink); color: var(--on-ink); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: var(--tonal); color: var(--muted); border: 0; font-family: inherit; cursor: default; letter-spacing: .01em; }
button.badge { cursor: pointer; }
.badge.ok, .q-accepted, .cr-approved { background: var(--ok-bg); color: var(--ok); }
.badge.warn, .q-sent, .cr-pending { background: var(--warn-bg); color: var(--warn); }
.q-rejected, .cr-rejected { background: var(--bad-bg); color: var(--bad); }
.st-planned { --c: #64748b; } .st-rough { --c: #ea580c; } .st-wiring { --c: #2563eb; } .st-panel { --c: #7c3aed; } .st-finish { --c: #0d9488; } .st-done { --c: #16a34a; }
@media (prefers-color-scheme: dark) { .st-planned { --c: #94a3b8; } .st-rough { --c: #fb923c; } .st-wiring { --c: #7aa2ff; } .st-panel { --c: #a78bfa; } .st-finish { --c: #2dd4bf; } .st-done { --c: #4ade80; } }
.badge[class*="st-"] { color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.badge[class*="st-"]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

/* ================================================================ forms */
input, select, textarea {
  width: 100%; min-width: 0; font: inherit; font-size: 16px; color: var(--text); background: var(--field);
  border: 1.5px solid transparent; border-radius: var(--r-sm); padding: 11px 13px; min-height: 46px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; }
textarea { resize: vertical; min-height: 84px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); background-color: var(--card); box-shadow: 0 0 0 4px var(--brand-soft); }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--brand-2); flex: none; }
input[type="color"] { padding: 3px; width: 46px; flex: none; }
.fld { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; min-width: 0; }
.fld > span { font-size: .76rem; color: var(--muted); font-weight: 650; letter-spacing: .02em; }
.fld.bad input { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }
.check { display: flex; align-items: center; gap: 10px; min-height: 46px; font-size: .92rem; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.span2 { grid-column: span 2; }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }
.inline-form .btn { min-height: 46px; width: 46px; padding: 0; }
.w8 { width: 8.5em; flex: none; }
.w10 { width: 10em; flex: none; }
fieldset { border: 0; background: var(--field); border-radius: var(--r); margin: 0 0 12px; padding: 6px 14px; }
legend { font-size: .76rem; color: var(--muted); font-weight: 650; padding: 8px 0 0; float: left; width: 100%; }
.seg { display: inline-flex; padding: 4px; background: var(--tonal); border-radius: 14px; gap: 4px; }
.seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 650; padding: 9px 18px; border-radius: 10px; cursor: pointer; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }

/* stepper */
.stepper { display: inline-flex; align-items: stretch; border-radius: var(--r-sm); overflow: hidden; background: var(--field); }
.stepper button { width: 40px; border: 0; background: transparent; color: var(--text); font-size: 1.25rem; font-weight: 500; cursor: pointer; }
.stepper button:active { background: var(--brand-soft); }
.stepper input { width: 52px; border: 0; border-radius: 0; text-align: center; padding: 6px 2px; min-height: 42px; background: transparent; font-weight: 700; -moz-appearance: textfield; }
.stepper input:focus { box-shadow: none; background: var(--card); }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ================================================================ quote editor */
.room { padding-top: 12px; }
.room-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.room-name { font-weight: 750; font-size: 1.05rem; flex: 1; background: transparent; padding-left: 4px; }
.room-head > b { font-size: .95rem; color: var(--brand-strong); }
.line { padding: 10px 0; border-top: 1px solid var(--line); }
.line-name { border-color: transparent; background: transparent; padding: 4px; min-height: 34px; font-size: .94rem; font-weight: 550; }
.line-name.static { padding: 4px; }
.line-nums { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.line-nums .price, .line-nums .qty-in { width: 92px; min-height: 42px; padding: 6px 10px; text-align: right; font-weight: 600; }
.line-nums .unit { font-size: .8rem; }
.line-total { margin-left: auto; white-space: nowrap; font-size: .95rem; font-weight: 700; }
.add-sel { margin-top: 10px; color: var(--accent); font-weight: 650; background-color: transparent; box-shadow: inset 0 0 0 1.5px var(--line); border-style: dashed; }
.add-room .row { padding: 0; border: 0; }
.add-room .row .btn { flex: none; }
.totals { margin-top: 8px; padding: 12px 14px; background: var(--field); border-radius: var(--r); }
.trow { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; }
.trow.grand { font-size: 1.2rem; font-weight: 800; border-top: 1.5px solid var(--line); margin-top: 6px; padding-top: 10px; }
.actionbar {
  position: sticky; bottom: calc(var(--nav-space) + 10px); z-index: 5;
  display: flex; align-items: center; gap: 8px; margin: 14px 0; padding: 10px 10px 10px 16px;
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid var(--glass-line); border-radius: 20px; box-shadow: var(--shadow);
}
.actionbar small { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 650; }
.actionbar b { display: block; font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; }

/* ================================================================ jobs */
.stagebar { display: flex; gap: 3px; margin-top: 8px; max-width: 200px; }
.stagebar i { flex: 1; height: 4px; border-radius: 2px; background: var(--tonal); }
.stagebar i.on { background: var(--brand-2); }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: -4px -16px 14px; padding: 0 16px 4px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { white-space: nowrap; padding: 8px 14px; border-radius: 999px; color: var(--muted); font-weight: 650; font-size: .88rem; background: var(--card); box-shadow: inset 0 0 0 1px var(--card-line); }
.tabs a.on { color: var(--on-ink); background: var(--ink); }

.track { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 4px -4px 0; }
.tstep { position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 4px 2px; background: none; border: 0; color: var(--muted); font: inherit; font-size: .68rem; font-weight: 600; line-height: 1.15; text-align: center; cursor: pointer; }
.tstep::before { content: ""; position: absolute; top: 19px; right: 50%; width: 100%; height: 3px; background: var(--tonal); }
.tstep:first-child::before { display: none; }
.tstep.done::before, .tstep.cur::before { background: var(--brand-2); }
.tstep i { position: relative; z-index: 1; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--tonal); color: var(--muted); font-style: normal; font-weight: 750; font-size: .8rem; box-shadow: 0 0 0 3px var(--card); }
.tstep i .ic { width: 15px; height: 15px; stroke-width: 3; }
.tstep.done i { background: var(--brand-2); color: var(--brand-ink); }
.tstep.cur i { background: var(--ink); color: var(--on-ink); box-shadow: 0 0 0 3px var(--card), 0 0 0 6px var(--brand-soft); }
.tstep.cur span { color: var(--text); font-weight: 750; }

.stage-counts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.stat { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 10px; border-radius: var(--r); background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); border: 1px solid var(--card-line); overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--c); }
.stat b { font-size: 1.45rem; font-weight: 800; line-height: 1.1; }
.stat span { font-size: .66rem; color: var(--muted); line-height: 1.15; font-weight: 600; }
.assign { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.card > .assign:first-child, .sec-head + .assign, h2 + .assign { border-top: 0; padding-top: 2px; }
.assign a { font-weight: 600; }
.day { padding-bottom: 12px; }
.day.today { box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--brand); }
.day.today h2::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-2); margin-left: 8px; vertical-align: middle; }
.day.weekend { background: color-mix(in srgb, var(--card) 60%, var(--bg)); box-shadow: none; }
.weeknav { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.weeknav b { flex: 1; text-align: center; font-size: .92rem; }
.weeknav .btn.sm { min-width: 40px; padding: 0 12px; background: var(--card); box-shadow: var(--shadow-sm); }

/* ================================================================ photos */
.pgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pthumb { position: relative; aspect-ratio: 1; border: 0; padding: 0; border-radius: 14px; overflow: hidden; background: var(--tonal); cursor: pointer; }
.pthumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.pthumb:active img { transform: scale(1.04); }
.pthumb .tag { position: absolute; top: 6px; left: 6px; display: grid; place-items: center; width: 22px; height: 22px; background: var(--brand); color: #000; border-radius: 7px; }
.pthumb .tag .ic { width: 13px; height: 13px; }
.pthumb .pdate { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); color: #fff; font-size: .68rem; font-weight: 600; padding: 14px 7px 5px; text-align: left; }
img.full { width: 100%; max-height: 55vh; object-fit: contain; border-radius: var(--r); background: #000; margin-bottom: 14px; display: block; }

/* ================================================================ materials */
.meter { height: 8px; background: var(--tonal); border-radius: 999px; overflow: hidden; margin: 6px 0 10px; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #16a34a); border-radius: 999px; }
.meter i.over { background: linear-gradient(90deg, #f87171, #dc2626); }
.cmp .trow { padding-bottom: 0; font-size: .9rem; }

/* ================================================================ paperwork & measurements */
.pw { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.pw .pw-label { font-weight: 600; font-size: .94rem; }
.pw.done .pw-label { color: var(--muted); text-decoration: line-through; }
.pw-note { margin-top: 8px; min-height: 38px; padding: 7px 11px; font-size: .88rem; }
.checkbtn { display: grid; place-items: center; width: 28px; height: 28px; margin-top: 1px; border-radius: 9px; border: 2px solid var(--line); background: var(--card); color: #fff; font-size: 1rem; font-weight: 800; cursor: pointer; flex: none; transition: all .15s; }
.pw.done .checkbtn { background: #16a34a; border-color: #16a34a; }
.meas { background: var(--field); border-radius: var(--r); padding: 10px 12px 6px; margin-bottom: 10px; }
.meas .row { padding: 0 0 8px; border: 0; }
.meas input { background: var(--card); }
.meas-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0 6px; }
.meas-grid .fld { margin-bottom: 6px; }
.meas-grid input { padding: 6px 8px; min-height: 40px; font-size: 15px; }
.msg { border-top: 1px solid var(--line); padding: 12px 0; }
.msg p { margin: 6px 0 0; font-size: .9rem; padding: 10px 12px; background: var(--field); border-radius: 4px 14px 14px 14px; }

/* ================================================================ more */
.menu { padding: 4px 16px; }
.menu-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); color: var(--text); }
.menu-item:first-child { border-top: 0; }
.menu-item small { display: block; font-size: .8rem; }
.menu-item > .ic { color: var(--muted); width: 18px; }
.menu-ic { --h: 220; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; flex: none; background: hsl(var(--h) var(--av-s) var(--av-l)); color: hsl(var(--h) 60% var(--av-t)); }
.cat-item { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.stock.low { box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--warn); }
details.cust summary { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
details.cust summary::-webkit-details-marker { display: none; }
details.cust[open] summary { margin-bottom: 6px; }
.err { white-space: pre-wrap; font-size: .8rem; background: var(--bad-bg); color: var(--bad); padding: 12px; border-radius: var(--r-sm); }

/* ================================================================ bottom nav */
.bottom-nav {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 10;
  max-width: 560px; margin: 0 auto; height: var(--nav-h); display: flex; justify-content: space-around; padding: 0 6px;
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--glass-line); border-radius: 24px; box-shadow: var(--shadow);
}
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: .68rem; font-weight: 650; }
.nav-ic { display: grid; place-items: center; width: 52px; height: 30px; border-radius: 999px; transition: background .2s, color .2s; }
.nav-ic .ic { width: 22px; height: 22px; }
.bottom-nav a.on { color: var(--text); }
.bottom-nav a.on .nav-ic { background: var(--brand-soft); color: var(--brand-strong); }
.bottom-nav a.on .ic { stroke-width: 2.4; }

/* ================================================================ modal (bottom sheet on phones) & toast */
.modal {
  border: 0; padding: 0; width: 100%; max-width: 560px; max-height: 92vh; margin: auto auto 0;
  border-radius: 26px 26px 0 0; background: var(--card); color: var(--text); box-shadow: var(--shadow);
}
.modal[open] { animation: sheet .28s cubic-bezier(.2, .8, .2, 1); }
.modal::backdrop { background: rgba(10, 12, 16, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
@keyframes sheet { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.modal-body { padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); }
.modal-body::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.modal-body h2 { font-size: 1.2rem; }
@media (min-width: 640px) { .modal { margin: auto; border-radius: 26px; } .modal-body::before { display: none; } .modal-body { padding-top: 20px; } }
.workers-pick .check { min-height: 40px; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-space) + 16px); transform: translate(-50%, 16px) scale(.96);
  background: #0f172a; color: #fff; padding: 11px 18px; border-radius: 999px; font-size: .9rem; font-weight: 600;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s cubic-bezier(.2, .8, .2, 1);
  z-index: 50; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast.bad { background: #dc2626; }

@media (max-width: 420px) {
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meas-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .w10 { width: 7.5em; }
  .stat { padding: 10px 7px; }
  .stat b { font-size: 1.25rem; }
}
@media (min-width: 720px) { .view { padding: 0 24px; } .page-head { margin: 0 -24px 10px; padding-left: 24px; padding-right: 24px; } }

/* ================================================================ print sheets (quote, measurements, photo report) */
body.printing { background: #e9ebef; padding-bottom: 24px; color-scheme: light; }
body.printing .bottom-nav { display: none; }
.print-bar { display: flex; justify-content: space-between; gap: 8px; margin: calc(14px + env(safe-area-inset-top)) 0 8px; }
.sheet { background: #fff; color: #111; max-width: 210mm; margin: 0 auto; padding: 14mm 12mm; font-size: 12px; line-height: 1.4; border-radius: 6px; box-shadow: 0 6px 28px rgba(0, 0, 0, .12); }
.sh-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 3px solid #ffc21a; padding-bottom: 12px; margin-bottom: 14px; }
.co-name { font-size: 17px; font-weight: 800; margin-bottom: 2px; letter-spacing: -.01em; }
.doc { text-align: right; }
.doc-title { font-size: 21px; font-weight: 800; letter-spacing: .06em; }
.sh-cust { display: flex; gap: 24px; margin-bottom: 12px; }
.sh-cust > div { flex: 1; }
.sh-cust small { display: block; color: #666; text-transform: uppercase; font-size: 9.5px; letter-spacing: .06em; margin-top: 4px; font-weight: 600; }
.sh-title { font-size: 14px; margin: 8px 0; }
.sh-table { width: 100%; border-collapse: collapse; }
.sh-table th { text-align: left; background: #f3f4f6; border-bottom: 1px solid #9ca3af; padding: 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; }
.sh-table td { padding: 4px 6px; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
.sh-table .r, .sh-totals .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sh-table tr.grp td { font-weight: 700; background: #fafafa; padding-top: 9px; border-bottom: 1px solid #c4c8cf; }
.sh-table tr.subt td { text-align: right; color: #555; font-style: italic; }
.sh-table tr.subt td:last-child { font-style: normal; }
.sh-totals { margin: 12px 0 12px auto; min-width: 55%; border-collapse: collapse; }
.sh-totals td { padding: 4px 6px; }
.sh-totals tr.grand td { font-size: 15px; font-weight: 800; border-top: 2px solid #111; }
.sh-notes { margin-top: 10px; }
.sh-notes p { margin: 3px 0; }
.sigs { display: flex; justify-content: space-between; gap: 40px; margin-top: 44px; }
.sigs > div { flex: 1; border-top: 1px solid #111; padding-top: 4px; text-align: center; font-size: 11px; }
.meas-t td, .meas-t th { font-size: 11px; }
.ph-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ph-grid figure { margin: 0; break-inside: avoid; }
.ph-grid img { width: 100%; height: 70mm; object-fit: cover; background: #eee; display: block; border-radius: 3px; }
.ph-grid figcaption { font-size: 10.5px; padding-top: 3px; }
@media (max-width: 600px) {
  .sheet { padding: 16px 12px; font-size: 11px; }
  .sh-head, .sh-cust { flex-direction: column; gap: 6px; }
  .doc { text-align: left; }
  .ph-grid img { height: 40vw; }
}
@media print {
  @page { size: A4; margin: 12mm; }
  body, body.printing { background: #fff; padding: 0; font-family: Inter, Arial, sans-serif; }
  .no-print, .bottom-nav, .toast, .modal { display: none !important; }
  .view { max-width: none; padding: 0; }
  .sheet { box-shadow: none; padding: 0; max-width: none; font-size: 11.5px; border-radius: 0; }
  .sh-head, .sh-cust { flex-direction: row; }
  .doc { text-align: right; }
  .sh-table tr { break-inside: avoid; }
  .ph-grid img { height: 75mm; }
}
