/* Genkki · panel de empresa y Super Admin.
   Carga despues de genkki.css y reutiliza sus tokens de color y tipografia. */

:root {
  --sidebar-w: 232px;
  --rail: #FFFFFF;
}
[data-theme="dark"] { --rail: #0E1726; }

body.app { background: var(--paper); }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
@media (max-width: 900px) { .shell { grid-template-columns: 1fr; } }

.rail {
  background: var(--rail); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 1.5rem;
  padding: 1.25rem 1rem; position: sticky; top: 0; height: 100vh;
}
@media (max-width: 900px) { .rail { position: static; height: auto; } }
.rail-brand img { height: 26px; width: auto; display: block; }
.rail-brand .logo-dark { display: none; }
[data-theme="dark"] .rail-brand .logo-light { display: none; }
[data-theme="dark"] .rail-brand .logo-dark  { display: block; }

.rail-who { font-size: .8125rem; color: var(--muted); line-height: 1.45; }
.rail-who strong { display: block; color: var(--ink); font-size: .9375rem; font-weight: 600; }

.rail nav { display: grid; gap: .125rem; }
.rail nav a {
  display: block; padding: .5rem .625rem; border-radius: 6px;
  color: var(--ink-soft); text-decoration: none; font-size: .9375rem; font-weight: 500;
}
.rail nav a:hover { background: var(--line-soft); color: var(--ink); }
.rail nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.rail-foot { margin-top: auto; display: grid; gap: .625rem; }

.main { padding: 1.75rem clamp(1.25rem, 3vw, 2.5rem) 4rem; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }
.page-head h1 { font-size: 1.75rem; }
.page-head .sub { color: var(--muted); font-size: .9375rem; margin: .25rem 0 0; }

/* ---------- Cifras del dia ---------- */
.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.counter { padding: 1rem 1.125rem; border-right: 1px solid var(--line-soft); }
.counter:last-child { border-right: 0; }
.counter dt { font-size: .8125rem; color: var(--muted); margin: 0 0 .25rem; }
.counter dd { margin: 0; font-family: "Archivo", sans-serif; font-weight: 700; font-size: 1.75rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.counter dd small { font-size: .875rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }

/* ---------- Tablas ---------- */
.panel-box { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; margin-top: 1.75rem; }
.panel-box > h2 { font-size: 1.0625rem; padding: .9375rem 1.125rem; border-bottom: 1px solid var(--line-soft); margin: 0; }
.tbl-scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: .9375rem; }
table.grid th { text-align: left; font-family: "Archivo", sans-serif; font-weight: 600; font-size: .8125rem; color: var(--muted); padding: .6875rem 1.125rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: .75rem 1.125rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid a { color: var(--ink); text-decoration: none; font-weight: 600; }
table.grid a:hover { color: var(--blue); text-decoration: underline; }

/* ---------- Barra horaria: el elemento que da sentido al panel ---------- */
/* El fondo es el dia entero (5:00-22:00); solo una linea guia, sin relleno,
   para que el bloque programado y la presencia real destaquen de verdad. */
.track { position: relative; height: 22px; min-width: 190px; overflow: hidden; }
.track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line-soft); }
.track-plan { position: absolute; top: 3px; bottom: 3px; border-radius: 3px; background: var(--line); }
.track-real { position: absolute; top: 5px; bottom: 5px; border-radius: 2px; background: var(--green); }
.track-real.is-late { background: var(--late-fg); }
.track-open { position: absolute; top: 5px; bottom: 5px; width: 3px; background: var(--blue); }
.track-caption { font-size: .8125rem; color: var(--muted); margin-top: .1875rem; font-variant-numeric: tabular-nums; }

/* ---------- Estados ---------- */
.tag { display: inline-block; padding: .1875rem .5625rem; border-radius: 99px; font-size: .8125rem; font-weight: 600; white-space: nowrap; }
.tag-ok { background: var(--ok-bg); color: var(--ok-fg); }
.tag-warn { background: var(--late-bg); color: var(--late-fg); }
.tag-bad { background: var(--out-bg); color: var(--out-fg); }
.tag-mute { background: var(--line-soft); color: var(--muted); }

/* ---------- Formularios ---------- */
.form { display: grid; gap: 1.125rem; max-width: 34rem; }
.form-wide { max-width: 46rem; grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (max-width: 640px) { .form-wide { grid-template-columns: 1fr; } }
.form .full { grid-column: 1 / -1; }
.field { display: grid; gap: .375rem; align-content: start; }
/* Iguala la altura de las columnas cuando solo una lleva texto de ayuda. */
.form-wide > .field { align-self: start; }
.field label { font-size: .875rem; font-weight: 600; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  font: inherit; font-size: .9375rem;
  padding: .625rem .75rem; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--ink); width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
.field .hint { font-size: .8125rem; color: var(--muted); }
.field .err { font-size: .8125rem; color: var(--out-fg); font-weight: 500; }
.fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 1.25rem; margin: 0; }
.fieldset legend { font-family: "Archivo", sans-serif; font-weight: 600; font-size: .9375rem; padding-inline: .5rem; }

/* ---------- Avisos ---------- */
.flash { padding: .875rem 1.125rem; border-radius: 8px; margin-bottom: 1.5rem; font-size: .9375rem; border: 1px solid transparent; }
.flash-ok { background: var(--ok-bg); color: var(--ok-fg); border-color: color-mix(in srgb, var(--ok-fg) 25%, transparent); }
.flash-bad { background: var(--out-bg); color: var(--out-fg); border-color: color-mix(in srgb, var(--out-fg) 25%, transparent); }

/* El token se muestra una sola vez: tiene que costar ignorarlo. */
.token-box { border: 2px solid var(--blue); border-radius: 8px; padding: 1.125rem 1.25rem; margin-bottom: 1.5rem; background: var(--surface); }
.token-box h3 { font-size: 1rem; margin: 0 0 .5rem; }
.token-box p { font-size: .875rem; color: var(--ink-soft); margin: 0 0 .75rem; }
.token-value {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .9375rem; word-break: break-all; user-select: all;
  background: var(--line-soft); padding: .75rem .875rem; border-radius: 6px; display: block;
}

/* ---------- Vacío ---------- */
.empty { padding: 3rem 1.5rem; text-align: center; color: var(--muted); }
.empty p { margin: 0 auto .875rem; max-width: 34ch; }

/* ---------- Acceso ---------- */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 25rem; }
.auth-card .auth-brand { display: block; margin: 0 auto 2rem; height: 34px; width: auto; }
.auth-card .auth-brand.logo-dark { display: none; }
[data-theme="dark"] .auth-card .auth-brand.logo-light { display: none; }
[data-theme="dark"] .auth-card .auth-brand.logo-dark  { display: block; }
.auth-box { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 1.75rem; box-shadow: var(--shadow); }
.auth-box h1 { font-size: 1.375rem; margin-bottom: .375rem; }
.auth-box .sub { font-size: .9375rem; color: var(--muted); margin-bottom: 1.5rem; }
.auth-box .btn { width: 100%; margin-top: .5rem; }
.auth-foot { text-align: center; margin-top: 1.25rem; font-size: .875rem; color: var(--muted); }

.row-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn-sm { padding: .4375rem .75rem; font-size: .875rem; }
.btn-danger { border-color: var(--out-fg); color: var(--out-fg); background: transparent; }
.btn-danger:hover { background: var(--out-bg); }
