:root {
  --color-bg: #ffffff;              /* pure white canvas */
  --color-surface: #ffffff;         /* cards sit on white too, distinguished by border */
  --color-surface-alt: #f4f5f6;     /* subtle off-white for hover/alt rows, secondary buttons */
  --color-border: #dcdfe3;          /* light neutral grey — reads clean across a full-width layout */
  --color-border-strong: #b8bcc2;   /* slightly darker grey, for dividers that need more separation */
  --color-text: #1f2328;            /* charcoal body text */
  --color-muted: #6b7280;
  --color-ink: #3f4552;             /* dark neutral grey — link text, headings, chrome borders (was navy) */
  --color-accent:  #ef8f2e;          /* pale orange — pricing, focus */
  --color-accent-hover: #d97a1f;
  --color-accent-light:  #fdecd9;    /* saturated orange — primary buttons,hero section background */
  --color-accent-contrast: #2b2f38; /* text sitting on an orange background needs a dark, not white, tone for contrast */
  --color-danger: #dc2626;
  --color-status-pending: #f59e0b;   /* amber */
  --color-status-active: #10b981;    /* emerald */
  --color-status-completed: #3b82f6; /* blue */
  --color-header: #ffffff;          /* white header/footer/nav bars — kept plain so the logo stands out */
  --color-header-text: #3f4552;     /* grey — all menu text */
  --color-header-muted: #3f4552;    /* same grey; active vs. inactive is shown by weight, not color */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  
}

a { color: var(--color-ink); }
a:visited { color: var(--color-ink); }

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

h1, h2 { margin: 0 0 1rem; }

.app-shell h1 {
  font-size: 1.25rem;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.login-brand {
  text-align: left;
  margin-bottom: 1.5rem;
}
.login-logo {
  height: 56px;
  width: auto;
  margin-bottom: 0.5rem;
}

#journey-title {
  font-size: 0.95rem;
  font-weight: 600;
}


.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 0.35rem;
  margin-top: 0.75rem;
}
label:first-child { margin-top: 0; }

input, select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text);
  font-size: 1rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-ink);
  box-shadow: 0 0 0 3px rgba(239, 143, 46, 0.2);
}

button {
  width: 100%;
  padding: 0.7rem;
  margin-top: 1rem;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--color-accent-hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary { background: var(--color-surface-alt); color: var(--color-text); border: 1px solid var(--color-border); }
button.secondary:hover:not(:disabled) { background: var(--color-border); }
button.danger { background: var(--color-danger); color: white; }
button.danger:hover:not(:disabled) { background: #b91c1c; }

.error { color: var(--color-danger); font-size: 0.9rem; margin-top: 0.75rem; }
.muted { color: var(--color-muted); font-size: 0.85rem; }

.autocomplete-list {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}
.autocomplete-list li {
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}
.autocomplete-list li:last-child { border-bottom: none; }
.autocomplete-list li:hover { background: var(--color-surface-alt); }

.journey-list { list-style: none; margin: 0; padding: 0; }
.journey-list li a {
  display: block;
  padding: 0.75rem;
  color: var(--color-text);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.85rem;
}
.journey-list li a:hover { background: var(--color-surface-alt); }
.journey-list li:last-child a { border-bottom: none; }
.journey-delete-row {
  padding: 0 0.75rem 0.6rem;
  text-align: right;
  border-bottom: 1px solid var(--color-border);
}
.journey-list li:last-child .journey-delete-row { border-bottom: none; }

.news-item-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.news-item-title { font-weight: 600; }
.news-item-excerpt {
  color: var(--color-muted);
  font-size: 0.9rem;
  line-height: 1.4;
  margin: 0.35rem 0 0;
}
.status-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--color-surface-alt);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  text-transform: uppercase;
  font-weight: 700;
  vertical-align: middle;
}
.status-badge.pending { background: #fef3c7; color: #92400e; border-color: #f59e0b; }
.status-badge.active { background: #d1fae5; color: #065f46; border-color: #10b981; }
.status-badge.completed { background: #dbeafe; color: #1e40af; border-color: #3b82f6; }

button.btn-small {
  width: auto;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  margin-top: 0;
}

#map {
  width: 100%;
  height: 60vh;
  min-height: 320px;
  border-radius: 12px;
  margin-bottom: 1rem;
}

#new-journey-btn {
  font-size: 0.9rem;
  padding: 0.6rem;
}

/* --- Admin panel (full page width) --- */
.admin-shell {
  max-width: 1800px;
  margin: 0 auto;
  padding: 1.25rem 2rem 3rem;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-header);
  border-bottom: 1px solid var(--color-border-strong);
  margin: -1.25rem -2rem 1.5rem;
  padding: 0.85rem 2rem;
}
.admin-nav a {
  color: var(--color-header-muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
}
.admin-nav a:hover { color: var(--color-header-text); }
.admin-nav-brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--color-header-text);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.4rem 0.8rem 0.4rem 0;
}
.admin-nav-brand img { border-radius: 5px; }
.admin-nav a.active { color: var(--color-header-text); background: var(--color-accent); }
.admin-nav #admin-logout-link { margin-left: auto; }
.admin-nav a.push-right { margin-left: auto; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem;
}
.stat-card .value { font-size: 1.75rem; font-weight: 700; }
.stat-card .label { color: var(--color-muted); font-size: 0.8rem; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.data-table th { color: var(--color-muted); font-weight: 600; font-size: 0.8rem; }
.data-table tbody tr:hover { background: var(--color-surface-alt); }
.table-wrap { overflow-x: auto; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.filter-bar .field { display: flex; flex-direction: column; gap: 0.3rem; }
.filter-bar label { margin: 0; }
.filter-bar select, .filter-bar input { width: auto; min-width: 150px; }
.filter-bar button { width: auto; margin-top: 0; padding: 0.6rem 1rem; }
.filter-bar button.secondary { min-width: 0; }

.pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}
.pagination button { width: auto; margin-top: 0; }

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-bottom: 0.75rem;
}
.map-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.map-legend .swatch { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }

#dashboard-map { height: 65vh; min-height: 380px; }

/* Driver-name tag floating above each active vehicle marker (gmSetMarker's labelText). */
.gm-marker-label {
  background: var(--color-ink);
  color: #ffffff;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

textarea {
  width: 100%;
  min-height: 200px;
  padding: 0.6rem 0.7rem;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text);
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
}

/* --- Tabs (superadmin Messages page) --- */
.tab-bar {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1.25rem;
}
.tab-btn {
  color: var(--color-muted);
  text-decoration: none;
  padding: 0.6rem 0.9rem;
  border-bottom: 2px solid transparent;
  font-size: 0.9rem;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  margin: 0;
  width: auto;
}
.tab-btn.active { color: var(--color-text); border-bottom-color: var(--color-accent); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.compose-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 800px) {
  .compose-grid { grid-template-columns: 1fr; }
}

.email-preview-frame {
  width: 100%;
  height: 500px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface-alt);
}

.btn-link {
  width: auto;
  background: none;
  color: var(--color-ink);
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
  text-decoration: underline;
}

.side-panel {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}
.side-panel.open { display: block; }
.side-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 17, 21, 0.5);
}
.side-panel-content {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(600px, 92vw);
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  padding: 1.25rem;
  overflow-y: auto;
  box-shadow: -4px 0 16px rgba(16, 24, 40, 0.08);
}
.side-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.top-bar {
  display: block;
  margin-bottom: 1rem;
}
.top-bar-links {
  margin-top: 0.5rem;
  display: block;
}
.top-bar a { color: var(--color-muted); text-decoration: none; font-size: 0.85rem; }
.top-bar a:hover { color: var(--color-text); }

.top-bar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.top-bar-icon {
  height: 32px;
  width: auto;
}

/* --- Public home page (full page width) --- */
.home-shell {
  max-width: 1800px;
  margin: 0 auto;
  padding: 1.1rem 2rem 2rem;
}
.home-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  background: var(--color-header);
  /* border-bottom: 1px solid var(--color-border-strong); */
  margin: -1.1rem -2rem 1rem;
  padding: 0.9rem 2rem;
}
.home-nav-links { display: flex; align-items: center; }
.home-nav a { color: var(--color-header-muted); text-decoration: none; font-size: 0.9rem; font-weight: 500; margin-left: 1.25rem; }
.home-nav a:hover { text-decoration: underline; }
.home-nav a.active { font-weight: 700; text-decoration: underline; }
.home-nav .brand { display: flex; align-items: center; margin-left: 0; }
.brand-logo { height: 56px; width: auto; display: block; }
@media (max-width: 640px) { .brand-logo { height: 44px; } }
.home-nav-toggle {
  display: none;
  width: auto;
  margin: 0;
  padding: 0.25rem 0.25rem;
  background: none;
  border: none;
  color: var(--color-header-text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

/* Below this, "Home / Pricing / News / Docs / Log In" no longer fits inline next to the
   brand — collapse the links behind a hamburger toggle instead of letting them wrap and
   crowd the bar. */
@media (max-width: 640px) {
  .home-nav-toggle { display: block; }
  .home-nav-links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    margin-top: 0.75rem;
  }
  .home-nav-links.open { display: flex; }
  .home-nav-links a { margin-left: 0; padding: 0.6rem 0; width: 100%; }
}

.hero {
  text-align: center;
  background: var(--color-accent);
  margin: 0 -2rem;
  padding: 3rem 2rem 3.5rem; 
}
.hero h1 { font-size: 2.25rem; max-width: 780px; margin: 0 auto 0.75rem; }
.hero p { color: #ffffff; font-size: 1.1rem; max-width: 560px; margin: 0 auto 1.75rem; }
.hero-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.hero-actions a {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}
.hero-actions a.primary {
  background: var(--color-accent-light);
  color: var(--color-accent-contrast);
  border: 1px solid var(--color-ink);
  box-shadow: 0 2px 8px rgba(191, 108, 12, 0.35);
}
.hero-actions a.primary:hover { background: var(--color-accent-hover); }
.hero-actions a.secondary {
  background: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid var(--color-ink);
  box-shadow: 0 1px 3px rgba(31, 35, 40, 0.08);
}
.hero-actions a.secondary:hover { background: var(--color-surface-alt); }

@media (max-width: 480px) {
  .hero h1 { font-size: 1.6rem; }
  .hero p { font-size: 1rem; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions a { text-align: center; }
}

.section { padding: 2.5rem 0; }
.section h2 { text-align: center; font-size: 1.5rem; }
.section-intro { text-align: center; color: var(--color-muted); max-width: 640px; margin: 0 auto 2rem; }
.callout {
  text-align: center;
  font-size: 1.15rem;
  color: var(--color-text);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 0 auto;
  max-width: 720px;
}

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0 auto; max-width: 800px; display: grid; gap: 1.5rem; }
.steps li { display: flex; gap: 1rem; align-items: flex-start; }
.steps li::before {
  counter-increment: step;
  content: counter(step);
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}
.steps li strong { display: block; margin-bottom: 0.25rem; }
.steps li p { margin: 0; color: var(--color-muted); }

.feature-list { list-style: none; padding: 0; margin: 0 auto; max-width: 800px; display: grid; gap: 1rem; }
.feature-list li { padding-left: 1.6rem; position: relative; color: var(--color-muted); }
.feature-list li::before { content: "\2713"; position: absolute; left: 0; color: var(--color-accent); font-weight: 700; }
.feature-list li strong { color: var(--color-text); }

.two-col-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 700px) { .two-col-grid { grid-template-columns: 1fr; } }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.plan-card {
  background: var(--color-surface-alt);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.plan-card .plan-name { font-weight: 700; font-size: 1.1rem; margin-bottom: 0.5rem; }
.plan-card .plan-price { font-size: 1.75rem; font-weight: 700; color: var(--color-accent); }
.plan-card .plan-price span { font-size: 0.9rem; font-weight: 400; color: var(--color-muted); }
.plan-card .plan-limit { color: var(--color-muted); font-size: 0.85rem; margin-top: 0.5rem; }
.plan-card .plan-criteria { list-style: none; margin: 0.75rem 0 0; padding: 0; color: var(--color-muted); font-size: 0.85rem; text-align: left; }
.plan-card .plan-criteria li { padding: 0.15rem 0 0.15rem 1.4rem; position: relative; }
.plan-card .plan-criteria li::before { content: "\2713"; position: absolute; left: 0; color: var(--color-accent); font-weight: 700; }

.home-footer {
  text-align: center;
  color: var(--color-header-muted);
  font-size: 0.85rem;
  background: var(--color-header);
  border-top: 1px solid var(--color-border-strong);
  margin: 3rem -2rem -2rem;
  padding: 1.5rem 2rem;
}
.home-footer a { color: var(--color-header-muted); margin: 0 0.5rem; }
.home-footer a:hover { text-decoration: underline; }

.pin-display {
  font-size: 1.75rem;
  letter-spacing: 0.2rem;
  font-weight: 700;
  text-align: center;
  padding: 0.75rem;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  margin: 0.5rem 0;
}

/* Full-width shells use generous side padding on desktop; pull it back in on
   narrow screens so the nav/footer's negative-margin edge-to-edge bleed still
   lines up with the shell's own padding. */
@media (max-width: 640px) {
  .admin-shell { padding: 1.25rem 1rem 3rem; }
  .admin-nav { margin: -1.25rem -1rem 1.5rem; padding: 0.85rem 1rem; }
  .home-shell { padding: 1.1rem 1rem 2rem; }
  .home-nav { margin: -1.1rem -1rem 1rem; padding: 0.9rem 1rem; }
  .home-footer { margin: 3rem -1rem -2rem; padding: 1.5rem 1rem; }
  .hero { margin: 0 -1rem; padding: 2rem 1rem 2.5rem; }
}
