:root {
  --bg: #f6f3ee; --surface: #ffffff; --surface-2: #f0ece4; --line: #e2dcd1;
  --ink: #1f2420; --ink-2: #4b524c; --muted: #7a8079;
  --brand: #2f6b4f; --brand-ink: #ffffff; --brand-soft: #e3efe8;
  --accent: #b5502b; --accent-soft: #f7e6dd;
  --ok: #2e7d4f; --warn: #a66a00; --warn-soft: #fbefd6; --bad: #b3261e; --bad-soft: #fbe3e1;
  --chart: #2f6b4f; --chart-2: #b5502b; --grid: #ebe6dc;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121513; --surface: #1b1f1c; --surface-2: #232825; --line: #2f3531;
    --ink: #eef1ec; --ink-2: #c3c9c2; --muted: #8e958d;
    --brand: #5fae86; --brand-ink: #0d1a13; --brand-soft: #1f3529;
    --accent: #e08a62; --accent-soft: #3a261d;
    --ok: #6cc690; --warn: #e2b04a; --warn-soft: #3a2f17; --bad: #f08a80; --bad-soft: #3d1f1c;
    --chart: #6cbf94; --chart-2: #e8956d; --grid: #2a302c;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121513; --surface: #1b1f1c; --surface-2: #232825; --line: #2f3531;
  --ink: #eef1ec; --ink-2: #c3c9c2; --muted: #8e958d;
  --brand: #5fae86; --brand-ink: #0d1a13; --brand-soft: #1f3529;
  --accent: #e08a62; --accent-soft: #3a261d;
  --ok: #6cc690; --warn: #e2b04a; --warn-soft: #3a2f17; --bad: #f08a80; --bad-soft: #3d1f1c;
  --chart: #6cbf94; --chart-2: #e8956d; --grid: #2a302c;
  --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Tamil", sans-serif; -webkit-tap-highlight-color: transparent; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
[hidden] { display: none !important; }

/* ---- shell ---- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--hero-a); color: var(--hero-ink); }
.brand { flex: 1; display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; min-width: 0; }
.brand #pageTitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.18); font-size: 13px; flex: none; }
.icon-btn { border: 0; background: transparent; color: inherit; font-size: 22px; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; flex: none; }
.icon-btn:hover { background: rgba(127,127,127,.15); }
.searchbar { position: sticky; top: 60px; z-index: 19; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.searchbar input { width: 100%; }
.search-results { max-height: 60vh; overflow: auto; }
main { max-width: 860px; margin: 0 auto; padding: 12px 16px calc(84px + env(safe-area-inset-bottom)); outline: none; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 0 8px; color: var(--muted); text-decoration: none; font-size: 11.5px; position: relative; }
.tabbar a .ti { display: grid; place-items: center; height: 24px; }
.icon-btn { display: inline-grid; place-items: center; }
.tabbar a.on { color: var(--brand); font-weight: 600; }
.badge { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
@media (min-width: 900px) {
  .tabbar { top: 60px; bottom: 0; right: auto; width: 96px; flex-direction: column; border-top: 0; border-right: 1px solid var(--line); padding-top: 8px; }
  .tabbar a { flex: none; padding: 12px 0; }
  main { padding-left: 112px; padding-bottom: 32px; max-width: 980px; }
}

/* ---- building blocks ---- */
.section { margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.section h2 { font-size: 15px; font-weight: 650; flex: 1; }
.section .count { color: var(--muted); font-weight: 500; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin: 8px 0; }
.card.tap { cursor: pointer; }
.card.tap:active { background: var(--surface-2); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.title { font-weight: 600; }
.sub { color: var(--ink-2); font-size: 13.5px; }
.muted { color: var(--muted); font-size: 13px; }
.clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { text-align: center; color: var(--muted); padding: 18px 8px; font-size: 14px; border: 1px dashed var(--line); border-radius: var(--radius); margin: 8px 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 550; white-space: nowrap; }
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.ok { background: var(--brand-soft); color: var(--ok); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
  .chips a { text-decoration: none; color: inherit; }
.chips button, .chips a { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; white-space: nowrap; cursor: pointer; }
.chips button.on, .chips a.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 4px; }
@media (min-width: 600px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; text-decoration: none; color: inherit; }
.stat b { display: block; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat span { color: var(--ink-2); font-size: 12.5px; }
.stat.alert b { color: var(--accent); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 8px 12px; font-size: 14px; font-weight: 550; cursor: pointer; text-decoration: none; min-height: 38px; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 10px; min-height: 32px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.fab { position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 15; border: 0; border-radius: 16px; background: var(--accent); color: #fff; padding: 14px 18px; font-size: 15px; font-weight: 650; box-shadow: 0 4px 14px rgba(0,0,0,.2); cursor: pointer; }
@media (min-width: 900px) { .fab { bottom: 24px; right: calc(50% - 470px); } }
.due-over { color: var(--bad); font-weight: 600; }
.due-today { color: var(--accent); font-weight: 600; }
.banner { border-radius: var(--radius); padding: 10px 12px; margin: 10px 0; font-size: 14px; background: var(--warn-soft); color: var(--ink); border: 1px solid var(--line); }
.banner.info { background: var(--brand-soft); }
.kv { display: grid; grid-template-columns: minmax(96px, 34%) 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 12px -16px 4px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; position: sticky; top: 60px; background: var(--bg); z-index: 5; }
.tabs button { border: 0; background: none; padding: 10px 12px; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2.5px solid transparent; white-space: nowrap; cursor: pointer; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.timeline .item { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.timeline .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
table.data td.num, table.data th.num { text-align: right; }
.scroll-x { overflow-x: auto; }
.chart-box { position: relative; height: 170px; }
.chart-title { font-size: 13px; color: var(--ink-2); font-weight: 600; margin: 4px 0; }
.summary { white-space: pre-wrap; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }

/* ---- forms ---- */
label.f { display: block; margin: 10px 0; }
label.f > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 4px; font-weight: 550; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 11px; font-size: 16px; min-height: 44px; }
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--brand); flex: none; }
label.check { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.err { color: var(--bad); font-size: 14px; min-height: 1em; margin: 6px 0; }
.form-actions { display: flex; gap: 8px; margin-top: 14px; position: sticky; bottom: 0; background: var(--surface); padding: 10px 0 4px; }
.form-actions .btn { flex: 1; min-height: 46px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.quick button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 5px 10px; font-size: 13px; cursor: pointer; }

/* ---- sheet ---- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.42); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: up .18s ease-out; }
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 18px; } }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
.sheet-head { display: flex; align-items: center; padding: 12px 12px 6px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { flex: 1; font-size: 17px; }
.sheet-body { overflow: auto; padding: 4px 18px calc(14px + env(safe-area-inset-bottom)); }
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ---- lock screen ---- */
.lock { max-width: 380px; margin: 8vh auto 0; padding: 0 4px; }
.lock .mark { width: 72px; height: 72px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 26px; margin: 0 auto 12px; }
.lock h1 { text-align: center; font-size: 22px; }
.lock p.tag { text-align: center; color: var(--muted); margin: 4px 0 18px; }

/* =================== home (Today) =================== */
:root { --hero-a: #2f6b4f; --hero-b: #1d4a36; --hero-ink: #ffffff; --hero-muted: rgba(255,255,255,.78); --ring-bg: rgba(255,255,255,.22); --ring-fg: #f3c98b;
  --t-call: #2f6b4f; --t-wa: #1e7f4f; --t-review: #b5502b; --t-refill: #9a6500; --t-lead: #5b5fc7; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --hero-a: #1d3a2b; --hero-b: #13271d; --hero-ink: #eef1ec; --hero-muted: rgba(238,241,236,.72); --ring-bg: rgba(255,255,255,.14); --ring-fg: #e8b871;
  --t-call: #6cbf94; --t-wa: #5fd194; --t-review: #e8956d; --t-refill: #e2b04a; --t-lead: #a5a8f0; } }
:root[data-theme="dark"] { --hero-a: #1d3a2b; --hero-b: #13271d; --hero-ink: #eef1ec; --hero-muted: rgba(238,241,236,.72); --ring-bg: rgba(255,255,255,.14); --ring-fg: #e8b871;
  --t-call: #6cbf94; --t-wa: #5fd194; --t-review: #e8956d; --t-refill: #e2b04a; --t-lead: #a5a8f0; }
.ic { flex: none; display: block; }
main.home { max-width: 1180px; padding-top: 0; }

.hero { margin: 0 -16px; padding: 18px 20px 46px; display: flex; align-items: center; gap: 16px;
  background: linear-gradient(160deg, var(--hero-a) 0%, var(--hero-b) 100%); color: var(--hero-ink); border-radius: 0 0 26px 26px; }
.hero-text { flex: 1; min-width: 0; }
.hero-date { font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--hero-muted); font-weight: 600; }
.hero h1 { font-size: 23px; font-weight: 700; margin: 4px 0 6px; letter-spacing: -.01em; }
.hero p { margin: 0; color: var(--hero-muted); font-size: 14px; }
.hero p b { color: var(--ring-fg); font-weight: 650; }
.ring { position: relative; width: 72px; height: 72px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring-bg { stroke: var(--ring-bg); }
.ring-fg { stroke: var(--ring-fg); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring-num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.05; }
.ring-num b { font-size: 19px; font-variant-numeric: tabular-nums; }
.ring-num span { font-size: 10.5px; color: var(--hero-muted); }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: -30px; position: relative; z-index: 2; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px 13px; text-decoration: none; color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 18px rgba(20,40,30,.07); display: flex; flex-direction: column; min-width: 0; transition: transform .12s; }
.kpi:active { transform: scale(.98); }
.kpi { position: relative; }
.kpi-ic { position: absolute; top: 11px; right: 11px; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; }
.kpi-label { padding-right: 4px; }
.kpi-val { padding-right: 38px; font-size: 25px; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 2px; }
.kpi-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; } }

/* type tones: tinted chip + coloured glyph */
.t-call { --tone: var(--t-call); } .t-wa { --tone: var(--t-wa); } .t-review { --tone: var(--t-review); } .t-refill { --tone: var(--t-refill); } .t-lead { --tone: var(--t-lead); }
.kpi-ic, .avatar[class*="t-"], .tag, .chip-ic, .tl-dot { color: var(--tone, var(--ink-2)); background: color-mix(in srgb, var(--tone, var(--muted)) 14%, transparent); }

.qbar { display: flex; gap: 8px; overflow-x: auto; margin: 14px -16px 0; padding: 2px 16px 4px; scrollbar-width: none; }
.qbar::-webkit-scrollbar { display: none; }
.qa { display: inline-flex; align-items: center; gap: 8px; flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px;
  padding: 9px 14px; font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none; }
.qa .ic { color: var(--brand); }
.qa:active { background: var(--surface-2); }

.alerts { display: grid; gap: 8px; margin-top: 12px; }
.alert-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink); font-size: 13.5px; cursor: pointer;
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }
.alert-row.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.alert-row > .ic { color: var(--warn); } .alert-row.bad > .ic { color: var(--bad); }
.alert-row span { flex: 1; min-width: 0; }
.alert-row b { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }

.home-grid { display: grid; gap: 14px; margin-top: 16px; }
@media (min-width: 1040px) { .home-grid { grid-template-columns: minmax(0, 1fr) 330px; align-items: start; } .side { position: sticky; top: 76px; } }
.side { display: grid; gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 13px 16px 6px; color: var(--ink-2); }
.panel-head h2 { font-size: 14.5px; font-weight: 650; color: var(--ink); flex: 1; }
.pad { padding: 4px 16px 14px; margin: 0; }

.seg { display: flex; gap: 4px; padding: 6px; margin: 10px 10px 4px; background: var(--surface-2); border-radius: 12px; overflow-x: auto; scrollbar-width: none; }
.seg button { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: transparent; color: var(--ink-2);
  padding: 8px 10px; border-radius: 9px; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.seg-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11.5px; line-height: 20px; background: color-mix(in srgb, var(--ink) 9%, transparent); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.seg-n.hot { background: var(--bad); color: #fff; }

.group-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px 4px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.group-head span { font-weight: 600; letter-spacing: 0; }
.group-head.bad { color: var(--bad); }
.task { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 4px 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.group-head + .task, #workBody > .task:first-child { border-top: 0; }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); font-weight: 700; font-size: 13.5px; }
.avatar.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 12px; flex: none; }
.task-main { min-width: 0; }
.task-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.task-name { font-weight: 650; color: var(--ink); text-decoration: none; font-size: 15px; }
.task-name:hover { text-decoration: underline; }
.tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.task-note { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-meta { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12.5px; margin-top: 4px; flex-wrap: wrap; }
.task-actions { grid-column: 2; display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.ib { width: 38px; height: 38px; border-radius: 11px; display: inline-grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; text-decoration: none; }
.ib:hover { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.ib-wa:hover { color: var(--t-wa); }
.done-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 11px; border: 0;
  background: var(--brand); color: var(--brand-ink); font-weight: 650; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.done-btn.ghost { background: var(--brand-soft); color: var(--brand); }
.done-btn:active, .ib:active { transform: translateY(1px); }
@media (min-width: 640px) {
  .task { grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; }
  .task-actions { grid-column: 3; margin-top: 0; }
}
.empty-state { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 34px 16px 38px; color: var(--muted); font-size: 13.5px; }
.empty-state .ic { color: var(--ok); width: 44px; height: 44px; padding: 8px; border-radius: 50%; background: var(--brand-soft); margin-bottom: 6px; }
.empty-state b { color: var(--ink); font-size: 15px; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 6px 12px 2px; }
.day { display: grid; justify-items: center; gap: 2px; padding: 8px 0 6px; border-radius: 12px; font-size: 11px; color: var(--muted); }
.day b { font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.day.past b { color: var(--muted); font-weight: 500; }
.day.today { background: var(--brand); color: var(--brand-ink); }
.day.today b { color: var(--brand-ink); }
.day i { font-style: normal; min-width: 18px; height: 18px; line-height: 18px; border-radius: 9px; font-size: 10.5px; font-weight: 700; text-align: center; }
.day i.has { background: color-mix(in srgb, var(--t-review) 18%, transparent); color: var(--t-review); }
.day.today i.has { background: rgba(255,255,255,.25); color: var(--brand-ink); }
.mini-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.panel-head + .mini-row { border-top: 0; }
.mini-row b { display: block; font-size: 14px; font-weight: 600; }
.mini-row small { display: block; color: var(--muted); font-size: 12px; }
.sheet .mini-row { padding: 10px 0; }
@media (min-width: 900px) {
  .hero { margin: 16px 0 0; border-radius: 22px; padding: 24px 28px 52px; }
  .hero h1 { font-size: 26px; }
}

/* =================== shared components (all modules) =================== */
.bad { --tone: var(--bad); }
.good { color: var(--ok) !important; } .warn { color: var(--warn) !important; }
.center { text-align: center; } .nowrap { white-space: nowrap; }
.btn .ic { margin: -2px 0; }
.btn.lg { min-height: 48px; font-size: 15px; border-radius: 12px; }
.btn.danger .ic { color: var(--bad); }

.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 16px 0 12px; }
.page-head h1 { font-size: 22px; font-weight: 750; letter-spacing: -.01em; }
.page-head p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }
.page-head p a { color: var(--brand); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 599px) { .page-actions .btn.primary:not(#saleBtn):not(#approveSel) { display: none; } } /* the FAB covers it on phones */

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.search-box { flex: 1 1 240px; display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); }
.search-box:focus-within { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.search-box input { border: 0; outline: 0; background: transparent; padding: 0; min-height: 0; height: 100%; font-size: 15px; }
.seg a { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--ink-2); padding: 8px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.seg a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.seg-page { margin: 0 0 12px; }
.toolbar .seg-page { margin: 0; flex: 0 1 auto; }
.seg-sm { margin: 0; padding: 4px; flex: 0 0 auto; }
.seg-sm button { padding: 6px 12px; font-size: 13px; }

.panel { margin-bottom: 14px; }
.panel-head .btn { margin-left: auto; }
.panel-head + .group-head { padding-top: 6px; }
.task.closed .task-name, .task.closed .task-note { color: var(--ink-2); }
.outcome, .reply { display: block; color: var(--ink); font-size: 13px; margin-top: 3px; }
.outcome .ic, .reply .ic { display: inline; vertical-align: -2px; color: var(--muted); }
.ib.sm { width: 30px; height: 30px; border-radius: 8px; }
.ib.danger:hover { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.wa-on { color: var(--t-wa); display: inline-grid; place-items: center; width: 30px; }
.stock { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.stock b { font-size: 16px; font-variant-numeric: tabular-nums; margin-right: 2px; }
.stock.ok b { color: var(--ok); } .stock.warn b { color: var(--warn); } .stock.bad b { color: var(--bad); }
.fab { display: inline-flex; align-items: center; gap: 6px; }
@media (min-width: 600px) { .fab { display: none; } }
.kpis.flat { margin-top: 0; margin-bottom: 14px; }
.cols, .cols-2 { display: grid; gap: 0 14px; }
@media (min-width: 1040px) { .cols { grid-template-columns: 1fr 1fr; align-items: start; } .cols .ai-panel { grid-column: 1 / -1; } .cols-2 { grid-template-columns: 1fr 1fr; align-items: start; } }
@media (min-width: 900px) { main { max-width: 1180px; } }
.pad > :last-child { margin-bottom: 0; }
.panel .kv { font-size: 14px; }
.panel .kv dt { font-size: 13px; }
.state { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13px; }
.state.ok { color: var(--ok); } .state.warn { color: var(--warn); }
.summary { white-space: pre-wrap; line-height: 1.55; margin: 0 0 12px; }
.ai-panel { background: linear-gradient(180deg, color-mix(in srgb, var(--t-lead) 7%, var(--surface)), var(--surface)); }
.ai-panel .panel-head .ic { color: var(--t-lead); }

/* lead pipeline */
.pipeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.pipe { position: relative; display: grid; gap: 1px; text-align: left; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink); }
.pipe b { font-size: 22px; font-variant-numeric: tabular-nums; color: var(--tone); }
.pipe span:last-child { font-size: 12px; color: var(--ink-2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipe-step { position: absolute; top: 8px; right: 10px; font-size: 11px; color: var(--muted); font-weight: 700; }
.pipe.on { border-color: var(--tone); box-shadow: 0 0 0 1px var(--tone) inset; background: color-mix(in srgb, var(--tone) 7%, var(--surface)); }

/* client profile */
.profile { margin: 14px 0 12px; padding: 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.profile-top { display: flex; gap: 14px; align-items: center; }
.avatar.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 19px; flex: none; }
.profile h1 { font-size: 20px; font-weight: 750; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; color: var(--muted); font-size: 13px; }
.profile-meta span { display: inline-flex; align-items: center; gap: 4px; }
.profile-meta span + span::before { content: ''; width: 3px; height: 3px; border-radius: 50%; background: currentColor; margin-right: 6px; opacity: .6; }
.profile-meta .ok { color: var(--ok); }
.prog-line { margin-top: 14px; padding: 12px; border-radius: 14px; background: var(--surface-2); font-size: 13.5px; }
.prog-line .row { gap: 8px; }
.profile-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.pa { display: grid; justify-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 12.5px; font-weight: 600; cursor: pointer; text-decoration: none; }
.pa .ic { color: var(--brand); }
.pa:active { background: var(--surface-2); }
.mstats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
@media (min-width: 700px) { .mstats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mstat { padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 1px; min-width: 0; }
.mstat span { font-size: 11.5px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.mstat b { font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mstat small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { margin: 0 -16px 12px; padding: 0 12px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); }
.tabs button { padding: 12px 12px 10px; }
.prog-card { padding: 4px 16px 14px; }
.prog-card + .prog-card { border-top: 1px solid var(--line); padding-top: 14px; }
.prog-card .ib { margin-left: 6px; }
.bar-label { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-2); margin-top: 10px; }
.progress { height: 7px; }
.progress.pay i { background: var(--t-refill); }
.link-row { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 13.5px; font-weight: 600; }
.charts { display: grid; gap: 14px; padding: 4px 16px 16px; }
@media (min-width: 900px) { .charts { grid-template-columns: 1fr 1fr; } }
.chart-box { height: 180px; }

/* timeline */
ol.timeline { list-style: none; margin: 0; padding: 8px 16px 14px; position: relative; }
ol.timeline li { position: relative; display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 8px 0; }
ol.timeline li:not(:last-child)::before { content: ''; position: absolute; left: 14px; top: 38px; bottom: -8px; width: 2px; background: var(--line); }
.tl-dot { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.tl-head { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; }
.tl-head b { font-size: 13.5px; }
.tl-head span { font-size: 12px; color: var(--muted); }
.tl-body p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }

/* whatsapp */
.alert-row.info { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 22%, transparent); }
.alert-row.info > .ic { color: var(--brand); }
.alert-row a { text-decoration: none; }
.alerts, .alert-row { margin-bottom: 12px; }
.approve-bar { position: sticky; top: 64px; z-index: 6; display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 12px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.check-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.sel-box { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); cursor: pointer; }

/* more / settings / users */
.me-card { display: flex; align-items: center; gap: 14px; margin: 16px 0 14px; padding: 16px; border-radius: 20px; color: var(--hero-ink);
  background: linear-gradient(160deg, var(--hero-a), var(--hero-b)); }
.me-card h1 { font-size: 19px; }
.me-card p { margin: 4px 0 0; font-size: 13px; color: var(--hero-muted); display: flex; align-items: center; gap: 6px; }
.me-card .avatar { background: rgba(255,255,255,.16); color: var(--hero-ink); }
.me-card .tag { background: rgba(255,255,255,.18); color: var(--hero-ink); }
.menu-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); text-decoration: none; text-align: left; cursor: pointer; font-size: 14px; }
.panel-head + .menu-row { border-top: 0; }
.menu-row:hover:not(.static) { background: var(--surface-2); }
.menu-row b { display: block; font-weight: 600; }
.menu-row small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.menu-row > .ic:last-child { color: var(--muted); }
.menu-row.danger b { color: var(--bad); }
.chip-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--ink-2); }
.roles { display: grid; gap: 8px; margin-bottom: 14px; }
@media (min-width: 700px) { .roles { grid-template-columns: repeat(3, 1fr); } }
.role-card { padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.role-card .chip-ic { margin-bottom: 8px; }
.role-card p { margin: 3px 0 0; font-size: 13px; color: var(--ink-2); }
.save-bar { position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 14px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0,0,0,.1); grid-column: 1 / -1; }
@media (min-width: 900px) { .save-bar { bottom: 16px; } }
.save-bar .err { margin: 0; }
.copy-field { display: flex; gap: 8px; }
.copy-field input { font-size: 13px; color: var(--ink-2); }

/* reports */
.bars { padding: 4px 16px 12px; display: grid; gap: 2px; }
.bar-row { display: grid; grid-template-columns: 58px 1fr auto; gap: 12px; align-items: center; padding: 7px 8px; margin: 0 -8px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.bar-row:hover, .bar-row.on { background: var(--surface-2); }
.bar-m { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.bar-track { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.bar-row.on .bar-track { background: var(--surface); }
.bar-track i { display: block; height: 100%; border-radius: 5px; background: var(--chart); }
.bar-v { text-align: right; font-variant-numeric: tabular-nums; }
.bar-v b { display: block; font-size: 13.5px; }
.bar-v small { font-size: 11.5px; color: var(--muted); }

/* tables inside panels */
.panel .scroll-x { padding: 0 6px 8px; }
.panel table.data th { position: sticky; top: 0; background: var(--surface); }
.panel table.data td, .panel table.data th { padding: 9px 10px; }
.panel table.data tr:last-child td { border-bottom: 0; }
table.data.edit input { min-height: 38px; padding: 6px 8px; font-size: 14px; }
.w-sm { width: 84px; } .w-md { width: 110px; }

/* =================== forms & sheets =================== */
.sheet { box-shadow: 0 -8px 40px rgba(0,0,0,.18); }
@media (max-width: 699px) { .sheet::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 0; } }
.sheet-head { padding: 12px 12px 12px 18px; gap: 12px; }
.sheet-head h2 { display: flex; align-items: center; gap: 12px; font-size: 17px; min-width: 0; }
.sheet-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand); }
.sheet-t { min-width: 0; }
.sheet-t small { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-body { padding: 6px 18px calc(16px + env(safe-area-inset-bottom)); }
.form-actions { margin: 16px -18px 0; padding: 12px 18px; border-top: 1px solid var(--line); bottom: -16px; }
.form-actions .btn { min-height: 48px; border-radius: 12px; font-size: 15px; }
.form-actions .btn.danger { flex: 0 0 auto; }
label.f > span, fieldset.f > legend { font-size: 13px; color: var(--ink-2); font-weight: 600; margin-bottom: 6px; }
label.f > span i, fieldset.f > legend i { color: var(--accent); font-style: normal; margin-left: 2px; }
fieldset.f { border: 0; padding: 0; margin: 12px 0; min-width: 0; }
fieldset.f > legend { padding: 0; display: block; }
input, select, textarea { border-radius: 12px; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237a8079' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.f-section { display: flex; align-items: center; gap: 8px; margin: 20px 0 4px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
form > .f-section:first-child, .pad > .f-section:first-child { margin-top: 6px; padding-top: 0; border-top: 0; }
.f-section .ic { color: var(--brand); }
.chip-radio { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-radio label { position: relative; cursor: pointer; }
.chip-radio input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.chip-radio span { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 550; color: var(--ink-2); transition: .12s; }
.chip-radio label:hover span { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.chip-radio input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip-radio input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent); }
.switch-row { display: flex; align-items: center; gap: 14px; margin: 10px 0; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); cursor: pointer; }
.sw-text { flex: 1; min-width: 0; font-size: 14px; }
.sw-text b { display: block; font-weight: 600; }
.sw-text .hint { margin-top: 2px; }
input.switch { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; min-height: 0; padding: 0; border-radius: 14px; border: 0; background: color-mix(in srgb, var(--ink) 22%, transparent); position: relative; cursor: pointer; flex: none; transition: background .15s; }
input.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
input.switch:checked { background: var(--brand); }
input.switch:checked::after { transform: translateX(18px); }
input.switch:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent); }
.quick { margin-top: 8px; }
.quick button { border-radius: 999px; padding: 5px 12px; background: var(--surface); border: 1px solid var(--line); font-weight: 550; color: var(--ink-2); }
.quick button:hover { border-color: var(--brand); color: var(--brand); }
.calc { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--brand-soft); margin: 12px 0; font-size: 13.5px; }
.calc .ic { color: var(--brand); margin-top: 1px; }
.calc b { display: block; font-size: 14.5px; }
.calc span { color: var(--ink-2); }
.dropzone { display: grid; justify-items: center; gap: 4px; padding: 22px 16px; margin: 10px 0; border: 2px dashed var(--line); border-radius: 16px; text-align: center; cursor: pointer; color: var(--ink-2); position: relative; }
.dropzone:hover { border-color: var(--brand); }
.dropzone .ic { color: var(--brand); }
.dropzone span { font-size: 12.5px; color: var(--muted); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.loading { display: grid; justify-items: center; gap: 6px; padding: 30px 10px; text-align: center; color: var(--muted); }
.loading .ic { color: var(--t-lead); animation: pulse 1.2s ease-in-out infinite; }
.loading b { color: var(--ink); }
@keyframes pulse { 50% { opacity: .35; transform: scale(.9); } }
.banner { display: flex; gap: 8px; align-items: flex-start; border-radius: 12px; }
.banner .ic { margin-top: 2px; }
.err:empty { display: none; }
.err { padding: 8px 12px; border-radius: 10px; background: var(--bad-soft); }

/* search */
.searchbar { box-shadow: 0 8px 20px rgba(0,0,0,.08); }
.searchbar .mini-row { padding: 10px 4px; }
.search-results .pad { padding: 10px 4px; }

/* =================== sign-in =================== */
.auth { min-height: calc(100vh - 40px); display: grid; align-content: center; gap: 0; max-width: 940px; margin: 0 auto; padding: 20px 0; }
@media (min-width: 860px) { .auth { grid-template-columns: 1.05fr 1fr; align-items: stretch; } }
.auth-brand { padding: 26px 24px; border-radius: 24px 24px 0 0; color: var(--hero-ink); background: radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--ring-fg) 25%, var(--hero-a)) 0%, var(--hero-a) 40%, var(--hero-b) 100%); }
.auth-brand .mark { width: 56px; height: 56px; border-radius: 16px; background: rgba(255,255,255,.16); display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.auth-brand h1 { font-size: 28px; margin-top: 16px; letter-spacing: -.01em; }
.auth-tag { margin: 4px 0 0; color: var(--hero-muted); }
.auth-brand ul { list-style: none; padding: 0; margin: 22px 0 0; display: none; gap: 14px; }
.auth-brand li { display: flex; gap: 12px; align-items: center; font-size: 14.5px; }
.auth-brand li .ic { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.14); }
.auth-card { padding: 24px; border-radius: 0 0 24px 24px; background: var(--surface); border: 1px solid var(--line); border-top: 0; box-shadow: 0 12px 40px rgba(20,40,30,.1); }
.auth-card h2 { font-size: 21px; }
.auth-card > .muted { margin: 4px 0 8px; font-size: 14px; }
.auth-card .btn.lg { margin-top: 12px; }
.auth-foot { display: flex; align-items: center; gap: 6px; justify-content: center; margin: 16px 0 0; font-size: 12.5px; color: var(--muted); }
@media (min-width: 860px) {
  .auth-brand { border-radius: 24px 0 0 24px; padding: 40px 36px; display: flex; flex-direction: column; justify-content: center; }
  .auth-brand ul { display: grid; }
  .auth-card { border-radius: 0 24px 24px 0; border-top: 1px solid var(--line); border-left: 0; padding: 40px 36px; display: flex; flex-direction: column; justify-content: center; }
}
.save-bar .btn { margin-left: auto; }
/* tone wins over the neutral defaults above */
.chip-ic[class*="t-"], .tl-dot[class*="t-"], .chip-ic.bad { color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, transparent); }

/* =================== responsive shell: phone · tablet · laptop · desktop ===================
   phone   < 600   bottom tab bar
   tablet  600–1023  icon rail (84px) on the left
   laptop  1024–1279 full sidebar (240px) with labels, Manage section, user chip; forms open as a right-hand drawer
   desktop ≥ 1280  same sidebar, wider content, two-column home and client page */
:root { --rail: 0px; }
.nav-brand, .nav-sec, .nav-extra, .nav-user, .top-search { display: none !important; }
.top-search .ic { width: 17px; height: 17px; }

@media (min-width: 600px) {
  :root { --rail: 84px; }
  body { padding-left: var(--rail); }
  .tabbar { top: 0; bottom: 0; left: 0; right: auto; width: var(--rail); flex-direction: column; align-items: stretch; gap: 2px;
    border-top: 0; border-right: 1px solid var(--line); padding: 10px 8px calc(12px + env(safe-area-inset-bottom)); overflow-y: auto; }
  .tabbar a { flex: none; padding: 10px 0 9px; border-radius: 14px; font-size: 11.5px; }
  .tabbar a:hover { background: var(--surface-2); color: var(--ink); }
  .tabbar a.on { background: var(--brand-soft); color: var(--brand); }
  .tabbar .nav-brand { display: grid !important; place-items: center; padding: 4px 0 12px; margin-bottom: 4px; }
  .tabbar .nav-brand:hover { background: none; }
  .nav-brand .logo { width: 40px; height: 40px; border-radius: 12px; background: var(--hero-a); color: var(--hero-ink); font-size: 15px; font-weight: 700; }
  .nav-brand-t { display: none; }
  .badge { top: 4px; left: calc(50% + 4px); }
  .topbar .brand .logo { display: none; }
  main, main.home { max-width: 1120px; margin: 0 auto; padding: 8px 24px 40px; }
  .hero { margin: 16px 0 0; border-radius: 22px; padding: 22px 26px 50px; }
  .qbar { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
  .tabs { margin: 0 0 12px; padding: 0; }
  .toast { bottom: 24px; }
  .save-bar { bottom: 16px; }
  .fab { display: none; }
  .searchbar { top: 60px; }
}
@media (min-width: 768px) {
  .top-search { display: block !important; position: relative; flex: 0 1 380px; }
  .top-search-box { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 12px; background: rgba(255,255,255,.14); color: var(--hero-muted); }
  .top-search-box:focus-within { background: var(--surface); color: var(--muted); box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
  .top-search-box input { border: 0; background: transparent; outline: 0; box-shadow: none; padding: 0; min-height: 0; height: 100%; font-size: 14.5px; color: var(--hero-ink); }
  .top-search-box input::placeholder { color: var(--hero-muted); }
  .top-search-box:focus-within input { color: var(--ink); }
  .top-search-box:focus-within input::placeholder { color: var(--muted); }
  .top-results { position: absolute; top: 46px; left: 0; right: 0; max-height: 70vh; overflow: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line);
    border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.18); padding: 6px; z-index: 40; }
  .top-results .mini-row { border-radius: 10px; border-top: 0; padding: 9px 10px; }
  .top-results .mini-row:hover { background: var(--surface-2); }
  #searchBtn { display: none; }
  .side { grid-template-columns: 1fr 1fr; align-items: start; }
  .kpis { gap: 12px; }
}
@media (min-width: 1024px) {
  :root { --rail: 240px; }
  .tabbar { padding: 14px 12px calc(14px + env(safe-area-inset-bottom)); gap: 2px; }
  .tabbar a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 9px 12px; font-size: 14px; font-weight: 550; color: var(--ink-2); border-radius: 11px; }
  .tabbar a .ti { height: 22px; }
  .tabbar a .ti .ic { width: 20px; height: 20px; }
  .tabbar a.on { font-weight: 650; }
  .tabbar .nav-brand { display: flex !important; justify-content: flex-start; gap: 12px; padding: 6px 10px 18px; }
  .nav-brand-t { display: grid; line-height: 1.2; }
  .nav-brand-t b { font-size: 16px; color: var(--ink); }
  .nav-brand-t small { font-size: 12px; color: var(--muted); font-weight: 500; }
  .tabbar .nav-sec { display: block !important; padding: 18px 12px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
  .tabbar .nav-extra { display: flex !important; }
  .tabbar .nav-extra[hidden] { display: none !important; }
  .tabbar .nav-user { display: flex !important; align-items: center; margin-top: auto; padding: 10px; border: 1px solid var(--line); border-radius: 14px; }
  .nav-user-t { display: grid; line-height: 1.25; min-width: 0; }
  .nav-user-t b { font-size: 13.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-user-t small { font-size: 12px; color: var(--muted); font-weight: 500; }
  .badge { position: static; margin-left: auto; }
  .topbar { padding-left: 24px; padding-right: 20px; gap: 14px; }
  .brand { font-size: 18px; }
  main, main.home { max-width: 1240px; padding: 8px 32px 48px; }
  .page-head h1 { font-size: 26px; }
  .cols { grid-template-columns: 1fr 1fr; align-items: start; }
  .cols .ai-panel { grid-column: 1 / -1; }
  /* forms: right-hand drawer so the page stays visible */
  .sheet-wrap { justify-content: flex-end; align-items: stretch; background: rgba(10,20,15,.32); }
  .sheet { max-width: 520px; max-height: none; height: 100%; border-radius: 22px 0 0 22px; animation: drawer .2s ease-out; }
  .sheet-head { padding: 18px 18px 14px 24px; }
  .sheet-body { padding: 8px 24px 0; flex: 1; }
  .form-actions { margin: 20px -24px 0; padding: 14px 24px calc(14px + env(safe-area-inset-bottom)); bottom: 0; }
}
@keyframes drawer { from { transform: translateX(40px); opacity: .4; } }
@media (min-width: 1280px) {
  main, main.home { max-width: 1320px; }
  .home-grid { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .side { grid-template-columns: 1fr; position: sticky; top: 76px; }
  .cols-2 { grid-template-columns: 1fr 1fr; align-items: start; }
  .kpi { padding: 16px 18px; } .kpi-val { font-size: 28px; }
  /* client page: profile column + tab column */
  .client-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 14px; }
  .client-aside { position: sticky; top: 76px; }
  .client-aside .profile { margin-top: 0; }
  .client-aside .mstats { grid-template-columns: 1fr 1fr; }
  .client-aside .profile-actions { grid-template-columns: 1fr 1fr; }
  .client-main .tabs { position: sticky; top: 60px; }
  .cols { grid-template-columns: 1fr; }
}
@media (min-width: 1600px) {
  main, main.home { max-width: 1480px; }
  .home-grid { grid-template-columns: minmax(0, 1fr) 400px; }
  .cols { grid-template-columns: 1fr 1fr; }
  .client-layout { grid-template-columns: 380px minmax(0, 1fr); }
}
/* below 1024 the old 900px rules must not move main or the rail */
@media (min-width: 600px) and (max-width: 1023px) { .home-grid { grid-template-columns: 1fr; } .side { position: static; } }
@media (min-width: 600px) and (max-width: 767px) { .side { grid-template-columns: 1fr; } }
body:has(#tabbar[hidden]) { padding-left: 0; }

/* =================== about =================== */
.about-hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 16px 0 14px; padding: 22px; border-radius: 22px; color: var(--hero-ink);
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--ring-fg) 22%, var(--hero-a)) 0%, var(--hero-a) 45%, var(--hero-b) 100%); }
.about-mark { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; flex: none; background: rgba(255,255,255,.15); font-size: 24px; font-weight: 700; }
.about-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hero-muted); }
.about-hero h1 { font-size: 24px; letter-spacing: -.01em; margin: 2px 0 6px; text-wrap: balance; }
.about-hero p:not(.about-eyebrow) { margin: 0; color: var(--hero-muted); max-width: 62ch; }
.about-ver { padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.15); font-size: 12.5px; font-weight: 650; white-space: nowrap; }
.about-copy p { margin: 0 0 10px; color: var(--ink-2); line-height: 1.6; max-width: 65ch; }
.glance { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.glance div { background: var(--surface); padding: 14px 16px; display: grid; gap: 2px; }
.glance b { font-size: 24px; font-variant-numeric: tabular-nums; }
.glance span { font-size: 12.5px; color: var(--muted); }
ol.journey { list-style: none; margin: 0; padding: 4px 0 8px; }
.journey li { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); }
.journey li:first-child { border-top: 0; }
.journey b { font-size: 14.5px; }
.journey p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-2); }
.j-step { width: 22px; flex: none; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.j-where { display: inline-flex; align-items: center; gap: 2px; flex: none; font-size: 12.5px; font-weight: 650; text-decoration: none; white-space: nowrap; }
@media (max-width: 599px) { .j-where { display: none; } .glance { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.does { display: grid; grid-template-columns: 1fr; gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.does-item { display: flex; gap: 12px; padding: 14px 16px; background: var(--surface); }
.does-item b { font-size: 14.5px; }
.does-item p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-2); }
kbd { font: 600 12px/1 ui-monospace, Menlo, monospace; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
.about-foot { margin: 8px 0 24px; }
@media (min-width: 600px) { .does { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .does { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.hint .ic, .sub .ic, p .ic { display: inline; vertical-align: -2px; }
@media (max-width: 599px) { .about-hero { flex-direction: column; align-items: flex-start; gap: 12px; padding: 20px; } .about-hero .grow { width: 100%; } .about-mark { width: 52px; height: 52px; font-size: 20px; } }

/* lab values review: one card per value */
.lab-meta { display: grid; align-content: end; gap: 2px; padding-bottom: 14px; font-size: 13px; color: var(--muted); }
.lab-meta b { font-size: 15px; color: var(--ink); }
.lab-rows { display: grid; gap: 8px; margin: 4px 0 12px; }
.lab-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px 8px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.lab-row .lab-test { grid-column: 1 / 3; font-weight: 600; }
.lab-row > .ib { grid-column: 3; grid-row: 1; align-self: center; }
.lab-row .lab-f { display: grid; gap: 2px; min-width: 0; }
.lab-row .lab-range { grid-column: 1 / -1; }
.lab-f span { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.lab-row input { min-height: 38px; padding: 6px 10px; font-size: 14.5px; }
@media (min-width: 600px) {
  .lab-row { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, .9fr) minmax(0, 1.6fr) auto; align-items: end; }
  .lab-row .lab-test { grid-column: auto; align-self: end; }
  .lab-row > .ib { grid-column: 5; grid-row: 1; align-self: end; margin-bottom: 4px; }
  .lab-row .lab-range { grid-column: auto; }
}
@media (min-width: 1024px) { .sheet.wide { max-width: 860px; } }

/* WhatsApp draft */
.draft-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 4px; }
.draft-bar .btn { border-color: color-mix(in srgb, var(--t-lead) 40%, var(--line)); color: var(--t-lead); }
.draft-bar .btn .ic { color: var(--t-lead); }
.draft-bar .hint { flex: 1; min-width: 200px; margin: 0; }
.msg-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: -4px; }
.report-row { display: flex; align-items: center; gap: 14px; padding: 6px 16px 16px; flex-wrap: wrap; }
.report-row b { font-size: 15px; }
.report-row p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-2); max-width: 62ch; }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; }
