/* Notificador — estilos (móvil primero, tema claro/oscuro automático) */

:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #eeece7;
  --line: #e2dfd8;
  --text: #1b1c1f;
  --muted: #6b6a66;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --accent-soft: #fdeee4;
  --danger: #b42318;
  --ok: #15803d;
  --unread: #c2410c;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 8px 24px rgb(0 0 0 / .06);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1c1f24;
    --surface-2: #252930;
    --line: #2e333b;
    --text: #ecebe8;
    --muted: #9a9ca3;
    --accent: #fb923c;
    --accent-ink: #1a0e05;
    --accent-soft: #3a2416;
    --danger: #f87171;
    --ok: #4ade80;
    --unread: #fb923c;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 var(--font);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
code, pre { font-family: var(--mono); font-size: 13px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: 600 14px var(--font); cursor: pointer; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); width: 100%; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.icon-btn {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  border: 0; background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:active { background: var(--surface-2); }

/* ---------- Acceso ---------- */
.login {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; text-align: center; gap: 4px;
}
.login img { border-radius: 18px; }
.login h1 { margin: 12px 0 0; font-size: 26px; letter-spacing: -.01em; }
.login p { color: var(--muted); margin: 4px 0 20px; }
.login form { width: 100%; max-width: 340px; display: grid; gap: 10px; }
.login input {
  height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  text-align: center; font: 600 18px var(--mono); letter-spacing: .08em; text-transform: uppercase;
}
.login input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.error { color: var(--danger); font-size: 14px; margin: 0; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 8px 8px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.title { display: flex; align-items: center; gap: 10px; }
.topbar h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.badge {
  min-width: 24px; height: 24px; padding: 0 8px; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); font: 700 13px/24px var(--font); text-align: center;
}
.actions { display: flex; }

/* ---------- Avisos ---------- */
.banner {
  margin: 4px 16px 10px; padding: 14px; border-radius: var(--radius);
  background: var(--accent-soft); display: flex; gap: 12px; align-items: center;
}
.banner div { flex: 1; display: grid; gap: 2px; }
.banner span { color: var(--muted); font-size: 13px; }
.banner.subtle { background: var(--surface-2); }

/* ---------- Búsqueda y filtros ---------- */
.toolbar { padding: 0 16px; display: grid; gap: 10px; }
.search {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 42px;
  border-radius: 12px; background: var(--surface-2); color: var(--muted);
}
.search svg { width: 18px; height: 18px; flex: none; }
.search input { flex: 1; border: 0; background: transparent; color: var(--text); font: inherit; outline: none; min-width: 0; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin: 0 -16px; padding-inline: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: 500 13px var(--font); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip .n { color: var(--muted); font-weight: 600; }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.active .n { color: inherit; opacity: .7; }
.chip i { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- Lista ---------- */
.list { padding: 12px 16px 24px; display: grid; gap: 8px; }
.item { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; }
.item-main {
  all: unset; box-sizing: border-box; width: 100%; display: flex; gap: 12px; padding: 14px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: var(--src, var(--muted)); }
.item.read .dot { background: transparent; box-shadow: inset 0 0 0 2px var(--src, var(--muted)); opacity: .55; }
.item-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.item-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.item-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item.read .item-title { font-weight: 500; }
.item time { flex: none; color: var(--muted); font-size: 12px; }
.item-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.source { font-weight: 600; color: var(--src, var(--muted)); }
.prio { padding: 1px 7px; border-radius: 6px; background: var(--danger); color: #fff; font-weight: 700; font-size: 11px; }
.item-body {
  color: var(--muted); font-size: 14px; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: pre-line;
}
.item.open .item-body { display: none; }
.item-detail { padding: 0 14px 14px 36px; display: grid; gap: 10px; }
.full-body { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.code {
  margin: 0; padding: 12px; border-radius: 10px; background: var(--surface-2); overflow-x: auto;
  white-space: pre; line-height: 1.5;
}
details summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-bottom: 6px; }

.empty { text-align: center; color: var(--muted); padding: 48px 24px; display: grid; justify-items: center; gap: 8px; }
.empty svg { width: 44px; height: 44px; stroke-width: 1.4; opacity: .6; }
.more { display: flex; margin: 0 auto 32px; }

/* ---------- Hoja de ajustes ---------- */
.sheet {
  width: 100%; max-width: min(640px, 100%); max-height: 92dvh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 20px 20px 0 0; background: var(--bg); color: var(--text);
  overflow-x: hidden; overflow-y: auto; outline: none;
}
.sheet section > * { min-width: 0; }
.sheet::backdrop { background: rgb(0 0 0 / .45); }
.sheet[open] { animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
.sheet-head {
  position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center;
  padding: 14px 8px 6px 20px; background: var(--bg); z-index: 1;
}
.sheet h2 { margin: 0; font-size: 20px; }
.sheet section { padding: 12px 20px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.sheet section:last-child { border: 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
.sheet h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sheet label { font-size: 13px; color: var(--muted); margin-bottom: -6px; }
.status { margin: 0; display: flex; align-items: center; gap: 8px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.on::before { background: var(--ok); }
.status.off::before { background: var(--danger); }
.muted { color: var(--muted); font-size: 13px; margin: 0; }
.secret {
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px;
  border-radius: 10px; background: var(--surface-2);
}
.secret code { flex: 1; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.secret code.blur { filter: blur(5px); cursor: pointer; transition: filter .2s; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: var(--surface-2); }
.tab { flex: 1; height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: 600 13px var(--font); cursor: pointer; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-weight: 500; z-index: 50; box-shadow: 0 8px 30px rgb(0 0 0 / .25);
}

/* ---------- Instalador ---------- */
body.install { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.install-card { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; display: grid; gap: 12px; box-shadow: var(--shadow); }
.install-card .brand { display: flex; align-items: center; gap: 12px; }
.install-card .brand img { border-radius: 10px; }
.install-card h1 { font-size: 20px; margin: 0; }
.install-card h2 { font-size: 16px; margin: 8px 0 0; }
.install-card label { font-size: 13px; color: var(--muted); margin-bottom: -6px; }
.install-card input { height: 46px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; width: 100%; }
.install-card form { display: grid; gap: 12px; }
.install-card .secret button { min-height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 600 12px var(--font); }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.checks .pass { color: var(--ok); }
.checks .fail { color: var(--danger); }
.ok-banner { margin: 0; padding: 12px; border-radius: 10px; background: var(--accent-soft); }
.err { color: var(--danger); margin: 0; }
.install-card ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.install-card a { color: var(--accent); }
.install-card a.btn { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

@media (min-width: 720px) {
  #app { max-width: 720px; margin: 0 auto; }
  .sheet { margin: auto; border-radius: 20px; }
}
