/* Shopfront Leads: same dark + gold as the Shopfront app, built for one thumb on a phone. */

:root {
  --bg: #0A0A0A;
  --card: #141414;
  --card-hi: #1C1A17;
  --field: #0F0F0F;
  --text: #F5EFE3;
  --muted: #A39A8B;
  --faint: #6F685D;
  --gold: #D4A24C;
  --gold-hi: #E7BD6A;
  --gold-soft: rgba(212, 162, 76, .14);
  --line: rgba(245, 239, 227, .09);
  --line-hi: rgba(245, 239, 227, .18);
  --hot: #FF8A5C;
  --hot-soft: rgba(255, 138, 92, .14);
  --ok: #7FD1A0;
  --ok-soft: rgba(127, 209, 160, .13);
  --err: #FF8F7E;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --gutter: 16px;
  --tab-h: 62px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --r: 14px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
a { color: var(--gold-hi); text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

/* ---------- Shell ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  padding: calc(12px + var(--safe-t)) var(--gutter) 12px;
  display: flex; align-items: center; gap: 12px;
  background: rgba(10, 10, 10, .88);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.top h1 { font-size: 19px; font-weight: 650; letter-spacing: -.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .back { font-size: 15px; color: var(--gold-hi); padding: 6px 4px; margin-left: -4px; }
.top .meta { font-size: 12.5px; color: var(--muted); text-align: right; line-height: 1.3; }

main { max-width: 720px; margin: 0 auto; padding: 14px var(--gutter) calc(var(--tab-h) + var(--safe-b) + 28px); }

.tabs {
  position: fixed; inset: auto 0 0; z-index: 20;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: rgba(14, 14, 14, .94);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11.5px; font-weight: 550; letter-spacing: .02em;
}
.tabs a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--gold-hi); }

/* ---------- Building blocks ---------- */
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 22px 2px 10px; }
.section-h:first-child { margin-top: 4px; }
.section-h h2 { font-size: 13px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.section-h span { font-size: 13px; color: var(--faint); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
}
.card + .card { margin-top: 10px; }
.card.is-hot { border-color: rgba(255, 138, 92, .35); background: linear-gradient(180deg, rgba(255, 138, 92, .06), transparent 90px), var(--card); }
.card.leaving { opacity: 0; transform: translateX(24px); transition: opacity .25s var(--ease), transform .25s var(--ease); }

.lead-head { display: flex; align-items: flex-start; gap: 10px; }
.lead-head .who { flex: 1; min-width: 0; }
.lead-name { font-size: 16px; font-weight: 650; line-height: 1.3; }
.lead-sub { color: var(--muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.score {
  flex: none; min-width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--card-hi); border: 1px solid var(--line-hi);
  font-weight: 700; font-size: 15px;
}
.score.high { color: var(--hot); border-color: rgba(255, 138, 92, .4); background: var(--hot-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 550; line-height: 1.5;
  background: var(--card-hi); color: var(--muted); border: 1px solid var(--line);
  white-space: nowrap;
}
.chip.hot { color: var(--hot); background: var(--hot-soft); border-color: transparent; }
.chip.gold { color: var(--gold-hi); background: var(--gold-soft); border-color: transparent; }
.chip.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.chip.warn { color: var(--err); background: rgba(255, 143, 126, .12); border-color: transparent; }

.proof { margin-top: 10px; font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.proof b { color: var(--text); font-weight: 600; }

.dm {
  margin-top: 12px; padding: 12px 13px;
  background: var(--field); border: 1px solid var(--line); border-radius: 11px;
  font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere;
}
.dm.empty { color: var(--faint); font-style: italic; }
.dm-label { margin-top: 12px; font-size: 12px; color: var(--faint); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.actions.three { grid-template-columns: 1.2fr 1fr 1fr; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 14px; border-radius: 11px;
  background: var(--card-hi); border: 1px solid var(--line-hi);
  font-weight: 600; font-size: 14.5px; color: var(--text);
  transition: background-color .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #17120A; }
.btn.primary:active { background: var(--gold-hi); }
.btn.done { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.btn.ghost { background: none; border-color: var(--line); color: var(--muted); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link-row { display: flex; gap: 16px; margin-top: 10px; font-size: 13.5px; }

.empty-state { text-align: center; color: var(--muted); padding: 30px 16px; border: 1px dashed var(--line-hi); border-radius: var(--r); }
.empty-state b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ---------- Today ---------- */
.progress { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.stat .n { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.stat .n small { font-size: 14px; font-weight: 500; color: var(--faint); }
.stat .l { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.bar { height: 4px; border-radius: 4px; background: var(--line); margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 4px; }

.window {
  margin-top: 10px; padding: 11px 14px; border-radius: var(--r);
  background: var(--card); border: 1px solid var(--line);
  font-size: 13.5px; color: var(--muted); display: flex; gap: 10px; align-items: center;
}
.window .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.window.open .dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.window b { color: var(--text); font-weight: 600; }

/* ---------- Pipeline ---------- */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filters .wide { grid-column: 1 / -1; }
.status-strip { display: flex; gap: 6px; overflow-x: auto; margin: 0 calc(-1 * var(--gutter)) 12px; padding: 0 var(--gutter) 2px; scrollbar-width: none; }
.status-strip::-webkit-scrollbar { display: none; }
.status-strip button {
  flex: none; padding: 7px 12px; border-radius: 99px; font-size: 13px; font-weight: 550;
  background: var(--card); border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.status-strip button[aria-pressed="true"] { background: var(--gold-soft); border-color: rgba(212, 162, 76, .45); color: var(--gold-hi); }
.status-strip button span { color: var(--faint); margin-left: 4px; }

.row-card { display: block; color: inherit; }
.row-card .lead-head { align-items: center; }
.row-card .chips { margin-top: 8px; }
.count-line { font-size: 13px; color: var(--faint); margin: 12px 2px 8px; }

/* ---------- Forms ---------- */
label.f { display: block; }
label.f > span { display: block; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); margin: 0 0 5px 2px; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--field); color: var(--text);
  border: 1px solid var(--line-hi); border-radius: 11px;
  font: inherit; font-size: 16px; /* 16px stops iOS zooming into fields */
}
select { appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
textarea.tall { min-height: 190px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 550; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--gold); }
fieldset { border: 0; padding: 0; margin: 0; }
.reply-box { border-color: rgba(212, 162, 76, .35); }

.save-bar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b)); z-index: 15;
  padding: 10px var(--gutter);
  background: rgba(10, 10, 10, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex; gap: 10px; align-items: center; justify-content: flex-end;
  transform: translateY(110%); transition: transform .2s var(--ease);
}
.save-bar.show { transform: none; }
.save-bar span { flex: 1; font-size: 13px; color: var(--muted); white-space: nowrap; }
.save-bar .btn { min-width: 96px; }
#lead-form { padding-bottom: 72px; } /* room for the save bar */

.timeline { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.timeline li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline li span:first-child { color: var(--muted); }

/* ---------- Numbers ---------- */
.range { display: flex; gap: 6px; overflow-x: auto; margin: 0 calc(-1 * var(--gutter)) 14px; padding: 0 var(--gutter); scrollbar-width: none; }
.range::-webkit-scrollbar { display: none; }
.funnel { display: grid; gap: 8px; }
.funnel .step { display: grid; grid-template-columns: 96px 1fr 44px; align-items: center; gap: 10px; font-size: 14px; }
.funnel .step span:first-child { color: var(--muted); }
.funnel .step b { text-align: right; font-weight: 700; }
.funnel .track { height: 10px; border-radius: 6px; background: var(--line); overflow: hidden; }
.funnel .track i { display: block; height: 100%; border-radius: 6px; background: var(--gold); min-width: 2px; }
.rate-big { display: flex; align-items: baseline; gap: 8px; margin-bottom: 14px; }
.rate-big .n { font-size: 34px; font-weight: 700; letter-spacing: -.02em; color: var(--gold-hi); }
.rate-big .l { color: var(--muted); font-size: 13.5px; }

.table-wrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 300px; }
th { text-align: right; font-size: 11px; font-weight: 600; color: var(--faint); letter-spacing: .03em; text-transform: uppercase; padding: 0 5px 8px; }
td { text-align: right; padding: 9px 5px; border-top: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
td:first-child { color: var(--text); font-weight: 550; line-height: 1.3; overflow-wrap: anywhere; }
td.rate { color: var(--gold-hi); font-weight: 650; }
.weeks { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; align-items: end; height: 110px; margin-top: 6px; }
.weeks div { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; font-size: 10.5px; color: var(--faint); white-space: nowrap; }
.weeks i { display: block; width: 100%; max-width: 30px; border-radius: 5px 5px 2px 2px; background: var(--gold-soft); position: relative; }
.weeks i b { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 5px 5px 2px 2px; background: var(--gold); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend span::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--gold-soft); }
.legend span.r::before { background: var(--gold); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 14px;
  max-width: calc(100vw - 32px); padding: 11px 14px 11px 16px; border-radius: 12px;
  background: #26231E; border: 1px solid var(--line-hi); box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  font-size: 14px; transition: opacity .2s, transform .2s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { color: var(--gold-hi); font-weight: 650; }
.toast.err { border-color: rgba(255, 143, 126, .4); }

.loading { color: var(--faint); text-align: center; padding: 40px 0; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px var(--gutter); }
.login form { width: 100%; max-width: 360px; display: grid; gap: 14px; }
.login img { width: 56px; height: 56px; border-radius: 14px; }
.login h1 { font-size: 22px; font-weight: 650; }
.login p { color: var(--muted); font-size: 14px; margin-top: -8px; }
.login .error { color: var(--err); font-size: 14px; min-height: 21px; margin: 0; }

@media (min-width: 720px) {
  .filters { grid-template-columns: 2fr 1fr 1fr 1fr; }
  .filters .wide { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
