/**
 * Share My Ride — Driver & Passenger dashboards ([smr_driver_portal],
 * [smr_passenger_portal]). Restyled to match the admin dashboard's
 * app-shell look (dark sidebar nav, topbar, stat cards, charts) —
 * admin/css/smr-admin.css is the reference, but this is a self-contained
 * copy scoped to .smr-portal-app because the admin file assumes it owns
 * the whole wp-admin canvas (position:fixed, 100vh), which isn't safe
 * inside a normal front-end page. The card/row/badge language below is
 * unchanged so it still matches Login/Register (smr-auth.css).
 */
.smr-portal {
	--smr-p-brand: #00808c;
	--smr-p-brand-dark: #006670;
	--smr-p-navy: #0f2942;
	--smr-p-border: #e5e7eb;
	--smr-p-text: #111827;
	--smr-p-text-muted: #6b7280;
	--smr-p-text-faint: #9ca3af;
	--smr-p-tint: #e6f4f5;
	--smr-p-green: #059669;
	--smr-p-green-tint: #ecfdf5;
	--smr-p-orange: #d97706;
	--smr-p-orange-tint: #fffbeb;
	--smr-p-red: #dc2626;
	--smr-p-red-tint: #fef2f2;
	--smr-p-gray-tint: #f3f4f6;
	--smr-p-bg: #ffffff;
	--smr-p-surface: #ffffff;
	color-scheme: light;

	font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
	color: var(--smr-p-text);
	width: 100%;
}
/* Dark mode: toggled by adding data-smr-theme="dark" to .smr-portal-app
   (smr-dashboard.js, same pattern as the admin dashboard's toggle).
   Everything else in this file already reads colors through the
   --smr-p-* custom properties above, so redefining them here is enough
   to flip the whole shell — no separate dark ruleset needed per
   component. */
.smr-portal-app[data-smr-theme="dark"] {
	--smr-p-border: #1c3a3f;
	--smr-p-text: #eef7f7;
	--smr-p-text-muted: #9db3b5;
	--smr-p-text-faint: #71898c;
	--smr-p-tint: rgba(0, 128, 140, 0.2);
	--smr-p-green-tint: rgba(5, 150, 105, 0.2);
	--smr-p-orange-tint: rgba(217, 119, 6, 0.2);
	--smr-p-red-tint: rgba(220, 38, 38, 0.2);
	--smr-p-gray-tint: rgba(255, 255, 255, 0.06);
	--smr-p-bg: #0a1a1d;
	--smr-p-surface: #102428;
	color-scheme: dark;
}
.smr-portal * { box-sizing: border-box; }
/* The shell is now position:fixed and covers the full viewport, so lock
   the page behind it from scrolling too (otherwise the theme's normal
   page content could still scroll underneath, causing a confusing extra
   scrollbar). */
body:has(.smr-portal-app) { overflow: hidden; }

/* Defensive ancestor resets: the 100vw breakout on .smr-portal-app (below)
   only works if every ancestor between it and <body> allows overflow and
   doesn't itself sit inside a max-width column. Elementor's page/section/
   container wrappers (and many theme content wrappers) do exactly that —
   "boxed" content width plus `overflow: hidden` on a section — which clips
   the breakout at the theme's normal content width instead of letting it
   reach the browser edge, even though the CSS on .smr-portal-app itself is
   correct. Scoped with :has() so this never touches pages that don't embed
   the portal. !important is needed because Elementor sets some of these
   inline via its own editor settings. */
body:has(.smr-portal-app) .elementor,
body:has(.smr-portal-app) .elementor-section-wrap,
body:has(.smr-portal-app) .elementor-top-section,
body:has(.smr-portal-app) .elementor-section,
body:has(.smr-portal-app) .elementor-container,
body:has(.smr-portal-app) .elementor-column,
body:has(.smr-portal-app) .elementor-widget-wrap,
body:has(.smr-portal-app) .elementor-widget-container,
body:has(.smr-portal-app) .elementor-element,
body:has(.smr-portal-app) .site-content,
body:has(.smr-portal-app) .content-area,
body:has(.smr-portal-app) .entry-content,
body:has(.smr-portal-app) #content,
body:has(.smr-portal-app) #primary,
body:has(.smr-portal-app) #page {
	max-width: none !important;
	overflow: visible !important;
	overflow-x: visible !important;
}

/* Same story for side padding/margin: reaching 100vw only gets the shell
   to the browser edge if every ancestor also has zero left/right padding
   and margin around it. Elementor's boxed layout and most themes add
   ~20-40px of side padding on these same wrappers, which is what was
   still squeezing the shell in from both sides after the overflow/width
   fix above. */
body:has(.smr-portal-app) .elementor,
body:has(.smr-portal-app) .elementor-section-wrap,
body:has(.smr-portal-app) .elementor-top-section,
body:has(.smr-portal-app) .elementor-section,
body:has(.smr-portal-app) .elementor-container,
body:has(.smr-portal-app) .elementor-column,
body:has(.smr-portal-app) .elementor-widget-wrap,
body:has(.smr-portal-app) .elementor-widget-container,
body:has(.smr-portal-app) .elementor-element,
body:has(.smr-portal-app) .site-content,
body:has(.smr-portal-app) .content-area,
body:has(.smr-portal-app) .entry-content,
body:has(.smr-portal-app) #content,
body:has(.smr-portal-app) #primary,
body:has(.smr-portal-app) #page {
	padding-left: 0 !important;
	padding-right: 0 !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}

/* Catch-all: rather than keep guessing class names for this theme's/
   Elementor's wrapper structure, reset EVERY actual ancestor of the
   portal shell (whatever it's called) so nothing upstream can box it
   in. `*:has(.smr-portal-app)` matches any element that contains the
   portal anywhere inside it — i.e. the real ancestor chain, not a
   guess. Safe because it's gated by `body:has(.smr-portal-app)`, so it
   only fires on pages that actually embed the driver/passenger portal. */
body:has(.smr-portal-app) *:has(> .smr-portal-app),
body:has(.smr-portal-app) *:has(.smr-portal-app) {
	max-width: none !important;
	width: auto !important;
	overflow: visible !important;
	overflow-x: visible !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}


/* ---------- App shell (sidebar + topbar), admin-dashboard look ---------- */
.smr-portal-app {
	/* Aliases so the reused admin chart/icon helpers (which reference
	   var(--smr-teal) etc.) pick up the portal's own brand colors. */
	--smr-teal: var(--smr-p-brand);
	--smr-teal-strong: var(--smr-p-brand-dark);
	--smr-teal-tint: var(--smr-p-tint);
	--smr-orange: var(--smr-p-orange);
	--smr-navy: var(--smr-p-navy);
	--smr-green: var(--smr-p-green);
	--smr-red: var(--smr-p-red);
	--smr-gray-dot: #9aa8ac;
	--smr-surface: var(--smr-p-surface);
	--smr-border: var(--smr-p-border);
	--smr-text: var(--smr-p-text);
	--smr-text-muted: var(--smr-p-text-muted);
	--smr-text-faint: var(--smr-p-text-faint);

	display: flex;
	border: none;
	border-top: 1px solid var(--smr-p-border);
	border-radius: 0;
	overflow: hidden;
	background: var(--smr-p-bg);
	box-shadow: none;
	/* True full-bleed: pin to the actual browser viewport instead of
	   trying to "break out" of whatever the theme wraps around this
	   shortcode (which is what kept getting clipped/padded/centered by
	   Elementor's container). position:fixed + inset:0 ignores all of
	   that — the shell always fills exactly 100vw x 100vh with zero
	   margin, no matter what ancestor markup the theme uses. */
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	margin: 0;
	z-index: 9999;
}
/* WordPress's own admin toolbar (visible to logged-in users) is fixed at
   the very top of the viewport with a higher stacking layer than our
   shell, so pinning to top:0 puts our topbar partly underneath it. Offset
   by the toolbar's real height — 32px desktop, 46px on the same <=782px
   breakpoint WP core itself switches at — same accommodation the
   wp-admin dashboard gets automatically. */
body.admin-bar .smr-portal-app { top: 32px; height: calc(100vh - 32px); }
@media screen and (max-width: 782px) {
	body.admin-bar .smr-portal-app { top: 46px; height: calc(100vh - 46px); }
}

/* Sidebar */
.smr-portal-sidebar {
	width: 232px; flex-shrink: 0;
	background: #052730;
	display: flex; flex-direction: column;
	padding: 18px 12px;
	overflow-y: auto;
}
.smr-portal-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; color: #fff; }
.smr-portal-brand svg { flex-shrink: 0; }
.smr-portal-brand-name { font-weight: 700; font-size: 14px; line-height: 1.25; }
.smr-portal-brand-name span { display: block; font-weight: 400; font-size: 11px; color: rgba(255, 255, 255, 0.45); }
.smr-portal-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.smr-portal-nav button,
.smr-portal-nav a {
	display: flex; align-items: center; gap: 10px; width: 100%;
	padding: 9px 10px; border: none; background: none; border-radius: 8px;
	color: rgba(255, 255, 255, 0.68); font-size: 13px; font-weight: 500; font-family: inherit;
	cursor: pointer; text-align: left; transition: background 0.12s ease, color 0.12s ease;
	text-decoration: none; box-sizing: border-box;
}
.smr-portal-nav button:hover,
.smr-portal-nav a:hover { background: rgba(255, 255, 255, 0.06) !important; color: #fff !important; }
.smr-portal-nav button.active { background: var(--smr-p-brand); color: #fff; }
.smr-portal-nav button svg,
.smr-portal-nav a svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.9; }
.smr-portal-nav-home { border-bottom: 1px solid rgba(255, 255, 255, 0.08); margin-bottom: 6px; padding-bottom: 8px; }
.smr-portal-nav-badge {
	margin-left: auto; background: var(--smr-p-orange); color: #fff;
	font-size: 10.5px; font-weight: 700; line-height: 1; padding: 3px 6px; border-radius: 99px;
}
.smr-portal-sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.smr-portal-logout-link {
	display: flex; align-items: center; gap: 9px; padding: 8px 10px; margin-bottom: 6px;
	color: rgba(255, 255, 255, 0.6); text-decoration: none; font-size: 12.5px; font-weight: 500; border-radius: 8px;
}
.smr-portal-logout-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.smr-portal-version { padding: 0 10px; font-size: 10.5px; color: rgba(255, 255, 255, 0.32); }

/* Main column */
.smr-portal-main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.smr-portal-topbar {
	flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
	padding: 14px 22px; background: var(--smr-p-surface); border-bottom: 1px solid var(--smr-p-border);
}
.smr-portal-topbar-title { display: flex; align-items: center; gap: 9px; font-size: 15.5px; font-weight: 700; letter-spacing: 0.01em; }
.smr-portal-topbar-title svg:not(.smr-portal-hamburger svg) { color: var(--smr-p-brand); }
.smr-portal-topbar-right { display: flex; align-items: center; gap: 12px; }
.smr-portal-range-pill {
	display: flex; align-items: center; gap: 6px;
	border: 1px solid var(--smr-p-border); border-radius: 8px;
	padding: 6px 11px; font-size: 12px; font-weight: 600; color: var(--smr-p-text); white-space: nowrap;
}
.smr-portal-user { display: flex; align-items: center; gap: 9px; }
.smr-portal-theme-toggle {
	width: 32px; height: 32px; border-radius: 50%;
	border: 1px solid var(--smr-p-border);
	background: var(--smr-p-surface);
	display: flex; align-items: center; justify-content: center;
	cursor: pointer; color: var(--smr-p-text-muted); flex-shrink: 0;
}
.smr-portal-theme-toggle:hover { color: var(--smr-p-brand) !important; border-color: var(--smr-p-brand) !important; background: var(--smr-p-surface) !important; }
.smr-portal-user-avatar {
	width: 32px; height: 32px; border-radius: 50%; background: var(--smr-p-brand-dark); color: #fff;
	display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; flex-shrink: 0;
}
.smr-portal-user-name { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.smr-portal-user-role { font-size: 11px; color: var(--smr-p-text-muted); }
.smr-portal-hamburger {
	display: none; align-items: center; justify-content: center;
	width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--smr-p-border);
	background: var(--smr-p-surface); color: var(--smr-p-text); cursor: pointer; flex-shrink: 0; margin-right: 2px;
}
/* Content is the only part of the shell that scrolls — sidebar and
   topbar stay put, same behaviour as the admin dashboard, at every
   screen size (not just desktop; the app shell is fixed 100vh now on
   mobile too, so mobile needs its own internal scroll just as much).
   Capped + centered so cards keep sensible proportions on wide monitors
   instead of stretching edge-to-edge — the shell itself still spans the
   full browser width, only the content column inside it is bounded. */
.smr-portal-content {
	flex: 1 !important; min-height: 0; overflow-y: auto !important; -webkit-overflow-scrolling: touch;
	padding: 22px 26px 40px !important;
	width: 100% !important;
}
.smr-portal-sidebar-overlay { display: none; }

@media (max-width: 880px) {
	.smr-portal-app { flex-direction: column; }
	.smr-portal-hamburger { display: flex; }
	.smr-portal-sidebar {
		position: absolute; top: 0; bottom: 0; left: 0; z-index: 30; width: 230px;
		transform: translateX(-100%); transition: transform 0.22s ease;
		box-shadow: 12px 0 32px rgba(0, 0, 0, 0.18);
	}
	.smr-portal-app.smr-portal-sidebar-open .smr-portal-sidebar { transform: translateX(0); }
	.smr-portal-sidebar-overlay {
		display: block; position: absolute; inset: 0; background: rgba(6, 20, 24, 0.45); z-index: 25;
		opacity: 0; pointer-events: none; transition: opacity 0.22s ease;
	}
	.smr-portal-app.smr-portal-sidebar-open .smr-portal-sidebar-overlay { opacity: 1; pointer-events: auto; }
	.smr-portal-topbar { padding: 12px 14px; }
	.smr-portal-user-name, .smr-portal-user-role { display: none; }
	.smr-portal-range-pill span { display: none; }
	.smr-portal-content { padding: 20px 16px 36px !important; }
}

/* Dashboard greeting header */
.smr-p-greeting { margin-bottom: 4px; }
.smr-p-greeting h2 { font-size: 19px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 8px; }
.smr-p-greeting-wave { font-size: 18px; }
.smr-p-greeting p { font-size: 12.5px; color: var(--smr-p-text-muted); margin: 3px 0 0; }

/* Quick-action icon grid (Dashboard tab) */
.smr-p-quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 700px) { .smr-p-quick-grid { grid-template-columns: repeat(2, 1fr); } }
.smr-p-quick-btn {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
	padding: 16px 10px; border-radius: 14px; border: 1px solid var(--smr-p-border);
	background: var(--smr-p-surface); color: var(--smr-p-text); font-size: 12px; font-weight: 600; font-family: inherit;
	cursor: pointer; text-align: center;
}
.smr-p-quick-btn svg { color: var(--smr-p-brand); }
.smr-p-quick-btn:hover { border-color: var(--smr-p-brand) !important; background: var(--smr-p-tint) !important; color: var(--smr-p-text) !important; }

/* Filter-tab pill row (My Trips / Bookings) */
.smr-p-filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.smr-p-filter-tab {
	padding: 7px 14px; border-radius: 999px; border: 1px solid var(--smr-p-border);
	background: var(--smr-p-surface); color: var(--smr-p-text-muted); font-size: 12.5px; font-weight: 600;
	font-family: inherit; cursor: pointer; white-space: nowrap;
}
.smr-p-filter-tab:hover { border-color: var(--smr-p-brand) !important; color: var(--smr-p-brand) !important; background: var(--smr-p-surface) !important; }
.smr-p-filter-tab.active { background: var(--smr-p-brand); border-color: var(--smr-p-brand); color: #fff; }

/* Earnings-tab weekly total row (under the bar chart) */
.smr-p-earn-total { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--smr-p-border); }
.smr-p-earn-total-label { display: block; font-size: 12px; color: var(--smr-p-text-muted); }
.smr-p-earn-total strong { font-size: 18px; font-weight: 700; }
.smr-p-earn-trend { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.smr-p-earn-trend-up { background: var(--smr-p-green-tint); color: #047857; }
.smr-p-earn-trend-down { background: var(--smr-p-red-tint); color: #b91c1c; }

/* 4-column stat row (Dashboard tab), collapsing like the rest of the grid */
.smr-p-stats-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .smr-p-stats-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .smr-p-stats-4 { grid-template-columns: 1fr; } }

.smr-p-dash-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; }
@media (max-width: 900px) { .smr-p-dash-grid { grid-template-columns: 1fr; } }

/* ---------- Line chart (reuses admin/views/partials/charts.php) ---------- */
.smr-linechart-wrap { padding: 4px 4px 0; }
.smr-linechart svg { width: 100%; height: auto; display: block; }
.smr-linechart-empty { display: flex; align-items: center; justify-content: center; height: 180px; color: var(--smr-p-text-faint); font-size: 13px; }

/* ---------- Donut chart (reuses admin/views/partials/charts.php) ---------- */
.smr-donut-row { display: flex; align-items: center; gap: 18px; }
.smr-donut { width: 100px; height: 100px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.smr-donut-hole { width: 64px; height: 64px; border-radius: 50%; background: var(--smr-p-surface); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.smr-donut-hole strong { font-size: 14px; font-weight: 700; line-height: 1.1; }
.smr-donut-hole span { font-size: 9px; color: var(--smr-p-text-muted); }
.smr-legend { list-style: none; margin: 0; padding: 0; font-size: 12.5px; flex: 1; }
.smr-legend li { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; }
.smr-legend-label { display: flex; align-items: center; gap: 7px; color: var(--smr-p-text); }
.smr-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.smr-legend-pct { font-weight: 700; color: var(--smr-p-text-muted); }

/* Alias for the "no data" state charts.php renders (class name is
   hardcoded there as .smr-empty; keep it visually identical to .smr-p-empty). */
.smr-empty { text-align: center; padding: 34px 16px; color: var(--smr-p-text-faint); }
.smr-empty svg { margin-bottom: 8px; opacity: 0.55; }
.smr-empty p { margin: 0; font-size: 13px; color: var(--smr-p-text-muted); }

/* ---------- Panels & cards ---------- */
.smr-portal-panel { display: flex; flex-direction: column; gap: 18px; }
.smr-portal-panel[hidden] { display: none; }
.smr-p-card {
	background: var(--smr-p-surface);
	border: 1px solid var(--smr-p-border);
	border-radius: 18px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 24px rgba(15, 41, 66, 0.03);
	padding: 20px 22px;
}
.smr-p-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }
.smr-p-card-head h3 { font-size: 15px; font-weight: 700; margin: 0; }
.smr-p-card-head p { font-size: 12.5px; color: var(--smr-p-text-muted); margin: 3px 0 0; }

/* Stat tiles */
.smr-p-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 700px) { .smr-p-stats { grid-template-columns: 1fr; } }
.smr-p-stat {
	background: var(--smr-p-surface); border: 1px solid var(--smr-p-border); border-radius: 16px;
	padding: 16px 18px;
}
.smr-p-stat-icon {
	width: 34px; height: 34px; border-radius: 10px; margin-bottom: 10px;
	background: var(--smr-p-tint); color: var(--smr-p-brand-dark);
	display: flex; align-items: center; justify-content: center;
}
.smr-p-stat-label { font-size: 12px; color: var(--smr-p-text-muted); font-weight: 500; }
.smr-p-stat-value { font-size: 21px; font-weight: 700; margin-top: 4px; }
.smr-p-stat-sub { font-size: 11.5px; color: var(--smr-p-text-faint); margin-top: 3px; }

/* Rows / list items */
.smr-p-list { display: flex; flex-direction: column; }
.smr-p-row {
	display: flex; align-items: center; gap: 12px;
	padding: 14px 4px;
	border-bottom: 1px solid var(--smr-p-border);
	flex-wrap: wrap;
}
.smr-p-row:last-child { border-bottom: none; }
.smr-p-avatar {
	width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
	background: var(--smr-p-tint); color: var(--smr-p-brand-dark);
	display: flex; align-items: center; justify-content: center;
}
.smr-p-row-main { flex: 1; min-width: 160px; }
.smr-p-row-title { font-size: 13.5px; font-weight: 700; }
.smr-p-row-sub { font-size: 12px; color: var(--smr-p-text-muted); margin-top: 2px; }
.smr-p-row-amount { font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.smr-p-row-actions { display: flex; gap: 8px; }

/* Badges */
.smr-p-badge {
	display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
	font-size: 11px; font-weight: 700; white-space: nowrap;
}
.smr-p-badge-teal { background: var(--smr-p-tint); color: var(--smr-p-brand-dark); }
.smr-p-badge-green { background: var(--smr-p-green-tint); color: #047857; }
.smr-p-badge-orange { background: var(--smr-p-orange-tint); color: #b45309; }
.smr-p-badge-red { background: var(--smr-p-red-tint); color: #b91c1c; }
.smr-p-badge-gray { background: var(--smr-p-gray-tint); color: var(--smr-p-text-muted); }

/* Buttons */
.smr-p-btn {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 8px 14px; border-radius: 10px; border: none;
	background: var(--smr-p-brand); color: #fff;
	font-size: 12.5px; font-weight: 700; cursor: pointer; font-family: inherit;
	white-space: nowrap;
}
.smr-p-btn:hover { background: var(--smr-p-brand-dark); }
.smr-p-btn-ghost { background: var(--smr-p-surface); color: var(--smr-p-text); border: 1px solid var(--smr-p-border); }
.smr-p-btn-ghost:hover { border-color: var(--smr-p-brand) !important; color: var(--smr-p-brand) !important; background: var(--smr-p-surface) !important; }
.smr-p-btn-danger { background: var(--smr-p-surface); color: var(--smr-p-red); border: 1px solid #fecaca; }
.smr-p-btn-danger:hover { background: var(--smr-p-red-tint); }
.smr-p-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Forms (add vehicle) */
.smr-p-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .smr-p-form-grid { grid-template-columns: 1fr; } }
.smr-p-field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--smr-p-text-muted); }
.smr-p-field input, .smr-p-field select {
	width: 100%; padding: 9px 12px; border: 1px solid var(--smr-p-border);
	border-radius: 10px; font-size: 13.5px; font-family: inherit; color: var(--smr-p-text);
	background: var(--smr-p-surface);
}
.smr-p-field input:focus, .smr-p-field select:focus {
	outline: none; border-color: var(--smr-p-brand); box-shadow: 0 0 0 3px rgba(0, 128, 140, 0.12);
}

/* Empty state */
.smr-p-empty { text-align: center; padding: 34px 16px; color: var(--smr-p-text-faint); }
.smr-p-empty svg { margin-bottom: 8px; opacity: 0.55; }
.smr-p-empty p { margin: 0 0 2px; font-size: 13px; color: var(--smr-p-text-muted); }
.smr-p-empty span { font-size: 12px; }

/* Inline form feedback */
.smr-p-feedback { font-size: 12.5px; margin-top: 10px; display: none; }
.smr-p-feedback.is-visible { display: block; }
.smr-p-feedback.is-error { color: var(--smr-p-red); }
.smr-p-feedback.is-success { color: var(--smr-p-green); }

/* ---------- Live Map ---------- */
.smr-p-map-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.smr-p-map-head h3 { font-size: 15px; font-weight: 700; margin: 0; }
.smr-p-map-head p { font-size: 12.5px; color: var(--smr-p-text-muted); margin: 3px 0 0; }
.smr-p-map-head-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.smr-p-map-status {
	display: inline-flex; align-items: center; gap: 6px;
	font-size: 12px; font-weight: 600; color: var(--smr-p-text-muted);
}
.smr-p-map-status::before {
	content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--smr-p-text-faint); flex-shrink: 0;
}
.smr-p-map-status.is-online { color: var(--smr-p-green); }
.smr-p-map-status.is-online::before { background: var(--smr-p-green); box-shadow: 0 0 0 3px var(--smr-p-green-tint); }
.smr-p-map-online-toggle {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 8px 16px; border-radius: 999px; border: none;
	background: var(--smr-p-brand); color: #fff;
	font-size: 12.5px; font-weight: 700; cursor: pointer; font-family: inherit; white-space: nowrap;
}
.smr-p-map-online-toggle:hover { background: var(--smr-p-brand-dark); }
.smr-p-map-online-toggle.is-online { background: var(--smr-p-red); }
.smr-p-map-online-toggle.is-online:hover { background: #b91c1c; }
.smr-p-map-count { font-size: 12.5px; font-weight: 600; color: var(--smr-p-text-muted); }
.smr-p-map-count strong { color: var(--smr-p-text); font-weight: 700; }
.smr-map-canvas {
	width: 100%; height: 460px; border-radius: 16px; overflow: hidden;
	border: 1px solid var(--smr-p-border); background: var(--smr-p-gray-tint);
}
.smr-p-map-empty { margin-top: 10px; }

/* ---------- Role switcher (topbar) ---------- */
.smr-role-switch { position: relative; }
.smr-role-switch-toggle {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 7px 12px; border: 1px solid var(--smr-p-border); border-radius: 999px;
	background: var(--smr-p-surface); color: var(--smr-p-text); cursor: pointer;
	font-size: 12.5px; font-weight: 600; font-family: inherit;
}
.smr-role-switch-toggle:hover { border-color: var(--smr-p-brand) !important; background: var(--smr-p-surface) !important; }
.smr-role-switch-current { display: inline-flex; align-items: center; gap: 7px; }
.smr-role-switch-current svg { color: var(--smr-p-brand); }
.smr-role-switch-toggle > svg:last-child { color: var(--smr-p-text-faint); }

.smr-role-switch-menu {
	position: absolute; top: calc(100% + 8px); right: 0; z-index: 400;
	min-width: 236px; background: var(--smr-p-surface); border: 1px solid var(--smr-p-border);
	border-radius: 14px; box-shadow: 0 14px 38px rgba(15, 41, 66, 0.16); padding: 8px;
}
.smr-role-switch-menu-label {
	font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
	color: var(--smr-p-text-faint); padding: 6px 8px 8px;
}
.smr-role-switch-option {
	display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
	padding: 10px 10px; border: none; border-radius: 10px; background: none; cursor: pointer;
	font-family: inherit; color: var(--smr-p-text); margin-bottom: 2px;
}
.smr-role-switch-option:hover:not(:disabled) { background: var(--smr-p-gray-tint) !important; }
.smr-role-switch-option:disabled { opacity: 0.55; cursor: default; }
.smr-role-switch-option.is-current { cursor: default; }
.smr-role-switch-option > svg:first-child { color: var(--smr-p-brand); flex-shrink: 0; }
.smr-role-switch-option span { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.smr-role-switch-option strong { font-size: 13px; font-weight: 700; }
.smr-role-switch-option em { font-size: 11px; font-style: normal; color: var(--smr-p-text-muted); }
.smr-role-switch-check { color: var(--smr-p-brand); flex: none !important; }
.smr-role-switch-badge {
	flex: none !important; font-size: 10px; font-weight: 700; color: var(--smr-p-brand);
	background: var(--smr-p-tint); padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.03em;
}

/* ---------- Range filter dropdown (Daily/Weekly/Monthly/Yearly/Custom) ---------- */
.smr-range-picker { position: relative; display: inline-flex; }
.smr-range-menu {
	position: absolute; top: calc(100% + 8px); right: 0; z-index: 300;
	min-width: 190px; background: var(--smr-p-surface); border: 1px solid var(--smr-p-border);
	border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
	padding: 6px;
}
.smr-range-menu-item {
	display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px;
	border: none; background: none; color: var(--smr-p-text); font-size: 13px; font-weight: 600;
	cursor: pointer; font-family: inherit;
}
.smr-range-menu-item:hover { background: var(--smr-p-gray-tint); }
.smr-range-menu-item.is-active { background: var(--smr-p-brand); color: #fff; }
.smr-range-custom {
	margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--smr-p-border);
	display: flex; flex-direction: column; gap: 8px;
}
.smr-range-custom label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--smr-p-text-muted); }
.smr-range-custom input[type="date"] {
	border: 1px solid var(--smr-p-border); border-radius: 8px; padding: 7px 9px;
	font-size: 12.5px; font-family: inherit; color: var(--smr-p-text); background: var(--smr-p-gray-tint);
}
.smr-range-custom-apply {
	margin-top: 2px; padding: 8px 12px; border: none; border-radius: 8px;
	background: var(--smr-p-brand); color: #fff; font-size: 12.5px; font-weight: 700;
	cursor: pointer; font-family: inherit;
}
.smr-range-custom-apply:hover { background: var(--smr-p-brand-dark); }

/* Custom Leaflet marker — a simple colored dot instead of the default pin. */
.smr-map-car-dot {
	display: block; width: 14px; height: 14px; border-radius: 50%;
	background: var(--smr-p-brand); border: 2px solid #fff;
	box-shadow: 0 0 0 3px rgba(0, 128, 140, 0.35), 0 1px 4px rgba(0, 0, 0, 0.25);
}
.smr-map-car-dot-self {
	background: var(--smr-p-orange);
	box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.35), 0 1px 4px rgba(0, 0, 0, 0.25);
}
/* Dark mode: invert the raster map tiles (a standard trick for OSM,
   since the tiles themselves are just images and can't read our color
   variables) so the map doesn't stay a bright white rectangle inside an
   otherwise dark shell. Markers/popups are excluded so they keep their
   real colors. */
.smr-portal-app[data-smr-theme="dark"] .smr-map-canvas .leaflet-tile-pane {
	filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.9);
}
.smr-portal-app[data-smr-theme="dark"] .smr-map-canvas .leaflet-marker-icon,
.smr-portal-app[data-smr-theme="dark"] .smr-map-canvas .leaflet-popup {
	filter: none;
}


.smr-p-sos-wrap { position: fixed; right: 22px; bottom: 22px; z-index: 40; }
#smr-sos-button {
	display: flex; align-items: center; gap: 8px;
	padding: 13px 20px; border-radius: 999px; border: none;
	background: var(--smr-p-red); color: #fff;
	font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
	box-shadow: 0 6px 20px rgba(220, 38, 38, 0.35);
}
#smr-sos-button:hover { background: #b91c1c; }

@media (max-width: 640px) {
	.smr-portal-tabs { gap: 6px; }
	.smr-portal-tabs button { padding: 8px 12px; font-size: 12.5px; }
	.smr-p-row-actions { width: 100%; justify-content: flex-end; }
}

/* Quick actions on the Dashboard tab */
.smr-p-quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Bridge for the legacy unstyled ride-search / post-ride
   forms when embedded inline (Find a Ride / Create Trip tabs) ---------- */
.smr-p-card .smr-widget fieldset {
	border: 1px solid var(--smr-p-border); border-radius: 14px;
	padding: 14px 16px; margin: 0 0 16px;
}
.smr-p-card .smr-widget legend { font-size: 12.5px; font-weight: 700; padding: 0 6px; }
.smr-p-card .smr-widget label { display: block; font-size: 12.5px; font-weight: 600; color: var(--smr-p-text-muted); margin-bottom: 12px; }
.smr-p-card .smr-widget input[type="text"],
.smr-p-card .smr-widget input[type="date"],
.smr-p-card .smr-widget input[type="time"],
.smr-p-card .smr-widget input[type="number"],
.smr-p-card .smr-widget select {
	display: block; width: 100%; margin-top: 6px; box-sizing: border-box;
	padding: 9px 12px; border: 1px solid var(--smr-p-border); border-radius: 10px;
	font-size: 13.5px; font-family: inherit; color: var(--smr-p-text); background: var(--smr-p-surface);
}
.smr-p-card .smr-widget input[type="checkbox"] { accent-color: var(--smr-p-brand); margin-right: 6px; }
.smr-p-card .smr-widget button[type="submit"],
.smr-p-card .smr-widget button#smr-add-waypoint {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 10px 16px; border-radius: 10px; border: none;
	background: var(--smr-p-brand); color: #fff;
	font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.smr-p-card .smr-widget button#smr-add-waypoint { background: var(--smr-p-surface); color: var(--smr-p-text); border: 1px solid var(--smr-p-border); margin-bottom: 14px; }
.smr-p-card .smr-widget button[type="submit"]:hover { background: var(--smr-p-brand-dark); }
.smr-p-card #smr-post-ride-message, .smr-p-card #smr-search-results { font-size: 13px; color: var(--smr-p-text-muted); margin-top: 12px; }

/* ---------- Create Trip form (reuses #smr-post-ride-form from post-ride.php) ---------- */
.smr-p-card #smr-post-ride-form fieldset {
	border: none; margin: 0 0 18px; padding: 0;
}
.smr-p-card #smr-post-ride-form legend {
	font-size: 12.5px; font-weight: 700; color: var(--smr-p-text); margin-bottom: 10px; padding: 0;
}
.smr-p-card #smr-post-ride-form label {
	display: block; font-size: 12.5px; font-weight: 600; color: var(--smr-p-text-muted); margin-bottom: 12px;
}
.smr-p-card #smr-post-ride-form input,
.smr-p-card #smr-post-ride-form select {
	display: block; width: 100%; margin-top: 6px;
	padding: 9px 12px; border: 1px solid var(--smr-p-border);
	border-radius: 10px; font-size: 13.5px; font-family: inherit; color: var(--smr-p-text);
	background: var(--smr-p-surface);
	box-sizing: border-box;
}
.smr-p-card #smr-post-ride-form input[type="checkbox"] { width: auto; display: inline-block; margin: 0 6px 0 0; }
.smr-p-card #smr-post-ride-form input:focus,
.smr-p-card #smr-post-ride-form select:focus {
	outline: none; border-color: var(--smr-p-brand); box-shadow: 0 0 0 3px rgba(0, 128, 140, 0.12);
}
.smr-p-card #smr-post-ride-form #smr-add-waypoint {
	background: none; border: 1px dashed var(--smr-p-border); border-radius: 10px;
	padding: 8px 12px; font-size: 12.5px; color: var(--smr-p-text-muted); cursor: pointer; font-family: inherit;
}
.smr-p-note {
	font-size: 12px; color: var(--smr-p-text-faint); background: var(--smr-p-gray-tint);
	border-radius: 10px; padding: 10px 12px; margin-bottom: 16px;
}

/* ---------- Reviews ---------- */
.smr-p-rating-summary { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.smr-p-rating-summary strong { font-size: 26px; font-weight: 700; }
.smr-p-rating-stars { color: #f59e0b; display: flex; gap: 2px; }
.smr-p-review-comment { font-size: 12.5px; color: var(--smr-p-text-muted); margin-top: 4px; line-height: 1.5; }

/* ---------- Profile / Settings ---------- */
.smr-p-profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.smr-p-profile-avatar {
	width: 56px; height: 56px; border-radius: 16px; flex-shrink: 0; overflow: hidden;
	background: var(--smr-p-tint); color: var(--smr-p-brand-dark);
	display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700;
}
.smr-p-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.smr-p-profile-avatar-picker { position: relative; display: inline-block; cursor: pointer; flex-shrink: 0; }
.smr-p-profile-avatar-edit {
	position: absolute; bottom: -4px; right: -4px; width: 22px; height: 22px; border-radius: 50%;
	background: var(--smr-p-brand); color: #fff; border: 2px solid var(--smr-p-surface);
	display: flex; align-items: center; justify-content: center;
}
.smr-p-btn-primary {
	padding: 10px 24px; border: none; border-radius: 10px; background: var(--smr-p-brand); color: #fff;
	font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.smr-p-btn-primary:hover { background: var(--smr-p-brand-dark); }
.smr-p-btn-primary:disabled, .smr-p-btn-ghost:disabled { opacity: 0.6; cursor: not-allowed; }
#smr-profile-password-form { margin-top: 16px; }
.smr-p-kv { display: flex; flex-direction: column; gap: 0; }
.smr-p-kv-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--smr-p-border); font-size: 13px; }
.smr-p-kv-row:last-child { border-bottom: none; }
.smr-p-kv-row span:first-child { color: var(--smr-p-text-muted); }
.smr-p-kv-row span:last-child { font-weight: 600; }

