/* Daily Leads. One calm column: progress up top, one lead card at a time down the page,
   section tabs in the thumb zone at the bottom. Ink and one blue; nothing else carries colour. */
@font-face { font-family: "General Sans"; src: url(fonts/GeneralSans-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "General Sans"; src: url(fonts/GeneralSans-Medium.woff2) format("woff2"); font-weight: 500 700; font-display: swap; }

:root {
  --paper: #F4F4F2; --surface: #FFFFFF; --ink: #111111; --muted: #55585E; --line: #DCDCD7;
  --accent: #4A65A3; --on-accent: #FFFFFF; --accent-soft: #E3E8F3; --warn: #8A4B0F; --bad: #A13A3A;
  --font: "General Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --tabs-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #111214; --surface: #1A1B1E; --ink: #EDEDEA; --muted: #A4A7AE; --line: #2E3034;
  --accent: #8FA5DA; --on-accent: #0E1116; --accent-soft: #222A3B; --warn: #E3A54C; --bad: #E58080;
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --paper: #111214; --surface: #1A1B1E; --ink: #EDEDEA; --muted: #A4A7AE; --line: #2E3034;
  --accent: #8FA5DA; --on-accent: #0E1116; --accent-soft: #222A3B; --warn: #E3A54C; --bad: #E58080;
  color-scheme: dark; }

* { box-sizing: border-box }
[hidden] { display: none !important }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.45 var(--font);
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + 24px); }
button, input, select, textarea { font: inherit; color: inherit }
a { color: var(--accent) }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
main, .top { max-width: 640px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
main:focus { outline: none }

/* Header */
.top { padding-top: calc(env(safe-area-inset-top, 0px) + 14px); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px }
h1 { font-size: 28px; line-height: 1.1; margin: 0; font-weight: 600; letter-spacing: -0.01em }
.sync { margin: 2px 0 0; font-size: 13px; color: var(--muted); min-height: 19px }
.sync.bad { color: var(--bad) }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; border-radius: 8px; cursor: pointer; margin-right: -10px }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round }

/* Progress */
.progress { padding: 16px 0 6px; display: grid; gap: 8px }
.progress-nums { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap }
.big { font-size: 40px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em }
.big small { font-size: 18px; font-weight: 500; color: var(--muted); letter-spacing: 0 }
.streak { font-weight: 600; font-variant-numeric: tabular-nums }
.streak span { color: var(--muted); font-weight: 400 }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s }
.goal-met { margin: 0; font-weight: 600; color: var(--accent) }

details.opener { margin: 10px 0 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0 }
details.opener summary { cursor: pointer; font-weight: 600; font-size: 15px; min-height: 28px; display: flex; align-items: center }
details.opener p { margin: 8px 0 0; font-size: 15px; max-width: 60ch }

/* Section headings */
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 26px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600 }
.empty { color: var(--muted); padding: 28px 0; margin: 0; max-width: 46ch }
.empty strong { color: var(--ink); display: block; font-size: 18px; margin-bottom: 4px }

/* Lead card */
.lead { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-top: 12px; display: grid; gap: 10px }
.lead-meta { margin: 0; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums }
.lead h2 { margin: 0; font-size: 21px; line-height: 1.2; font-weight: 600; text-wrap: balance; overflow-wrap: anywhere }
.site { margin: 0; font-size: 15px; max-width: 60ch }
.tag { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 8px; border-radius: 4px; margin-right: 6px; background: var(--accent-soft); color: var(--ink) }
.tag.ok { background: none; border: 1px solid var(--line); color: var(--muted) }
.reason { margin: 0; font-size: 14px; font-weight: 600; color: var(--warn) }
.reason.info { color: var(--muted); font-weight: 500 }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px }
.actions .call { grid-column: span 2; font-size: 18px; min-height: 56px }
.actions .call small { display: inline; font-size: 18px; font-weight: 500; margin-left: 6px; white-space: nowrap }
.act { min-height: 52px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--ink); padding: 6px 8px; cursor: pointer; text-align: center; line-height: 1.15 }
.act svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round }
.act.call { background: var(--accent); border-color: var(--accent); color: var(--on-accent) }
.act.call small { font-variant-numeric: tabular-nums }
.act[aria-disabled="true"] { color: var(--muted); background: none; border-style: dashed; cursor: default }

.note { display: grid; gap: 4px }
.note span { font-size: 13px; color: var(--muted) }
.note textarea { width: 100%; min-height: 44px; max-height: 220px; resize: vertical; field-sizing: content; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); font-size: 16px }

details.more summary { cursor: pointer; font-size: 14px; color: var(--muted); min-height: 32px; display: flex; align-items: center; width: max-content }
details.more .more-body { display: grid; gap: 8px; padding-top: 6px; font-size: 15px }
details.more p { margin: 0; max-width: 60ch; overflow-wrap: anywhere }
details.more .label { font-size: 13px; color: var(--muted); display: block }

.marks-label { margin: 4px 0 -2px; font-size: 13px; color: var(--muted); font-weight: 600 }
.marks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px }
.mark { min-height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; padding: 6px 10px }
.mark:active { background: var(--accent-soft) }
.mark[data-s="won"] { grid-column: span 2 }
.mark[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft) }

.cb-panel { border: 1px solid var(--accent); border-radius: 10px; padding: 12px; display: grid; gap: 10px; background: var(--paper) }
.cb-panel p { margin: 0; font-weight: 600 }
.chips { display: flex; flex-wrap: wrap; gap: 8px }
.chip { min-height: 44px; padding: 8px 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer }
.cb-custom { display: flex; gap: 8px; flex-wrap: wrap; align-items: center }
.cb-custom input { min-height: 44px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); min-width: 0; flex: 1 1 160px }

/* Compact rows (done today, follow-ups, clients) */
.row-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); min-height: 56px }
.row-item .who { min-width: 0 }
.row-item strong { display: block; overflow-wrap: anywhere; font-weight: 600 }
.row-item .sub { font-size: 14px; color: var(--muted) }
.row-item .text-btn { flex: none }
.row-item + .lead { margin-bottom: 12px }

.text-btn { border: 0; background: none; color: var(--accent); font-weight: 600; min-height: 44px; padding: 0 8px; cursor: pointer }
.btn { min-height: 48px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-align: center }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent) }
.more-btn { width: 100%; margin-top: 16px }

.search { width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); margin-top: 14px; font-size: 16px }

/* Stats */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: 10px }
.kpi { background: var(--surface); padding: 14px }
.kpi b { display: block; font-size: 30px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums }
.kpi span { font-size: 14px; color: var(--muted) }
.days { margin-top: 10px; display: grid; gap: 4px }
.day { display: grid; grid-template-columns: 76px 1fr 30px; align-items: center; gap: 10px; font-size: 14px; font-variant-numeric: tabular-nums }
.day .track { position: relative; height: 14px }
.day .fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 3px; min-width: 2px }
.day .fill.zero { background: var(--line) }
.day .goal-line { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .55 }
.day .n { text-align: right; font-weight: 600 }
.day.weekend { color: var(--muted) }
.legend { font-size: 13px; color: var(--muted); margin: 8px 0 0 }

/* Bottom tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); padding-inline: max(0px, calc(50% - 320px)) }
.tabs a { min-height: var(--tabs-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; text-align: center; line-height: 1.1; padding: 0 2px }
.tabs a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 3px 0 var(--accent) }
.tabs .count { font-size: 12px; font-variant-numeric: tabular-nums }

/* Settings sheet */
dialog { border: 0; padding: 0; background: var(--paper); color: var(--ink); width: 100%; max-width: 560px; max-height: 92dvh; border-radius: 16px; margin: auto auto 0; }
@media (min-width: 600px) { dialog { margin: auto } }
dialog::backdrop { background: rgb(0 0 0 / .45) }
.sheet { padding: 8px 16px calc(24px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 4px }
.sheet-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--paper); padding: 8px 0; z-index: 1 }
.sheet h2 { margin: 0; font-size: 22px }
.sheet section { border-top: 1px solid var(--line); padding: 14px 0; display: grid; gap: 10px }
.sheet h3 { margin: 0; font-size: 16px }
.field { display: grid; gap: 4px; font-size: 14px; color: var(--muted) }
.field input { min-height: 48px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 16px; width: 100% }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; cursor: pointer }
.check input { width: 22px; height: 22px; accent-color: var(--accent) }
.help { margin: 0; font-size: 14px; color: var(--muted) }
.help.bad { color: var(--bad) }
.row { display: flex; gap: 8px; flex-wrap: wrap }
.file-btn { position: relative; overflow: hidden }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer }

/* Toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + 12px); z-index: 30; background: var(--ink); color: var(--paper); border-radius: 10px; padding: 4px 4px 4px 16px; display: flex; align-items: center; gap: 8px; width: max-content; max-width: calc(100% - 32px); font-size: 15px; font-weight: 500; box-shadow: 0 6px 24px rgb(0 0 0 / .2) }
.toast .text-btn { color: var(--paper); text-decoration: underline }

@media (prefers-reduced-motion: reduce) { .bar i { transition: none } }
@media (max-width: 360px) { .big { font-size: 34px } .actions .call small { margin-left: 2px } }
