/* ==========================================================================
   The Negra — UI Kit para herramientas internas · v1.1 (16/10/2026)
   Referencia visual: studio.thenegra.com. Página de componentes: studio.thenegra.com/ui/
   Uso: ver tn-brain/ui-kit/README.md. Tipografías: <link rel="stylesheet" href="https://use.typekit.net/ung5ebm.css">
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  /* superficies (de atrás hacia adelante) */
  --bg: #000;            /* fondo de la página */
  --panel: #0e0e0e;      /* paneles, tarjetas, filas al pasar */
  --panel2: #161616;     /* elementos dentro de un panel, inputs, botones secundarios */
  --line: #262626;       /* bordes y separadores */
  --line2: #3a3a3a;      /* bordes al pasar el mouse */
  /* texto */
  --fg: #f4f1ea;         /* principal (blanco cálido) */
  --muted: #8d887e;      /* secundario */
  --soft: #cfcac0;       /* párrafos largos sobre fondo oscuro */
  /* acento y estados */
  --gold: #a8986a;       /* acento del estudio: foco, progreso, selección, acción destacada */
  --ok: #7fb069; --warn: #d9a441; --bad: #d1605a; --info: #6f9fd8;
  /* tipografía */
  --serif: "garamond-premier-pro-display", Garamond, Times, serif;   /* títulos, nombres, números grandes */
  --sans: "neue-haas-grotesk-text", "Helvetica Neue", Helvetica, Arial, sans-serif;   /* texto y controles */
  --mono: ui-monospace, "SF Mono", Menlo, monospace;                 /* etiquetas, metadatos, chips */
  /* forma */
  --r-s: 8px; --r-m: 12px; --r-l: 16px; --r-pill: 999px;
  --gutter: 28px;
}

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--sans); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 400; margin: 0; }
h1 { font-size: 40px; line-height: 1; }
h2 { font-size: 34px; line-height: 1; }
h3 { font-size: 22px; line-height: 1.15; }
h4 { font-size: 18px; }
p { margin: 0 0 12px; }
[hidden] { display: none !important; }
::selection { background: var(--gold); color: #000; }

.muted { color: var(--muted); }
.soft { color: var(--soft); }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.serif { font-family: var(--serif); }
.dato { font-family: var(--mono); font-size: 12px; }   /* datos literales en mono, sin mayúsculas: emails, links, códigos, IPs */
.ok-t { color: var(--ok); } .warn-t { color: var(--warn); } .bad-t { color: var(--bad); } .gold-t { color: var(--gold); }

/* ---------- 3. Estructura: header fijo, menú, submenú, contenido ---------- */
.fijo { position: sticky; top: 0; z-index: 10; background: rgba(0,0,0,.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top { display: flex; align-items: center; gap: 28px; padding: 14px var(--gutter); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-family: var(--serif); font-size: 20px; }
.brand img { width: 34px; }
.menu { display: flex; gap: 4px; }
.menu a { text-decoration: none; padding: 6px 14px; border-radius: var(--r-pill); color: var(--muted); }
.menu a:hover, .menu a.on { color: var(--fg); background: var(--panel2); }
.me { margin-left: auto; display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 13px; }
.submenu { display: flex; gap: 6px; padding: 10px var(--gutter); border-top: 1px solid var(--line); }
.submenu a { text-decoration: none; padding: 4px 12px; border-radius: var(--r-pill); color: var(--muted); font-size: 13px; }
.submenu a:hover, .submenu a.on { color: var(--fg); background: var(--panel2); }

main { padding: 32px var(--gutter) 120px; max-width: 1480px; margin: 0 auto; }
section { margin-bottom: 56px; scroll-margin-top: 120px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.acciones { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pila { display: grid; gap: 12px; }

/* ---------- 4. Botones y links ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; padding: 9px 16px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--panel2); color: var(--fg); cursor: pointer; text-decoration: none; font-size: 14px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--fg); border-color: var(--fg); color: #000; }        /* la acción principal de la pantalla */
.btn.gold { background: var(--gold); border-color: var(--gold); color: #000; }       /* acción destacada (activar, crear) */
.btn.peligro { color: var(--bad); border-color: var(--bad); background: none; }      /* borrar, desactivar */
.btn.small { padding: 5px 11px; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: default; }
.link { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; color: var(--muted); font-size: inherit; }
.link:hover { color: var(--fg); }
.icon { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px 6px; font-size: 13px; }
.icon:hover { color: var(--fg); }

/* ---------- 5. Formularios ---------- */
label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
label > span { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search], input:not([type]), select, textarea {
  width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-s); padding: 9px 12px; outline: none; color: var(--fg); }
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.ayuda { font-size: 12px; color: var(--muted); }
.error { color: var(--bad); font-size: 13px; min-height: 1.2em; }
/* interruptor */
.toggle { display: inline-flex; flex-direction: row; align-items: center; gap: 10px; cursor: pointer; color: var(--fg); font-size: 14px; }
.toggle input { appearance: none; flex: none; width: 38px; height: 22px; margin: 0; border-radius: var(--r-pill); background: var(--line); position: relative; cursor: pointer; transition: background .2s; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--fg); transition: transform .2s; }
.toggle input:checked { background: var(--ok); }
.toggle input:checked::after { transform: translateX(16px); }
/* casilla o radio con texto */
.opcion { display: flex; flex-direction: row; align-items: center; gap: 8px; color: var(--fg); font-size: 13px; cursor: pointer; }
.opcion input { accent-color: var(--gold); }

/* ---------- 6. Contenedores ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); padding: 22px; margin-bottom: 18px; }
.panel > h3 { margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card { display: block; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-decoration: none; }
a.card:hover { border-color: var(--gold); }
.card .nom { font: 400 19px/1.15 var(--serif); }
.card .meta { color: var(--muted); font-size: 12px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.card .pie { font-size: 12px; margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.vacio { color: var(--muted); padding: 18px; border: 1px dashed var(--line); border-radius: var(--r-m); }
.aviso { border: 1px solid var(--warn); color: var(--warn); padding: 10px 14px; border-radius: 10px; margin-bottom: 24px; }
.aviso.info { border-color: var(--info); color: var(--info); }
.aviso.bad { border-color: var(--bad); color: var(--bad); }

/* ---------- 7. Datos: números, tablas, chips, progreso, alertas ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 28px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.kpi b { display: block; font: 400 44px/1 var(--serif); margin: 10px 0 4px; }
.kpi.riesgo b { color: var(--warn); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font: 11px var(--mono); color: var(--muted); letter-spacing: .05em; text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.nombre { font: 400 20px var(--serif); }
td.mono, td .mono { white-space: nowrap; }
tr.fila { cursor: pointer; }
tr.fila:hover td { background: var(--panel); }
tr.apagada td { opacity: .5; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; font: 11px var(--mono); padding: 3px 10px; border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: currentColor; }
.chip.warn { color: var(--warn); border-color: currentColor; }
.chip.bad { color: var(--bad); border-color: currentColor; }
.chip.info { color: var(--info); border-color: currentColor; }
.chip.gold { color: var(--gold); border-color: currentColor; }
.chip.apagado { border-style: dashed; opacity: .7; }

.prog { width: 90px; height: 4px; background: var(--line); border-radius: 2px; display: inline-block; vertical-align: middle; margin-right: 8px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--gold); }

.alertas { display: grid; gap: 8px; }
.alerta { display: grid; grid-template-columns: 10px 1fr auto; gap: 14px; align-items: start; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 16px; text-decoration: none; }
a.alerta:hover { border-color: var(--line2); }
.alerta .pt { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--muted); }
.alerta.alta .pt { background: var(--bad); } .alerta.media .pt { background: var(--warn); } .alerta.info .pt { background: var(--info); }
.alerta small { display: block; color: var(--muted); margin-top: 2px; }

/* ---------- 8. Capas: aviso modal y toast ---------- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.72); display: grid; place-items: center; padding: 16px; }
.modal-caja { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 30px; max-width: 480px; width: 100%; }
.modal-caja h2 { font-size: 30px; line-height: 1.1; margin-bottom: 14px; }
.modal-bot { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 70; background: var(--fg); color: #000;
  padding: 10px 18px; border-radius: var(--r-pill); font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; }
.toast.on { opacity: 1; transform: translateX(-50%); }

/* ---------- 9. Login ---------- */
.login { max-width: 380px; margin: 12vh auto; display: grid; gap: 16px; }
.login h1 { margin-bottom: 8px; }
.login .btn { justify-content: center; padding: 11px 18px; }

/* ---------- 10. Pantallas angostas ---------- */
@media (max-width: 900px) {
  :root { --gutter: 16px; }
  .top { flex-wrap: wrap; gap: 12px; padding: 12px var(--gutter); }
  .menu { overflow-x: auto; max-width: 100%; }
  main { padding: 20px var(--gutter) 100px; }
  .grid2 { grid-template-columns: 1fr; }
  h1 { font-size: 34px; } h2 { font-size: 28px; }
  .ocultar-m { display: none; }
}
