:root {
  --bg: #090a0c;
  --surface: #151820;
  --text: #f4f1ec;
  --muted: #9a9ba3;
  --ember: #ff4f1f;
  --signal: #c8f542;
  --line: #f4f1ec1a;
  --line-strong: #f4f1ec2e;
  --radius: 4px;
  --font-display: "Bebas Neue", sans-serif;
  --font-body: "Figtree", sans-serif;
  --nav-h: 72px;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
img { max-width: 100%; display: block; }
h1, h2, p { margin: 0; }
.container { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.container-wide { width: min(1280px, 100% - 2.5rem); margin-inline: auto; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 48px; padding: .85rem 1.35rem; border-radius: var(--radius); font-weight: 600;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--ember); color: #fff; }
.btn-ghost { border: 1px solid var(--line-strong); }
.btn-signal { background: var(--signal); color: #101208; }
.btn-danger { border: 1px solid #ff64508c; }
.site-nav {
  position: sticky; top: 0; z-index: 20; height: var(--nav-h);
  border-bottom: 1px solid var(--line); background: #090a0cc7;
  backdrop-filter: blur(18px);
}
.site-nav-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: .7rem; }
.brand-mark {
  width: 15px; height: 15px; background: var(--ember);
  clip-path: polygon(15% 0, 100% 0, 85% 100%, 0 100%);
}
.brand-text { font-family: var(--font-display); letter-spacing: .07em; font-size: 1.8rem; }
.nav-user { color: var(--muted); font-size: .9rem; margin-right: .75rem; }
.page { min-height: 100vh; background: radial-gradient(ellipse at top right, #ff4f1f14, transparent 45%), var(--bg); }
.login-panel { min-height: calc(100vh - var(--nav-h)); display: grid; place-items: center; padding: 2rem 1.25rem; }
.login-card { width: min(440px, 100%); }
.login-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; border: 1px solid var(--line); padding: .3rem; margin-bottom: 1.5rem; }
.login-tabs button { min-height: 42px; color: var(--muted); font-weight: 600; }
.login-tabs button.active { background: #ff4f1f24; color: var(--text); }
.login-card h1 { font-size: 1.7rem; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .85rem; margin-top: .35rem; }
.err { color: #ff8d72; min-height: 1.2em; }
.form-grid { display: grid; gap: 1rem; margin-top: 1.25rem; }
.field { display: flex; flex-direction: column; gap: .45rem; }
[hidden] { display: none !important; }
.field label { letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-size: .82rem; font-weight: 600; }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: var(--radius); background: #00000047;
  width: 100%; min-height: 48px; padding: .75rem .9rem; outline: none;
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #ff4f1fa6; }
.field-hint { color: var(--muted); margin: 0; font-size: .88rem; font-weight: 500; text-transform: none; letter-spacing: 0; line-height: 1.4; }
.portal-main, .builder-main { padding: 2.5rem 0 4rem; }
.portal-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1.25rem; margin-bottom: 2rem; }
.portal-header h1, .builder-top h1 {
  font-family: var(--font-display); letter-spacing: .03em; font-size: clamp(2.4rem, 5vw, 3.6rem); line-height: .95;
}
.eyebrow { letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-size: .78rem; font-weight: 600; }
.portal-empty { border: 1px dashed var(--line-strong); padding: clamp(2rem, 5vw, 3rem); background: #ffffff04; }
.config-table { border: 1px solid var(--line); }
.config-row, .config-head {
  display: grid; gap: .75rem; padding: 1rem 1.1rem; align-items: center;
}
.config-head { display: none; background: var(--surface); color: var(--muted); letter-spacing: .1em; text-transform: uppercase; font-size: .75rem; border-bottom: 1px solid var(--line); }
.config-row { border-bottom: 1px solid var(--line); background: #00000026; }
.config-row:last-child { border-bottom: none; }
.config-row .muted { font-size: .9rem; margin-top: .2rem; display: block; }
.config-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.table-btn { min-height: 38px; padding: .45rem .8rem; font-size: .9rem; }
@media (width >= 900px) {
  .config-head, .config-row { grid-template-columns: 1.6fr 1.1fr 1fr .9fr 1.1fr; display: grid; }
}
.builder-back { color: var(--muted); }
.builder-back:hover { color: var(--ember); }
.builder-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; list-style: none; margin: 2rem 0 0; padding: 0; }
.builder-steps button {
  width: 100%; min-height: 44px; border: 1px solid var(--line); color: var(--muted);
  display: flex; align-items: center; gap: .45rem; padding: .45rem .55rem; font-size: .82rem; font-weight: 600; text-align: left;
}
.builder-steps span { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; background: #ffffff0f; font-size: .75rem; }
.builder-steps .active button { color: var(--text); background: #ff4f1f24; border-color: #ff4f1f8c; }
.builder-steps .done button { color: var(--text); border-color: #c8f5424d; }
.builder-form { margin-top: 1.5rem; }
.count-grid { display: grid; gap: 1rem; margin-top: 1.25rem; }
.builder-panel { border: 1px solid var(--line); background: #1518208c; padding: clamp(1.25rem, 3vw, 1.75rem); }
.builder-panel h2 { margin-bottom: 1.15rem; font-size: 1.3rem; }
.builder-panel .subhead { margin: 1.5rem 0 .55rem; font-size: 1.05rem; }
.stream-grid { margin-top: .75rem; }
.choice-compact { padding: .8rem .9rem; }
.grid-2 { display: grid; gap: 1rem; }
.choice-grid { display: grid; gap: .75rem; }
.choice { display: grid; gap: .25rem; border: 1px solid var(--line); padding: 1rem; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice.selected, .choice:hover { background: #ff4f1f24; border-color: #ff4f1f8c; }
.choice span { color: var(--muted); font-size: .92rem; }
.hold-logo-field { margin-top: 1.15rem; }
.hold-logo-preview, .hold-logo-review { display: flex; align-items: center; gap: .85rem; }
.hold-logo-preview img, .hold-logo-review img, .config-thumb {
  width: 160px; height: 90px; object-fit: contain; background: #000; border: 1px solid var(--line);
}
.config-thumb { width: 96px; height: 54px; }
.geofence-panel { margin-top: 1.25rem; }
.geofence-toolbar {
  display: grid; gap: 1rem; margin-bottom: 1rem;
}
.geofence-search-row { display: flex; gap: .65rem; }
.geofence-search-row input { flex: 1; }
.geofence-search-row .btn, .geofence-actions .btn { min-height: 48px; }
.geofence-actions { display: flex; flex-wrap: wrap; gap: .65rem; align-items: end; }
.geofence-map {
  height: min(52vh, 460px);
  min-height: 320px;
  border: 1px solid var(--line);
  background: #0d1118;
  z-index: 1;
}
.geofence-map .leaflet-container { background: #0d1118; font-family: var(--font-body); }
.geofence-wrap .leaflet-pane,
.geofence-map .leaflet-pane { z-index: 1; }
.geofence-map .leaflet-top,
.geofence-map .leaflet-bottom { z-index: 2; }
.geofence-map .leaflet-control-attribution {
  background: #090a0ccc; color: #9a9ba3; font-size: .7rem;
}
.fence-post {
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  border-radius: 50%;
  background: #ff4f1f !important;
  border: 2px solid #c8f542 !important;
  box-shadow: 0 0 0 1px #0008;
  cursor: grab;
}
.fence-post:active,
.leaflet-marker-dragging .fence-post { cursor: grabbing; }
.builder-actions { display: flex; justify-content: space-between; gap: .75rem; margin-top: 1.25rem; }
.review-grid { display: grid; gap: 1rem; margin: 0; }
.review-grid div { border-bottom: 1px solid var(--line); padding-bottom: .85rem; }
.review-grid dt { letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-size: .75rem; }
.review-grid dd { margin: .3rem 0 0; font-weight: 600; word-break: break-word; }
@media (width >= 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .builder-steps { grid-template-columns: repeat(6, 1fr); }
  .choice-grid { grid-template-columns: repeat(2, 1fr); }
  .stream-grid { grid-template-columns: repeat(2, 1fr); }
  .review-grid { grid-template-columns: 1fr 1fr; }
  .count-grid { grid-template-columns: repeat(3, 1fr); }
  .geofence-toolbar { grid-template-columns: 1fr auto; align-items: end; }
}
