:root {
  color-scheme: dark;
  --bg: #07111d;
  --bg-soft: #0d1b2b;
  --panel: rgba(18, 31, 48, 0.9);
  --panel-strong: rgba(24, 40, 61, 0.96);
  --panel-muted: rgba(33, 54, 80, 0.72);
  --stroke: rgba(182, 206, 232, 0.12);
  --stroke-strong: rgba(182, 206, 232, 0.2);
  --ink: #f6f8fb;
  --muted: #b5c4d4;
  --primary: #146eb4;
  --primary-deep: #0d4f85;
  --accent: #ff9900;
  --accent-soft: rgba(255, 153, 0, 0.16);
  --ok: #2fb26f;
  --danger: #ff6b6b;
  --shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  font-family: "Segoe UI", "SF Pro Display", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(20, 110, 180, 0.22), transparent 28%),
    radial-gradient(circle at bottom right, rgba(255, 153, 0, 0.16), transparent 24%),
    linear-gradient(180deg, #07111d 0%, #0b1727 45%, #08111b 100%);
}

.app-shell {
  width: min(1280px, calc(100% - 24px));
  margin: 0 auto;
  padding: 20px 0 44px;
}

.dashboard-grid,
.field-grid,
.field-stack,
.stop-list,
.alt-results,
.summary-grid {
  display: grid;
}

.dashboard-grid {
  gap: 24px;
  grid-template-areas:
    "block"
    "start"
    "home"
    "stops"
    "publish";
}

.section--block {
  grid-area: block;
}

.section--start {
  grid-area: start;
}

.section--home {
  grid-area: home;
}

.section--stops {
  grid-area: stops;
}

.section--publish {
  grid-area: publish;
}

.glass {
  backdrop-filter: blur(18px);
  background: linear-gradient(180deg, rgba(20, 32, 49, 0.92), rgba(13, 24, 38, 0.94));
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}

.hero,
.section {
  border-radius: var(--radius-xl);
  padding: 22px;
}

.hero {
  display: grid;
  gap: 18px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -60px -60px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 153, 0, 0.18), transparent 70%);
  pointer-events: none;
}

.hero-copy,
.hero-actions {
  position: relative;
  z-index: 1;
}

.hero-actions {
  display: grid;
  gap: 10px;
  align-content: start;
}

.hero-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.hero h1,
.section h2 {
  margin: 0;
}

.hero h1 {
  font-size: clamp(30px, 6vw, 48px);
  letter-spacing: -0.04em;
}

.section h2 {
  font-size: clamp(22px, 3vw, 28px);
  letter-spacing: -0.03em;
}

.subtitle,
.hint,
.status-message,
.field span,
.eyebrow {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.subtitle,
.hint,
.status-message {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.55;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
}

.field-grid {
  grid-template-columns: 1fr;
  gap: 18px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 8px;
}

.field-stack {
  gap: 18px;
}

.field span {
  font-size: 13px;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: stretch;
}

input {
  width: 100%;
  min-height: 56px;
  border: 1px solid rgba(182, 206, 232, 0.14);
  border-radius: 18px;
  padding: 15px 16px;
  font-size: 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

input::placeholder {
  color: rgba(181, 196, 212, 0.72);
}

input:focus {
  outline: 2px solid rgba(20, 110, 180, 0.22);
  border-color: rgba(20, 110, 180, 0.5);
  background: rgba(255, 255, 255, 0.08);
}

button {
  appearance: none;
  border: none;
  border-radius: 18px;
  padding: 15px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.primary-button {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: white;
  box-shadow: 0 12px 30px rgba(20, 110, 180, 0.22);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  border: 1px solid rgba(182, 206, 232, 0.14);
}

.ghost-button--small {
  padding-inline: 14px;
  min-width: 126px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.city-scope-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.city-preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.city-preset {
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid rgba(182, 206, 232, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: #d8e8f8;
  font-size: 13px;
  font-weight: 700;
}

.city-preset.is-active {
  background: rgba(20, 110, 180, 0.22);
  border-color: rgba(126, 191, 242, 0.45);
  color: #9fd8ff;
}

.city-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid rgba(182, 206, 232, 0.16);
  background: rgba(20, 110, 180, 0.12);
  color: #b6dbff;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.city-chip button {
  border: none;
  background: transparent;
  color: #f2f7ff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  padding: 0;
  min-width: 16px;
  cursor: pointer;
}

.city-chip--empty {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
}

.actions-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
}

.actions-inline > * {
  min-width: 132px;
}

#ocrStatus {
  margin-top: -4px;
}

.section--publish .primary-button {
  width: 100%;
  min-height: 60px;
  font-size: 16px;
}

.section--publish {
  position: static !important;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  border: 1px solid rgba(182, 206, 232, 0.14);
}

.summary-grid {
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(182, 206, 232, 0.12);
}

.summary-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.summary-value {
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.stop-composer {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(182, 206, 232, 0.1);
}

.stop-list {
  gap: 18px;
}

.stop-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(182, 206, 232, 0.12);
}

.stop-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.stop-main {
  flex: 1;
  display: grid;
  gap: 10px;
}

.stop-label {
  font-size: 16px;
  font-weight: 800;
}

.stop-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(20, 110, 180, 0.18);
  color: #8dd0ff;
  font-weight: 800;
}

.stop-address {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

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

.mini-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(20, 110, 180, 0.14);
  color: #9fd1ff;
  font-size: 12px;
  font-weight: 700;
}

.link-button {
  color: var(--danger);
  background: transparent;
  padding: 2px 0;
  font-size: 14px;
  font-weight: 700;
}

.alt-results {
  gap: 10px;
}

.alt-result {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  border-radius: 20px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(182, 206, 232, 0.12);
}

.alt-result strong {
  font-size: 14px;
  color: var(--ink);
}

.alt-result span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.empty-card {
  color: var(--muted);
}

.status-message {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(182, 206, 232, 0.12);
}

.pac-container {
  z-index: 9999 !important;
  border-radius: 18px;
  border: 1px solid rgba(182, 206, 232, 0.16);
  overflow: hidden;
}

@media (min-width: 720px) {
  .app-shell {
    width: min(1280px, calc(100% - 32px));
    padding-top: 24px;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 24px 26px;
  }

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

  .section--start,
  .section--home {
    min-height: 100%;
  }
}

@media (min-width: 860px) {
  .dashboard-grid {
    gap: 24px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "block block"
      "start home"
      "stops stops"
      "publish publish";
  }

  .summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1120px) {
  .dashboard-grid {
    grid-template-columns: 430px minmax(0, 1fr);
    grid-template-areas:
      "block stops"
      "start stops"
      "home stops"
      "publish stops";
    align-items: start;
  }
}

@media (max-width: 719px) {
  .app-shell {
    width: min(100%, calc(100% - 18px));
    padding-top: 14px;
    padding-bottom: 30px;
  }

  .hero,
  .section {
    border-radius: 26px;
    padding: 20px;
  }

  .hero {
    gap: 14px;
    margin-bottom: 18px;
  }

  .hero h1 {
    font-size: clamp(28px, 8vw, 38px);
  }

  .hero-note {
    font-size: 12px;
  }

  .dashboard-grid {
    gap: 18px;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .summary-card,
  .stop-card,
  .stop-composer {
    border-radius: 22px;
  }

  .actions,
  .actions-inline {
    flex-direction: column;
  }

  .actions > *,
  .actions-inline > * {
    width: 100%;
    min-width: 0;
  }

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

  .field-grid,
  .field-stack,
  .stop-list,
  .alt-results {
    gap: 16px;
  }

  .section--publish {
    margin-top: 4px;
  }

  .section--publish .field-stack {
    gap: 14px;
  }

  .ghost-button--small {
    width: 100%;
    min-width: 0;
  }
}
