/* Portex KPI — tokens. Diseño: panel de gerencia sobrio, azul tinta de logística,
   números grandes en Space Grotesk, texto en Inter. Claro y oscuro por sistema. */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --fg: #16202c;
  --muted: #5b6878;
  --line: #dde2e8;
  --accent: #1f5fbf;
  --accent-soft: #dce8fa;
  --muted-bar: #b8c2ce;
  --ok: #1d7f4e;
  --warn: #a86400;
  --bad: #b3261e;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b;
    --panel: #161d27;
    --fg: #e6ebf1;
    --muted: #93a0b0;
    --line: #283342;
    --accent: #6ea3ff;
    --accent-soft: #1d2b44;
    --muted-bar: #45526a;
    --ok: #4cc38a;
    --warn: #f0a742;
    --bad: #ff7a70;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--body); }
h1, h2 { font-family: var(--display); font-weight: 600; margin: 0; text-wrap: balance; }
.muted { color: var(--muted); }
.error { color: var(--bad); }
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Login */
.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-caja { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 28px; display: flex; flex-direction: column; gap: 10px; }
.login-caja form { display: flex; flex-direction: column; gap: 8px; }
.login-caja label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 6px; }
.login-caja input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.login-caja button, .boton { margin-top: 12px; padding: 10px 14px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
.boton-sec { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--fg); cursor: pointer; }

/* Panel */
.barra { position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line); }
.barra-int { max-width: 1200px; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.barra .marca { font-family: var(--display); font-weight: 600; font-size: 18px; }
.nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--fg); }
.nav a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--accent); }
.form-plano { width: 100%; max-width: 560px; border: 0; padding: 0; background: transparent; }
details summary { cursor: pointer; color: var(--accent); margin-top: 10px; }
.subir { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.subir input[type="file"] { max-width: 100%; }
.subir .boton { margin-top: 0; }
.resultado { font-size: 13px; }
.resultado li { margin: 2px 0; }
tr.clic { cursor: pointer; }
tr.clic:hover td { background: var(--accent-soft); }
tr.sel td { background: var(--accent-soft); font-weight: 600; }
td.total, tr.total td { font-weight: 600; }
.barra .acciones { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.barra select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
main.panel { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; display: flex; flex-direction: column; gap: 28px; }
.lede { font-size: 16px; max-width: 75ch; margin: 6px 0 0; color: var(--muted); }
.lede b { color: var(--fg); font-weight: 600; }
section h2 { font-size: 18px; margin-bottom: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.big { font-family: var(--display); font-size: 28px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.2; }
.sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.up { color: var(--ok); font-weight: 600; }
.down { color: var(--bad); font-weight: 600; }
.flat { color: var(--muted); font-weight: 600; }
.dos { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.grafico { position: relative; height: 260px; }
.tabla-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.num, th.num { text-align: right; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); }
.pill.ok { color: var(--ok); border-color: currentColor; }
.barra-estados { display: flex; height: 26px; border-radius: 6px; overflow: hidden; background: var(--line); }
.leyenda { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 12px; font-size: 12px; }
.leyenda strong { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.aviso { background: var(--accent-soft); border-radius: var(--r); padding: 10px 14px; font-size: 13px; }
.pie { font-size: 12px; color: var(--muted); }
