/* Camoy Squad — portal (rediseño v2 "herramienta de datos", aprobado el 05/10/2026 a partir de
   bocetos/oficina_virtual/reportes_v2.html, variante "riel").
   Densidad alta: bordes de 1 px, radios de 4–6 px, sin sombras de tarjeta ni degradados. Un solo acento: el verde
   agua del logo (teal-500 para rellenos y foco, petrol-600 para texto y enlaces).
   CSP estricta (default-src 'none'; style-src/font-src/script-src 'self'): sin estilos en línea ni recursos externos.
   Fuentes alojadas en static/fonts con licencia OFL (textos en portal_web/licencias_fuentes). */

@font-face { font-family: "Inter"; src: url("../fonts/InterVariable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/JetBrainsMono-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/JetBrainsMono-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  /* Marca: el verde agua del logo es el color principal */
  --teal-950: #062a2d;   /* texto sobre teal-500 */
  --teal-900: #0b3d41;   /* riel y paneles de marca */
  --teal-800: #0f4c51;
  --teal-700: #145e63;
  --teal-500: #0eafb3;   /* único acento: rellenos y foco. No para texto chico sobre blanco */
  --teal-100: #d7f3f3;
  --teal-50:  #e8f7f7;
  --petrol-600: #236f7b; /* texto y enlaces sobre fondo claro (AA) */

  /* Grises neutros */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8f9fa;  /* encabezados de tabla, filas de grupo */
  --hover: #f1f3f5;
  --ink: #17202a;
  --ink-2: #3c4753;
  --muted: #5f6b77;      /* 5.4:1 sobre blanco */
  --line: #e2e5e9;
  --line-2: #d3d8dd;     /* bordes de controles */

  /* Estados (texto oscuro sobre fondo claro: AA) */
  --ok: #17703f;   --ok-bg: #e4f3ea;
  --warn: #8a5300; --warn-bg: #fbf0d9;
  --err: #b42318;  --err-bg: #fce8e6;
  --idle: #5f6b77; --idle-bg: #eef0f2;

  /* Agentes (solo marcas chicas: nunca texto) */
  --conde: #3b5ccc;
  --belle: #0eafb3;
  --caito: #d9822b;

  --bar-bg: var(--teal-900);
  --escena: #e3edf0;     /* fondo liso del marco de la oficina */

  --r: 4px;
  --r-lg: 6px;
  --h-ctl: 30px;         /* alto de botones e inputs */
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  /* Series de los gráficos de reportes (paleta categórica validada, orden fijo; core/graficos.py) */
  --serie-1: #2a78d6; --serie-2: #eb6834; --serie-3: #1baf7a; --serie-4: #eda100;
  --serie-5: #e87ba4; --serie-6: #008300; --serie-7: #4a3aa7; --serie-8: #e34948;
  color-scheme: light;
}

/* Tema oscuro: el del sistema (si el usuario no eligió) o el elegido con el selector (data-theme en <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116; --surface: #151a20; --surface-2: #1a2027; --hover: #1d242c;
    --ink: #e5e9ed; --ink-2: #c3cbd3; --muted: #95a0ab; --line: #262d35; --line-2: #333c46;
    --petrol-600: #5fc9cc; --teal-50: #0f2e31; --teal-100: #12393d;
    --ok: #5fd08a; --ok-bg: #12301f; --warn: #f0b85a; --warn-bg: #33270f; --err: #ff8f80; --err-bg: #3a1a16;
    --idle: #a3adb7; --idle-bg: #232a32;
    --bar-bg: #0a2629; --escena: #0f1c22;
    --serie-1: #3987e5; --serie-2: #d95926; --serie-3: #199e70; --serie-4: #c98500;
    --serie-5: #d55181; --serie-6: #008300; --serie-7: #9085e9; --serie-8: #e66767;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1116; --surface: #151a20; --surface-2: #1a2027; --hover: #1d242c;
  --ink: #e5e9ed; --ink-2: #c3cbd3; --muted: #95a0ab; --line: #262d35; --line-2: #333c46;
  --petrol-600: #5fc9cc; --teal-50: #0f2e31; --teal-100: #12393d;
  --ok: #5fd08a; --ok-bg: #12301f; --warn: #f0b85a; --warn-bg: #33270f; --err: #ff8f80; --err-bg: #3a1a16;
  --idle: #a3adb7; --idle-bg: #232a32;
  --bar-bg: #0a2629; --escena: #0f1c22;
  --serie-1: #3987e5; --serie-2: #d95926; --serie-3: #199e70; --serie-4: #c98500;
  --serie-5: #d55181; --serie-6: #008300; --serie-7: #9085e9; --serie-8: #e66767;
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 13px/1.45 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a { color: var(--petrol-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 600; }
h1 { font-size: 15px; }
h2 { font-size: 13.5px; }
h3 { font-size: 13px; }
p { margin: 0; }
svg { flex: none; }
:focus-visible { outline: 2px solid var(--teal-500); outline-offset: 1px; border-radius: var(--r); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -40px; background: var(--teal-500); color: var(--teal-950); padding: 6px 10px; border-radius: var(--r); z-index: 50; font-weight: 600; }
.skip:focus { top: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12px; }
.num { text-align: right; white-space: nowrap; }
.nw { white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.logo-d { display: none; }
:root[data-theme="dark"] .logo-l { display: none; }
:root[data-theme="dark"] .logo-d { display: inline; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .logo-l { display: none; } :root:not([data-theme]) .logo-d { display: inline; } }

/* ---------- Estructura: riel + contenido ---------- */
.app { display: grid; grid-template-columns: 80px minmax(0, 1fr); min-height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; }

/* Riel: columna angosta de marca con íconos y rótulo chico */
.appnav { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--bar-bg); z-index: 30; }
.an-brand { display: flex; align-items: center; justify-content: center; height: 44px; border-bottom: 1px solid rgba(255, 255, 255, .1); flex: none; }
.an-brand img { width: 26px; height: 26px; }
.an-tenant { display: flex; justify-content: center; margin: 10px auto 2px; }
.an-tenant .ini { width: 30px; height: 30px; border-radius: var(--r); background: var(--teal-500); color: var(--teal-950); display: grid; place-items: center; font-weight: 700; font-size: 11px; }
.an-tenant .an-tenant-txt { display: none; }
.an-links { display: flex; flex-direction: column; gap: 2px; padding: 4px 6px; overflow-y: auto; }
.an-links .grp { height: 1px; margin: 6px 10px; background: rgba(255, 255, 255, .14); }
.an-links .grp:first-child { display: none; }
.an-links a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 54px; padding: 0 2px; border-radius: var(--r); position: relative; color: #bfdede; font-size: 10.5px; font-weight: 500; text-align: center; line-height: 1.15; }
.an-links a:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.an-links a[aria-current="page"] { background: rgba(14, 175, 179, .22); color: #fff; }
.an-links a[aria-current="page"]::before { content: ""; position: absolute; left: -6px; top: 8px; bottom: 8px; width: 3px; background: var(--teal-500); border-radius: 0 2px 2px 0; }
.an-links svg { width: 20px; height: 20px; }
.an-foot { margin-top: auto; padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, .1); display: grid; justify-items: center; }
.an-foot .dot { display: block; width: 6px; height: 6px; border-radius: 50%; background: #3ddc84; }

/* Barra superior: breadcrumb, pestañas del módulo, tema y usuario */
.topbar { height: 44px; display: flex; align-items: center; gap: 16px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; }
.crumbs a { color: var(--muted); }
.crumbs .sep { color: var(--line-2); }
.crumbs h1 { overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.subnav { display: flex; gap: 2px; height: 100%; }
.subnav a { display: flex; align-items: center; padding: 0 10px; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.subnav a:hover { color: var(--ink); text-decoration: none; background: var(--hover); }
.subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--teal-500); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.avatar { width: 26px; height: 26px; border-radius: var(--r); background: var(--teal-50); color: var(--petrol-600); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 600; font-size: 11px; }
.mobile-brand { display: none; }
.content { padding: 14px 16px 32px; display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 1480px; }
.logout { margin: 0; display: inline; }

/* Selector de tema */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; }
.seg button { width: 28px; height: 24px; display: grid; place-items: center; border: 0; background: var(--surface); color: var(--muted); cursor: pointer; padding: 0; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button:hover { color: var(--ink); background: var(--hover); }
.seg button[aria-pressed="true"] { background: var(--teal-50); color: var(--petrol-600); }
.seg svg { width: 14px; height: 14px; }

/* ---------- Controles ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--h-ctl); padding: 0 11px; border-radius: var(--r); border: 1px solid var(--teal-500); background: var(--teal-500); color: var(--teal-950); font: 600 13px var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #0b9da1; border-color: #0b9da1; text-decoration: none; }
.btn.sec { background: var(--surface); border-color: var(--line-2); color: var(--ink); font-weight: 500; }
.btn.sec:hover { background: var(--hover); }
.btn.teal { background: var(--teal-500); color: var(--teal-950); }
.btn.sm { min-height: 26px; padding: 0 9px; font-size: 12px; }
.btn svg { width: 15px; height: 15px; }
button.link { background: none; border: 0; color: var(--petrol-600); font: inherit; font-weight: 500; cursor: pointer; padding: 0; min-height: 0; }
button.link:hover { text-decoration: underline; }
button.link.peligro { color: var(--err); }
.err-texto { color: var(--err); }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); padding: 5px 8px; min-height: var(--h-ctl); width: 100%; }
textarea { min-height: 60px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--teal-500); box-shadow: 0 0 0 1px var(--teal-500); }
input[disabled] { background: var(--surface-2); color: var(--muted); }
input[type="checkbox"], input[type="radio"] { width: 14px; height: 14px; min-height: 0; padding: 0; accent-color: var(--teal-500); }
.chk { width: auto; flex: none; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; }
details summary { cursor: pointer; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.filters .field { flex: 1 1 130px; min-width: 0; }
.filters .field:first-child { flex: 2 1 240px; }
.filtros-acciones { flex: none; }

/* ---------- Paneles ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; min-height: 40px; padding: 7px 12px; border-bottom: 1px solid var(--line); }
.card-h .small, .card-h .muted { font-size: 12px; }
.card-h .row { flex-wrap: wrap; }
.card-h > div > h2 + p { margin-top: 1px; }
.card-b { padding: 12px; }
.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-office { grid-template-columns: minmax(0, 1fr) 340px; }
.form-card { max-width: 640px; }
.form-card .card-b { display: flex; flex-direction: column; gap: 12px; }
.note { border: 1px dashed var(--line-2); background: var(--surface-2); border-radius: var(--r); padding: 8px 10px; font-size: 12px; color: var(--muted); }
.note b { color: var(--ink); }
fieldset.note { padding: 8px 10px; }
.msg-err, .msg-ok { border-radius: var(--r); padding: 7px 10px; font-size: 12.5px; border: 1px solid; }
.msg-err { color: var(--err); background: var(--err-bg); border-color: var(--err); }
.msg-ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok); }
.empty { padding: 24px 12px; text-align: center; color: var(--muted); }

/* Cifras clave: una franja con divisiones de 1 px */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi { padding: 10px 14px; border-right: 1px solid var(--line); min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi .l { font-size: 12px; color: var(--muted); }
.kpi .v { font: 600 22px/1.25 var(--mono); letter-spacing: -.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .t { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* Pestañas dentro de un panel */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 8px; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 10px; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--teal-500); }

/* ---------- Tablas de datos ---------- */
.table-wrap { overflow: auto; position: relative; }  /* contiene los .sr-only de las celdas: no desbordan la página */
.table-wrap.alto { max-height: 70vh; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.t th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-2); height: 30px; padding: 0 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t th.num { font-family: var(--font); }
table.t td { height: 34px; padding: 5px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: var(--hover); }
table.t tr.off td { color: var(--muted); }
table.t tfoot td { background: var(--surface); border-top: 1px solid var(--line-2); border-bottom: 0; font-weight: 600; }
table.t .principal { font-weight: 500; color: var(--ink); }
table.t a.principal:hover { color: var(--petrol-600); }
table.t .sub { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { white-space: nowrap; }
.acciones { white-space: nowrap; text-align: right; }
.acciones > * + * { margin-left: 10px; }
.acciones form { display: inline; }
.chan { display: inline-flex; gap: 4px; }
.chan span { font-size: 11px; padding: 0 5px; height: 18px; line-height: 16px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink-2); background: var(--surface-2); }

/* Listas compactas (últimas consultas, registros de cambios) */
.items { list-style: none; margin: 0; padding: 0; }
.items li { padding: 8px 12px; border-bottom: 1px solid var(--line); }
.items li:last-child { border-bottom: 0; }
.items .q { font-weight: 500; margin: 3px 0 2px; white-space: pre-wrap; word-break: break-word; }
.items .q a { color: var(--ink); }
.items .q a:hover { color: var(--petrol-600); }
.items .r { white-space: pre-wrap; word-break: break-word; color: var(--ink-2); font-size: 12.5px; }
.items .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

/* Estados como etiquetas chicas */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 10px; font-size: 11.5px; font-weight: 500; white-space: nowrap; vertical-align: middle; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill .d { display: none; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.err { background: var(--err-bg); color: var(--err); }
.pill.idle { background: var(--idle-bg); color: var(--idle); }
.pill.live::before { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* Sello de la fuente del dato */
.seal { display: inline-flex; align-items: center; gap: 5px; height: 20px; font-size: 11.5px; font-weight: 600; padding: 0 7px; border-radius: 3px; white-space: nowrap; }
.seal.cert { background: var(--teal-50); color: var(--petrol-600); }
.seal.directa { background: var(--warn-bg); color: var(--warn); }

.ag { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.ag i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.ag.conde i { background: var(--conde); } .ag.belle i { background: var(--belle); } .ag.caito i { background: var(--caito); }

/* ---------- Oficina (el canvas y los personajes no cambian: solo el marco y el panel "Ahora") ---------- */
.office-wrap { position: relative; background: var(--escena); overflow: hidden; }
.office-wrap canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; }
.office-overlay { position: absolute; inset: 0; pointer-events: none; }
.tag { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; gap: 3px; transition: opacity .2s; }
.tag .name { background: rgba(6, 42, 45, .88); color: #fff; font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 4px; white-space: nowrap; }
.tag .bubble { background: #fff; color: var(--teal-950); border: 2px solid var(--teal-950); font-size: .7rem; font-weight: 650; padding: 2px 8px; border-radius: 8px; white-space: nowrap; position: relative; box-shadow: 0 2px 0 rgba(6, 42, 45, .25); }
.tag .bubble::after { content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -5px; border: 5px solid transparent; border-top-color: var(--teal-950); }
.tag .bubble.err { border-color: #b42318; color: #b42318; }
.tag .bubble.err::after { border-top-color: #b42318; }
.tag .bubble.rest { border-color: #5f6b77; color: #5f6b77; background: #f4f6f8; }
.tag .bubble.rest::after { border-top-color: #5f6b77; }
.office-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.toggle { width: 34px; height: 20px; border-radius: 10px; background: var(--teal-500); position: relative; flex: none; border: 0; cursor: pointer; padding: 0; min-height: 0; }
.toggle::after { content: ""; position: absolute; right: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; }
.toggle[aria-checked="false"] { background: var(--line-2); }
.toggle[aria-checked="false"]::after { right: auto; left: 3px; }

.agents { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.agent { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-right: 1px solid var(--line); min-width: 0; }
.agent:last-child { border-right: 0; }
.agent b { display: block; font-size: 13px; }
.agent span { font-size: 12px; color: var(--muted); display: block; }
.agent .state { margin-top: 3px; }
.agent span.pill { display: inline-flex; }
img.retrato { width: 40px; height: 40px; border-radius: var(--r); object-fit: cover; flex: none; background: #eef0f5; border: 1px solid var(--line); image-rendering: pixelated; }
img.retrato.big { width: 64px; height: 64px; }

.feed { list-style: none; margin: 0; padding: 0; max-height: 470px; overflow-y: auto; }
.feed li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.feed li:last-child { border-bottom: 0; }
.feed time { color: var(--muted); font: 11.5px var(--mono); padding-top: 1px; }
.feed .ev-detail { color: var(--muted); font-size: 12px; }
.feed li.nuevo { animation: flash 1.2s ease-out; }
.feed li.vacio { display: block; color: var(--muted); }
.feed a { font-weight: 600; }
@keyframes flash { from { background: var(--teal-50); } to { background: transparent; } }

/* ---------- Detalle de una consulta ---------- */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { position: relative; padding: 0 0 12px 22px; font-size: 12.5px; }
.steps li::before { content: ""; position: absolute; left: 4px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--teal-500); }
.steps li::after { content: ""; position: absolute; left: 9px; top: 16px; bottom: 0; width: 1px; background: var(--line-2); }
.steps li:last-child::after { display: none; }
.steps .t { color: var(--muted); font: 11.5px var(--mono); }
.answer { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; font-size: 13px; }
.how { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; font-size: 12.5px; margin: 0; padding: 8px 0; border-top: 1px solid var(--line); }
.how:first-child { border-top: 0; padding-top: 0; }
.how dt { color: var(--muted); }
.how dd { margin: 0; }

/* ---------- Equipo y accesos ---------- */
.agentes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.agente { display: flex; gap: 12px; padding: 12px; border-right: 1px solid var(--line); min-width: 0; }
.agente:last-child { border-right: 0; }
.agente h2 { font-size: 14px; }
.agente dl { margin: 6px 0 0; display: grid; gap: 4px; font-size: 12.5px; }
.agente dt { font-weight: 600; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.agente dd { margin: 0; }
.codigo-card { border-color: var(--teal-500); }
.codigo { font: 600 1.6rem/1.2 var(--mono); letter-spacing: 2px; color: var(--petrol-600); margin: 2px 0; }
.enlace { font: 12px/1.4 var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 7px 9px; overflow-wrap: anywhere; user-select: all; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline-form select { width: auto; min-height: 26px; padding: 2px 6px; font-size: 12px; }

/* ---------- Ingreso ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--teal-900); color: #cfe8e8; padding: 40px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art .brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.login-art .brand img { width: 30px; height: 30px; }
.login-art .brand b { font-size: 15px; }
.login-art .brand small { display: block; font-size: 12px; color: #9cc9ca; }
.login-art h1 { color: #fff; font-size: 26px; line-height: 1.25; max-width: 440px; font-weight: 650; letter-spacing: -.3px; }
.login-art p { max-width: 440px; margin-top: 10px; font-size: 14px; }
.login-art .marca-grande { width: min(108%, 580px, 64vh); height: auto; align-self: center; margin: 0 0 -24px; }
.login-col { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 16px; }
.login-col .card { max-width: none; }
.by { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 0; }
.by b { color: var(--ink-2); font-weight: 600; }
.by-pie { display: flex; align-items: center; gap: 7px; margin-top: 4px; }
.login-form { display: grid; place-items: center; padding: 32px 16px; }
.login-form .card { width: 100%; max-width: 360px; padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.login-form .card h2 { font-size: 16px; margin-bottom: 2px; }

/* ---------- Entrega de un reporte, imprimible en A4 ---------- */
.solo-imprimir { display: none; }
.respuesta { white-space: pre-line; overflow-wrap: anywhere; }
.h-bloque { font-size: 13.5px; margin: 6px 0 0; }
.bloque-reporte { margin-top: 6px; }
.bloque-reporte .table-wrap { border: 1px solid var(--line); border-radius: var(--r); margin-top: 6px; }
/* T15: entrega con tarjetas, gráfico SVG y tabla plegable */
.tarjetas-rep { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tarjeta-rep { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; flex: 0 1 190px; min-width: 140px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.tarjeta-rep strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.tarjeta-rep .var-sube { color: var(--ok); font-weight: 600; } .tarjeta-rep .var-baja { color: var(--err); font-weight: 600; }   /* T15 F2: el signo +/- va en el texto, el color solo refuerza */
.graf-rep { margin: 10px 0 0; max-width: 760px; }
.graf-rep svg { display: block; height: auto; }
.graf-rep svg.angosto { display: none; }      /* celular: la versión de 360 (core/graficos.ANCHO_ANGOSTO), con el texto legible */
@media (max-width: 600px) { .graf-rep svg.graf { display: none; } .graf-rep svg.angosto { display: block; } }
.graf .t1 { fill: var(--ink); } .graf .t2 { fill: var(--muted); } .graf .eje { stroke: var(--line); }
.graf circle.m { stroke: var(--surface); }
.graf .s1 { fill: var(--serie-1); } .graf .s2 { fill: var(--serie-2); } .graf .s3 { fill: var(--serie-3); } .graf .s4 { fill: var(--serie-4); }
.graf .s5 { fill: var(--serie-5); } .graf .s6 { fill: var(--serie-6); } .graf .s7 { fill: var(--serie-7); } .graf .s8 { fill: var(--serie-8); }
.graf .l.s1 { fill: none; stroke: var(--serie-1); } .graf .l.s2 { fill: none; stroke: var(--serie-2); } .graf .l.s3 { fill: none; stroke: var(--serie-3); }
.graf .l.s4 { fill: none; stroke: var(--serie-4); } .graf .l.s5 { fill: none; stroke: var(--serie-5); } .graf .l.s6 { fill: none; stroke: var(--serie-6); }
.graf .l.s7 { fill: none; stroke: var(--serie-7); } .graf .l.s8 { fill: none; stroke: var(--serie-8); }
.tabla-rep { margin-top: 8px; } .tabla-rep summary { cursor: pointer; color: var(--petrol-600); }

/* ---------- Barra inferior (celular) ---------- */
.tabbar { display: none; }

@media (max-width: 1100px) {
  .g-office { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis .kpi:nth-child(2n) { border-right: 0; }
  .kpis .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis.k3 .kpi { border-bottom: 0; border-right: 1px solid var(--line); }
  .kpis.k3 .kpi:last-child { border-right: 0; }
  .topbar .sub { display: none; }
}

@media (max-width: 760px) {
  body { font-size: 14px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .appnav, .hide-m { display: none !important; }
  .topbar { height: auto; min-height: 44px; flex-wrap: wrap; row-gap: 0; }
  .crumbs { height: 44px; }
  .subnav { order: 5; width: calc(100% + 24px); margin: 0 -12px; height: 38px; padding: 0 4px; overflow-x: auto; border-top: 1px solid var(--line); }
  .mobile-brand { display: flex; }
  .mobile-brand img { width: 24px; height: 24px; }
  .topbar { padding: 0 12px; column-gap: 10px; }
  .content { padding: 12px 12px 84px; gap: 12px; }
  .g-2, .g-3, .form-grid { grid-template-columns: 1fr; }
  .kpis.k3 { grid-template-columns: 1fr; }
  .kpis.k3 .kpi { border-right: 0; border-bottom: 1px solid var(--line); }
  .kpis.k3 .kpi:last-child { border-bottom: 0; }
  .agents, .agentes { grid-template-columns: 1fr; }
  .agent, .agente { border-right: 0; border-bottom: 1px solid var(--line); }
  .agent:last-child, .agente:last-child { border-bottom: 0; }
  .filters .field { flex: 1 1 40%; }
  .filters .field:first-child { flex-basis: 100%; }
  table.t td { height: 40px; }  /* objetivo táctil */
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 24px 20px; gap: 16px; }
  .login-art h1 { font-size: 20px; }
  .login-art .marca-grande { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 2px calc(4px + env(safe-area-inset-bottom)); }
  .tabbar.n2 { grid-template-columns: repeat(2, 1fr); } .tabbar.n3 { grid-template-columns: repeat(3, 1fr); } .tabbar.n4 { grid-template-columns: repeat(4, 1fr); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; font-size: 11px; font-weight: 500; color: var(--muted); }
  .tabbar a[aria-current="page"] { color: var(--petrol-600); }
  .tabbar svg { width: 20px; height: 20px; }
  .tag .bubble { font-size: .62rem; padding: 1px 6px; }
  .tag .name { font-size: .62rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  @page { size: A4; margin: 16mm; }
  .appnav, .topbar, .tabbar, .no-print, .mobile-brand, .skip { display: none !important; }
  .solo-imprimir { display: block; }
  html, body, .app, .main, .content, .card, .card-b, .table-wrap { background: #fff !important; color: #000 !important; border: 0 !important; box-shadow: none !important; }
  .app { display: block !important; }
  .content { padding: 0 !important; }
  table.t th, table.t td { color: #000 !important; border-bottom: 1px solid #999 !important; background: #fff !important; position: static; }
  .muted { color: #444 !important; }
}
