:root {
  /* Core Palette - Sophisticated Slate & Emerald */
  --bg-app: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.72);
  --bg-card-hover: rgba(255, 255, 255, 0.88);
  --bg-muted: rgba(241, 245, 249, 0.6);
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  
  --accent: #10b981;
  --accent-light: #34d399;
  --accent-soft: #ecfdf5;
  --accent-gradient: linear-gradient(135deg, #059669 0%, #3b82f6 100%);
  --accent-glass: rgba(16, 185, 129, 0.08);
  
  --success: #10b981;
  --danger: #f43f5e;
  --warning: #f59e0b;
  
  --border: rgba(255, 255, 255, 1);
  --border-outer: rgba(226, 232, 240, 0.5);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 10px 15px -10px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 30px rgba(16, 185, 129, 0.15);
  
  --radius: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;

  /* Strict Layering Control */
  --z-bg: 0;
  --z-map: 1;
  --z-ui: 10;
  --z-header: 100;
  --z-overlay: 1000;
  --z-modal: 1001;
  --z-toast: 2000;
}

body.dark {
  --bg-app: #020617;
  --bg-card: rgba(15, 23, 42, 0.70);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-muted: rgba(30, 41, 59, 0.5);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --border: rgba(255, 255, 255, 0.08);
  --border-outer: rgba(0, 0, 0, 0.2);
  --shadow: 0 10px 15px -10px rgba(0, 0, 0, 0.3);
}

/* --- Base Styles --- */
.hidden { display: none !important; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
}
.profile-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.profile-info h2 { margin: 0; font-size: 1.25rem; font-weight: 800; line-height: 1.2; }
.profile-info p { margin: 0; color: var(--text-muted); font-size: 0.85rem; line-height: 1; }

.profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.avatar {
  font-size: 2rem;
  background: transparent;
  line-height: 1;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: -1;
  background: 
    radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%), 
    radial-gradient(at 100% 0%, rgba(59, 130, 246, 0.08) 0px, transparent 50%), 
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%), 
    radial-gradient(at 0% 100%, rgba(59, 130, 246, 0.08) 0px, transparent 50%),
    #f8fafc;
  filter: blur(60px);
}
body.dark::before {
  background: 
    radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.15) 0px, transparent 50%), 
    radial-gradient(at 100% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%), 
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.15) 0px, transparent 50%), 
    radial-gradient(at 0% 100%, rgba(59, 130, 246, 0.15) 0px, transparent 50%);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.hidden { display: none !important; }
.mt-4 { margin-top: 1rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.full-width { width: 100%; }
.text-accent { color: var(--accent); }

/* --- Header --- */
.header {
  position: sticky;
  top: 0;
  height: 72px;
  background: rgba(248, 250, 252, 0.6);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  z-index: var(--z-header);
  display: flex;
  align-items: center;
}
body.dark .header {
  background: rgba(15, 23, 42, 0.6);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo {
  font-size: 1.5rem;
  font-weight: 900;
  cursor: pointer;
  margin: 0;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: 0;
  align-items: center;
}

.nav-links .btn {
  padding: 8px 12px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-inline {
  width: 18px;
  height: 18px;
  vertical-align: -4px;
  margin-right: 6px;
  stroke-width: 2.5;
}

.lucide {
  width: 20px;
  height: 20px;
  stroke-width: 2.5px;
  display: inline-block;
}

.icon-lg {
  width: 32px;
  height: 32px;
}

/* --- Views --- */
.view {
  min-height: calc(100vh - 72px);
  padding: 32px 0 64px;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Autofill detection via animation — triggers animationstart on the input when browser autofills */
@keyframes onAutofillStart { from {} to {} }
input:-webkit-autofill { animation-name: onAutofillStart; }

/* --- Auth View --- */
.auth-view {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  background: var(--bg-muted);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  text-align: center;
  background: var(--bg-card);
  border-radius: 20px;
  box-shadow: var(--shadow);
  z-index: var(--z-ui);
}

.brand-icon {
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
}
.brand-icon i, .brand-icon svg {
  width: 48px;
  height: 48px;
  stroke-width: 2px;
  color: var(--accent);
}

.auth-title { margin: 0; font-size: 2rem; font-weight: 900; }
.auth-subtitle { color: var(--text-muted); margin-bottom: 32px; }

.auth-map-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: var(--z-bg);
  opacity: 0.3;
  filter: grayscale(1);
}

/* --- Active Trip Banner --- */
.active-trip-banner {
  background: var(--accent);
  color: white;
  padding: 16px 24px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
  animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.banner-content { display: flex; align-items: center; gap: 16px; }
.banner-icon { font-size: 24px; }
.banner-info { display: flex; flex-direction: column; }
.banner-info strong { font-size: 1.1rem; }
.banner-info span { font-size: 0.85rem; opacity: 0.9; }

/* --- Dashboard Grid --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 320px 1fr 280px;
  gap: 32px;
}

@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: 320px 1fr; }
  .col-stats { display: none; }
}

@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .col-profile { order: 2; }
  .col-feed { order: 1; }
  .col-stats { display: block; order: 3; }
}

/* --- Insights View Layout --- */
.insights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.insights-grid .card:first-child {
  grid-column: span 2;
}

.insights-row {
  grid-column: span 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.col-feed { min-width: 0; }

.col-stats { min-width: 0; }

/* --- Cards --- */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.02),
    0 10px 15px -3px rgba(0, 0, 0, 0.04),
    inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  margin-bottom: 24px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.card:hover {
  transform: translateY(-6px);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: var(--accent-light);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-header h3 { margin: 0; font-size: 1rem; font-weight: 700; color: var(--text-secondary); }

/* --- Trip Cards --- */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trip-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: var(--bg-muted);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  position: relative;
}

.trip-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-light);
  transform: translateX(8px);
  box-shadow: var(--shadow-sm);
}

.trip-card-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.trip-card.trip-needs-review {
  border-color: var(--warning);
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.trip-review-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--warning);
}

.trip-review-banner i { flex-shrink: 0; width: 14px; height: 14px; }

.trip-review-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.trip-info { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.trip-route-pill {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  font-size: 0.75rem;
  border-radius: 4px;
  width: fit-content;
}

.trip-path { font-weight: 600; font-size: 0.95rem; }
.path-arrow { color: var(--text-muted); padding: 0 4px; }

.trip-meta { text-align: right; }
.trip-date { font-weight: 700; font-size: 0.85rem; }
.trip-duration { font-size: 0.8rem; color: var(--text-secondary); }
.trip-direction { font-size: 0.75rem; color: var(--text-secondary); font-weight: 600; letter-spacing: 0.03em; }

/* --- Stats --- */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-box {
  background: var(--bg-muted);
  padding: 20px 16px;
  border-radius: var(--radius);
  text-align: center;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}
.stat-box:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-soft);
  box-shadow: var(--shadow-sm);
  transform: scale(1.05);
}

.stat-box strong { display: block; font-size: 1.75rem; font-weight: 900; color: var(--accent); letter-spacing: -0.02em; }
.stat-box span { font-size: 0.65rem; font-weight: 800; color: var(--text-muted); }

.streak-box {
  background: var(--accent-gradient);
  color: white;
  padding: 24px;
  border-radius: var(--radius-lg);
  margin-top: 16px;
  position: relative;
  box-shadow: 0 10px 20px rgba(5, 150, 105, 0.2);
  overflow: hidden;
  border: none;
}
.streak-box::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
  animation: rot 10s linear infinite;
  pointer-events: none;
}
@keyframes rot {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.streak-title { 
  font-size: 0.75rem; 
  font-weight: 800; 
  margin-bottom: 20px; 
  opacity: 0.9; 
  text-align: center;
}
.streak-data { display: flex; justify-content: space-around; align-items: center; position: relative; z-index: 1; }
.streak-item { text-align: center; flex: 1; }
.streak-item strong { display: block; font-size: 2.5rem; font-weight: 900; line-height: 1; margin-bottom: 4px; }
.streak-item span { font-size: 0.65rem; opacity: 0.8; font-weight: 700; }

.divider-v { width: 1px; height: 30px; background: rgba(255,255,255,0.3); }

/* --- Tables / Lists --- */
.list-compact { display: flex; flex-direction: column; gap: 8px; }
.compact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-muted);
  border-radius: 12px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.compact-row:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-soft);
  transform: translateX(4px);
}
.row-label { font-weight: 700; color: var(--text-secondary); }
.row-value { 
  color: var(--accent); 
  font-weight: 900; 
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 8px;
  min-width: 40px;
  text-align: center;
}

/* --- Form Elements --- */
.btn {
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.9rem;
}

.btn-primary { 
  background: var(--accent-gradient); 
  color: white; 
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-inactive { opacity: 0.5; cursor: default; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.btn-icon {
  background: transparent;
  border: none;
  padding: 8px;
  min-width: auto;
  box-shadow: none !important;
  font-size: 1.2rem;
}
.btn-icon:hover {
  background: var(--bg-muted);
  transform: translateY(-2px);
}

.btn-sm { padding: 8px 16px; font-size: 0.8rem; }

.toggle-group {
  display: flex;
  background: var(--bg-muted);
  padding: 4px;
  border-radius: 8px;
}

.toggle-btn {
  flex: 1;
  padding: 6px 12px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-secondary);
}

.toggle-btn.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

input, select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-muted);
  border: 1px solid var(--border-outer);
  border-radius: 12px;
  font-size: 1rem;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s;
}

input:focus, select:focus { 
  border-color: var(--accent-light); 
  background: var(--bg-card);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.input-center { text-align: center; }

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* --- Modals --- */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: var(--z-overlay);
}

.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-card);
  width: 90%;
  max-width: 450px;
  border-radius: 20px;
  box-shadow: var(--shadow);
  z-index: var(--z-modal);
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.modal-header h2 { margin: 0; font-size: 1.25rem; font-weight: 800; }

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s;
}
.btn-close:hover { color: var(--text-primary); }

.loading-state {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-style: italic;
}

.status-msg {
  padding: 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* --- Edit Trip / Management --- */
.trip-info { position: relative; }
.btn-edit-trip {
  position: absolute;
  top: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  opacity: 0;
}

.trip-card:hover .btn-edit-trip { opacity: 1; transform: translateX(-4px); }
.btn-edit-trip:hover { background: var(--accent-light); color: white; border-color: transparent; }

.modal-select {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
  font-weight: 600;
  outline: none;
}

.btn-danger-outline {
  background: transparent;
  border: 2px solid var(--danger);
  color: var(--danger);
}
.btn-danger-outline:hover { background: var(--danger); color: white; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: white; }

/* --- Journey Connector --- */
.journey-connector { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: -4px 0; }
.journey-line { width: 2px; height: 10px; background: var(--accent); opacity: 0.3; border-radius: 1px; }
.journey-badge { display: flex; align-items: center; gap: 6px; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 20px; padding: 3px 10px; font-size: 0.72rem; color: var(--text-secondary); font-weight: 500; }
.btn-break-journey { background: none; border: none; padding: 0; cursor: pointer; color: var(--text-secondary); display: flex; align-items: center; opacity: 0.5; transition: opacity 0.15s, color 0.15s; }
.btn-break-journey:hover { opacity: 1; color: var(--danger); }

/* --- Advanced Analytics --- */
.insight-row {
  background: var(--bg-muted);
  padding: 16px;
  border-radius: var(--radius);
}

.insight-title {
  font-weight: 800;
  font-size: 0.85rem;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.insight-title .badge {
  background: var(--accent);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.insight-item {
  text-align: center;
}
.insight-item strong { display: block; font-size: 1.1rem; font-weight: 900; }
.insight-item span { font-size: 0.65rem; font-weight: 700; color: var(--text-muted); }
.insight-item.success strong { color: var(--success); }
.insight-item.muted { opacity: 0.6; }

/* --- Peak Times Chart --- */
.chart-compact {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chart-label {
  width: 60px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.chart-bar-bg {
  flex: 1;
  height: 12px;
  background: var(--bg-muted);
  border-radius: 6px;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.chart-value {
  width: 24px;
  font-size: 0.8rem;
  font-weight: 800;
  text-align: right;
  color: var(--accent);
}

/* --- Admin Views --- */
.admin-grid {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .admin-grid { grid-template-columns: 1fr; }
}

.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inbox-item {
  background: var(--bg-muted);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
  border-left: 4px solid var(--warning);
}

.inbox-item:hover {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  transform: translateX(4px);
}

.inbox-item-content {
  flex: 1;
}

.inbox-item-name {
  font-weight: 700;
  display: block;
}

.inbox-item-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.badge-count {
  background: var(--warning);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 800;
  margin-right: 8px;
}

/* --- Library Grid --- */
.lib-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.stop-card {
  background: var(--bg-muted);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.stop-card:hover {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  border-color: var(--accent);
}

.stop-card-name {
  font-weight: 800;
  margin-bottom: 4px;
}

.stop-card-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  gap: 8px;
}

.alias-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dotted var(--border);
}

.alias-pill {
  font-size: 0.65rem;
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.admin-filters {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}

.divider {
  text-align: center;
  position: relative;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-muted);
  margin: 16px 0;
}

.divider::before, .divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 35%;
  height: 1px;
  background: var(--border);
}

.divider::before { left: 0; }
.divider::after { right: 0; }

.text-accent { color: var(--accent) !important; }

/* Prediction Card */
.prediction-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.prediction-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-gradient);
}

.prediction-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.prediction-icon {
    font-size: 1.25rem;
}

.prediction-label {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--text-muted);
}

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

.prediction-main {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.prediction-route {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
}

.prediction-stop {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.prediction-stats {
    text-align: right;
    min-width: 80px;
}

.prediction-confidence {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-electric);
}

.prediction-confidence-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* Active Trip Styles Extension */
.trip-active-card {
    border: 2px solid var(--accent-electric);
    animation: glow-pulse 3s infinite ease-in-out;
}

@keyframes glow-pulse {
    0% { box-shadow: 0 0 5px rgba(99, 102, 241, 0.1); }
    50% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.3); }
    100% { box-shadow: 0 0 5px rgba(99, 102, 241, 0.1); }
}

/* Sparkline */
.insight-sparkline {
    display: block;
    width: 100%;
    height: 32px;
    margin: 6px 0;
    opacity: 0.8;
}

.sparkline-container {
    height: 64px;
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 3px;
    padding: 4px 0 20px;
    position: relative;
}
.spark-bar {
    flex: 1;
    background: var(--accent);
    opacity: 0.35;
    border-radius: 2px;
    transition: all 0.2s ease;
    cursor: default;
}
.spark-bar:hover {
    opacity: 1;
    background: var(--accent-light);
    transform: scaleY(1.1);
}
.spark-avg-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--accent);
    opacity: 0.5;
    pointer-events: none;
}
.spark-label {
    width: 100%;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 6px;
    text-align: center;
    position: absolute;
    bottom: 0;
    left: 0;
}
/* --- Activity Grid (GitHub Style) --- */
.activity-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 12px;
    padding-bottom: 2rem;
    position: relative;
    justify-content: flex-start;
}

.grid-day-column {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.grid-square {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: var(--bg-muted);
    transition: all 0.2s ease;
    cursor: pointer;
}

.grid-square:hover {
    transform: scale(1.3);
    z-index: 10;
    box-shadow: 0 0 10px var(--accent);
}

/* Heat Colors (TTC Indigo Theme) */
.heat-0 { background: var(--bg-muted); opacity: 0.3; }
.heat-1 { background: var(--accent-soft); opacity: 0.6; }
.heat-2 { background: var(--accent-light); opacity: 0.8; }
.heat-3 { background: var(--accent); }
.heat-4 { background: var(--accent-electric); }

.grid-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.65rem;
    color: var(--text-muted);
    justify-content: flex-end;
    margin-top: 8px;
}

.legend-square {
    width: 8px;
    height: 8px;
    border-radius: 1px;
}

/* Layout adjustments */
.sparkline-container { display: none; } /* Hide old sparkline */

/* --- Settings UI Enhancements --- */
.section-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.profile-info-box {
  background: var(--bg-muted);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border-outer);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.info-row:not(:last-child) {
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

body.dark .info-row:not(:last-child) {
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.info-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.info-value {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 700;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-muted);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-outer);
}

.toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.toggle-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Switch Component */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-outer);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 2px;
  background-color: #cbd5e1;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
}

input:checked + .slider {
  background-color: var(--accent);
  border-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(20px);
  background-color: white;
}

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 50%;
}
