:root {
  --brand: #122433; --accent: #18b169; --brand-ink: #fff; --bg: #f4f6f9; --card: #fff;
  --ink: #15202b; --muted: #5b6b7b; --line: #e3e8ee; --warn-bg: #fff5e0;
  --warn-ink: #8a5a00; --err: #c0392b; --rec: #d93a3a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f151c; --card: #18212b; --ink: #e8eef4; --muted: #93a3b3;
    --line: #2a3644; --warn-bg: #3a2e12; --warn-ink: #ffcf73; --brand: #e8eef4;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
header { display: flex; align-items: center; gap: 6px; padding: calc(env(safe-area-inset-top) + 10px) 12px 10px 16px;
  background: #fff; border-bottom: 1px solid #e3e8ee; }
.logo-head { height: 30px; width: auto; display: block; }
.logo-hero { width: min(300px, 80%); display: block; margin: 18px 0 6px; }
.spacer { flex: 1; }
.admin-tag { color: #122433; font-size: 14px; }
.bizbar { background: var(--card); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px;
  padding: 6px 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand { font-weight: 700; }
.biz { flex: 1; font-size: 13px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header button.link { color: #122433; font-weight: 600; font-size: 15px; padding: 8px 6px; }
main { max-width: 520px; margin: 0 auto; padding: 16px 16px calc(env(safe-area-inset-bottom) + 24px); }
h1 { font-size: 24px; margin: 8px 0; } h2 { font-size: 19px; margin: 6px 0; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; } .between { justify-content: space-between; }
input, textarea { width: 100%; font: inherit; padding: 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); color: var(--ink); margin: 8px 0; }
button { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 13px 16px; border-radius: 12px; width: 100%; cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
button.link { background: none; border: 0; color: var(--brand); width: auto; padding: 8px; }
.view { text-align: left; }
#v-record, #v-busy { text-align: center; }
.mic { width: 150px; height: 150px; border-radius: 50%; margin: 28px auto 12px; display: grid; place-items: center;
  background: var(--accent); color: #fff; border: 0; box-shadow: 0 8px 24px rgba(24,177,105,.35); }
.mic.rec { background: var(--rec); animation: pulse 1.2s infinite; box-shadow: 0 8px 24px rgba(217,58,58,.4); }
@keyframes pulse { 50% { transform: scale(1.06); } }
.timer { font-variant-numeric: tabular-nums; color: var(--muted); margin-bottom: 18px; }
.type { margin-top: 16px; text-align: left; } .type summary { color: var(--brand); cursor: pointer; text-align: center; }
.spinner { width: 54px; height: 54px; margin: 60px auto 20px; border: 5px solid var(--line);
  border-top-color: var(--brand); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
td { padding: 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
td.amt { text-align: right; white-space: nowrap; padding-left: 8px; }
td .q { color: var(--muted); font-size: 12px; }
.tbc { color: var(--warn-ink); font-weight: 600; }
.totals { margin-top: 10px; font-size: 14px; }
.totals div { display: flex; justify-content: space-between; padding: 2px 0; }
.totals .grand { font-size: 18px; font-weight: 700; border-top: 2px solid var(--accent); margin-top: 4px; padding-top: 6px; }
.warn, .questions { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 10px; margin-top: 10px; font-size: 14px; }
.questions ul { margin: 4px 0 0 18px; padding: 0; }
.actions { display: grid; gap: 10px; margin-top: 14px; }
.hist { list-style: none; padding: 0; margin: 0; }
.hist li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; cursor: pointer; }
.err { color: var(--err); min-height: 1em; }
details summary { cursor: pointer; margin-top: 10px; }

/* My pack */
.gap { gap: 12px; }
.tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; background: var(--line); padding: 4px; border-radius: 12px; margin: 10px 0 12px; }
.tabs button { border: 0; padding: 9px 4px; font-size: 14px; background: transparent; border-radius: 9px; }
.tabs button.on { background: var(--card); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.ptab .card { margin-bottom: 12px; }
.ptab > button { margin-bottom: 12px; }
.form label { display: block; font-size: 13px; color: var(--muted); margin-top: 8px; }
.form input, .form textarea { margin: 4px 0 0; }
.form .check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; }
.form .check input { width: auto; margin: 0; }
.filebtn { display: block; text-align: center; padding: 12px; border-radius: 12px; border: 1px dashed var(--brand);
  color: var(--brand); margin-top: 8px; cursor: pointer; }
.filebtn.primary { background: var(--accent); border-color: var(--accent); color: #fff; border-style: solid; font-weight: 600; }
.filebtn.busy { opacity: .6; pointer-events: none; }
.logo { max-height: 64px; max-width: 160px; border-radius: 6px; background: #fff; }
.pricewrap { max-height: 60vh; overflow: auto; margin-top: 6px; }
.ptable { font-size: 13px; }
.ptable td { padding: 3px 2px; border-bottom: 1px solid var(--line); }
.ptable input { margin: 0; padding: 6px; font-size: 13px; border-radius: 6px; }
.ptable .c-code { width: 22%; } .ptable .c-unit { width: 16%; } .ptable .c-price { width: 22%; }
.ptable .del { width: 28px; padding: 4px; border: 0; background: none; color: var(--err); font-size: 18px; }
.ptable tr.desc td { border-bottom: 0; padding-bottom: 0; }
.plain { list-style: none; padding: 0; margin: 8px 0 0; }
.plain li { padding: 9px 0; border-top: 1px solid var(--line); }
.plain li:first-child { border-top: 0; }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 9px; background: var(--line); color: var(--muted); margin-right: 6px; }
.mini { display: inline; width: auto; padding: 2px 6px; border: 0; background: none; color: var(--brand); font-size: 13px; }
.mini.danger { color: var(--err); }
.digest { white-space: pre-wrap; font-size: 13px; color: var(--muted); max-height: 240px; overflow: auto; }
.btnrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.nowrap { white-space: nowrap; padding-left: 8px; }

.planbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 16px;
  background: #e6f6ee; color: #12623f; font-size: 13px; font-weight: 600; }
.planbar.bad { background: #fdeceb; color: #a1281c; }
.planbar .mini { color: inherit; text-decoration: underline; white-space: nowrap; }
.okmsg { background: #e6f6ee; color: #12623f; border-radius: 10px; padding: 10px; font-size: 14px; }
.card.plan { margin-bottom: 12px; }
.card.plan button { margin-top: 10px; }
#v-login a { color: var(--accent); }

.otp { font-size: 26px; letter-spacing: 10px; text-align: center; font-weight: 700; }

/* install guide */
.sheet-bg { position: fixed; inset: 0; background: rgba(18,36,51,.55); display: flex; align-items: flex-end;
  justify-content: center; z-index: 50; padding: 0; }
.sheet { background: var(--card); color: var(--ink); width: 100%; max-width: 520px; border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(env(safe-area-inset-bottom) + 18px); text-align: left; box-shadow: 0 -10px 40px rgba(0,0,0,.25);
  max-height: 92vh; overflow: auto; animation: up .25s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }
.sheet-icon { width: 60px; height: 60px; border-radius: 14px; border: 1px solid var(--line); }
.sheet h2 { margin: 12px 0 4px; font-size: 21px; }
.steps-i { list-style: none; padding: 0; margin: 14px 0; counter-reset: s; }
.steps-i li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.steps-i li:first-child { border-top: 0; }
.ico-i { flex: none; width: 40px; height: 40px; border-radius: 10px; background: #e6f6ee; color: #12623f;
  display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.note { background: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 10px 0 14px; }
#inst-native { margin: 14px 0 6px; }
#inst-later { width: 100%; margin-top: 4px; color: var(--muted); }
#install-again { margin-top: 20px; color: var(--accent); font-weight: 600; }
@media (min-width: 600px) { .sheet-bg { align-items: center; } .sheet { border-radius: 22px; } }

/* quotes, invoices, status */
.sbadge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px;
  background: var(--line); color: var(--muted); text-transform: capitalize; vertical-align: middle; }
.sbadge.sent { background: #e7f0fb; color: #1f5fa8; } .sbadge.accepted, .sbadge.ok { background: #e6f6ee; color: #12623f; }
.sbadge.declined, .sbadge.bad { background: #fdeceb; color: #a1281c; } .sbadge.invoiced { background: #efe9fb; color: #5b3aa8; }
.sbadge.warnb { background: #fff5e0; color: #8a5a00; }
.seg { display: flex; align-items: center; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.seg button { width: auto; padding: 8px 14px; font-size: 14px; border-radius: 99px; }
.seg button.on { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.tabs.tabs3 { grid-template-columns: repeat(3, 1fr); }
.workbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 16px;
  background: #fff5e0; color: #8a5a00; font-size: 13px; font-weight: 600; cursor: pointer; }
.workbar.bad { background: #fdeceb; color: #a1281c; }
.workbar .mini { color: inherit; text-decoration: underline; }
#btn-as-quoted { margin: 4px auto 14px; max-width: 320px; display: block; }
.hist li .row > span:last-child { white-space: nowrap; padding-left: 10px; }

/* navigation */
.logo-btn { border: 0; background: none; padding: 0; width: auto; cursor: pointer; }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(3, 1fr);
  background: rgba(255,255,255,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid #e3e8ee; padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px); }
.bottomnav button { border: 0; background: none; color: #6b7b8c; font-size: 12px; font-weight: 600; padding: 6px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; border-radius: 12px; }
.bottomnav .ni { font-size: 20px; line-height: 1; }
.bottomnav button.on { color: #122433; background: #e6f6ee; }
main { padding-bottom: calc(env(safe-area-inset-bottom) + 96px); }
.backlink { width: auto; border: 0; background: none; color: var(--accent); font-weight: 700; padding: 4px 0 12px; font-size: 15px; }

/* client response card */
.status-card { margin-top: 14px; }
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.status-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 6px;
  font-weight: 700; font-size: 15px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); color: var(--ink); }
.status-grid .si { font-size: 22px; line-height: 1; }
.status-grid button[data-st=sent].on { background: #1f5fa8; border-color: #1f5fa8; color: #fff; }
.status-grid button[data-st=accepted].on { background: #12935a; border-color: #12935a; color: #fff; }
.status-grid button[data-st=declined].on { background: #c0392b; border-color: #c0392b; color: #fff; }

/* history filters + status edges */
.fchips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.fchips::-webkit-scrollbar { display: none; }
.fchips button { width: auto; flex: none; padding: 7px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; }
.fchips button b { opacity: .6; margin-left: 2px; }
.fchips button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.fchips button.on.f-sent { background: #1f5fa8; border-color: #1f5fa8; }
.fchips button.on.f-accepted, .fchips button.on.f-paid { background: #12935a; border-color: #12935a; }
.fchips button.on.f-declined, .fchips button.on.f-overdue { background: #c0392b; border-color: #c0392b; }
.fchips button.on.f-unpaid { background: #b07700; border-color: #b07700; }
.hist li { border-left: 5px solid var(--line); }
.hist li.st-sent { border-left-color: #1f5fa8; } .hist li.st-accepted, .hist li.st-paid { border-left-color: #12935a; }
.hist li.st-declined, .hist li.st-overdue { border-left-color: #c0392b; } .hist li.st-unpaid { border-left-color: #d49a00; }
.hist li.st-invoiced { border-left-color: #6a45c2; }
.hist li .row.small { margin-top: 4px; gap: 8px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bottomnav { background: rgba(24,33,43,.92); border-top-color: #2a3644; }
  :root:not([data-theme="light"]) .bottomnav button.on { color: #e8eef4; background: #1d3a2e; }
}

/* My work pipeline */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 18px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 10px 10px 9px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--card); color: var(--ink); text-align: left; }
.tile .tn { font-size: 24px; font-weight: 800; line-height: 1.05; }
.tile .tl { font-size: 12px; font-weight: 700; }
.tile .ta { font-size: 11px; color: var(--muted); }
.tile.empty { opacity: .55; }
.tile.t-go .tn { color: #12935a; } .tile.t-bad .tn { color: #c0392b; } .tile.t-warn .tn { color: #b07700; }
.tile.t-blue .tn { color: #1f5fa8; } .tile.t-ok .tn { color: #12935a; } .tile.t-grey .tn { color: var(--muted); }
.tile.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(24,177,105,.18); opacity: 1; }
.tile.on.t-bad { border-color: #c0392b; box-shadow: 0 0 0 3px rgba(192,57,43,.18); }
.stage-title { font-size: 18px; margin: 4px 0 10px; }
.stage-title .muted { font-weight: 500; display: block; margin-top: 2px; }
.li-actions { display: flex; gap: 8px; margin-top: 10px; }
.li-actions button { width: auto; padding: 8px 14px; font-size: 14px; font-weight: 700; border-radius: 10px; }
.li-actions button.go { background: var(--accent); border-color: var(--accent); color: #fff; }
.hist li.st-draft { border-left-color: #8796a5; }
