/* Portal del integrador — CSS propio (decisión del dueño, 2026-11-25).
   Identidad: tokens de la landing (landing/assets/css/fiskode.css). Nombres de componentes
   compatibles con el dashboard_design_system 1.10.0 (.card, .kpi-*, .ds-badge--*, .table,
   .ds-pagination, .empty-state, .alert-*): compatible en nombres, NO sincronizado.
   Sin JS, sin inline, sin recursos externos: la CSP del portal es `default-src 'self'`. */

:root {
  --ink: #242a32;
  --ink-2: #566172;
  --ink-3: #8a94a3;
  --rule: #dce3ec;
  --paper: #ffffff;
  --paper-2: #eef2f6;
  --bg: #f4f6f9;
  --brand: #2854c5;
  --brand-ink: #1d3f99;
  --link: #2c5ce5;
  --side: #17203a;
  --side-ink: #c9d3ea;
  --ok: #256744;
  --ok-bg: #e5f4ec;
  --warn: #8a5300;
  --warn-bg: #fff3dc;
  --danger: #a3262a;
  --danger-bg: #fde8e8;
  --info: #1d4ea8;
  --info-bg: #e8effd;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(23, 32, 58, .06), 0 4px 16px rgba(23, 32, 58, .05);
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid rgba(44, 92, 229, .45); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--paper); padding: .5rem 1rem; z-index: 10; }
.skip-link:focus { left: 1rem; top: 1rem; }

/* ── Shell: barra lateral (desktop) / barra superior (mobile) ─────────── */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 1.25rem 1rem; position: sticky; top: 0; height: 100vh; }
.sidebar-brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 700; padding: .25rem .5rem 1.25rem; }
.sidebar-brand img { width: 36px; height: 36px; padding: 4px; background: #fff; border-radius: 9px; }
.sidebar-brand small { display: block; font-weight: 500; color: var(--side-ink); font-size: .75rem; letter-spacing: .02em; }
.side-nav { display: flex; flex-direction: column; gap: .25rem; }
.side-nav a { display: flex; align-items: center; gap: .65rem; min-height: 40px; padding: .5rem .75rem; border-radius: 8px; color: var(--side-ink); font-weight: 500; }
.side-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.side-nav a[aria-current="page"] { background: var(--brand); color: #fff; }
.side-nav svg { width: 18px; height: 18px; flex: none; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 1rem; font-size: .85rem; }
.sidebar-foot .who { color: #fff; font-weight: 600; overflow-wrap: anywhere; }
.sidebar-foot .email { color: var(--side-ink); overflow-wrap: anywhere; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 2rem; background: var(--paper); border-bottom: 1px solid var(--rule); }
.topbar .partner { font-weight: 600; }
.topbar .stamp { font-size: .85rem; color: var(--ink-2); }
.content { padding: 1.75rem 2rem 3rem; width: 100%; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.page-header p { margin: .25rem 0 0; color: var(--ink-2); }
.back-link { display: inline-block; margin-bottom: .5rem; font-size: .9rem; }

/* ── Botones ─────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 40px; padding: .55rem 1.1rem; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); }
.btn-secondary { background: var(--paper); color: var(--ink); border-color: var(--rule); }
.btn-secondary:hover { background: var(--paper-2); }
.btn-ghost { background: transparent; color: var(--side-ink); border-color: rgba(255, 255, 255, .18); width: 100%; margin-top: .75rem; }
.btn-ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.btn-block { width: 100%; }
.btn svg { width: 16px; height: 16px; }

/* ── Cards y KPI ─────────────────────────────────────────────────────── */
.card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 1.25rem 1.5rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.5rem; border-bottom: 1px solid var(--rule); }
.card-header h2 { font-size: 1rem; font-weight: 600; }
.content > .card + .card, .summary-grid + .card { margin-top: 1.25rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { padding: 1.1rem 1.25rem; }
.kpi-label { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.kpi-value { font-size: 1.75rem; font-weight: 700; margin-top: .35rem; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 1rem; font-weight: 500; color: var(--ink-2); }
.kpi-hint { font-size: .85rem; color: var(--ink-2); margin-top: .2rem; }

/* Barra de cupo: <progress> nativo, sin style="width" ni JS. */
.quota { margin-top: 1rem; }
.quota-head { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; color: var(--ink-2); margin-bottom: .4rem; }
progress.quota-bar { -webkit-appearance: none; appearance: none; width: 100%; height: 12px; border: 0; border-radius: 999px; background: var(--paper-2); overflow: hidden; display: block; }
progress.quota-bar::-webkit-progress-bar { background: var(--paper-2); border-radius: 999px; }
progress.quota-bar::-webkit-progress-value { background: var(--brand); border-radius: 999px; }
progress.quota-bar::-moz-progress-bar { background: var(--brand); border-radius: 999px; }
progress.quota-bar.is-warn::-webkit-progress-value { background: #d48806; }
progress.quota-bar.is-warn::-moz-progress-bar { background: #d48806; }
progress.quota-bar.is-danger::-webkit-progress-value { background: var(--danger); }
progress.quota-bar.is-danger::-moz-progress-bar { background: var(--danger); }

.summary-lead { font-size: 1.1rem; margin: 0; }
.summary-lead strong { font-variant-numeric: tabular-nums; }
.summary-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; }
.detail-list { margin: 0; display: grid; gap: .6rem; }
.detail-list div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px dashed var(--rule); padding-bottom: .5rem; }
.detail-list dt { color: var(--ink-2); }
.detail-list dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* ── Alertas y badges ────────────────────────────────────────────────── */
.alert { border-radius: 10px; padding: .75rem 1rem; margin: 1rem 0 0; border: 1px solid transparent; }
.alert-info { background: var(--info-bg); color: var(--info); border-color: #cddcfb; }
.alert-warning { background: var(--warn-bg); color: var(--warn); border-color: #f5dca6; }
.alert-danger { background: var(--danger-bg); color: var(--danger); border-color: #f6c6c6; }
.alert-success { background: var(--ok-bg); color: var(--ok); border-color: #c4e6d3; }
.messages { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.messages .alert { margin: 0 0 .5rem; }
.note { font-size: .85rem; color: var(--ink-2); margin: .75rem 0 0; }

.ds-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.ds-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ds-badge--success { background: var(--ok-bg); color: var(--ok); }
.ds-badge--warning { background: var(--warn-bg); color: var(--warn); }
.ds-badge--danger { background: var(--danger-bg); color: var(--danger); }
.ds-badge--info { background: var(--info-bg); color: var(--info); }
.ds-badge--subtle { background: var(--paper-2); color: var(--ink-2); }

/* ── Tablas ──────────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); background: #f8fafc; padding: .7rem 1rem; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.table td { padding: .8rem 1rem; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.table td.num { white-space: nowrap; }
.table td.cell-strong { min-width: 10rem; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfd; }
.table .text-end { text-align: right; font-variant-numeric: tabular-nums; }
.table .cell-strong { font-weight: 600; }
.table .cell-sub { display: block; font-size: .8rem; color: var(--ink-3); }
.breakdown summary { cursor: pointer; color: var(--link); font-size: .85rem; }
.breakdown ul { margin: .4rem 0 0; padding-left: 1rem; font-size: .85rem; color: var(--ink-2); }

.ds-pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.5rem; border-top: 1px solid var(--rule); font-size: .9rem; color: var(--ink-2); }
.ds-pagination .pages { display: flex; gap: .5rem; }

.empty-state { text-align: center; padding: 3rem 1.5rem; }
.empty-state h2 { font-size: 1.05rem; }
.empty-state p { color: var(--ink-2); margin: .4rem 0 0; }

/* ── Acceso (login, activación, recuperación) ────────────────────────── */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; background: radial-gradient(circle at 20% 10%, #e6edfd 0, transparent 45%), var(--bg); }
.auth-card { width: 100%; max-width: 26rem; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 1.5rem; }
.auth-brand img { height: 40px; width: auto; }
.auth-card .card-body { padding: 2rem; }
.auth-card h1 { font-size: 1.35rem; font-weight: 700; }
.auth-card .lead { color: var(--ink-2); margin: .35rem 0 1.25rem; }
.auth-foot { text-align: center; margin-top: 1.25rem; font-size: .9rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .35rem; }
.field input { width: 100%; min-height: 44px; padding: .6rem .8rem; font: inherit; font-size: 1rem; color: var(--ink); background: var(--paper); border: 1px solid #c9d2de; border-radius: 8px; }
.field input:focus { outline: none; border-color: var(--link); box-shadow: 0 0 0 3px rgba(44, 92, 229, .18); }
.errorlist { list-style: none; padding: .6rem .8rem; margin: 0 0 1rem; color: var(--danger); background: var(--danger-bg); border-radius: 8px; font-size: .9rem; }
.field .errorlist { margin: .35rem 0 0; padding: .35rem .6rem; }

/* ── Documentación ───────────────────────────────────────────────────── */
.docs { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.docs-nav { padding: 1rem; position: sticky; top: 1rem; }
.docs-nav-title { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); margin: .5rem .5rem .35rem; }
.docs-nav ul { list-style: none; margin: 0 0 .75rem; padding: 0; }
.docs-nav a { display: block; padding: .4rem .6rem; border-radius: 6px; color: var(--ink); font-size: .92rem; }
.docs-nav a:hover { background: var(--paper-2); text-decoration: none; }
.docs-nav a[aria-current="page"] { background: var(--info-bg); color: var(--info); font-weight: 600; }
.prose { max-width: none; overflow-wrap: anywhere; }
.prose h1 { font-size: 1.6rem; margin: 0 0 1rem; }
.prose h2 { font-size: 1.25rem; margin: 2rem 0 .75rem; padding-top: .5rem; border-top: 1px solid var(--rule); }
.prose h3 { font-size: 1.05rem; margin: 1.5rem 0 .5rem; }
.prose h4 { font-size: .95rem; margin: 1.25rem 0 .5rem; }
.prose p, .prose ul, .prose ol { margin: .6rem 0; }
.prose li { margin: .2rem 0; }
.prose code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .86em; background: var(--paper-2); padding: .1rem .35rem; border-radius: 4px; }
.prose pre { background: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: 8px; overflow-x: auto; font-size: .85rem; line-height: 1.55; }
.prose pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.prose table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: .9rem; display: block; overflow-x: auto; }
.prose .table-wrap { overflow-x: auto; margin: 1rem 0; }
.prose .table-wrap:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.prose .table-wrap table { display: table; margin: 0; }
.prose th, .prose td { border: 1px solid var(--rule); padding: .5rem .7rem; text-align: left; vertical-align: top; }
.prose th { background: #f8fafc; font-weight: 600; }
.prose blockquote { margin: 1rem 0; padding: .6rem 1rem; border-left: 4px solid var(--link); background: var(--info-bg); color: var(--ink); border-radius: 0 8px 8px 0; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 1.5rem 0; }
.prose blockquote > :first-child { margin-top: 0; }
.prose blockquote > :last-child { margin-bottom: 0; }
/* Índice de la página (`[TOC]` en el markdown). */
.prose .toc { margin: 1rem 0 1.5rem; padding: .75rem 1rem; border: 1px solid var(--rule); border-radius: 8px; background: #f8fafc; }
.prose .toc .toctitle { display: block; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); margin-bottom: .35rem; }
.prose .toc ul { margin: 0; padding-left: 1.1rem; columns: 2 16rem; column-gap: 2rem; }
.prose .toc li { margin: .15rem 0; break-inside: avoid; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .docs { grid-template-columns: 1fr; }
  .docs-nav { position: static; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .75rem 1rem; }
  .sidebar-brand { padding: 0; }
  .sidebar-brand small { display: none; }
  .side-nav { flex-direction: row; order: 3; width: 100%; overflow-x: auto; }
  .side-nav a { flex: none; }
  .sidebar-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .sidebar-foot .who, .sidebar-foot .email { display: none; }
  .sidebar-foot .btn-ghost { width: auto; margin: 0; }
  .topbar { padding: .6rem 1rem; flex-direction: column; align-items: flex-start; gap: .1rem; }
  .content { padding: 1.25rem 1rem 2.5rem; }
  .card-body, .card-header { padding-left: 1rem; padding-right: 1rem; }
  .ds-pagination { padding: .75rem 1rem; flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 1.3rem; }
  .kpi-value { font-size: 1.5rem; }
}
