:root {
  --app-bg: #f3f5f8;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #172033;
  --text-muted: #697386;
  --border: #e4e8ef;
  --primary: #1f2937;
  --primary-soft: #eef1f5;
  --success: #16815d;
  --warning: #b7791f;
  --danger: #c43d4f;
  --info: #2f6f9f;
  --shadow-sm: 0 4px 14px rgba(18, 30, 55, 0.06);
  --shadow-md: 0 12px 32px rgba(18, 30, 55, 0.1);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --nav-height: 76px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--app-bg);
}

body {
  min-height: 100%;
  margin: 0;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at top left, rgba(72, 102, 155, 0.08), transparent 32rem),
    var(--app-bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: #276a9a;
}

.app-header {
  position: relative;
  overflow: hidden;
  margin-bottom: 22px;
  padding:
    calc(20px + env(safe-area-inset-top))
    20px
    26px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent 42%),
    linear-gradient(135deg, #182235, #283750);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.app-header::after {
  position: absolute;
  right: -55px;
  bottom: -80px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  content: "";
}

.app-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 13px;
}

.app-brand-icon {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 25px;
  backdrop-filter: blur(10px);
}

.app-brand h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.app-greeting {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.92rem;
}

main.container {
  max-width: 760px;
  padding-right: 16px;
  padding-left: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 2px 14px;
  font-size: 1.08rem;
  font-weight: 760;
  letter-spacing: -0.015em;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card.shadow-sm {
  box-shadow: var(--shadow-sm) !important;
}

.card-body {
  padding: 18px;
}

.card.border-dark {
  border-color: #43516b !important;
  box-shadow: 0 10px 30px rgba(38, 53, 82, 0.14);
}

.card h2,
.card h5 {
  color: var(--text);
  font-weight: 750;
  letter-spacing: -0.02em;
}

.text-muted {
  color: var(--text-muted) !important;
}

.badge {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.text-bg-success {
  background: rgba(22, 129, 93, 0.12) !important;
  color: var(--success) !important;
}

.text-bg-warning {
  background: rgba(183, 121, 31, 0.14) !important;
  color: #8a5b18 !important;
}

.text-bg-danger {
  background: rgba(196, 61, 79, 0.12) !important;
  color: var(--danger) !important;
}

.bg-light {
  background: linear-gradient(145deg, #f6f8fb, #eef2f7) !important;
}

.bg-success {
  background: linear-gradient(135deg, #167b59, #209873) !important;
}

.bg-warning {
  background: linear-gradient(135deg, #f4c96b, #e7ad3c) !important;
  color: #4a3210 !important;
}

.bg-danger {
  background: linear-gradient(135deg, #bc3549, #da5667) !important;
}

.display-6 {
  letter-spacing: -0.05em;
}

.list-group {
  --bs-list-group-border-color: var(--border);
}

.list-group-item {
  background: transparent;
  color: var(--text);
  font-size: 0.93rem;
}

.list-group-item strong {
  font-weight: 700;
}

.btn {
  min-height: 46px;
  border-radius: 13px;
  font-weight: 700;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.btn:active {
  transform: scale(0.985);
}

.btn-dark {
  border-color: #1f2937;
  background: linear-gradient(135deg, #1f2937, #344158);
  box-shadow: 0 8px 18px rgba(31, 41, 55, 0.15);
}

.btn-primary {
  border-color: #345b9d;
  background: linear-gradient(135deg, #31558d, #4173b8);
}

.btn-success {
  border-color: #167b59;
  background: linear-gradient(135deg, #167b59, #23966f);
}

.btn-outline-dark,
.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-warning,
.btn-outline-danger,
.btn-outline-success {
  border-width: 1.5px;
}

.form-label {
  margin-bottom: 7px;
  color: #4c5870;
  font-size: 0.82rem;
  font-weight: 700;
}

.form-control,
.form-select {
  min-height: 46px;
  border: 1px solid #dce2eb;
  border-radius: 12px;
  background: #fbfcfe;
  color: var(--text);
  box-shadow: none;
}

.form-control:focus,
.form-select:focus {
  border-color: #8da7ce;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(67, 108, 166, 0.11);
}

.form-check-input {
  width: 2.35em !important;
  height: 1.25em;
  cursor: pointer;
}

.form-check-input:checked {
  border-color: #2d6d55;
  background-color: #2d6d55;
}

.alert {
  border: 0;
  border-radius: var(--radius-sm);
}

.alert-secondary {
  background: #eef1f5;
  color: #5d687a;
}

.alert-info {
  background: #eaf4fa;
  color: #245c7f;
}

.alert-success {
  background: #e8f5ef;
  color: #146344;
}

.alert-warning {
  background: #fff5dd;
  color: #76521a;
}

.alert-danger {
  background: #fdebed;
  color: #913044;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
}

.bottom-nav {
  position: fixed;
  z-index: 1000;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding:
    8px
    max(4px, env(safe-area-inset-right))
    env(safe-area-inset-bottom)
    max(4px, env(safe-area-inset-left));
  overflow-x: auto;
  border-top: 1px solid rgba(214, 220, 229, 0.9);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 -8px 24px rgba(20, 31, 52, 0.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.bottom-nav button {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 5px 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #778196;
  font-size: 0.66rem;
  font-weight: 650;
  line-height: 1;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.bottom-nav button i {
  display: block;
  font-size: 1.15rem;
}

.bottom-nav button.active {
  background: #edf1f7;
  color: #24344e;
  font-weight: 750;
}

.bottom-nav button:active {
  transform: scale(0.94);
}

#dashboard .card:first-child {
  animation: card-in 0.25s ease-out;
}

@keyframes card-in {
  from {
    transform: translateY(5px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (min-width: 768px) {
  body {
    padding-bottom: 28px;
  }

  .app-header {
    max-width: 760px;
    margin: 18px auto 24px;
    border-radius: var(--radius-lg);
  }

  .bottom-nav {
    right: 50%;
    bottom: 18px;
    left: auto;
    width: min(720px, calc(100% - 32px));
    height: 72px;
    transform: translateX(50%);
    border: 1px solid var(--border);
    border-radius: 20px;
  }

  main.container {
    padding-bottom: 95px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --app-bg: #10141c;
    --surface: #181e28;
    --surface-muted: #202734;
    --text: #edf1f7;
    --text-muted: #9da8ba;
    --border: #2a3342;
    --primary-soft: #242c38;
    --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 16px 34px rgba(0, 0, 0, 0.28);
  }

  body {
    background:
      radial-gradient(circle at top left, rgba(75, 101, 153, 0.13), transparent 30rem),
      var(--app-bg);
  }

  .card,
  .bottom-nav {
    background: rgba(24, 30, 40, 0.96);
  }

  .bottom-nav {
    border-top-color: var(--border);
  }

  .bottom-nav button.active {
    background: #252e3c;
    color: #fff;
  }

  .form-control,
  .form-select {
    border-color: #354052;
    background: #202733;
    color: #edf1f7;
  }

  .form-control:focus,
  .form-select:focus {
    background: #252d3a;
  }

  .list-group-item {
    color: var(--text);
  }

  .bg-light {
    background: linear-gradient(145deg, #242b37, #1e2530) !important;
    color: var(--text);
  }

  .alert-secondary {
    background: #252d39;
    color: #bac3d1;
  }

  pre.bg-light {
    background: #11161e !important;
    color: #c8d1df;
  }
}

.hero-commute {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border-radius: 26px;
  color: #fff;
  box-shadow: 0 20px 45px rgba(27, 38, 62, 0.22);
}

.hero-commute::before {
  position: absolute;
  top: -80px;
  right: -55px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  content: "";
}

.hero-commute::after {
  position: absolute;
  bottom: -110px;
  left: -70px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  content: "";
}

.hero-normal {
  background:
    linear-gradient(145deg, #166b55, #238c6d);
}

.hero-busy {
  background:
    linear-gradient(145deg, #9b651b, #d19737);
}

.hero-heavy {
  background:
    linear-gradient(145deg, #9e3043, #cf5263);
}

.hero-top,
.hero-countdown,
.hero-stats,
.hero-meta,
.hero-alternative,
.hero-actions,
.hero-empty,
.hero-checking {
  position: relative;
  z-index: 1;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.hero-eyebrow {
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hero-top h2 {
  margin: 0;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 780;
  letter-spacing: -0.035em;
}

.hero-route-label {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.86rem;
}

.hero-route-label i {
  margin: 0 5px;
  font-size: 0.72rem;
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}

.hero-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
}

.hero-countdown {
  padding: 34px 0 30px;
  text-align: center;
}

.hero-countdown-label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero-countdown-value {
  margin: 3px 0;
  font-size: clamp(3rem, 13vw, 4.8rem);
  font-weight: 820;
  line-height: 1;
  letter-spacing: -0.065em;
}

.hero-departure-time {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
}

.hero-departure-time strong {
  margin-left: 4px;
  color: #fff;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.hero-stat {
  padding: 14px 8px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.09);
  text-align: center;
  backdrop-filter: blur(8px);
}

.hero-stat-icon {
  margin-bottom: 5px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.9rem;
}

.hero-stat-label {
  color: rgba(255, 255, 255, 0.67);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.hero-stat-value {
  margin-top: 2px;
  font-size: 1.18rem;
  font-weight: 780;
}

.hero-stat-value small {
  font-size: 0.66rem;
  font-weight: 650;
  opacity: 0.7;
}

.hero-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.76rem;
}

.hero-alternative {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding: 13px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.78rem;
}

.hero-alternative strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.84rem;
}

.hero-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.hero-actions .btn {
  border-radius: 13px;
}

.hero-actions .btn-light {
  color: #25334a;
}

.hero-actions .btn-outline-light:hover,
.hero-actions .btn-outline-light:focus {
  color: #25334a;
}

.hero-checking {
  min-height: 18px;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.76rem;
  text-align: center;
}

.hero-empty {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 28px 0 18px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
}

.hero-empty i {
  font-size: 1.7rem;
}

.hero-empty p {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.82rem;
}

@media (max-width: 390px) {
  .hero-commute {
    padding: 18px;
  }

  .hero-stats {
    gap: 7px;
  }

  .hero-stat {
    padding: 12px 5px;
  }

  .hero-meta {
    flex-direction: column;
    gap: 5px;
  }
}

.hero-commute {
  transition:
    background 0.45s ease,
    box-shadow 0.45s ease,
    transform 0.25s ease;
}

.hero-plenty {
  background:
    linear-gradient(145deg, #166b55, #238c6d);
}

.hero-soon {
  background:
    linear-gradient(145deg, #9b651b, #d19737);
  box-shadow:
    0 20px 45px rgba(162, 105, 27, 0.28);
}

.hero-urgent {
  background:
    linear-gradient(145deg, #9e3043, #cf5263);
  box-shadow:
    0 20px 45px rgba(158, 48, 67, 0.3);
}

.hero-complete {
  background:
    linear-gradient(145deg, #3d485a, #566275);
  box-shadow:
    0 18px 38px rgba(40, 48, 62, 0.2);
}

.hero-countdown-value {
  font-variant-numeric: tabular-nums;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

.hero-urgent .hero-countdown-value {
  animation: urgent-pulse 1.8s ease-in-out infinite;
}

@keyframes urgent-pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.025);
  }
}

.hero-meta [id^="heroUpdated_"]::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #8ff0c2;
  box-shadow: 0 0 0 4px rgba(143, 240, 194, 0.12);
  content: "";
}