/* Tropical HQ — Plus Jakarta Sans, dark-first, warm orange accent */

@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('/fonts/PlusJakartaSans.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --bg: #0A1316;
  --bg-raise: #0F1B1F;
  --card: #101D21;
  --card-edge: rgba(255, 255, 255, 0.055);
  --hairline: rgba(255, 255, 255, 0.06);
  --text: #EDF3F2;
  --muted: #82989B;
  --faint: #51666A;
  --accent: #F4862C;
  --accent-soft: rgba(244, 134, 44, 0.13);
  --accent-grad: linear-gradient(135deg, #FFA14A, #EF6F1E);
  --up: #3DD68C;
  --up-soft: rgba(61, 214, 140, 0.12);
  --down: #FF7A7A;
  --down-soft: rgba(255, 122, 122, 0.11);
  --mark-cut: #0C181B;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
  --radius: 16px;
}

:root[data-theme="light"] {
  --bg: #F3F1EC;
  --bg-raise: #FBFAF7;
  --card: #FFFFFF;
  --card-edge: rgba(20, 40, 44, 0.07);
  --hairline: rgba(20, 40, 44, 0.08);
  --text: #16262A;
  --muted: #61767A;
  --faint: #9CACAF;
  --accent: #E8731C;
  --accent-soft: rgba(232, 115, 28, 0.1);
  --up: #169963;
  --up-soft: rgba(22, 153, 99, 0.1);
  --down: #D14F4F;
  --down-soft: rgba(209, 79, 79, 0.09);
  --mark-cut: #F3F1EC;
  --shadow: 0 3px 14px rgba(22, 38, 42, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html { height: 100%; }
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 20px 12px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--hairline);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name { font-weight: 700; font-size: 15.5px; letter-spacing: -0.015em; }
.brand-date { font-weight: 600; font-size: 11.5px; color: var(--muted); }
.top-actions { display: flex; gap: 4px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; color: var(--muted); display: grid; place-items: center; }
.icon-btn:active { background: var(--accent-soft); color: var(--accent); }
.icon-btn.spin svg { animation: rot 0.8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
#main { padding: 16px 16px 0; max-width: 560px; margin: 0 auto; display: grid; gap: 14px; }
.foot-space { height: calc(env(safe-area-inset-bottom) + 28px); }

.card {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.c-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.c-title { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.c-meta { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.c-meta.link { color: var(--accent); text-decoration: none; }
.c-meta.link::after { content: ' \203A'; }
.as-btn { padding: 0; }

/* ---------- hero number (leads) ---------- */
.hero-line { display: flex; align-items: center; gap: 10px; }
.hero-num { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-sub { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 6px; }

.trend {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 11.5px; font-weight: 700; padding: 2.5px 8px; border-radius: 7px;
  font-variant-numeric: tabular-nums; letter-spacing: 0.01em;
}
.trend.up { color: var(--up); background: var(--up-soft); }
.trend.down { color: var(--down); background: var(--down-soft); }
.trend.flat { color: var(--muted); background: var(--hairline); }
.trend:empty { display: none; }

/* ---------- inline stats ---------- */
.istats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 12px; }
@media (min-width: 460px) {
  .istats { grid-template-columns: repeat(4, 1fr); }
  .istats.gbp { grid-template-columns: repeat(3, 1fr); }
}
.istat b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.istat span { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.istat .trend { margin-top: 6px; }

.site-spark { margin-top: 16px; height: 40px; }
.site-spark svg { width: 100%; height: 40px; display: block; }
.src-line { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 12px; }
.src-line b { color: var(--text); font-weight: 700; }
.src-line .sep { color: var(--faint); padding: 0 4px; }

/* ---------- leads list ---------- */
.leads { margin-top: 14px; border-top: 1px solid var(--hairline); }
.lead { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--hairline); }
.lead:last-child { border-bottom: none; }
.lead-av {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.lead-info { min-width: 0; flex: 1; }
.lead-name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-meta { font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.lead-call {
  flex: none; width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--card-edge); color: var(--accent);
  display: grid; place-items: center; text-decoration: none;
}
.lead-call:active { background: var(--accent-soft); }
.empty { font-size: 13px; font-weight: 500; color: var(--muted); line-height: 1.55; }
.leads .empty { padding: 12px 0 2px; }
.accent { color: var(--accent); font-weight: 700; }

/* ---------- playbook ---------- */
.tip {
  background: var(--bg-raise);
  border: 1px solid var(--card-edge);
  border-radius: 12px; padding: 12px 14px;
  font-size: 13px; font-weight: 500; line-height: 1.55; margin-bottom: 6px;
}
.tip b {
  color: var(--accent); font-weight: 700; display: block;
  font-size: 10.5px; letter-spacing: 0.09em; text-transform: uppercase; margin-bottom: 4px;
}
.playbook { display: grid; }
.pb-cat {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 13px 0; font-weight: 700; font-size: 13.5px;
  border-bottom: 1px solid var(--hairline); text-align: left;
}
.pb-cat:last-of-type { border-bottom: none; }
.pb-right { display: flex; align-items: center; gap: 8px; }
.pb-count { font-size: 11.5px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.pb-count.done { color: var(--up); }
.pb-chev { color: var(--faint); transition: transform 0.2s; display: grid; place-items: center; }
.pb-cat.open .pb-chev { transform: rotate(180deg); }
.pb-items { display: none; padding: 2px 0 8px; border-bottom: 1px solid var(--hairline); }
.pb-items.open { display: block; }
.pb-item { display: flex; align-items: flex-start; gap: 11px; width: 100%; padding: 8px 0; text-align: left; }
.pb-box {
  width: 19px; height: 19px; border-radius: 6px; flex: none; margin-top: 1px;
  border: 1.5px solid var(--faint); display: grid; place-items: center;
  color: transparent; font-size: 12px;
}
.pb-item.done .pb-box { background: var(--accent); border-color: var(--accent); color: #fff; }
.pb-text { font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.5; }
.pb-item.done .pb-text { color: var(--faint); }

.stamp { text-align: center; font-size: 11px; font-weight: 600; color: var(--faint); padding-top: 2px; }

/* ---------- sheets ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(4, 10, 12, 0.62);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity 0.22s;
}
.backdrop.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--bg-raise);
  border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--card-edge);
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 22px);
  max-width: 560px; margin: 0 auto;
  max-height: 85vh; overflow-y: auto;
  transform: translateY(105%); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet.show { transform: translateY(0); }
.sheet-grab { width: 38px; height: 4px; border-radius: 99px; background: var(--faint); opacity: 0.45; margin: 5px auto 16px; }
.sheet-title { font-size: 18px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 12px; }
.sheet-hint { font-size: 12.5px; font-weight: 500; color: var(--muted); margin: 0 0 16px; line-height: 1.55; }

.m-nav { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 12px; }
.m-btn {
  width: 32px; height: 32px; border-radius: 9px; color: var(--muted);
  font-size: 19px; line-height: 1; display: grid; place-items: center;
  border: 1px solid var(--card-edge);
}
.m-btn:active { background: var(--accent-soft); color: var(--accent); }
.m-btn[disabled] { opacity: 0.25; }
.m-label { font-weight: 700; font-size: 13.5px; min-width: 110px; text-align: center; }

.field { display: block; margin-bottom: 12px; flex: 1; }
.field span { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 13px; border-radius: 11px;
  background: var(--card); border: 1px solid var(--card-edge); color: var(--text);
  font: 600 16px 'Plus Jakarta Sans', sans-serif;
}
.field input:focus { outline: none; border-color: var(--accent); }
.field-row { display: flex; gap: 10px; }

.btn-primary {
  width: 100%; padding: 15px; border-radius: 13px; margin-top: 6px;
  background: var(--accent-grad); color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 6px 16px rgba(239, 111, 30, 0.28);
}
.btn-primary:active { transform: scale(0.985); }
.btn-primary[disabled] { opacity: 0.5; }

.seg { display: flex; gap: 5px; background: var(--card); border: 1px solid var(--card-edge); padding: 3px; border-radius: 11px; }
.seg button { padding: 7px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--accent); color: #fff; }

.set-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; font-weight: 600; font-size: 14px; }
.set-action {
  display: block; width: 100%; text-align: left; padding: 14px 0;
  font-weight: 600; font-size: 14px; border-bottom: 1px solid var(--hairline);
}
.set-action:first-of-type { border-top: 1px solid var(--hairline); }
.set-foot { font-size: 11px; font-weight: 600; color: var(--faint); text-align: center; margin-top: 18px; }

/* ---------- lock screen ---------- */
.lock {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: env(safe-area-inset-top) 24px env(safe-area-inset-bottom);
}
.lock-inner { width: 100%; max-width: 300px; text-align: center; }
.lock-mark { width: 60px; height: 60px; margin-bottom: 12px; }
.lock-title { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.lock-sub { font-size: 13px; font-weight: 500; color: var(--muted); margin: 4px 0 24px; min-height: 20px; }
.lock-sub.err { color: var(--down); animation: shake 0.4s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin-bottom: 30px; min-height: 12px; }
.pin-dot { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--faint); }
.pin-dot.full { background: var(--accent); border-color: var(--accent); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.keypad button {
  height: 62px; border-radius: 16px; font-size: 23px; font-weight: 600;
  background: var(--card); border: 1px solid var(--card-edge); color: var(--text);
}
.keypad button:active { background: var(--accent-soft); }
.keypad button.action { font-size: 15px; color: var(--accent); font-weight: 700; }
.keypad button.ghost { background: none; border: none; }

@media (min-width: 561px) {
  #main { padding-top: 22px; }
}
