@font-face { font-family: 'Heebo'; src: url('assets/heebo-regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Heebo'; src: url('assets/heebo-bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --ink: #16171a; --ink2: #3d4047; --muted: #7c818b; --line: #e3e5e9; --line2: #d2d5db;
  --bg: #f4f5f7; --card: #ffffff; --band: #eff0f2;
  --red: #c8102e; --red-soft: #fbe9ec; --red-ink: #a50d26;
  --ok: #18804a; --ok-soft: #e5f4ec; --warn: #a86400; --warn-soft: #fdf1df;
  --info: #1f5fbf; --info-soft: #e7effc; --bad: #c22b1f; --bad-soft: #fde8e6;
  --wa: #1fa855; --wa-dark: #178a45;
  --r: 14px; --shadow: 0 1px 2px rgba(20, 22, 26, .06), 0 2px 10px rgba(20, 22, 26, .04);
  --top: env(safe-area-inset-top, 0px); --bot: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif; font-size: 16px; line-height: 1.45; }
body.noscroll { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.warn-t { color: var(--warn); font-style: normal; } .bad-t { color: var(--bad); }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.mini { width: 14px; height: 14px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center;
  padding: calc(var(--top) + 6px) 8px 6px; background: rgba(255, 255, 255, .94); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--line); min-height: 56px; }
.tb-title { text-align: center; min-width: 0; }
.tb-title h1 { margin: 0; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-logo { height: 30px; display: block; margin: 0 auto; }
.tb-side { display: flex; } .tb-side.end { justify-content: flex-end; }
.iconbtn { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--ink); }
.iconbtn:active { background: var(--band); }
.iconbtn.del { color: var(--muted); } .iconbtn.wa { color: var(--wa); }

/* ---------- page ---------- */
.page { max-width: 640px; margin: 0 auto; padding: 14px 14px 28px; }
.page.with-tabs { padding-bottom: calc(96px + var(--bot)); }
.page.with-bar { padding-bottom: calc(100px + var(--bot)); }
.sec { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; margin: 12px 0; }
.sec-h { display: flex; align-items: center; gap: 8px; margin: -2px 0 12px; font-size: 15px; font-weight: 700; padding-inline-start: 10px; border-inline-start: 4px solid var(--red); line-height: 1.25; }
.sec-side { margin-inline-start: auto; font-size: 13px; font-weight: 400; color: var(--info); }
.text { white-space: normal; color: var(--ink2); }

/* ---------- tab bar ---------- */
.tabbar { position: fixed; bottom: 0; inset-inline: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--bot)); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; color: var(--muted); padding: 4px 0; }
.tab.on { color: var(--ink); font-weight: 700; } .tab.on .ic { stroke-width: 2.2; }
.tab.plus span { width: 54px; height: 54px; border-radius: 18px; background: var(--red); color: #fff; display: grid; place-items: center; margin-top: -22px; box-shadow: 0 6px 16px rgba(200, 16, 46, .35); }
.tab.plus .ic { width: 28px; height: 28px; stroke-width: 2.4; }

/* ---------- action bar (editors) ---------- */
.actionbar { position: fixed; bottom: 0; inset-inline: 0; z-index: 20; display: flex; gap: 10px; padding: 10px 14px calc(10px + var(--bot));
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.actionbar > * { max-width: 640px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 13px; font-weight: 700; font-size: 15.5px;
  background: var(--band); color: var(--ink); border: 1px solid transparent; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.wa { background: var(--wa); color: #fff; } .btn.wa:active { background: var(--wa-dark); }
.btn.ghost { background: #fff; border-color: var(--line2); }
.btn.danger { color: var(--bad); } .btn.danger:not(.ghost) { background: var(--bad); color: #fff; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.wide { width: 100%; margin-top: 10px; } .btn.big { min-height: 56px; font-size: 17px; }
.btn.grow { flex: 1; } .btn[disabled] { opacity: .45; pointer-events: none; }
.btn .ic { width: 20px; height: 20px; }
.btnrow { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.btnrow .btn { flex: 1; }
.link { display: inline-flex; gap: 6px; align-items: center; color: var(--info); margin-top: 8px; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; background: var(--band); color: var(--ink2); }
.s-wait { background: #eef0f3; color: #4f5560; } .s-sched { background: var(--info-soft); color: var(--info); }
.s-work { background: var(--warn-soft); color: var(--warn); } .s-ready { background: var(--ok-soft); color: var(--ok); }
.s-done { background: #23252a; color: #fff; } .s-cancel { background: #f1f1f1; color: #9a9a9a; text-decoration: line-through; }
.q-draft { background: #eef0f3; color: #4f5560; } .q-sent { background: var(--info-soft); color: var(--info); }
.q-ok { background: var(--ok-soft); color: var(--ok); } .q-no { background: var(--bad-soft); color: var(--bad); } .q-exp { background: var(--warn-soft); color: var(--warn); }
.pay { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.pay-ok { color: var(--ok); } .pay-warn { color: var(--warn); } .pay-bad { color: var(--bad); } .pay-info { color: var(--info); } .pay-mute { color: var(--muted); }
.pillbtn { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- home ---------- */
.hello { margin: 6px 2px 12px; } .hello h2 { margin: 0; font-size: 24px; } .hello span { color: var(--muted); font-size: 14px; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qa { display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; border-radius: var(--r); padding: 16px; font-weight: 700; font-size: 16px; }
.qa:first-child { background: var(--red); }
.qa .ic { width: 24px; height: 24px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.kpi { background: var(--card); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; border-inline-start: 4px solid var(--line2); }
.kpi b { font-size: 22px; line-height: 1.2; } .kpi span { color: var(--muted); font-size: 13px; }
.kpi.ok { border-color: var(--ok); } .kpi.bad { border-color: var(--bad); } .kpi.bad b { color: var(--bad); }
.welcome { background: var(--card); border-radius: var(--r); padding: 18px; margin-top: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.welcome span { color: var(--ink2); }
.note { display: flex; gap: 10px; align-items: center; background: var(--info-soft); color: #173f7a; border-radius: 12px; padding: 12px; margin: 10px 0; font-size: 14px; }
.note > div { flex: 1; } .note .ic { color: inherit; }
.note.demo { background: var(--warn-soft); color: #6b4300; } .note.warn { background: var(--warn-soft); color: #6b4300; }
.note.ok { background: var(--ok-soft); color: #0f5a33; }

/* ---------- lists & cards ---------- */
.list { background: var(--card); border-radius: var(--r); overflow: hidden; }
.sec .list { margin: 0 -14px; border-radius: 0; }
.list.big { box-shadow: var(--shadow); margin: 12px 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); width: 100%; text-align: start; }
.row:last-child { border-bottom: 0; }
.row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row b { font-weight: 700; font-size: 15px; } .row span { color: var(--muted); font-size: 13px; }
.row .go { color: var(--line2); width: 18px; }
.row:active { background: var(--band); }
.att-ok > .ic { color: var(--ok); } .att-bad > .ic { color: var(--bad); } .att-warn > .ic { color: var(--warn); } .att-info > .ic { color: var(--info); }
.cards { display: flex; flex-direction: column; gap: 10px; }
.card { display: block; background: var(--card); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); }
.card:active { transform: scale(.995); }
.card .c1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card .num { font-size: 13px; color: var(--muted); direction: ltr; unicode-bidi: isolate; }
.card .c2 { font-weight: 700; font-size: 16.5px; margin-top: 2px; }
.card .c3 { color: var(--ink2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .c4 { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.card .c4 b { color: var(--ink); font-size: 15px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 34px 16px; color: var(--muted); text-align: center; }
.empty .ic { width: 34px; height: 34px; stroke-width: 1.4; } .empty b { color: var(--ink2); }
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 12px; padding: 0 12px; box-shadow: var(--shadow); color: var(--muted); }
.search input { flex: 1; border: 0; outline: 0; background: none; height: 46px; font-size: 16px; color: var(--ink); min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; align-items: center; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -14px; padding-inline: 14px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.sec .chips.scroll { margin-top: 0; }
.chips-l { font-size: 13px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 7px 13px; border-radius: 999px; background: #fff; border: 1px solid var(--line2); font-size: 14px; white-space: nowrap; color: var(--ink2); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
.chip.add { border-style: dashed; } .chip .ic { width: 15px; height: 15px; }
.sumline { display: flex; justify-content: space-between; padding: 6px 2px 10px; color: var(--muted); } .sumline b { color: var(--ink); font-size: 18px; }

/* ---------- job / customer hero ---------- */
.hero { background: var(--card); border-radius: var(--r); padding: 16px 14px 12px; box-shadow: var(--shadow); }
.hero .h1 { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.h-name { font-size: 21px; font-weight: 700; }
.hero .h2 { color: var(--ink2); margin-top: 2px; }
.steps { display: grid; grid-template-columns: repeat(5, 1fr); margin: 16px 0 8px; position: relative; }
.steps::before { content: ''; position: absolute; top: 7px; inset-inline: 10%; height: 2px; background: var(--line); }
.step { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); position: relative; text-align: center; line-height: 1.2; }
.step i { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--line2); }
.step.on i { background: var(--ok); border-color: var(--ok); } .step.on { color: var(--ink2); }
.step.cur i { box-shadow: 0 0 0 4px var(--ok-soft); } .step.cur { color: var(--ink); font-weight: 700; }
.acts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 10px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px; border-radius: 12px; background: var(--band); font-size: 12px; font-weight: 700; color: var(--ink2); }
.act.wa { background: var(--wa); color: #fff; }
.act:active { filter: brightness(.95); }
.money3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 4px; }
.money3 > div { background: var(--card); border-radius: 12px; padding: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.sec .money3 > div { background: var(--bg); box-shadow: none; }
.money3 span { font-size: 12.5px; color: var(--muted); } .money3 b { font-size: 17px; }
.money3 .due b { color: var(--bad); }
.paystate { margin: 6px 0 8px; }
.kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); } .kv:last-child { border: 0; } .kv span { color: var(--muted); }
.docrow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.docrow:last-child { border: 0; } .docrow > .ic { color: var(--red); }
.dr-main { flex: 1; display: flex; flex-direction: column; } .dr-main span { font-size: 13px; color: var(--muted); }
.log { list-style: none; margin: 0; padding: 0; font-size: 14px; color: var(--ink2); max-height: 260px; overflow: auto; }
.log li { padding: 6px 0; border-bottom: 1px dashed var(--line); } .log li span { display: block; font-size: 12px; color: var(--muted); }
.linked { display: flex; align-items: center; gap: 8px; background: var(--band); border-radius: 10px; padding: 8px 10px; font-size: 13px; color: var(--ink2); margin-bottom: 10px; }
.linked span { flex: 1; }

/* ---------- forms ---------- */
.fld { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; position: relative; min-width: 0; }
.lbl { font-size: 13px; color: var(--muted); font-weight: 700; }
.lbl:empty { display: none; }
.fld input, .fld textarea, .fld select, .ro { width: 100%; border: 1px solid var(--line2); border-radius: 11px; background: #fff; padding: 11px 12px; font-size: 16px; outline: 0; min-height: 46px; -webkit-appearance: none; appearance: none; }
.fld textarea { resize: none; line-height: 1.5; overflow: hidden; }
.fld input:focus, .fld textarea:focus, .fld select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22, 23, 26, .08); }
.fld input[dir=ltr] { text-align: right; }
.fld input[type=date], .fld input[type=datetime-local] { text-align: right; min-height: 46px; display: block; }
.fld select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: 18px 50%, 13px 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.ro { background: var(--band); border-color: transparent; color: var(--ink2); display: flex; align-items: center; }
.fld.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.fld.inline input { max-width: 140px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.sugg { position: absolute; top: 100%; inset-inline: 0; z-index: 15; background: #fff; border-radius: 11px; box-shadow: 0 8px 26px rgba(0, 0, 0, .14); overflow: hidden; }
.sugg:empty { display: none; }
.sugg button { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 12px; border-bottom: 1px solid var(--line); text-align: start; }
.sugg button span { color: var(--muted); font-size: 14px; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line2); border-radius: 11px; overflow: hidden; background: #fff; min-height: 46px; }
.stepper button { width: 44px; align-self: stretch; font-size: 22px; color: var(--ink2); }
.stepper button:active { background: var(--band); }
.stepper input { border: 0 !important; box-shadow: none !important; text-align: center !important; padding: 0; min-height: 44px; width: 100%; border-radius: 0; }
.stepper b { flex: 1; text-align: center; font-size: 18px; }
.seg { display: flex; background: var(--band); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; padding: 10px 4px; border-radius: 9px; font-size: 14px; color: var(--ink2); }
.seg button.on { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.seg.small button { font-size: 13px; padding: 9px 2px; }
.tgl { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 15px; cursor: pointer; }
.tgl input { position: absolute; opacity: 0; pointer-events: none; }
.tgl i { width: 46px; height: 28px; border-radius: 99px; background: var(--line2); position: relative; flex: none; transition: background .15s; }
.tgl i::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: inset-inline-start .15s; }
.tgl input:checked + i { background: var(--ok); } .tgl input:checked + i::after { inset-inline-start: 21px; }
.tot { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tot span { color: var(--ink2); } .tot b { font-size: 17px; }
.tot.big { background: var(--red-soft); margin: 4px -14px; padding: 12px 14px; border: 0; } .tot.big b { font-size: 22px; color: var(--red-ink); }
.item { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; background: #fcfcfd; }
.item-top { display: flex; gap: 6px; align-items: flex-start; } .item-top .fld { flex: 1; }
.item-top .iconbtn { margin-top: 20px; }
.item-nums { display: grid; grid-template-columns: 1.1fr 1fr .9fr; gap: 8px; }
.item-nums .fld { margin-bottom: 0; }
.fld.sum b { min-height: 46px; display: flex; align-items: center; font-size: 15px; }
.declare { font-size: 14px; color: var(--ink2); background: var(--band); padding: 10px 12px; border-radius: 10px; margin: 0 0 12px; }
.sigbtn { width: 100%; min-height: 108px; border: 1.5px dashed var(--line2); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); background: #fff; padding: 8px; }
.sigbtn.has { border-style: solid; }
.sigbtn img { max-height: 64px; max-width: 100%; }
.sigbtn small { font-size: 11.5px; color: var(--muted); text-align: center; }
.sigbtn span { font-weight: 700; color: var(--ink2); }
.cat-row { display: grid; grid-template-columns: 1fr 96px 40px; gap: 8px; align-items: start; }
.cat-row .fld { margin-bottom: 6px; } .cat-row .iconbtn { margin-top: 2px; }

/* ---------- photos ---------- */
.photos { margin-bottom: 8px; }
.photos + .photos { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.ph-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ph-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ph-grid > span { grid-column: 1 / -1; }
.ph { aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--band); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-full { width: 100%; border-radius: 12px; display: block; }

/* ---------- sheet ---------- */
#sheet { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; justify-content: flex-end; }
.sh-back { position: absolute; inset: 0; background: rgba(15, 16, 19, .42); opacity: 0; transition: opacity .2s; }
.sh-panel { position: relative; background: var(--bg); border-radius: 20px 20px 0 0; max-height: 92vh; display: flex; flex-direction: column; transform: translateY(30px); opacity: 0; transition: transform .22s ease, opacity .22s; width: 100%; max-width: 640px; margin: 0 auto; }
#sheet.in .sh-back { opacity: 1; } #sheet.in .sh-panel { transform: none; opacity: 1; }
#sheet.full .sh-panel { height: 94vh; }
.sh-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 4px 8px; }
.sh-head h2 { margin: 0; font-size: 17px; padding-inline-start: 6px; }
.sh-body { overflow-y: auto; padding: 4px 16px calc(18px + var(--bot)); -webkit-overflow-scrolling: touch; }
.menu { display: flex; flex-direction: column; background: var(--card); border-radius: var(--r); overflow: hidden; }
.mi { display: flex; align-items: center; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); text-align: start; width: 100%; }
.mi:last-child { border: 0; } .mi > div { display: flex; flex-direction: column; } .mi span { font-size: 13px; color: var(--muted); }
.mi .ic { color: var(--red); } .mi.danger, .mi.danger .ic { color: var(--bad); } .mi.cur { background: var(--band); justify-content: space-between; }
.confirm-t { font-size: 17px; margin: 6px 0 4px; }
.tpls { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.tpl { display: block; background: var(--card); border-radius: 12px; padding: 12px; border: 1px solid var(--line); }
.tpl b { display: block; color: var(--wa-dark); margin-bottom: 4px; } .tpl span { color: var(--ink2); font-size: 14px; }
.tpl.hl { border-color: var(--wa); box-shadow: 0 0 0 3px rgba(31, 168, 85, .15); }
.prev { min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.prev img { width: 100%; border-radius: 6px; box-shadow: 0 2px 14px rgba(0, 0, 0, .14); margin-bottom: 10px; background: #fff; }
.fmt { margin: 6px 0 8px; }
.spin { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--red); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sigpad { position: relative; background: #fff; border-radius: 14px; border: 1px solid var(--line2); height: min(46vh, 300px); touch-action: none; }
.sigpad canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.sigline { position: absolute; inset-inline: 24px; bottom: 30%; border-bottom: 1px dashed var(--line2); pointer-events: none; }

#toast { position: fixed; z-index: 80; left: 50%; bottom: calc(100px + var(--bot)); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 15px; opacity: 0; pointer-events: none; transition: .2s; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.ok { background: var(--ok); } #toast.bad { background: var(--bad); }
.fatal { padding: 40px 20px; display: flex; flex-direction: column; gap: 8px; text-align: center; }

@media (min-width: 700px) {
  .page { padding-top: 22px; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .ph-grid { grid-template-columns: repeat(6, 1fr); }
}

/* =========================================================
   DOCUMENTS (A4, rendered off-screen and turned into PDF)
   Copies Stav's own forms: title right, logo left, red rule,
   grey bands with a red bar, dark table header.
   ========================================================= */
#docstage { position: fixed; top: 0; left: -12000px; width: 794px; pointer-events: none; }
.doc { width: 794px; min-height: 1123px; padding: 40px 54px 26px; background: #fff; color: #1b1d21; font-family: 'Heebo', Arial, sans-serif; font-size: 14px; line-height: 1.45; direction: rtl; display: flex; flex-direction: column; }
.doc .ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.d-head { display: flex; justify-content: space-between; align-items: flex-start; }
.d-title h1 { font-size: 33px; margin: 0 0 6px; font-weight: 700; letter-spacing: 0; }
.d-title div { font-size: 14px; color: #33363c; line-height: 1.75; }
.d-logo { width: 280px; margin-top: 2px; }
.d-rule { height: 3px; background: #c8102e; margin: 14px 0 12px; }
.d-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0 44px; margin-bottom: 4px; }
.d-f { display: flex; align-items: flex-end; gap: 10px; min-height: 30px; }
.d-f label { color: #3d4047; white-space: nowrap; flex: none; padding-bottom: 3px; }
.d-f > span { flex: 1; border-bottom: 1px solid #cdd0d5; min-height: 24px; padding: 0 4px 2px; font-weight: 700; color: #111; }
.d-sec { background: #eff0f2; border-right: 6px solid #c8102e; padding: 7px 14px; margin: 14px 0 6px; }
.d-sec h2 { margin: 0; font-size: 15.5px; font-weight: 700; }
.d-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 44px; }
.d-grid.three { grid-template-columns: 1fr 1fr 1fr; gap: 6px 26px; margin-bottom: 6px; }
.d-table { width: 100%; border-collapse: collapse; margin-top: 2px; }
.d-table th { background: #232428; color: #fff; font-weight: 700; padding: 10px 12px; font-size: 14px; text-align: center; }
.d-table td { border: 1px solid #d5d7db; padding: 9px 12px; text-align: center; vertical-align: top; }
.d-table .desc { text-align: right; width: 52%; }
.d-empty { color: #9a9ea6; }
.d-bottom { display: grid; grid-template-columns: 1fr 330px; gap: 34px; margin-top: 20px; align-items: start; }
.d-notes h3 { margin: 0 0 6px; font-size: 15px; }
.d-totals .r { display: flex; justify-content: space-between; padding: 9px 12px; border-bottom: 1px solid #dcdee2; }
.d-totals .r b { font-weight: 700; }
.d-totals .r.total { background: #f8e7ea; font-size: 17px; font-weight: 700; border-bottom: 0; }
.d-text { padding: 2px 4px 5px; border-bottom: 1px solid #cdd0d5; min-height: 28px; line-height: 1.6; margin-bottom: 2px; }
.d-text.plain { border-bottom: 1px solid #cdd0d5; }
.d-label { color: #3d4047; margin: 4px 0 2px; }
.d-inline { display: flex; align-items: flex-end; gap: 10px; margin: 6px 0 2px; }
.d-inline label { color: #3d4047; white-space: nowrap; flex: none; padding-bottom: 3px; }
.d-inline > span { flex: 1; border-bottom: 1px solid #cdd0d5; min-height: 26px; padding: 0 4px 3px; font-weight: 700; }
.d-checks { display: flex; gap: 70px; margin: 4px 0 6px; }
.d-check { display: inline-flex; align-items: center; gap: 8px; }
.d-check i { width: 17px; height: 17px; border: 1.5px solid #9a9ea6; display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-size: 13px; font-weight: 700; line-height: 1; }
.d-check i.on { background: #c8102e; border-color: #c8102e; color: #fff; }
.d-declare { font-size: 13px; margin: 10px 0 2px; color: #2b2e33; }
.d-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; margin-top: 6px; }
.d-sign { display: flex; align-items: flex-end; gap: 10px; }
.d-sign label { color: #3d4047; white-space: nowrap; padding-bottom: 3px; }
.d-sigbox { flex: 1; height: 54px; border-bottom: 1px solid #9a9ea6; display: flex; align-items: flex-end; justify-content: center; }
.d-sigbox img { max-height: 50px; max-width: 220px; }
.d-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid #dcdee2; font-size: 12.5px; color: #4a4d55; }
.doc > .d-foot { margin-top: auto; }
.d-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.d-photos figure { margin: 0; }
.d-ph { width: 100%; height: 255px; background-size: cover; background-position: center; border-radius: 4px; background-color: #f1f2f4; }
.d-photos figcaption { font-size: 12px; color: #6b6f78; margin-top: 4px; }
.d-bottom + .d-grid { margin-top: 18px; }
