:root {
  --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-sep: rgba(0, 0, 0, 0.06);
  --tab-hover-bg: #f5f5f5;
  --tab-hover-text: #3f3f46;
  --tab-active-color: #ff2d96;
  --tab-active-bg: #f9f9f9;
  --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;
}

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-sep: rgba(255, 255, 255, 0.08);
  --tab-hover-bg: #1e2733;
  --tab-hover-text: #e8eef4;
  --tab-active-color: #ff5eb3;
  --tab-active-bg: #1f2835;
  --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;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "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: Inter, -apple-system, BlinkMacSystemFont, "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;
}

/* ── Header ── */

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

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-logo {
  --width: 2rem;
  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;
}

.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;
}

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

.alerts-header {
  position: sticky;
  top: 0;
  background: var(--card);
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alerts-header h2 {
  margin: 0;
  font-size: 1rem;
}

.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.9rem 1rem;
  gap: 0.65rem;
}

.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-main {
  flex: 1;
  min-width: 0;
}

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

.alert-main strong {
  font-size: 0.88rem;
}

.alert-main small {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.74rem;
}

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

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

.alert-item strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 0.2rem;
}

.alert-item small,
.alert-item time {
  color: var(--muted);
  font-size: 0.76rem;
}

.alert-item time {
  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-item.critical strong { color: #b42318; }
.alert-item.warning strong  { color: #b54708; }
.alert-item.info strong     { color: #175cd3; }

.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: #d97706;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 140ms ease, transform 140ms ease;
  box-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-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;
}

/* ── 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("./assets/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;
}

.popup-location {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.82em;
  color: var(--popup-muted);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 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;
  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%;
  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: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;
  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);
}

.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);
}

/* ── 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);
}

/* ── 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-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;
  gap: 0.8rem;
  box-shadow: 0 4px 12px rgba(16, 36, 63, 0.08);
}

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

.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;
}

/* ── Account ── */

.btn-signout {
  width: 100%;
  margin-top: 1rem;
  padding: 0.62rem 1rem;
  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(7, 1fr);
  gap: 0.05rem;
  margin: 0;
  width: 100%;
  flex-shrink: 0;
  padding: calc(0.1rem + env(safe-area-inset-bottom));
  background: var(--surface-nav);
  border-top: 1px solid var(--nav-border-top);
  box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.05);
}

.tab {
  appearance: none;
  border: 0;
  border-right: 1px solid var(--tab-sep);
  background: transparent;
  color: var(--tab-text);
  border-radius: 0.3rem;
  padding: 0.22rem 0.15rem 0.1rem;
  touch-action: manipulation;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  min-height: 2.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.2rem;
  transition: color 160ms ease, transform 160ms ease;
}

.tab:last-child { border-right: 0; }
.tab:hover { background-color: var(--tab-hover-bg); }
.tab:active { transform: scale(0.98); }
.tab:not(.tab-active):hover { color: var(--tab-hover-text); }

.tab-icon {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
}

.tab-label {
  white-space: nowrap;
}

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

/* ── 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 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;
}
