/* Honey — «Panal nocturno». Un solo tema oscuro; el acento se puede cambiar por .env (UI_ACCENT). */
:root {
  --bg: #15130F;
  --surface: #1E1B15;
  --surface-2: #24201A;
  --line: #2C2820;
  --me: #2A251C;
  --me-line: #3A3327;
  --ink: #F3EEE4;
  --ink-2: #B5AD9C;
  --ink-3: #A79F8F;
  --accent: #F2B32E;
  --accent-ink: #1A1406;
  --ok: #7FCB8A;
  --blue: #8FB5E8;
  --err: #F08A7A;
  --r-card: 18px;
  --r-btn: 12px;
  --tabbar: 64px;
  --font-title: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  /* Alias de los nombres viejos (páginas que todavía los usan). */
  --card: var(--surface);
  --muted: var(--ink-2);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 400 16px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3, .num, .title { font-family: var(--font-title); font-weight: 700; letter-spacing: -.01em; }
.muted { color: var(--ink-2); } .faint { color: var(--ink-3); } .ok { color: var(--ok); } .err { color: var(--err); }

/* Íconos SVG de trazo */
.ic { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
      stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 18px; height: 18px; } .ic.lg { width: 26px; height: 26px; }

/* Página con barra inferior */
.page { min-height: 100dvh;
        padding: calc(env(safe-area-inset-top, 0px) + 16px) max(16px, env(safe-area-inset-right, 0px))
                 calc(var(--tabbar) + env(safe-area-inset-bottom, 0px) + 24px) max(16px, env(safe-area-inset-left, 0px)); }
.page main { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.topbar { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.topbar h1 { flex: 1; margin: 0; font-size: 30px; line-height: 1.1; }
.topbar h1.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.topbar .spacer { flex: 1; }
.eyebrow { font: 600 12px/1 var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }

/* Superficies */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px; min-width: 0; }
.card h2 { font-size: 17px; margin: 0 0 10px; }
.card.accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.card.accent .muted, .card.accent .faint { color: rgba(26, 20, 6, .72); }
a.card { display: block; text-decoration: none; }
a.card.stat { display: flex; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 6px; min-height: 104px; justify-content: space-between; text-decoration: none; }
.stat .num { font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .label { color: var(--ink-2); font-size: 14px; line-height: 1.25; }
.stat.hot .num { color: var(--accent); }

/* Botones, pills e interruptores */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
       padding: 0 18px; border-radius: var(--r-btn); border: 1px solid var(--line); background: var(--surface);
       color: var(--ink); font: 600 16px/1 var(--font); text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.outline, .btn.secondary { background: transparent; border-color: var(--me-line); }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 15px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.block { width: 100%; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
        font: 600 12.5px/1.2 var(--font); background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
        white-space: nowrap; }
.pill.accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.pill.blue { background: rgba(143, 181, 232, .14); color: var(--blue); border-color: rgba(143, 181, 232, .35); }
.pill.green { background: rgba(127, 203, 138, .12); color: var(--ok); border-color: rgba(127, 203, 138, .32); }
.pill.gray { background: var(--surface-2); color: var(--ink-3); }
.switch { position: relative; width: 52px; height: 32px; flex: none; border-radius: 999px; border: 0; padding: 0;
          background: var(--me-line); cursor: pointer; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%;
                 background: var(--ink-2); transition: transform .2s, background .2s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); background: var(--accent-ink); }
.switch-hit { display: inline-grid; place-items: center; min-width: 52px; min-height: 44px; }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }

.iconbtn { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%;
           border: 0; background: transparent; color: var(--ink-2); cursor: pointer; padding: 0; }
.iconbtn.primary { background: var(--accent); color: var(--accent-ink); }
.iconbtn:disabled { opacity: .45; }

/* Barra inferior */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr);
          background: rgba(21, 19, 15, .94); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
          border-top: 1px solid var(--line);
          padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 6px)
                   max(8px, env(safe-area-inset-left, 0px)); }
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
            gap: 3px; min-height: 52px; color: var(--ink-3); text-decoration: none; font: 500 12px/1 var(--font); }
.tabbar a.active { color: var(--accent); }
.tabbar a.active::after { content: ""; position: absolute; bottom: 2px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

/* Listas y tablas */
.list { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; }
.table { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink-3); font-weight: 500; white-space: nowrap; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-family: var(--font); font-weight: 400; }
td.clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stats .stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px; min-height: 92px; }
.stats .stat b { font: 700 22px/1.1 var(--font-title); white-space: nowrap; font-variant-numeric: tabular-nums; }
.stats .stat b.ok { color: var(--ok); }
.stats .stat span { color: var(--ink-2); font-size: 13px; }

/* Menú ⋯ y diálogo */
.acct { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 220px; padding: 6px;
        background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .45); }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px;
                        border-radius: 10px; border: 0; background: transparent; color: var(--ink); font: 500 15px/1 var(--font);
                        text-decoration: none; text-align: left; cursor: pointer; }
.menu a:hover, .menu button:hover, .menu a:focus-visible, .menu button:focus-visible { background: var(--surface-2); }
.menu .danger { color: var(--err); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
dialog.confirm { border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; width: min(340px, calc(100vw - 32px));
                 background: var(--surface); color: var(--ink); }
dialog.confirm::backdrop { background: rgba(0, 0, 0, .6); }
dialog.confirm form { display: grid; gap: 10px; margin: 0; }
dialog.confirm h2 { margin: 0; font-size: 20px; }
dialog.confirm p { margin: 0; color: var(--ink-2); font-size: 15px; }
dialog.confirm .actions { display: grid; gap: 8px; margin-top: 8px; }
dialog.confirm .keep { background: var(--accent); color: var(--accent-ink); border: 0; }
dialog.confirm .leave { background: transparent; color: var(--err); border: 1px solid var(--me-line); }
dialog.confirm .actions button { min-height: 48px; border-radius: var(--r-btn); font: 600 16px/1 var(--font); cursor: pointer; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Botones de las páginas viejas (notificaciones) con el estilo nuevo */
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.actions button { min-height: 48px; padding: 0 18px; border-radius: var(--r-btn); border: 1px solid var(--me-line);
                  background: transparent; color: var(--ink); font: 600 15px/1 var(--font); cursor: pointer; }
.actions .primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.actions .danger { color: var(--err); }

/* Buscador (Ctrl+K) */
.tabbar .brand, .tabbar .search-open { display: none; }
kbd { font: 500 11.5px/1 var(--font); color: var(--ink-3); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }
dialog.search { border: 1px solid var(--line); border-radius: var(--r-card); padding: 0; background: var(--surface); color: var(--ink);
                width: min(640px, calc(100vw - 32px)); margin: 12vh auto auto; box-shadow: 0 24px 60px rgba(0, 0, 0, .55); }
dialog.search::backdrop { background: rgba(0, 0, 0, .6); }
.search-box { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.search-box input { flex: 1; min-width: 0; min-height: 56px; border: 0; background: transparent; color: var(--ink);
                    font: 400 17px/1.2 var(--font); outline: none; }
.search-box input::placeholder { color: var(--ink-3); }
#search-list { list-style: none; margin: 0; padding: 6px; max-height: min(60vh, 480px); overflow-y: auto; }
#search-list li { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px; border-radius: 10px; cursor: pointer; }
#search-list li[aria-selected="true"] { background: var(--surface-2); outline: 1px solid var(--me-line); }
#search-list li .ic { color: var(--ink-3); }
#search-list li[aria-selected="true"] .ic { color: var(--accent); }
#search-list .t { flex: 1; min-width: 0; }
#search-list .t b { display: block; font: 500 15px/1.3 var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#search-list .t span { display: block; font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#search-list .kind { font-size: 12px; color: var(--ink-3); }
.rule:target { border-color: var(--accent); }

/* Escritorio: barra lateral a la izquierda en vez de la barra inferior */
@media (min-width: 1024px) {
  :root { --side: 236px; }
  .tabbar { top: 0; bottom: 0; right: auto; width: var(--side); display: flex; flex-direction: column; gap: 4px;
            padding: 22px 14px; background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none;
            border-top: 0; border-right: 1px solid var(--line); }
  .tabbar .brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 18px; font: 700 22px/1 var(--font-title); color: var(--ink); }
  .tabbar .brand .ic { width: 30px; height: 30px; fill: var(--accent); stroke: var(--accent); }
  .tabbar .search-open { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 12px; padding: 0 10px 0 12px;
                         border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-3);
                         font: 500 15px/1 var(--font); cursor: pointer; }
  .tabbar .search-open span { flex: 1; text-align: left; }
  .tabbar .search-open:hover { border-color: var(--me-line); color: var(--ink-2); }
  .tabbar a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 12px;
              color: var(--ink-2); font: 500 15.5px/1 var(--font); }
  .tabbar a:hover { background: var(--surface); color: var(--ink); }
  .tabbar a.active { background: var(--surface-2); color: var(--accent); }
  .tabbar a.active::after { display: none; }
  .page { padding: 32px 48px 48px calc(var(--side) + 48px); }
  .page main { max-width: 1080px; }
  .topbar h1 { font-size: 34px; }
}
