:root {
  /* MD3 Color Tokens - Dark Mode (Standard Blue Theme) */
  --md-sys-color-primary: #aec6ff;
  /* Standard MD3 Blue 80 */
  --md-sys-color-on-primary: #002e69;
  --md-sys-color-primary-container: #14448c;
  --md-sys-color-on-primary-container: #d1e4ff;

  --md-sys-color-secondary: #82b1ff;
  /* Blue 200 - Clearly Blue */
  --md-sys-color-on-secondary: #002d6f;
  --md-sys-color-secondary-container: #00468c;
  --md-sys-color-on-secondary-container: #dbe4ff;

  --md-sys-color-tertiary: #99cbff;
  /* Lighter Blue */
  --md-sys-color-on-tertiary: #003355;
  --md-sys-color-tertiary-container: #004b73;
  --md-sys-color-on-tertiary-container: #cce5ff;

  --md-sys-color-error: #ffb4ab;
  --md-sys-color-on-error: #690005;
  --md-sys-color-error-container: #93000a;
  --md-sys-color-on-error-container: #ffdad6;

  /* Glassmorphism Backgrounds */
  --md-sys-color-background: #0b1221;
  /* Dark Night Blue */
  --md-sys-color-on-background: #e1e2e6;

  --md-sys-color-surface: rgba(15, 30, 50, 0.7);
  --md-sys-color-on-surface: #e1e2e6;
  --md-sys-color-surface-variant: rgba(50, 75, 100, 0.8);
  --md-sys-color-on-surface-variant: #c0c7cd;

  --md-sys-color-outline: #89929c;
  --md-sys-color-outline-variant: rgba(137, 146, 156, 0.3);

  /* Containers - Glassy */
  --md-sys-color-surface-container-lowest: rgba(5, 15, 30, 0.6);
  --md-sys-color-surface-container-low: rgba(10, 25, 45, 0.6);
  --md-sys-color-surface-container: rgba(15, 35, 60, 0.6);
  --md-sys-color-surface-container-high: rgba(20, 60, 100, 0.6);
  /* Bluer tint */
  --md-sys-color-surface-container-highest: rgba(30, 70, 120, 0.6);

  /* Elevation & Shape */
  --md-sys-elevation-level1: 0 4px 20px rgba(0, 0, 0, 0.4);
  --md-sys-elevation-level2: 0 8px 30px rgba(0, 0, 0, 0.5);
  --md-sys-elevation-level3: 0 12px 40px rgba(0, 0, 0, 0.6);

  --md-sys-shape-corner-xs: 4px;
  --md-sys-shape-corner-s: 8px;
  --md-sys-shape-corner-m: 12px;
  --md-sys-shape-corner-l: 16px;
  --md-sys-shape-corner-xl: 28px;
  --md-sys-shape-corner-full: 999px;

  /* Typography */
  --md-sys-typescale-display-large: 400 57px/64px 'Roboto', sans-serif;
  --md-sys-typescale-headline-medium: 400 28px/36px 'Roboto', sans-serif;
  --md-sys-typescale-title-large: 400 22px/28px 'Roboto', sans-serif;
  --md-sys-typescale-title-medium: 500 16px/24px 'Roboto', sans-serif;
  --md-sys-typescale-body-large: 400 16px/24px 'Roboto', sans-serif;
  --md-sys-typescale-body-medium: 400 14px/20px 'Roboto', sans-serif;
  --md-sys-typescale-label-large: 500 14px/20px 'Roboto', sans-serif;

  /* Legacy mapping (gradual migration) */
  --bg: var(--md-sys-color-background);
  --panel: var(--md-sys-color-surface-container);
  --text: var(--md-sys-color-on-background);
  --muted: var(--md-sys-color-on-surface-variant);
  --line: var(--md-sys-color-outline-variant);
  --accent: var(--md-sys-color-primary);
  --accent2: var(--md-sys-color-tertiary);
  --shadow: var(--md-sys-elevation-level1);
  --radius: var(--md-sys-shape-corner-l);
}

[data-theme="light"] {
  /* Light Mode - Standard Blue Theme */
  --md-sys-color-primary: #0061a4;
  /* Standard MD3 Blue 40 */
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #d1e4ff;
  --md-sys-color-on-primary-container: #001d36;

  --md-sys-color-secondary: #0277bd;
  /* Light Blue 800 */
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #d1e4ff;
  --md-sys-color-on-secondary-container: #001d36;

  --md-sys-color-tertiary: #0288d1;
  /* Light Blue 700 */
  --md-sys-color-on-tertiary: #ffffff;
  --md-sys-color-tertiary-container: #b3ebff;
  --md-sys-color-on-tertiary-container: #001f33;

  --md-sys-color-error: #ba1a1a;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #ffdad6;
  --md-sys-color-on-error-container: #410002;

  --md-sys-color-background: #fdfcff;
  --md-sys-color-on-background: #1a1c1e;

  --md-sys-color-surface: #fdfcff;
  --md-sys-color-on-surface: #1a1c1e;
  --md-sys-color-surface-variant: #e0e2ec;
  --md-sys-color-on-surface-variant: #43474e;

  --md-sys-color-outline: #74777f;
  --md-sys-color-outline-variant: #c4c6d0;

  --md-sys-color-surface-container-lowest: #ffffff;
  --md-sys-color-surface-container-low: #f7f9ff;
  --md-sys-color-surface-container: #f1f3f9;
  --md-sys-color-surface-container-high: #e2e8f0;
  --md-sys-color-surface-container-highest: #dce3eb;

  --md-sys-elevation-level1: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 3px 1px rgba(0, 0, 0, 0.05);
  --md-sys-elevation-level2: 0 1px 2px rgba(0, 0, 0, 0.1), 0 2px 6px 2px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Roboto, system-ui, -apple-system, sans-serif;
  background-color: var(--md-sys-color-background);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(40, 100, 255, 0.25), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(20, 80, 200, 0.2), transparent 40%);
  color: var(--md-sys-color-on-background);
  transition: background-color 0.3s ease, color 0.3s ease;
  line-height: 1.5;
  min-height: 100vh;
}


.wrap {
  max-width: 1200px;
  /* MD3 standard width is flexible, but limiting readability */
  margin: 0 auto;
  padding: 16px 24px;
}

/* --- Navigation (Top App Bar) --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  /* Smoother corner for logo */
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  display: grid;
  place-items: center;
  font-size: 20px;
}

.logo::before {
  content: '🏠';
}

/* Simplification */

.brand h1 {
  font: var(--md-sys-typescale-title-large);
  margin: 0;
  color: var(--md-sys-color-on-surface);
}

.brand p {
  font: var(--md-sys-typescale-body-medium);
  margin: 0;
  color: var(--md-sys-color-on-surface-variant);
}

/* --- Buttons --- */
.actions {
  display: flex;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 24px;
  border-radius: var(--md-sys-shape-corner-full);
  /* Pill shape */
  font: var(--md-sys-typescale-label-large);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  user-select: none;
  text-decoration: none;
}

/* Tonal Button (Default) */
.btn {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.btn:hover {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  opacity: 0.9;
}

.btn:active {
  background-color: var(--md-sys-color-on-secondary-container);
  color: var(--md-sys-color-secondary-container);
}

/* Filled/Primary Button */
.btn.primary {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.btn.primary:hover {
  box-shadow: var(--md-sys-elevation-level1);
  opacity: 0.92;
}

/* Outlined Button */
.btn.outlined {
  background-color: transparent;
  border: 1px solid var(--md-sys-color-outline);
  color: var(--md-sys-color-primary);
}

/* --- Cards --- */
.card,
.feature-card {
  background-color: var(--md-sys-color-surface-container-high);
  border-radius: var(--md-sys-shape-corner-m);
  padding: 16px;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  border: none;
  overflow: hidden;
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
}

.feature-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.card:hover,
.feature-card:hover {
  background-color: var(--md-sys-color-surface-container-highest);
  transform: translateY(-2px);
  box-shadow: var(--md-sys-elevation-level2);
}

.card .hd {
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card .hd .title {
  font: var(--md-sys-typescale-title-medium);
  color: var(--md-sys-color-on-surface);
  margin: 0;
}

.feature-card h3 {
  font: var(--md-sys-typescale-title-large);
  margin: 12px 0 4px;
  color: var(--md-sys-color-on-surface);
}

.feature-card p {
  font: var(--md-sys-typescale-body-medium);
  color: var(--md-sys-color-on-surface-variant);
  margin: 0;
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background-color: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
  display: grid;
  place-items: center;
  font-size: 24px;
}

/* --- Inputs --- */
input[type="text"],
input[type="url"],
input[type="number"],
input[type="date"],
textarea,
select {
  width: 100%;
  height: 56px;
  padding: 0 16px;
  background-color: transparent;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 4px;
  /* Text field small radius */
  color: var(--md-sys-color-on-surface);
  font: var(--md-sys-typescale-body-large);
  margin-bottom: 16px;
  transition: all 0.2s ease;
  caret-color: var(--md-sys-color-primary);
}

textarea {
  height: auto;
  padding-top: 16px;
  min-height: 120px;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  border-width: 2px;
}

label {
  display: block;
  font: var(--md-sys-typescale-body-medium);
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 8px;
}

/* --- Badges & Tags --- */
.pill,
.feature-tag {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  background-color: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
  font: var(--md-sys-typescale-label-large);
  margin-right: 8px;
  border: none;
}

.pill:hover {
  background-color: var(--md-sys-color-surface-variant);
}

.feature-tag {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-size: 11px;
  height: 24px;
  padding: 0 8px;
  margin-right: 4px;
}

/* --- Layout Utils --- */
.grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.row3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.section {
  padding: 24px 0;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

.section:first-child {
  border: none;
}

/* --- Stats --- */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.kpi {
  background-color: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-m);
  padding: 16px;
  border: none;
}

.kpi .val {
  font-size: 32px;
  font-weight: 500;
  /* Regular for numbers in MD3 */
  color: var(--md-sys-color-primary);
  margin: 0;
}

.kpi .name {
  font: var(--md-sys-typescale-body-medium);
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 4px;
}

/* --- Dialog/Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  /* Scrim */
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--md-sys-color-surface-container-high);
  padding: 24px;
  border-radius: 28px;
  /* Dialog XL radius */
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--md-sys-elevation-level3);
}

/* Hide scrollbar for modals (Chrome, Safari, Opera) - User Request */
.modal::-webkit-scrollbar {
  display: none;
}

/* Hide scrollbar for modals (IE, Edge and Firefox) */
.modal {
  -ms-overflow-style: none;
  /* IE and Edge */
  scrollbar-width: none;
  /* Firefox */
}


.modal h2 {
  font: var(--md-sys-typescale-headline-medium);
  margin: 0 0 16px 0;
  color: var(--md-sys-color-on-surface);
}

.btnRow {
  display: flex;
  justify-content: flex-end;
  /* MD3 dialog actions align right */
  gap: 12px;
  margin-top: 24px;
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--md-sys-color-inverse-surface, #313033);
  color: var(--md-sys-color-inverse-on-surface, #f4eff4);
  padding: 14px 24px;
  border-radius: 4px;
  font: var(--md-sys-typescale-body-medium);
  box-shadow: var(--md-sys-elevation-level2);
  transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
  z-index: 2000;
  min-width: 300px;
  text-align: left;
}

[data-theme="light"] .toast {
  background: #313033;
  color: #f4eff4;
}

[data-theme="light"] .toast {
  background: #313033;
  color: #f4eff4;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* --- Breadcrumb --- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  margin-bottom: 24px;
  font: var(--md-sys-typescale-body-medium);
  color: var(--md-sys-color-on-surface-variant);
}

.breadcrumb a {
  color: var(--md-sys-color-primary);
  text-decoration: none;
  border-radius: 4px;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb span {
  color: var(--md-sys-color-on-surface-variant);
  opacity: 0.6;
}

/* --- Empty Strings/State --- */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--md-sys-color-on-surface-variant);
}

/* --- Responsive Grids --- */
.features-grid,
.items-grid,
.trip-list,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 32px;
  margin-top: 32px;
}

/* On very large screens, limit max columns or increase min-width if needed */
@media (min-width: 1400px) {

  .features-grid,
  .items-grid,
  .trip-list {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  }
}