/* Bon Temps Boards — shared styles.
   Tokens and layout follow the approved mock-up (live-boards-mock-up):
   warm cream, deep purple, gold stars, Bricolage Grotesque display type. */
* { box-sizing: border-box; }
:root {
  color-scheme: light dark;
  --bg: #f3f1ec;
  --surface: #ffffff;
  --surface-2: #eceae4;
  --ink: #211533;
  --ink-soft: #57496e;
  --line: #ddd6ea;
  --purple: #4a156b;
  --purple-bright: #6d28a8;
  --gold: #d9930d;
  --gold-bright: #f2b01e;
  --green: #177a4c;
  --red: #b3352c;
  --display-bg: #1d0b33;
  --display-panel: #2a1150;
  --display-ink: #f4efff;
  --display-soft: #c9b8ec;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(33, 21, 51, .10);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #140d24;
    --surface: #1f1538;
    --surface-2: #291d49;
    --ink: #f0eafc;
    --ink-soft: #b7a8d9;
    --line: #3a2a63;
    --purple: #8b5cf6;
    --purple-bright: #a678f0;
    --gold: #f2b01e;
    --green: #3ecf8e;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  }
}
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
h1, h2, h3, .display-font { font-family: "Bricolage Grotesque", "Archivo", sans-serif; }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
a { color: var(--purple-bright); }
button, [role="button"], select, summary, input:not([type="checkbox"], [type="radio"]) { min-height: 2.25rem; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px 64px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 18px 0 6px;
}
.topbar .brand {
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 22px;
  color: var(--ink); text-decoration: none; letter-spacing: -.01em;
}
.topbar .brand span { color: var(--purple-bright); }
.topbar nav { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.topbar nav a {
  font-weight: 700; font-size: 14px; text-decoration: none; color: var(--ink-soft);
  padding: 8px 12px; border-radius: 10px;
}
.topbar nav a:hover { background: var(--surface-2); color: var(--ink); }
.topbar nav a.active { background: var(--purple); color: #fff; }
@media (prefers-color-scheme: dark) { .topbar nav a.active { background: var(--purple-bright); color: #140d24; } }

/* ---------- Hero ---------- */
.hero { padding: 26px 0 8px; }
.hero h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.03; margin: 12px 0 10px; font-weight: 800; letter-spacing: -.01em; }
.hero h1 .accent { color: var(--purple-bright); }
.hero p.lede { font-size: clamp(16px, 2vw, 19px); color: var(--ink-soft); max-width: 62ch; margin: 0; }
.hero p.lede strong { color: var(--ink); }
.tag {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .04em;
  padding: 6px 12px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-soft);
}
.tag .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.live-pill { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; letter-spacing: .05em; }
.live-pill .pulse { width: 10px; height: 10px; border-radius: 50%; background: #e5484d; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(229,72,77,.5); } 70% { box-shadow: 0 0 0 9px rgba(229,72,77,0); } 100% { box-shadow: 0 0 0 0 rgba(229,72,77,0); } }

/* ---------- Buttons / forms ---------- */
.btn {
  font: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
  border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); padding: 8px 16px;
}
.btn:hover { border-color: var(--purple-bright); }
.btn.primary { background: var(--purple); border-color: var(--purple); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { background: var(--purple-bright); border-color: var(--purple-bright); color: #140d24; } }
.btn.primary:hover { filter: brightness(1.1); }
.btn.small { padding: 4px 12px; font-size: 13px; min-height: 2rem; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.approve { border-color: var(--green); color: var(--green); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.field { margin-bottom: 12px; position: relative; }
.field label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 5px; color: var(--ink); }
.field label .opt { font-weight: 500; color: var(--ink-soft); }
.field input, .field textarea, .field select {
  width: 100%; font: inherit; font-size: 15px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--purple-bright); outline-offset: 1px; border-color: var(--purple-bright); }
.field .hint { font-size: 12.5px; color: var(--ink-soft); margin: 6px 0 0; }
.suggest {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 5;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; margin-top: 4px;
  box-shadow: 0 12px 24px rgba(33, 21, 51, .16); overflow: hidden; display: none;
}
.suggest.open { display: block; }
.suggest button {
  display: flex; width: 100%; justify-content: space-between; align-items: center;
  background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 12px;
  font: inherit; font-size: 14px; cursor: pointer; color: var(--ink); text-align: left; min-height: 2.75rem;
}
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover, .suggest button:focus { background: var(--surface-2); }
.suggest .dist { font-size: 12px; color: var(--ink-soft); }

/* ---------- Cards / panels ---------- */
.card, .panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.panel h3 { margin: 0 0 4px; font-size: 19px; }
.panel .panel-sub { font-size: 13.5px; color: var(--ink-soft); margin: 0 0 14px; }
section.block { margin-top: 48px; }
section.block > h2 { font-size: clamp(24px, 3.4vw, 32px); margin: 0 0 6px; font-weight: 800; }
section.block > p.intro-p { color: var(--ink-soft); max-width: 64ch; margin: 0 0 20px; }

/* ---------- Board page layout ---------- */
.stage-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin: 26px 0 16px; }
.stage-head h2 { font-size: clamp(24px, 3.4vw, 32px); margin: 0; font-weight: 800; }
.stage-head p { margin: 4px 0 0; color: var(--ink-soft); max-width: 56ch; }
.stage { display: grid; grid-template-columns: 360px 1fr; gap: 26px; align-items: start; }
.stage > div { min-width: 0; }
@media (max-width: 900px) { .stage { grid-template-columns: minmax(0, 1fr); } }
.checkin-btn {
  width: 100%; font-size: 16px; padding: 12px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--green); color: #fff; font-weight: 800; font-family: "Bricolage Grotesque", sans-serif;
  letter-spacing: .01em;
}
.checkin-btn:hover { filter: brightness(1.08); }
.checkin-btn:disabled { opacity: .45; cursor: not-allowed; }
.fineprint { font-size: 12px; color: var(--ink-soft); text-align: center; margin: 10px 0 0; }
.toast {
  display: none; margin-top: 14px; background: #e9f7ef; border: 1.5px solid var(--green); color: #0d5230;
  border-radius: 12px; padding: 12px 14px; font-size: 14px;
}
.toast.show { display: block; }
.toast strong { display: block; font-family: "Bricolage Grotesque", sans-serif; font-size: 15px; }
@media (prefers-color-scheme: dark) { .toast { background: #0e2e1d; color: #b8f0d0; } }

/* ---------- Leaflet map ---------- */
.map-box { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
#map { height: 480px; width: 100%; background: #1d0b33; z-index: 0; }
@media (max-width: 900px) { #map { height: 380px; } }
.leaflet-container { font-family: "Archivo", system-ui, sans-serif; }
.pin-star { background: none; border: none; }
.pin-star svg { display: block; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
.pin-star.new-pin svg { animation: pinpop .7s ease-out; transform-origin: center; }
@keyframes pinpop { 0% { transform: scale(0); } 60% { transform: scale(1.9); } 100% { transform: scale(1); } }
.pin-popup { font-size: 14px; }
.pin-popup b { display: block; font-size: 15px; }
.pin-popup .cmt { font-style: italic; color: #57496e; margin-top: 4px; }

/* ---------- Stats / ticker / latest ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.stat .num { font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: clamp(22px, 3vw, 30px); line-height: 1; }
.stat .lbl { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-soft); margin-top: 4px; }
.ticker {
  display: flex; gap: 10px; align-items: center; margin-top: 14px;
  background: rgba(217, 147, 13, .1); border: 1px solid rgba(217, 147, 13, .4); border-radius: 10px; padding: 8px 14px;
  font-size: 14px; min-height: 2.5rem; overflow: hidden;
}
.ticker .t-tag { flex: none; font-size: 11px; font-weight: 800; letter-spacing: .1em; color: var(--gold); }
.ticker .t-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.latest { margin-top: 18px; }
.latest h4, .wall-head { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 8px; font-weight: 700; }
.latest ul { list-style: none; margin: 0; padding: 0; }
.latest li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.latest li:last-child { border-bottom: 0; }
.latest .who { font-weight: 600; }
.latest .from { color: var(--ink-soft); }
.latest .miles { color: var(--gold); font-family: "IBM Plex Mono", monospace; font-size: 12.5px; flex: none; }
.latest li.fresh { animation: slidein .5s ease-out; }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Shout-out wall ---------- */
.wall { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 560px) { .wall { grid-template-columns: 1fr; } }
.wall .note { border-radius: 10px; padding: 10px 12px; font-size: 13.5px; line-height: 1.4; color: #2c2144; }
.wall .note b { display: block; font-size: 12px; margin-top: 5px; opacity: .75; }
.n1 { background: #fde68a; } .n2 { background: #bbf7d0; } .n3 { background: #fbcfe8; }
.n4 { background: #bfdbfe; } .n5 { background: #fed7aa; } .n6 { background: #ddd6fe; }

/* ---------- Board list / templates ---------- */
.board-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (max-width: 820px) { .board-grid { grid-template-columns: 1fr; } }
.board-card { display: block; text-decoration: none; color: var(--ink); }
.board-card h3 { margin: 0 0 4px; font-size: 20px; }
.board-card p { margin: 0; font-size: 14px; color: var(--ink-soft); }
.board-card .meta { margin-top: 12px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.board-card .meta b { font-family: "IBM Plex Mono", monospace; }
.how-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .how-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .how-grid { grid-template-columns: 1fr; } }
.how-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.how-card .step-num { font-family: "IBM Plex Mono", monospace; font-weight: 600; font-size: 13px; color: var(--gold); }
.how-card h3 { margin: 6px 0; font-size: 18px; }
.how-card p { margin: 0; font-size: 14px; color: var(--ink-soft); }
.tpl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (max-width: 820px) { .tpl-grid { grid-template-columns: 1fr; } }
.tpl { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.tpl-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 0; }
.tpl-ico { width: 42px; height: 42px; flex: none; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--purple-bright); }
.tpl-head h3 { margin: 0; font-size: 19px; }
.tpl-head .tpl-use { font-size: 12.5px; color: var(--ink-soft); }
.tpl-body { padding: 12px 18px 18px; font-size: 14px; color: var(--ink-soft); }
.tpl-body p { margin: 0 0 12px; }
.tpl .live-tag { margin-left: auto; flex: none; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--green); border: 1.5px solid currentColor; padding: 3px 8px; border-radius: 999px; }
.tpl .soon-tag { margin-left: auto; flex: none; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); border: 1.5px solid var(--line); padding: 3px 8px; border-radius: 999px; }

/* ---------- Display view (big screen) ---------- */
body.display { background: var(--display-bg); color: var(--display-ink); }
.display-shell { max-width: 1560px; margin: 0 auto; padding: 18px 26px 26px; }
.display-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.display-top .dt-kicker { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-bright); }
.display-top h1 { margin: 2px 0 0; font-size: clamp(30px, 4vw, 46px); line-height: 1.05; font-weight: 800; }
.display-top .dt-sub { font-size: 14px; color: var(--display-soft); margin-top: 4px; }
.scan-box { text-align: center; background: var(--display-panel); border: 1px solid #452a75; border-radius: 12px; padding: 10px 14px 8px; }
.scan-box img { width: 96px; height: 96px; display: block; margin: 0 auto 4px; background: #fff; border-radius: 6px; padding: 4px; }
.scan-box span { font-size: 12px; font-weight: 700; display: block; line-height: 1.3; }
.scan-box small { font-size: 11px; color: var(--display-soft); }
#displayMap { height: 52vh; min-height: 380px; width: 100%; background: #1d0b33; border-radius: 12px; }
.display-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
@media (max-width: 700px) { .display-stats { grid-template-columns: repeat(2, 1fr); } }
.dstat { background: var(--display-panel); border: 1px solid #452a75; border-radius: 12px; padding: 10px 14px; }
.dstat .num { font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: clamp(22px, 3vw, 32px); line-height: 1; color: #fff; }
.dstat .lbl { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--display-soft); margin-top: 4px; }
.display-ticker {
  display: flex; gap: 10px; align-items: center; margin-top: 14px;
  background: rgba(242, 176, 30, .1); border: 1px solid rgba(242, 176, 30, .35); border-radius: 10px; padding: 10px 14px;
  font-size: 15px; min-height: 2.75rem; overflow: hidden;
}
.display-ticker .t-tag { flex: none; font-size: 11px; font-weight: 800; letter-spacing: .1em; color: var(--gold-bright); }
.display-ticker .t-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.display-bottom { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; margin-top: 14px; }
@media (max-width: 700px) { .display-bottom { grid-template-columns: 1fr; } }
.display-bottom h4 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--display-soft); margin: 0 0 8px; font-weight: 700; }
.dlatest ul { list-style: none; margin: 0; padding: 0; }
.dlatest li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid #37205f; font-size: 15px; }
.dlatest li:last-child { border-bottom: 0; }
.dlatest .who { color: #fff; font-weight: 600; }
.dlatest .from { color: var(--display-soft); }
.dlatest .miles { color: var(--gold-bright); font-family: "IBM Plex Mono", monospace; font-size: 13px; flex: none; }
.ad-card { background: linear-gradient(135deg, #f7ead2, #f2d492); color: #3a2a05; border-radius: 12px; padding: 16px; min-height: 118px; display: flex; flex-direction: column; justify-content: center; }
.ad-card .ad-name { font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 21px; line-height: 1.15; }
.ad-card .ad-line { font-size: 13.5px; margin-top: 3px; }
.ad-card .ad-meta { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; margin-top: 10px; color: #7a5c14; font-weight: 700; }
.ad-dots { display: flex; gap: 6px; margin-top: 10px; }
.ad-dots i { width: 8px; height: 8px; border-radius: 50%; background: #452a75; display: block; }
.ad-dots i.on { background: var(--gold-bright); }

/* ---------- Console ---------- */
.org-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; align-items: start; }
@media (max-width: 820px) { .org-grid { grid-template-columns: 1fr; } }
.mod-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.mod-item:last-child { border-bottom: 0; }
.mod-item .mi-body { flex: 1; min-width: 0; }
.mod-item .mi-type { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--purple-bright); }
.mod-item .mi-text { font-size: 14.5px; margin-top: 1px; }
.mod-item .mi-meta { font-size: 12.5px; color: var(--ink-soft); }
.mod-actions { display: flex; gap: 6px; flex: none; }
.mod-actions .btn { padding: 4px 10px; }
.mod-status { font-size: 12px; font-weight: 700; }
.board-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.board-row:last-child { border-bottom: 0; }
.board-row .b-name { font-weight: 700; font-size: 15px; }
.board-row .b-meta { font-size: 12.5px; color: var(--ink-soft); }
.board-row .b-count { margin-left: auto; text-align: right; flex: none; }
.board-row .b-count .n { font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 18px; }
.board-row .b-count .l { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--ink-soft); }
.empty { color: var(--ink-soft); font-size: 14px; margin: 0; }
.error { background: #fdeceb; border: 1.5px solid var(--red); color: #7a1f1a; border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-top: 12px; }
@media (prefers-color-scheme: dark) { .error { background: #3a1414; color: #f3b8b4; } }
.hidden { display: none !important; }

footer { margin-top: 56px; border-top: 1px solid var(--line); padding-top: 18px; font-size: 13px; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; }
@media (prefers-reduced-motion: reduce) {
  .pin-star.new-pin svg, .latest li.fresh { animation: none; }
  .live-pill .pulse { animation: none; }
  html { scroll-behavior: auto; }
}
