:root {
  --bg: #0f1720;
  --panel: #17222e;
  --panel-2: #1d2b39;
  --line: #2a3b4d;
  --text: #e7eef5;
  --muted: #93a4b5;
  --accent: #2f81f7;
  --ok: #2ea043;
  --warn: #d29922;
  --err: #da3633;
  --radius: 10px;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: #79b8ff; text-decoration: none; }
a:hover { text-decoration: underline; }
.top {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px; background: #0b131b; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; font-size: 17px; color: var(--text); letter-spacing: .2px; }
.pill {
  font-size: 11px; letter-spacing: .8px; padding: 2px 8px; border-radius: 999px;
  background: #12324f; color: #9ecbff; border: 1px solid #1d4b74;
}
.nav { display: flex; align-items: center; gap: 14px; margin-left: 8px; flex: 1; }
.nav a { color: var(--muted); padding: 4px 2px; }
.nav a.on { color: var(--text); border-bottom: 2px solid var(--accent); }
.nav .spacer { flex: 1; }
.who { color: var(--muted); font-size: 13px; }
main { max-width: 1180px; margin: 22px auto 60px; padding: 0 18px; }
h1, h2, h3 { margin: 0 0 10px; font-weight: 640; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 18px;
}
.head-panel { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.kpis { display: flex; gap: 22px; flex-wrap: wrap; }
.kpi-label { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.row-actions { display: flex; gap: 6px; }
.grow { flex: 1; min-width: 220px; }
.stack { display: flex; flex-direction: column; gap: 6px; min-width: 210px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, button, textarea {
  font: inherit; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
input:focus, select:focus { outline: 2px solid #2f81f7aa; border-color: var(--accent); }
button, .btn {
  background: var(--panel-2); color: var(--text); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  padding: 8px 12px; border-radius: 8px;
}
button:hover, .btn:hover { border-color: #3d5871; background: #223142; }
button.primary { background: #1f6feb; border-color: #2f81f7; }
button.primary:hover { background: #2f81f7; }
button.link { background: none; border: none; color: #79b8ff; padding: 0; }
.inline { display: inline; }
.grid { width: 100%; border-collapse: collapse; margin: 12px 0; }
.grid th, .grid td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.st-ok { color: #7ee787; border-color: #23543a; background: #12261a; }
.st-ok::before { background: var(--ok); }
.st-warn { color: #e3b341; border-color: #5a4718; background: #2a2210; }
.st-warn::before { background: var(--warn); }
.st-err { color: #ff9b96; border-color: #5c2422; background: #2a1414; }
.st-err::before { background: var(--err); }
.st-run { color: #9ecbff; border-color: #1d4b74; background: #122436; }
.st-run::before { background: var(--accent); animation: pulse 1.4s infinite; }
.st-idle { color: var(--muted); }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid var(--line); }
.flash-ok { background: #10261a; border-color: #23543a; color: #b7f0c4; }
.flash-warn { background: #2a2210; border-color: #5a4718; color: #f0dca0; }
.flash-error { background: #2a1414; border-color: #5c2422; color: #ffc4c0; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
.tag-warn { background: #2a2210; color: #e3b341; border: 1px solid #5a4718; }
details { margin: 10px 0; }
summary { cursor: pointer; color: #9ecbff; margin-bottom: 8px; }
pre.doc {
  background: #0c141c; border: 1px solid var(--line); border-radius: 8px; padding: 12px;
  overflow: auto; max-height: 420px; white-space: pre-wrap; font-size: 12.5px;
}
.login-body { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(1200px 600px at 50% -10%, #16283a, #0b131b 60%); }
.login { width: min(400px, 92vw); display: flex; flex-direction: column; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.login h1 { font-size: 22px; }
.login .primary { margin-top: 6px; justify-content: center; }
.foot { text-align: center; color: #5d7086; font-size: 12px; padding: 26px 0 40px; }
.progress { font-size: 12.5px; color: var(--muted); }
@media (max-width: 720px) {
  .row { flex-direction: column; align-items: stretch; }
}

/* El panel es el contenedor de scroll: la tabla conserva su semántica y las
   columnas no se aplastan en pantallas estrechas. */
@media (max-width: 1024px) {
  .panel { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .grid { min-width: 640px; }
  .stack { min-width: 0; }
  .grid input, .grid select { width: 100%; min-width: 120px; }
}
@media (max-width: 720px) {
  .grid { min-width: 560px; }
}

/* FF-BASIC-02: orden documental y baja lógica */
.ord {
  display: inline-block; min-width: 34px; margin-right: 8px; padding: 1px 6px;
  border-radius: 6px; background: #122436; border: 1px solid #1d4b74;
  color: #9ecbff; font-size: 11.5px; font-variant-numeric: tabular-nums;
}
.row-deleted { opacity: .55; }
.tag-del { background: #2a1414; color: #ff9b96; border: 1px solid #5c2422; }
button.danger { border-color: #5c2422; color: #ff9b96; }
button.danger:hover { background: #2a1414; }

/* FF-BASIC-03: responsive del encabezado y accesibilidad de animaciones.
   El nav con el usuario/organización desbordaba la página en tablet y móvil. */
@media (max-width: 900px) {
  .top { flex-wrap: wrap; gap: 8px 12px; }
  .nav { flex-wrap: wrap; margin-left: 0; }
  .who { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 720px) {
  .top { padding: 10px 14px; }
  .nav { width: 100%; gap: 10px; }
  .who { max-width: 58vw; }
  .panel { padding: 14px; }
  .stack { min-width: 0; width: 100%; }
  .kpis { gap: 14px; }
  .login { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .st-run::before { animation: none; }
  * { transition: none !important; }
}
