/* ─────────────────────────────────────────────────────────────────────────────
   OnFest · Panel de administración
   Un solo archivo de estilos, sin compilación. Los colores son variables: el
   tema oscuro solo cambia su valor (por el sistema o por el botón del panel).
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  color-scheme: light;
  --bg: #f6f5f3;
  --surface: #ffffff;
  --surface-2: #faf9f7;
  --surface-3: #f0eeeb;
  --border: #e4e1dc;
  --border-strong: #cfcbc4;
  --text: #1a1917;
  --text-2: #55524d;
  --text-3: #85817a;
  --accent: #e2531c;        /* naranja OnFest, bajado un punto para leer sobre blanco */
  --accent-hover: #c94614;
  --accent-soft: #fdeee6;
  --accent-ink: #ffffff;
  --focus: #2a78d6;

  --ok: #0c7a0c;      --ok-soft: #e4f4e4;
  --warn: #8a5a00;    --warn-soft: #fdf1d3;
  --bad: #b92c2c;     --bad-soft: #fbe6e6;
  --info: #1c5cab;    --info-soft: #e3eefb;
  --neutral-soft: #eeece8;

  /* Gráficos (paleta validada para daltonismo; el orden no se cambia). */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --grid: #e9e6e1;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(20, 18, 14, 0.06);
  --shadow-lg: 0 18px 50px rgba(20, 18, 14, 0.22);
  --sidebar-w: 244px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110;
  --surface: #1a1a19;
  --surface-2: #201f1e;
  --surface-3: #2a2927;
  --border: #302f2c;
  --border-strong: #45433f;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --text-3: #8f8d85;
  --accent: #ff7a45;
  --accent-hover: #ff8f63;
  --accent-soft: #3a2218;
  --accent-ink: #1a0e08;
  --focus: #6da7ec;

  --ok: #5fd35f;      --ok-soft: #173017;
  --warn: #f2bd4b;    --warn-soft: #3a2e10;
  --bad: #f08080;     --bad-soft: #3d1c1c;
  --info: #86b6ef;    --info-soft: #172a44;
  --neutral-soft: #2a2927;

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --grid: #2c2b28;

  --shadow-sm: none;
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
a.link, .link { color: var(--info); cursor: pointer; }
a.link:hover, .link:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--text-3); }
.soft { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; }

/* ── Estructura ───────────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100%; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 14px 10px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand b { font-size: 15px; letter-spacing: -0.01em; }
.brand span { display: block; font-size: 11px; color: var(--text-3); }

.nav-group { margin-top: 14px; }
.nav-group > .nav-title { padding: 0 10px 5px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; cursor: pointer;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }

.sidebar-foot { margin-top: auto; padding: 12px 8px 2px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); }
.sidebar-foot b { color: var(--text); font-size: 13px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.btn.menu-btn { display: none; }
.content { padding: 24px 28px 60px; max-width: 1360px; width: 100%; }

.search { position: relative; flex: 1; max-width: 460px; }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input { width: 100%; padding-left: 34px; }
.search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-family: var(--font); font-size: 11px; color: var(--text-3); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; background: var(--surface-2); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); max-height: 70vh; overflow: auto; padding: 6px;
}
.search-results .group { padding: 8px 8px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.search-results a { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--radius-sm); }
.search-results a:hover, .search-results a.sel { background: var(--surface-3); }
.search-results .t { min-width: 0; }
.search-results .t div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }

/* ── Cabecera de página ───────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.page-head .sub { color: var(--text-3); margin-top: 2px; max-width: 70ch; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-size: 13px; margin-bottom: 10px; cursor: pointer; }
.back:hover { color: var(--text); }

.section { margin-top: 26px; }
.section > h2, .card > h2 { font-size: 14px; font-weight: 650; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.section > h2 .muted, .card > h2 .muted { font-weight: 400; }

/* ── Controles ────────────────────────────────────────────────────────────── */
input, select, textarea, button { font: inherit; color: inherit; }
input[type="text"], input[type="search"], input[type="password"], input[type="number"], select, textarea {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 7px 10px; min-height: 34px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
textarea { width: 100%; resize: vertical; line-height: 1.45; }
textarea.code { font-family: var(--mono); font-size: 12.5px; min-height: 380px; tab-size: 2; white-space: pre; }
label.field { display: block; font-weight: 550; font-size: 13px; }
label.field > span { display: block; margin-bottom: 5px; }
label.field > small { display: block; margin-top: 4px; font-weight: 400; color: var(--text-3); }
label.field input, label.field select { width: 100%; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 34px; padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 550; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
:root[data-theme="dark"] .btn.danger.solid { color: #1a0808; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { min-height: 28px; padding: 3px 9px; font-size: 13px; }
.btn.icon-only { padding: 6px 8px; }
.btn.busy { pointer-events: none; opacity: 0.7; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input[type="search"] { width: 340px; max-width: 100%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.chip:hover { background: var(--surface-3); }
.chip.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip .n { font-variant-numeric: tabular-nums; opacity: 0.7; }

/* En pantallas estrechas se desplaza de lado en vez de salirse de la página. */
.seg { display: inline-flex; max-width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow-x: auto; overflow-y: hidden; background: var(--surface); }
.seg button { flex: none; white-space: nowrap; border: 0; background: transparent; padding: 7px 14px; cursor: pointer; font-weight: 550; color: var(--text-2); border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--surface-3); }
.seg button.on { background: var(--accent-soft); color: var(--accent); }

/* ── Tarjetas y cifras ────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.card.flush { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 14px; }
.grid.kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 1280px) { .grid.kpis:not(.four) { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .grid.kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid.kpis, .grid.kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.kpi { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); }
a.kpi:hover { border-color: var(--border-strong); }
.kpi .label { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .note { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.delta { font-weight: 600; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid; margin-bottom: 16px; }
.banner.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); }
.banner.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); }
.banner.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); color: var(--info); }
.banner b { color: inherit; }
.banner .btn { margin-left: auto; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 19px; white-space: nowrap; background: var(--neutral-soft); color: var(--text-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badges { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* ── Tablas ───────────────────────────────────────────────────────────────── */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3);
  padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2);
  white-space: nowrap; user-select: none;
}
table.data th.sortable { cursor: pointer; }
table.data th.sortable:hover { color: var(--text); }
table.data th .arrow { margin-left: 4px; opacity: 0.35; font-size: 10px; }
table.data th.sorted { color: var(--text); }
table.data th.sorted .arrow { opacity: 1; }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: var(--surface-2); }
table.data td.tight, table.data th.tight { width: 1%; white-space: nowrap; }
table.data td.clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.data input[type="checkbox"] { width: 15px; height: 15px; margin: 0; vertical-align: middle; }

.pager { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 13px; color: var(--text-3); flex-wrap: wrap; }
.pager .nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.pager select { min-height: 28px; padding: 2px 6px; }

.empty { padding: 44px 20px; text-align: center; color: var(--text-3); }
.empty b { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }
.loading { padding: 44px 20px; text-align: center; color: var(--text-3); }
.loading::before { content: ""; display: inline-block; width: 16px; height: 16px; margin-right: 8px; vertical-align: -3px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Personas y miniaturas ────────────────────────────────────────────────── */
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--surface-3); flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 650; color: var(--text-2); text-transform: uppercase; overflow: hidden; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.thumb { width: 40px; height: 40px; border-radius: 7px; object-fit: cover; background: var(--surface-3); flex: none; display: block; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who .t { min-width: 0; }
.who .t > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.who .t .muted { font-size: 12.5px; }
.people { display: flex; flex-wrap: wrap; gap: 6px; }
.person { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 13px; }
a.person:hover { border-color: var(--border-strong); background: var(--surface-2); }

/* ── Fichas ───────────────────────────────────────────────────────────────── */
.profile-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.profile-head .t { flex: 1; min-width: 220px; }
.profile-head h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.profile-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cover { width: 132px; height: 132px; border-radius: var(--radius); object-fit: cover; background: var(--surface-3); flex: none; }

dl.props { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr); margin: 0; }
dl.props dt { color: var(--text-3); padding: 7px 0; border-bottom: 1px solid var(--border); }
dl.props dd { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
dl.props dt:last-of-type, dl.props dd:last-of-type { border-bottom: 0; }
dl.props.compact { grid-template-columns: minmax(0, auto) minmax(0, 1fr); column-gap: 14px; }
dl.props.compact dd { text-align: right; }

.stats { display: flex; flex-wrap: wrap; gap: 8px 26px; }
.stats div b { display: block; font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stats div span { font-size: 12.5px; color: var(--text-3); }
.stats a.stat-link { color: inherit; text-decoration: none; display: block; border-radius: 6px; }
.stats a.stat-link span { text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.stats a.stat-link:hover span { color: var(--text); text-decoration-color: currentColor; }

pre.json { margin: 0; padding: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: var(--mono); font-size: 12px; line-height: 1.5; overflow: auto; max-height: 460px; white-space: pre-wrap; overflow-wrap: anywhere; }

.comment { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; }
.comment .body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.comment .meta { font-size: 12.5px; color: var(--text-3); }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.media { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-3); cursor: pointer; border: 1px solid var(--border); }
.media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media .tag { position: absolute; left: 6px; top: 6px; }
.media .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; font-size: 12px; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, 0.75)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer { max-width: 100%; max-height: 62vh; display: block; margin: 0 auto; border-radius: var(--radius-sm); background: #000; }

/* ── Gráficos ─────────────────────────────────────────────────────────────── */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--text-3); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .hit:hover + .hl, .chart g.col:hover .hl { opacity: 1; }
.chart .hl { fill: var(--text); opacity: 0; pointer-events: none; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--text); color: var(--bg); padding: 6px 9px; border-radius: 7px; font-size: 12px; line-height: 1.4; white-space: nowrap; transform: translate(-50%, -100%); box-shadow: var(--shadow-lg); }
.tip b { font-variant-numeric: tabular-nums; }

.bars { display: grid; gap: 9px; }
.bars .row { display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; }
.bars .row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.bars .track { height: 10px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.bars .fill { height: 100%; background: var(--series-1); border-radius: 4px; min-width: 2px; }
.bars .val { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 28px; text-align: right; }

.list-rows > * { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.list-rows > *:last-child { border-bottom: 0; padding-bottom: 0; }
.list-rows > *:first-child { padding-top: 0; }
.list-rows .t { flex: 1; min-width: 0; }
.list-rows .t > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.row-link:hover .t > div:first-child { text-decoration: underline; }

/* ── Ventanas y avisos ────────────────────────────────────────────────────── */
.backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(15, 14, 12, 0.5); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 860px; }
.modal > header { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.modal > header h3 { font-size: 16px; font-weight: 650; flex: 1; min-width: 0; }
/* minmax(0, 1fr): sin esto la columna de la rejilla crece hasta el texto más
   largo que no se parta y el contenido se sale de la ventana. */
.modal > .body { padding: 14px 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
/* Dentro de una ventana las filas explican algo: el texto se parte en varias
   líneas en vez de cortarse con «…» como en las listas del resumen. */
.modal .list-rows .t > div { white-space: normal; overflow: visible; }
.modal .list-rows > * > .btn { flex: none; }
.modal > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; flex-wrap: wrap; }
.modal .lead { color: var(--text-2); }
.modal .lead b { color: var(--text); }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 9px; box-shadow: var(--shadow-lg); font-weight: 500; animation: rise 0.18s ease-out; }
.toast.error { background: var(--bad); color: #fff; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ── Explorador de datos ──────────────────────────────────────────────────── */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-family: var(--mono); font-size: 13px; margin-bottom: 14px; }
.crumbs a { padding: 2px 6px; border-radius: 5px; color: var(--info); }
.crumbs a:hover { background: var(--surface-3); }
.crumbs span { color: var(--text-3); }
.coll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.coll { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-family: var(--mono); font-size: 13px; }
.coll:hover { border-color: var(--border-strong); background: var(--surface-2); }
.coll .n { font-family: var(--font); color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ── Acceso ───────────────────────────────────────────────────────────────── */
.login-page { display: grid; place-items: center; min-height: 100%; padding: 20px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow-sm); display: grid; gap: 16px; }
.login-card .brand { padding: 0; }
.login-card .brand img { width: 42px; height: 42px; border-radius: 11px; }
.login-card .brand b { font-size: 18px; }
.login-card .btn { width: 100%; min-height: 40px; }
.login-card[hidden], .login-card [hidden] { display: none; }
.login-help { font-size: 13.5px; line-height: 1.45; margin: 0; }
.login-help + .login-help, #setup > * + * { margin-top: 10px; }
.login-qr { background: #fff; border-radius: 12px; padding: 8px; width: 200px; margin: 12px auto 4px; }
.login-qr img { display: block; width: 100%; height: auto; }
.login-secret { font-size: 13px; letter-spacing: .04em; word-break: break-all; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; user-select: all; }
.form-error { color: var(--bad); background: var(--bad-soft); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; }

/* ── Pantallas estrechas ──────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .grid.two, .grid.three { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform 0.18s ease; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 50; background: rgba(15, 14, 12, 0.45); }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .content { padding: 18px 16px 50px; }
  .search kbd { display: none; }
  .search { max-width: none; }
  .topbar .spacer { display: none; }
  .toolbar input[type="search"] { width: 100%; }
  .page-head .actions { margin-left: 0; }
  dl.props { grid-template-columns: minmax(0, 1fr); }
  dl.props dt { border-bottom: 0; padding-bottom: 0; }
  .hide-sm { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ── Conversación de chat ─────────────────────────────────────────────────── */
.chat-log { display: grid; gap: 2px; }
.chat-day { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; color: var(--text-3); font-size: 12px; }
.chat-day span { display: inline-block; }
.chat-day span::first-letter { text-transform: uppercase; }
.chat-day::before, .chat-day::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.msg { display: flex; gap: 10px; padding: 6px 4px; border-radius: var(--radius-sm); }
.msg:hover { background: var(--surface-2); }
.msg-main { min-width: 0; flex: 1; display: grid; gap: 4px; }
.msg-meta { font-size: 13px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-reply { border-left: 3px solid var(--border-strong); padding: 2px 8px; color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.msg-img { max-width: 240px; max-height: 240px; border-radius: var(--radius-sm); cursor: zoom-in; display: block; background: var(--surface-3); }
.msg-audio { max-width: 100%; height: 36px; }
.msg-sticker { display: flex; align-items: center; gap: 8px; }
.msg-sticker span { font-size: 26px; line-height: 1; }
.msg-poll { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); max-width: 460px; }
.msg-poll-opt { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-top: 1px solid var(--border); }
.msg-link { overflow-wrap: anywhere; }
