/* PüLU · Registro — hoja única. Tokens del design system (docs/design_system.md §3–§6, pulu_ui::tema): un tema oscuro,
   acento turquesa petróleo + ámbar de aviso, trazos de 1 px, radios 2 (controles) y 3 (paneles), retícula de 4 px,
   Inter (UI) + IBM Plex Mono (valores). Sin gradientes, sombras decorativas, glow ni animaciones permanentes. */

@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fuentes/Inter-Regular.ttf") format("truetype"); }
@font-face { font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap; src: url("/fuentes/Inter-Medium.ttf") format("truetype"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fuentes/Inter-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fuentes/IBMPlexMono-Regular.ttf") format("truetype"); }

:root {
  --bg: #0c0f14; --surface: #12161d; --surface-raised: #191f28; --surface-sunken: #090b0f;
  --border: #252c37; --border-strong: #3a4454; --grid: #1c222c;
  --text: #e7eaef; --text-2: #939cab; --text-3: #5d6675;
  --accent: #35a89f; --accent-strong: #6fd3ca; --accent-dim: rgb(53 168 159 / 18%);
  --amber: #d29922; --ok: #3fb950; --error: #f85149; --error-dim: rgb(248 81 73 / 12%); --amber-dim: rgb(210 153 34 / 12%);
  --font-ui: "Inter", "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;
  --fs-xs: 11px; --fs-s: 12.5px; --fs-m: 15px; --fs-l: 17px; --fs-xl: 22px; --fs-xxl: 30px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --radius-ctl: 2px; --radius-panel: 3px; --stroke: 1px;
  --topbar-h: 48px; --ancho: 960px; --ancho-form: 440px;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text); font-family: var(--font-ui); font-size: var(--fs-m); line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: var(--stroke) solid var(--accent); outline-offset: 2px;
}
h1, h2, h3 { margin: 0; font-weight: 500; line-height: 1.25; letter-spacing: -0.005em; }
h1 { font-size: var(--fs-xxl); } h2 { font-size: var(--fs-xl); } h3 { font-size: var(--fs-l); }
p { margin: 0 0 var(--s3); }
p:last-child { margin-bottom: 0; }
small, .s { font-size: var(--fs-s); }
.mono, code, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
code { font-size: 0.92em; background: var(--surface-raised); padding: 1px 5px; border-radius: var(--radius-ctl); border: var(--stroke) solid var(--border); }
.dim { color: var(--text-2); } .dim3 { color: var(--text-3); }
.label, .etiqueta { font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.visualmente-oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.oculto { display: none !important; }

/* --- barra superior --- */
.topbar {
  height: var(--topbar-h); background: var(--surface); border-bottom: var(--stroke) solid var(--border);
}
.topbar .in {
  max-width: var(--ancho); margin: 0 auto; height: 100%; padding: 0 var(--s5);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
}
.brand { display: flex; align-items: center; gap: var(--s3); color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 22px; height: 22px; display: block; opacity: 0.92; }
.brand .name { font-size: var(--fs-l); letter-spacing: 0.005em; }
.brand .name b { font-weight: 600; }
.brand .sep { width: 1px; height: 18px; background: var(--border-strong); }
.brand .area { color: var(--text-2); font-size: var(--fs-m); }
.brand .wave { color: var(--text-3); display: inline-flex; margin-left: var(--s1); }
.nav { display: flex; align-items: center; gap: var(--s1); }
.nav a, .nav button {
  display: inline-flex; align-items: center; height: 30px; padding: 0 var(--s3); border-radius: var(--radius-ctl);
  color: var(--text-2); font: inherit; font-size: var(--fs-s); background: transparent; border: var(--stroke) solid transparent; cursor: pointer;
}
.nav a:hover, .nav button:hover { color: var(--text); text-decoration: none; border-color: var(--border-strong); }
.nav a.on { color: var(--text); background: var(--surface-raised); border-color: var(--border-strong); }
.nav .apodo { color: var(--text); font-family: var(--font-mono); font-size: var(--fs-s); padding: 0 var(--s2); }

/* --- contenido --- */
main { flex: 1; width: 100%; max-width: var(--ancho); margin: 0 auto; padding: var(--s6) var(--s5) var(--s7); }
main.estrecho { max-width: calc(var(--ancho-form) + 2 * var(--s5)); }
.cabecera { margin-bottom: var(--s5); }
.cabecera .etiqueta { margin-bottom: var(--s2); display: block; }
.cabecera p { color: var(--text-2); max-width: 60ch; }
.gemil { height: 9px; margin: var(--s5) 0; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='9' viewBox='0 0 18 9'><path d='M9 0.5h1v1h1v1h1v1h1v1h-1v1h-1v1h-1v1h-1v-1h-1v-1h-1v-1h-1v-1h1v-1h1v-1h1z' fill='none' stroke='%233a4454' stroke-width='0.75'/></svg>") repeat-x center; }

.panel { background: var(--surface); border: var(--stroke) solid var(--border); border-radius: var(--radius-panel); }
.panel > .head {
  min-height: 36px; display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s4);
  border-bottom: var(--stroke) solid var(--border); font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2);
}
.panel > .head .right { margin-left: auto; display: flex; gap: var(--s2); align-items: center; text-transform: none; letter-spacing: 0; font-size: var(--fs-s); }
.panel > .body { padding: var(--s4); }
.panel + .panel { margin-top: var(--s4); }
.grid3 > .panel, .grid2 > .panel { margin-top: 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s4); }
.pie-panel { display: flex; justify-content: flex-end; gap: var(--s2); padding: var(--s3) var(--s4); border-top: var(--stroke) solid var(--border); }

/* --- hero de portada --- */
.hero { padding: var(--s5) 0 var(--s3); }
.hero h1 { font-size: var(--fs-xxl); margin-bottom: var(--s3); }
.hero p { color: var(--text-2); max-width: 62ch; font-size: var(--fs-l); }
.hero .acciones { display: flex; gap: var(--s2); margin-top: var(--s5); flex-wrap: wrap; }
.dato { display: grid; gap: var(--s1); }
.dato .ml { font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.dato .mv { font-size: var(--fs-l); color: var(--text); }
.dato .mn { font-size: var(--fs-s); color: var(--text-2); }
.lista { margin: 0; padding-left: 1.1em; color: var(--text-2); }
.lista li { margin: 0 0 var(--s1); }
.lista li::marker { color: var(--text-3); }

/* --- formularios --- */
form { display: grid; gap: var(--s4); }
.campo { display: grid; gap: 6px; }
.campo label { font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.campo .fila { display: flex; gap: var(--s2); align-items: center; }
.campo .fila input { flex: 1; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="datetime-local"], input[type="number"], select, textarea {
  width: 100%; height: 36px; padding: 0 var(--s3); font: inherit; font-size: var(--fs-m); color: var(--text);
  background: var(--surface-sunken); border: var(--stroke) solid var(--border-strong); border-radius: var(--radius-ctl);
}
textarea { height: auto; min-height: 72px; padding: var(--s2) var(--s3); resize: vertical; }
select { appearance: none; -webkit-appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23939cab' stroke-width='1.25'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; }
input::placeholder { color: var(--text-3); }
input:hover, select:hover, textarea:hover { border-color: var(--text-2); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
input[aria-invalid="true"] { border-color: var(--error); }
input.mono { font-family: var(--font-mono); letter-spacing: 0.04em; }
.ayuda { font-size: var(--fs-s); color: var(--text-2); }
.error-campo { font-size: var(--fs-s); color: var(--error); min-height: 1.2em; }
.acciones-form { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.acciones-form .enlace { margin-left: auto; font-size: var(--fs-s); }

/* --- botones --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); height: 34px; padding: 0 var(--s4);
  background: var(--surface-raised); color: var(--text); border: var(--stroke) solid var(--border-strong); border-radius: var(--radius-ctl);
  font: inherit; font-size: var(--fs-m); cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--text-2); text-decoration: none; }
.btn.primary { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-dim); }
.btn.primary:hover { border-color: var(--accent-strong); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.quiet:hover { border-color: var(--border-strong); color: var(--text); }
.btn.danger { border-color: var(--error); color: var(--error); background: transparent; }
.btn.danger:hover { background: var(--error-dim); }
.btn.sm { height: 28px; padding: 0 var(--s3); font-size: var(--fs-s); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: default; pointer-events: none; }
.btn .spin { width: 12px; height: 12px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: giro 0.8s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }

/* --- mensajes --- */
.msg {
  display: none; padding: var(--s3) var(--s4); border: var(--stroke) solid var(--border-strong); border-radius: var(--radius-ctl);
  background: var(--surface-raised); color: var(--text); font-size: var(--fs-s); line-height: 1.45;
}
.msg.show { display: block; }
.msg.ok { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-dim); }
.msg.warn { border-color: var(--amber); color: var(--amber); background: var(--amber-dim); }
.msg.err { border-color: var(--error); color: var(--error); background: var(--error-dim); }
.msg a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* --- pastillas de estado --- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 var(--s2); border: var(--stroke) solid var(--border-strong);
  border-radius: var(--radius-ctl); font-size: var(--fs-xs); letter-spacing: 0.03em; color: var(--text-2); white-space: nowrap; text-transform: lowercase;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: currentColor; }
.pill.activa, .pill.activo, .pill.verificado { border-color: var(--accent); color: var(--accent-strong); }
.pill.pendiente { border-color: var(--amber); color: var(--amber); }
.pill.suspendida, .pill.vencida, .pill.liberada { color: var(--text-3); }
.pill.revocada, .pill.bloqueado, .pill.bloqueada { border-color: var(--error); color: var(--error); }

/* --- clave/valor y tablas --- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--s2) var(--s5); align-items: baseline; margin: 0; }
.kv dt { font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.kv dd { margin: 0; }
.tabla-wrap { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; font-size: var(--fs-s); }
.tabla th { text-align: left; font-weight: 500; font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); padding: var(--s2) var(--s3); border-bottom: var(--stroke) solid var(--border-strong); white-space: nowrap; }
.tabla td { padding: var(--s2) var(--s3); border-bottom: var(--stroke) solid var(--border); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla td.num, .tabla th.num { text-align: right; }
.tabla .mono { font-size: var(--fs-s); }
.tabla .vacio { color: var(--text-3); text-align: center; padding: var(--s5); }
.tabla tr.sel td { background: var(--accent-dim); }

/* --- barra de herramientas (admin) --- */
.tabs { display: flex; gap: 2px; border-bottom: var(--stroke) solid var(--border); margin-bottom: var(--s4); }
.tab { height: 32px; padding: 0 var(--s3); display: inline-flex; align-items: center; font: inherit; font-size: var(--fs-s); color: var(--text-2); background: transparent; border: 0; border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.herramientas { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; padding: var(--s3) var(--s4); border-bottom: var(--stroke) solid var(--border); }
.herramientas input, .herramientas select { height: 30px; font-size: var(--fs-s); width: auto; min-width: 140px; }
.herramientas .total { margin-left: auto; font-size: var(--fs-s); color: var(--text-2); font-family: var(--font-mono); }
.paginacion { display: flex; gap: var(--s2); align-items: center; justify-content: flex-end; padding: var(--s2) var(--s4); font-size: var(--fs-s); color: var(--text-2); border-top: var(--stroke) solid var(--border); }
.metricas { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3); }
.metrica { padding: var(--s3) var(--s4); border: var(--stroke) solid var(--border); border-radius: var(--radius-ctl); background: var(--surface-sunken); display: grid; gap: 2px; }
.metrica .ml { font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.metrica .mv { font-family: var(--font-mono); font-size: 24px; line-height: 1.1; color: var(--text); }
.metrica .mn { font-size: var(--fs-xs); color: var(--text-2); }
.barras { display: flex; align-items: flex-end; gap: 3px; height: 72px; padding-top: var(--s2); }
.barras .b { flex: 1; min-width: 4px; background: var(--accent); opacity: 0.85; }
.barras .b.cero { background: var(--grid); }
.editor { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); padding: var(--s3) var(--s4); border-top: var(--stroke) solid var(--border); background: var(--surface-raised); }
.editor .campo label { font-size: 10px; }
.editor input, .editor select, .editor textarea { height: 30px; font-size: var(--fs-s); }
.editor .ancho { grid-column: 1 / -1; }

/* --- detalle plegable --- */
details { border: var(--stroke) solid var(--border); border-radius: var(--radius-panel); }
details summary { cursor: pointer; padding: var(--s3) var(--s4); color: var(--text-2); font-size: var(--fs-s); list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "+"; display: inline-block; width: 14px; color: var(--text-3); font-family: var(--font-mono); }
details[open] summary::before { content: "−"; }
details .body { padding: 0 var(--s4) var(--s4); }

/* --- pie --- */
footer { border-top: var(--stroke) solid var(--border); }
footer .in { max-width: var(--ancho); margin: 0 auto; padding: var(--s4) var(--s5); display: flex; gap: var(--s4); flex-wrap: wrap; align-items: center; font-size: var(--fs-s); color: var(--text-3); }
footer a { color: var(--text-2); }
footer .ver { margin-left: auto; font-family: var(--font-mono); }

/* --- texto legal --- */
.prosa { max-width: 68ch; }
.prosa h2 { font-size: var(--fs-l); margin: var(--s5) 0 var(--s2); }
.prosa p, .prosa li { color: var(--text-2); }
.prosa strong { color: var(--text); font-weight: 500; }

@media (max-width: 760px) {
  main { padding: var(--s5) var(--s4) var(--s6); }
  .grid3, .grid2, .metricas { grid-template-columns: 1fr 1fr; }
  .editor { grid-template-columns: 1fr 1fr; }
  .brand .area, .brand .wave, .brand .sep { display: none; }
}
@media (max-width: 520px) {
  .grid3, .grid2, .metricas, .editor { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: var(--s1); }
  .kv dd { margin-bottom: var(--s2); }
}
@media (prefers-reduced-motion: reduce) { .btn .spin { animation: none; } }

/* --- utilidades de espaciado --- */
.mt { margin-top: var(--s3); } .mt2 { margin-top: var(--s5); } .mb { margin-bottom: var(--s3); }
