:root {
  color-scheme: light;
  --app-height: 100dvh;
  --vv-top: 0px;
  --bg: #f4f1ea;
  --bg-2: #ece7dc;
  --surface: #fffdf8;
  --surface-2: #ffffff;
  --input: #ffffff;
  --border: #d9d1c3;
  --text: #1c1f26;
  --text-2: #2a2f3a;
  --muted: #5f6674;
  --muted-2: #6e7584;
  --accent: #e07a1f;
  --accent-2: #f59e3b;
  --accent-text: #b45309;
  --on-accent: #140c04;
  --overlay: rgba(28, 22, 14, 0.4);
  --shadow: 0 14px 36px rgba(40, 28, 12, 0.12);
  --sidebar-bg: linear-gradient(180deg, #faf6ee 0%, #f0ebe0 100%);
  --sidebar-border: rgba(196, 94, 18, 0.18);
  --chip-bg: rgba(28, 31, 38, 0.04);
  --chip-border: rgba(28, 31, 38, 0.08);
  --map-empty-bg: rgba(255, 253, 248, 0.92);
  --mobile-nav-bg: linear-gradient(180deg, rgba(250, 246, 238, 0.9) 0%, #f0ebe0 35%);
  --mobile-nav-stack: calc(0.7rem + 3rem + 0.5rem + 3rem + max(0.7rem, env(safe-area-inset-bottom)));
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23c45e12' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
}

html.dark {
  color-scheme: dark;
  --bg: #07080b;
  --bg-2: #0b0e14;
  --surface: #121722;
  --surface-2: #151922;
  --input: #0d1016;
  --border: #2a3242;
  --text: #f4f4f5;
  --text-2: #e4e4e7;
  --muted: #a1a8b8;
  --muted-2: #8b93a7;
  --accent: #e07a1f;
  --accent-2: #f59e3b;
  --accent-text: #fbbf72;
  --on-accent: #140c04;
  --overlay: rgba(0, 0, 0, 0.55);
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  --sidebar-bg: linear-gradient(180deg, #121722 0%, #0b0e14 100%);
  --sidebar-border: rgba(245, 158, 59, 0.12);
  --chip-bg: rgba(255, 255, 255, 0.03);
  --chip-border: rgba(255, 255, 255, 0.05);
  --map-empty-bg: rgba(7, 8, 11, 0.82);
  --mobile-nav-bg: linear-gradient(180deg, rgba(11, 14, 20, 0.72) 0%, #0b0e14 35%);
  --mobile-nav-stack: calc(0.7rem + 3rem + 0.5rem + 3rem + max(0.7rem, env(safe-area-inset-bottom)));
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23fbbf72' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
}

/* iOS Home Screen / installed PWA */
html.pwa-standalone,
html.pwa-standalone body {
  min-height: 100%;
  min-height: 100dvh;
  -webkit-user-select: none;
  user-select: none;
}

html.pwa-standalone input,
html.pwa-standalone textarea,
html.pwa-standalone [contenteditable] {
  -webkit-user-select: text;
  user-select: text;
}

@media (display-mode: standalone) {
  html,
  body {
    min-height: 100%;
    min-height: 100dvh;
  }
}

html:has(.app-body),
body.app-body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(480px, 560px) minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  min-height: var(--app-height);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  padding: 1.15rem 1.35rem 2rem;
  padding-top: max(1.15rem, env(safe-area-inset-top));
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  padding-left: max(1.35rem, env(safe-area-inset-left));
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

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

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: #f59e3b;
  background: rgba(224, 122, 31, 0.12);
  border: 1px solid rgba(245, 158, 59, 0.3);
}

.brand-logo {
  display: block;
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
}

.brand h1 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.stats-link {
  color: var(--text-2);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.35rem 0.45rem;
}

.lang-menu {
  position: relative;
  flex-shrink: 0;
}

.lang-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 40px;
  height: 40px;
  padding: 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.lang-menu-btn .lang-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.lang-menu-btn[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.lang-menu-list {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 40;
  min-width: 9.5rem;
  max-height: min(70vh, 22rem);
  overflow: auto;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.lang-menu-list button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  text-align: left;
  padding: 0.42rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.lang-menu-list button:hover,
.lang-menu-list button:focus-visible {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--text);
  outline: none;
}

.lang-menu-list button.active {
  background: var(--accent);
  color: var(--on-accent);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

html.dark .theme-toggle .icon-moon,
html:not(.dark) .theme-toggle .icon-sun {
  display: none;
}

.destination-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.stop-row {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
}

.stop-row label {
  flex: 1;
  margin: 0;
}

.remove-dest {
  flex-shrink: 0;
  width: 44px;
  height: 48px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  border-radius: 10px;
  font-size: 1.1rem;
  line-height: 1;
}

.add-dest-btn {
  width: 100%;
}

.check-row {
  flex-direction: row !important;
  align-items: center;
  gap: 0.7rem !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 0.95rem !important;
  font-weight: 500 !important;
  color: var(--text-2) !important;
  min-height: 48px;
  cursor: pointer;
}

.check-row input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  margin: 0;
  padding: 0;
  border: 2px solid var(--accent-2);
  border-radius: 6px;
  background-color: var(--input);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
  flex-shrink: 0;
  pointer-events: auto;
  cursor: pointer;
}

.check-row input[type="checkbox"]:checked {
  border-color: #e07a1f;
  background-color: #e07a1f;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23140c04' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M2.2 6.2 4.8 8.8 9.8 3.2'/%3E%3C/svg%3E");
}

.check-row input[type="checkbox"]:focus-visible {
  outline: 2px solid #fbbf72;
  outline-offset: 2px;
}

.check-row.is-disabled,
.check-row:has(input:disabled) {
  opacity: 0.45;
  cursor: not-allowed;
}

.check-row input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

.field-hint {
  margin: -0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted-2);
  line-height: 1.35;
}

.budget-field.hidden,
#hotels-block.hidden,
#trip-summary-block.hidden,
#days-block.hidden {
  display: none !important;
}

.planner-form,
.results {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.planner-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.planner-form input[type="text"],
.planner-form select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--input);
  color: var(--text);
  border-radius: 10px;
  padding: 0.85rem 0.8rem;
  font-size: 16px;
  font-family: inherit;
  min-height: 48px;
  appearance: none;
  -webkit-appearance: none;
}

.planner-form select {
  background-color: var(--input);
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.4rem;
}

.planner-form input[type="text"]:focus,
.planner-form select:focus {
  outline: 2px solid #e07a1f;
  outline-offset: 1px;
}

.address-wrap {
  position: relative;
}

.address-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.address-suggest li {
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-2);
  line-height: 1.3;
}

.address-suggest li.active,
.address-suggest li:hover {
  background: rgba(224, 122, 31, 0.16);
}

.address-suggest li.muted {
  color: var(--muted-2);
  cursor: default;
}

.address-wrap.is-valid input[type="text"] {
  border-color: #3f6f4a;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.lang-menu-btn,
.lang-menu-list button {
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.primary-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 0.95rem 1rem;
  min-height: 48px;
  background: linear-gradient(135deg, #e07a1f, #c45e12);
  color: #140c04;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}

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

.ghost-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  border: 1px solid var(--border);
  background: var(--input);
  color: var(--text-2);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  min-height: 48px;
  text-decoration: none;
}

.icon-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  border-radius: 8px;
  width: 44px;
  height: 44px;
}

.results h3 {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.route-title {
  margin: 0.4rem 0 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.7rem;
  line-height: 1.05;
}

.route-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.route-distance {
  margin: 0;
  color: var(--accent-text);
  font-weight: 600;
  font-size: 0.95rem;
}

.trip-summary {
  margin: 0;
  color: var(--text-2);
  font-size: 0.95rem;
  line-height: 1.5;
}

.day-cards {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.day-card {
  padding: 0.8rem;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.day-card header {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.4rem;
}

.day-card header small {
  color: var(--muted-2);
  font-size: 0.8rem;
}

.day-card p {
  margin: 0 0 0.45rem;
  color: var(--text-2);
  font-size: 0.92rem;
  line-height: 1.45;
}

.day-card .day-weather {
  color: var(--accent-text);
  font-weight: 600;
  font-size: 0.88rem;
}

.day-card ul {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.day-card li + li {
  margin-top: 0.2rem;
}

.hotel-link {
  color: var(--accent-text);
  font-weight: 600;
  font-size: 0.88rem;
  margin-top: 0.4rem;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.soft-list,
.card-list,
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.soft-list.bullets li,
.soft-list li {
  padding: 0.45rem 0.55rem;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 10px;
  font-size: 0.9rem;
}

.card-list li {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.card-list strong {
  display: block;
  margin-bottom: 0.2rem;
}

.card-meta {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--accent-text);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.map-pane {
  position: relative;
  min-height: 0;
}

.show-map-btn {
  display: none;
}

.mobile-nav {
  display: none;
}

#map {
  width: 100%;
  height: 100%;
  background: var(--bg-2);
}

.map-locate {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 0 8px 8px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

.map-locate.is-locating {
  opacity: 0.55;
}

html.dark .map-locate {
  background: var(--surface-2);
}

.map-toolbar {
  position: absolute;
  z-index: 500;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  left: max(0.75rem, env(safe-area-inset-left));
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
}

.map-toolbar > * {
  pointer-events: auto;
}

.map-toolbar .ghost-btn {
  width: auto;
  padding: 0.55rem 0.9rem;
  backdrop-filter: blur(8px);
}

.save-status {
  color: var(--muted);
  font-size: 0.8rem;
}

.map-empty {
  position: absolute;
  z-index: 400;
  left: 50%;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(36rem, calc(100% - 1.5rem));
  margin: 0;
  padding: 0.7rem 1rem;
  border-radius: 16px;
  background: var(--map-empty-bg);
  border: 1px solid var(--sidebar-border);
  color: var(--text-2);
  text-align: center;
  font-size: 0.88rem;
}

.map-empty.hidden,
.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

#close-sidebar {
  display: none !important;
}

.drawer {
  display: none !important;
  position: fixed;
  inset: 0;
  z-index: 800;
}

.drawer.is-open {
  display: block !important;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(420px, 100%);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--sidebar-border);
  padding: 1.2rem;
  padding-top: max(1.2rem, env(safe-area-inset-top));
  padding-bottom: max(1.2rem, env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

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

.drawer-panel h2 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.8rem;
}

.drawer-copy {
  color: var(--muted);
  font-size: 0.9rem;
}

.history-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--input);
  color: inherit;
  border-radius: 12px;
  padding: 0.85rem;
  cursor: pointer;
}

.history-item:hover {
  border-color: #e07a1f;
}

.history-item small {
  display: block;
  color: var(--muted);
  margin-top: 0.3rem;
}

.history-page-copy {
  margin: 0 0 1rem;
  color: var(--text-2);
  line-height: 1.5;
}

.history-page-empty {
  margin: 0;
  color: var(--muted);
}

.history-page-list {
  display: grid;
  gap: 0.75rem;
}

.history-card {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.history-card strong {
  display: block;
}

.history-card small {
  display: block;
  color: var(--muted);
  margin-top: 0.3rem;
}

.history-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.history-card-actions .ghost-btn,
.history-card-actions .danger-btn {
  width: auto;
  min-width: 8rem;
  min-height: 42px;
  text-decoration: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1.4rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 900;
  background: #f59e3b;
  color: #140c04;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  max-width: calc(100% - 2rem);
}

@media (max-width: 900px) {
  html:has(.app-body),
  body.app-body {
    overflow: hidden;
    height: 100%;
    overscroll-behavior: none;
  }

  .sidebar-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.5rem 0.55rem;
  }

  .brand {
    min-width: 0;
    grid-column: 1;
    grid-row: 1;
  }

  .brand h1 {
    line-height: 1.05;
  }

  .brand-wrap {
    display: block;
  }

  .sidebar-header .header-actions {
    display: contents;
  }

  .sidebar-header .lang-menu {
    grid-column: 2;
    grid-row: 1;
  }

  .sidebar-header .theme-toggle {
    grid-column: 3;
    grid-row: 1;
  }

  .account-menu {
    grid-column: 2 / -1;
    grid-row: 2;
    justify-self: end;
    max-width: 100%;
  }

  .account-menu-btn {
    max-width: 100%;
  }

  .app-shell {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    grid-template-rows: none;
    overflow: hidden;
    position: fixed;
    top: var(--vv-top);
    left: 0;
    right: 0;
    height: var(--app-height);
    min-height: 0;
  }

  .sidebar {
    position: relative;
    inset: auto;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    transform: none;
    z-index: 2;
    border-right: 0;
    padding-bottom: calc(var(--mobile-nav-stack) + 4.75rem);
  }

  .generate-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--mobile-nav-stack);
    z-index: 41;
    padding: 0.55rem 1rem 0.4rem;
    background: var(--mobile-nav-bg);
    border-top: 1px solid var(--sidebar-border);
  }

  .mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    padding: 0.7rem 1rem;
    padding-bottom: max(0.7rem, env(safe-area-inset-bottom));
    background: var(--mobile-nav-bg);
    border-top: 0;
  }

  html.keyboard-open .mobile-nav,
  html.keyboard-open .generate-dock {
    display: none !important;
  }

  html.keyboard-open .sidebar {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }

  .mobile-nav .ghost-btn {
    width: 100%;
  }

  .map-pane {
    display: none;
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    min-height: 0;
    border-top: 1px solid var(--sidebar-border);
  }

  .app-shell.has-route:not(.map-mode) .map-pane {
    display: none;
  }

  .app-shell.has-route:not(.map-mode) .map-empty {
    display: none;
  }

  .app-shell.has-route:not(.map-mode) #open-sidebar {
    display: none;
  }

  .app-shell.map-mode .sidebar,
  .app-shell.map-mode .mobile-nav {
    display: none;
  }

  .app-shell.map-mode .map-pane {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    width: 100%;
    height: var(--app-height);
    min-height: var(--app-height);
    max-height: none;
  }

  .app-shell.map-mode #map {
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    min-height: 0;
  }

  .show-map-btn {
    display: flex;
    width: 100%;
  }

  .map-toolbar .ghost-btn {
    min-height: 44px;
    padding: 0.55rem 0.85rem;
  }

  .drawer-panel {
    width: 100%;
  }
}

@media (min-width: 901px) {
  .show-map-btn {
    display: none !important;
  }
}

.stats-body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}

.stats-page {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.2rem 1rem 2.5rem;
  padding-top: max(1.2rem, env(safe-area-inset-top));
}

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

.stats-header .header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.stats-header .lang-menu,
.stats-header .theme-toggle,
.stats-header .stats-home {
  align-self: center;
}

.stats-kicker {
  margin: 0 0 0.25rem;
  color: var(--accent-2);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
}

.stats-header h1 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 2rem;
}

.stats-home {
  width: auto;
  height: 40px;
  min-height: 40px;
  padding: 0 0.8rem;
  border-radius: 10px;
  text-decoration: none;
}

@media (max-width: 900px) {
  .account-page .stats-header,
  .admin-page .stats-header {
    align-items: flex-start;
  }

  .account-page .stats-header .header-actions,
  .admin-page .stats-header .header-actions {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: end;
    align-items: center;
    gap: 0.45rem;
    margin-left: auto;
  }

  .account-page .stats-header .lang-menu,
  .admin-page .stats-header .lang-menu {
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
  }

  .account-page .stats-header .theme-toggle,
  .admin-page .stats-header .theme-toggle {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .account-page .stats-header .stats-home,
  .admin-page .stats-header .stats-home {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: end;
  }
}

.stats-copy,
.stats-error {
  color: var(--muted);
  line-height: 1.45;
}

.stats-error {
  color: #fca5a5;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.7rem;
  margin: 1.2rem 0 1.6rem;
}

.stats-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stats-card span {
  color: var(--muted-2);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stats-card strong {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.8rem;
}

.stats-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-bottom: 1.6rem;
}

.stats-split h2,
.stats-page h2 {
  margin: 0 0 0.5rem;
  color: var(--accent-text);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stats-split li,
#recent-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: baseline;
}

#recent-list li {
  flex-direction: column;
}

.stats-split .muted,
#recent-list .muted {
  color: var(--muted-2);
}

@media (max-width: 700px) {
  .stats-split {
    grid-template-columns: 1fr;
  }
}

.account-menu {
  position: relative;
}

.account-menu-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 11rem;
  height: 40px;
  min-height: 40px;
  padding: 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.account-menu-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-btn::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  flex: 0 0 auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  opacity: 0.7;
}

.account-menu-list {
  position: fixed;
  z-index: 80;
  min-width: 11.5rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: grid;
}

.account-menu-list[hidden] {
  display: none;
}

.account-menu-list a,
.account-menu-list button {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
}

.account-menu-list form {
  margin: 0;
}

.account-menu-list button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}

.account-menu-list a:hover,
.account-menu-list a:focus-visible,
.account-menu-list button:hover,
.account-menu-list button:focus-visible {
  background: var(--chip-bg);
}

.account-dl {
  display: grid;
  gap: 0.85rem;
  margin: 1.1rem 0 0;
}

.account-dl div {
  display: grid;
  gap: 0.2rem;
}

.account-dl dt {
  color: var(--accent-text);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.account-dl dd {
  margin: 0;
  color: var(--text-2);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.account-avatar {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--chip-bg);
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.2rem;
}

.account-actions .primary-btn,
.account-actions .ghost-btn {
  width: auto;
  min-width: 10rem;
  text-decoration: none;
}

.account-section {
  margin-top: 1.6rem;
}

.account-section h2 {
  margin: 0 0 0.7rem;
  color: var(--accent-text);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-toggle {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}

.account-toggle input {
  margin-top: 0.2rem;
  inline-size: 1.05rem;
  block-size: 1.05rem;
  accent-color: #c45e12;
}

.account-toggle span {
  display: grid;
  gap: 0.2rem;
}

.account-toggle strong {
  font-weight: 600;
}

.account-toggle small {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.auth-body {
  min-height: 100dvh;
  height: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  place-items: start center;
  padding: 1.2rem;
  padding-top: max(1.2rem, env(safe-area-inset-top));
  padding-bottom: max(1.2rem, env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}

.auth-card {
  width: min(28rem, 100%);
  margin-block: auto;
  display: grid;
  gap: 0.9rem;
  padding: 1.4rem 1.3rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.auth-brand {
  flex: 1 1 auto;
  min-width: 0;
}

.auth-header h1 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.7rem;
}

.auth-header-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-left: auto;
  flex-shrink: 0;
}

.auth-header .lang-menu {
  margin-left: 0;
}

.auth-copy,
.auth-meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.auth-meta {
  font-size: 0.82rem;
}

.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 46px;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  text-decoration: none;
  font-weight: 600;
}

.oauth-google {
  background: #fff;
  color: #1f1f1f;
}

.oauth-github {
  background: #161b22;
  color: #f0f6fc;
}

.mfa-form {
  display: grid;
  gap: 0.75rem;
}

.mfa-form input {
  width: 100%;
  min-height: 46px;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input);
  color: var(--text);
  letter-spacing: 0.12em;
  font-size: 1.05rem;
}

.qr-box {
  display: grid;
  place-items: center;
  padding: 0.8rem;
  border-radius: 14px;
  background: #fff;
}

.qr-box svg {
  width: 180px;
  height: 180px;
}

.mfa-secret {
  margin: 0;
  text-align: center;
  word-break: break-all;
  color: var(--muted);
}

.backup-codes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.backup-codes code {
  display: block;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: var(--input);
  text-align: center;
}

.invite-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.7rem;
  margin: 0;
}

.invite-form input,
.invite-form select {
  flex: 1 1 16rem;
  min-height: 48px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input);
  color: var(--text);
  font: inherit;
}

.invite-lang {
  display: grid;
  gap: 0.3rem;
  flex: 1 1 16rem;
  color: var(--text-2);
  font-size: 0.85rem;
}

.invite-form .primary-btn {
  width: auto;
  min-width: 10rem;
  min-height: 48px;
  flex: 0 0 auto;
}

.invite-status {
  min-height: 0;
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--muted-2);
  line-height: 1.35;
}

.admin-page section + section {
  margin-top: 1.15rem;
}

@media (min-width: 901px) {
  .invite-form {
    width: 100%;
  }

  .invite-form input[type="email"] {
    flex: 1 1 auto;
    width: auto;
    min-width: 14rem;
    max-width: none;
  }

  .invite-lang {
    flex: 0 0 11.5rem;
  }

  .invite-form select {
    flex: none;
    width: 100%;
  }
}

.table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.6rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.admin-table small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.danger-btn {
  min-height: 36px;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: 8px;
  background: transparent;
  color: #fca5a5;
  cursor: pointer;
}

.danger-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.legal-page {
  max-width: 40rem;
}

.legal-page h1 {
  margin-bottom: 0.35rem;
}

.legal-updated {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 1.2rem;
}

.legal-page h2 {
  margin: 1.4rem 0 0.45rem;
  color: var(--accent-text);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legal-page p,
.legal-page li {
  color: var(--text-2);
  line-height: 1.55;
}

.legal-page ul {
  padding-left: 1.15rem;
}

.legal-nav {
  margin-top: 2rem;
}

.legal-nav a {
  color: var(--accent-text);
}

.legal-contact {
  position: relative;
  display: grid;
  gap: 0.7rem;
  margin-top: 1.6rem;
  padding-top: 0.2rem;
}

.legal-contact h2 {
  margin-top: 0;
}

.legal-contact label {
  display: grid;
  gap: 0.3rem;
  color: var(--text-2);
  font-size: 0.9rem;
}

.legal-contact input,
.legal-contact select,
.legal-contact textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input);
  color: var(--text);
  font: inherit;
}

.legal-contact textarea {
  min-height: 8rem;
  resize: vertical;
}

.legal-contact .primary-btn {
  width: auto;
  justify-self: start;
  padding-inline: 1.2rem;
}

.legal-hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.legal-contact-status {
  margin: 0;
}

.legal-contact-status[data-state="ok"] {
  color: var(--accent-text);
}

.legal-contact-status[data-state="err"] {
  color: #fca5a5;
}

.home-body {
  min-height: 100dvh;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.2rem;
  padding-top: max(1.2rem, env(safe-area-inset-top));
  padding-bottom: max(1.2rem, env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}

.home-card {
  width: min(40rem, 100%);
  display: grid;
  gap: 0.95rem;
  margin-block: auto;
  padding: 1.5rem 1.4rem 1.6rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.home-kicker {
  margin: 0 0 0.15rem;
  color: var(--accent-text);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-lead,
.home-card p,
.home-features li {
  margin: 0;
  color: var(--text-2);
  line-height: 1.55;
}

.home-features {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.4rem;
}

.home-invite {
  color: var(--muted);
}

.home-actions {
  display: flex;
  gap: 0.65rem;
}

.home-actions .primary-btn {
  text-decoration: none;
}

@media (max-width: 720px) {
  .home-actions {
    position: sticky;
    bottom: -1px;
    z-index: 5;
    margin: 0 -0.2rem;
    padding: 0.7rem 0.2rem 0.15rem;
    background: linear-gradient(180deg, transparent, var(--surface) 42%);
  }
}

.home-legal {
  margin-top: 0.35rem;
}
