:root {
  /* Tema oscuro azulado (el que Isra prefiere). RGB aparte para las rgba(). */
  --bg: #0d1016;
  --bg-rgb: 13,16,22;
  --bg2: #151a22;
  --card: #1a212b;
  --card2: #222b38;
  --border: #2a3542;
  --border2: #364354;
  --text: #eef2f8;
  --text2: #94a2b6;
  --accent: #7cb0ff;
  --accent-rgb: 124,176,255;
  --accent2: #a08bff;
  --accent2-rgb: 160,139,255;
  --accent-ink: #0a1020;
  --ok: #58d68a;
  --warn: #f6b545;
  --gold: #ffd479;
  --radius: 18px;
  --shadow: 0 12px 34px rgba(0,0,0,.4);
  --grad: linear-gradient(135deg, var(--accent), var(--accent2));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(130% 80% at 50% -10%, #17202e 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--text2); }
button { font-family: inherit; cursor: pointer; }
svg { display: block; }

/* ---------- Login ---------- */
.login { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(120% 70% at 50% 0%, rgba(var(--accent-rgb),.18), transparent 60%), var(--bg); }
.login-card { text-align: center; max-width: 340px; animation: rise .5s ease; }
.login-logo { font-size: 60px; filter: drop-shadow(0 8px 20px rgba(var(--accent-rgb),.4)); }
.login-card h1 { font-size: 40px; font-weight: 800; margin: 6px 0 2px; letter-spacing: .5px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.login-tag { color: var(--text2); font-size: 15px; margin: 4px 0 30px; line-height: 1.6; }
.gbtn-wrap { display: flex; justify-content: center; min-height: 44px; }
.login-foot { font-size: 12.5px; margin-top: 26px; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 18px 14px;
  background: linear-gradient(180deg, var(--bg) 55%, rgba(var(--bg-rgb),.6));
  backdrop-filter: blur(10px);
}
.brand { font-size: 21px; font-weight: 800; letter-spacing: .3px; display: flex; align-items: center; gap: 9px; }
.brand .logo { font-size: 23px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; width: 42px; height: 42px; display: grid; place-items: center; font-size: 16px;
  transition: border-color .15s, transform .1s;
}
.icon-btn:hover { border-color: var(--border2); }
.icon-btn:active { transform: scale(.93); }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border2); background: var(--card2); }

.view { padding: 6px 18px 44px; max-width: 760px; margin: 0 auto; }
.sec-title { font-size: 13px; color: var(--text2); font-weight: 700; letter-spacing: .8px; text-transform: uppercase; margin: 24px 2px 14px; }

/* ---------- Aviso: sin nube ---------- */
.cloud-warn {
  display: block; width: 100%; margin: 14px 0 4px; padding: 13px 16px;
  background: rgba(246,181,69,.12); border: 1px solid #7a5a2a; color: var(--warn);
  border-radius: 13px; font-size: 13.5px; line-height: 1.5; text-align: left;
}
.cloud-warn strong { color: var(--gold); }
.sync-status { font-size: 12.5px; text-align: center; margin-top: 18px; padding: 10px; background: var(--card); border-radius: 10px; border: 1px solid var(--border); white-space: pre-line; cursor: pointer; }

/* ---------- Seguir escuchando ---------- */
.continue-list { display: flex; flex-direction: column; gap: 11px; }
.continue-card {
  display: flex; gap: 14px; align-items: center;
  background: linear-gradient(135deg, var(--card2), var(--card));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow);
  transition: transform .12s, border-color .15s;
}
.continue-card:active { transform: scale(.99); }
.continue-card .mini-cover {
  width: 52px; height: 72px; border-radius: 9px; flex-shrink: 0; overflow: hidden;
  display: grid; place-items: center; font-size: 24px; color: #fff; background: var(--grad);
  background-size: cover; background-position: center; box-shadow: 0 6px 14px rgba(0,0,0,.35);
}
.continue-card .cc-main { flex: 1; min-width: 0; }
.continue-card .cc-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue-card .cc-sub { font-size: 12.5px; color: var(--text2); margin-top: 3px; }
.continue-card .cc-bar { height: 5px; background: rgba(0,0,0,.35); border-radius: 3px; margin-top: 9px; overflow: hidden; }
.continue-card .cc-fill { height: 100%; background: var(--grad); border-radius: 3px; }
.continue-card .cc-play {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  background: var(--grad); color: var(--accent-ink); border: none; display: grid; place-items: center;
  box-shadow: 0 6px 16px rgba(var(--accent-rgb),.35);
}
.continue-card .cc-play svg { width: 20px; height: 20px; margin-left: 2px; }

/* ---------- Biblioteca ---------- */
.lib-head { display: flex; align-items: center; justify-content: space-between; }
.lib-count { color: var(--text2); font-weight: 700; opacity: .75; }

/* Barra: buscar · ordenar · cuadrícula/lista. En móvil el buscador se lleva
   una línea entera y el resto baja a la siguiente, alineado a la derecha. */
.lib-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 0 2px 14px; }
.search-wrap { flex: 1 1 200px; min-width: 0; display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 0 10px; height: 40px; }
.search-wrap:focus-within { border-color: var(--accent); }
.search-wrap .search-ico { color: var(--text2); flex-shrink: 0; }
.search-wrap input {
  flex: 1; min-width: 0; background: none; border: none; outline: none;
  color: var(--text); font: inherit; font-size: 14.5px; padding: 0;
}
.search-wrap input::placeholder { color: var(--text2); }
.search-wrap input::-webkit-search-cancel-button { display: none; }
.search-clear { background: none; border: none; color: var(--text2); font-size: 13px; padding: 4px 2px; }
.lib-bar-right { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.lib-sort {
  height: 40px; background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; padding: 0 8px; font: inherit; font-size: 13.5px; cursor: pointer;
}
.lib-sort:focus { outline: none; border-color: var(--accent); }
.view-toggle { display: flex; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 3px; }
.vt {
  width: 38px; height: 32px; display: grid; place-items: center; border: none; border-radius: 9px;
  background: none; color: var(--text2); transition: background .15s, color .15s;
}
.vt[aria-pressed="true"] { background: var(--card2); color: var(--accent); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.vt:active { transform: scale(.94); }

.add-btn {
  background: var(--grad); color: var(--accent-ink); font-weight: 700;
  padding: 10px 15px; border-radius: 13px; font-size: 14px; border: none;
  display: inline-flex; align-items: center; gap: 7px; box-shadow: 0 6px 16px rgba(var(--accent-rgb),.3);
  transition: transform .1s;
}
.add-btn:active { transform: scale(.96); }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 16px; margin-top: 6px; }
.book-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 15px; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: var(--shadow); position: relative;
  transition: transform .13s, border-color .15s;
}
.book-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.book-card .cover-box {
  aspect-ratio: 2/3; display: grid; place-items: center; position: relative; overflow: hidden;
  color: #fff; background: var(--grad); background-size: cover; background-position: center;
}
/* Lomo del libro cuando es portada de color (sin imagen) */
.book-card .cover-box.gen::before { content: ""; position: absolute; left: 12px; top: 0; bottom: 0; width: 3px; background: rgba(0,0,0,.22); box-shadow: 6px 0 12px rgba(0,0,0,.15); }
.book-card .cover-box .gen-title { padding: 0 12px; text-align: center; font-weight: 700; font-size: 14px; line-height: 1.35; text-shadow: 0 2px 8px rgba(0,0,0,.4); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.book-card .cover-box .badges { position: absolute; left: 8px; bottom: 8px; right: 8px; display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.book-card .cover-box .pct { background: rgba(0,0,0,.6); font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; backdrop-filter: blur(4px); }
.book-card .cover-box .pct.done { background: rgba(88,214,138,.85); color: #08210f; }
.book-card .cover-box .offline { background: rgba(0,0,0,.6); font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 20px; backdrop-filter: blur(4px); color: var(--ok); }
/* Barra de avance en el pie de la portada: se ve el progreso de un vistazo */
.book-card .cover-box .cover-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(0,0,0,.45); }
.book-card .cover-box .cover-bar i { display: block; height: 100%; background: var(--grad); }
.book-card .bc-info { padding: 10px 12px 13px; }
.book-card .bc-title { font-size: 13.5px; font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-card .bc-sub { font-size: 11.5px; color: var(--text2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-card .del {
  position: absolute; top: 7px; right: 7px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; border: none; display: grid; place-items: center; opacity: 0;
  transition: opacity .15s; backdrop-filter: blur(4px);
}
.book-card:hover .del, .book-card:active .del { opacity: 1; }
/* En pantalla táctil no hay «pasar el ratón»: la papelera se ve siempre (si no,
   era imposible borrar un libro desde el móvil). */
@media (hover: none) { .book-card .del { opacity: .85; } }
.book-card .cover-box:focus-visible,
.book-row .row-main:focus-visible, .continue-card .cc-main:focus-visible {
  outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 10px;
}

/* ---------- Biblioteca en LISTA ---------- */
.library-grid.list { display: flex; flex-direction: column; gap: 9px; }
.book-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 11px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  transition: border-color .15s, transform .12s;
}
.book-row:hover { border-color: var(--border2); }
.book-row:active { transform: scale(.995); }
.book-row .row-cover {
  width: 42px; height: 60px; border-radius: 8px; flex-shrink: 0; overflow: hidden;
  display: grid; place-items: center; font-size: 20px; color: #fff; background: var(--grad);
  background-size: cover; background-position: center; box-shadow: 0 4px 10px rgba(0,0,0,.3);
}
.book-row .row-main { flex: 1; min-width: 0; cursor: pointer; }
.book-row .row-title { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-row .row-sub { font-size: 12px; color: var(--text2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-row .row-sub .ok { color: var(--ok); }
.book-row .row-bar { height: 4px; background: rgba(0,0,0,.35); border-radius: 3px; margin-top: 7px; overflow: hidden; }
.book-row .row-bar i { display: block; height: 100%; background: var(--grad); border-radius: 3px; }
.book-row .row-play {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; border: none;
  background: var(--grad); color: var(--accent-ink); display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(var(--accent-rgb),.3);
}
.book-row .row-play svg { width: 17px; height: 17px; margin-left: 2px; }
.book-row .row-play:active { transform: scale(.93); }
.book-row .row-del {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; border: none;
  background: var(--card2); color: var(--text2); display: grid; place-items: center; font-size: 14px;
}
.book-row .row-del:hover { color: var(--text); }

.empty { text-align: center; padding: 54px 20px; }
.empty-ico { font-size: 48px; }
.empty p { margin: 8px 0; }

/* ---------- Reproductor ---------- */
.player { padding: 0; max-width: none; min-height: 100dvh; position: relative; overflow: hidden; }
.player-bg { position: absolute; inset: 0; z-index: 0; transition: background .5s; }
.player-inner { position: relative; z-index: 1; max-width: 540px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 22px 40px; display: flex; flex-direction: column; min-height: 100dvh; }
.icon-btn.back { width: auto; padding: 0 15px 0 11px; gap: 5px; align-self: flex-start; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; }
.cover-wrap { display: grid; place-items: center; margin: 22px 0 20px; }
.cover {
  width: 200px; height: 300px; border-radius: 16px; display: grid; place-items: center;
  color: #fff; background: var(--grad); background-size: cover; background-position: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.55); position: relative; overflow: hidden; text-align: center;
}
.cover .cover-emoji { font-size: 74px; }
.cover .cover-title { padding: 0 18px; font-weight: 700; font-size: 19px; line-height: 1.4; text-shadow: 0 2px 10px rgba(0,0,0,.45); }
.now { text-align: center; margin-bottom: 16px; }
.now-title { font-size: 21px; font-weight: 800; letter-spacing: .2px; }
.now-sub { color: var(--text2); font-size: 13.5px; margin-top: 4px; }

.player-actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 16px; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 7px; background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 22px; padding: 9px 15px; font-size: 13px; font-weight: 600;
  transition: border-color .15s, transform .1s;
}
.pill-btn:hover { border-color: var(--border2); }
.pill-btn:active { transform: scale(.95); }
.pill-btn svg { opacity: .85; }

.para-wrap { position: relative; margin-bottom: 18px; }
.para-view {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 15px 17px; font-size: 16px; line-height: 1.65; color: var(--text);
  max-height: 26vh; overflow-y: auto; min-height: 58px; cursor: pointer;
}
.expand-btn {
  position: absolute; right: 8px; bottom: 8px; width: 32px; height: 32px; border-radius: 9px;
  background: rgba(var(--bg-rgb),.72); color: var(--text2); border: 1px solid var(--border);
  display: grid; place-items: center; backdrop-filter: blur(4px);
}
.expand-btn:hover { color: var(--text); border-color: var(--border2); }
.para-view.reading { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset, 0 0 24px rgba(var(--accent-rgb),.12); }
/* Modo lectura (vista mini y lector): lo ya leído/pendiente atenuado, la frase en curso muy marcada */
.para-view.reading .sent, .reader-text.reading .sent { color: #5c6b7e; transition: color .25s, background .25s, box-shadow .25s; }
.para-view .sent, .reader-text .sent { border-radius: 5px; padding: 1px 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.para-view.reading .sent.on, .reader-text.reading .sent.on { color: #fff; background: linear-gradient(90deg, rgba(var(--accent-rgb),.38), rgba(var(--accent2-rgb),.30)); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.28); font-weight: 600; }
.para-view:not(.reading) .sent, .reader-text:not(.reading) .sent { color: var(--text); }

/* ---------- Lector a pantalla completa ---------- */
.reader { position: fixed; inset: 0; z-index: 35; background: var(--bg); display: flex; flex-direction: column; }
.reader-top {
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--border); background: var(--bg2);
}
.reader-info { flex: 1; min-width: 0; }
.reader-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-pos { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.reader-text {
  max-width: 680px; margin: 0 auto;
  padding: 22px 20px calc(150px + env(safe-area-inset-bottom));
  font-size: 17.5px; line-height: 1.8;
}
/* pre-line: los párrafos del fragmento (separados por línea en blanco) se ven
   como párrafos de verdad, en el lector y en la vista mini */
.reader-text p.rp { margin: 0 0 1.1em; white-space: pre-line; }
.para-view { white-space: pre-line; }
.reader-text .sent { cursor: pointer; }
/* Frase elegida con el dedo («leer desde aquí»): dorado, distinta de la leída (azul) */
.reader-text .sent.sel { background: rgba(255,212,121,.26) !important; box-shadow: 0 0 0 3px rgba(255,212,121,.22) !important; color: var(--text) !important; }
.reader-bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 36;
  display: flex; gap: 12px; align-items: center;
  background: rgba(21,26,34,.9); border: 1px solid var(--border2); border-radius: 44px;
  padding: 8px 14px; backdrop-filter: blur(12px); box-shadow: var(--shadow);
}
.reader-bar .ctl { width: 48px; height: 48px; }
.reader-bar .ctl svg { width: 21px; height: 21px; }
.reader-bar .ctl.play { width: 62px; height: 62px; }
.reader-bar .ctl.play svg { width: 27px; height: 27px; }
.play-here {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 36;
  background: var(--grad); color: var(--accent-ink); border: none; border-radius: 24px;
  padding: 12px 22px; font-weight: 700; font-size: 14.5px;
  box-shadow: 0 8px 22px rgba(var(--accent-rgb),.4); animation: rise .18s ease;
}
.reader-go {
  position: fixed; right: 14px; bottom: calc(104px + env(safe-area-inset-bottom)); z-index: 36;
  background: var(--card2); color: var(--text); border: 1px solid var(--border2); border-radius: 20px;
  padding: 9px 14px; font-size: 12.5px; font-weight: 600; box-shadow: var(--shadow);
}

.progress { margin-bottom: 22px; }
input[type=range] { width: 100%; -webkit-appearance: none; appearance: none; height: 9px; border-radius: 6px; background: var(--card2); border: 1px solid var(--border2); outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 2px 8px rgba(0,0,0,.5); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border: 3px solid var(--bg); border-radius: 50%; background: var(--accent); cursor: pointer; }
input[type=range]::-moz-range-track { background: var(--card2); border: 1px solid var(--border2); border-radius: 6px; height: 9px; }
/* Etiquetas bajo un deslizador (grave/normal/agudo) */
.range-ends { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text2); margin-top: 7px; }
.progress-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text2); margin-top: 7px; }

.controls { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 28px; }
.ctl {
  background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 50%;
  width: 56px; height: 56px; display: grid; place-items: center; padding: 0; transition: border-color .15s, transform .1s, background .15s;
}
.ctl:hover { border-color: var(--border2); }
.ctl:active { transform: scale(.91); }
.ctl svg { width: 24px; height: 24px; }
.ctl.play {
  width: 78px; height: 78px; background: var(--grad); color: var(--accent-ink); border: none;
  box-shadow: 0 12px 30px rgba(var(--accent-rgb),.42);
}
.ctl.play svg { width: 34px; height: 34px; }

.speed { text-align: center; }
.speed-label { font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: .7px; }
.speed-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.speed-btns button {
  background: var(--card); color: var(--text2); border: 1px solid var(--border);
  border-radius: 20px; padding: 7px 14px; font-size: 13px; font-weight: 600; transition: all .12s;
}
.speed-btns button.active { background: var(--grad); color: var(--accent-ink); border-color: transparent; }
.player-status { text-align: center; color: var(--text2); font-size: 12.5px; margin-top: 18px; min-height: 18px; }

/* ---------- Hojas inferiores (ajustes / capítulos) ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; }
.sheet-card {
  background: var(--bg2); border-top-left-radius: 24px; border-top-right-radius: 24px;
  width: 100%; max-width: 540px; margin: 0 auto; padding: 20px 22px calc(30px + env(safe-area-inset-bottom));
  border: 1px solid var(--border); border-bottom: none; max-height: 82vh; overflow-y: auto;
  animation: sheet-up .24s cubic-bezier(.2,.8,.2,1);
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h2 { margin: 0; font-size: 18px; }
.sheet-tabs { display: flex; gap: 6px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.sheet-tab { background: none; border: none; color: var(--text2); font-weight: 700; font-size: 13.5px; padding: 7px 16px; border-radius: 9px; transition: all .12s; }
.sheet-tab.active { background: var(--card2); color: var(--text); }

.nav-list { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: 11px; text-align: left; background: none; border: none; color: var(--text); width: 100%; transition: background .12s; }
.nav-item:hover { background: var(--card); }
.nav-item.current { background: var(--card); box-shadow: inset 0 0 0 1px var(--border2); }
.nav-item .ni-num { flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px; background: var(--card2); color: var(--text2); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.nav-item.current .ni-num { background: var(--grad); color: var(--accent-ink); }
.nav-item .ni-main { flex: 1; min-width: 0; }
.nav-item .ni-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .ni-sub { font-size: 11.5px; color: var(--text2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .ni-del { flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px; background: none; border: none; color: var(--text2); display: grid; place-items: center; }
.nav-item .ni-del:hover { color: var(--warn); }
.nav-empty { text-align: center; color: var(--text2); font-size: 13.5px; padding: 30px 12px; }

/* Temporizador de apagado */
.sleep-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.sleep-grid button { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 15px 8px; font-weight: 700; font-size: 14px; transition: all .12s; }
.sleep-grid button:hover { border-color: var(--border2); }
.sleep-grid button.on { background: var(--grad); color: var(--accent-ink); border-color: transparent; }
.sleep-grid button small { display: block; font-weight: 500; font-size: 11px; opacity: .8; margin-top: 2px; }
.sleep-custom { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sleep-custom span { font-size: 13.5px; color: var(--text2); flex: 1; }
.sleep-custom input[type=time] { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; font-size: 15px; }
.btn-set { background: var(--card2); color: var(--text); border: 1px solid var(--border2); border-radius: 10px; padding: 9px 15px; font-weight: 600; }
.btn-cancel-sleep { width: 100%; background: none; border: 1px solid #7a3a3a; color: var(--warn); border-radius: 11px; padding: 12px; font-weight: 600; }
.pill-btn.armed { background: var(--grad); color: var(--accent-ink); border-color: transparent; }

.field { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; font-size: 14px; }
.field > span { font-weight: 600; }
.field select, .field input[type=text] { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 15px; }
.switch-field { flex-direction: row; align-items: center; justify-content: space-between; gap: 14px; }
.switch-field span { flex: 1; font-weight: 500; }
.switch-field input { width: 46px; height: 26px; }
.test-voice { background: var(--card2); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 11px; width: 100%; font-weight: 600; }
.backup-field > span small { display: block; font-weight: 400; margin-top: 3px; line-height: 1.45; }
.backup-btns { display: flex; gap: 10px; }
.backup-btn { flex: 1; text-align: center; background: var(--card2); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 11px; font-weight: 600; font-size: 14px; transition: border-color .15s, transform .1s; }
.backup-btn:hover { border-color: var(--accent); color: var(--accent); }
.backup-btn:active { transform: scale(.97); }
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.account-info { display: flex; align-items: center; gap: 11px; min-width: 0; }
.account-name { font-weight: 700; font-size: 14px; }
.account-email { font-size: 12px; }
.btn-logout { background: none; border: 1px solid var(--border2); color: var(--text2); border-radius: 10px; padding: 9px 14px; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.btn-logout:hover { color: var(--warn); border-color: var(--warn); }
.settings-foot { font-size: 12.5px; margin-top: 20px; text-align: center; line-height: 1.7; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--card2); color: var(--text); border: 1px solid var(--border2); box-shadow: var(--shadow); padding: 12px 18px; border-radius: 13px; z-index: 60; font-size: 14px; max-width: 90vw; text-align: center; animation: rise .2s ease; }
.toast.err { border-color: #7a3a3a; }
.toast.ok { border-color: #3a6f4c; }
.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--text2); border-top-color: var(--accent); border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px; margin-right: 7px; }
@keyframes sp { to { transform: rotate(360deg); } }
