/* Spirit Connect — design system.
   Language carried from the FieldForce / KIST Closer / Territory Mapper family:
   warm paper palette, Fraunces for display numerals & titles, Outfit for UI,
   JetBrains Mono for codes and money. Pills carry meaning: green=good/on-prem,
   gold=partial/off-prem/premium, orange=attention, blue=info. */

:root {
  --bg: #f6f6f4;
  --panel: #ffffff;
  --ink: #1a1a18;
  --muted: #6b6b66;
  --line: #e7e5e0;
  --green: #2e7d4f;      --green-lt: #e7f3ec;  --green-bd: #bfe0cd;
  --gold: #a97f1f;       --gold-lt: #f8f0dd;   --gold-bd: #e6d3a3;
  --orange: #c05621;     --orange-lt: #fdeee3; --orange-bd: #f3cfb3;
  --blue: #1d5b9c;       --blue-lt: #e8f1fa;   --blue-bd: #bcd6ee;
  --red: #b03a2e;        --red-lt: #fbe9e7;
  --dark: #21201d;
  --r: 12px; --r-sm: 8px;
  --shadow: 0 1px 3px rgba(26,26,24,.06), 0 4px 16px rgba(26,26,24,.06);
  --shadow-lg: 0 4px 12px rgba(26,26,24,.10), 0 16px 40px rgba(26,26,24,.12);
  --font-ui: "Outfit", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-ui); background: var(--bg); color: var(--ink);
  font-size: 15px; line-height: 1.5; min-height: 100vh;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 300; background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 10px 20px;
}
.topbar .logo { font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--ink); }
.topbar .logo em { color: var(--gold); font-style: normal; }
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a {
  padding: 7px 13px; border-radius: 999px; color: var(--ink); font-size: 14px;
  font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
}
.topbar nav a:hover { background: var(--bg); text-decoration: none; }
.topbar nav a.active { background: var(--dark); color: #fff; }
.topbar nav a .nbadge {
  font-size: 10.5px; padding: 1px 7px; border-radius: 999px; font-weight: 600;
  background: var(--gold-lt); color: var(--gold); border: 1px solid var(--gold-bd);
}
.userchip {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 13px;
}
.userchip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }

.wrap { max-width: 1280px; margin: 0 auto; padding: 26px 20px 80px; }
.wrap-narrow { max-width: 880px; }

/* ---------- components ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 20px;
}
.card + .card { margin-top: 16px; }
.card h3 { font-size: 17px; margin-bottom: 6px; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 920px) { .g2, .g3, .g4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

.stat { border-left: 3px solid var(--green); padding: 14px 16px; background: var(--panel);
        border-radius: var(--r-sm); border-top: 1px solid var(--line);
        border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow); }
.stat .n { font-family: var(--font-display); font-size: 30px; font-weight: 700; }
.stat .l { font-size: 12.5px; color: var(--muted); font-weight: 500; letter-spacing: .02em; }
.stat.gold { border-left-color: var(--gold); }
.stat.blue { border-left-color: var(--blue); }
.stat.orange { border-left-color: var(--orange); }

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2.5px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill.green { background: var(--green-lt); color: var(--green); border: 1px solid var(--green-bd); }
.pill.gold { background: var(--gold-lt); color: var(--gold); border: 1px solid var(--gold-bd); }
.pill.orange { background: var(--orange-lt); color: var(--orange); border: 1px solid var(--orange-bd); }
.pill.blue { background: var(--blue-lt); color: var(--blue); border: 1px solid var(--blue-bd); }
.pill.grey { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
  border: 1.5px solid var(--line); border-radius: 999px; background: #fff;
  font-size: 13.5px; font-weight: 500; cursor: pointer; user-select: none;
  transition: all .12s ease;
}
.chip:hover { border-color: var(--gold-bd); }
.chip.on { border-color: var(--dark); background: var(--dark); color: #fff; }
.chip.on.gold { background: var(--gold); border-color: var(--gold); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font-size: 14px; font-weight: 600; color: var(--ink);
  transition: all .12s ease;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink); outline: none;
}
.input:focus { border-color: var(--gold); }
label.lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted);
            margin: 14px 0 6px; letter-spacing: .03em; text-transform: uppercase; }

/* score bar (single source of score-color truth: >=80 green, >=50 gold, else grey) */
.score { display: inline-flex; align-items: center; gap: 8px; }
.score .track { width: 54px; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.score .fill { height: 100%; border-radius: 999px; }
.score .v { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; }

/* table */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
          color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line);
          position: sticky; top: 0; background: var(--panel); z-index: 2; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--bg); }
.tbl .acct-name { font-weight: 600; }
.tbl .acct-meta { font-size: 11.5px; color: var(--muted); }

/* data-source strip — the "honest about the data" banner */
.src-strip {
  border-radius: var(--r-sm); padding: 11px 15px; font-size: 13px; margin: 14px 0;
  border: 1px solid var(--green-bd); background: var(--green-lt); color: #1d4d33;
}
.src-strip.gold { border-color: var(--gold-bd); background: var(--gold-lt); color: #6d5312; }
.src-strip b { font-weight: 700; }

/* factor cards (rank-by options) — incl. the disabled/partial mechanic */
.rank-opt {
  border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 13px 15px;
  cursor: pointer; background: #fff; position: relative; transition: border-color .12s;
}
.rank-opt:hover { border-color: var(--gold-bd); }
.rank-opt.on { border-color: var(--dark); box-shadow: 0 0 0 1px var(--dark); }
.rank-opt .t { font-weight: 700; font-size: 14px; }
.rank-opt .d { font-size: 12.5px; color: var(--muted); margin: 3px 0 8px; }
.rank-opt.na {
  cursor: not-allowed; color: var(--muted);
  background: repeating-linear-gradient(-45deg, #fff, #fff 7px, #f3f2ef 7px, #f3f2ef 9px);
}
.rank-opt .flag { position: absolute; top: 10px; right: 10px; }

/* stepper */
.stepper { display: flex; gap: 6px; margin-bottom: 22px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 999px;
        font-size: 13px; font-weight: 600; background: #fff; border: 1px solid var(--line);
        color: var(--muted); }
.step.on { background: var(--dark); border-color: var(--dark); color: #fff; }
.step.done { background: var(--green-lt); border-color: var(--green-bd); color: var(--green); }
.step .num { width: 20px; height: 20px; border-radius: 50%; background: var(--bg);
             display: inline-flex; align-items: center; justify-content: center;
             font-size: 11.5px; font-family: var(--font-mono); }
.step.on .num { background: rgba(255,255,255,.18); color: #fff; }

/* toast */
#toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 12px);
  background: var(--dark); color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 13.5px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: all .22s ease; z-index: 999; max-width: 92vw;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* modal */
.modal-bk { position: fixed; inset: 0; background: rgba(26,26,24,.45); z-index: 500;
            display: none; align-items: center; justify-content: center; padding: 18px; }
.modal-bk.show { display: flex; }
.modal { background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
         max-width: 620px; width: 100%; max-height: 88vh; overflow: auto; padding: 24px; }
.modal h3 { font-size: 19px; margin-bottom: 4px; }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0;
      border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; }

/* map */
#map { width: 100%; height: calc(100vh - 210px); min-height: 460px;
       border-radius: var(--r); border: 1px solid var(--line); }
.map-legend {
  position: absolute; bottom: 18px; left: 12px; z-index: 400;
  background: rgba(255,255,255,.9); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px; font-size: 12px;
}
.map-legend .row { display: flex; align-items: center; gap: 7px; margin: 3px 0; }

/* auth box */
.auth-box { max-width: 400px; margin: 9vh auto; }

/* pricing */
.plan { border: 1.5px solid var(--line); border-radius: 14px; padding: 24px; background: #fff;
        display: flex; flex-direction: column; gap: 0; position: relative; }
.plan.feat { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), var(--shadow-lg); }
.plan .tag { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); }
.plan .price { font-family: var(--font-display); font-size: 38px; font-weight: 700; }
.plan .price span { font-size: 14px; font-family: var(--font-ui); color: var(--muted); font-weight: 500; }
.plan ul { list-style: none; margin: 14px 0 18px; flex: 1; }
.plan li { padding: 6px 0; font-size: 13.5px; display: flex; gap: 8px; align-items: baseline; }
.plan li::before { content: "✓"; color: var(--green); font-weight: 700; }
.plan li.no { color: var(--muted); }
.plan li.no::before { content: "—"; color: var(--line); }

/* landing hero */
.hero { padding: 64px 0 40px; text-align: center; }
.hero h1 { font-size: clamp(32px, 5.4vw, 54px); max-width: 820px; margin: 0 auto 16px; }
.hero h1 em { font-style: italic; color: var(--gold); }
.hero p.sub { font-size: 17px; color: var(--muted); max-width: 640px; margin: 0 auto 26px; }

/* coverage bars (data story) */
.covbar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--line); }
.covbar .seg { height: 100%; }

footer.site { border-top: 1px solid var(--line); padding: 26px 20px; text-align: center;
              color: var(--muted); font-size: 13px; margin-top: 60px; }

/* mobile bottom tab bar (KIST-style); topbar nav hides on phones */
.bottomnav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 500;
  background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottomnav a {
  flex: 1; text-align: center; font-size: 11px; font-weight: 600; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none;
}
.bottomnav a .ic { font-size: 19px; }
.bottomnav a.active { color: var(--ink); }
.bottomnav a.active .ic { transform: scale(1.12); }

@media (max-width: 720px) {
  .topbar { padding: 8px 12px; gap: 8px; }
  .topbar nav { display: none; }              /* bottom tabs take over */
  .bottomnav { display: flex; }
  .userchip span:last-child { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  .wrap { padding: 18px 12px 84px; }          /* clear the bottom bar */
  #map { height: 56vh; }
}

/* coming-soon modules (campaigns, studio): visible in nav, grayed, not clickable */
.topbar nav a.soon, .bottomnav a.soon { opacity: .38; pointer-events: none; }
.topbar nav a.soon::after { content: "soon"; font-size: 9.5px; margin-left: 5px; padding: 1px 5px;
  border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted);
  vertical-align: middle; }
.card.soon { opacity: .55; filter: grayscale(.5); }
/* a parked page: banner card on top, everything else grayed and inert */
.soon-card { border-color: var(--gold-bd); background: var(--gold-lt); text-align: center; }
body.soon-page .wrap > *:not(.soon-card) { pointer-events: none; user-select: none; opacity: .35; filter: grayscale(.7); }
