:root {
  --bg: #0f172a;
  --panel: #111c33;
  --card: #17233d;
  --soft: #20304f;
  --ink: #f8fafc;
  --muted: #a8b3c7;
  --line: rgba(226, 232, 240, .12);
  --accent: #38bdf8;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 24px;
  --shadow: 0 30px 80px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top right, rgba(56,189,248,.2), transparent 32rem), var(--bg);
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem clamp(1rem, 4vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(15,23,42,.85);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.eyebrow { margin: 0 0 .35rem; color: var(--accent); text-transform: uppercase; letter-spacing: .14em; font-size: .74rem; font-weight: 950; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.6rem, 4vw, 3rem); line-height: 1; letter-spacing: -.05em; }
h2 { margin-bottom: 1rem; font-size: 1.25rem; }
.sync-button, .primary, .button-grid button, .filter-row button {
  border: 0;
  border-radius: 16px;
  min-height: 48px;
  padding: .8rem 1rem;
  cursor: pointer;
  font-weight: 950;
}
.sync-button, .primary { background: var(--accent); color: #082f49; }
.layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
}
.control-panel, .workspace { display: grid; gap: 1rem; align-content: start; }
.panel-card, .map-card, .table-card, .stats-grid article {
  background: rgba(23, 35, 61, .92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-card { padding: 1rem; }
.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.button-grid button { background: var(--soft); color: var(--ink); border: 1px solid var(--line); }
.button-grid button:hover { outline: 2px solid rgba(56, 189, 248, .45); }
.note-form { display: grid; gap: .8rem; }
label { display: grid; gap: .35rem; color: var(--muted); font-weight: 850; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0b1222;
  color: var(--ink);
  padding: .8rem .9rem;
}
textarea { min-height: 90px; resize: vertical; }
.gps-row { display: flex; align-items: center; gap: .6rem; }
.pulse { width: 14px; height: 14px; border-radius: 999px; background: var(--good); box-shadow: 0 0 0 0 rgba(34,197,94,.8); animation: pulse 1.5s infinite; }
.gps-card p { color: var(--muted); margin-bottom: 0; }
@keyframes pulse { 70% { box-shadow: 0 0 0 12px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.stats-grid article { padding: 1rem; }
.stats-grid span { color: var(--muted); font-weight: 850; }
.stats-grid strong { display: block; font-size: 2.2rem; line-height: 1; margin-top: .35rem; }
.map-card, .table-card { padding: 1rem; }
.map-toolbar, .table-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.filter-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.filter-row button { min-height: 40px; background: var(--soft); color: var(--muted); }
.filter-row .active { background: var(--accent); color: #082f49; }
/* ── Leaflet map ── */
#map {
  height: 470px;
  border-radius: 18px;
  border: 1px solid var(--line);
  z-index: 1;
}
/* Leaflet popup dark theme */
.leaflet-popup-content-wrapper {
  background: #17233d;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0,0,0,.4);
}
.leaflet-popup-tip { background: #17233d; }
.leaflet-popup-content { margin: .75rem 1rem; font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
.leaflet-popup-content strong { color: var(--accent); display: block; margin-bottom: .25rem; }
.leaflet-popup-content small { color: var(--muted); }
/* Custom marker icons */
.map-pin {
  width: 34px; height: 34px;
  border-radius: 12px 12px 12px 3px;
  transform: rotate(-45deg);
  border: 2.5px solid rgba(255,255,255,.8);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,.45);
  font-weight: 900; font-size: .85rem; color: white;
}
.map-pin span { transform: rotate(45deg); display: block; }
.map-pin.stop         { background: var(--bad); }
.map-pin.signal       { background: var(--warn); color: #08111f; }
.map-pin.construction { background: #f97316; }
.map-pin.school       { background: #a855f7; }
.map-pin.delivery     { background: var(--accent); color: #082f49; }
.map-pin.bad-addr     { background: #64748b; }
/* Quick-add pending state */
.quick-hint { color: var(--muted); font-size: .82rem; margin: 0 0 .6rem; }
.pending-hint {
  margin: .6rem 0 0;
  padding: .5rem .75rem;
  border-radius: 10px;
  background: rgba(56,189,248,.12);
  color: var(--accent);
  font-size: .82rem;
  font-weight: 850;
  display: none;
}
.pending-hint.active { display: block; }
.button-grid button.pending { outline: 2px solid var(--accent); background: rgba(56,189,248,.15); }
.table-wrap { overflow-x: auto; border-radius: 18px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { text-align: left; padding: .95rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }
td { color: #e5eefb; }
.tag { display: inline-flex; border-radius: 999px; padding: .35rem .6rem; font-size: .8rem; font-weight: 950; color: #08111f; }
.tag.good { background: var(--good); }
.tag.warn { background: var(--warn); }
.tag.bad { background: var(--bad); color: white; }

/* ── Desktop-only notice for mobile ── */
.mobile-notice { display: none; }

@media (max-width: 960px) {
  /* Hide the whole dashboard on mobile */
  .layout { display: none; }

  /* Show the mobile notice instead */
  .mobile-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem 2rem;
    gap: 1rem;
  }
  .mobile-notice-icon {
    font-size: 3rem;
    line-height: 1;
  }
  .mobile-notice h2 {
    font-size: 1.6rem;
    letter-spacing: -.04em;
    margin: 0;
  }
  .mobile-notice p {
    color: var(--muted);
    max-width: 320px;
    margin: 0;
    font-size: .95rem;
    line-height: 1.6;
  }
  .mobile-notice .notice-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: rgba(56,189,248,.12);
    border: 1px solid rgba(56,189,248,.25);
    color: var(--accent);
    font-size: .82rem;
    font-weight: 850;
    padding: .4rem .85rem;
    border-radius: 999px;
  }

  /* Pitch section still shows on mobile */
  .pitch-inner { grid-template-columns: 1fr; }
  .pitch-section { padding: .75rem .75rem 2rem; }
}

.header-right { display:flex; align-items:center; gap:.75rem; }
.home-link { display:inline-flex; align-items:center; padding:.45rem .85rem; border-radius:999px; border:1px solid var(--line); font-size:.82rem; font-weight:850; color:var(--muted); white-space:nowrap; }
.home-link:hover { color:var(--ink); }

/* ── Pitch section ── */
.pitch-section {
  padding: 1rem 1rem 2rem;
}
.pitch-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  background: rgba(23,35,61,.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.5rem, 3vw, 2.5rem);
}
.pitch-copy h2 {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  line-height: 1.1;
  letter-spacing: -.04em;
  margin-bottom: 1rem;
}
.pitch-copy p {
  color: var(--muted);
  font-size: .95rem;
  margin-bottom: .75rem;
}
.pitch-who {
  color: var(--accent) !important;
  font-weight: 850;
  font-size: .88rem !important;
  border-left: 3px solid var(--accent);
  padding-left: .75rem;
  margin-top: 1rem;
}
.pitch-list {
  display: grid;
  gap: .75rem;
  align-content: start;
}
.pitch-list div {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: .9rem 1rem;
}
.pitch-list strong {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--accent);
  color: #082f49;
  font-weight: 950;
  font-size: .85rem;
}
.pitch-list span {
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.5;
}

@media (max-width: 960px) {
  .pitch-inner { grid-template-columns: 1fr; }
}
