/* MarketDepot Admin — mobile first. Tokens alineados con erp/docs/UI_DESIGN_SYSTEM.md. */
:root {
    --color-text: #0f1f3a;
    --color-text-secondary: #3d4d66;
    --color-muted: #5b6b82;
    --color-action: #0759d3;
    --color-action-hover: #0649ae;
    --color-background: #f3f5f9;
    --color-surface: #ffffff;
    --color-surface-alt: #f8fafc;
    --color-border: #e1e7ef;
    --color-border-strong: #cdd6e3;
    --color-control-border: #8492a6;
    --color-selection: #ebf3ff;
    --color-success: #13714a;
    --color-success-bg: #e8f6ee;
    --color-error: #b42318;
    --color-error-bg: #fdeceb;
    --color-warning: #8a5a00;
    --color-warning-bg: #fff4d6;
    --color-info: #0759d3;
    --color-info-bg: #ebf3ff;
    --color-chart: #3b7ddd;
    --color-chart-track: #e8edf4;
    --color-sidebar: #0c1a32;
    --color-sidebar-text: #b7c3d6;
    --color-sidebar-muted: #7486a3;
    --color-sidebar-active: #1b2d4e;
    --font-sans: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --radius-small: 0.375rem;
    --radius-control: 0.5rem;
    --radius-surface: 0.75rem;
    --shadow-surface: 0 1px 2px rgb(15 31 58 / 0.05);
    --touch-target: 2.75rem;
    --sidebar-width: 16rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-sans); font-size: 1rem; color: var(--color-text); background: var(--color-background); line-height: 1.5; }
h1 { font-size: 1.625rem; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 var(--space-1); }
h2 { font-size: 1.125rem; line-height: 1.35; font-weight: 600; margin: 0 0 var(--space-3); }
h3 { font-size: 1rem; font-weight: 600; margin: var(--space-4) 0 var(--space-2); }
p { margin: 0 0 var(--space-3); }
a { color: var(--color-action); }
code { font-family: var(--font-mono); font-size: 0.875em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--color-muted); }
.num { font-variant-numeric: tabular-nums; }

/* ── Estructura: barra lateral oscura + área de trabajo ─────────────────────────── */
.app { min-height: 100vh; }
.sidebar { background: var(--color-sidebar); color: var(--color-sidebar-text); }
.sidebar__top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-4) var(--space-2); }
.brand { display: inline-flex; align-items: center; gap: 0.75rem; text-decoration: none; color: #fff; }
.brand__logo { display: block; border-radius: 8px; flex-shrink: 0; }
.brand__info { display: flex; flex-direction: column; line-height: 1.2; }
.brand__name { font-size: 1.125rem; font-weight: 700; color: #ffffff; letter-spacing: -0.01em; }
.brand__tag { font-size: 0.72rem; font-weight: 400; color: #72849e; }
.nav > summary { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--touch-target); padding: 0 var(--space-3); margin: 0 var(--space-4) var(--space-3); border: 1px solid var(--color-sidebar-active); border-radius: var(--radius-control); cursor: pointer; font-weight: 600; font-size: 0.875rem; color: #fff; list-style: none; }
.nav > summary::-webkit-details-marker { display: none; }
.nav > summary::before { content: ""; width: 1rem; height: 0.75rem; background: linear-gradient(currentColor 0 0) top / 100% 2px no-repeat, linear-gradient(currentColor 0 0) center / 100% 2px no-repeat, linear-gradient(currentColor 0 0) bottom / 100% 2px no-repeat; }
.nav__group { padding: 0 var(--space-3) var(--space-1); }
.nav__title { margin: var(--space-3) var(--space-3) var(--space-1); font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #586d8a; }
.nav a, .nav__link { display: flex; align-items: center; gap: 0.75rem; min-height: 2.35rem; padding: 0.45rem var(--space-3); border-radius: var(--radius-control); color: var(--color-sidebar-text); text-decoration: none; font-size: 0.875rem; font-weight: 500; transition: background 0.15s, color 0.15s; }
.nav a:hover, .nav__link:hover { background: #13243d; color: #fff; }
.nav a[aria-current="page"], .nav__link.is-active, .nav__link[aria-current="page"] { background: var(--color-sidebar-active); color: #fff; font-weight: 600; box-shadow: 0 2px 4px rgba(29, 78, 216, 0.3); }
.nav a:focus-visible, .nav__link:focus-visible { outline: 2px solid #8bb8ff; outline-offset: -2px; }
.nav__icon { flex-shrink: 0; color: inherit; }
.sidebar__user { display: none; }

.sidebar__footer { margin-top: auto; padding: var(--space-3) var(--space-3) var(--space-4); }
.env-card { background: #071322; border: 1px solid #1a2a44; border-radius: var(--radius-surface); padding: 0.65rem 0.75rem; display: flex; align-items: center; gap: 0.65rem; }
.env-card__icon { width: 32px; height: 32px; border-radius: 0.5rem; background: rgba(16, 185, 129, 0.15); color: #10b981; display: grid; place-items: center; flex-shrink: 0; }
.env-card__info { flex: 1; min-width: 0; }
.env-card__title { display: flex; align-items: center; justify-content: space-between; font-size: 0.78rem; font-weight: 600; color: #e2e8f0; }
.env-card__status { display: flex; align-items: center; gap: 0.35rem; font-size: 0.68rem; color: #8496ae; margin-top: 0.15rem; }
.env-card__dot { width: 6px; height: 6px; border-radius: 50%; background: #10b981; flex-shrink: 0; }

.workspace { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 3.75rem; padding: 0.5rem var(--space-5); background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.topbar__search { position: relative; display: flex; align-items: center; width: 100%; max-width: 30rem; }
.topbar__search-icon { position: absolute; left: 0.75rem; color: #94a3b8; pointer-events: none; }
.topbar__search-input { width: 100%; min-height: 2.25rem !important; padding: 0.35rem 0.75rem 0.35rem 2.25rem !important; background: #f8fafc !important; border: 1px solid #e2e8f0 !important; border-radius: 0.5rem !important; font-size: 0.8125rem !important; color: #1e293b !important; }
.topbar__search-input:focus-visible { outline: 2px solid var(--color-action); background: #ffffff !important; }
.topbar__actions { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.topbar__icon-btn { position: relative; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: transparent; border: none; color: #64748b; display: grid; place-items: center; cursor: pointer; transition: background 0.15s; }
.topbar__icon-btn:hover { background: #f1f5f9; color: #0f172a; }
.topbar__badge { position: absolute; top: 2px; right: 2px; min-width: 1rem; height: 1rem; border-radius: 999px; background: #ef4444; color: #fff; font-size: 0.6875rem; font-weight: 700; display: grid; place-items: center; padding: 0 0.25rem; border: 2px solid #fff; }
.topbar__user-profile { display: flex; align-items: center; gap: 0.75rem; padding-left: 0.5rem; border-left: 1px solid #f1f5f9; }
.topbar__user { display: flex; align-items: center; gap: 0.65rem; text-decoration: none; color: inherit; }
.avatar--navy { background: #0f2744; color: #ffffff; width: 2.25rem; height: 2.25rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 0.8125rem; }
.topbar__user-details { display: flex; flex-direction: column; line-height: 1.25; }
.topbar__name { font-size: 0.8125rem; font-weight: 600; color: #0f172a; }
.topbar__role { font-size: 0.72rem; color: #64748b; }
.topbar__logout-form { margin: 0; }
.topbar__logout-btn { min-height: 1.85rem !important; padding: 0 0.65rem !important; font-size: 0.75rem !important; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); margin: 0; padding: 0; list-style: none; font-size: 0.875rem; color: var(--color-muted); min-width: 0; }
.crumbs li + li::before { content: "/"; margin-right: var(--space-1); color: var(--color-border-strong); }
.crumbs a { color: var(--color-muted); text-decoration: none; }
.crumbs a:hover { color: var(--color-action); text-decoration: underline; }
.crumbs [aria-current="page"] { color: var(--color-text); font-weight: 600; }
.envbar { margin: 0; padding: var(--space-2) var(--space-4); background: var(--color-warning-bg); color: var(--color-warning); font-size: 0.8125rem; border-bottom: 1px solid #f1dfa6; }
.content { padding: var(--space-4); max-width: 90rem; margin: 0 auto; }

@media (max-width: 47.99rem) {
    .topbar__search { display: none; }
    .topbar__user-details { display: none; }
}
/* Móvil y tableta: el botón Menú comparte fila con la marca; el menú se despliega debajo. */
@media (max-width: 63.99rem) {
    .sidebar { position: relative; }
    .nav > summary { position: absolute; top: var(--space-2); right: var(--space-4); margin: 0; }
    .nav[open] { padding-bottom: var(--space-2); border-top: 1px solid var(--color-sidebar-active); }
}
@media (min-width: 48rem) {
    .content { padding: var(--space-6) var(--space-5); }
    .topbar { padding-inline: var(--space-5); }
}
@media (min-width: 64rem) {
    .app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
    .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
    .sidebar__top { padding: var(--space-5) var(--space-4) var(--space-3); }
    .nav { flex: 1; }
    .content { padding: var(--space-6) var(--space-6); }
    .topbar { padding-inline: var(--space-6); }
}

/* Escritorio: el menú siempre visible. Sin soporte de ::details-content queda el botón «Menú» como respaldo. */
@media (min-width: 64rem) {
    @supports selector(::details-content) {
        .nav > summary { display: none; }
        .nav::details-content { content-visibility: visible; display: block; }
    }
}

/* ── Encabezado de página ───────────────────────────────────────────────────────── */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); }
.page-header > div:first-child { min-width: 0; flex: 1 1 22rem; }
.page-header .muted { max-width: 46rem; margin-bottom: 0; }
.page-header__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); font-size: 0.875rem; color: var(--color-muted); }
.eyebrow { margin: 0 0 var(--space-1); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-muted); }
.section-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2); margin: var(--space-8) 0 var(--space-3); }
.section-title h2 { margin: 0; font-size: 1.25rem; }
.section-title p { margin: 0; font-size: 0.875rem; color: var(--color-muted); }
@media (min-width: 48rem) { h1 { font-size: 1.875rem; } }

/* ── Superficies ────────────────────────────────────────────────────────────────── */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-surface); padding: var(--space-4); margin-bottom: var(--space-4); box-shadow: var(--shadow-surface); }
@media (min-width: 48rem) { .card { padding: var(--space-5); } }
.card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-4); }
.card__head h2 { margin: 0; }
.card__head p { margin: 0; }
.card--flush { padding: 0; overflow: hidden; }
.card--flush > .card__head { padding: var(--space-4) var(--space-4) 0; }
@media (min-width: 48rem) { .card--flush > .card__head { padding: var(--space-5) var(--space-5) 0; } }
.card__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--color-border); background: var(--color-surface-alt); font-size: 0.875rem; color: var(--color-muted); }
.grid { display: grid; gap: var(--space-4); align-items: start; }
.grid > .card { margin-bottom: 0; }
@media (min-width: 75rem) {
    .grid--8-4 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
    .grid--6-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.notice { padding: var(--space-3) var(--space-4); border-radius: var(--radius-control); border: 1px solid var(--color-border); background: var(--color-selection); margin-bottom: var(--space-4); }
.notice--error { border-color: #f3b8b2; background: var(--color-error-bg); color: #7a1a12; }
.notice--warning { border-color: #f1dfa6; background: var(--color-warning-bg); color: #5c3d00; }
.notice code { word-break: break-all; }

/* ── KPIs ───────────────────────────────────────────────────────────────────────── */
.kpi-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin: 0 0 var(--space-4); }
@media (min-width: 40rem) { .kpi-row { grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); } }
.kpi-tile { margin: 0; padding: var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-surface); box-shadow: var(--shadow-surface); min-width: 0; }
.kpi-tile dt { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); overflow-wrap: anywhere; }
.kpi-tile dd { margin: var(--space-2) 0 0; font-size: 1.75rem; line-height: 1.1; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi-tile dd small { font-size: 0.875rem; font-weight: 500; color: var(--color-muted); }
.kpi-tile p { margin: var(--space-2) 0 0; font-size: 0.8125rem; color: var(--color-muted); }
.kpi-tile--warning { border-top: 3px solid #d9a21b; }
.kpi-tile--critical { border-top: 3px solid var(--color-error); }
.kpi-tile--ok { border-top: 3px solid #2f9e6b; }

/* Cifras de control: tira compacta de componentes técnicos */
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 0; margin: 0; border: 1px solid var(--color-border); border-radius: var(--radius-control); overflow: hidden; }
.control { margin: 0; padding: var(--space-3) var(--space-4); border-right: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); margin-right: -1px; margin-bottom: -1px; }
.control dt { display: flex; align-items: center; gap: var(--space-2); font-size: 0.8125rem; color: var(--color-muted); }
.control dd { margin: var(--space-1) 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.control dd small { display: block; font-weight: 400; font-size: 0.8125rem; color: var(--color-muted); }

/* Indicador de estado */
.dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--color-control-border); flex-shrink: 0; }
.dot--ok { background: #2f9e6b; }
.dot--warning, .dot--degraded { background: #d9a21b; }
.dot--critical, .dot--down { background: var(--color-error); }
.dot--info, .dot--unknown { background: #94a3b8; }

/* ── Atención requerida ─────────────────────────────────────────────────────────── */
.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-1) var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--color-border); }
.alerts li:first-child { border-top: 0; padding-top: 0; }
.alerts .dot { margin-top: 0.45rem; }
.alerts strong { font-weight: 600; font-size: 0.9375rem; }
.alerts p { grid-column: 2; margin: 0; font-size: 0.8125rem; color: var(--color-muted); }
.all-clear { display: flex; align-items: center; gap: var(--space-2); margin: 0; color: var(--color-success); font-weight: 600; }

/* ── Barras de proporción (SVG; compatibles con CSP sin estilos en línea) ──────────── */
.meter { display: block; width: 100%; height: 0.5rem; border-radius: 999px; }
.meter__track { fill: var(--color-chart-track); }
.meter__bar { fill: var(--color-chart); }
.meter--warning .meter__bar { fill: #d9a21b; }
.meter--critical .meter__bar { fill: var(--color-error); }
.meter--ok .meter__bar { fill: #2f9e6b; }
.ratios { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
.ratio__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-2); font-size: 0.9375rem; }
.ratio__head span:last-child { flex-shrink: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.ratio__head small { font-weight: 400; color: var(--color-muted); }

/* ── Formularios ────────────────────────────────────────────────────────────────── */
.field { margin-bottom: var(--space-4); }
label { display: block; font-weight: 600; font-size: 0.9375rem; margin-bottom: var(--space-1); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="datetime-local"], select, textarea {
    width: 100%; min-height: var(--touch-target); padding: var(--space-2) var(--space-3); font: inherit; color: inherit;
    border: 1px solid var(--color-control-border); border-radius: var(--radius-control); background: var(--color-surface);
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--color-action); outline-offset: 2px; }
.field-error { color: var(--color-error); margin: var(--space-1) 0 0; font-size: 0.875rem; }
.help-text { color: var(--color-muted); font-size: 0.875rem; }
.checks { display: grid; gap: var(--space-2); }
.checks label { display: flex; gap: var(--space-2); align-items: flex-start; font-weight: 400; margin: 0; }
.checks input { margin-top: 0.3rem; }
fieldset { border: 1px solid var(--color-border); border-radius: var(--radius-control); margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4); }
legend { font-weight: 600; padding: 0 var(--space-2); }
.searchbar { display: flex; gap: var(--space-2); margin: 0; flex: 1 1 18rem; max-width: 28rem; }
.searchbar input { min-width: 0; }

/* Selector de periodo (enlaces; sin JavaScript) */
.segmented { display: inline-flex; flex-wrap: wrap; padding: 0.1875rem; gap: 0.1875rem; background: var(--color-chart-track); border-radius: var(--radius-control); }
.segmented a { display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 var(--space-3); border-radius: var(--radius-small); color: var(--color-text-secondary); font-size: 0.875rem; font-weight: 500; text-decoration: none; }
.segmented a:hover { color: var(--color-text); }
.segmented a[aria-current="true"] { background: var(--color-surface); color: var(--color-text); font-weight: 600; box-shadow: 0 1px 2px rgb(15 31 58 / 0.12); }

/* ── Botones ────────────────────────────────────────────────────────────────────── */
.button { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--touch-target); padding: 0 var(--space-4); border-radius: var(--radius-control); border: 1px solid var(--color-action); background: var(--color-action); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.button:hover { background: var(--color-action-hover); }
.button--secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border-strong); }
.button--secondary:hover { background: var(--color-surface-alt); border-color: var(--color-control-border); }
.button--danger { background: var(--color-error); border-color: var(--color-error); }
.button--small { min-height: 2.25rem; padding: 0 var(--space-3); font-size: 0.875rem; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ── Tablas ─────────────────────────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.data-table th, .data-table td { text-align: left; padding: var(--space-3); border-bottom: 1px solid var(--color-border); vertical-align: top; }
.data-table thead th { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-muted); background: var(--color-surface-alt); vertical-align: bottom; }
.data-table tbody tr:hover { background: var(--color-surface-alt); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .is-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .is-zero { color: #a3afc0; }
.data-table .is-flag { color: var(--color-error); font-weight: 600; }
.data-table .is-slow { color: var(--color-warning); font-weight: 600; }
.data-table--wide { min-width: 60rem; }
.data-table--wide th { white-space: normal; min-width: 5.5rem; }
.cell-strong { font-weight: 600; }
.cell-sub { display: block; font-size: 0.8125rem; color: var(--color-muted); }
.cell-bar { display: grid; grid-template-columns: 3.5rem minmax(4rem, 1fr); align-items: center; gap: var(--space-2); }

/* Tabla de cuentas: tabla en escritorio, tarjetas en móvil (columnas prioritarias arriba). */
@media (max-width: 63.99rem) {
    .rtable { min-width: 0; }
    .rtable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
    .rtable tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-4); padding: var(--space-4); border-bottom: 1px solid var(--color-border); }
    .rtable td { padding: 0; border: 0; text-align: left !important; }
    .rtable td::before { content: attr(data-label); display: block; font-size: 0.75rem; color: var(--color-muted); }
    .rtable td.is-primary { grid-column: 1 / -1; font-size: 1rem; }
    .rtable td.is-primary::before { display: none; }
    .rtable tbody tr:hover { background: transparent; }
}
@media (min-width: 40rem) and (max-width: 63.99rem) { .rtable tr { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 64rem) {
    .rtable th:first-child, .rtable td:first-child { min-width: 13rem; }
    .rtable th:first-child, .rtable td:first-child { position: sticky; left: 0; z-index: 1; background: var(--color-surface); box-shadow: 1px 0 0 var(--color-border); }
    .rtable thead th:first-child { background: var(--color-surface-alt); }
    .rtable tbody tr:hover td:first-child { background: var(--color-surface-alt); }
}

/* ── Insignias ──────────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.125rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; line-height: 1.5; background: var(--color-info-bg); color: var(--color-info); white-space: nowrap; }
.badge--ok { background: var(--color-success-bg); color: var(--color-success); }
.badge--off { background: var(--color-error-bg); color: var(--color-error); }
.badge--warn { background: var(--color-warning-bg); color: var(--color-warning); }
.badge--neutral { background: var(--color-chart-track); color: var(--color-text-secondary); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.cards { display: grid; gap: var(--space-4); }
@media (min-width: 48rem) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── Estados vacíos ─────────────────────────────────────────────────────────────── */
.empty { padding: var(--space-8) var(--space-4); text-align: center; color: var(--color-muted); }
.empty strong { display: block; margin-bottom: var(--space-1); color: var(--color-text); font-size: 1rem; }
.empty p { max-width: 32rem; margin: 0 auto; font-size: 0.875rem; }

/* ── Acceso ─────────────────────────────────────────────────────────────────────── */
.guest { min-height: 100vh; display: grid; place-items: center; padding: var(--space-4); }
.guest__box { width: 100%; max-width: 26rem; }
.guest__box > h1 { font-size: 1.5rem; margin-bottom: var(--space-4); }
.guest__logo { display: block; border-radius: 12px; margin-bottom: var(--space-3); }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); font-family: var(--font-mono); margin: var(--space-4) 0; }
.codes li { padding: var(--space-2); border: 1px dashed var(--color-control-border); border-radius: var(--radius-control); text-align: center; }

/* QR del alta TOTP */
.qr { display: flex; justify-content: center; padding: var(--space-3); background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-control); margin-bottom: var(--space-3); }
.qr svg { width: 100%; max-width: 15rem; height: auto; }

/* ── Filtros y fichas ───────────────────────────────────────────────────────────── */
.filters { display: grid; gap: var(--space-3); }
.filters .field { margin-bottom: 0; }
@media (min-width: 48rem) { .filters { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; align-items: end; } }
.filters--simple { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 48rem) { .filters--simple { grid-template-columns: minmax(0, 2fr) auto; } }
.facts { display: grid; gap: var(--space-3); margin: 0 0 var(--space-3); }
@media (min-width: 48rem) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.facts dt { font-size: 0.8125rem; color: var(--color-muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ── Tablero y salud ────────────────────────────────────────────────────────────── */
.cards--wide { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 64rem) { .cards--wide { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.status-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.status-banner p { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4) var(--space-3); margin: 0 0 var(--space-4); }
@media (min-width: 40rem) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpi dt { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-muted); }
.kpi dd { margin: var(--space-1) 0 0; font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.sparkline { display: block; width: 100%; max-width: 40rem; height: 3rem; color: var(--color-chart); margin-bottom: var(--space-3); }

/* ── Detalle por portal ─────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: var(--space-1); margin: 0 0 var(--space-6); border-bottom: 1px solid var(--color-border); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a { display: inline-flex; align-items: center; min-height: var(--touch-target); padding: 0 var(--space-3); text-decoration: none; color: var(--color-muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--color-text); }
.tabs a[aria-current='page'] { color: var(--color-action); border-bottom-color: var(--color-action); font-weight: 600; }
.adoption li { display: flex; gap: var(--space-3); align-items: baseline; }
.findings { list-style: none; margin: 0; padding: 0; }
.finding { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-1); padding: var(--space-4) 0; border-top: 1px solid var(--color-border); }
.finding:first-child { border-top: 0; padding-top: 0; }
.finding p { margin: 0; }
.finding__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.finding code { color: var(--color-text-secondary); overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ── Panel administrativo / Tablero de inicio (Boceto) ────────────────────────── */
.dash-breadcrumb { display: flex; align-items: center; gap: 0.35rem; font-size: 0.8125rem; color: #64748b; margin-bottom: 0.75rem; }
.dash-breadcrumb__icon { color: #64748b; flex-shrink: 0; }
.dash-breadcrumb__sep { color: #94a3b8; font-size: 0.75rem; }
.dash-breadcrumb__current { color: #334155; font-weight: 500; }

.dash-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; }
.dash-header__left { flex: 1 1 20rem; }
.dash-header__title { font-size: 1.75rem; font-weight: 700; color: #0f172a; margin: 0 0 0.2rem; letter-spacing: -0.02em; }
.dash-header__greeting { font-size: 1.05rem; font-weight: 600; color: #1e293b; margin: 0 0 0.25rem; }
.dash-header__permissions { font-size: 0.8125rem; color: #64748b; margin: 0; }
.dash-header__right { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.dash-header__datetime { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8125rem; color: #64748b; }
.dash-header__quick-btn { background: #1d4ed8 !important; border-color: #1d4ed8 !important; color: #ffffff !important; padding: 0.5rem 1rem !important; min-height: 2.35rem !important; border-radius: 0.5rem !important; font-size: 0.8125rem !important; font-weight: 600 !important; box-shadow: 0 2px 4px rgba(29, 78, 216, 0.25); display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; }
.dash-header__quick-btn:hover { background: #1e40af !important; border-color: #1e40af !important; }

/* ── Dropdown Acciones Rápidas ─────────────────────────────────────────────────── */
.quick-actions-dropdown { position: relative; display: inline-block; }
.quick-actions-chevron { transition: transform 0.2s ease; }
.quick-actions-dropdown.is-open .quick-actions-chevron { transform: rotate(180deg); }
.quick-actions-menu { position: absolute; right: 0; top: calc(100% + 6px); background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.75rem; box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08); min-width: 19rem; max-width: 23rem; z-index: 100; overflow: hidden; padding: 0.4rem 0; animation: fadeInScale 0.15s ease-out; }
.quick-actions-menu__header { padding: 0.5rem 1rem 0.35rem; font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; }
.quick-actions-menu__divider { height: 1px; background: #f1f5f9; margin: 0.35rem 0; }
.quick-actions-menu__item { display: flex; align-items: flex-start; gap: 0.75rem; width: 100%; padding: 0.6rem 1rem; text-align: left; background: transparent; border: none; cursor: pointer; text-decoration: none; color: inherit; transition: background-color 0.15s ease; box-sizing: border-box; }
.quick-actions-menu__item:hover { background-color: #f8fafc; }
.quick-actions-menu__item:focus-visible { background-color: #f1f5f9; outline: none; }
.quick-actions-menu__icon { flex-shrink: 0; margin-top: 0.15rem; color: #64748b; }
.quick-actions-menu__content { display: flex; flex-direction: column; min-width: 0; }
.quick-actions-menu__content strong { font-size: 0.8125rem; font-weight: 600; color: #0f172a; line-height: 1.25; }
.quick-actions-menu__content span { font-size: 0.72rem; color: #64748b; line-height: 1.25; margin-top: 0.1rem; }
.text-blue { color: #0284c7 !important; }
.text-red { color: #dc2626 !important; }
.text-green { color: #16a34a !important; }
.text-purple { color: #9333ea !important; }
.text-amber { color: #d97706 !important; }
.text-slate { color: #475569 !important; }
.text-indigo { color: #4f46e5 !important; }

@keyframes fadeInScale { from { opacity: 0; transform: scale(0.97) translateY(-4px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ── 5 Tarjetas KPI Resumen ────────────────────────────────────────────────────── */
.summary-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.summary-kpi { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.75rem; padding: 0.95rem 1.15rem; display: flex; flex-direction: column; justify-content: space-between; min-height: 6rem; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03); text-decoration: none; color: inherit; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
a.summary-kpi:hover, .summary-kpi--link:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08); border-color: #cbd5e1; }
a.summary-kpi:hover .summary-kpi__num, .summary-kpi--link:hover .summary-kpi__num { color: #2563eb; }
a.summary-kpi:focus-visible, .summary-kpi--link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.summary-kpi__top { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.35rem; }
.summary-kpi__icon { width: 32px; height: 32px; border-radius: 0.5rem; display: grid; place-items: center; flex-shrink: 0; }
.summary-kpi__icon--blue { background: #e0f2fe; color: #0284c7; }
.summary-kpi__icon--green { background: #dcfce7; color: #16a34a; }
.summary-kpi__icon--cyan { background: #e0f7fa; color: #00acc1; }
.summary-kpi__icon--red { background: #fee2e2; color: #dc2626; }
.summary-kpi__icon--sky { background: #e0f2fe; color: #2563eb; }
.summary-kpi__label { font-size: 0.75rem; font-weight: 600; color: #64748b; line-height: 1.2; }
.summary-kpi__value { margin-top: 0.2rem; }
.summary-kpi__val-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.5rem; margin-top: 0.2rem; }
.summary-kpi__num { font-size: 1.5rem; font-weight: 700; color: #0f172a; line-height: 1.1; font-variant-numeric: tabular-nums; }
.summary-kpi__trend { font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.4rem; border-radius: 0.25rem; line-height: 1.2; }
.summary-kpi__trend--up { background: #dcfce7; color: #15803d; }
.summary-kpi__trend--down { background: #fee2e2; color: #b91c1c; }
.summary-kpi__progress { width: 100%; height: 4px; background: #e2e8f0; border-radius: 999px; margin-top: 0.55rem; overflow: hidden; }
.summary-kpi__progress-fill { height: 100%; background: #10b981; border-radius: 999px; }
.summary-kpi__chart { display: inline-flex; align-items: flex-end; gap: 2px; height: 1.35rem; }
.summary-kpi__chart span { width: 3px; background: #93c5fd; border-radius: 1px; display: inline-block; }
.summary-kpi__chart--red span { background: #fca5a5; }

/* ── Banner Estado General ─────────────────────────────────────────────────────── */
.platform-banner { background: #ffffff; border: 1px solid #d1fae5; border-radius: 0.75rem; padding: 1rem 1.35rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03); }
.platform-banner__left { display: flex; align-items: center; gap: 1rem; flex: 1 1 20rem; }
.platform-banner__circle { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.platform-banner__circle--ok { background: #dcfce7; color: #16a34a; }
.platform-banner__circle--warn { background: #fef3c7; color: #d97706; }
.platform-banner__circle--off { background: #fee2e2; color: #dc2626; }
.platform-banner__headline { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.15rem; flex-wrap: wrap; }
.platform-banner__headline strong { font-size: 0.95rem; font-weight: 700; color: #0f172a; }
.platform-banner__desc { font-size: 0.8125rem; color: #64748b; margin: 0; }
.platform-banner__actions { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.platform-banner__btn { background: #ffffff !important; border: 1px solid #cbd5e1 !important; color: #1e293b !important; font-size: 0.8125rem !important; font-weight: 600 !important; padding: 0.45rem 0.85rem !important; border-radius: 0.5rem !important; text-decoration: none; display: inline-flex; align-items: center; gap: 0.45rem; }
.platform-banner__btn:hover { background: #f8fafc !important; border-color: #94a3b8 !important; }

/* ── Hub de Portales ───────────────────────────────────────────────────────────── */
.portals-hub { margin-bottom: 2rem; }
.portals-hub__header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.75rem; }
.portals-hub__title { font-size: 1.25rem; font-weight: 700; color: #0f172a; margin: 0 0 0.15rem; }
.portals-hub__sub { font-size: 0.8125rem; color: #64748b; margin: 0; }
.portals-hub__view-switch { display: flex; gap: 0.25rem; background: #e2e8f0; padding: 3px; border-radius: 0.5rem; }
.view-switch-btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.75rem; font-size: 0.78rem; font-weight: 600; border: none; border-radius: 0.375rem; background: transparent; color: #475569; text-decoration: none; cursor: pointer; transition: all 0.15s; }
.view-switch-btn.is-active { background: #1d4ed8; color: #ffffff; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }

.portals-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); gap: 1.25rem; }
@media (min-width: 72rem) {
    .portals-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ── Tarjeta individual de portal (Boceto) ─────────────────────────────────────── */
.portal-box { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.75rem; padding: 1.15rem 1.25rem 0.85rem; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.02); transition: box-shadow 0.15s, border-color 0.15s; }
.portal-box:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06); border-color: #cbd5e1; }
.portal-box__head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.15rem; gap: 0.5rem; }
.portal-box__brand { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.portal-box__icon { width: 38px; height: 38px; border-radius: 0.5rem; display: grid; place-items: center; flex-shrink: 0; background-color: #2563eb; }
.portal-box--erp .portal-box__icon { background-color: #2563eb; }
.portal-box--seller .portal-box__icon { background-color: #7c3aed; }
.portal-box--services .portal-box__icon { background-color: #0284c7; }
.portal-box--food .portal-box__icon { background-color: #ea580c; }
.portal-box--customer .portal-box__icon { background-color: #0d9488; }
.portal-box--admin .portal-box__icon { background-color: #4338ca; }
.icon-white { color: #ffffff; }
.portal-box__titles { min-width: 0; }
.portal-box__name { font-size: 1.05rem; font-weight: 700; color: #0f172a; margin: 0; line-height: 1.2; }
.portal-box__desc { font-size: 0.72rem; color: #64748b; margin: 0.1rem 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-box__status-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; flex-shrink: 0; }
.portal-box__minichart { display: inline-flex; align-items: flex-end; gap: 2px; height: 1.15rem; }
.portal-box__minichart span { width: 2.5px; background: #bfdbfe; border-radius: 1px; display: inline-block; }
.portal-box__minichart span:nth-child(1) { height: 40%; }
.portal-box__minichart span:nth-child(2) { height: 65%; }
.portal-box__minichart span:nth-child(3) { height: 50%; }
.portal-box__minichart span:nth-child(4) { height: 85%; }
.portal-box__minichart span:nth-child(5) { height: 70%; }
.portal-box__minichart span:nth-child(6) { height: 100%; }
.portal-box__minichart span:nth-child(7) { height: 90%; }

.summary-kpi__progress-fill { width: 100%; }
.summary-kpi__chart span:nth-child(1) { height: 35%; }
.summary-kpi__chart span:nth-child(2) { height: 60%; }
.summary-kpi__chart span:nth-child(3) { height: 45%; }
.summary-kpi__chart span:nth-child(4) { height: 80%; }
.summary-kpi__chart span:nth-child(5) { height: 65%; }
.summary-kpi__chart span:nth-child(6) { height: 95%; }

.portal-box__body { flex: 1; margin-bottom: 0.75rem; }
.portal-kpis-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.85rem 0.5rem; }
.portal-kpi-item { display: flex; flex-direction: column; min-width: 0; text-decoration: none; color: inherit; }
a.portal-kpi-item, .portal-kpi-item--clickable { border-radius: 0.375rem; padding: 0.25rem 0.35rem; margin: -0.25rem -0.35rem; transition: background-color 0.15s ease, transform 0.15s ease; cursor: pointer; }
a.portal-kpi-item:hover, .portal-kpi-item--clickable:hover { background-color: #f1f5f9; transform: translateY(-1px); }
a.portal-kpi-item:hover .portal-kpi-item__num, .portal-kpi-item--clickable:hover .portal-kpi-item__num { color: #2563eb; }
a.portal-kpi-item:focus-visible, .portal-kpi-item--clickable:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }
.portal-kpi-item__num { font-size: 1.25rem; font-weight: 700; color: #0f172a; line-height: 1.2; font-variant-numeric: tabular-nums; transition: color 0.15s ease; }
.portal-kpi-item__label { font-size: 0.72rem; color: #64748b; line-height: 1.25; margin-top: 0.15rem; overflow-wrap: anywhere; }

.admin-portal-metrics { display: flex; flex-direction: column; gap: 0.75rem; padding-top: 0.25rem; }
.admin-metric-group__label { font-size: 0.72rem; color: #64748b; font-weight: 500; display: block; }
.admin-metric-group__text { font-size: 0.8125rem; color: #1e293b; margin: 0.15rem 0 0; }
.admin-metric-group__text a { color: #2563eb; text-decoration: none; font-weight: 500; }
.admin-metric-group__text a:hover { text-decoration: underline; }

.portal-box__foot { border-top: 1px solid #f1f5f9; padding-top: 0.75rem; display: flex; align-items: center; justify-content: space-between; font-size: 0.8rem; }
.portal-box__link { display: inline-flex; align-items: center; gap: 0.35rem; color: #2563eb; text-decoration: none; font-weight: 500; font-size: 0.78rem; }
.portal-box__link:hover { text-decoration: underline; }
.portal-box__menu-btn { background: transparent; border: none; color: #94a3b8; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 4px; cursor: pointer; }
.portal-box__menu-btn:hover { background: #f1f5f9; color: #0f172a; }

.table-kpis-summary { display: flex; flex-wrap: wrap; gap: 0.65rem; font-size: 0.8125rem; color: #64748b; }
.table-kpis-summary strong { color: #0f172a; }
.table-kpi-link { color: inherit; text-decoration: none; padding: 0.15rem 0.35rem; border-radius: 0.25rem; transition: background-color 0.15s ease, color 0.15s ease; }
.table-kpi-link:hover { background-color: #f1f5f9; color: #2563eb; }
.table-kpi-link:hover strong { color: #2563eb; }

/* ── Vista Detalle de Portal ERP (Boceto Profesional) ────────────────────────── */
.dash-portal-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.dash-portal-header__left { flex: 1 1 24rem; }
.dash-portal-header__title-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.35rem; }
.dash-portal-header__title { font-size: 1.65rem; font-weight: 700; color: #0f172a; margin: 0; letter-spacing: -0.02em; }
.dash-portal-header__time { font-size: 0.8125rem; color: #64748b; }
.dash-portal-header__desc { font-size: 0.84rem; color: #64748b; margin: 0; max-width: 48rem; line-height: 1.4; }
.dash-portal-header__right { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }

.status-pill { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.status-pill--ok { background: #dcfce7; color: #15803d; }
.status-pill--warn { background: #fef3c7; color: #b45309; }
.status-pill--off { background: #fee2e2; color: #b91c1c; }
.status-pill__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.header-action-btn { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.85rem; background: #ffffff; border: 1px solid #cbd5e1; border-radius: 0.5rem; font-size: 0.8125rem; font-weight: 600; color: #1e293b; text-decoration: none; transition: background 0.15s, border-color 0.15s; }
.header-action-btn:hover { background: #f8fafc; border-color: #94a3b8; }
.header-export-btn { background: #1d4ed8 !important; border-color: #1d4ed8 !important; color: #ffffff !important; padding: 0.45rem 0.95rem !important; min-height: 2.2rem !important; border-radius: 0.5rem !important; font-size: 0.8125rem !important; font-weight: 600 !important; display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.header-export-btn:hover { background: #1e40af !important; border-color: #1e40af !important; }

.export-dropdown { position: relative; display: inline-block; }
.export-dropdown__menu { position: absolute; right: 0; top: calc(100% + 4px); background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.5rem; box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1); min-width: 11rem; z-index: 50; overflow: hidden; padding: 0.25rem 0; }
.export-dropdown__item { display: block; width: 100%; text-align: left; padding: 0.55rem 0.85rem; font-size: 0.8125rem; color: #1e293b; background: transparent; border: none; cursor: pointer; text-decoration: none; }
.export-dropdown__item:hover { background: #f1f5f9; color: #0f172a; }

/* ── 7 Cifras Clave del Portal ─────────────────────────────────────────────────── */
.portal-figures-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.75rem; margin-bottom: 1.5rem; }
@media (min-width: 80rem) {
    .portal-figures-row { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}
.portal-fig-tile { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.75rem; padding: 0.85rem 0.95rem; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03); min-height: 5.75rem; position: relative; text-decoration: none; color: inherit; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
a.portal-fig-tile:hover, .portal-fig-tile--clickable:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08); border-color: #cbd5e1; }
a.portal-fig-tile:hover .portal-fig-tile__num, .portal-fig-tile--clickable:hover .portal-fig-tile__num { color: #2563eb; }
a.portal-fig-tile:focus-visible, .portal-fig-tile--clickable:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.portal-fig-tile__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.35rem; }
.portal-fig-tile__icon { width: 30px; height: 30px; border-radius: 0.45rem; display: grid; place-items: center; flex-shrink: 0; }
.portal-fig-tile__icon--blue { background: #e0f2fe; color: #0284c7; }
.portal-fig-tile__icon--green { background: #dcfce7; color: #16a34a; }
.portal-fig-tile__icon--purple { background: #f3e8ff; color: #9333ea; }
.portal-fig-tile__icon--sky { background: #e0f2fe; color: #2563eb; }
.portal-fig-tile__icon--orange { background: #ffedd5; color: #ea580c; }
.portal-fig-tile__icon--amber { background: #fef3c7; color: #d97706; }
.portal-fig-tile__icon--red { background: #fee2e2; color: #dc2626; }
.portal-fig-tile__label { font-size: 0.72rem; font-weight: 600; color: #64748b; line-height: 1.2; margin-bottom: 0.2rem; }
.portal-fig-tile__val-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.4rem; }
.portal-fig-tile__num { font-size: 1.45rem; font-weight: 700; color: #0f172a; line-height: 1.1; font-variant-numeric: tabular-nums; }
.portal-fig-tile__trend { font-size: 0.68rem; font-weight: 700; padding: 0.1rem 0.35rem; border-radius: 0.25rem; background: #dcfce7; color: #15803d; line-height: 1.2; }
.portal-fig-tile__chart { display: inline-flex; align-items: flex-end; gap: 2px; height: 1.1rem; }
.portal-fig-tile__chart span { width: 2.5px; background: #bfdbfe; border-radius: 1px; display: inline-block; }
.portal-fig-tile__chart--green span { background: #86efac; }
.portal-fig-tile__chart--purple span { background: #d8b4fe; }
.portal-fig-tile__chart--orange span { background: #fdba74; }
.portal-fig-tile__chart--amber span { background: #fde047; }
.portal-fig-tile__chart--red span { background: #fca5a5; }

/* ── Paneles Centrales: Prioridades de atención & Brechas de activación ───────── */
.portal-dash-panels { display: grid; grid-template-columns: 1fr; gap: 1.25rem; margin-bottom: 1.5rem; }
@media (min-width: 64rem) {
    .portal-dash-panels { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
}

.portal-panel { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.75rem; padding: 1.25rem; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.02); display: flex; flex-direction: column; }
.portal-panel__head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.4rem; gap: 0.75rem; flex-wrap: wrap; }
.portal-panel__title-wrap { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.portal-panel__icon { width: 28px; height: 28px; border-radius: 0.45rem; display: grid; place-items: center; flex-shrink: 0; }
.portal-panel__icon--red { background: #fee2e2; color: #dc2626; }
.portal-panel__icon--blue { background: #e0f2fe; color: #2563eb; }
.portal-panel__title { font-size: 1.05rem; font-weight: 700; color: #0f172a; margin: 0; }
.portal-panel__badge { padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.portal-panel__badge--red { background: #fee2e2; color: #dc2626; }
.portal-panel__link { font-size: 0.8125rem; font-weight: 600; color: #2563eb; text-decoration: none; }
.portal-panel__link:hover { text-decoration: underline; }
.portal-panel__desc { font-size: 0.78rem; color: #64748b; margin: 0 0 1rem; line-height: 1.35; }

/* ── Mini tarjetas horizontales de prioridades de atención ─────────────────────── */
.priority-cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 0.75rem; flex: 1; }
@media (min-width: 48rem) and (max-width: 64rem) {
    .priority-cards-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 64rem) {
    .priority-cards-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.priority-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 0.5rem; padding: 0.85rem 0.75rem; display: flex; flex-direction: column; justify-content: space-between; transition: all 0.15s; }
.priority-card:hover { border-color: #cbd5e1; background: #ffffff; box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04); }
.priority-card__top { display: flex; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.65rem; }
.priority-card__icon { width: 26px; height: 26px; border-radius: 0.35rem; display: grid; place-items: center; flex-shrink: 0; }
.priority-card__icon--red { background: #fee2e2; color: #dc2626; }
.priority-card__icon--orange { background: #ffedd5; color: #ea580c; }
.priority-card__icon--purple { background: #f3e8ff; color: #9333ea; }
.priority-card__icon--blue { background: #e0f2fe; color: #2563eb; }
.priority-card__title { font-size: 0.74rem; font-weight: 600; color: #334155; line-height: 1.25; margin: 0; }
.priority-card__stat { font-size: 0.95rem; font-weight: 700; color: #0f172a; margin-bottom: 0.45rem; line-height: 1.2; }
.priority-card__bar { width: 100%; height: 5px; border-radius: 999px; background: #e2e8f0; overflow: hidden; margin-bottom: 0.65rem; }
.priority-card__bar-fill { height: 100%; border-radius: 999px; }
.priority-card__bar-fill--red { background: #ef4444; }
.priority-card__bar-fill--orange { background: #f97316; }
.priority-card__bar-fill--purple { background: #a855f7; }
.priority-card__bar-fill--blue { background: #3b82f6; }
.priority-card__link { font-size: 0.72rem; font-weight: 600; color: #2563eb; text-decoration: none; display: inline-flex; align-items: center; gap: 0.25rem; }
.priority-card__link:hover { text-decoration: underline; }

/* ── Brechas de activación ─────────────────────────────────────────────────────── */
.activation-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; flex: 1; justify-content: space-around; }
.activation-item { display: flex; flex-direction: column; gap: 0.25rem; }
.activation-item__head { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.78rem; gap: 0.5rem; }
.activation-item__label { font-weight: 500; color: #334155; }
.activation-item__count { font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; }
.activation-item__bar { width: 100%; height: 6px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.activation-item__fill { height: 100%; border-radius: 999px; }
.activation-item__fill--red { background: #ef4444; }
.activation-item__fill--orange { background: #f97316; }
.activation-item__fill--purple { background: #a855f7; }
.activation-item__fill--blue { background: #3b82f6; }
.activation-item__fill--cyan { background: #06b6d4; }

/* ── Sección Salud Técnica ─────────────────────────────────────────────────────── */
.tech-health-section { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.75rem; padding: 1.15rem 1.25rem; margin-bottom: 1.5rem; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.02); }
.tech-health-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem; }
.tech-health-header__left { display: flex; align-items: center; gap: 0.65rem; }
.tech-health-header__icon { width: 30px; height: 30px; border-radius: 0.45rem; background: #dcfce7; color: #16a34a; display: grid; place-items: center; }
.tech-health-header__title { font-size: 1.05rem; font-weight: 700; color: #0f172a; margin: 0; }
.tech-health-header__sub { font-size: 0.78rem; color: #64748b; margin: 0.1rem 0 0; }
.tech-health-header__link { font-size: 0.8125rem; font-weight: 600; color: #2563eb; text-decoration: none; }
.tech-health-header__link:hover { text-decoration: underline; }

.tech-health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; }
@media (min-width: 64rem) {
    .tech-health-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.tech-health-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 0.5rem; padding: 0.75rem 0.85rem; display: flex; flex-direction: column; justify-content: space-between; min-height: 5rem; }
.tech-health-card__top { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.25rem; }
.tech-health-card__icon { width: 22px; height: 22px; border-radius: 0.35rem; display: grid; place-items: center; font-size: 0.75rem; }
.tech-health-card__icon--green { background: #dcfce7; color: #16a34a; }
.tech-health-card__icon--purple { background: #f3e8ff; color: #9333ea; }
.tech-health-card__icon--blue { background: #e0f2fe; color: #2563eb; }
.tech-health-card__icon--red { background: #fee2e2; color: #dc2626; }
.tech-health-card__label { font-size: 0.72rem; font-weight: 600; color: #475569; }
.tech-health-card__val { font-size: 1.15rem; font-weight: 700; color: #0f172a; line-height: 1.2; margin: 0.15rem 0 0.1rem; }
.tech-health-card__val--red { color: #dc2626; }
.tech-health-card__hint { font-size: 0.7rem; color: #64748b; margin: 0; line-height: 1.2; }
.tech-health-card__bar { width: 100%; height: 4px; background: #cbd5e1; border-radius: 999px; overflow: hidden; margin-top: 0.35rem; }
.tech-health-card__bar-fill { height: 100%; background: #10b981; border-radius: 999px; }

/* ── Sección de Cuentas y Tarjetas para Móviles / Escritorio ──────────────────── */
.accounts-container { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.75rem; padding: 1.25rem; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.02); margin-bottom: 2rem; }
.accounts-toolbar { display: flex; flex-direction: column; gap: 0.85rem; margin-bottom: 1.25rem; }
@media (min-width: 64rem) {
    .accounts-toolbar { flex-direction: row; justify-content: space-between; align-items: center; }
}
.accounts-toolbar__info { display: flex; align-items: center; gap: 0.65rem; }
.accounts-toolbar__icon { width: 32px; height: 32px; border-radius: 0.5rem; background: #e0f2fe; color: #2563eb; display: grid; place-items: center; flex-shrink: 0; }
.accounts-toolbar__title { font-size: 1.15rem; font-weight: 700; color: #0f172a; margin: 0; }
.accounts-toolbar__sub { font-size: 0.78rem; color: #64748b; margin: 0.1rem 0 0; }

.accounts-toolbar__controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.65rem; }
.accounts-searchbox { position: relative; min-width: 16rem; flex: 1 1 auto; }
.accounts-searchbox__icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.accounts-searchbox__input { width: 100%; padding: 0.45rem 0.75rem 0.45rem 2.2rem; font-size: 0.8125rem; border: 1px solid #cbd5e1; border-radius: 0.5rem; background: #ffffff; outline: none; transition: border-color 0.15s; }
.accounts-searchbox__input:focus { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15); }

.accounts-date-filter { position: relative; display: inline-flex; align-items: center; gap: 0.4rem; }
.accounts-date-filter__icon { position: absolute; left: 0.65rem; color: #64748b; pointer-events: none; }
.accounts-date-filter__select { padding: 0.45rem 1.6rem 0.45rem 2rem; font-size: 0.8125rem; font-weight: 500; border: 1px solid #cbd5e1; border-radius: 0.5rem; background: #ffffff; color: #1e293b; outline: none; cursor: pointer; transition: border-color 0.15s; }
.accounts-date-filter__select:focus { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15); }
.accounts-date-range-box { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.78rem; color: #64748b; }
.accounts-date-range-input { padding: 0.4rem 0.5rem; font-size: 0.78rem; border: 1px solid #cbd5e1; border-radius: 0.45rem; background: #ffffff; outline: none; color: #1e293b; }
.accounts-date-range-input:focus { border-color: #2563eb; }

.accounts-filter-pills { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.filter-pill { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.75rem; font-size: 0.76rem; font-weight: 600; border: none; border-radius: 999px; cursor: pointer; transition: all 0.15s; text-decoration: none; background: #f1f5f9; color: #475569; }
.filter-pill:hover { background: #e2e8f0; color: #1e293b; }
.filter-pill.is-active { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.filter-pill--all.is-active { background: #2563eb; color: #ffffff; }
.filter-pill--active { background: #ecfdf5; color: #047857; }
.filter-pill--active.is-active { background: #10b981; color: #ffffff; }
.filter-pill--noactivity { background: #fef2f2; color: #b91c1c; }
.filter-pill--noactivity.is-active { background: #ef4444; color: #ffffff; }
.filter-pill--nosales { background: #fff7ed; color: #c2410c; }
.filter-pill--nosales.is-active { background: #f97316; color: #ffffff; }
.filter-pill--alerts { background: #fef2f2; color: #b91c1c; }
.filter-pill--alerts.is-active { background: #dc2626; color: #ffffff; }

/* ── Tarjetas de Negocios (Mobile First) ───────────────────────────────────────── */
.account-cards-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 48rem) {
    .account-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 76rem) {
    .account-cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.biz-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.75rem; padding: 1.15rem; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03); transition: border-color 0.15s, box-shadow 0.15s; position: relative; }
.biz-card:hover { border-color: #94a3b8; box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05); }

.biz-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.85rem; }
.biz-card__brand { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.biz-card__avatar { width: 38px; height: 38px; border-radius: 0.5rem; background: #e0f2fe; color: #2563eb; display: grid; place-items: center; flex-shrink: 0; font-weight: 700; font-size: 0.95rem; }
.biz-card__titles { min-width: 0; }
.biz-card__name { font-size: 0.98rem; font-weight: 700; color: #0f172a; margin: 0; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.biz-card__name a { color: inherit; text-decoration: none; }
.biz-card__name a:hover { color: #2563eb; text-decoration: underline; }
.biz-card__owner { font-size: 0.76rem; color: #64748b; margin: 0.15rem 0 0; }
.biz-card__owner strong { color: #334155; }
.biz-card__status-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; flex-shrink: 0; }

/* ── 3 Bloques de Fecha Clave y Suscripción (Requisito Principal del Usuario) ──── */
.biz-card__dates-box { background: #f8fafc; border: 1px solid #edf2f7; border-radius: 0.5rem; padding: 0.65rem 0.75rem; display: grid; grid-template-columns: 1fr; gap: 0.55rem; margin-bottom: 0.85rem; }
@media (min-width: 32rem) {
    .biz-card__dates-box { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
}
.biz-card__date-col { display: flex; flex-direction: column; min-width: 0; }
.biz-card__date-col:not(:last-child) { border-bottom: 1px dashed #e2e8f0; padding-bottom: 0.4rem; }
@media (min-width: 32rem) {
    .biz-card__date-col:not(:last-child) { border-bottom: none; border-right: 1px solid #e2e8f0; padding-bottom: 0; padding-right: 0.5rem; }
}
.biz-card__date-label { display: flex; align-items: center; gap: 0.3rem; font-size: 0.68rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 0.2rem; }
.biz-card__date-val { font-size: 0.82rem; font-weight: 700; color: #0f172a; line-height: 1.2; word-break: break-word; }
.biz-card__date-val--highlight { color: #2563eb; }
.biz-card__date-val--inactive { color: #94a3b8; font-weight: 500; }
.biz-card__date-sub { font-size: 0.68rem; color: #64748b; margin-top: 0.15rem; line-height: 1.2; }

/* ── Franja de Métricas de Uso ─────────────────────────────────────────────────── */
.biz-card__metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.35rem; background: #ffffff; border: 1px solid #f1f5f9; border-radius: 0.45rem; padding: 0.45rem 0.5rem; margin-bottom: 0.85rem; text-align: center; }
.biz-card__metric-item { display: flex; flex-direction: column; }
.biz-card__metric-val { font-size: 0.95rem; font-weight: 700; color: #0f172a; line-height: 1.1; font-variant-numeric: tabular-nums; }
.biz-card__metric-lbl { font-size: 0.66rem; color: #64748b; margin-top: 0.1rem; line-height: 1.2; }

/* ── Franja de Alertas del Negocio ─────────────────────────────────────────────── */
.biz-card__alerts-bar { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 0.85rem; min-height: 1.6rem; }
.alert-chip { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.68rem; font-weight: 600; padding: 0.15rem 0.45rem; border-radius: 0.35rem; }
.alert-chip--red { background: #fee2e2; color: #b91c1c; }
.alert-chip--orange { background: #ffedd5; color: #c2410c; }
.alert-chip--purple { background: #f3e8ff; color: #7e22ce; }
.alert-chip--blue { background: #e0f2fe; color: #0369a1; }
.alert-chip--count { background: #dc2626; color: #ffffff; font-weight: 700; border-radius: 999px; padding: 0.1rem 0.35rem; }

/* ── Pie de Tarjeta ───────────────────────────────────────────────────────────── */
.biz-card__foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #f1f5f9; padding-top: 0.75rem; margin-top: auto; font-size: 0.78rem; }
.biz-card__detail-link { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 600; color: #2563eb; text-decoration: none; }
.biz-card__detail-link:hover { text-decoration: underline; }
.biz-card__actions-btn { background: #f8fafc; border: 1px solid #e2e8f0; color: #475569; padding: 0.25rem 0.5rem; border-radius: 0.35rem; font-size: 0.72rem; font-weight: 600; cursor: pointer; }
.biz-card__actions-btn:hover { background: #f1f5f9; color: #0f172a; }

/* ── Vista Profesional de Salud del Sistema (Rediseño) ───────────────────────── */
.health-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; }
.health-header__main { flex: 1 1 24rem; }
.health-header__tag-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.health-header__eyebrow { font-size: 0.7rem; font-weight: 700; color: #2563eb; letter-spacing: 0.08em; text-transform: uppercase; }
.health-pulse { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0.65rem; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 999px; font-size: 0.75rem; font-weight: 600; color: #334155; box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
.health-pulse__dot { width: 8px; height: 8px; border-radius: 50%; }
.health-pulse__dot--ok { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
.health-pulse__dot--warn { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }
.health-pulse__dot--off { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }
.health-header__title { font-size: 1.75rem; font-weight: 700; color: #0f172a; margin: 0 0 0.35rem; letter-spacing: -0.02em; }
.health-header__desc { font-size: 0.85rem; color: #64748b; margin: 0; max-width: 46rem; line-height: 1.45; }

.health-header__actions { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.health-timer-badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.4rem 0.75rem; background: #ffffff; border: 1px solid #cbd5e1; border-radius: 0.5rem; font-size: 0.75rem; font-weight: 600; color: #64748b; }
.health-btn-refresh { display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; }
.health-btn-errors { display: inline-flex; align-items: center; gap: 0.35rem; text-decoration: none; }

/* Cuadrícula Superior de KPIs de Salud */
.health-kpis-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1.75rem; }
@media (min-width: 48rem) {
    .health-kpis-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 72rem) {
    .health-kpis-grid { grid-template-columns: 1.25fr 1fr 1fr 1.25fr; }
}

.health-kpi-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.75rem; padding: 1.1rem 1.2rem; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03); min-height: 6.5rem; }
.health-kpi-card--hero { background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%); border-color: #cbd5e1; }
.health-kpi-card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
.health-kpi-card__label { font-size: 0.72rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; }
.health-kpi-card__icon { width: 32px; height: 32px; border-radius: 0.5rem; display: grid; place-items: center; flex-shrink: 0; }
.health-kpi-card__icon--ok { background: #dcfce7; color: #16a34a; }
.health-kpi-card__icon--warn { background: #fef3c7; color: #d97706; }
.health-kpi-card__icon--off { background: #fee2e2; color: #dc2626; }
.health-kpi-card__icon--blue { background: #e0f2fe; color: #0284c7; }
.health-kpi-card__icon--purple { background: #f3e8ff; color: #9333ea; }
.health-kpi-card__icon--slate { background: #f1f5f9; color: #475569; }

.health-kpi-card__body { display: flex; flex-direction: column; gap: 0.35rem; }
.health-kpi-card__val-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.health-kpi-card__value { font-size: 1.6rem; font-weight: 700; color: #0f172a; line-height: 1.1; font-variant-numeric: tabular-nums; }
.health-kpi-card__value-total { font-size: 1rem; color: #94a3b8; font-weight: 500; }
.health-kpi-card__unit { font-size: 0.82rem; color: #64748b; font-weight: 500; }
.health-kpi-card__subtext { font-size: 0.74rem; color: #64748b; margin: 0; line-height: 1.3; }

.health-progress-bar { width: 100%; height: 6px; background: #f1f5f9; border-radius: 999px; overflow: hidden; margin: 0.15rem 0; }
.health-progress-bar__fill { height: 100%; border-radius: 999px; }
.health-progress-bar__fill--green { background: #10b981; }
.health-progress-bar__fill--amber { background: #f59e0b; }
.health-progress-bar__fill--red { background: #ef4444; }

.health-portals-quicklist { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.25rem; }
.health-quick-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.6rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 0.4rem; font-size: 0.72rem; font-weight: 600; color: #334155; text-decoration: none; transition: all 0.15s; }
.health-quick-chip:hover { background: #e2e8f0; color: #0f172a; }
.health-quick-chip__dot { width: 6px; height: 6px; border-radius: 50%; }
.health-quick-chip__dot--ok { background: #10b981; }
.health-quick-chip__dot--degraded { background: #f59e0b; }
.health-quick-chip__dot--down { background: #ef4444; }

/* Contenedor y Tarjetas de cada Portal */
.health-portals-container { display: flex; flex-direction: column; gap: 1.5rem; margin-bottom: 2.5rem; }
.health-portal-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.85rem; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03); overflow: hidden; transition: border-color 0.2s; }
.health-portal-card--ok { border-left: 4px solid #10b981; }
.health-portal-card--degraded { border-left: 4px solid #f59e0b; }
.health-portal-card--down { border-left: 4px solid #ef4444; }

.health-portal-card__head { display: flex; justify-content: space-between; align-items: center; padding: 1.15rem 1.4rem; background: #ffffff; border-bottom: 1px solid #f1f5f9; flex-wrap: wrap; gap: 0.75rem; }
.health-portal-card__title-area { display: flex; align-items: center; gap: 0.85rem; }
.health-portal-badge-avatar { width: 42px; height: 42px; border-radius: 0.6rem; display: grid; place-items: center; flex-shrink: 0; background: #e0f2fe; color: #0284c7; }
.health-portal-badge-avatar--food { background: #ffedd5; color: #ea580c; }
.health-portal-badge-avatar--seller { background: #dcfce7; color: #16a34a; }
.health-portal-badge-avatar--services { background: #f3e8ff; color: #9333ea; }
.health-portal-badge-avatar--erp { background: #e0f2fe; color: #2563eb; }
.health-portal-badge-avatar--admin { background: #0f2744; color: #ffffff; }

.health-portal-card__title-row { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.health-portal-card__name { font-size: 1.2rem; font-weight: 700; color: #0f172a; margin: 0; letter-spacing: -0.01em; }
.health-portal-card__sub { font-size: 0.76rem; color: #64748b; margin: 0.15rem 0 0; }
.health-portal-card__sub code { font-size: 0.72rem; padding: 0.1rem 0.3rem; background: #f1f5f9; border-radius: 0.25rem; }

.health-portal-card__head-actions { display: flex; align-items: center; gap: 0.65rem; }
.health-env-pill { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0.6rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 0.4rem; font-size: 0.72rem; font-weight: 600; color: #475569; }
.health-env-pill__env { color: #0f172a; font-weight: 700; }
.health-portal-link { display: inline-flex; align-items: center; gap: 0.35rem; }

.health-portal-card__body { padding: 1.4rem; }

/* Alerta de Portal Desconectado */
.health-portal-alert { display: flex; align-items: flex-start; gap: 0.85rem; padding: 1rem 1.15rem; background: #fef2f2; border: 1px solid #fee2e2; border-radius: 0.6rem; color: #991b1b; }
.health-portal-alert__icon { flex-shrink: 0; color: #dc2626; margin-top: 0.1rem; }
.health-portal-alert__content { font-size: 0.84rem; line-height: 1.4; }
.health-portal-alert__content strong { font-size: 0.92rem; display: block; margin-bottom: 0.25rem; color: #7f1d1d; }
.health-portal-alert__content p { margin: 0 0 0.35rem; }

/* Grid de Componentes Técnicos */
.health-checks-grid { display: grid; grid-template-columns: 1fr; gap: 0.85rem; margin-bottom: 1.5rem; }
@media (min-width: 42rem) {
    .health-checks-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 64rem) {
    .health-checks-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 80rem) {
    .health-checks-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.health-check-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 0.65rem; padding: 0.95rem 1rem; display: flex; flex-direction: column; justify-content: space-between; min-height: 6.75rem; transition: background 0.15s, border-color 0.15s; }
.health-check-box:hover { background: #ffffff; border-color: #cbd5e1; box-shadow: 0 2px 5px rgba(15, 23, 42, 0.03); }
.health-check-box--down { background: #fff5f5; border-color: #fecaca; }

.health-check-box__header { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; margin-bottom: 0.6rem; }
.health-check-box__icon-title { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.health-check-box__icon { width: 26px; height: 26px; border-radius: 0.4rem; display: grid; place-items: center; flex-shrink: 0; }
.health-check-box__icon--ok { background: #dcfce7; color: #16a34a; }
.health-check-box__icon--degraded { background: #fef3c7; color: #d97706; }
.health-check-box__icon--down { background: #fee2e2; color: #dc2626; }
.health-check-box__icon--unknown { background: #f1f5f9; color: #64748b; }
.health-check-box__title { font-size: 0.78rem; font-weight: 700; color: #334155; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.health-check-box__metric { display: flex; flex-direction: column; gap: 0.2rem; }
.health-metric-val { display: flex; align-items: baseline; gap: 0.35rem; flex-wrap: wrap; }
.health-metric-val__num { font-size: 1.35rem; font-weight: 700; color: #0f172a; line-height: 1.1; font-variant-numeric: tabular-nums; }
.health-metric-val__unit { font-size: 0.74rem; font-weight: 600; color: #64748b; }
.health-metric-val__text { font-size: 1.1rem; font-weight: 700; color: #0f172a; line-height: 1.2; }
.health-metric-val__text--warn { color: #d97706; }
.health-metric-val__failed { font-size: 0.74rem; font-weight: 700; color: #dc2626; }
.health-metric-note { font-size: 0.7rem; color: #64748b; line-height: 1.25; margin-top: 0.15rem; }

/* Sección de Tareas & Jobs */
.health-tasks-section { background: #ffffff; border: 1px solid #edf2f7; border-radius: 0.65rem; padding: 1.1rem; }
.health-tasks-section__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.85rem; flex-wrap: wrap; gap: 0.5rem; }
.health-tasks-section__title-group { display: flex; align-items: center; gap: 0.45rem; color: #0f172a; }
.health-tasks-section__title-group h3 { font-size: 0.92rem; font-weight: 700; margin: 0; color: #0f172a; }
.health-tasks-section__badge { font-size: 0.72rem; font-weight: 600; padding: 0.15rem 0.5rem; background: #f1f5f9; border-radius: 999px; color: #475569; }

.health-tasks-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 1.75rem 1rem; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 0.5rem; }
.health-tasks-empty__icon { color: #94a3b8; margin-bottom: 0.5rem; }
.health-tasks-empty p { font-size: 0.84rem; font-weight: 600; color: #334155; margin: 0 0 0.25rem; }
.health-tasks-empty code { background: #e2e8f0; padding: 0.1rem 0.35rem; border-radius: 0.25rem; }

.health-tasks-table-wrap { border: 1px solid #e2e8f0; border-radius: 0.5rem; overflow: hidden; }
.health-tasks-table { width: 100%; margin: 0; }
.health-tasks-table thead th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; background: #f8fafc; }
.health-tasks-table td { font-size: 0.8rem; padding: 0.6rem 0.85rem; }

.health-task-name { display: flex; flex-direction: column; gap: 0.15rem; }
.health-task-code { font-size: 0.78rem; font-weight: 600; color: #1e293b; background: #f1f5f9; padding: 0.15rem 0.4rem; border-radius: 0.25rem; display: inline-block; width: fit-content; }
.health-task-error-tooltip { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.7rem; color: #dc2626; font-weight: 500; }
.health-kind-badge { display: inline-block; font-size: 0.68rem; font-weight: 600; text-transform: uppercase; padding: 0.1rem 0.4rem; background: #f1f5f9; color: #475569; border-radius: 0.25rem; }

/* ══════════════════════════════════════════════════════════════════════════════
   CENTRO DE MONITOREO Y ERRORES DE LA PLATAFORMA (ERROR LOGGING & DIAGNOSTICS)
   ══════════════════════════════════════════════════════════════════════════════ */

.err-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.err-header__main { flex: 1 1 32rem; min-width: 0; }
.err-header__tag-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.45rem; flex-wrap: wrap; }
.err-header__eyebrow { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #64748b; }

.err-pulse { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.2rem 0.6rem; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 999px; font-size: 0.75rem; font-weight: 600; color: #334155; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03); }
.err-pulse__dot { width: 8px; height: 8px; border-radius: 50%; position: relative; }
.err-pulse__dot--ok { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); animation: pulseGreen 2.2s infinite; }
.err-pulse__dot--warn { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25); animation: pulseAmber 1.8s infinite; }
.err-pulse__dot--off { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25); animation: pulseRed 1.4s infinite; }

@keyframes pulseGreen {
    0%, 100% { box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25); }
    50% { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.08); }
}
@keyframes pulseAmber {
    0%, 100% { box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.1); }
}
@keyframes pulseRed {
    0%, 100% { box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.35); }
    50% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0.12); }
}

.err-header__title { font-size: 1.65rem; font-weight: 800; color: #0f172a; margin: 0 0 0.4rem; letter-spacing: -0.025em; line-height: 1.15; }
.err-header__desc { font-size: 0.875rem; color: #475569; margin: 0; line-height: 1.5; max-width: 58rem; }
.err-header__actions { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }

.err-timer-badge { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.65rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 0.45rem; font-size: 0.75rem; font-weight: 600; color: #475569; }

/* Grid de KPIs de Errores */
.err-kpis-grid { display: grid; grid-template-columns: 1fr; gap: 0.85rem; margin-bottom: 1.5rem; }
@media (min-width: 44rem) {
    .err-kpis-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 72rem) {
    .err-kpis-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.err-kpi-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.75rem; padding: 1.15rem; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03); min-height: 8.5rem; transition: border-color 0.15s, box-shadow 0.15s; }
.err-kpi-card:hover { border-color: #cbd5e1; box-shadow: 0 3px 8px rgba(15, 23, 42, 0.04); }
.err-kpi-card--hero { border-left: 4px solid #0f2744; }
.err-kpi-card--crit { border-left: 4px solid #ef4444; }
.err-kpi-card--clean { border-left: 4px solid #10b981; }

.err-kpi-card__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.65rem; }
.err-kpi-card__label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; }
.err-kpi-card__icon { width: 34px; height: 34px; border-radius: 0.5rem; display: grid; place-items: center; flex-shrink: 0; }
.err-kpi-card__icon--navy { background: #0f2744; color: #ffffff; }
.err-kpi-card__icon--red { background: #fee2e2; color: #dc2626; }
.err-kpi-card__icon--green { background: #dcfce7; color: #16a34a; }
.err-kpi-card__icon--slate { background: #f1f5f9; color: #475569; }

.err-kpi-card__body { display: flex; flex-direction: column; gap: 0.35rem; }
.err-kpi-card__val-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.err-kpi-card__value { font-size: 1.85rem; font-weight: 800; color: #0f172a; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.err-kpi-card__unit { font-size: 0.85rem; font-weight: 600; color: #64748b; }
.err-kpi-card__subtext { font-size: 0.75rem; color: #64748b; margin: 0; line-height: 1.35; }

.err-quicklist { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.35rem; }
.err-quick-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.55rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 0.4rem; font-size: 0.72rem; font-weight: 600; color: #334155; text-decoration: none; transition: all 0.15s; }
.err-quick-chip:hover { background: #e2e8f0; color: #0f172a; border-color: #cbd5e1; }
.err-quick-chip__dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.err-quick-chip__dot--clean { background: #10b981; }
.err-quick-chip__dot--warn { background: #f59e0b; }
.err-quick-chip__dot--crit { background: #ef4444; }
.err-quick-chip__dot--down { background: #64748b; }
.err-quick-chip__count { font-size: 0.68rem; padding: 0.05rem 0.3rem; border-radius: 999px; background: #e2e8f0; color: #1e293b; font-weight: 700; }
.err-quick-chip__count--warn { background: #fef3c7; color: #92400e; }
.err-quick-chip__count--crit { background: #fee2e2; color: #991b1b; }

/* Barra de Filtros y Búsqueda en Vivo */
.err-toolbar-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.75rem; padding: 1rem 1.25rem; margin-bottom: 1.5rem; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03); }
.err-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.err-toolbar__form { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; flex: 1 1 30rem; }
.err-toolbar__field { display: flex; align-items: center; gap: 0.5rem; }
.err-toolbar__label { font-size: 0.78rem; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; display: flex; align-items: center; gap: 0.3rem; }
.err-toolbar__select { padding: 0.45rem 1.8rem 0.45rem 0.75rem; font-size: 0.8125rem; font-weight: 500; border: 1px solid #cbd5e1; border-radius: 0.5rem; background: #ffffff; color: #1e293b; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; outline: none; }
.err-toolbar__select:focus { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15); }

.err-toolbar__search-wrap { position: relative; flex: 1 1 18rem; min-width: 14rem; }
.err-toolbar__search-icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.err-toolbar__search-input { width: 100%; padding: 0.45rem 2.2rem 0.45rem 2.25rem; font-size: 0.8125rem; border: 1px solid #cbd5e1; border-radius: 0.5rem; background: #f8fafc; color: #1e293b; outline: none; transition: all 0.15s; }
.err-toolbar__search-input:focus { background: #ffffff; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15); }
.err-toolbar__search-clear { position: absolute; right: 0.6rem; top: 50%; transform: translateY(-50%); border: none; background: transparent; color: #94a3b8; cursor: pointer; padding: 0.2rem; font-size: 0.85rem; line-height: 1; border-radius: 50%; display: none; }
.err-toolbar__search-clear:hover { color: #0f172a; }

.err-toolbar__actions { display: flex; align-items: center; gap: 0.5rem; }

/* Contenedor de Portales */
.err-portals-container { display: flex; flex-direction: column; gap: 1.5rem; margin-bottom: 2.5rem; }
.err-portal-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.85rem; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03); overflow: hidden; transition: border-color 0.2s; }
.err-portal-card--ok { border-left: 4px solid #10b981; }
.err-portal-card--warn { border-left: 4px solid #f59e0b; }
.err-portal-card--crit { border-left: 4px solid #ef4444; }
.err-portal-card--down { border-left: 4px solid #64748b; }

.err-portal-card__head { display: flex; justify-content: space-between; align-items: center; padding: 1.15rem 1.4rem; background: #ffffff; border-bottom: 1px solid #f1f5f9; flex-wrap: wrap; gap: 0.75rem; }
.err-portal-card__title-area { display: flex; align-items: center; gap: 0.85rem; }

.err-portal-badge-avatar { width: 42px; height: 42px; border-radius: 0.6rem; display: grid; place-items: center; flex-shrink: 0; background: #e0f2fe; color: #0284c7; }
.err-portal-badge-avatar--food { background: #ffedd5; color: #ea580c; }
.err-portal-badge-avatar--seller { background: #dcfce7; color: #16a34a; }
.err-portal-badge-avatar--services { background: #f3e8ff; color: #9333ea; }
.err-portal-badge-avatar--erp { background: #e0f2fe; color: #2563eb; }
.err-portal-badge-avatar--admin { background: #0f2744; color: #ffffff; }
.err-portal-badge-avatar--customer { background: #ccfbf1; color: #0d9488; }

.err-portal-card__title-row { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.err-portal-card__name { font-size: 1.15rem; font-weight: 700; color: #0f172a; margin: 0; letter-spacing: -0.01em; }
.err-portal-card__sub { font-size: 0.76rem; color: #64748b; margin: 0.15rem 0 0; }
.err-portal-card__sub code { font-size: 0.72rem; padding: 0.1rem 0.35rem; background: #f1f5f9; border-radius: 0.25rem; font-family: monospace; }

.err-portal-card__head-actions { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }

.err-portal-card__body { padding: 1.25rem 1.4rem; }

/* Estado vacío de portal sin errores */
.err-portal-empty { display: flex; align-items: center; gap: 1.15rem; padding: 1.5rem 1.75rem; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 0.65rem; }
.err-portal-empty__icon { width: 42px; height: 42px; border-radius: 50%; background: #dcfce7; color: #16a34a; display: grid; place-items: center; flex-shrink: 0; }
.err-portal-empty__title { font-size: 0.95rem; font-weight: 700; color: #166534; margin: 0 0 0.2rem; }
.err-portal-empty__desc { font-size: 0.8125rem; color: #15803d; margin: 0; line-height: 1.4; }

/* Barra de Actividad y Sparkline */
.err-activity-bar { display: flex; justify-content: space-between; align-items: center; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 0.65rem; padding: 0.85rem 1.15rem; margin-bottom: 1.15rem; flex-wrap: wrap; gap: 1rem; }
.err-activity-bar__spark { display: flex; align-items: center; gap: 1rem; flex: 1 1 20rem; min-width: 0; }
.err-sparkline-box { display: flex; flex-direction: column; gap: 0.3rem; min-width: 14rem; flex: 1; max-width: 22rem; }
.err-sparkline-box .sparkline { width: 100%; height: 38px; color: #2563eb; }
.err-sparkline-meta { display: flex; justify-content: space-between; font-size: 0.68rem; font-weight: 600; color: #64748b; }

.err-activity-bar__summary { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.err-level-pill { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.6rem; border-radius: 0.4rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }
.err-level-pill--crit { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.err-level-pill--error { background: #ffedd5; color: #9a3412; border: 1px solid #fed7aa; }
.err-level-pill--warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.err-level-pill--info { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.err-level-pill--count { font-weight: 800; font-size: 0.75rem; }

/* Tabla de Excepciones */
.err-table-wrap { border: 1px solid #e2e8f0; border-radius: 0.65rem; overflow: hidden; background: #ffffff; }
.err-table { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; }
.err-table thead th { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #475569; background: #f8fafc; padding: 0.75rem 0.95rem; border-bottom: 1px solid #e2e8f0; border-top: none; }
.err-table tbody tr.err-row { transition: background 0.15s; }
.err-table tbody tr.err-row:hover { background: #f8fafc; }
.err-table tbody td { padding: 0.75rem 0.95rem; border-bottom: 1px solid #f1f5f9; font-size: 0.8125rem; vertical-align: middle; }

/* Celdas específicas */
.err-cell-level { display: flex; flex-direction: column; gap: 0.25rem; align-items: flex-start; }
.err-badge-level { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.45rem; border-radius: 0.35rem; font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; }
.err-badge-level--crit { background: #fee2e2; color: #b91c1c; }
.err-badge-level--error { background: #fff1f2; color: #be123c; }
.err-badge-level--warn { background: #fef3c7; color: #b45309; }
.err-badge-level--info { background: #f1f5f9; color: #475569; }

.err-badge-http { display: inline-flex; align-items: center; padding: 0.1rem 0.35rem; border-radius: 0.3rem; font-size: 0.68rem; font-weight: 700; font-family: monospace; }
.err-badge-http--5xx { background: #fee2e2; color: #991b1b; }
.err-badge-http--4xx { background: #fef3c7; color: #92400e; }
.err-badge-http--other { background: #e2e8f0; color: #334155; }

.err-cell-class { max-width: 22rem; min-width: 14rem; }
.err-class-row { display: flex; align-items: center; gap: 0.4rem; justify-content: space-between; }
.err-class-code { font-size: 0.8125rem; font-weight: 700; color: #0f172a; background: #f1f5f9; padding: 0.2rem 0.45rem; border-radius: 0.35rem; border: 1px solid #e2e8f0; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; word-break: break-all; }

.err-btn-copy { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 1px solid #cbd5e1; border-radius: 0.35rem; background: #ffffff; color: #64748b; cursor: pointer; transition: all 0.15s; flex-shrink: 0; padding: 0; }
.err-btn-copy:hover { background: #f1f5f9; color: #0f172a; border-color: #94a3b8; }
.err-btn-copy--copied { background: #dcfce7 !important; color: #16a34a !important; border-color: #86efac !important; }

.err-cell-location { max-width: 18rem; min-width: 10rem; }
.err-loc-row { display: flex; align-items: baseline; gap: 0.35rem; flex-wrap: wrap; }
.err-loc-file { font-size: 0.8125rem; font-weight: 700; color: #1e293b; font-family: monospace; }
.err-loc-line { font-size: 0.72rem; font-weight: 800; color: #2563eb; background: #eff6ff; padding: 0.1rem 0.35rem; border-radius: 0.25rem; font-family: monospace; }
.err-loc-dir { font-size: 0.72rem; color: #94a3b8; display: block; font-family: monospace; word-break: break-all; }

.err-cell-route { font-family: monospace; font-size: 0.78rem; color: #334155; }
.err-route-code { background: #f8fafc; padding: 0.15rem 0.4rem; border-radius: 0.3rem; border: 1px solid #f1f5f9; word-break: break-all; }

.err-cell-count { text-align: right; min-width: 6.5rem; }
.err-count-num { font-size: 0.95rem; font-weight: 800; color: #0f172a; font-variant-numeric: tabular-nums; }
.err-meter-mini { width: 100%; height: 4px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin-top: 0.25rem; }
.err-meter-mini__fill { height: 100%; background: #2563eb; border-radius: 999px; }
.err-meter-mini__fill--crit { background: #ef4444; }

.err-cell-time { font-size: 0.78rem; min-width: 8.5rem; }
.err-time-relative { font-weight: 700; color: #1e293b; display: block; }
.err-time-first { font-size: 0.72rem; color: #64748b; margin-top: 0.1rem; display: block; }

.err-btn-details { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.65rem; font-size: 0.74rem; font-weight: 700; border: 1px solid #cbd5e1; border-radius: 0.4rem; background: #ffffff; color: #334155; cursor: pointer; transition: all 0.15s; white-space: nowrap; user-select: none; }
.err-btn-details:hover { background: #f8fafc; color: #0f172a; border-color: #94a3b8; }
.err-btn-details.is-open { background: #0f2744; color: #ffffff; border-color: #0f2744; }
.err-btn-details-icon { transition: transform 0.2s ease; display: inline-flex; }
.err-btn-details.is-open .err-btn-details-icon { transform: rotate(180deg); }

/* Fila de detalles expandible */
.err-details-row { display: none; background: #f8fafc; }
.err-details-row.is-open { display: table-row !important; }
.err-details-cell { padding: 1rem 1.4rem !important; border-bottom: 2px solid #e2e8f0 !important; }
.err-details-panel { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.65rem; padding: 1.15rem 1.25rem; box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.02); }

.err-details-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (min-width: 48rem) {
    .err-details-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 72rem) {
    .err-details-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.err-details-item { display: flex; flex-direction: column; gap: 0.2rem; }
.err-details-label { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; }
.err-details-val { font-size: 0.8125rem; color: #0f172a; font-weight: 600; display: flex; align-items: center; gap: 0.4rem; }
.err-details-val code { font-family: monospace; font-size: 0.76rem; background: #f1f5f9; padding: 0.15rem 0.4rem; border-radius: 0.3rem; border: 1px solid #e2e8f0; }

.err-diagnostic-hint { display: flex; align-items: flex-start; gap: 0.65rem; padding: 0.75rem 0.95rem; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 0.5rem; font-size: 0.8rem; color: #1e40af; line-height: 1.45; }
.err-diagnostic-hint__icon { flex-shrink: 0; color: #2563eb; margin-top: 0.1rem; }
.err-diagnostic-hint strong { color: #1e3a8a; }

.err-no-results { display: none; text-align: center; padding: 2.5rem 1rem; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 0.65rem; color: #64748b; margin-top: 1rem; }
.err-no-results.is-visible { display: block !important; }

/* Utilidades CSP y Columnas para Tabla de Errores */
.err-col-severity { width: 14%; }
.err-col-class { width: 28%; }
.err-col-location { width: 25%; }
.err-col-route { width: 14%; }
.err-col-count { width: 8%; }
.err-col-time { width: 11%; }
.err-col-action { width: 8%; }

.err-offline-alert { display: flex; align-items: flex-start; gap: 0.85rem; padding: 1rem 1.15rem; border-radius: 0.6rem; }
.err-offline-alert__icon { flex-shrink: 0; color: #dc2626; margin-top: 0.15rem; }
.err-offline-alert__title { display: block; margin-bottom: 0.25rem; font-size: 0.95rem; color: #991b1b; }
.err-offline-alert__desc { margin: 0 0 0.35rem; font-size: 0.85rem; }

.err-no-results__title { margin: 0.5rem 0 0.25rem; font-weight: 600; font-size: 0.9rem; }
.err-quicklist-note { margin-top: 0.35rem; }
.err-clipboard-fallback { position: fixed; left: -9999px; top: 0; opacity: 0; pointer-events: none; }

.is-hidden { display: none !important; }
.err-toolbar__search-clear.is-active { display: block !important; }

.err-w-4 { width: 4%; }
.err-w-5 { width: 5%; }
.err-w-10 { width: 10%; }
.err-w-15 { width: 15%; }
.err-w-20 { width: 20%; }
.err-w-25 { width: 25%; }
.err-w-30 { width: 30%; }
.err-w-35 { width: 35%; }
.err-w-40 { width: 40%; }
.err-w-45 { width: 45%; }
.err-w-50 { width: 50%; }
.err-w-55 { width: 55%; }
.err-w-60 { width: 60%; }
.err-w-65 { width: 65%; }
.err-w-70 { width: 70%; }
.err-w-75 { width: 75%; }
.err-w-80 { width: 80%; }
.err-w-85 { width: 85%; }
.err-w-90 { width: 90%; }
.err-w-95 { width: 95%; }
.err-w-100 { width: 100%; }

/* ── Rediseño Profesional de Equipo y Roles ────────────────────────────────────── */
.section-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1.25rem; }
.section-toolbar__search-wrap { position: relative; flex: 1 1 18rem; max-width: 28rem; }
.section-toolbar__search-icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.section-toolbar__search-input { width: 100%; padding: 0.45rem 0.75rem 0.45rem 2.25rem; font-size: 0.8125rem; border: 1px solid #cbd5e1; border-radius: 0.5rem; background: #ffffff; color: #1e293b; outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.section-toolbar__search-input:focus { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15); }
.section-toolbar__filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }

.team-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; margin-bottom: 2rem; }
@media (min-width: 48rem) {
    .team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 76rem) {
    .team-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.member-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.85rem; padding: 1.25rem; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03); transition: border-color 0.15s, box-shadow 0.15s; position: relative; }
.member-card:hover { border-color: #94a3b8; box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06); }
.member-card--inactive { background: #fbfcfe; border-style: dashed; opacity: 0.85; }
.member-card--locked { border-color: #fca5a5; background: #fffdfd; }

.member-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.member-card__identity { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.member-card__avatar { width: 42px; height: 42px; border-radius: 50%; background: #0f2744; color: #ffffff; display: grid; place-items: center; font-weight: 700; font-size: 0.875rem; flex-shrink: 0; }
.member-card__avatar--off { background: #94a3b8; }
.member-card__avatar--locked { background: #ef4444; }
.member-card__name-box { min-width: 0; }
.member-card__name { font-size: 1rem; font-weight: 700; color: #0f172a; margin: 0; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-card__email { font-size: 0.78rem; color: #64748b; margin: 0.1rem 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-card__badges { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; flex-shrink: 0; }

.member-card__meta { background: #f8fafc; border: 1px solid #edf2f7; border-radius: 0.5rem; padding: 0.5rem 0.75rem; display: flex; align-items: center; justify-content: space-between; font-size: 0.72rem; color: #64748b; margin-bottom: 0.85rem; }
.member-card__meta-item { display: inline-flex; align-items: center; gap: 0.35rem; }

.member-card__roles-section { margin-bottom: 1rem; flex: 1; }
.member-card__roles-title { display: flex; align-items: center; justify-content: space-between; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; margin-bottom: 0.5rem; }
.member-card__roles-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.member-card__role-item { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.4rem 0.6rem; border-radius: 0.45rem; background: #f8fafc; border: 1px solid #e2e8f0; font-size: 0.78rem; transition: background 0.15s; }
.member-card__role-item:hover { background: #f1f5f9; }
.member-card__role-badge { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 600; color: #1e293b; min-width: 0; }
.member-card__role-portal { font-size: 0.68rem; font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 0.25rem; background: #e0f2fe; color: #0369a1; text-transform: uppercase; }
.member-card__role-portal--erp { background: #e0f2fe; color: #0284c7; }
.member-card__role-portal--seller { background: #dcfce7; color: #16a34a; }
.member-card__role-portal--services { background: #f3e8ff; color: #9333ea; }
.member-card__role-portal--food { background: #ffedd5; color: #ea580c; }
.member-card__role-portal--platform { background: #0f2744; color: #ffffff; }
.member-card__role-portal--customer { background: #ccfbf1; color: #0f766e; }

.member-card__role-actions { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.member-card__btn-revoke { background: transparent; border: 1px solid transparent; color: #dc2626; padding: 0.15rem 0.4rem; border-radius: 0.3rem; font-size: 0.7rem; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.member-card__btn-revoke:hover { background: #fee2e2; border-color: #fca5a5; }

.member-card__foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #f1f5f9; padding-top: 0.85rem; margin-top: auto; gap: 0.5rem; flex-wrap: wrap; }
.member-card__actions { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

/* Modales profesionales de confirmación y asignación */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(2px); z-index: 100; display: none; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.is-open { display: flex; }
.modal-box { background: #ffffff; border-radius: 0.85rem; width: 100%; max-width: 32rem; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04); overflow: hidden; animation: modalIn 0.18s ease-out; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
.modal-box__head { display: flex; align-items: center; justify-content: space-between; padding: 1.15rem 1.4rem; border-bottom: 1px solid #f1f5f9; background: #ffffff; }
.modal-box__title { font-size: 1.1rem; font-weight: 700; color: #0f172a; margin: 0; }
.modal-box__close { background: transparent; border: none; font-size: 1.25rem; color: #94a3b8; cursor: pointer; width: 28px; height: 28px; border-radius: 0.35rem; display: grid; place-items: center; }
.modal-box__close:hover { background: #f1f5f9; color: #0f172a; }
.modal-box__body { padding: 1.25rem 1.4rem; }
.modal-box__foot { display: flex; align-items: center; justify-content: flex-end; gap: 0.65rem; padding: 1rem 1.4rem; background: #f8fafc; border-top: 1px solid #e2e8f0; }

/* Tabla moderna de Roles */
.roles-table-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.85rem; overflow: hidden; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03); margin-bottom: 2rem; }
.roles-table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 1rem 1.25rem; background: #ffffff; border-bottom: 1px solid #f1f5f9; flex-wrap: wrap; }
.roles-table { width: 100%; border-collapse: collapse; margin: 0; font-size: 0.8125rem; }
.roles-table thead th { background: #f8fafc; color: #475569; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.75rem 1.15rem; border-bottom: 1px solid #e2e8f0; text-align: left; }
.roles-table tbody tr { transition: background 0.15s; border-bottom: 1px solid #f1f5f9; }
.roles-table tbody tr:hover { background: #f8fafc; }
.roles-table tbody td { padding: 0.85rem 1.15rem; vertical-align: middle; color: #1e293b; }
.roles-table tbody tr:last-child { border-bottom: none; }
.roles-portal-pill { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.18rem 0.55rem; border-radius: 0.35rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.roles-portal-pill--platform { background: #0f2744; color: #ffffff; }
.roles-portal-pill--erp { background: #e0f2fe; color: #0369a1; }
.roles-portal-pill--seller { background: #dcfce7; color: #15803d; }
.roles-portal-pill--services { background: #f3e8ff; color: #7e22ce; }
.roles-portal-pill--food { background: #ffedd5; color: #c2410c; }
.roles-portal-pill--customer { background: #ccfbf1; color: #0f766e; }

/* Formulario moderno de Roles y Permisos */
.role-editor-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.85rem; padding: 1.5rem; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03); margin-bottom: 2rem; }
.role-editor-section { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid #f1f5f9; }
.role-editor-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.role-portal-fieldset { border: 1px solid #e2e8f0; border-radius: 0.65rem; padding: 1.15rem; margin-bottom: 1.25rem; background: #fbfcfe; }
.role-portal-legend { font-size: 0.8125rem; font-weight: 700; color: #0f172a; padding: 0 0.45rem; display: flex; align-items: center; gap: 0.4rem; }
.permissions-grid { display: grid; grid-template-columns: 1fr; gap: 0.65rem; margin-top: 0.65rem; }
@media (min-width: 48rem) {
    .permissions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 72rem) {
    .permissions-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.permission-checkbox-card { display: flex; align-items: flex-start; gap: 0.65rem; padding: 0.65rem 0.8rem; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.5rem; cursor: pointer; transition: all 0.15s; }
.permission-checkbox-card:hover { border-color: #94a3b8; background: #f8fafc; }
.permission-checkbox-card:has(input:checked) { border-color: #2563eb; background: #eff6ff; }
.permission-checkbox-card input[type="checkbox"] { margin-top: 0.2rem; cursor: pointer; flex-shrink: 0; }
.permission-checkbox-body { min-width: 0; flex: 1; }
.permission-code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.76rem; font-weight: 700; color: #0f172a; background: #f1f5f9; padding: 0.1rem 0.35rem; border-radius: 0.25rem; display: inline-block; margin-bottom: 0.2rem; }
.permission-checkbox-card:has(input:checked) .permission-code { background: #dbeafe; color: #1e40af; }
.permission-desc { font-size: 0.72rem; color: #64748b; line-height: 1.35; display: block; }

/* ── Rediseño Profesional de Auditoría y Trazabilidad Forense ───────────────────── */
.audit-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1.25rem; margin-bottom: 1.5rem; }
.audit-header__main { flex: 1 1 24rem; min-width: 0; }
.audit-header__tag-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.35rem; }
.audit-header__eyebrow { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #64748b; }
.audit-header__title { font-size: 1.5rem; font-weight: 700; color: #0f172a; margin: 0 0 0.35rem; letter-spacing: -0.01em; }
.audit-header__desc { font-size: 0.84rem; color: #475569; margin: 0; line-height: 1.45; max-width: 54rem; }
.audit-header__actions { display: flex; align-items: center; gap: 0.65rem; flex-shrink: 0; }
.audit-header__btn { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 600; }

.audit-pulse { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0.55rem; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.audit-pulse__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.audit-pulse__dot--ok { background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2); }
.audit-pulse__dot--crit { background: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2); }
.audit-pulse__dot--blue { background: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2); }
.audit-pulse__label { color: #334155; }

/* Alertas de verificación de integridad */
.audit-alert { display: flex; align-items: flex-start; gap: 0.85rem; padding: 1.15rem 1.35rem; border-radius: 0.75rem; margin-bottom: 1.5rem; border: 1px solid transparent; animation: modalIn 0.2s ease-out; }
.audit-alert--ok { background: #f0fdf4; border-color: #86efac; color: #166534; }
.audit-alert--ok .audit-alert__title { color: #14532d; }
.audit-alert--ok .audit-alert__icon { color: #16a34a; }
.audit-alert--error { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.audit-alert--error .audit-alert__title { color: #7f1d1d; }
.audit-alert--error .audit-alert__icon { color: #dc2626; }
.audit-alert__icon { flex-shrink: 0; margin-top: 0.15rem; }
.audit-alert__content { flex: 1; min-width: 0; }
.audit-alert__title { font-size: 0.95rem; font-weight: 700; margin: 0 0 0.25rem; }
.audit-alert__desc { font-size: 0.8125rem; margin: 0; line-height: 1.45; }

/* Grid de KPIs */
.audit-kpis-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1.5rem; }
@media (min-width: 40rem) { .audit-kpis-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 64rem) { .audit-kpis-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.audit-kpi-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.75rem; padding: 1.15rem 1.25rem; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03); display: flex; flex-direction: column; justify-content: space-between; }
.audit-kpi-card--hero { border-left: 4px solid #2563eb; }
.audit-kpi-card--warn { border-left: 4px solid #d97706; background: #fffdfa; }
.audit-kpi-card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.65rem; }
.audit-kpi-card__label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; }
.audit-kpi-card__icon { width: 34px; height: 34px; border-radius: 0.5rem; display: grid; place-items: center; flex-shrink: 0; }
.audit-kpi-card__icon--blue { background: #eff6ff; color: #2563eb; }
.audit-kpi-card__icon--green { background: #f0fdf4; color: #16a34a; }
.audit-kpi-card__icon--amber { background: #fef3c7; color: #d97706; }
.audit-kpi-card__icon--purple { background: #f5f3ff; color: #7c3aed; }
.audit-kpi-card__icon--slate { background: #f1f5f9; color: #64748b; }
.audit-kpi-card__val-row { display: flex; align-items: baseline; gap: 0.65rem; margin-bottom: 0.25rem; flex-wrap: wrap; }
.audit-kpi-card__value { font-size: 1.65rem; font-weight: 800; color: #0f172a; font-variant-numeric: tabular-nums; line-height: 1.1; }
.audit-kpi-card__unit { font-size: 0.8125rem; font-weight: 600; color: #64748b; }
.audit-kpi-card__subtext { font-size: 0.74rem; color: #64748b; margin: 0; line-height: 1.35; }

/* Tarjeta y formulario de filtros */
.audit-filter-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.75rem; padding: 1.15rem 1.25rem; margin-bottom: 1.5rem; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03); }
.audit-filter-form { display: flex; flex-direction: column; gap: 1rem; }
.audit-filter-row { display: grid; grid-template-columns: 1fr; gap: 0.85rem; align-items: flex-end; }
@media (min-width: 48rem) { .audit-filter-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 72rem) { .audit-filter-row { grid-template-columns: 2fr 1.2fr 1fr 1fr 1fr 1fr; } }

.audit-field { display: flex; flex-direction: column; gap: 0.35rem; }
.audit-field__label { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.74rem; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: 0.03em; }
.audit-input, .audit-select { width: 100%; padding: 0.45rem 0.65rem; font-size: 0.8125rem; border: 1px solid #cbd5e1; border-radius: 0.45rem; background: #ffffff; color: #1e293b; outline: none; transition: all 0.15s; }
.audit-input:focus, .audit-select:focus { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15); }
.audit-filter-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.65rem; flex-wrap: wrap; padding-top: 0.25rem; }
.audit-btn-filter { display: inline-flex; align-items: center; gap: 0.4rem; background: #1d4ed8; color: #ffffff; font-weight: 600; padding: 0.45rem 1rem; border-radius: 0.45rem; font-size: 0.8125rem; }
.audit-btn-clear { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8125rem; }

/* Tabla de Auditoría */
.audit-table-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.75rem; overflow: hidden; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03); margin-bottom: 2rem; }
.audit-table-card__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.35rem; background: #ffffff; border-bottom: 1px solid #f1f5f9; flex-wrap: wrap; }
.audit-table-card__title-row { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.audit-table-card__title { font-size: 1.05rem; font-weight: 700; color: #0f172a; margin: 0; }
.audit-table-card__counter { font-size: 0.76rem; color: #64748b; }
.audit-table-card__hints { display: flex; align-items: center; gap: 0.75rem; }
.audit-hint-chip { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; color: #64748b; font-weight: 600; }
.audit-hint-chip__dot { width: 6px; height: 6px; border-radius: 50%; }
.audit-hint-chip__dot--ok { background: #16a34a; }
.audit-hint-chip__dot--warn { background: #d97706; }
.audit-hint-chip__dot--off { background: #dc2626; }

.audit-table-wrap { overflow-x: auto; }
.audit-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0; }
.audit-table thead th { background: #f8fafc; color: #475569; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.75rem 1rem; border-bottom: 1px solid #e2e8f0; text-align: left; }
.audit-table tbody tr.audit-row { transition: background 0.15s; }
.audit-table tbody tr.audit-row:hover { background: #f8fafc; }
.audit-table tbody td { padding: 0.75rem 1rem; border-bottom: 1px solid #f1f5f9; font-size: 0.8125rem; vertical-align: middle; }

/* Columnas de la tabla */
.audit-col-time { width: 14%; }
.audit-col-actor { width: 22%; }
.audit-col-action { width: 18%; }
.audit-col-entity { width: 18%; }
.audit-col-result { width: 10%; }
.audit-col-reason { width: 12%; }
.audit-col-details { width: 6%; text-align: right; }

.audit-cell-time { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.audit-time-main { display: block; font-weight: 700; color: #1e293b; font-size: 0.8125rem; }
.audit-time-sub { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; color: #64748b; margin-top: 0.15rem; }

/* Actor Box */
.audit-actor-box { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.audit-actor-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 0.78rem; flex-shrink: 0; }
.audit-actor-avatar--user { background: #0f2744; color: #ffffff; }
.audit-actor-avatar--system { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }
.audit-actor-info { min-width: 0; }
.audit-actor-name { display: block; font-size: 0.84rem; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-actor-email { display: block; font-size: 0.72rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-actor-ip { display: block; margin-top: 0.15rem; font-size: 0.68rem; color: #94a3b8; }
.audit-actor-ip code { font-family: monospace; }

/* Acción */
.audit-action-chip { display: inline-flex; align-items: center; gap: 0.35rem; }
.audit-action-icon { color: #2563eb; flex-shrink: 0; }
.audit-action-text { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.78rem; font-weight: 700; color: #0f172a; background: #f1f5f9; padding: 0.15rem 0.45rem; border-radius: 0.35rem; border: 1px solid #e2e8f0; }
.audit-portal-tag { display: inline-block; font-size: 0.65rem; font-weight: 800; background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; padding: 0.1rem 0.35rem; border-radius: 0.25rem; margin-top: 0.2rem; }

/* Entidad */
.audit-entity-box { display: flex; flex-direction: column; gap: 0.2rem; }
.audit-entity-type { font-size: 0.72rem; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: 0.03em; }
.audit-entity-id { font-family: monospace; font-size: 0.75rem; color: #1e293b; background: #f8fafc; padding: 0.1rem 0.35rem; border-radius: 0.25rem; border: 1px solid #e2e8f0; display: inline-block; word-break: break-all; }

/* Motivo */
.audit-reason-text { font-size: 0.78rem; color: #334155; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Botón expandir */
.audit-btn-expand { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.3rem 0.6rem; font-size: 0.74rem; font-weight: 700; border: 1px solid #cbd5e1; border-radius: 0.4rem; background: #ffffff; color: #334155; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.audit-btn-expand:hover { background: #f8fafc; border-color: #94a3b8; color: #0f172a; }
.audit-btn-expand.is-open { background: #0f2744; color: #ffffff; border-color: #0f2744; }
.audit-btn-expand__icon { display: inline-flex; transition: transform 0.2s ease; }
.audit-btn-expand.is-open .audit-btn-expand__icon { transform: rotate(180deg); }

/* Fila de detalle forense */
.audit-detail-row { display: none; background: #f8fafc; }
.audit-detail-row.is-open { display: table-row !important; }
.audit-detail-cell { padding: 1.15rem 1.5rem !important; border-bottom: 2px solid #e2e8f0 !important; }
.audit-detail-panel { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 0.65rem; padding: 1.25rem; box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.02); }

.audit-detail-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1.15rem; }
@media (min-width: 48rem) { .audit-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 72rem) { .audit-detail-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.audit-detail-item { display: flex; flex-direction: column; gap: 0.25rem; }
.audit-detail-label { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; }
.audit-detail-val { font-size: 0.8125rem; color: #0f172a; font-weight: 600; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.audit-detail-val code { font-family: monospace; font-size: 0.76rem; background: #f1f5f9; padding: 0.15rem 0.4rem; border-radius: 0.3rem; border: 1px solid #e2e8f0; }

.audit-roles-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.audit-role-tag { font-size: 0.68rem; font-weight: 700; background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; padding: 0.1rem 0.4rem; border-radius: 0.25rem; }

/* Cadena Criptográfica Forense */
.audit-hash-chain { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 0.55rem; padding: 0.85rem 1rem; margin-bottom: 1rem; }
.audit-hash-chain__title { display: flex; align-items: center; gap: 0.45rem; font-size: 0.76rem; font-weight: 800; color: #1e293b; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 0.65rem; }
.audit-hash-chain__boxes { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.audit-hash-box { flex: 1 1 16rem; background: #ffffff; border: 1px solid #cbd5e1; border-radius: 0.45rem; padding: 0.55rem 0.75rem; display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.audit-hash-box--current { border-color: #93c5fd; background: #eff6ff; }
.audit-hash-box__label { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; color: #64748b; }
.audit-hash-box--current .audit-hash-box__label { color: #1d4ed8; }
.audit-hash-box__code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.72rem; color: #1e293b; word-break: break-all; }
.audit-hash-arrow { color: #94a3b8; display: grid; place-items: center; flex-shrink: 0; }

/* Meta JSON */
.audit-meta-section { margin-top: 0.85rem; }
.audit-meta-json { background: #0f172a; color: #e2e8f0; padding: 0.85rem 1rem; border-radius: 0.5rem; font-family: monospace; font-size: 0.75rem; overflow-x: auto; margin: 0.35rem 0 0; max-height: 16rem; }

/* Empty state */
.audit-empty-state { text-align: center; padding: 3.5rem 1.5rem; color: #64748b; }
.audit-empty-state__icon { width: 54px; height: 54px; border-radius: 50%; background: #f1f5f9; color: #94a3b8; display: grid; place-items: center; margin: 0 auto 1rem; }
.audit-empty-state__title { font-size: 1.1rem; font-weight: 700; color: #0f172a; margin: 0 0 0.4rem; }
.audit-empty-state__desc { font-size: 0.84rem; margin: 0 auto 1.25rem; max-width: 28rem; line-height: 1.45; }
.audit-empty-state__btn { display: inline-block; }

/* Paginación */
.audit-pagination-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 1.35rem; background: #f8fafc; border-top: 1px solid #e2e8f0; flex-wrap: wrap; }
.audit-pagination-info { font-size: 0.78rem; color: #64748b; font-weight: 500; }
.audit-pagination-nav { display: flex; align-items: center; gap: 0.5rem; margin: 0; }

/* ── Tickets de soporte ─────────────────────────────────────────────────────────── */
.ticket-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.ticket-head h1 { margin: 0 0 var(--space-1); overflow-wrap: anywhere; }
.ticket-head p { margin: 0; }
.ticket-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.ticket-kpis { margin: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 40rem) { .ticket-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 64rem) { .ticket-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.ticket-kpis .kpi dd { font-size: 1.25rem; }
.ticket-filters { display: grid; gap: var(--space-3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ticket-filters__q, .ticket-filters__actions { grid-column: 1 / -1; }
.ticket-filters .field { margin-bottom: 0; }
.ticket-filters__actions { align-items: end; }
@media (min-width: 40rem) { .ticket-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 64rem) { .ticket-filters { grid-template-columns: minmax(0, 2fr) repeat(5, minmax(0, 1fr)) auto; } .ticket-filters__q, .ticket-filters__actions { grid-column: auto; } }
.ticket-title { max-width: 32rem; overflow-wrap: anywhere; }
.ticket-form { max-width: 44rem; }
.ticket-layout { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 64rem) { .ticket-layout { grid-template-columns: minmax(0, 1fr) 22rem; } }
.ticket-main, .ticket-side { min-width: 0; }
.ticket-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.ticket-shots { list-style: none; margin: var(--space-4) 0 0; padding: 0; display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); }
.ticket-shots a { display: block; border: 1px solid var(--color-border); border-radius: var(--radius-control); overflow: hidden; background: var(--color-surface-alt); }
.ticket-shots img { display: block; width: 100%; height: 8rem; object-fit: cover; }
.ticket-thread { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: grid; gap: var(--space-3); }
.ticket-msg { padding: var(--space-3) var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface); }
.ticket-msg--reporter { background: var(--color-surface-alt); }
.ticket-msg--admin { border-left: 4px solid var(--color-action); }
.ticket-msg--internal { background: var(--color-warning-bg); border-left-color: var(--color-warning); }
.ticket-msg__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-2); font-size: 0.875rem; }
.ticket-reply { border-top: 1px solid var(--color-border); padding-top: var(--space-4); }
.ticket-inline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2); align-items: end; margin-bottom: var(--space-3); }
.ticket-inline .field { margin-bottom: 0; }
.ticket-facts { margin: 0; grid-template-columns: minmax(0, 1fr); }
.ticket-history { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.ticket-history li { padding-left: var(--space-3); border-left: 3px solid var(--color-border); }
/* Reporte de conducta: evidencia de la conversación (ET Reportes y bloqueos). */
.ticket-subtitle { margin: var(--space-4) 0 var(--space-2); font-size: 0.875rem; }
.ticket-evidence { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.ticket-evidence__item { max-width: 85%; padding: var(--space-2) var(--space-3); border-radius: 12px; background: var(--color-surface-2, #f1f5f9); }
.ticket-evidence__item--business { justify-self: end; background: #e8f0fe; }
.ticket-evidence__item p { margin: var(--space-1) 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ticket-evidence__who { font-size: 0.75rem; color: var(--color-muted); }
