/* Puls — design system. Tema oscuro por defecto + claro. */

:root {
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 64px;
  --header-h: 60px;
  --accent: #00c896;
  --accent-strong: #0ee6a8;
  --danger: #ff5a5f;
  --warn: #f5a623;
  --early: #4da3ff;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

html[data-theme="dark"] {
  --bg: #0b1220;
  --bg2: #101a2e;
  --surface: rgba(255, 255, 255, .045);
  --surface2: rgba(255, 255, 255, .08);
  --border: rgba(255, 255, 255, .09);
  --text: #e9eff8;
  --muted: #8fa0b8;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, .35);
  --glass: rgba(11, 18, 32, .82);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f2f6fb;
  --bg2: #e9eff7;
  --surface: #ffffff;
  --surface2: #f0f4fa;
  --border: rgba(16, 24, 40, .1);
  --text: #101828;
  --muted: #5b6b82;
  --shadow: 0 10px 30px rgba(16, 24, 40, .12);
  --shadow-sm: 0 4px 14px rgba(16, 24, 40, .08);
  --glass: rgba(242, 246, 251, .88);
  color-scheme: light;
}

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

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

body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 85% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
    radial-gradient(900px 400px at -10% 110%, color-mix(in srgb, #3b82f6 10%, transparent), transparent 60%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
}

#view { outline: none; }

/* --- Header de vista ------------------------------------------------------- */

.view-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--header-h);
  padding: calc(env(safe-area-inset-top) + 6px) 16px 6px;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}

.view-title {
  flex: 1;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.view-actions { display: flex; gap: 4px; flex-shrink: 0; }

.brand { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-size: 1.15rem; font-weight: 800; letter-spacing: -.02em; }
.brand-tag { font-size: .68rem; color: var(--muted); font-weight: 500; letter-spacing: .02em; }

.logo {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #009e79);
  color: #05251c;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

/* --- Botones / controles ---------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font: inherit; font-weight: 600; font-size: .88rem;
  padding: 9px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .12s var(--ease), background .15s, box-shadow .15s;
}
.btn:hover { background: color-mix(in srgb, var(--surface2) 85%, var(--accent) 8%); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  border-color: transparent;
  color: #05251c;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn.ghost { background: transparent; }
.btn.ghost.on { color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.btn.sm { padding: 6px 12px; font-size: .8rem; border-radius: 10px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px;
  border: none; background: transparent;
  color: var(--muted);
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s, color .15s, transform .12s var(--ease);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); }
.icon-btn:active { transform: scale(.92); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.star.on, .ic.on { color: var(--warn); }

.select, .trip-input {
  font: inherit; font-size: .9rem; color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.select:focus, .trip-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }

.seg { display: flex; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 3px; }
.seg-btn {
  flex: 1; border: none; background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; font-size: .82rem;
  padding: 8px 6px; border-radius: 9px; cursor: pointer;
  transition: background .15s, color .15s;
}
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* --- Chips / badges --------------------------------------------------------- */

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 700; letter-spacing: .01em;
  padding: 3px 8px; border-radius: 999px;
  background: var(--surface2); color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.chip.late { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.chip.early { color: var(--early); background: color-mix(in srgb, var(--early) 12%, transparent); border-color: color-mix(in srgb, var(--early) 35%, transparent); }
.chip.ontime { color: var(--muted); }
.chip.offline { color: var(--muted); }
.chip.live { color: var(--accent-strong); background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.chip.platform { font-variant-numeric: tabular-nums; }
.btn-chip { cursor: pointer; border: 1px solid var(--border); background: var(--surface2); color: var(--text); font-size: .76rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; transition: all .15s; }
.btn-chip:hover { border-color: var(--accent); color: var(--accent-strong); }

.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-strong);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.72); }
}

.line-badge {
  display: inline-grid; place-items: center;
  font-weight: 800; letter-spacing: -.01em;
  border-radius: 9px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.line-badge.md { min-width: 44px; height: 30px; padding: 0 8px; font-size: .95rem; }
.line-badge.sm { min-width: 34px; height: 22px; padding: 0 6px; font-size: .72rem; border-radius: 7px; }

/* --- Clock bar --------------------------------------------------------------- */

.clock-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 4px;
  font-variant-numeric: tabular-nums;
}
.clock { font-size: 1.5rem; font-weight: 800; letter-spacing: .02em; }
.net-row { padding: 10px 18px 0; display: flex; justify-content: flex-end; }
.net-status { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; color: var(--muted); font-weight: 600; }
.net-status.off { color: var(--warn); }

/* --- Secciones ---------------------------------------------------------------- */

.section { padding: 14px 16px 4px; }
.section-title {
  display: flex; align-items: center; gap: 6px;
  margin: 6px 4px 10px;
  font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted);
}

.fav-row { display: flex; flex-direction: column; gap: 10px; }
.near-list { display: flex; flex-direction: column; gap: 10px; }
.locate-wrap { display: flex; justify-content: center; padding: 18px 16px 6px; }
.locate-wrap .btn { width: 100%; max-width: 320px; }

/* --- Stop card (mini board) ---------------------------------------------------- */

.stop-card {
  display: block; width: 100%; text-align: left;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 13px 14px;
  cursor: pointer;
  transition: transform .14s var(--ease), border-color .15s, background .15s, box-shadow .15s;
  font: inherit; color: inherit;
  position: relative;
}
.stop-card:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); box-shadow: var(--shadow-sm); }
.stop-card:active { transform: scale(.99); }

.stop-card-top { display: flex; align-items: center; gap: 8px; }
.stop-name { font-weight: 700; font-size: .98rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop-dist { font-size: .74rem; color: var(--muted); font-weight: 600; flex-shrink: 0; }
.stop-card-board {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin-top: 9px; min-height: 22px;
  font-variant-numeric: tabular-nums;
}
.mini-loading { color: var(--muted); display: inline-flex; }
.mini-empty { font-size: .76rem; color: var(--muted); }

.dep-mini { display: inline-flex; align-items: center; gap: 7px; }
.dep-mini-dest { font-size: .8rem; color: var(--text); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-mini-time { font-size: .8rem; font-weight: 800; }
.dep-mini-time.rt { color: var(--accent-strong); }
.dep-mini.cancelled .dep-mini-dest, .dep-mini.cancelled .dep-mini-time { text-decoration: line-through; color: var(--muted); }

.fav-actions { display: flex; gap: 2px; margin-left: auto; }

/* --- Stop detail ---------------------------------------------------------------- */

.stop-content { padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 14px; }

.stop-hero { display: flex; flex-direction: column; gap: 10px; }
.stop-hero-name { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.stop-hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mode-tag { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; font-weight: 700; }
.stop-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stop-hero-actions .btn { flex: 1; min-width: 130px; }

.alert-banner {
  display: flex; gap: 10px; align-items: flex-start;
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
  color: color-mix(in srgb, var(--warn) 75%, var(--text));
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: .84rem;
}
.alert-banner p { margin: 0 0 3px; }
.alert-banner p:last-child { margin-bottom: 0; }
.alert-ic { flex-shrink: 0; margin-top: 1px; }

.board { display: flex; flex-direction: column; gap: 12px; }
.board-more { text-align: center; font-size: .76rem; color: var(--muted); font-weight: 600; padding: 4px 0 2px; }
.board-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.dep-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.dep-row:last-child { border-bottom: none; }
.dep-row.cancelled { opacity: .62; }
.dep-row.cancelled .dep-dest-txt, .dep-row.cancelled .dep-clock { text-decoration: line-through; }

.dep-main { flex: 1; min-width: 0; }
.dep-dest { display: flex; align-items: center; gap: 7px; }
.dep-dest-txt { font-weight: 700; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-line-name { font-size: .72rem; color: var(--muted); font-weight: 600; }
.dep-alert { color: var(--warn); display: inline-flex; }
.dep-sub { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }

.dep-time-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; min-width: 86px; }
.dep-count { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.dep-count.soon { color: var(--accent-strong); animation: pulseSoft 2s ease-in-out infinite; }
@keyframes pulseSoft { 0%, 100% { opacity: 1; } 50% { opacity: .65; } }
.dep-clock-row { display: flex; align-items: center; gap: 6px; }
.dep-clock { font-size: .82rem; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.dep-cancel { font-size: .8rem; font-weight: 800; color: var(--danger); text-transform: uppercase; letter-spacing: .04em; }
.dep-time-wrap .icon-btn.bell { width: 30px; height: 30px; margin-top: 2px; }

.popover {
  position: absolute; right: 12px; top: calc(100% - 6px); z-index: 20;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 10px;
  width: 200px;
  display: flex; flex-direction: column; gap: 8px;
}
.popover-title { margin: 0; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.popover-opts { display: flex; flex-wrap: wrap; gap: 6px; }

/* --- Trip ---------------------------------------------------------------------- */

.trip-form { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 4px; }
.trip-field { position: relative; display: flex; align-items: center; gap: 8px; }
.trip-field-ic { color: var(--muted); display: inline-flex; flex-shrink: 0; }
.trip-field .trip-input { padding-left: 6px; }
.trip-form .swap { align-self: flex-end; margin-top: -6px; }
.when-wrap { padding: 0 2px; }
.plan-btn { margin-top: 2px; }

.trip-autocomplete {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.trip-results { display: flex; flex-direction: column; gap: 12px; padding: 12px 16px 20px; }

.trip-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.trip-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--border); }
.trip-times { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.trip-times strong { font-weight: 800; }
.trip-arrow { color: var(--muted); display: inline-flex; }
.trip-meta { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.trip-legs { padding: 6px 0 10px; }

.leg { display: flex; gap: 12px; padding: 8px 15px 8px 12px; }
.leg-rail { display: flex; flex-direction: column; align-items: center; width: 14px; flex-shrink: 0; }
.leg-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--lc) 22%, transparent); }
.leg-line { flex: 1; width: 2px; background: color-mix(in srgb, var(--lc) 40%, transparent); margin: 3px 0; border-radius: 2px; }
.leg:last-child .leg-line { background: transparent; }
.leg-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; padding-bottom: 10px; }
.leg-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.leg-mode { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 700; color: var(--lc); }
.leg-rt { margin-left: auto; }
.leg-from, .leg-to { display: flex; align-items: baseline; gap: 9px; }
.leg-time { font-weight: 800; font-size: .88rem; font-variant-numeric: tabular-nums; width: 44px; flex-shrink: 0; }
.leg-name { font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leg-from .leg-name { color: var(--text); }

/* --- Settings -------------------------------------------------------------------- */

.settings-section {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 6px 14px 12px;
  margin: 12px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.settings-section .section-title { margin: 10px 0 0; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-label { font-size: .86rem; font-weight: 600; }
.settings-row .select { width: auto; min-width: 150px; }
.row-inline { display: flex; align-items: center; gap: 10px; }
.range-row { display: flex; align-items: center; gap: 12px; width: 100%; }
.range-row input[type="range"] {
  flex: 1; min-width: 0; height: 32px;
  accent-color: var(--accent-strong);
  cursor: pointer;
}
.range-value {
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: .9rem;
  min-width: 58px; text-align: right; color: var(--accent-strong);
}
.notif-status { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.notif-desc { margin: 0; font-size: .78rem; color: var(--muted); }
.about-box { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; }
.about-credits { margin: 0; font-weight: 700; font-size: .9rem; }
.about-data { margin: 0; font-size: .74rem; color: var(--muted); }
.about-user { display: flex; align-items: center; gap: 10px; }
.about-user .trip-input { max-width: 200px; }

/* --- Buscador overlay --------------------------------------------------------------- */

.map-wrap {
  height: 230px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 0 0 12px;
  position: relative;
  z-index: 1;
}
/* mapa del home: más grande (el reloj y favoritas ya no están arriba) */
.home-map { height: min(46vh, 400px); }
.map-wrap .leaflet-container {
  background: var(--bg2);
  font-family: var(--font);
}
.map-wrap .leaflet-popup-content-wrapper {
  border-radius: 10px;
  font-family: var(--font);
  font-weight: 700;
  font-size: .82rem;
  color: var(--text);
  background: var(--bg2);
  border: 1px solid var(--border);
}
.map-wrap .leaflet-popup-tip { background: var(--bg2); }
.map-wrap .leaflet-control-attribution { font-size: 9px; background: rgba(0,0,0,.35); color: #9aa7bd; }
.map-wrap .leaflet-control-attribution a { color: #c3cfe0; }
.stop-map { margin-top: 2px; }

/* Tiles de OpenStreetMap en modo oscuro (invertidos vía CSS, técnica estándar) */
html[data-theme="dark"] .map-wrap .leaflet-tile-pane {
  filter: invert(1) hue-rotate(195deg) brightness(.92) contrast(.92) saturate(.55);
}

#search-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 18px) 18px 18px;
  transition: opacity .18s var(--ease);
}
#search-overlay[hidden] { display: none; }
#search-overlay:not(.open) { opacity: 0; pointer-events: none; }

.search-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px 6px 14px;
  box-shadow: var(--shadow-sm);
}
.search-box-ic { font-size: 1rem; color: var(--muted); }
#search-input {
  flex: 1; font: inherit; font-size: 1rem; color: var(--text);
  background: transparent; border: none; outline: none; padding: 10px 0;
}
#search-input::placeholder { color: var(--muted); }
#search-close { color: var(--muted); }

.search-results { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.search-hint { color: var(--muted); font-size: .84rem; padding: 10px 4px; text-align: center; }

.search-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  cursor: pointer; text-align: left; color: inherit; font: inherit;
  transition: border-color .15s, transform .12s var(--ease);
}
.search-item:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.search-item:active { transform: scale(.99); }
.search-item-ic { color: var(--accent); display: inline-flex; flex-shrink: 0; }
.search-item-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.search-item-name { font-weight: 700; font-size: .9rem; }
.search-item-label { font-size: .74rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item-tag { font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-strong); flex-shrink: 0; }

/* --- Navegación inferior -------------------------------------------------------------- */

#bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 640px;
  z-index: 60;
  display: flex;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-top: 1px solid var(--border);
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 4px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 12px;
  font-size: .66rem; font-weight: 700; letter-spacing: .02em;
  transition: color .15s, background .15s;
  position: relative;
}
.nav-item .nav-ic { transition: transform .18s var(--ease); }
.nav-item.active { color: var(--accent-strong); }
.nav-item.active .nav-ic { transform: translateY(-1px); }
.nav-item.active::after {
  content: ''; position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent-strong);
}

/* --- Toasts ------------------------------------------------------------------------------ */

#toast-wrap {
  position: fixed; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);
  left: 50%; transform: translateX(-50%);
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  width: min(92vw, 480px);
  pointer-events: none;
}
.toast {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 14px;
  padding: 11px 16px;
  font-size: .84rem; font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(12px);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
  pointer-events: auto;
  max-width: 100%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.toast.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }

/* --- Instalar ------------------------------------------------------------------------------- */

.install-prompt {
  position: fixed; top: calc(env(safe-area-inset-top) + 10px); left: 50%; transform: translateX(-50%);
  z-index: 90;
  display: flex; align-items: center; gap: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  width: min(92vw, 480px);
}
.install-text { flex: 1; font-size: .84rem; font-weight: 700; }
.install-prompt .icon-btn.install-close { width: 30px; height: 30px; }
/* el atributo hidden debe ganarle al display:flex del banner (si no, queda
   un recuadro vacío flotando arriba tras cerrarlo) */
.install-prompt[hidden] { display: none; }

/* --- Estados vacíos / skeleton ----------------------------------------------------------------- */

.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 16px; text-align: center; }
.empty-ic { color: var(--muted); opacity: .8; }
.empty-title { margin: 0; font-weight: 700; font-size: .92rem; }
.empty-sub { margin: 0; font-size: .8rem; color: var(--muted); max-width: 300px; }

.skeleton-wrap { display: flex; flex-direction: column; gap: 10px; }
.skeleton-line {
  height: 76px;
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--surface) 40%, var(--surface2) 50%, var(--surface) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { 0% { background-position: 120% 0; } 100% { background-position: -80% 0; } }

/* --- Accesibilidad ------------------------------------------------------------------------------ */

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.no-scroll { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}

@media (min-width: 700px) {
  #app { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
  #bottom-nav { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}
