:root {
  color-scheme: dark light;
  --bg: #0f1117;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-elevated: rgba(10, 15, 30, 0.6);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f5f7ff;
  --text-muted: rgba(245, 247, 255, 0.64);
  --accent: #6dd5ff;
  --accent-strong: #3a8dff;
  --danger: #ff6b6b;
  --success: #2ecc71;
  font-family: "Inter", "SF Pro Text", "Roboto", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at top, rgba(61, 90, 254, 0.2), rgba(15, 17, 23, 0.9)), var(--bg);
  color: var(--text);
}

body {
  display: flex;
  justify-content: center;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.app-shell {
  width: min(100%, 420px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
  position: relative;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.5rem;
}

.status-banner {
  margin: 0 1.25rem 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(109, 213, 255, 0.4);
  background: rgba(109, 213, 255, 0.12);
  color: var(--accent);
  font-size: 0.85rem;
  line-height: 1.35;
  backdrop-filter: blur(10px);
}

.status-banner.success {
  background: rgba(76, 175, 80, 0.18);
  border-color: rgba(76, 175, 80, 0.35);
  color: #d6ffe0;
}

.status-banner.error {
  background: rgba(255, 107, 107, 0.18);
  border-color: rgba(255, 107, 107, 0.4);
  color: #ffe5e5;
}

.status-banner[hidden] {
  display: none;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.brand-mark {
  font-size: 1.75rem;
}

.brand h1 {
  font-size: 1.3rem;
  letter-spacing: 0.02em;
  margin: 0;
}

.tagline {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.icon-button {
  border: none;
  background: transparent;
  color: inherit;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  transition: background 150ms ease;
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.icon-button:focus-visible,
.icon-button:hover {
  background: rgba(109, 213, 255, 0.1);
  outline: none;
}

.content {
  padding: 0 1.25rem 4.5rem;
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 32px rgba(8, 12, 24, 0.35);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card-header h2 {
  font-size: 1.05rem;
  margin: 0;
}

.card select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: inherit;
  font-size: 0.9rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

.summary-total {
  font-size: 1.5rem;
  margin: 0 0 1rem;
}

.summary-total span {
  font-weight: 700;
  color: var(--accent);
}

.summary-progress {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.summary-progress-bar {
  position: absolute;
  inset: 0;
  width: calc(var(--pct, 0) * 1%);
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  animation: grow 1.4s ease forwards;
}

.summary-progress-cap {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

.summary-progress-cap strong {
  color: var(--text);
}

.summary-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 0;
}

.summary-breakdown dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.summary-breakdown dd {
  margin: 0;
  font-size: 0.95rem;
}

.trip-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.trip-item {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(12, 16, 24, 0.55);
  display: grid;
  gap: 0.6rem;
}

.trip-item.muted {
  background: rgba(255, 255, 255, 0.02);
  border-style: dashed;
  text-align: center;
  color: var(--text-muted);
}

.trip-route {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.trip-route svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}

.trip-dates {
  margin: 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.trip-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.primary,
.secondary,
.text-button,
.tab {
  font: inherit;
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  border: none;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  color: #05070d;
  font-weight: 600;
}

.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.text-button {
  background: transparent;
  color: var(--accent);
  padding: 0.3rem 0.4rem;
}

.primary:active,
.secondary:active,
.tab:active {
  transform: scale(0.98);
}

.primary:focus-visible,
.secondary:focus-visible,
.tab:focus-visible,
.text-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tab-bar {
  position: sticky;
  bottom: 0;
  width: 100%;
  background: rgba(8, 11, 20, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 0.4rem 0.5rem calc(0.4rem + env(safe-area-inset-bottom));
  gap: 0.4rem;
  backdrop-filter: blur(16px);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 0.35rem 0.25rem;
}

.tab svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  opacity: 0.9;
}

.tab.active {
  color: var(--accent);
}

.trip-empty {
  padding: 0.5rem 0;
  font-size: 0.85rem;
}

@media (min-width: 480px) {
  body {
    background: radial-gradient(circle at top, rgba(61, 90, 254, 0.18), rgba(15, 17, 23, 0.94));
  }

  .app-shell {
    border-radius: 26px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin: 1.5rem 0;
  }

  .app-header {
    padding-top: 1.4rem;
  }

  .content {
    padding-bottom: 5rem;
  }
}

@keyframes grow {
  from {
    width: 0;
  }
  to {
    width: calc(var(--pct, 0) * 1%);
  }
}

@supports (height: 100svh) {
  .app-shell {
    min-height: 100svh;
  }
}

dialog {
  border: none;
  border-radius: 24px 24px 0 0;
  margin: 0;
  max-width: min(100%, 420px);
  width: 100%;
  padding: 0;
  background: rgba(8, 11, 20, 0.92);
  color: inherit;
  inset: auto 0 0;
}

dialog::backdrop {
  background: rgba(1, 4, 12, 0.65);
  backdrop-filter: blur(6px);
}

.sheet {
  display: grid;
  gap: 1rem;
  padding: 1.25rem 1.5rem calc(1.25rem + env(safe-area-inset-bottom));
}

.sheet header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.field input,
.field select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
}

.field input::placeholder {
  color: rgba(245, 247, 255, 0.4);
}

menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0;
}

menu button {
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
