:root {
  --ember: #EE5A24;
  --blue: #2350C8;
  --bone: #F1EBDD;
  --butter: #FFEE8C;
  --night: #111014;
  --panel: rgba(17, 16, 20, .94);
  --line: rgba(241, 235, 221, .14);
  --muted: #b3aa9c;
  --ink: var(--bone);
  --ok: #7dbe4a;
  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter Tight", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--night); color: var(--ink); font-family: var(--sans); }
body { padding-bottom: calc(var(--nav-h) + var(--safe-b)); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--butter); }
img { max-width: 100%; }
[hidden] { display: none !important; }
body.gate .demo-banner, body.gate .install-banner { display: none !important; }

.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  background: linear-gradient(to bottom, #111014 70%, rgba(17,16,20,0));
}
.app-header .logo { width: 36px; height: 38px; display: block; }
.lockup h1 {
  font-family: var(--display); font-weight: 700; font-size: 22px; line-height: .9;
  margin: 0; letter-spacing: .04em; text-transform: uppercase;
}
.lockup h1 span { color: var(--ember); }
.lockup p { margin: 2px 0 0; font-family: var(--serif); font-style: italic; font-size: 13px; color: var(--muted); }

.demo-banner {
  position: sticky; top: calc(58px + env(safe-area-inset-top, 0px)); z-index: 19;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  margin: 0 14px 10px; padding: 6px 10px; border-radius: 10px;
  background: rgba(255, 238, 140, .12); border: 1px solid rgba(255, 238, 140, .3);
  color: var(--butter); font-size: 12px; line-height: 1.35;
}
.demo-banner p { margin: 0; flex: 1 1 160px; }
.demo-banner-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.demo-banner-actions button {
  background: transparent; border: 1px solid rgba(255, 238, 140, .45);
  color: var(--butter); border-radius: 999px; padding: 4px 10px;
  font-size: 12px; font-weight: 600; min-height: 28px;
}
.demo-banner-actions button:hover, .demo-banner-actions button:focus {
  background: var(--butter); color: var(--night);
}
.fb-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.fb-item:last-child { border-bottom: 0; }
.fb-item .meta { color: var(--muted); font-size: 12px; margin: 0 0 4px; }
.fb-item p { margin: 0 0 4px; font-size: 14px; }
.or-line {
  display: flex; align-items: center; gap: 10px; margin: 4px 0 12px;
  color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
}
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }


main { padding: 0 14px 24px; max-width: 560px; margin: 0 auto; }
main.wide { max-width: 100%; padding-left: 0; padding-right: 0; }

.screen { display: none; }
.screen.on { display: block; }

h2.page {
  font-family: var(--display); font-weight: 700; font-size: 32px; line-height: .92;
  margin: 6px 0 4px; text-transform: uppercase; letter-spacing: .02em;
}
h2.page::after { content: ""; display: block; width: 44px; height: 4px; background: var(--ember); margin-top: 8px; }
.lede { font-family: var(--serif); font-style: italic; color: var(--muted); margin: 0 0 16px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--ember);
  border-radius: 14px; padding: 16px; margin: 0 0 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.card.plain { border-top-color: var(--line); }
.kicker { font: 500 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ember); margin: 0 0 6px; }

.tog {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left; background: rgba(241,235,221,.04);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0 0 8px;
  min-height: 52px;
}
.tog.on { border-color: var(--ember); background: rgba(238,90,36,.12); }
.tog .box {
  width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--muted); flex: none;
  display: grid; place-items: center;
}
.tog.on .box { background: var(--ember); border-color: var(--ember); }
.tog.on .box::after { content: ""; width: 10px; height: 6px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(0, -1px); }
.tog b { font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.chip {
  border: 1px solid var(--line); background: transparent; border-radius: 999px;
  padding: 8px 12px; font-size: 13px; font-weight: 600; min-height: 40px;
}
.chip[aria-pressed="true"] { background: var(--butter); color: var(--night); border-color: var(--butter); }
.chip.no[aria-pressed="true"] { background: #6b3a3a; color: var(--bone); border-color: #8a4a4a; }
.chip.interested[aria-pressed="true"] { background: var(--blue); color: #fff; border-color: var(--blue); }
.chip.repent[aria-pressed="true"] { background: var(--ok); color: #10200a; border-color: var(--ok); }

.stepper { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.stepper button {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(241,235,221,.06); font-size: 22px; line-height: 1;
}
.stepper input {
  width: 64px; text-align: center; background: transparent; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px; font-size: 18px; font-weight: 700;
}

label.field, .field-label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; letter-spacing: .04em; text-transform: uppercase; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number], select, textarea {
  width: 100%; background: rgba(241,235,221,.05); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 12px; min-height: 46px;
}
textarea { min-height: 80px; resize: vertical; }
details.more { margin: 10px 0; }
details.more > summary { color: var(--muted); cursor: pointer; padding: 8px 0; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+ "; color: var(--ember); font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 48px; border-radius: 12px; border: 0;
  background: var(--ember); color: #fff; font-weight: 700; font-size: 16px; margin: 8px 0;
}
.btn:disabled { opacity: .5; }
.btn.ok { background: var(--ok); color: #10200a; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--bone); }
.btn.butter { background: var(--butter); color: var(--night); }
.btn.sm { width: auto; min-height: 40px; padding: 0 14px; font-size: 14px; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat {
  background: rgba(238,90,36,.1); border: 1px solid rgba(238,90,36,.35);
  border-radius: 12px; padding: 10px 12px; text-align: left; color: inherit;
}
.stat b { display: block; font-family: var(--display); font-size: 28px; line-height: 1; }
.stat span { font-size: 12px; color: var(--muted); }
.stat:focus, .stat:hover { border-color: var(--butter); }

.bars { margin: 12px 0; }
.bar-row { display: grid; grid-template-columns: 64px 1fr 36px; gap: 8px; align-items: center; margin: 4px 0; font-size: 12px; color: var(--muted); }
.bar-row i { display: block; height: 8px; background: var(--ember); border-radius: 99px; }

.list-item {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 10px;
  padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.list-item .meta { color: var(--muted); font-size: 12px; }
.tcode {
  font-family: var(--mono); font-size: 28px; letter-spacing: .18em;
  text-align: center; padding: 10px; background: rgba(241,235,221,.05); border-radius: 12px;
}

table.gt { width: 100%; border-collapse: collapse; font-size: 13px; }
table.gt th, table.gt td { text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.gt th:first-child, table.gt td:first-child { text-align: left; }
table.gt th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #0c0b0e; border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.nav button {
  background: none; border: 0; color: var(--muted); padding: 8px 2px 6px;
  font-size: 10px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.nav button.on { color: var(--butter); }
.nav svg { width: 22px; height: 22px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + var(--safe-b));
  transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--butter); color: var(--night); padding: 10px 16px; border-radius: 999px;
  font-weight: 600; transition: .25s; z-index: 40; white-space: nowrap; max-width: 90%;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #8a3530; color: #fff; }

/* Sign-in is a full page without the tab bar */
body.gate { padding-bottom: 0; }
body.gate .nav, body.gate .app-header { display: none; }
.gate-wrap { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 32px 22px 40px; max-width: 420px; margin: 0 auto; }
.gate-wrap .logo { width: 84px; height: 90px; margin: 0 auto 16px; display: block; }
.gate-wrap h1 { font-family: var(--display); font-size: 56px; line-height: .8; text-transform: uppercase; text-align: center; margin: 0; }
.gate-wrap h1 b { display: block; color: var(--ember); font-size: 28px; letter-spacing: .12em; margin-top: 8px; }
.gate-wrap h1 b::after { content: ""; display: block; width: 48px; height: 4px; background: var(--ember); margin: 8px auto 0; }
.gate-wrap .tag { text-align: center; font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--muted); margin: 14px 0 28px; }

#map-screen { position: relative; }
#map { height: calc(100dvh - var(--nav-h) - 52px - env(safe-area-inset-top, 0px)); width: 100%; background: #1a191c; }
.map-filters {
  position: absolute; top: 8px; left: 8px; right: 8px; z-index: 500;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.map-filters select, .map-filters button, .map-legend {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: 12px; min-height: 36px; width: auto;
}
.map-legend { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--bone); }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.leaflet-container { background: #1a191c; font-family: var(--sans); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #1c1b20; color: var(--bone); }
.leaflet-popup-content { margin: 10px 12px; font-size: 13px; }

.due { color: var(--ember); font-weight: 700; }
.share-tag { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.switch input { width: 44px; height: 26px; accent-color: var(--ember); }

@media (min-width: 720px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

.install-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  margin: 0 14px 10px; padding: 8px 10px; border-radius: 10px;
  background: rgba(35, 80, 200, .16); border: 1px solid rgba(35, 80, 200, .4);
  color: var(--bone); font-size: 12px; line-height: 1.35;
}
.install-banner p { margin: 0; flex: 1 1 160px; }
.install-banner-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.install-banner-actions button {
  background: transparent; border: 1px solid rgba(241, 235, 221, .35);
  color: var(--bone); border-radius: 999px; padding: 4px 10px;
  font-size: 12px; font-weight: 600; min-height: 28px;
}
.install-banner-actions button:hover, .install-banner-actions button:focus {
  background: var(--butter); color: var(--night); border-color: var(--butter);
}
.install-steps {
  margin: 10px 0 0; padding: 0; list-style: none; counter-reset: step;
}
.install-steps li {
  position: relative;
  padding: 10px 0 10px 36px;
  border-bottom: 1px solid var(--line);
  font-size: 15px; line-height: 1.4;
}
.install-steps li:last-child { border-bottom: 0; }
.install-steps li::before {
  content: counter(step);
  counter-increment: step;
  position: absolute; left: 0; top: 10px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ember); color: #fff;
  font-size: 12px; font-weight: 700; line-height: 24px; text-align: center;
}
.ios-share { vertical-align: -3px; color: var(--butter); }

.notes-wrap { position: relative; }
.notes-wrap textarea { padding-right: 52px; }
.mic-btn {
  position: absolute; right: 8px; bottom: 8px;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(241,235,221,.1);
  color: var(--bone);
  display: grid; place-items: center; padding: 0;
}
.mic-btn svg { display: block; }
.mic-btn.listening {
  background: var(--ember); border-color: var(--ember); color: #fff;
  animation: micpulse 1.1s ease-in-out infinite;
}
@keyframes micpulse {
  50% { box-shadow: 0 0 0 6px rgba(238,90,36,.28); }
}
.mic-hint { font-size: 12px; margin: 4px 0 8px; }

#invitelink {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0;
  min-height: 44px; word-break: break-all;
}
