:root {
  --safe-area-top: 0px;
  --safe-area-right: 0px;
  --safe-area-left: 0px;
  --safe-area-right: env(safe-area-inset-right, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
  --bg: #f4f7fb;
  --text: #10243f;
  --muted: #5f7087;
  --brand: #000;
  --brand-soft: #e7f0ff;
  --card: #ffffff;
  --border: #d7e2f0;
  --online: #16a34a;
  --idle: #f59e0b;
  --offline: #ef4444;
  --input-bg: #ffffff;
  --pill-bg: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.95);
  --surface-nav: rgba(255, 255, 255, 0.94);
  --nav-border-top: rgba(230, 230, 230, 0.95);
  --shell-desktop-bg: #ffffff;
  --tab-text: #6f6f76;
  --tab-hover-text: #3f3f46;
  --tab-active-color: #ff2d96;
  --tab-active-bg: rgba(255, 45, 150, 0.12);
  --tab-press-bg: rgba(15, 23, 42, 0.05);
  --popup-muted: #555555;
  --btn-primary-bg: #000000;
  --btn-primary-hover: #0b5ed7;
  --btn-primary-text: #ffffff;
  --focus-ring: rgba(13, 110, 253, 0.12);
  --slider-thumb-ring: #ffffff;
  --modal-backdrop: rgba(9, 16, 29, 0.5);
  --msg-error-bg: #fef2f2;
  --msg-error-border: #fecaca;
  --msg-error-text: #b91c1c;
  --msg-success-bg: #f0fdf4;
  --msg-success-border: #bbf7d0;
  --msg-success-text: #166534;
  --btn-google-hover-bg: #f8fafc;
  --signout-hover-bg: #fef2f2;
  --login-placeholder: #a3b1c6;
  --scrollbar-track: transparent;
  --scrollbar-thumb: color-mix(in srgb, #6b7280 55%, transparent);
  --scrollbar-thumb-hover: color-mix(in srgb, #4b5563 70%, transparent);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1218;
  --text: #e8eef4;
  --muted: #8f9db0;
  --brand: #e8eef4;
  --brand-soft: #1e2838;
  --card: #161d27;
  --border: #2a3544;
  --input-bg: #1c2430;
  --pill-bg: #1c2430;
  --surface-glass: rgba(22, 29, 38, 0.92);
  --surface-nav: rgba(18, 24, 32, 0.94);
  --nav-border-top: rgba(42, 53, 68, 0.95);
  --shell-desktop-bg: #121820;
  --tab-text: #a8b4c5;
  --tab-hover-text: #e8eef4;
  --tab-active-color: #ff5eb3;
  --tab-active-bg: rgba(255, 94, 179, 0.18);
  --tab-press-bg: rgba(255, 255, 255, 0.06);
  --popup-muted: #9aa8bc;
  --btn-primary-bg: #2563eb;
  --btn-primary-hover: #1d4ed8;
  --btn-primary-text: #ffffff;
  --focus-ring: rgba(59, 130, 246, 0.28);
  --slider-thumb-ring: #161d27;
  --modal-backdrop: rgba(0, 0, 0, 0.62);
  --msg-error-bg: #2a181c;
  --msg-error-border: #5c2d36;
  --msg-error-text: #fca5a5;
  --msg-success-bg: #14231c;
  --msg-success-border: #22543a;
  --msg-success-text: #86efac;
  --btn-google-hover-bg: #252d3a;
  --signout-hover-bg: #2a181c;
  --login-placeholder: #6b778c;
  --scrollbar-track: transparent;
  --scrollbar-thumb: color-mix(in srgb, #94a3b8 45%, transparent);
  --scrollbar-thumb-hover: color-mix(in srgb, #cbd5e1 60%, transparent);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

input {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ── Layout Shell ── */

.app-shell {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

.app-shell input,
.app-shell textarea,
.app-shell select {
  -webkit-user-select: text;
  user-select: text;
}

button,
a,
[role="button"] {
  touch-action: manipulation;
}

.main-content {
  min-height: 0;
  overflow: hidden;
}

.panel {
  height: 100%;
  overflow: auto;
}

/* Subtle visible scrollbar on scrollable content areas */
.panel,
.alerts-scroll,
.triplog-results,
.poi-form-area,
.page-panel,
.table-wrap,
.share-device-shared-list {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.panel::-webkit-scrollbar,
.alerts-scroll::-webkit-scrollbar,
.triplog-results::-webkit-scrollbar,
.poi-form-area::-webkit-scrollbar,
.page-panel::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.share-device-shared-list::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.panel::-webkit-scrollbar-track,
.alerts-scroll::-webkit-scrollbar-track,
.triplog-results::-webkit-scrollbar-track,
.poi-form-area::-webkit-scrollbar-track,
.page-panel::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track,
.share-device-shared-list::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

.panel::-webkit-scrollbar-thumb,
.alerts-scroll::-webkit-scrollbar-thumb,
.triplog-results::-webkit-scrollbar-thumb,
.poi-form-area::-webkit-scrollbar-thumb,
.page-panel::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.share-device-shared-list::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
}

.panel::-webkit-scrollbar-thumb:hover,
.alerts-scroll::-webkit-scrollbar-thumb:hover,
.triplog-results::-webkit-scrollbar-thumb:hover,
.poi-form-area::-webkit-scrollbar-thumb:hover,
.page-panel::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover,
.share-device-shared-list::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* ── Header ── */

.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: calc(0.5rem + var(--safe-area-top)) calc(0.5rem + var(--safe-area-right)) 0.5rem calc(0.5rem + var(--safe-area-left));
  background: var(--surface-glass);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

@supports (-webkit-touch-callout: none) {
  .app-header {
    padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
  }
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  padding: 0.12rem 0.35rem 0.12rem 0;
  border: none;
  background: transparent;
  border-radius: 0.65rem;
  cursor: pointer;
  flex-shrink: 0;
  max-width: 100%;
  min-width: 0;
  text-align: left;
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.brand-home-btn:hover {
  opacity: 0.88;
}

.brand-home-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--text) 45%, transparent);
  outline-offset: 2px;
}

.brand-home-btn .brand-text {
  min-width: 0;
}

.brand-logo {
  --width: 2rem;
  display: block;
  width: var(--width);
  height: 2rem;
  border-radius: 0.6rem;
  object-fit: contain;
}

.brand-text h1 {
  margin: 0;
  font-size: 1rem;
}

.brand-text p {
  margin: 0.1rem 0 0;
  line-height: 1.2;
}

/* Match website2 header brand (Plus Jakarta Sans) */
.brand-title {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: 1rem;
  color: #062a20;
}

.brand-version {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 500;
  font-size: 0.76rem;
  color: var(--muted);
}

html[data-theme="dark"] .brand-title {
  color: var(--text);
}

.header-action {
  border: 1px solid var(--border);
  background: var(--pill-bg);
  color: var(--text);
  padding: 0.5rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.header-action-icon {
  width: 0.9rem;
  height: 0.9rem;
  display: block;
  object-fit: contain;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--offline);
  color: #fff;
  font-size: 0.72rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.country-flag {
  font-size: 1.4rem;
  line-height: 1;
  cursor: default;
   font-family: "Noto Color Emoji";
}


.leaflet-container img.leaflet-tile {
    mix-blend-mode: unset !important;
}

.leaflet-tile {
    filter: blur(0);
    width: 256.5px !important;
    height: 256.9px !important;
}

/* ── Alerts Drawer ── */

.alerts-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 16, 29, 0.35);
  z-index: 1200;
}

/* [hidden] must win over .alerts-drawer { display: flex } - otherwise the sheet stays visible and close does nothing */
.alerts-backdrop[hidden],
.alerts-drawer[hidden] {
  display: none !important;
}

.alerts-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1300;
  display: flex;
  flex-direction: column;
  max-height: min(75vh, 520px);
  overflow: hidden;
  background: var(--card);
  border-top-left-radius: 1rem;
  border-top-right-radius: 1rem;
  box-shadow: 0 -10px 24px rgba(16, 36, 63, 0.22);
}

.alerts-swipe-handle {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  padding: 0.45rem 0 0.35rem;
  touch-action: none;
}

.alerts-swipe-indicator {
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 32%, transparent);
}

.alerts-header {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  background: var(--card);
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  touch-action: manipulation;
}

/* flex:1 here can make the sheet grow to the full viewport, covering the dim backdrop and blocking close/backdrop clicks */
.alerts-scroll {
  flex: 0 1 auto;
  min-height: 0;
  max-height: min(calc(75vh - 3.5rem), calc(520px - 3.5rem));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.alerts-header h2 {
  margin: 0;
  font-size: 1rem;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.alerts-close {
  border: 1px solid var(--border);
  background: var(--pill-bg);
  border-radius: 999px;
  padding: 0.4rem 0.65rem;
  font-size: 0.76rem;
  color: var(--muted);
}

/* ── Shared List Styles ── */

.history-list,
.device-list,
.alerts-list,
.alerts-page-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.history-list li,
.device-list li,
.alert-item,
.alerts-page-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.alert-item {
  padding: 0.85rem 1rem 0.85rem 0.85rem;
  gap: 0.65rem;
  border-left: 3px solid transparent;
  border-radius: 0 10px 10px 0;
  background: color-mix(in srgb, var(--card) 88%, var(--border) 12%);
}

.alert-item.critical {
  border-left-color: #f04438;
  background: color-mix(in srgb, #fef3f2 35%, var(--card) 65%);
}

.alert-item.warning {
  border-left-color: #f79009;
  background: color-mix(in srgb, #fffaeb 40%, var(--card) 60%);
}

.alert-item.info {
  border-left-color: #2e90fa;
  background: color-mix(in srgb, #eff8ff 38%, var(--card) 62%);
}

/* Shown for rows that were still unacknowledged when the list was loaded (ack runs after read on the server) */
.alert-item.alert-item-unacked {
  border-left-width: 8px;
  border-left-color: #1d4ed8;
  box-shadow: inset 4px 0 0 0 #93c5fd, 0 0 0 1px color-mix(in srgb, #2563eb 28%, transparent);
  background: color-mix(in srgb, #dbeafe 42%, var(--card) 58%);
}

.alert-item.alert-item-unacked.critical {
  background: color-mix(in srgb, #dbeafe 28%, color-mix(in srgb, #fef3f2 40%, var(--card) 60%));
}

.alert-item.alert-item-unacked.warning {
  background: color-mix(in srgb, #dbeafe 22%, color-mix(in srgb, #fffaeb 40%, var(--card) 60%));
}

.alert-item.alert-item-unacked.info {
  background: color-mix(in srgb, #bfdbfe 45%, var(--card) 55%);
}

.alert-new-pill {
  display: inline-block;
  margin-left: 0.2rem;
  margin-right: 0.1rem;
  padding: 0.12rem 0.4rem 0.1rem;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.1;
  vertical-align: 0.12em;
  color: #fff;
  background: linear-gradient(145deg, #2563eb, #1d4ed8);
  border-radius: 0.3rem;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.45);
}

html[data-theme="dark"] .alert-item {
  background: color-mix(in srgb, var(--card) 92%, var(--border) 8%);
}

html[data-theme="dark"] .alert-item.critical {
  background: color-mix(in srgb, #f04438 12%, var(--card) 88%);
}

html[data-theme="dark"] .alert-item.warning {
  background: color-mix(in srgb, #f79009 10%, var(--card) 90%);
}

html[data-theme="dark"] .alert-item.info {
  background: color-mix(in srgb, #2e90fa 12%, var(--card) 88%);
}

html[data-theme="dark"] .alert-item.alert-item-unacked {
  border-left-color: #60a5fa;
  box-shadow: inset 4px 0 0 0 rgba(59, 130, 246, 0.55), 0 0 0 1px color-mix(in srgb, #3b82f6 40%, transparent);
  background: color-mix(in srgb, #1e3a5f 55%, var(--card) 45%);
}

html[data-theme="dark"] .alert-item.alert-item-unacked.critical,
html[data-theme="dark"] .alert-item.alert-item-unacked.warning,
html[data-theme="dark"] .alert-item.alert-item-unacked.info {
  background: color-mix(in srgb, #1e3a5f 48%, var(--card) 52%);
}

html[data-theme="dark"] .alert-new-pill {
  background: linear-gradient(145deg, #3b82f6, #2563eb);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.alert-item--plain {
  background: transparent !important;
  border-left-color: transparent !important;
  border-radius: 0;
}

.alerts-page-list li {
  padding: 0.7rem 0;
}

.history-list li:last-child,
.device-list li:last-child,
.alerts-page-list li:last-child {
  border-bottom: 0;
}

.device-main,
.alert-body {
  flex: 1;
  min-width: 0;
}

.device-main strong,
.history-list strong,
.device-list strong {
  display: block;
  font-size: 0.9rem;
}

.alert-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.alert-type-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.alert-type-mark {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.55rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.alert-type-mark.critical {
  background: color-mix(in srgb, #f04438 22%, transparent);
  color: #c01048;
}

.alert-type-mark.warning {
  background: color-mix(in srgb, #f79009 22%, transparent);
  color: #b54708;
}

.alert-type-mark.info {
  background: color-mix(in srgb, #2e90fa 22%, transparent);
  color: #175cd3;
}

html[data-theme="dark"] .alert-type-mark.critical {
  background: color-mix(in srgb, #f97066 28%, transparent);
  color: #fda29b;
}

html[data-theme="dark"] .alert-type-mark.warning {
  background: color-mix(in srgb, #fdb022 26%, transparent);
  color: #fec84b;
}

html[data-theme="dark"] .alert-type-mark.info {
  background: color-mix(in srgb, #53b1fd 26%, transparent);
  color: #84caff;
}

.alert-type-meta {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
  padding-top: 0.08rem;
}

.alert-type-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.25;
}

.alert-type-technical {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.2;
}

.alert-vehicle {
  display: block;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.3;
}

.alert-body .alert-copy {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.history-list span,
.device-list small,
.history-list small {
  color: var(--muted);
  font-size: 0.78rem;
}

.alert-item div {
  min-width: 0;
}

.alert-item time {
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.alert-when {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.12rem;
  text-align: right;
}

.alert-when-at {
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.92;
}

.alert-badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 0.35rem;
  white-space: nowrap;
}

.alert-badge.critical { background: #fef3f2; color: #b42318; }
.alert-badge.warning  { background: #fffaeb; color: #b54708; }
.alert-badge.info     { background: #eff8ff; color: #175cd3; }
.alert-badge.normal   { background: #f0fdf4; color: #166534; }

/* ── Card Header Row ── */

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.card-header-row h2 {
  margin: 0;
}

.btn-add-device {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border: 0;
  border-radius: 0.6rem;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 140ms ease, transform 140ms ease;
  hhbox-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

.btn-add-device:hover {
  background: #b45309;
}

.btn-add-device:active {
  transform: scale(0.97);
}

/* ── QR Scanner Modal ── */

.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.qr-modal[hidden] { display: none; }

.qr-modal-content {
  background: var(--card);
  border-radius: 1rem;
  width: 100%;
  max-width: 380px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(16, 36, 63, 0.22);
}

.qr-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.qr-modal-header h3 {
  margin: 0;
  font-size: 0.95rem;
}

#qrReader {
  width: 100%;
  min-height: 260px;
  background: #000;
}

#qrReader video {
  border-radius: 0;
}

.qr-status {
  text-align: center;
  padding: 0.6rem 1rem;
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.qr-result {
  padding: 0 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-input[readonly] {
  background: var(--bg);
  color: var(--muted);
}

/* ── Device / Vehicle List ── */

.device-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.device-list .device-row {
  display: block;
  padding: 0;
  border-bottom: 0;
  border-radius: 0.7rem;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.device-list .device-row:hover {
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
  border-color: color-mix(in srgb, var(--brand-soft) 80%, var(--border));
  transform: translateY(-1px);
}

html[data-theme="dark"] .device-list .device-row {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .device-list .device-row:hover {
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}

.dv-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
  padding: 0.5rem 0.75rem 0.55rem 0.9rem;
  border-radius: inherit;
  overflow: hidden;
}

.dv-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--muted);
  border-radius: 0.7rem 0 0 0.7rem;
}

.device-row[data-status="moving"] .dv-card::before { background: var(--online); }
.device-row[data-status="idle"]   .dv-card::before { background: var(--idle); }
.device-row[data-status="offline"] .dv-card::before { background: var(--offline); }

.dv-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.dv-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  min-width: 0;
}

.dv-name {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.005em;
  color: var(--text);
}

.dv-reg {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border-radius: 0.35rem;
  background: color-mix(in srgb, var(--brand-soft) 80%, transparent);
  color: var(--muted);
}

.dv-status {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--muted) 16%, transparent);
  color: var(--muted);
  white-space: nowrap;
}

.dv-status::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 0.18rem color-mix(in srgb, currentColor 22%, transparent);
}

.dv-status-moving {
  background: color-mix(in srgb, var(--online) 18%, transparent);
  color: var(--online);
}

.dv-status-idle {
  background: color-mix(in srgb, var(--idle) 22%, transparent);
  color: var(--idle);
}

.dv-status-offline {
  background: color-mix(in srgb, var(--offline) 18%, transparent);
  color: var(--offline);
}

.dv-subline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.2;
}

.dv-dot {
  color: var(--border);
  font-weight: 700;
}

.dv-badge {
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dv-badge-shared {
  background: var(--brand-soft);
  color: var(--muted);
  border: 1px solid var(--border);
}

.dv-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.1rem 0.45rem;
  padding: 0.28rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: none;
}

.dv-stat {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dv-stat-label {
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--muted) 70%, transparent);
}

.dv-stat-value {
  margin-top: 0.02rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dv-location {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dv-location::before {
  content: "📍";
  font-size: 0.78rem;
  flex-shrink: 0;
  filter: grayscale(0.2);
}

.dv-extra {
  font-size: 0.72rem;
  color: var(--muted);
}

.dv-actions {
  margin-top: 0.05rem;
}

@media (max-width: 520px) {
  .dv-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 360px) {
  .dv-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.device-location {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.74rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

.device-speed {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text);
}

.device-parking {
  display: block;
  margin-top: 0.15rem;
  color: #b45309;
  font-size: 0.74rem;
}

.device-list .device-main > strong {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.device-shared-badge {
  flex-shrink: 0;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--muted);
  border: 1px solid var(--border);
}

.device-row--shared .device-shared-badge {
  background: color-mix(in srgb, var(--brand-soft) 70%, var(--border) 30%);
}

/* ── Status Badges ── */

.status {
  align-self: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status.online  { color: var(--online); }
.status.idle    { color: var(--idle); }
.status.offline { color: var(--offline); }

.dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.25rem;
}

.dot.online { background: var(--online); }

/* ── Live Map ── */

#panel-live {
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
}

.vehicle-div-icon {
  background: transparent;
  border: 0;
}

.sprite-car-wrapper {
  width: 32px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 4px 8px rgba(2, 8, 23, 0.3));
}

.sprite-car-rotation {
  width: 32px;
  height: 52px;
  transition: transform 220ms ease;
}

.sprite-car {
  width: 32px;
  height: 52px;
  background-image: url("./cars_sprite.webp");
  background-size: 300% 200%;
  background-repeat: no-repeat;
}

.map-overlay {
  position: absolute;
  left: 0.8rem;
  top: 0.8rem;
  z-index: 900;
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.6rem 0.75rem;
  box-shadow: 0 6px 18px rgba(16, 36, 63, 0.08);
}

.map-overlay strong {
  display: block;
  font-size: 0.85rem;
}

.map-overlay p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.vehicle-popup {
  min-width: 13.5rem;
  font-size: 0.8rem;
  color: var(--text);
}

.vp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.vp-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.vp-name {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.005em;
}

.vp-reg {
  margin-top: 0.05rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--popup-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.vp-status {
  flex-shrink: 0;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--muted) 18%, transparent);
  color: var(--muted);
}

.vp-status-moving {
  background: color-mix(in srgb, var(--online) 18%, transparent);
  color: var(--online);
}

.vp-status-idle {
  background: color-mix(in srgb, var(--idle) 22%, transparent);
  color: var(--idle);
}

.vp-status-offline {
  background: color-mix(in srgb, var(--offline) 18%, transparent);
  color: var(--offline);
}

.vp-subline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.18rem;
  font-size: 0.74rem;
  color: var(--muted);
}

.vp-badge {
  padding: 0.04rem 0.4rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.vp-badge-shared {
  background: color-mix(in srgb, var(--brand-soft) 75%, transparent);
  color: var(--text);
}

.vp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
}

.vp-stat {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.vp-stat-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--popup-muted);
}

.vp-stat-value {
  margin-top: 0.05rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.15;
}

.vp-location {
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
  font-size: 0.6rem;
  color: var(--popup-muted);
  word-break: break-word;
}

/* ── Content Cards ── */

.content-card {
  background: var(--card);
  padding: 0.8rem;
}

.content-card h2 {
  margin: 0 0 0.8rem;
  font-size: 1rem;
}

.loading-text {
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
  padding: 1.5rem 0;
}

/* ── Shared Form Elements ── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.form-row {
  display: flex;
  gap: 0.5rem;
}

.form-field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.form-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input {
  width: 100%;
  min-width: 0;
  padding: 0.48rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  font-size: 0.84rem;
  color: var(--text);
  background: var(--input-bg);
  outline: none;
}

.form-input[type="datetime-local"] {
  display: block;
  max-width: 100%;
  line-height: 1.2;
}

.form-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.btn-primary {
  width: 100%;
  padding: 0.55rem 1rem;
  border: 0;
  border-radius: 0.6rem;
  background: var(--btn-primary-bg);
  touch-action: manipulation;
  color: var(--btn-primary-text);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--btn-primary-hover);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-msg {
  margin: 0.4rem 0 0.75rem;
  padding: 0.45rem 0.65rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  text-align: center;
}

.form-msg.error {
  background: var(--msg-error-bg);
  border: 1px solid var(--msg-error-border);
  color: var(--msg-error-text);
}

.form-msg.success {
  background: var(--msg-success-bg);
  border: 1px solid var(--msg-success-border);
  color: var(--msg-success-text);
}

.form-section-title {
  font-size: 0.9rem;
  margin: 1.2rem 0 0.4rem;
  color: var(--text);
}

/* ── Modal Overlay ── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay[hidden] { display: none; }

.modal-box {
  background: var(--card);
  border-radius: 1rem;
  width: 100%;
  max-width: 380px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(16, 36, 63, 0.22);
}

.confirm-modal-box {
  max-width: 360px;
}

.confirm-modal-body {
  padding: 1rem;
}

.confirm-modal-message {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1rem;
}

.confirm-modal-btn {
  min-height: 2.25rem;
  padding: 0.48rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.confirm-modal-btn-cancel {
  background: var(--pill-bg);
  color: var(--muted);
}

.confirm-modal-btn-cancel:hover,
.confirm-modal-btn-cancel:focus-visible {
  background: var(--bg);
  color: var(--text);
}

.confirm-modal-btn-danger {
  border-color: #dc2626;
  background: #dc2626;
  color: #fff;
}

.confirm-modal-btn-danger:hover,
.confirm-modal-btn-danger:focus-visible {
  border-color: #b91c1c;
  background: #b91c1c;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 0.95rem;
}

.modal-close-btn {
  border: 1px solid var(--border);
  background: var(--pill-bg);
  border-radius: 999px;
  padding: 0.4rem 0.65rem;
  font-size: 0.76rem;
  color: var(--muted);
  cursor: pointer;
}

/* ── Device Row Actions ── */

.device-actions {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

.device-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: var(--pill-bg);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms ease;
}

.device-action-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.device-action-btn.btn-leave-share {
  border-color: color-mix(in srgb, #f04438 35%, var(--border));
  color: #b42318;
}

.device-action-btn.btn-leave-share:hover {
  background: #fef3f2;
  color: #b42318;
}

html[data-theme="dark"] .device-action-btn.btn-leave-share {
  border-color: color-mix(in srgb, #f97066 40%, var(--border));
  color: #fda29b;
}

html[data-theme="dark"] .device-action-btn.btn-leave-share:hover {
  background: color-mix(in srgb, #f04438 18%, var(--card));
  color: #fda29b;
}

.share-device-shared-section {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.share-device-shared-heading {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
}

.share-device-shared-loading,
.share-device-shared-empty {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.share-device-shared-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
}

.share-device-shared-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
}

.share-device-shared-row:last-child {
  border-bottom: 0;
}

.share-device-shared-who {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.share-device-shared-row .device-action-btn {
  flex-shrink: 0;
}

/* ── Data Tables ── */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  white-space: nowrap;
}

.data-table th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0.5rem 0.55rem;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--card);
}

.data-table td {
  padding: 0.5rem 0.55rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  background: var(--card);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: var(--bg);
}

.data-table--log .log-actions-col {
  width: 2.85rem;
  text-align: center;
  vertical-align: middle;
  padding: 0.5rem 0.55rem;
}

.data-table--log .log-actions-cell {
  text-align: center;
  vertical-align: middle;
  padding: 0.5rem 0.55rem;
}

.data-table--log .log-actions-cell .device-action-btn {
  box-sizing: border-box;
  width: 1.85rem;
  height: 1.85rem;
  min-width: 1.85rem;
  padding: 0;
  justify-content: center;
  line-height: 1;
  font-size: 0.72rem;
}

.log-month-group + .log-month-group {
  margin-top: 0.8rem;
}

.log-month-title {
  margin-top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.log-month-total {
  margin-left: auto;
  font-weight: 700;
  white-space: nowrap;
  color: var(--msg-success-text)
}

.service-log-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.service-log-card {
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--card);
  padding: 0.45rem 0.55rem 0.5rem;
  box-shadow: 0 1px 3px rgba(16, 36, 63, 0.04);
}

.service-log-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.service-log-title {
  margin: 0;
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 0.32rem;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
}

.service-log-vehicle {
  flex: 0 1 auto;
  min-width: 0;
  color: var(--text);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-log-station {
  flex: 0 1 auto;
  min-width: 0;
  color: var(--muted);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-log-when {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.service-log-sep {
  flex: 0 0 auto;
  color: var(--muted);
  opacity: 0.5;
}

.service-log-card .device-action-btn {
  box-sizing: border-box;
  width: 1.5rem;
  height: 1.5rem;
  min-width: 1.5rem;
  padding: 0;
  justify-content: center;
  line-height: 1;
  font-size: 0.66rem;
  flex-shrink: 0;
}

.service-log-flow {
  display: flex;
  align-items: stretch;
  gap: 0.32rem;
  margin: 0.42rem 0 0;
}

.service-log-flow-cell {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--pill-bg);
  padding: 0.28rem 0.42rem;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.service-log-flow-cell--next {
  background: color-mix(in srgb, var(--brand-soft) 65%, var(--card));
  border-color: color-mix(in srgb, var(--brand-soft) 60%, var(--border));
}

.service-log-flow-label {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.1;
  text-transform: uppercase;
}

.service-log-flow-value {
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-log-flow-value em {
  font-style: normal;
  font-weight: 600;
  font-size: 0.66rem;
  color: var(--muted);
  margin-left: 0.18rem;
}

.service-log-flow-arrow {
  align-self: center;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
}

.service-log-notes {
  margin: 0.42rem 0 0;
  padding: 0.05rem 0 0.05rem 0.5rem;
  border-left: 2px solid var(--border);
  color: var(--text);
  font-size: 0.72rem;
  font-style: italic;
  line-height: 1.3;
  word-break: break-word;
}

html[data-theme="dark"] .service-log-card {
  box-shadow: none;
}

/* ── History Panel ── */

#panel-history.panel-active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  min-height: 0;
}

.history-controls {
  padding: 0.7rem 0.8rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.history-controls .form-row:has(input[type="datetime-local"]) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 0.6rem;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.history-load-btn {
  flex: 1;
}

.history-reset-btn {
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--pill-bg);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.55rem 0.8rem;
  min-width: 4.4rem;
  cursor: pointer;
  touch-action: manipulation;
}

.history-reset-btn:hover {
  background: var(--brand-soft);
}

.history-playback[hidden],
.history-map-wrap[hidden] {
  display: none;
}

.history-map-wrap {
  flex: 1;
  position: relative;
  min-height: 0;
}

.history-map {
  width: 100%;
  height: 100%;
}

.history-info {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 900;
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  box-shadow: 0 4px 12px rgba(16, 36, 63, 0.08);
}

.history-info-meta {
  display: flex;
  gap: 0.8rem;
}

.history-info span {
  color: var(--muted);
}

.history-info .history-geocode {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-playback {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.8rem;
  background: var(--card);
  border-top: 1px solid var(--border);
}

.playback-btn {
  width: 2.2rem;
  height: 2.2rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--pill-bg);
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 140ms ease;
}

.playback-btn:hover {
  background: var(--brand-soft);
}

.playback-btn.playing {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border-color: var(--btn-primary-bg);
}

.playback-slider {
  flex: 1;
  height: 0.3rem;
  appearance: none;
  background: var(--border);
  border-radius: 999px;
  outline: none;
}

.playback-slider::-webkit-slider-thumb {
  appearance: none;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--btn-primary-bg);
  border: 2px solid var(--slider-thumb-ring);
  box-shadow: 0 2px 6px rgba(13, 110, 253, 0.3);
  cursor: grab;
}

.playback-pos {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  min-width: 3.5rem;
  text-align: right;
}

/* ── Trip Log Panel ── */

#panel-triplog.panel-active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  min-height: 0;
}

.triplog-controls {
  padding: 0.7rem 0.8rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.triplog-controls .form-row:has(input[type="datetime-local"]) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 0.6rem;
}

@media (max-width: 430px) {
  .form-input[type="datetime-local"] {
    appearance: none;
    -webkit-appearance: none;
    overflow: hidden;
    padding-left: 0.28rem;
    padding-right: 0.28rem;
    font-size: 0.68rem;
  }
}

.triplog-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.triplog-load-btn {
  flex: 1;
  min-width: 8rem;
}

.triplog-results {
  flex: 1;
  overflow: auto;
  background: var(--card);
  padding: 0.75rem 0.8rem 1rem;
}

.triplog-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.triplog-item {
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--pill-bg);
  overflow: hidden;
}

.triplog-item > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.62rem 0.72rem;
}

.triplog-item > summary::-webkit-details-marker {
  display: none;
}

.triplog-summary-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}

.triplog-summary-route {
  min-width: 0;
  flex: 1;
}

.triplog-summary-point {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.28rem;
}

.triplog-summary-point + .triplog-summary-point {
  margin-top: 0.1rem;
}

.triplog-point-label {
  font-size: 0.71rem;
  color: var(--muted);
  flex: 0 0 auto;
}

.triplog-point-text {
  min-width: 0;
  font-size: 0.82rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.triplog-summary-time {
  margin: 0;
  color: var(--muted);
  font-size: 0.73rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.08rem;
  white-space: nowrap;
}

.triplog-summary-time-line {
  display: block;
}

.triplog-summary-meta {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.triplog-tree {
  margin: 0 0.72rem 0.7rem 1.15rem;
  padding: 0 0 0 0.8rem;
  border-left: 1px solid var(--border);
  list-style: none;
}

.triplog-tree > li {
  margin: 0.38rem 0;
  color: var(--text);
  font-size: 0.76rem;
}

.triplog-tree ul {
  list-style: none;
  margin: 0.3rem 0 0.25rem 0;
  padding: 0 0 0 0.8rem;
  border-left: 1px dashed var(--border);
}

.triplog-tree ul li {
  margin: 0.25rem 0;
  color: var(--muted);
}

.triplog-item-actions {
  padding: 0 0.72rem 0.72rem 1.15rem;
}

.triplog-history-btn {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--pill-bg);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}

.triplog-history-btn:hover {
  background: var(--brand-soft);
}

/* ── Account ── */

.account-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.2rem;
  margin: 0 0 -1px;
  align-items: end;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.account-tabs::-webkit-scrollbar {
  display: none;
}

.account-tab-subscriptions {
  color: var(--brand);
}

.account-tab-subscriptions.account-tab-active {
  color: var(--text);
}

.subscription-hero {
  margin-bottom: 0.55rem;
}

.subscription-intro {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.subscription-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.subscription-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: var(--card);
  padding: 0.85rem 0.95rem 0.85rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  overflow: hidden;
}

.subscription-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: color-mix(in srgb, var(--muted) 40%, transparent);
}

.subscription-card.is-active::before { background: var(--online); }
.subscription-card.is-expiring::before { background: #f59e0b; }
.subscription-card.is-expired::before { background: #ef4444; }

.subscription-card.is-expiring {
  background: color-mix(in srgb, #f59e0b 7%, var(--card));
  border-color: color-mix(in srgb, #f59e0b 35%, var(--border));
}

.subscription-card.is-expired {
  background: color-mix(in srgb, #ef4444 7%, var(--card));
  border-color: color-mix(in srgb, #ef4444 35%, var(--border));
}

.subscription-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  min-width: 0;
}

.subscription-card-titles {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.subscription-card-name {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subscription-card-reg {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-feature-settings: "tnum";
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subscription-status {
  flex-shrink: 0;
  align-self: flex-start;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
  line-height: 1.2;
}

.subscription-status-active {
  color: var(--online);
  background: color-mix(in srgb, var(--online) 14%, transparent);
  border-color: color-mix(in srgb, var(--online) 32%, transparent);
}

.subscription-status-expiring {
  color: #b45309;
  background: color-mix(in srgb, #f59e0b 16%, transparent);
  border-color: color-mix(in srgb, #f59e0b 34%, transparent);
}

.subscription-status-expired {
  color: #dc2626;
  background: color-mix(in srgb, #ef4444 14%, transparent);
  border-color: color-mix(in srgb, #ef4444 30%, transparent);
}

.subscription-status-unknown {
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  border-color: color-mix(in srgb, var(--muted) 28%, transparent);
}

html[data-theme="dark"] .subscription-status-expiring {
  color: #fbbf24;
}

html[data-theme="dark"] .subscription-status-expired {
  color: #fca5a5;
}

.subscription-progress {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.subscription-progress-empty {
  font-size: 0.76rem;
  color: var(--muted);
}

.subscription-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.9rem;
  flex-wrap: wrap;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
}

.subscription-progress-expiry,
.subscription-progress-days {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.subscription-progress-days {
  color: var(--text);
}

.subscription-card.is-expiring .subscription-progress-days {
  color: #b45309;
}

.subscription-card.is-expired .subscription-progress-days {
  color: #dc2626;
}

html[data-theme="dark"] .subscription-card.is-expiring .subscription-progress-days {
  color: #fbbf24;
}

html[data-theme="dark"] .subscription-card.is-expired .subscription-progress-days {
  color: #fca5a5;
}

.subscription-icon {
  flex-shrink: 0;
  opacity: 0.75;
}

.subscription-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 18%, transparent);
  overflow: hidden;
}

.subscription-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--online);
  transition: width 320ms ease;
}

.subscription-card.is-expiring .subscription-progress-fill {
  background: #f59e0b;
}

.subscription-card.is-expired .subscription-progress-fill {
  background: #ef4444;
}

.subscription-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: nowrap;
}

.subscription-card-footer-solo {
  justify-content: stretch;
}

.subscription-payment-methods {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.35rem;
  flex: 1 1 auto;
  min-width: 0;
}

.subscription-payment-methods .btn-renew-payment {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  max-width: none;
  padding: 0.55rem 0.7rem;
  font-size: 0.78rem;
  gap: 0.3rem;
  position: relative;
}

.subscription-payment-methods .btn-renew-payment > span:not(.btn-renew-payment-icons) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.subscription-payment-methods[data-count="1"] .btn-renew-payment {
  padding: 0.58rem 0.95rem;
  font-size: 0.8rem;
  gap: 0.42rem;
}

.subscription-payment-methods[data-count="2"] .btn-renew-payment {
  padding: 0.52rem 0.55rem;
  font-size: 0.74rem;
}

.subscription-payment-methods[data-count="3"] .btn-renew-payment,
.subscription-payment-methods[data-count="4"] .btn-renew-payment {
  gap: 0.22rem;
}

.subscription-payment-methods[data-count="3"] .btn-renew-payment {
  padding: 0.48rem 0.38rem;
  font-size: 0.66rem;
}

.subscription-payment-methods[data-count="3"] .btn-renew-payment-card-brands,
.subscription-payment-methods[data-count="4"] .btn-renew-payment-card-brands,
.subscription-payment-methods[data-count="3"] .btn-renew-payment > svg:last-child,
.subscription-payment-methods[data-count="4"] .btn-renew-payment > svg:last-child {
  display: none;
}

.subscription-payment-methods[data-count="4"] .btn-renew-payment {
  padding: 0.42rem 0.28rem;
  font-size: 0.6rem;
  gap: 0.18rem;
}

.subscription-payment-methods[data-count="4"] .subscription-icon-card {
  width: 13px;
  height: 13px;
}

.btn-renew-payment-busy {
  pointer-events: none;
}

.btn-renew-payment-busy > * {
  visibility: hidden;
}

.btn-renew-payment-busy::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.95rem;
  height: 0.95rem;
  margin: -0.475rem 0 0 -0.475rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: subscription-payment-spin 0.7s linear infinite;
}

@keyframes subscription-payment-spin {
  to {
    transform: rotate(360deg);
  }
}

.subscription-card-price {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.subscription-card-price-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.subscription-card-price-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
}

.subscription-card-price-unit {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--muted);
}

.btn-renew-stripe,
.btn-renew-payment {
  appearance: none;
  border: none;
  border-radius: 0.6rem;
  background: #635bff;
  color: #ffffff;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.58rem 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  white-space: nowrap;
  transition: background-color 120ms ease, transform 120ms ease, box-shadow 160ms ease;
  box-shadow: 0 1px 0 rgba(99, 91, 255, 0.4) inset, 0 1px 2px rgba(99, 91, 255, 0.18);
}

.btn-renew-payment-card {
  background: #635bff;
  box-shadow: 0 1px 0 rgba(99, 91, 255, 0.4) inset, 0 1px 2px rgba(99, 91, 255, 0.18);
}

.btn-renew-payment-momo {
  background: #0f766e;
  box-shadow: 0 1px 0 rgba(15, 118, 110, 0.35) inset, 0 1px 2px rgba(15, 118, 110, 0.18);
}

.btn-renew-payment-icons {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-renew-payment-card-brands {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0.92;
}

.btn-renew-stripe:hover:not(:disabled),
.btn-renew-payment:hover:not(:disabled) {
  background: #5851ea;
}

.btn-renew-payment-momo:hover:not(:disabled) {
  background: #0d655f;
}

.btn-renew-stripe:active:not(:disabled),
.btn-renew-payment:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-renew-stripe:disabled,
.btn-renew-payment:disabled,
.btn-renew-stripe-disabled,
.btn-renew-payment-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--muted);
  box-shadow: none;
  flex: 1 1 auto;
  width: 100%;
}

.subscription-card-footer-solo .subscription-payment-methods {
  width: 100%;
}

@media (max-width: 480px) {
  .subscription-card-footer {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .subscription-card-price {
    flex: 1 1 100%;
  }

  .subscription-payment-methods {
    flex: 1 1 100%;
  }
}

.subscription-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
  padding: 1rem 0;
}

.account-tab {
  flex: 0 0 auto;
  text-align: center;
  white-space: nowrap;
  scroll-snap-align: start;
  appearance: none;
  border: 1px solid transparent;
  border-bottom-color: var(--border);
  border-radius: 0.75rem 0.75rem 0 0;
  background: color-mix(in srgb, var(--muted) 8%, transparent);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.58rem 0.85rem 0.62rem;
  position: relative;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

@media (max-width: 640px) {
  .account-tab {
    font-size: 0.76rem;
    padding: 0.52rem 0.7rem 0.56rem;
    letter-spacing: -0.005em;
  }
}

.account-tab:not(.account-tab-active):hover {
  color: var(--text);
  background: color-mix(in srgb, var(--muted) 12%, transparent);
}

.account-tab:focus-visible {
  outline: 2px solid var(--muted);
  outline-offset: 2px;
}

.account-tab-active {
  z-index: 1;
  border-color: var(--border);
  border-bottom-color: var(--card);
  background: var(--card);
  color: var(--text);
}

.account-tab-panel {
  min-height: 0;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0 0 0.85rem 0.85rem;
  background: var(--card);
}

.account-tab-panel .device-list {
  margin-bottom: 0.8rem;
}

.account-tab-panel .form-section-title {
  margin-top: 0;
}

.btn-signout {
  width: 100%;
  padding: 0.62rem 1rem;
  margin-top: 1.75rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--pill-bg);
  color: #ef4444;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 140ms ease;
}

.btn-signout:hover {
  background: var(--signout-hover-bg);
}

/* ── POI Page ── */

.poi-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.poi-map-wrap {
  position: relative;
  height: 40%;
  min-height: 200px;
  flex-shrink: 0;
}

.poi-map {
  width: 100%;
  height: 100%;
}

.poi-hint {
  position: absolute;
  bottom: 0.6rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.76rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
}

.page-panel {
  flex: 1;
  overflow: auto;
  padding: 0.8rem;
  background: var(--card);
}

.poi-form-area {
  flex: 1;
  overflow: auto;
  padding: 0.8rem;
  background: var(--card);
}

.poi-checkbox {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text);
  cursor: pointer;
  flex: 1;
}

.poi-checkbox input {
  accent-color: var(--brand);
}

/* ── Bottom Menu ── */

.bottom-menu {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.15rem;
  margin: 0;
  width: 100%;
  flex-shrink: 0;
  padding: 0.4rem calc(0.4rem + var(--safe-area-right)) 0.4rem calc(0.4rem + var(--safe-area-left));
  background: var(--surface-nav);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--nav-border-top);
  box-shadow: 0 -8px 24px -12px rgba(15, 23, 42, 0.12);
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--tab-text);
  border-radius: 0.85rem;
  padding: 0.4rem 0.15rem 0.3rem;
  touch-action: manipulation;
  font-family: 'Plus Jakarta Sans';
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.015em;
  min-height: 3.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
  position: relative;
  cursor: pointer;
  transition: color 200ms ease;
}

.tab:not(.tab-active):hover { color: var(--tab-hover-text); }
.tab:not(.tab-active):active { background-color: var(--tab-press-bg); }
.tab:focus-visible {
  outline: 2px solid var(--tab-active-color);
  outline-offset: 2px;
}

.tab-icon {
  width: 1.4rem;
  height: 1.4rem;
  display: block;
  position: relative;
  z-index: 1;
  transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tab-label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: relative;
  z-index: 1;
  transition: color 200ms ease;
}

.tab-active {
  color: var(--tab-active-color);
  font-weight: 600;
}

.tab-active::before {
  content: "";
  position: absolute;
  top: 0.3rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(2.6rem, 80%);
  height: 1.75rem;
  border-radius: 999px;
  background: var(--tab-active-bg);
  z-index: 0;
  animation: tabPillIn 280ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tab-active .tab-icon {
  transform: scale(1.06) translateY(-1px);
}

@keyframes tabPillIn {
  from { transform: translateX(-50%) scale(0.6); opacity: 0; }
  to   { transform: translateX(-50%) scale(1);   opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .tab,
  .tab-icon,
  .tab-active::before { transition: none; animation: none; }
}

@media (max-width: 430px) {
  .bottom-menu {
    gap: 0.1rem;
    padding-left: 0.3rem;
    padding-right: 0.3rem;
  }

  .tab {
    padding: 0.36rem 0.08rem 0.28rem;
    min-height: 3rem;
  }

  .tab-icon {
    width: 1.28rem;
    height: 1.28rem;
  }

  .tab-label {
    font-size: 0.6rem;
    letter-spacing: 0;
  }
}

/* ── Responsive ── */

@media (min-width: 768px) {
  .app-shell {
    max-width: 1080px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background: var(--shell-desktop-bg);
  }

  .bottom-menu {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ── Login Page ── */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(13, 110, 253, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
    var(--bg);
}

html[data-theme="dark"] .login-page {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(37, 99, 235, 0.14) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 2rem 1.75rem;
  box-shadow: 0 12px 40px rgba(16, 36, 63, 0.08);
}

.login-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  height: 3.5rem;
  border-radius: 0.85rem;
  object-fit: contain;
  margin-bottom: 0.6rem;
}

.login-brand h1 {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: 1rem;
  color: #062a20;
}

html[data-theme="dark"] .login-brand h1 {
  color: var(--text);
}

.login-brand p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.login-form h2 {
  margin: 0 0 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  color: var(--text);
}

.login-error {
  margin: 0 0 0.8rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.6rem;
  background: var(--msg-error-bg);
  border: 1px solid var(--msg-error-border);
  color: var(--msg-error-text);
  font-size: 0.82rem;
  text-align: center;
}

.btn-google {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--pill-bg);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 140ms ease, box-shadow 140ms ease;
}

.btn-google:hover {
  background: var(--btn-google-hover-bg);
  box-shadow: 0 2px 8px rgba(16, 36, 63, 0.08);
}

.btn-google:active { transform: scale(0.995); }

.google-icon {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1.15rem 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.input-group {
  margin-bottom: 0.85rem;
}

.input-group label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.input-group input {
  width: 100%;
  padding: 0.62rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--input-bg);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.input-group input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.input-group input::placeholder { color: var(--login-placeholder); }

.login-footer {
  margin: 1.1rem 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.login-footer a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}

.login-footer a:hover { text-decoration: underline; }

.poi-actions-cell {
  text-align: right;
}

/* Leaflet: avoid popups measuring as extremely narrow (async content, panel / map resizes) */
.leaflet-popup-content {
  min-width: 12.5rem;
  max-width: 20rem;
  box-sizing: border-box;
}

/* ── Leaflet popups (dark theme) ── */

html[data-theme="dark"] .leaflet-popup-content-wrapper,
html[data-theme="dark"] .leaflet-popup-tip {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .leaflet-container {
  background: #1c1c1c;
}

/* ── Range slider (Firefox) ── */

.playback-slider::-moz-range-thumb {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--btn-primary-bg);
  border: 2px solid var(--slider-thumb-ring);
  cursor: grab;
}
