/* ------------------------------------------------------------------ */
/* Ambulist — design tokens                                              */
/* ------------------------------------------------------------------ */
:root {
  --ink: #1b1f1d;
  --slate: #2c3330;
  --slate-light: #2f3835;
  --slate-lighter: #3a4340;
  --moss: #7c9070;
  --moss-dark: #5d7256;
  --paper: #ece6d8;
  --paper-dim: #c9c2b2;
  --muted: #8a9189;
  --border: #3a4340;
  --danger: #b3705f;

  --font-display: "Fraunces", "Georgia", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --sidebar-width: 380px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius: 14px;
  --radius-sm: 8px;
  --attribution-bg: rgba(36, 43, 41, 0.7);
}

/* ------------------------------------------------------------------ */
/* Light theme — aged paper, ink text                                   */
/* ------------------------------------------------------------------ */
:root[data-theme="light"] {
  --ink: #f3efe3;
  --slate: #ffffff;
  --slate-light: #ece4d2;
  --slate-lighter: #ddd3ba;
  --moss: #5d7256;
  --moss-dark: #4a5c45;
  --paper: #2c2f2a;
  --paper-dim: #5c5f56;
  --muted: #8a8270;
  --border: #ddd3ba;
  --danger: #a14e3c;
  --attribution-bg: rgba(255, 255, 255, 0.75);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0;
}

button {
  font-family: var(--font-body);
}

a {
  color: var(--moss);
}

/* ------------------------------------------------------------------ */
/* App shell — full-screen map as background                            */
/* ------------------------------------------------------------------ */
#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* ------------------------------------------------------------------ */
/* Persistent background map                                            */
/* ------------------------------------------------------------------ */
#map-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--ink);
}

/* ------------------------------------------------------------------ */
/* Guest banner (floating pill, horizontally centred at top)           */
/* ------------------------------------------------------------------ */
#guest-banner {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 16px;
  background: var(--moss-dark);
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  border-radius: var(--radius);
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.guest-banner-exit {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 12px;
  font-family: var(--font-body);
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.guest-banner-exit:active {
  background: rgba(255, 255, 255, 0.25);
}

/* ------------------------------------------------------------------ */
/* Sidebar show button (visible when sidebar is collapsed)              */
/* ------------------------------------------------------------------ */
#sidebar-show-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--slate);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 8px 16px 8px 12px;
  color: var(--paper);
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.15s ease;
}

#sidebar-show-btn .mark {
  color: var(--moss);
  font-size: 20px;
  line-height: 1;
}

#sidebar-show-btn:active {
  background: var(--slate-light);
}

/* ------------------------------------------------------------------ */
/* Sidebar (floating panel — right side, with gap from edges)           */
/* ------------------------------------------------------------------ */
#sidebar {
  position: absolute;
  right: 20px;
  top: 20px;
  bottom: 20px;
  width: var(--sidebar-width);
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: var(--slate);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.3s ease;
}

#sidebar.sidebar-collapsed {
  transform: translateX(calc(100% + 24px));
}

.sidebar-handle {
  display: none;
  width: 100%;
  padding: 14px 0 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-handle::after {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 0 auto;
}

/* ------------------------------------------------------------------ */
/* Sidebar header — two rows: brand above, actions below                */
/* ------------------------------------------------------------------ */
#sidebar-header {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 8px 8px 16px;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s ease;
  gap: 2px;
}

.sidebar-brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.sidebar-brand-row .mark {
  color: var(--moss);
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  display: inline-block;
  transform: scaleX(-1);
}

/* All uses of .mark use the Old Italic Letter A (𐌀) flipped horizontally */
.mark {
  display: inline-block;
  transform: scaleX(-1);
}

.sidebar-brand-row h1 {
  font-size: 20px;
  color: var(--paper);
  flex: 1;
}

.sidebar-collapse-btn {
  margin-left: auto;
  flex-shrink: 0;
}

.sidebar-actions-row {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ */
/* In-body sub-header (back button + page title)                        */
/* ------------------------------------------------------------------ */
.sidebar-subheader {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--slate);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 8px 4px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s ease;
}

.sidebar-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-back-btn:active {
  background: var(--slate-light);
}

.sidebar-subheader-title {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--paper);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ------------------------------------------------------------------ */
/* Sidebar footer — always pinned to bottom, outside scroll area        */
/* ------------------------------------------------------------------ */
#sidebar-footer {
  flex-shrink: 0;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  transition: border-color 0.2s ease;
}

#sidebar-footer:empty {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Guest trip promo (in walk detail, where trip badge would appear)     */
/* ------------------------------------------------------------------ */
.guest-trip-promo {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.guest-trip-promo a {
  color: var(--moss);
}

/* ------------------------------------------------------------------ */
/* Form stats override fields                                           */
/* ------------------------------------------------------------------ */
.form-stats-override {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-note {
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}

/* ------------------------------------------------------------------ */
/* Map style picker (Leaflet custom control)                            */
/* ------------------------------------------------------------------ */
.map-style-control {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 4px;
}

.map-style-btn {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  background: var(--slate);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: background-color 0.15s ease;
}

.map-style-btn:active {
  background: var(--slate-light);
}

.map-style-panel {
  background: var(--slate);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  min-width: 140px;
}

.map-style-panel.hidden {
  display: none;
}

.map-style-pill {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--paper);
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.map-style-pill:hover {
  background: var(--slate-light);
}

.map-style-pill.active {
  background: var(--moss);
  color: var(--ink);
}

/* ------------------------------------------------------------------ */
/* Header buttons                                                       */
/* ------------------------------------------------------------------ */
.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
}

.header-btn:active {
  background: var(--slate-light);
}

.header-signin {
  background: transparent;
  border: none;
  color: var(--moss);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 4px;
  cursor: pointer;
  white-space: nowrap;
}

.header-signin:active {
  opacity: 0.7;
}

/* ------------------------------------------------------------------ */
/* Login modal overlay                                                  */
/* ------------------------------------------------------------------ */
#view-login {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--slate);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px 28px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.login-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.login-close:hover {
  background: var(--slate-light);
  color: var(--paper);
}

.login-card .mark {
  font-size: 28px;
  margin-bottom: 6px;
}

.login-card h1 {
  font-size: 24px;
  color: var(--paper);
  margin-bottom: 20px;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card .error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 20px;
  color: var(--muted);
  font-size: 12px;
}

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

.create-account-section {
  text-align: left;
}

.create-account-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.create-account-header strong {
  font-size: 14px;
  font-weight: 500;
  color: var(--paper-dim);
}

.create-account-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.privacy-notice-small {
  margin-top: 20px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* Forms                                                                */
/* ------------------------------------------------------------------ */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.field label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input, textarea, select {
  width: 100%;
  background: var(--slate-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--paper);
  padding: 13px 14px;
  font-size: 15px;
  font-family: var(--font-body);
  min-height: 48px;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--moss);
}

input::placeholder, textarea::placeholder {
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
}

.btn-primary {
  background: var(--moss);
  color: var(--ink);
}

.btn-primary:active {
  background: var(--moss-dark);
}

.btn-secondary {
  background: var(--slate-light);
  color: var(--paper);
  border-color: var(--border);
}

.btn-secondary:active {
  background: var(--slate-lighter);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger:active {
  background: rgba(179, 112, 95, 0.12);
}

.btn-block {
  width: 100%;
}

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

/* ------------------------------------------------------------------ */
/* Sidebar list view                                                    */
/* ------------------------------------------------------------------ */
.sidebar-list-actions {
  padding: 12px 16px 4px;
}

/* ------------------------------------------------------------------ */
/* Trip group in list view                                              */
/* ------------------------------------------------------------------ */
.trip-group {
  margin-bottom: 8px;
}

.trip-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  color: var(--paper);
}

.trip-group-header:active {
  background: var(--slate-light);
}

.trip-group-header .swatch {
  width: 10px;
  height: 36px;
  border-radius: 6px;
  flex-shrink: 0;
}

.trip-group-info {
  flex: 1;
  min-width: 0;
}

.trip-group-name {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--paper);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}

.trip-group-meta {
  font-size: 12px;
  color: var(--muted);
}

.trip-group-walks {
  padding-left: 16px;
}

/* ------------------------------------------------------------------ */
/* Section heading in list view                                         */
/* ------------------------------------------------------------------ */
.list-section-heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 16px 4px;
}

/* ------------------------------------------------------------------ */
/* Hike cards                                                           */
/* ------------------------------------------------------------------ */
.hike-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 16px 16px;
}

.hike-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--slate-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.hike-card:active {
  background: var(--slate-lighter);
}

.swatch {
  width: 10px;
  height: 44px;
  border-radius: 6px;
  flex-shrink: 0;
}

.hike-card-body {
  flex: 1;
  min-width: 0;
}

.hike-card-title {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--paper);
  margin: 0 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hike-card-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12.5px;
}

.hike-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.trip-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--moss);
}

/* Planned (not-yet-walked) walk card */
.hike-card.planned {
  border-style: dashed;
  opacity: 0.82;
}

.hike-card.planned .hike-card-title::after {
  content: " · planned";
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  font-style: italic;
}

/* Download buttons in walk detail */
.detail-download {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  background: var(--slate-light);
  color: var(--paper);
}

.btn-sm:active {
  background: var(--slate-lighter);
}

.trip-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ------------------------------------------------------------------ */
/* Usage banner (free plan limit)                                       */
/* ------------------------------------------------------------------ */
.usage-banner {
  margin: 0 16px 4px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--slate);
  color: var(--muted);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.usage-banner.usage-full {
  border-color: var(--danger);
  color: var(--danger);
}

/* ------------------------------------------------------------------ */
/* Hike detail view                                                     */
/* ------------------------------------------------------------------ */
.detail-body {
  padding: 18px 18px 32px;
}

.detail-title {
  font-size: 26px;
  margin-bottom: 4px;
}

.detail-date {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.planned-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--moss);
  border: 1.5px dashed var(--moss);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  margin-bottom: 16px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-row.stats-1col {
  grid-template-columns: 1fr;
}

.stat-row.stats-2col {
  grid-template-columns: repeat(2, 1fr);
}

.stat-box {
  background: var(--slate-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--paper);
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.detail-notes {
  color: var(--paper-dim);
  white-space: pre-wrap;
  margin-bottom: 24px;
  line-height: 1.65;
}

.detail-notes:empty::before {
  content: "No notes for this walk.";
  color: var(--muted);
  font-style: italic;
}

.detail-actions {
  display: flex;
  gap: 10px;
}

.detail-actions .btn {
  flex: 1;
}

/* ------------------------------------------------------------------ */
/* Trip detail view                                                     */
/* ------------------------------------------------------------------ */
.trip-day-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.trip-day-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--slate-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.trip-day-card:active {
  background: var(--slate-lighter);
}

.trip-day-index {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--muted);
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* Add / Edit view                                                      */
/* ------------------------------------------------------------------ */
.form-page {
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-x: hidden;
}

.upload-box {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  background: var(--slate-light);
}

.upload-box.has-file {
  border-color: var(--moss);
  color: var(--paper-dim);
}

.upload-box .upload-icon {
  margin-bottom: 8px;
  color: var(--moss);
}

.upload-box input[type="file"] {
  display: none;
}

#preview-map {
  height: 200px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--slate-light);
}

/* ------------------------------------------------------------------ */
/* Trip grouping (Add/Edit form)                                        */
/* ------------------------------------------------------------------ */
.trip-new-input {
  margin-top: 8px;
}

.trip-new-input.hidden {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Empty states                                                         */
/* ------------------------------------------------------------------ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.empty-state .empty-icon {
  color: var(--moss-dark);
  margin-bottom: 14px;
}

.empty-state h3 {
  color: var(--paper-dim);
  font-size: 18px;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  max-width: 240px;
  margin: 0;
}

/* ------------------------------------------------------------------ */
/* Leaflet tweaks                                                       */
/* ------------------------------------------------------------------ */
.leaflet-container {
  background: var(--slate);
  font-family: var(--font-body);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--slate);
  color: var(--paper);
}

.leaflet-control-attribution {
  background: var(--attribution-bg) !important;
  color: var(--muted) !important;
}

.leaflet-control-attribution a {
  color: var(--paper-dim) !important;
}

/* ------------------------------------------------------------------ */
/* Toast                                                                */
/* ------------------------------------------------------------------ */
#toast {
  position: fixed;
  bottom: 24px;
  left: calc(50% - var(--sidebar-width) / 2);
  transform: translateX(-50%) translateY(20px);
  background: var(--slate-lighter);
  color: var(--paper);
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 13px;
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  white-space: nowrap;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ------------------------------------------------------------------ */
/* Toggle switch                                                        */
/* ------------------------------------------------------------------ */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-row-label {
  flex: 1;
}

.toggle-row-label strong {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: var(--paper);
  margin-bottom: 2px;
}

.toggle-row-label span {
  font-size: 12.5px;
  color: var(--muted);
}

.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--slate-lighter);
  border-radius: 13px;
  transition: background 0.2s ease;
  cursor: pointer;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.toggle input:checked + .toggle-track {
  background: var(--moss);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(18px);
}

/* ------------------------------------------------------------------ */
/* Share URL row                                                        */
/* ------------------------------------------------------------------ */
.share-url-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--slate-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-top: 10px;
}

.share-url-text {
  flex: 1;
  font-size: 12px;
  color: var(--paper-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.share-copy-btn {
  flex-shrink: 0;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--moss);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.share-copy-btn:active {
  background: var(--slate-lighter);
}

/* ------------------------------------------------------------------ */
/* Share section (inside walk detail)                                  */
/* ------------------------------------------------------------------ */
.share-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.share-section-heading {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

/* ------------------------------------------------------------------ */
/* Settings view                                                        */
/* ------------------------------------------------------------------ */
.settings-body {
  padding: 18px;
}

.settings-section-heading {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
  margin-top: 24px;
}

.settings-section-heading:first-child {
  margin-top: 0;
}

.settings-data-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-data-row .btn {
  flex: 1;
  min-width: 120px;
  font-size: 13.5px;
  min-height: 42px;
  padding: 8px 14px;
}

/* ------------------------------------------------------------------ */
/* About / FAQ view                                                     */
/* ------------------------------------------------------------------ */
.about-body {
  padding: 18px;
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-q {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--paper);
  margin-bottom: 8px;
}

.faq-a {
  font-size: 14px;
  color: var(--paper-dim);
  line-height: 1.6;
}

/* ------------------------------------------------------------------ */
/* Share shell (public read-only pages — no auth, no nav)              */
/* ------------------------------------------------------------------ */
#share-shell {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  overflow-y: auto;
}

#share-header {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#share-header .mark {
  font-size: 22px;
  line-height: 1;
  color: var(--moss);
}

#share-header h1 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--paper);
}

#share-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.view {
  height: 100%;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.view.hidden {
  display: none;
}

.share-footer {
  text-align: center;
  padding: 18px;
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.share-footer a {
  color: var(--moss);
  text-decoration: none;
}

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

.share-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  gap: 10px;
}

.share-error h2 {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--paper);
}

#view-share-list .share-list-body {
  padding: 0 18px 24px;
}

#share-list-map {
  height: 38vh;
  min-height: 220px;
  background: var(--slate-light);
  flex-shrink: 0;
}

.detail-map {
  height: 38vh;
  min-height: 220px;
  background: var(--slate);
}

/* ------------------------------------------------------------------ */
/* Loading spinner                                                      */
/* ------------------------------------------------------------------ */
.spinner-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Responsive: Mobile (< 760px) — sidebar becomes a bottom sheet       */
/* ------------------------------------------------------------------ */
@media (max-width: 759px) {
  #guest-banner {
    top: 16px;
    max-width: calc(100vw - 32px);
    white-space: normal;
    text-align: center;
    flex-wrap: wrap;
    justify-content: center;
  }

  #sidebar-show-btn {
    top: auto;
    bottom: 20px;
    right: 50%;
    transform: translateX(50%);
  }

  #sidebar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    height: 85vh;
    border-radius: 18px 18px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    transform: translateY(calc(100% - 90px));
    transition: transform 0.3s ease, background-color 0.2s ease, border-color 0.2s ease;
  }

  #sidebar.sidebar-collapsed {
    transform: translateY(100%);
  }

  #sidebar.expanded {
    transform: translateY(0);
  }

  .sidebar-handle {
    display: block;
  }

  /* Collapse button: ↑ when peeking (tap to expand), ↓ when expanded (tap to collapse) */
  #sidebar:not(.expanded) .sidebar-collapse-btn svg {
    transform: rotate(-90deg);
  }
  #sidebar.expanded .sidebar-collapse-btn svg {
    transform: rotate(90deg);
  }

  .form-stats-override {
    grid-template-columns: 1fr;
  }

  #toast {
    left: 50%;
    bottom: 90px;
  }
}
