/* ClioPlay Link v3.0 — Exact Carminat Glassmorphic Design System
 * Exact RGB565 palettes ported from ClioPlay clio040.c + hud_glass.h
 * Full logical CSS for native RTL (ar / he), System/Dark/Light theme parity. */

:root {
  color-scheme: dark;
  /* Night theme (clio040.c exact RGB565 conversions) */
  --bg: #041214;            /* C_BG 0x0082 */
  --bg-elev: #08181a;       /* C_HEADER 0x08c3 */
  --panel: rgba(16, 28, 34, 0.78);   /* C_PANEL 0x10e4 glass */
  --panel-solid: #101c22;
  --panel2: rgba(24, 38, 48, 0.86);  /* C_PANEL2 0x1926 */
  --border: rgba(88, 122, 144, 0.34); /* C_BORDER 0x39e9 */
  --rim: rgba(240, 248, 255, 0.14);   /* hud_glass.h 1px specular top rim */
  --ink: #f4f7fa;           /* C_WHITE 0xf7bf */
  --muted: #9aaeb8;         /* C_MUTED 0x9d76 */
  --cyan: #639eff;          /* C_CYAN 0x64ff */
  --active-bg: #18445c;     /* C_ACTIVE 0x1a2b */
  --active-ink: #ffffff;
  --route: #ff66b5;         /* C_ROUTE 0xfb36 */
  --route-future: #a575ff;  /* C_ROUTE_FUTURE 0xa3bf */
  --diversion: #63dbb8;     /* C_ROUTE_DIVERSION 0x66d8 */
  --car: #f79c42;           /* C_CAR 0xf4e8 */
  --success: #34d399;
  --warn: #f59e0b;
  --danger: #f87171;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.42);
  --radius: 16px;
  --radius-sm: 12px;
  --nav-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="light"] {
  color-scheme: light;
  /* Day theme (clio040.c exact RGB565 conversions) */
  --bg: #eceeed;            /* C_BG 0xef7d */
  --bg-elev: #e4e7e6;       /* C_HEADER 0xe73c */
  --panel: rgba(246, 247, 246, 0.84); /* C_PANEL 0xf7be glass */
  --panel-solid: #f6f7f6;
  --panel2: rgba(230, 234, 234, 0.90); /* C_PANEL2 0xe71c */
  --border: rgba(130, 146, 156, 0.34); /* C_BORDER 0xb618 */
  --rim: rgba(255, 255, 255, 0.82);
  --ink: #102831;           /* C_WHITE 0x1146 */
  --muted: #526872;         /* C_MUTED 0x534e */
  --cyan: #0373dd;          /* C_CYAN 0x039b */
  --active-bg: #0373dd;     /* C_ACTIVE 0x039b */
  --active-ink: #ffffff;
  --route: #e62a84;         /* C_ROUTE 0xe150 */
  --route-future: #7b5fd6;  /* C_ROUTE_FUTURE 0x7afa */
  --diversion: #087c84;     /* C_ROUTE_DIVERSION 0x0bf0 */
  --car: #eb701a;           /* C_CAR 0xeb83 */
  --success: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow: 0 10px 26px rgba(16, 40, 49, 0.10);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.42;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

body {
  background-image:
    radial-gradient(ellipse 85% 45% at 50% -10%, color-mix(in srgb, var(--cyan) 14%, transparent), transparent 70%),
    radial-gradient(ellipse 65% 35% at 85% 100%, color-mix(in srgb, var(--route) 8%, transparent), transparent 65%);
  background-attachment: fixed;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

input, textarea, select {
  font-size: 16px; /* Prevents iOS Safari auto-zoom */
}

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  touch-action: manipulation;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* App Frame */
.app-frame {
  max-width: 520px;
  margin-inline: auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
}

/* Top App Bar (Carminat HUD frosted header) */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding-top: var(--safe-top);
  background: color-mix(in srgb, var(--bg-elev) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border-bottom: 1px solid var(--border);
}

.app-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, #0d6efd, #0345a6);
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 12px rgba(3, 115, 221, 0.35);
  flex-shrink: 0;
}
.brand-mark svg { width: 24px; height: 24px; }

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.brand-text span {
  font-size: 10px;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--muted);
}
.brand-text strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.app-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bar-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--ink);
}
.bar-pill svg { width: 15px; height: 15px; }
.bar-pill-accent {
  background: var(--cyan);
  color: #ffffff;
  border-color: transparent;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--ink);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.status-pill.ready .status-dot { background: var(--cyan); }
.status-pill.linked .status-dot { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-pill.sending .status-dot { background: var(--car); animation: pulseDot 0.9s infinite; }
.status-pill.sent .status-dot { background: var(--success); }
.status-pill.error .status-dot { background: var(--danger); }

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.6; }
}

/* Main content */
.app-content {
  flex: 1;
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.app-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Frosted Glass Carminat Surface (matches hud_glass.h) */
.surface {
  background: var(--panel);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 var(--rim), var(--shadow);
  padding: 14px;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-inline: 2px;
}
.view-header h1, .view-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.view-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Chips & Pills */
.chip-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 0 11px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.chip-button svg { width: 15px; height: 15px; }
.chip-button:active { transform: scale(0.97); }
.chip-button.active { background: var(--active-bg); color: var(--active-ink); border-color: var(--cyan); }
.chip-button.chip-danger { color: var(--danger); }

.pill-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--ink);
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}
.pill-action svg { width: 16px; height: 16px; flex-shrink: 0; }
.pill-action:active { transform: scale(0.98); }
.pill-action-primary {
  background: var(--active-bg);
  color: var(--active-ink);
  border-color: color-mix(in srgb, var(--cyan) 65%, transparent);
}
.pill-action-accent {
  background: var(--cyan);
  color: #ffffff;
  border-color: transparent;
}
.pill-action-danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}

.value-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: color-mix(in srgb, var(--cyan) 16%, transparent);
  color: var(--cyan);
}
.value-pill.warn {
  background: color-mix(in srgb, var(--warn) 18%, transparent);
  color: var(--warn);
}
.value-pill.ok {
  background: color-mix(in srgb, var(--success) 18%, transparent);
  color: var(--success);
}

/* Release Notice Banner */
.release-notice {
  background: color-mix(in srgb, var(--cyan) 12%, var(--panel-solid));
  border: 1px solid color-mix(in srgb, var(--cyan) 38%, transparent);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.release-row { display: flex; align-items: center; gap: 8px; }
.release-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: start;
  min-height: 40px;
}
.release-icon { width: 18px; height: 18px; color: var(--cyan); flex-shrink: 0; }
.release-label { flex: 1; display: flex; flex-direction: column; }
.release-label strong { font-size: 13.5px; }
.release-label small { font-size: 12px; color: var(--muted); }
.release-chevron { width: 18px; height: 18px; color: var(--muted); transition: transform 0.2s; }
.release-toggle[aria-expanded="true"] .release-chevron { transform: rotate(180deg); }
.release-dismiss {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted);
}
.release-dismiss svg { width: 16px; height: 16px; }
.release-details { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; }
.release-details ul { margin: 0 0 8px; padding-inline-start: 18px; }
.release-details li { margin-bottom: 4px; }
.release-note { margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.release-links { display: flex; gap: 10px; flex-wrap: wrap; }
.release-links a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px;
  border-radius: 10px; font-size: 13px; font-weight: 600; text-decoration: none;
  background: var(--panel2); color: var(--ink); border: 1px solid var(--border);
}
.release-links a.release-primary { background: var(--cyan); color: #ffffff; border-color: transparent; }

/* Unified Omnibox */
.omnibox-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}
.omnibox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 6px 4px 12px;
}
.omnibox-row:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 18%, transparent);
}
.omnibox-icon { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.omnibox-input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  border: none;
  background: transparent;
  outline: none;
  padding: 6px 0;
}
.omnibox-input::placeholder { color: var(--muted); }
.omnibox-inline-btn {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--cyan);
  background: color-mix(in srgb, var(--cyan) 12%, transparent);
  flex-shrink: 0;
}
.omnibox-inline-btn svg { width: 17px; height: 17px; }

.search-results {
  list-style: none;
  margin: 0;
  padding: 4px;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 240px;
  overflow-y: auto;
}
.search-result-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  text-align: start;
  min-height: 44px;
}
.search-result-btn:hover, .search-result-btn:active { background: var(--panel2); }
.search-result-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--cyan) 16%, transparent);
  color: var(--cyan);
  flex-shrink: 0;
}
.search-result-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.search-result-copy strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-copy small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.message.success { color: var(--success); }
.message.warning { color: var(--warn); }
.message.error { color: var(--danger); }

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--cyan);
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.out-of-map-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  background: color-mix(in srgb, var(--warn) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 42%, transparent);
  color: var(--warn);
}
.out-of-map-banner svg { width: 16px; height: 16px; flex-shrink: 0; }

.short-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.manual-panel { padding-top: 4px; }
.coordinate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.coordinate-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.coordinate-grid input {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel2);
}

/* Quick Places Strip */
.quick-strip { display: flex; flex-direction: column; gap: 6px; }
.quick-chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.quick-chips::-webkit-scrollbar { display: none; }
.quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.quick-chip svg { width: 14px; height: 14px; color: var(--cyan); }
.quick-chip.parked svg { color: var(--car); }
.quick-chip.recent svg { color: var(--muted); }

/* Interactive Canvas Mini-Map */
.map-card {
  padding: 0;
  overflow: hidden;
  position: relative;
}
.mini-map-canvas {
  display: block;
  width: 100%;
  height: 196px;
  touch-action: none;
  cursor: grab;
}
.mini-map-canvas:active { cursor: grabbing; }
.map-overlay-bar {
  position: absolute;
  inset-inline: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.map-hint-pill {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: color-mix(in srgb, var(--panel-solid) 86%, transparent);
  border: 1px solid var(--border);
  color: var(--ink);
  backdrop-filter: blur(10px);
}
.map-fit-btn {
  pointer-events: auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--panel-solid) 90%, transparent);
  border: 1px solid var(--border);
  color: var(--cyan);
}
.map-fit-btn svg { width: 16px; height: 16px; }

/* Detected Destination Card */
.destination-card { display: flex; flex-direction: column; gap: 11px; }
.destination-header { display: flex; align-items: flex-start; gap: 10px; }
.pin-badge {
  width: 38px; height: 38px; border-radius: 11px;
  background: color-mix(in srgb, var(--route) 18%, transparent);
  color: var(--route);
  display: grid; place-items: center; flex-shrink: 0;
}
.pin-badge svg { width: 20px; height: 20px; }
.destination-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.destination-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.provider-tag, .confidence-tag {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px;
}
.provider-tag { background: color-mix(in srgb, var(--cyan) 16%, transparent); color: var(--cyan); }
.confidence-tag.exact { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.confidence-tag.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.destination-copy strong { font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coords { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.bookmark-button {
  display: inline-flex; align-items: center; gap: 5px; min-height: 38px; padding: 0 11px;
  border-radius: 10px; font-size: 13px; font-weight: 600;
  background: var(--panel2); border: 1px solid var(--border); color: var(--ink);
}
.bookmark-button svg { width: 15px; height: 15px; }
.bookmark-button.saved { background: color-mix(in srgb, var(--cyan) 18%, transparent); color: var(--cyan); border-color: var(--cyan); }
.bookmark-button.saved svg { fill: currentColor; }

.name-field { display: flex; flex-direction: column; gap: 4px; }
.name-field-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.char-counter.over { color: var(--warn); font-weight: 700; }
.name-field input {
  width: 100%; min-height: 42px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--panel2);
}

.dest-card-footer { display: flex; gap: 8px; }
.dest-trip-btn { flex: 1; }

/* Carminat Vertical Itinerary Progress Rail */
.trip-card { display: flex; flex-direction: column; gap: 10px; }
.trip-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.trip-title-wrap { display: flex; align-items: center; gap: 8px; }
.trip-title-wrap h2 { margin: 0; font-size: 16px; }
.trip-header-actions { display: flex; align-items: center; gap: 6px; }

.trip-rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.rail-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  min-height: 54px;
}
.rail-row.is-passed .rail-copy strong { color: var(--muted); text-decoration: line-through; }
.rail-row.tx-active .rail-copy { background: color-mix(in srgb, var(--cyan) 14%, transparent); }
.rail-row.tx-done .rail-node { background: var(--success); border-color: var(--success); color: #fff; }

.rail-track {
  width: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex-shrink: 0;
}
.rail-stem {
  flex: 1;
  width: 3px;
  background: var(--border);
  border-radius: 2px;
}
.rail-stem.hidden-stem { opacity: 0; }
.rail-stem.travelled { background: var(--route); }

.rail-node {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--cyan);
  background: var(--panel-solid);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  z-index: 1;
}
.rail-node.active {
  background: transparent;
  border: 3px solid var(--cyan);
  box-shadow: 0 0 10px color-mix(in srgb, var(--cyan) 55%, transparent);
}
.rail-node.final {
  border-radius: 6px;
  border-color: var(--route);
  background: var(--route);
  color: #ffffff;
}
.rail-node.done {
  border-color: var(--success);
  background: var(--success);
  color: #ffffff;
}
.rail-live-car {
  position: absolute;
  top: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--car);
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px var(--car);
  z-index: 2;
}

.rail-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: start;
  padding: 6px 8px;
  border-radius: 10px;
}
.rail-copy:active { background: var(--panel2); }
.rail-copy strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-copy small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.trip-row-controls {
  display: flex;
  align-items: center;
  gap: 2px;
}
.trip-ctrl-btn {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--muted);
}
.trip-ctrl-btn svg { width: 16px; height: 16px; }
.trip-ctrl-btn:hover { background: var(--panel2); color: var(--ink); }
.trip-ctrl-btn.danger:hover { color: var(--danger); }

/* Action Switch */
.action-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.action-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--border);
  text-align: start;
  min-height: 56px;
}
.action-option.selected {
  background: var(--active-bg);
  color: var(--active-ink);
  border-color: var(--cyan);
}
.action-option.selected small { color: rgba(255, 255, 255, 0.80); }
.action-icon { width: 22px; height: 22px; flex-shrink: 0; color: var(--cyan); }
.action-option.selected .action-icon { color: #ffffff; }
.action-copy { display: flex; flex-direction: column; min-width: 0; }
.action-copy strong { font-size: 13.5px; }
.action-copy small { font-size: 11.5px; color: var(--muted); }

/* Smart Send Dock */
.send-dock { display: flex; flex-direction: column; gap: 8px; }
.send-button {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 60px;
  padding: 10px 16px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: start;
  background: linear-gradient(135deg, #0b74e5, #0354b5);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.30), 0 10px 24px rgba(3, 115, 221, 0.34);
  transition: transform 0.12s, background 0.2s;
}
.send-button:active:not(:disabled) { transform: scale(0.985); }
.send-button.trip-mode { background: linear-gradient(135deg, #d62d82, #8d29a8); }
.send-button.sending { background: linear-gradient(135deg, #1b4f7a, #0e3452); }
.send-button.sent { background: linear-gradient(135deg, #059669, #047857); }
.send-icon { width: 24px; height: 24px; flex-shrink: 0; }
.send-copy { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.send-copy strong { font-size: 16px; font-weight: 700; }
.send-copy small { font-size: 12px; opacity: 0.88; }
.send-duration-badge {
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}
.send-progress {
  position: absolute; inset-inline: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, 0.16);
}
.send-progress-fill {
  display: block; height: 100%; width: 0%; background: #ffffff; transition: width 0.08s linear;
}

.remote-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Places Tab */
.sync-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.parked-card { display: flex; flex-direction: column; gap: 10px; }
.parked-top { display: flex; align-items: center; gap: 11px; }
.parked-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: color-mix(in srgb, var(--car) 18%, transparent);
  color: var(--car); display: grid; place-items: center; flex-shrink: 0;
}
.parked-icon svg { width: 22px; height: 22px; }
.parked-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.parked-copy small { font-size: 12px; color: var(--muted); }
.parked-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.parked-actions .pill-action { flex: 1; min-width: 0; min-height: 38px; padding: 0 7px; font-size: 12px; white-space: nowrap; }

.pinned-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pinned-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--border);
  text-align: start;
  min-height: 60px;
}
.pinned-card svg { width: 20px; height: 20px; color: var(--cyan); flex-shrink: 0; }
.pinned-card-copy { min-width: 0; display: flex; flex-direction: column; }
.pinned-card-copy strong { font-size: 14px; }
.pinned-card-copy small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.segmented-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--panel2);
  border: 1px solid var(--border);
}
.segmented-tab {
  min-height: 36px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.segmented-tab.selected {
  background: var(--active-bg);
  color: var(--active-ink);
}

.places-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.place-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--border);
}
.place-load {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: start; min-height: 44px;
}
.place-avatar {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--cyan) 16%, transparent); color: var(--cyan); flex-shrink: 0;
}
.place-avatar.recent { background: var(--panel2); color: var(--muted); }
.place-avatar svg { width: 17px; height: 17px; }
.place-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.place-title-line { display: flex; align-items: center; gap: 6px; }
.place-title-line strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-text small { font-size: 11.5px; color: var(--muted); }

.phone-only-dot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--warn) 18%, transparent);
  color: var(--warn);
  flex-shrink: 0;
}
.phone-only-dot::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%; background: var(--warn);
}

.place-actions { display: flex; align-items: center; gap: 2px; }
.place-icon-btn {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: var(--muted);
}
.place-icon-btn svg { width: 16px; height: 16px; }
.place-icon-btn:hover { background: var(--panel2); color: var(--ink); }
.place-icon-btn.danger:hover { color: var(--danger); }
.place-icon-btn.saved { color: var(--cyan); }

.empty-state {
  text-align: center;
  padding: 28px 18px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.empty-state strong { color: var(--ink); font-size: 15px; }
.empty-state p { margin: 0; font-size: 13px; max-width: 300px; }

/* Car Tab — Hero, Driving Insights, Car Settings */
.car-hero { display: flex; flex-direction: column; gap: 12px; }
.car-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.car-hero-meta { display: flex; flex-direction: column; gap: 3px; }
.car-hero-meta strong { font-size: 16.5px; }
.car-hero-meta small { font-size: 12.5px; color: var(--muted); }
.car-hero-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.car-hero-actions .pill-action { min-height: 40px; font-size: 12.5px; padding: 0 8px; }

.sync-status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--panel2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.sync-status-strip .chip-button {
  white-space: nowrap;
  flex-shrink: 0;
}
.sync-status-strip.synced {
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
  color: var(--success);
}
.sync-status-strip.dirty {
  border-color: color-mix(in srgb, var(--warn) 48%, transparent);
  color: var(--warn);
}

/* Driving Insights Visualiser */
.insights-card { display: flex; flex-direction: column; gap: 12px; }
#insightsContainer { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-head h3 { margin: 0; font-size: 16px; }
.insights-empty { font-size: 13px; color: var(--muted); padding: 8px 0; }

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.kpi-tile {
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--panel2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kpi-tile strong { font-size: 18px; font-variant-numeric: tabular-nums; color: var(--cyan); }
.kpi-tile small { font-size: 11.5px; color: var(--muted); }

.rhythm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.rhythm-card {
  padding: 10px;
  border-radius: 12px;
  background: var(--panel2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rhythm-title { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.bar-chart {
  height: 68px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
}
.bar-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}
.bar-fill {
  width: 100%;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, var(--cyan), color-mix(in srgb, var(--cyan) 50%, transparent));
  min-height: 4px;
}
.bar-fill.accent {
  background: linear-gradient(180deg, var(--route), color-mix(in srgb, var(--route) 48%, transparent));
}
.bar-col small { font-size: 9.5px; color: var(--muted); height: 12px; }

.insight-block { display: flex; flex-direction: column; gap: 7px; }
.insight-block h4 { margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.pace-list { display: flex; flex-direction: column; gap: 6px; }
.pace-row {
  display: grid;
  grid-template-columns: 96px 1fr 44px;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}
.pace-track {
  height: 7px;
  border-radius: 999px;
  background: var(--panel2);
  overflow: hidden;
}
.pace-bar { display: block; height: 100%; border-radius: 999px; background: var(--cyan); }
.pace-bar.fast { background: var(--car); }
.pace-bar.calm { background: var(--diversion); }
.pace-row strong { text-align: end; font-size: 12px; font-variant-numeric: tabular-nums; }
.cold-pace-note { font-size: 12px; color: var(--muted); }

.intel-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.intel-badge {
  font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--border); color: var(--ink);
}

.insight-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.insight-row-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--panel2);
  border: 1px solid var(--border);
  text-align: start;
  min-height: 44px;
}
.insight-row-btn strong { font-size: 13.5px; }
.insight-drive-copy { display: flex; flex-direction: column; min-width: 0; }
.insight-drive-copy small { font-size: 11.5px; color: var(--muted); }

/* Car Settings Grid & Sticky Apply Bar */
.settings-group { display: flex; flex-direction: column; gap: 10px; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 10px;
  transition: background 0.15s;
}
.setting-row.modified {
  background: color-mix(in srgb, var(--warn) 11%, transparent);
  box-shadow: inset 3px 0 0 var(--warn);
}
[dir="rtl"] .setting-row.modified {
  box-shadow: inset -3px 0 0 var(--warn);
}
.setting-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.setting-label strong { font-size: 14px; font-weight: 600; }
.setting-label small { font-size: 11.5px; color: var(--muted); }

.setting-select {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel2);
  font-size: 13.5px;
  font-weight: 600;
  max-width: 170px;
}
.setting-range-wrap { display: flex; align-items: center; gap: 8px; }
.setting-range { width: 110px; accent-color: var(--cyan); }
.setting-time {
  min-height: 36px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel2);
  font-size: 13.5px;
}

.toggle-switch {
  width: 48px; height: 28px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--border);
  position: relative; flex-shrink: 0; transition: background 0.18s;
}
.toggle-switch::after {
  content: "";
  position: absolute; top: 3px; inset-inline-start: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #ffffff; box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  transition: transform 0.18s;
}
.toggle-switch[aria-checked="true"] {
  background: var(--cyan); border-color: var(--cyan);
}
.toggle-switch[aria-checked="true"]::after {
  transform: translateX(20px);
}
[dir="rtl"] .toggle-switch[aria-checked="true"]::after {
  transform: translateX(-20px);
}

.sticky-apply-bar {
  position: sticky;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 8px);
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-solid) 94%, transparent);
  border: 1px solid var(--cyan);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
}
.sticky-apply-bar .pill-action-accent { flex: 1; }

.duration-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.duration-pill {
  min-width: 44px; min-height: 36px; border-radius: 9px;
  font-size: 13px; font-weight: 600;
  background: var(--panel2); border: 1px solid var(--border);
}
.duration-pill.selected { background: var(--active-bg); color: var(--active-ink); border-color: var(--cyan); }

.shortcut-box {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--border);
}
.shortcut-box code { flex: 1; font-size: 11.5px; overflow-x: auto; white-space: nowrap; }

.collapsible-details summary {
  cursor: pointer; font-weight: 600; font-size: 14px; list-style: none;
  display: flex; align-items: center; justify-content: space-between; min-height: 36px;
}
.collapsible-details summary::-webkit-details-marker { display: none; }
.collapsible-body { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; }

/* Bottom Tab Bar (Navigate · Places · Car) */
.bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 40;
  padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-top: 1px solid var(--border);
}
.bottom-nav-inner {
  max-width: 520px;
  margin-inline: auto;
  height: var(--nav-h);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.nav-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}
.nav-tab svg { width: 22px; height: 22px; }
.nav-tab.selected { color: var(--cyan); }
.nav-badge {
  position: absolute;
  top: 7px;
  inset-inline-start: calc(50% + 9px);
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: var(--cyan);
  color: #ffffff;
  display: grid;
  place-items: center;
}
.nav-badge.warn { background: var(--warn); color: #111; }

/* Fullscreen Optical QR Scanner Modal */
.scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #02080a;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 12px) 16px calc(var(--safe-bottom) + 18px);
  gap: 14px;
}
.scanner-head { display: flex; align-items: center; justify-content: space-between; }
.scanner-head h2 { margin: 0; font-size: 18px; }
.scanner-viewport {
  flex: 1;
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: #0b161b;
  display: grid;
  place-items: center;
}
.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scanner-reticle {
  position: absolute;
  width: min(70vw, 250px);
  height: min(70vw, 250px);
  border-radius: 20px;
  border: 3px solid var(--cyan);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.scanner-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.scanner-dots {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
}
.scan-dot {
  width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.25);
}
.scan-dot.done { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.scan-count { font-size: 12.5px; font-weight: 700; color: var(--cyan); margin-inline-start: 4px; }

/* Toast */
.app-toast {
  position: fixed;
  inset-inline: 16px;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 14px);
  max-width: 440px;
  margin-inline: auto;
  z-index: 90;
  padding: 11px 16px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel-solid) 94%, transparent);
  border: 1px solid var(--cyan);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
