/* ==========================================================================
   Libreta de Aves — estilos
   Paleta: bosque (verde), papel (arena), loica (rojo), ámbar
   ========================================================================== */

:root {
  --bg: #f4f1e9;
  --bg-2: #ebe6da;
  --surface: #ffffff;
  --surface-2: #f6f3ec;
  --line: #e4ddcf;
  --line-strong: #d3cab8;
  --text: #1b2621;
  --muted: #6a776f;
  --accent: #1f7356;
  --accent-strong: #165a43;
  --accent-soft: #e1efe7;
  --on-accent: #ffffff;
  --amber: #b87512;
  --amber-soft: #fbeed6;
  --red: #c9443a;
  --red-soft: #fbe5e2;
  --slate-soft: #eceae4;
  --shadow-sm: 0 1px 2px rgba(27, 38, 33, .06), 0 1px 1px rgba(27, 38, 33, .04);
  --shadow: 0 1px 2px rgba(27, 38, 33, .05), 0 8px 24px -8px rgba(27, 38, 33, .12);
  --shadow-lg: 0 20px 50px -12px rgba(15, 30, 22, .35);
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "SF Pro Display", Roboto, sans-serif;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1512; --bg-2: #121b17; --surface: #16201b; --surface-2: #1c2823;
    --line: #26342d; --line-strong: #33443b; --text: #e7eee9; --muted: #93a39a;
    --accent: #4cc08f; --accent-strong: #6fd3a8; --accent-soft: #173529; --on-accent: #06140e;
    --amber: #e8a948; --amber-soft: #3a2c12; --red: #ef7468; --red-soft: #3b1c19; --slate-soft: #222d28;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -8px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1512; --bg-2: #121b17; --surface: #16201b; --surface-2: #1c2823;
  --line: #26342d; --line-strong: #33443b; --text: #e7eee9; --muted: #93a39a;
  --accent: #4cc08f; --accent-strong: #6fd3a8; --accent-soft: #173529; --on-accent: #06140e;
  --amber: #e8a948; --amber-soft: #3a2c12; --red: #ef7468; --red-soft: #3b1c19; --slate-soft: #222d28;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -8px rgba(0,0,0,.5);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -.01em; }
a { color: var(--accent); }
code { font: .88em ui-monospace, "Cascadia Code", Consolas, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; border: 1px solid var(--line); }
b { font-weight: 650; }
.muted { color: var(--muted); margin: 0 0 14px; }
.hint { color: var(--muted); font-size: .8rem; margin: 8px 0 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* ---------- Layout ---------- */
.app { min-height: 100dvh; }
.main { padding: 16px 16px calc(var(--tabbar-h) + var(--safe-b) + 88px); max-width: 1180px; margin: 0 auto; }
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.sidebar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand img { border-radius: 11px; box-shadow: var(--shadow-sm); width: 36px; height: 36px; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand strong { font-family: var(--font-display); font-size: 1.02rem; }
.brand small { color: var(--muted); font-size: .74rem; }
.sidebar .nav { display: none; }

.observer-chip {
  display: inline-flex; align-items: center; gap: 7px; max-width: 46vw;
  padding: 7px 12px 7px 9px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: .82rem; font-weight: 600; box-shadow: var(--shadow-sm);
}
.observer-chip svg { width: 17px; height: 17px; color: var(--accent); }
.observer-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.observer-chip.empty { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, var(--line)); }

/* Bottom tab bar (mobile) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 600;
}
.tabbar a svg { width: 23px; height: 23px; transition: transform .2s; }
.tabbar a.on { color: var(--accent); }
.tabbar a.on svg { transform: translateY(-1px); }
.tabbar a.on::before {
  content: ""; position: absolute; top: 8px; width: 54px; height: 30px; border-radius: 999px;
  background: var(--accent-soft); z-index: -1;
}
.dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 2px var(--surface); }
.tabbar .dot { top: 10px; margin-left: 20px; }

/* Desktop */
@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 248px 1fr; }
  .sidebar {
    flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 28px;
    height: 100dvh; padding: 24px 16px; border-bottom: 0; border-right: 1px solid var(--line);
    background: var(--bg-2); backdrop-filter: none;
  }
  .brand img { width: 42px; height: 42px; }
  .sidebar .nav { display: flex; flex-direction: column; gap: 4px; }
  .nav a {
    position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
    text-decoration: none; color: var(--muted); font-weight: 600; transition: background .15s, color .15s;
  }
  .nav a:hover { background: var(--surface-2); color: var(--text); }
  .nav a.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
  .nav .dot { position: static; margin-left: auto; }
  .sidebar-foot { margin-top: auto; }
  .observer-chip { max-width: 100%; width: 100%; padding: 10px 12px; border-radius: 12px; }
  .tabbar { display: none; }
  .main { padding: 36px 40px 64px; width: 100%; }
}

/* ---------- View header ---------- */
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 2px 18px; }
.view-head h1 { font-size: clamp(1.55rem, 1.2rem + 1.4vw, 2.1rem); font-weight: 700; }
.eyebrow { margin: 0 0 2px; color: var(--muted); font-size: .8rem; font-weight: 600; }
.eyebrow::first-letter { text-transform: uppercase; }
.net-pill { font-size: .72rem; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.net-pill.off { background: var(--amber-soft); color: var(--amber); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin: 0 0 14px; min-width: 0;
}
fieldset.card { margin: 0 0 14px; }
legend.card-title { float: left; width: 100%; }
legend.card-title + * { clear: both; }
.card.flush { padding: 0; overflow: hidden; }
.card-title { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.02rem; font-weight: 700; padding: 0; margin: 0 0 14px; }
.card-title.plain svg { color: var(--accent); }
.card-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-row .card-title { margin: 0; }
.step {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent); font-size: .78rem; font-weight: 800;
}
.tag { font-family: var(--font); font-size: .68rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--slate-soft); color: var(--muted); }
.stack { min-width: 0; }

.split { display: grid; gap: 14px; }
.side-panel { display: none; }
@media (min-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 24px; }
  .side-panel { display: block; position: sticky; top: 24px; }
}

/* ---------- Form controls ---------- */
.field-label { display: block; font-size: .78rem; font-weight: 700; color: var(--muted); margin: 14px 0 6px; letter-spacing: .01em; }
.card-title + .field-label, .card-title + .grid-2 > div > .field-label:first-child { margin-top: 0; }
.grid-2 { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

input[type="text"], input[type="search"], input[type="number"], input[type="datetime-local"], textarea {
  width: 100%; min-height: 46px; padding: 11px 13px; font: 16px/1.35 var(--font); color: var(--text);
  background: var(--surface-2); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  outline: none; transition: border-color .15s, box-shadow .15s, background .15s; -webkit-appearance: none; appearance: none;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:focus, textarea:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
textarea { resize: vertical; min-height: 84px; }
input[type="datetime-local"] { min-width: 0; }

/* Species combobox */
.combo { position: relative; }
.combo-icon { position: absolute; left: 13px; top: 13px; color: var(--muted); pointer-events: none; }
.combo input { padding-left: 42px; padding-right: 40px; font-weight: 600; }
.combo-clear {
  position: absolute; right: 6px; top: 6px; width: 34px; height: 34px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); font-size: 1.3rem; cursor: pointer;
}
.combo-list {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none;
  max-height: min(360px, 52vh); overflow: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
}
.combo-list:empty { display: none; }
.combo-list li { display: flex; flex-direction: column; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.combo-list li .c { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.combo-list li .s { color: var(--muted); font-style: italic; font-size: .82rem; }
.combo-list li mark { background: none; color: var(--accent); font-weight: 800; }
.combo-list li.active, .combo-list li:hover { background: var(--accent-soft); }
.combo-list li.custom .c { color: var(--accent); }
.combo-list li.empty { cursor: default; color: var(--muted); }
.combo-list .note { font-size: .64rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--slate-soft); color: var(--muted); font-style: normal; }

.recent { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.recent:empty { display: none; }
.recent::before { content: "Recientes"; font-size: .72rem; font-weight: 700; color: var(--muted); align-self: center; margin-right: 2px; }
.recent button {
  border: 1px dashed var(--line-strong); background: transparent; border-radius: 999px; padding: 5px 11px;
  font-size: .8rem; font-weight: 600; cursor: pointer; color: var(--text);
}
.recent button:hover { border-style: solid; border-color: var(--accent); color: var(--accent); }

/* Segmented control */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 14px; }
.segmented button {
  min-height: 38px; border: 0; border-radius: 10px; background: transparent; font-size: .84rem; font-weight: 650;
  color: var(--muted); cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; white-space: nowrap; padding: 0 6px;
}
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
#statusSeg button.on[data-s="confirmed"] { background: var(--accent); color: var(--on-accent); }
#statusSeg button.on[data-s="tentative"] { background: var(--amber); color: #fff; }
#statusSeg button.on[data-s="unidentified"] { background: var(--muted); color: var(--surface); }

/* Stepper */
.stepper { display: grid; grid-template-columns: 46px 1fr 46px; border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.stepper button { border: 0; background: transparent; font-size: 1.3rem; font-weight: 600; cursor: pointer; color: var(--accent); }
.stepper button:active { background: var(--accent-soft); }
.stepper input { border: 0; border-radius: 0; text-align: center; font-weight: 700; background: transparent; min-height: 44px; box-shadow: none !important; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips button {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); font-size: .84rem; font-weight: 600; color: var(--text);
  cursor: pointer; transition: all .15s;
}
.chips button:hover { border-color: var(--line-strong); }
.chips button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chips button .e { font-size: 1rem; line-height: 1; }
.chips-sm { margin-top: 8px; }
.chips-sm button { padding: 5px 10px; font-size: .78rem; }

/* GPS */
.gps {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 14px; padding: 12px 14px; text-align: left;
  border: 1.5px dashed var(--line-strong); border-radius: 14px; background: transparent; cursor: pointer; transition: all .15s;
}
.gps > svg { width: 22px; height: 22px; color: var(--accent); }
.gps:hover { border-color: var(--accent); background: var(--accent-soft); }
.gps-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.gps-text strong { font-size: .92rem; }
.gps-text small { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; }
.gps.has { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.gps.busy > svg { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.8); opacity: .5; } }
.gps-clear { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; font-size: 1.3rem; color: var(--muted); }
.gps-clear:hover { background: var(--surface); color: var(--red); }

/* Editing bar */
.editing-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; margin-bottom: 14px;
  border-radius: 14px; background: var(--amber-soft); color: var(--amber); font-weight: 700; font-size: .88rem;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: 14px; border: 1.5px solid transparent; font-weight: 700; font-size: .92rem; cursor: pointer;
  transition: transform .08s, background .15s, box-shadow .15s, border-color .15s; text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row.end { justify-content: flex-end; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 700; font-size: .85rem; cursor: pointer; text-decoration: none; }

.form-actions {
  position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px); z-index: 10;
  display: grid; grid-template-columns: auto 1fr; gap: 8px; padding: 8px;
  background: color-mix(in srgb, var(--surface) 90%, transparent); border: 1px solid var(--line); border-radius: 18px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow-lg);
}
.form-actions .btn-primary { min-height: 50px; font-size: 1rem; }
@media (min-width: 900px) { .form-actions { bottom: 20px; } }

/* ---------- Mini list (today) ---------- */
.mini-list { display: flex; flex-direction: column; }
.mini-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.mini-item:first-child { border-top: 0; }
.mini-item .t { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; width: 42px; }
.mini-item .n { font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-empty { color: var(--muted); font-size: .88rem; margin: 0; }
.tip { display: flex; gap: 12px; background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.tip svg { color: var(--accent); margin-top: 2px; }
.tip p { margin: 0; font-size: .86rem; }

/* ---------- Registro ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.search { position: relative; flex: 1 1 260px; }
.search svg { position: absolute; left: 13px; top: 13px; color: var(--muted); }
.search input { padding-left: 42px; background: var(--surface); }
.chips-filter button { padding: 7px 12px; }

.day { margin: 22px 2px 8px; font-size: .8rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; display: flex; justify-content: space-between; }
.day:first-child { margin-top: 0; }
.obs-grid { display: grid; gap: 10px; }
@media (min-width: 760px) { .obs-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } }

.obs {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px 14px 12px 18px; margin: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.obs::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.obs.tentative::before { background: var(--amber); }
.obs.unidentified::before { background: var(--line-strong); }
.obs-top { display: flex; align-items: flex-start; gap: 10px; }
.obs-name { flex: 1; min-width: 0; }
.obs-name strong { display: block; font-size: 1.02rem; line-height: 1.25; }
.obs-name em { color: var(--muted); font-size: .82rem; }
.obs-count { font-weight: 800; font-size: .82rem; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.obs-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: .82rem; }
.obs-meta span { display: inline-flex; align-items: center; gap: 4px; }
.obs-meta svg { width: 14px; height: 14px; }
.obs-meta a { color: inherit; }
.obs-notes { font-size: .86rem; margin: 2px 0 0; white-space: pre-wrap; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; }
.pill { font-size: .72rem; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.pill.status-tentative { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.pill.status-unidentified { background: var(--slate-soft); border-color: transparent; }
.pill.new { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.obs-acts { display: flex; gap: 2px; margin: -4px -6px 0 0; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state img { width: 72px; height: 72px; border-radius: 20px; opacity: .9; margin-bottom: 12px; }
.empty-state h3 { color: var(--text); margin-bottom: 6px; }
.empty-state p { margin: 0 0 16px; }

/* ---------- Especies ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow-sm); }
.stat b { display: block; font-family: var(--font-display); font-size: 1.75rem; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .8rem; font-weight: 600; }
.stat.hero { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.stat.hero span { color: color-mix(in srgb, var(--on-accent) 80%, transparent); }

.sp-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: center; }
.sp-row:first-child { border-top: 0; }
.sp-row .nm strong { display: block; font-size: .95rem; }
.sp-row .nm em { color: var(--muted); font-size: .8rem; }
.sp-row .num { text-align: right; font-size: .8rem; color: var(--muted); }
.sp-row .num b { display: block; color: var(--text); font-size: 1rem; font-variant-numeric: tabular-nums; }
.bar { grid-column: 1 / -1; height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.sp-rank { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-right: 6px; border-radius: 7px; background: var(--surface-2); font-size: .7rem; font-weight: 800; color: var(--muted); font-style: normal; vertical-align: 1px; }

/* ---------- Datos ---------- */
.data-grid { display: grid; gap: 0 16px; }
@media (min-width: 900px) { .data-grid { grid-template-columns: 1fr 1fr; } .data-grid .status-card, .data-grid .howto { grid-column: 1 / -1; } }
.status-card { display: flex; gap: 14px; align-items: flex-start; }
.status-card .ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); flex: none; }
.status-card.warn .ic { background: var(--amber-soft); color: var(--amber); }
.status-card h2 { font-size: 1.05rem; margin-bottom: 2px; }
.status-card p { margin: 0; color: var(--muted); font-size: .88rem; }
.status-card .grow { flex: 1; min-width: 0; }
.status-card .btn { margin-top: 12px; }
.link-state { display: flex; align-items: center; gap: 8px; font-size: .86rem; font-weight: 650; margin-bottom: 12px; }
.link-state:empty { display: none; }
.link-state::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.link-state.pending::before { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.observer-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.observer-list .row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.observer-list .row span { flex: 1; font-weight: 600; }
.observer-list .row.cur span::after { content: " · actual"; color: var(--accent); font-size: .78rem; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }
.install-box:not(:empty) { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .86rem; color: var(--muted); }
.howto summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary::after { content: "+"; font-size: 1.4rem; color: var(--muted); }
.howto[open] summary::after { content: "−"; }
.howto summary .card-title { margin: 0; }
.howto ol { margin: 14px 0 0; padding-left: 20px; display: grid; gap: 8px; font-size: .9rem; }

/* ---------- Dialog ---------- */
.dialog {
  width: min(420px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: 22px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgba(8, 18, 13, .45); backdrop-filter: blur(3px); }
.dialog h2 { font-size: 1.25rem; margin-bottom: 4px; }
.dialog input { margin: 4px 0 16px; }
.observer-pick { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.observer-pick button { text-align: left; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2); font-weight: 650; cursor: pointer; }
.observer-pick button:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 90px); z-index: 60;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
  padding: 12px 14px 12px 18px; border-radius: 14px; background: #16231d; color: #eef4f0;
  font-size: .9rem; font-weight: 600; box-shadow: var(--shadow-lg);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: all .25s cubic-bezier(.2, .8, .2, 1);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast button { border: 0; background: rgba(255, 255, 255, .12); color: #8ee0b8; font-weight: 800; padding: 6px 10px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
@media (min-width: 900px) { .toast { bottom: 100px; left: calc(50% + 124px); } }

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