/* =========================================================================
   PortMap — hoja de estilos
   Claro: papel marfil cálido y tinta. Oscuro: gris carbón neutro.
   Acento ámbar tostado; verde oliva para estados correctos; cobalto para datos.
   Tipografía: Archivo (texto y titulares) + JetBrains Mono (datos y etiquetas).
   ========================================================================= */

@font-face {
  font-family: 'Archivo';
  src: url('fonts/archivo.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono.woff2') format('woff2');
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --font: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --bg: #f2efe6;
  --surface: #faf8f2;
  --surface-2: #ebe7dc;
  --surface-3: #e2ddcf;
  --line: #d8d1c0;
  --line-strong: #b9b09b;
  --ink: #1b1a17;
  --ink-2: #48443b;
  --ink-3: #777162;
  --accent: #b0520c;
  --accent-hover: #93440a;
  --accent-ink: #fffaf2;
  --accent-soft: #f2e0cb;
  --ok: #4f6b1d;
  --ok-soft: #e2e8cf;
  --warn: #8f6200;
  --warn-soft: #f3e6c2;
  --danger: #a3301d;
  --danger-soft: #f4dbd3;
  --info: #2c4fb8;
  --info-soft: #dde3f4;
  --series-1: #2c4fb8;
  --series-2: #c27510;
  --focus: #b0520c;
  --term-bg: #181816;
  --term-ink: #e6e3d9;
  --term-dim: #8c877a;
  --term-line: #2e2d29;
  --shadow: 0 1px 0 rgba(27, 26, 23, .04), 0 18px 40px -18px rgba(27, 26, 23, .35);
  --radius: 3px;
  --side-w: 236px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131312;
    --surface: #1a1a18;
    --surface-2: #21211e;
    --surface-3: #2a2a26;
    --line: #2e2d29;
    --line-strong: #46443d;
    --ink: #ecebe5;
    --ink-2: #b9b6ac;
    --ink-3: #87837a;
    --accent: #e39245;
    --accent-hover: #f0a660;
    --accent-ink: #1b1207;
    --accent-soft: #3a2a19;
    --ok: #a3c060;
    --ok-soft: #26301a;
    --warn: #e2b44b;
    --warn-soft: #362c14;
    --danger: #f07c64;
    --danger-soft: #3a1f19;
    --info: #86a0f2;
    --info-soft: #1e2539;
    --series-1: #7f9bf0;
    --series-2: #e2a04a;
    --focus: #e39245;
    --term-bg: #0e0e0d;
    --term-line: #262522;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 20px 50px -20px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #131312;
  --surface: #1a1a18;
  --surface-2: #21211e;
  --surface-3: #2a2a26;
  --line: #2e2d29;
  --line-strong: #46443d;
  --ink: #ecebe5;
  --ink-2: #b9b6ac;
  --ink-3: #87837a;
  --accent: #e39245;
  --accent-hover: #f0a660;
  --accent-ink: #1b1207;
  --accent-soft: #3a2a19;
  --ok: #a3c060;
  --ok-soft: #26301a;
  --warn: #e2b44b;
  --warn-soft: #362c14;
  --danger: #f07c64;
  --danger-soft: #3a1f19;
  --info: #86a0f2;
  --info-soft: #1e2539;
  --series-1: #7f9bf0;
  --series-2: #e2a04a;
  --focus: #e39245;
  --term-bg: #0e0e0d;
  --term-line: #262522;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 20px 50px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  font-variation-settings: 'wdth' 100;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
p { margin: 0; }
a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: .92em; font-variant-ligatures: none; }
code { background: var(--surface-2); border: 1px solid var(--line); padding: 0 4px; border-radius: 2px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
svg.icon { flex: none; display: block; }
::selection { background: var(--accent-soft); color: var(--ink); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.tight { gap: 4px; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 8px; }
.stack.loose { gap: 28px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }

/* -------------------------------------------------------------- layout */
.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 16px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
  font-variation-settings: 'wdth' 88;
}
.brand:hover { color: var(--ink); }
.brand .mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--bg);
  border-radius: 2px;
}
.brand .ver { font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; margin-left: auto; }

.side-nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.side-section { margin-top: 18px; }
.side-section:first-child { margin-top: 4px; }
.side-label {
  padding: 0 8px 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--radius);
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: background-color .12s, color .12s;
}
.side-link:hover { background: var(--surface-2); color: var(--ink); }
.side-link.active {
  background: var(--surface-2);
  color: var(--ink);
  border-left-color: var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.side-link .count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}

.side-foot { border-top: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 8px; }

.live {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 8px;
}
.live .dot { background: var(--line-strong); }
.live.on { color: var(--ok); }
.live.on .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

.user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.user-btn:hover { background: var(--surface-2); }
.avatar {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--ink-2);
  background: var(--surface-2);
}
.user-btn .who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-btn .who strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn .who span { font-size: 11.5px; color: var(--ink-3); }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
}
.topbar .crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}
.topbar .crumbs a { text-decoration: none; }
.topbar .crumbs strong { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .menu-toggle, .topbar .brand-mini { display: none; }

.content {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 28px 64px;
}

/* ----------------------------------------------------------- page head */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.page-head .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-head .eyebrow a { text-decoration: none; }
.page-head h1 {
  font-size: 34px;
  font-weight: 650;
  letter-spacing: -0.03em;
  font-variation-settings: 'wdth' 92;
  line-height: 1.05;
}
.page-head .title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .sub { margin-top: 8px; color: var(--ink-2); max-width: 64ch; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --------------------------------------------------------------- bento */
.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}
.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; }
.span-5 { grid-column: span 5; }
.span-4 { grid-column: span 4; }

/* -------------------------------------------------------------- panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 15px; font-weight: 600; }
.panel-head p { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.panel-head .meta { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }
.panel-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.panel-foot.between { justify-content: space-between; }
.panel.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }

/* Sección sin caja: título + regla fina */
.section { display: flex; flex-direction: column; gap: 12px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-strong);
}
.section-head h2 { font-size: 18px; letter-spacing: -0.02em; }
.section-head .meta { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

/* -------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); }
.stats .stat + .stat { border-left: 1px solid var(--line); }
.stat { padding: 16px 18px; min-width: 0; }
.stat-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.stat-value {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.stat-value.sm { font-size: 17px; }
.stat-value .unit { font-size: .55em; color: var(--ink-3); margin-left: 3px; letter-spacing: 0; }
.stat-sub { margin-top: 4px; font-size: 12px; color: var(--ink-3); }
.stat-col { display: flex; flex-direction: column; }
.stat-col .stat + .stat { border-top: 1px solid var(--line); }

/* --------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  position: sticky;
  top: 0;
  text-align: left;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--surface-2);
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tbody tr { transition: background-color .1s; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table th.num, .table td.num { text-align: right; }
.table td.actions, .table th.actions { width: 1%; text-align: right; white-space: nowrap; }
.table .cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.table .cell-main strong { font-weight: 600; }
.table .cell-sub { font-size: 12px; color: var(--ink-3); }
.table .mono { font-size: 12.5px; }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 550;
  font-size: 13.5px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .12s, border-color .12s, color .12s, transform .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); color: var(--ink); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: transparent; }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink-3);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn-primary.loading::after, .btn-accent.loading::after { border-color: var(--bg); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color .12s, color .12s, border-color .12s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.icon-btn.danger:hover { color: var(--danger); }
.icon-btn .count {
  position: absolute;
  top: 2px;
  right: 1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
}
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* ----------------------------------------------------------------- forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-weight: 550; font-size: 13px; color: var(--ink); }
.field .hint { font-size: 12px; color: var(--ink-3); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="search"],
input[type="url"], input[type="datetime-local"], input:not([type]), select, textarea {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition: border-color .12s, background-color .12s;
}
textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, select:disabled { background: var(--surface-2); color: var(--ink-3); }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: .85; }
input.mono, textarea.mono { font-family: var(--mono); font-size: 13px; }
select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.input-icon input { padding-left: 32px; }

.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch .track {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  transition: background-color .15s, border-color .15s;
}
.switch .track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 1px;
  background: var(--ink-3);
  transition: transform .15s, background-color .15s;
}
.switch input:checked + .track { background: var(--ink); border-color: var(--ink); }
.switch input:checked + .track::after { transform: translateX(16px); background: var(--bg); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + .track { opacity: .5; }

.switch-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.switch-row:first-child { border-top: 0; padding-top: 0; }
.switch-row .text { display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.switch-row .text strong { font-weight: 550; }
.switch-row .text span { font-size: 12.5px; color: var(--ink-3); }

.segmented {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.segmented button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.segmented button:first-child { border-left: 0; }
.segmented button:hover { background: var(--surface-2); color: var(--ink); }
.segmented button.active { background: var(--ink); color: var(--bg); }
.segmented.block { display: flex; width: 100%; }
.segmented.block button { flex: 1; }

/* Opciones en lista (sin tarjetas) */
.options { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  cursor: pointer;
  border-top: 1px solid var(--line);
  transition: background-color .1s;
}
.option:first-child { border-top: 0; }
.option:hover { background: var(--surface-2); }
.option input { margin: 3px 0 0; accent-color: var(--accent); }
.option strong { display: block; font-weight: 550; }
.option span { display: block; font-size: 12.5px; color: var(--ink-3); }
.option.checked { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }
.option.disabled { opacity: .5; cursor: not-allowed; }

.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 13px;
}
.check input { accent-color: var(--accent); margin: 0; }
.check:hover { background: var(--surface-2); }

/* Selector de países/etiquetas */
.tokens { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); padding: 4px; display: flex; flex-wrap: wrap; gap: 4px; position: relative; }
.tokens:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tokens input { border: 0 !important; box-shadow: none !important; height: 26px; flex: 1; min-width: 140px; padding: 0 6px; background: transparent; }
.token {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 4px 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--surface-2);
  font-size: 12.5px;
}
.token b { font-family: var(--mono); font-weight: 600; font-size: 11px; color: var(--ink-3); }
.token button { border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 2px; display: grid; }
.token button:hover { color: var(--danger); }
.suggest {
  position: absolute;
  left: -1px;
  right: -1px;
  top: calc(100% + 4px);
  z-index: 60;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.suggest button {
  display: flex;
  width: 100%;
  gap: 10px;
  padding: 7px 10px;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.suggest button b { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); width: 22px; }
.suggest button:hover, .suggest button.active { background: var(--surface-2); }

/* ------------------------------------------------------ badges and dots */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
  vertical-align: middle;
}
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-soft); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-soft); }
.badge.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: var(--danger-soft); }
.badge.info { color: var(--info); border-color: color-mix(in srgb, var(--info) 40%, transparent); background: var(--info-soft); }
.badge.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.badge.solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.badges { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }

.dot { display: inline-block; width: 8px; height: 8px; flex: none; border-radius: 1px; background: var(--line-strong); }
.dot.on { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.err { background: var(--danger); }
.dot.off { background: transparent; border: 1px solid var(--ink-3); }
.dot.pulse { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.state.on { color: var(--ok); }
.state.err { color: var(--danger); }
.state.warn { color: var(--warn); }

.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
}
.chip.off { opacity: .5; text-decoration: line-through; }
.chip.down { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); color: var(--danger); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }

/* --------------------------------------------------------------- notes */
.note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-3);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 13px;
  color: var(--ink-2);
}
.note svg { margin-top: 2px; }
.note.info { border-left-color: var(--info); }
.note.info svg { color: var(--info); }
.note.ok { border-left-color: var(--ok); }
.note.ok svg { color: var(--ok); }
.note.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.note.warn svg { color: var(--warn); }
.note.danger { border-left-color: var(--danger); background: var(--danger-soft); color: var(--ink); }
.note.danger svg { color: var(--danger); }
.note .note-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }

/* -------------------------------------------------------------- terminal */
.term {
  border: 1px solid var(--term-line);
  border-radius: var(--radius);
  background: var(--term-bg);
  color: var(--term-ink);
  overflow: hidden;
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--term-line);
  overflow-x: auto;
}
.term-bar button {
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid var(--term-line);
  background: transparent;
  color: var(--term-dim);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.term-bar button:hover { color: var(--term-ink); }
.term-bar button.active { color: var(--term-ink); background: color-mix(in srgb, var(--term-ink) 7%, transparent); box-shadow: inset 0 -2px 0 var(--accent); }
.term-bar .spacer { flex: 1; }
.term-bar .meta { padding: 0 12px; font-family: var(--mono); font-size: 11px; color: var(--term-dim); white-space: nowrap; }
.term-body { padding: 14px 16px; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; }
.term-line { display: flex; gap: 10px; align-items: flex-start; }
.term-line .prompt { color: var(--accent); user-select: none; flex: none; }
.term-line code { background: none; border: 0; padding: 0; color: var(--term-ink); font-size: 12.5px; word-break: break-all; white-space: pre-wrap; flex: 1; }
.term-line .copy { flex: none; margin-top: -3px; color: var(--term-dim); }
.term-line .copy:hover { color: var(--term-ink); background: color-mix(in srgb, var(--term-ink) 10%, transparent); border-color: transparent; }
.term-comment { color: var(--term-dim); }
.term-comment::before { content: '# '; }
.term-gap { height: 10px; }

/* ------------------------------------------------------------ key-value */
.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; margin: 0; }
.kv dt, .kv dd { padding: 9px 0; border-top: 1px solid var(--line); margin: 0; }
.kv dt:first-of-type, .kv dd:first-of-type { border-top: 0; }
.kv dt { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding-right: 16px; padding-top: 11px; }
.kv dd { min-width: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- lists */
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.list-row:first-child { border-top: 0; }
.list-row.clickable { cursor: pointer; transition: background-color .1s; }
.list-row.clickable:hover { background: var(--surface-2); }
.list-row .title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .sub { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .side { margin-left: auto; text-align: right; font-family: var(--mono); font-size: 12px; color: var(--ink-2); flex: none; }

/* Publicaciones */
.rule {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  align-items: start;
}
.rule:first-child { border-top: 0; }
.rule.disabled .rule-main { opacity: .55; }
.rule .glyph {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--ink-2);
  background: var(--surface-2);
}
.rule-main { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.rule-route { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--mono); font-size: 13px; min-width: 0; }
.rule-route .arrow { color: var(--ink-3); }
.rule-route a { font-weight: 600; }
.rule-side { display: flex; align-items: center; gap: 4px; }
.rule-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); }
.rule-meta span { display: inline-flex; align-items: center; gap: 5px; }

/* ------------------------------------------------------------- diagram */
.diagram { width: 100%; overflow-x: auto; }
.diagram svg.vertical { min-width: 0; max-width: 340px; }
.diagram svg { display: block; min-width: 560px; width: 100%; max-width: 880px; height: auto; margin: 0 auto; font-family: var(--mono); }
.diagram .node rect { fill: var(--surface); stroke: var(--line-strong); }
.diagram .node.core rect { fill: var(--surface-2); }
.diagram .node.live rect { stroke: var(--ok); }
.diagram .node.down rect { stroke: var(--danger); stroke-dasharray: 4 3; }
.diagram .node text { fill: var(--ink); font-size: 12px; }
.diagram .node text.k { fill: var(--ink-3); font-size: 9.5px; letter-spacing: .08em; }
.diagram .wire { stroke: var(--line-strong); stroke-width: 1.5; fill: none; }
.diagram .wire.tunnel { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 4; }
.diagram .wire.tunnel.idle { stroke: var(--line-strong); }
.diagram .wire-label { fill: var(--ink-3); font-size: 10.5px; }

/* --------------------------------------------------------------- chart */
.chart-body { position: relative; min-height: 250px; padding: 8px 8px 0; }
.chart-svg { display: block; overflow: visible; font-family: var(--mono); }
.chart-svg text { fill: var(--ink-3); font-size: 10.5px; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; }
.chart-svg .baseline { stroke: var(--line-strong); stroke-width: 1; }
.chart-svg .line { fill: none; stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .line.s1 { stroke: var(--series-1); }
.chart-svg .line.s2 { stroke: var(--series-2); }
.chart-svg .area.s1 { fill: var(--series-1); opacity: .09; }
.chart-svg .area.s2 { fill: var(--series-2); opacity: .09; }
.chart-svg .crosshair { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-svg .marker { stroke: var(--surface); stroke-width: 2; }
.chart-svg .marker.s1 { fill: var(--series-1); }
.chart-svg .marker.s2 { fill: var(--series-2); }
.chart-svg:focus { outline: none; }
.chart-svg:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-size: 13px; pointer-events: none; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; padding: 16px 18px 4px; }
.chart-total { font-family: var(--mono); font-size: 30px; font-weight: 500; letter-spacing: -0.02em; line-height: 1; }
.chart-total-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend-item { display: flex; align-items: center; gap: 7px; }
.legend-item strong { font-family: var(--mono); font-weight: 500; color: var(--ink); }
.key-line { display: inline-block; width: 14px; height: 2px; }
.key-line.s1 { background: var(--series-1); }
.key-line.s2 { background: var(--series-2); }
.tooltip {
  position: absolute;
  z-index: 5;
  min-width: 170px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 12px;
  pointer-events: none;
}
.tooltip .t-title { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-bottom: 6px; }
.tooltip .t-row { display: flex; align-items: center; gap: 8px; }
.tooltip .t-row strong { font-family: var(--mono); font-weight: 500; }

/* --------------------------------------------------------------- modals */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--ink) 38%, transparent);
  animation: fade .12s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rise .14s ease-out;
}
.modal.lg { max-width: 760px; }
@keyframes rise { from { transform: translateY(6px); opacity: 0; } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.modal-head .titles { flex: 1; min-width: 0; }
.modal-head h2 { font-size: 19px; letter-spacing: -0.02em; }
.modal-head p { margin-top: 4px; font-size: 13px; color: var(--ink-3); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }

/* ------------------------------------------------------ menus / popovers */
.menu, .popover {
  position: fixed;
  z-index: 90;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rise .1s ease-out;
}
.menu { padding: 4px; }
.menu hr { margin: 4px 0; }
.menu-head { padding: 8px 10px; border-bottom: 1px solid var(--line); margin: -4px -4px 4px; display: flex; flex-direction: column; }
.menu-head span { font-size: 12px; color: var(--ink-3); }
.menu-label { padding: 8px 10px 4px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.menu [role="menuitem"] {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 2px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu [role="menuitem"] svg { color: var(--ink-3); }
.menu [role="menuitem"]:hover { background: var(--surface-2); color: var(--ink); }
.menu [role="menuitem"].danger { color: var(--danger); }
.menu [role="menuitem"].danger svg { color: var(--danger); }
.menu [role="menuitem"].checked::after { content: ''; margin-left: auto; width: 6px; height: 6px; background: var(--accent); }

.popover { width: 380px; max-width: calc(100vw - 16px); }
.popover-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.popover-head h3 { font-size: 14px; }
.popover-body { max-height: min(460px, 70vh); overflow-y: auto; }

.notif {
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 12px;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.notif:first-child { border-top: 0; }
.notif:hover { background: var(--surface-2); }
.notif .dot { margin-top: 6px; }
.notif .n-title { font-weight: 550; font-size: 13px; }
.notif .n-body { font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }
.notif .n-time { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.notif:not(.unread) .n-title { font-weight: 450; color: var(--ink-2); }
.notif.unread { box-shadow: inset 2px 0 0 var(--accent); }

/* --------------------------------------------------------------- toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(400px, calc(100vw - 32px)); }
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--ok);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: rise .14s ease-out;
}
.toast svg { margin-top: 1px; }
.toast.success svg { color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
.toast.error svg { color: var(--danger); }
.toast.warning { border-left-color: var(--warn); }
.toast.warning svg { color: var(--warn); }
.toast.info { border-left-color: var(--info); }
.toast.info svg { color: var(--info); }
.toast .t-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.toast .icon-btn { width: 24px; height: 24px; margin: -3px -4px 0 0; }

/* ----------------------------------------------------------------- misc */
.empty { padding: 44px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty .glyph { width: 40px; height: 40px; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: 2px; color: var(--ink-3); margin-bottom: 4px; }
.empty h3 { font-size: 16px; }
.empty p { color: var(--ink-3); max-width: 44ch; font-size: 13px; }
.empty .btn { margin-top: 8px; }

.skeleton { height: 14px; border-radius: 2px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.secret {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 13.5px;
  word-break: break-all;
}
.secret span { flex: 1; }

.qr { display: grid; place-items: center; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); width: max-content; margin: 0 auto; }
.qr img { width: 220px; height: 220px; image-rendering: pixelated; display: block; }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); }
.steps li:first-child { border-top: 0; }
.steps li::before { content: counter(step, decimal-leading-zero); font-family: var(--mono); font-size: 11.5px; color: var(--accent); padding-top: 2px; }

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button, .tabs a {
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--ink-3);
  font: inherit;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.tabs button:hover, .tabs a:hover { color: var(--ink); }
.tabs .active { color: var(--ink); border-bottom-color: var(--accent); }

.settings-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; align-items: start; }
.subnav { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 1px; }
.subnav button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 7px 10px;
  line-height: 1.3;
  border: 0;
  border-left: 2px solid var(--line);
  background: none;
  color: var(--ink-3);
  font: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.subnav button:hover { color: var(--ink); border-left-color: var(--ink-3); }
.subnav button.active { color: var(--ink); border-left-color: var(--accent); background: var(--surface-2); }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }

/* ----------------------------------------------------------------- auth */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}
.auth-side {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 40px 48px;
  background: var(--term-bg);
  color: var(--term-ink);
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.auth-side .brand { padding: 0; color: var(--term-ink); }
.auth-side .brand .mark { background: var(--term-ink); color: var(--term-bg); }
.auth-side .brand .ver { color: var(--term-dim); }
.auth-side h2 { font-size: clamp(30px, 3.4vw, 46px); font-weight: 650; letter-spacing: -0.035em; line-height: 1.02; font-variation-settings: 'wdth' 88; max-width: 14ch; }
.auth-side h2 em { font-style: normal; color: var(--accent); }
.auth-side p { color: var(--term-dim); max-width: 46ch; margin-top: 14px; }
.auth-log { font-family: var(--mono); font-size: 12px; line-height: 1.8; color: var(--term-dim); border-top: 1px solid var(--term-line); padding-top: 16px; }
.auth-log b { color: var(--term-ink); font-weight: 500; }
.auth-log .ok { color: #a3c060; }
.auth-main { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(24px, 6vw, 88px); background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.auth-card h1 { font-size: 28px; letter-spacing: -0.03em; font-variation-settings: 'wdth' 92; }
.auth-card .lead { color: var(--ink-3); margin-top: 6px; }
.auth-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; font-size: 12px; color: var(--ink-3); max-width: 380px; width: 100%; margin-left: auto; margin-right: auto; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }

.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.lang-switch button { border: 0; background: none; padding: 3px 8px; font-family: var(--mono); font-size: 11px; color: var(--ink-3); cursor: pointer; text-transform: uppercase; }
.lang-switch button + button { border-left: 1px solid var(--line); }
.lang-switch button.active { background: var(--ink); color: var(--bg); }

.noscript { padding: 24px; font-family: var(--mono); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats .stat:nth-child(3) { border-left: 0; }
  .stats .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .settings-grid { grid-template-columns: 1fr; gap: 16px; }
  .subnav { position: static; flex-direction: row; overflow-x: auto; border-bottom: 1px solid var(--line); gap: 0; }
  .subnav button { border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; flex: none; }
  .subnav button.active { border-bottom-color: var(--accent); background: none; }
  .hide-md { display: none !important; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 150;
    width: min(290px, 86vw);
    transform: translateX(-100%);
    transition: transform .18s ease-out;
    box-shadow: var(--shadow);
  }
  .app.nav-open .sidebar { transform: none; }
  .nav-scrim { position: fixed; inset: 0; z-index: 140; background: color-mix(in srgb, var(--ink) 30%, transparent); }
  .topbar { padding: 0 12px; }
  .topbar .menu-toggle { display: inline-grid; }
  .topbar .brand-mini { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -0.02em; text-decoration: none; }
  .topbar .crumbs { display: none; }
  .content { padding: 20px 16px 56px; }
  .page-head h1 { font-size: 27px; }
  .page-head .actions { width: 100%; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 24px; gap: 16px; }
  .auth-side h2 { font-size: 28px; }
  .auth-side .auth-log, .auth-side p { display: none; }
  .auth-main { padding: 32px 20px 40px; justify-content: flex-start; }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .hide-sm { display: none !important; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 21px; }
  .panel-head, .panel-body { padding-left: 14px; padding-right: 14px; }
  .rule { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 14px; }
  .rule .glyph { display: none; }
  .list-row { padding: 10px 14px; }
  .backdrop { padding: 0; place-items: end stretch; }
  .modal, .modal.lg { max-width: none; max-height: 92vh; border-radius: 6px 6px 0 0; border-bottom: 0; }
  .modal-foot .btn { flex: 1; }
  .toasts { right: 16px; left: 16px; bottom: 16px; width: auto; }
  .field-row { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { padding-bottom: 0; border-top: 1px solid var(--line); }
  .kv dd { border-top: 0; padding-top: 2px; }
  .kv dt:first-of-type { border-top: 0; }

  /* Tablas en filas apiladas */
  .table.stacked thead { display: none; }
  .table.stacked, .table.stacked tbody, .table.stacked tr, .table.stacked td { display: block; width: 100%; }
  .table.stacked tr { padding: 10px 14px; border-bottom: 1px solid var(--line); position: relative; }
  .table.stacked tbody tr:last-child { border-bottom: 0; }
  .table.stacked td { padding: 2px 0; border: 0; text-align: left; }
  .table.stacked td[data-label]::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 96px;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-3);
  }
  .table.stacked td.actions { position: absolute; top: 8px; right: 8px; width: auto; }
  .table.stacked td.num { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Utilidades sin estilos en línea (la CSP no los permite) */
.search-box { max-width: 420px; }
.gap-top { margin-top: 8px; }
.term-qr { padding: 12px 0; }
