:root {
  --bg: #fff3e5;
  --panel: #ffffff;
  --panel-soft: #fff7ef;
  --line: #ffcfad;
  --text: #132f57;
  --muted: #5d6f84;
  --orange: #ff6600;
  --orange-strong: #e65a00;
  --orange-soft: #ffe3ce;
  --yellow: #ffd200;
  --navy: #14365f;
  --navy-soft: #e7f0fb;
  --danger: #9f3f17;
  --shadow: 0 10px 24px rgba(20, 54, 95, 0.12);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top right, #ffe9d6 0%, var(--bg) 58%);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", Arial, sans-serif;
}
button, input, textarea { font: inherit; }

.route-app {
  min-height: 100vh;
  max-width: 820px;
  margin: 0 auto;
  padding: 10px 10px 96px;
}

.app-header {
  background: linear-gradient(135deg, #ff7a1e 0%, var(--orange) 58%, #ff9542 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.34);
}

.postnl-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--navy);
  font-size: 13px;
  font-weight: 900;
  text-transform: lowercase;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.route-name {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px;
  background: #fff;
  color: var(--navy);
  font-size: 16px;
  font-weight: 800;
}

.ghost-btn {
  border: 1px solid rgba(255, 255, 255, 0.44);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 800;
}

.route-stats {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 700;
}

.screen-wrap { margin-top: 10px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 11px;
  box-shadow: 0 8px 18px rgba(20, 54, 95, 0.08);
}

.panel h2 {
  margin: 0 0 4px;
  font-size: 19px;
  line-height: 1.1;
}

.sub {
  margin: 0 0 9px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.route-input, .search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fffdfa;
  color: var(--text);
}

.route-input {
  min-height: 168px;
  resize: vertical;
  padding: 10px;
  line-height: 1.42;
}

.search-input {
  padding: 10px 11px;
}

.cta-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 8px;
}

.primary-btn, .secondary-btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px;
  font-size: 14px;
  font-weight: 900;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(180deg, #ff7a1f 0%, var(--orange-strong) 100%);
  box-shadow: 0 7px 14px rgba(230, 90, 0, 0.25);
}

.secondary-btn {
  color: var(--navy);
  background: #fff;
  border: 1px solid #ffb57e;
}

.small-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  background: var(--panel-soft);
  border: 1px solid #ffd7bd;
  border-radius: var(--radius-sm);
  padding: 5px;
}

.mode-switch button {
  border: 1px solid #ffcfaa;
  background: #fff;
  color: var(--navy);
  border-radius: 9px;
  padding: 9px 8px;
  font-size: 12px;
  font-weight: 800;
}

.mode-switch button.is-active {
  background: linear-gradient(180deg, #ff7a20 0%, var(--orange-strong) 100%);
  border-color: #ff7a20;
  color: #fff;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.chip-row button {
  border: 1px solid #ffb37c;
  background: #ffe4d1;
  color: #723100;
  border-radius: 999px;
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 900;
}

.chip-row button.is-active {
  background: linear-gradient(180deg, #ff7a20 0%, var(--orange-strong) 100%);
  border-color: #ff7a20;
  color: #fff;
  box-shadow: 0 5px 10px rgba(230, 90, 0, 0.2);
}

.chip-row button:disabled { opacity: 0.45; }

.group-summary {
  margin: 8px 0 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #173862;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.group-summary-sub {
  margin: 0 0 8px;
  padding: 0 2px 0 10px;
  border-left: 3px solid #ff9b5b;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.street-grid {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.street-grid--scan {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.street-btn {
  width: 100%;
  text-align: left;
  border: 1px solid #ffbe91;
  border-radius: 11px;
  background: linear-gradient(180deg, #fffefc 0%, #fff3e8 100%);
  padding: 8px 9px;
  color: var(--text);
  box-shadow: 0 2px 0 rgba(255, 179, 124, 0.22);
}

.street-btn.is-multi {
  background: linear-gradient(180deg, #fff1e3 0%, #ffd9ba 100%);
  border-color: #ff933f;
  border-left: 6px solid var(--orange-strong);
  box-shadow: 0 5px 12px rgba(255, 102, 0, 0.16);
}

.street-btn.is-selected {
  border-color: var(--navy);
  background: linear-gradient(180deg, #eef5ff 0%, #dceaff 100%);
  box-shadow: inset 0 0 0 1px var(--navy), 0 7px 14px rgba(20, 54, 95, 0.18);
}

.street-btn.is-compact {
  min-height: 54px;
}

.street-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.street-top strong {
  font-size: 13px;
  color: var(--navy);
  font-weight: 900;
  line-height: 1.2;
}

.street-top em {
  font-size: 11px;
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.street-numbers {
  margin-top: 5px;
  color: #25496c;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.street-tags {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.street-tags span {
  border-radius: 999px;
  padding: 3px 7px;
  background: #dfeeff;
  color: #173b63;
  font-size: 10px;
  font-weight: 800;
}

.street-tags span.warn {
  background: #ffd7bf;
  color: var(--danger);
}

.control-note {
  margin-top: 10px;
  border: 1px solid #ffd7bc;
  background: #fff8f2;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.control-note summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  color: var(--danger);
}

.control-note ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.control-note li {
  margin: 2px 0;
  font-size: 12px;
  color: #6f5441;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(820px, 100%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255,243,229,0) 0%, rgba(255,243,229,0.98) 32%);
}

.bottom-nav button {
  border: 1px solid #ffc79f;
  border-radius: 10px;
  padding: 10px 7px;
  background: #fff;
  color: #713206;
  font-size: 13px;
  font-weight: 900;
}

.bottom-nav button.is-active {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

.bottom-nav button:disabled { opacity: 0.45; }

@media (min-width: 540px) {
  .route-app {
    padding-left: 16px;
    padding-right: 16px;
  }

  .cta-row {
    grid-template-columns: 1fr 1fr;
  }

  .street-grid--scan {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
