/* HVP Solar CRM. Light, calm, phone-first. */
:root {
  --bg: #f4f6f9; --card: #fff; --ink: #0f172a; --ink2: #334155; --muted: #64748b; --line: #e2e8f0; --line2: #f1f5f9;
  --sun: #f59e0b; --sun2: #fbbf24; --pri: #0f766e; --pri-ink: #fff; --pri-soft: #ccfbf1;
  --red: #dc2626; --amber: #d97706; --green: #16a34a; --blue: #2563eb; --wa: #16a34a;
  --side: #0f172a; --side-ink: #cbd5e1;
  --r: 12px; --sh: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; }
a { color: var(--pri); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 22px 0 10px; color: var(--ink2); }
h3 { font-size: 14px; margin: 0 0 12px; font-weight: 600; }
h3 small { font-weight: 400; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.red { color: var(--red) !important; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
code { background: var(--line2); padding: 2px 6px; border-radius: 6px; font-size: 12px; word-break: break-all; }
.ic { width: 18px; height: 18px; flex: none; }

/* layout */
.app { display: flex; min-height: 100vh; }
.side { width: 232px; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex: none; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand b { display: block; font-size: 14px; line-height: 1.2; }
.brand small { color: var(--sun2); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.sun { width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fde68a, var(--sun) 60%, #d97706); box-shadow: 0 0 0 4px rgba(245, 158, 11, .18), 0 0 18px rgba(245, 158, 11, .45); flex: none; }
.logo-img { width: 40px; height: 40px; border-radius: 50%; object-fit: contain; background: #fff; flex: none; box-shadow: 0 0 0 2px rgba(245, 158, 11, .35); }
.brand.big .logo-img { width: 64px; height: 64px; }
.logo-img.lg, .sun.lg { width: 84px; height: 84px; }
.logo-set { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.logo-set > div { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.side nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 2px; flex: 1; overflow-y: auto; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--side-ink); font-weight: 500; }
.side nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.side nav a.on { background: rgba(245, 158, 11, .14); color: #fff; box-shadow: inset 3px 0 0 var(--sun); }
.side .me { display: flex; align-items: center; gap: 10px; padding: 14px 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
.side .me span { flex: 1; min-width: 0; }
.side .me b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .me small { color: #94a3b8; }
.side .iconbtn { color: #94a3b8; background: transparent; border-color: rgba(255, 255, 255, .12); }
.main { flex: 1; min-width: 0; padding: 0 24px 40px; }
.top { display: flex; align-items: center; gap: 12px; padding: 18px 0 14px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.top h1 { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search input { width: 300px; }
.tabbar { display: none; }

/* controls */
input, select, textarea { font: inherit; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; min-height: 38px; width: 100%; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pri-soft); border-color: var(--pri); }
input[type=file] { padding: 6px; }
input[type=radio], input[type=checkbox] { width: auto; min-height: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 500; color: var(--ink2); }
label.inl { flex-direction: row; align-items: center; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; min-height: 38px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: #cbd5e1; background: #f8fafc; }
.btn.primary { background: var(--pri); border-color: var(--pri); color: var(--pri-ink); }
.btn.primary:hover { background: #115e59; }
.btn.ghost { background: transparent; }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.sm { padding: 5px 10px; min-height: 30px; font-size: 12px; }
.btn.block { width: 100%; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink2); cursor: pointer; }
.iconbtn.wa { color: var(--wa); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--pri); cursor: pointer; font: inherit; }
form.inline { display: inline; }
.row-form { display: flex; gap: 8px; align-items: center; }
.row-form.wrap { flex-wrap: wrap; }
.row-form > input, .row-form > select { flex: 1; min-width: 140px; width: auto; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.fgrid.one { grid-template-columns: 1fr; }
.fgrid .wide { grid-column: 1 / -1; }
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-weight: 700; font-size: 13px; margin-bottom: 10px; color: var(--ink); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.actions.sticky { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; }
.spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.seg a { padding: 7px 14px; color: var(--ink2); font-weight: 500; }
.seg a.on { background: var(--ink); color: #fff; }
.seg a:hover { text-decoration: none; }

/* cards & content */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 16px; margin-bottom: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.card.hl { box-shadow: 0 0 0 2px var(--sun); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.grid2 > section, .grid2 > div > section { margin-bottom: 14px; }
.lead-grid { grid-template-columns: 1.25fr 1fr; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash.warn { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.empty { padding: 22px; text-align: center; color: var(--muted); }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar h2 { margin: 0; }
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); border: 1px solid color-mix(in srgb, var(--c) 25%, #fff); white-space: nowrap; }
.grade { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; background: var(--line2); color: var(--muted); }
.g-hot { background: #fee2e2; color: #b91c1c; } .g-warm { background: #fef3c7; color: #a16207; } .g-cold { background: #e0f2fe; color: #0369a1; }
.av { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: hsl(var(--h) 70% 92%); color: hsl(var(--h) 55% 32%); font-weight: 700; font-size: 12px; flex: none; vertical-align: middle; }
.prog { display: inline-block; width: 90px; height: 6px; background: var(--line); border-radius: 9px; overflow: hidden; vertical-align: middle; }
.prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--sun), var(--green)); border-radius: 9px; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr[data-href] { cursor: pointer; }
.tbl tr[data-href]:hover td { background: #f8fafc; }
.tbl tr.off td { opacity: .5; }
.card:not(.flush) .tbl th { background: none; padding-left: 0; }
.card:not(.flush) .tbl td { padding-left: 0; }

/* dashboard */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpis.three { grid-template-columns: repeat(3, 1fr); }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--sh); }
.kpi small { color: var(--muted); font-weight: 500; display: block; }
.kpi b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.kpi span { font-size: 12px; color: var(--muted); }
.kpi.good b { color: var(--green); } .kpi.warn b { color: var(--amber); }
.alerts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.alert { padding: 8px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line); color: var(--ink2); }
.alert.red { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert.amber { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert:hover { text-decoration: none; filter: brightness(.98); }
.fbar { display: grid; grid-template-columns: 120px 1fr 40px 40px; align-items: center; gap: 10px; margin: 7px 0; color: var(--ink2); }
.fbar.sm { grid-template-columns: 210px 1fr 30px; margin: 4px 0; font-size: 12.5px; }
.fbar i { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--sun2), var(--sun)); display: block; }
.fbar.sm i { background: linear-gradient(90deg, #5eead4, var(--pri)); height: 9px; }
.fbar b { text-align: right; } .fbar small { color: var(--muted); }
a.fbar:hover { text-decoration: none; color: var(--ink); }

/* list rows (Today, jobs) */
.row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line2); }
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--ink); }
.row-main:hover { text-decoration: none; }
.row-main > span { min-width: 0; }
.row-main small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-act { display: flex; gap: 6px; }
.when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.filters input, .filters select { width: auto; min-width: 130px; }
.filters input[name=s] { min-width: 200px; }

/* board */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.col { flex: 0 0 240px; background: #eef1f5; border-radius: var(--r); padding: 8px; min-height: 120px; }
.col.drop { outline: 2px dashed var(--pri); }
.col-h { font-weight: 600; font-size: 12.5px; padding: 4px 6px 8px; display: flex; justify-content: space-between; color: var(--c); }
.col-h span { color: var(--muted); }
.kc { display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; margin-bottom: 7px; color: var(--ink); box-shadow: var(--sh); }
.kc:hover { text-decoration: none; border-color: #cbd5e1; }
.kc small { display: block; color: var(--muted); margin-top: 2px; }
.kc .prog { margin-top: 6px; width: 100%; }

/* lead page */
.lead-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; }
.lh-main { display: flex; gap: 12px; align-items: center; min-width: 0; }
.lh-main .av { width: 46px; height: 46px; font-size: 15px; }
.lh-badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lh-meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.lh-act { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stage-form select { width: auto; font-weight: 600; }
.dd { position: relative; }
.dd-menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, .12); min-width: 240px; z-index: 20; padding: 6px; }
.dd.open .dd-menu { display: block; }
.dd-menu a { display: block; padding: 8px 10px; border-radius: 7px; color: var(--ink); }
.dd-menu a:hover { background: var(--line2); text-decoration: none; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs a.on { color: var(--ink); border-color: var(--sun); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs .prog { width: 40px; height: 4px; }
.cnt { background: var(--line); border-radius: 99px; padding: 0 6px; font-size: 11px; color: var(--ink2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { flex-direction: row; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { padding: 7px 12px; border: 1px solid var(--line); border-radius: 99px; font-size: 13px; font-weight: 500; background: #fff; color: var(--ink2); }
.chip input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip input:focus-visible + span { outline: 2px solid var(--pri); }
[data-show-for] { display: none; }
.quick-dates a { margin: 0 2px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 12px; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; border: 2px solid #fff; }
.timeline .t-call::before { background: var(--blue); } .timeline .t-stage::before { background: var(--sun); } .timeline .t-payment::before { background: var(--green); }
.timeline .t-project::before { background: var(--pri); } .timeline .t-quote::before { background: var(--amber); } .timeline .t-survey::before { background: #0891b2; }
.timeline small { color: var(--muted); }
.plan { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.plan > div { background: #f8fafc; border: 1px solid var(--line2); border-radius: 10px; padding: 10px; }
.plan small { color: var(--muted); display: block; }
.plan b { display: block; font-size: 17px; }
.plan span { font-size: 11.5px; color: var(--muted); }
.plan .good b { color: var(--green); }
.facts { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; margin: 0; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
.quote-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.qr-main small { display: block; margin-top: 3px; }
.qr-act { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.q-preview, .calc-hint { margin-top: 12px; }
.q-preview:empty { display: none; }
.qp { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 12px; }
.qp small { display: block; color: #92400e; } .qp b { font-size: 16px; }

/* project steps */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { border: 1px solid var(--line2); border-radius: 10px; margin-bottom: 6px; background: #fff; }
.steps li.cur { border-color: var(--sun2); box-shadow: 0 0 0 3px #fef3c7; }
.st-h { display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; }
.st-dot { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; background: var(--line2); color: var(--muted); flex: none; }
.st-done .st-dot { background: var(--green); color: #fff; }
.st-na .st-dot { background: #e2e8f0; }
.cur .st-dot { background: var(--sun); color: #fff; }
.st-t small { display: block; color: var(--muted); }
.st-na .st-t b { color: var(--muted); font-weight: 500; text-decoration: line-through; }
.st-form { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 12px 12px 52px; }
.st-form[hidden] { display: none; }
.st-form input { width: auto; flex: 1; min-width: 130px; }
.st-btns { display: flex; gap: 6px; }
.stepper-filter { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; }
.stepper-filter a { flex: none; padding: 6px 11px; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--ink2); font-size: 12.5px; white-space: nowrap; }
.stepper-filter a b { color: var(--muted); margin-left: 3px; }
.stepper-filter a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.stepper-filter a.on b { color: var(--sun2); }
.stepper-filter a:hover { text-decoration: none; }

/* files */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.gallery.big { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.gallery img, .gallery .doc { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--line2); color: var(--muted); font-weight: 700; border: 1px solid var(--line); }
.gallery figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 8px; }
.gallery figcaption { font-size: 12.5px; margin-top: 6px; font-weight: 500; }
.gallery figcaption small { display: block; color: var(--muted); font-weight: 400; }

/* calculator */
.calc-out .big { font-size: 34px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.calc-out .grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.calc-out .grid div { background: #f8fafc; border-radius: 10px; padding: 10px 12px; border: 1px solid var(--line2); }
.calc-out .grid small { display: block; color: var(--muted); }
.calc-out .grid b { font-size: 18px; }
.calc-out .net { background: #ecfdf5 !important; border-color: #a7f3d0 !important; }
.calc-out .net b { color: var(--green); }

/* jobs */
.job-h { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: 15px; }
.job p { margin: 6px 0 10px; }
.job-act { display: flex; gap: 8px; flex-wrap: wrap; }
.job-act .btn { flex: 1; }
.roles { padding-left: 18px; margin: 16px 0 0; } .roles li { margin-bottom: 4px; }

/* auth */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(1000px 500px at 80% -10%, #fef3c7, transparent), radial-gradient(800px 400px at -10% 110%, #ccfbf1, transparent), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: 0 20px 50px rgba(15, 23, 42, .08); }
.brand.big { color: var(--ink); padding: 0 0 20px; }
.brand.big small { color: var(--amber); }
.auth h2 { font-size: 17px; margin: 0 0 4px; color: var(--ink); }

/* phone */
@media (max-width: 900px) {
  .side { display: none; }
  .main { padding: 0 14px calc(80px + env(safe-area-inset-bottom)); }
  .top { padding: 12px 0 10px; flex-wrap: wrap; }
  .top h1 { font-size: 17px; }
  .search { order: 3; flex: 1 0 100%; } .search input { width: 100%; }
  .top .btn span { display: none; }
  .grid2, .lead-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpis.three { grid-template-columns: 1fr; }
  .kpi b { font-size: 20px; }
  .plan { grid-template-columns: 1fr 1fr; }
  .fgrid { grid-template-columns: 1fr 1fr; }
  .fbar { grid-template-columns: 100px 1fr 34px 34px; }
  .fbar.sm { grid-template-columns: 1fr 80px 24px; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; color: var(--muted); font-size: 10.5px; font-weight: 600; }
  .tabbar a.on { color: var(--pri); }
  .tabbar a:hover { text-decoration: none; }
  .tabbar .ic { width: 22px; height: 22px; }
  /* tables become cards */
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { padding: 10px 14px; border-bottom: 1px solid var(--line2); }
  .tbl td { padding: 2px 0; border: 0; }
  .tbl td:empty { display: none; }
  .card:not(.flush) .tbl tr { padding-left: 0; padding-right: 0; }
  .row { flex-wrap: wrap; row-gap: 4px; }
  .row-main { flex: 1 1 calc(100% - 90px); }
  .row .when { order: 3; flex: 1 0 100%; padding-left: 44px; }
  .row .g-new { display: none; }
  .lh-act { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .lh-act .btn { width: 100%; }
  .lh-act .stage-form { grid-column: 1 / -1; }
  .stage-form select { width: 100%; }
  .lh-main { align-items: flex-start; }
  .lh-badges .badge { white-space: normal; }
  .dd-menu { left: 0; right: auto; min-width: 0; width: calc(100vw - 60px); max-width: 320px; }
  /* overview: what to do first, then the plan, then history */
  .lead-grid > div { display: contents; }
  .lead-grid { display: flex; flex-direction: column; gap: 0; }
  .o-call { order: 1; } .o-plan { order: 2; } .o-follow { order: 3; } .o-facts { order: 4; } .o-note { order: 5; } .o-time { order: 6; }
  /* table cells as labelled rows (labels come from the header, set by app.js) */
  .tbl td[data-label] { display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl td[data-label] { flex-wrap: wrap; }
  .tbl td[data-label] > small { flex-basis: 100%; }
  .tbl td[data-label] > br { display: none; }
  .tbl td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
  .tbl td:first-child { font-size: 15px; margin-bottom: 2px; }
  .tbl.ads td, .tbl.ads th { white-space: normal; }
  .tbl td form.row-form { width: 100%; }
  .tbl.leads td:nth-child(6), .tbl.leads td:nth-child(7), .tbl.leads td:nth-child(9) { display: none; }
  .tbl.leads td:nth-child(8):not(.red) { display: none; }
  .filters input[name=s] { display: none; }
  .seg { display: flex; overflow-x: auto; scrollbar-width: none; }
  .seg a { white-space: nowrap; flex: none; padding: 7px 12px; }
  .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; color: var(--muted); font: inherit; font-size: 10.5px; font-weight: 600; background: none; border: 0; cursor: pointer; }
  .tabbar button.on { color: var(--pri); }
  .tabbar button .ic { width: 22px; height: 22px; }
  .sheet { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 40; display: flex; align-items: flex-end; }
  .sheet[hidden] { display: none; }
  .sheet-card { background: #fff; width: 100%; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px rgba(15, 23, 42, .15); }
  .sheet-me { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
  .sheet-me b { display: block; } .sheet-me small { color: var(--muted); }
  .sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
  .sheet-grid a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 12px; background: #f8fafc; border: 1px solid var(--line2); color: var(--ink2); font-size: 12px; font-weight: 600; text-align: center; }
  .sheet-grid a.on { background: var(--pri-soft); color: var(--pri); border-color: #99f6e4; }
  .sheet-grid a:hover { text-decoration: none; }
  .sheet-grid .ic { width: 24px; height: 24px; }
  .m-logout { text-align: center; margin: 10px 0 0; }
  .st-form { padding-left: 12px; }
  .filters input, .filters select { flex: 1; min-width: 45%; }
  .facts { grid-template-columns: 100px 1fr; }
}
@media (max-width: 420px) { .fgrid { grid-template-columns: 1fr; } }
@media print { .side, .tabbar, .top form, .top .btn { display: none !important; } }
.verdict { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.v-ok { background: #dcfce7; color: #166534; } .v-bad { background: #fee2e2; color: #991b1b; } .v-warn { background: #fef3c7; color: #92400e; } .v-wait { background: var(--line2); color: var(--muted); }
.tbl.ads td, .tbl.ads th { white-space: nowrap; } .tbl.ads td:first-child { white-space: normal; min-width: 180px; }
details summary { cursor: pointer; margin-top: 10px; }
@media (min-width: 901px) { .m-logout { display: none; } }
