/* ==========================================================================
   Tablero de Dirección — hoja de estilos principal
   Tokens primero (claro / oscuro), luego layout, componentes y gráficas.
   ========================================================================== */

:root {
  color-scheme: light;
  --bg:          #f3f5f4;
  --surface:     #ffffff;
  --surface-2:   #f7f9f8;
  --ink:         #16201c;
  --ink-2:       #4b5752;
  --muted:       #75807b;
  --line:        #dde3e0;
  --line-strong: #c5cdc9;

  --sidebar:     #0f3d33;
  --sidebar-ink: #d8e6df;
  --sidebar-dim: #8fb0a3;
  --sidebar-act: #1c5546;

  --accent:      #0f6b52;
  --accent-ink:  #ffffff;
  --accent-soft: #e2f0ea;

  /* Series de gráficas (paleta validada para daltonismo) */
  --series-1:    #2a78d6;
  --series-2:    #eb6834;
  --series-prev: #a9b3ae;
  --grid:        #e8ecea;
  /* Rampa ordinal (antigüedad de saldos): más oscuro = más viejo */
  --age-1:#86b6ef; --age-2:#5598e7; --age-3:#2a78d6; --age-4:#1c5cab; --age-5:#104281;

  /* Estados: siempre con icono + texto, nunca solo color */
  --good:        #0ca30c;
  --good-ink:    #006300;
  --warning:     #fab219;
  --warning-ink: #8a5a00;
  --critical:    #d03b3b;
  --critical-ink:#b12a2a;

  --radius-lg: 14px;
  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 1px 2px rgba(22, 32, 28, .06);
  --font: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:#111513; --surface:#1a1f1d; --surface-2:#151a18; --ink:#ecf1ee; --ink-2:#b8c3be;
    --muted:#8c9893; --line:#2b3330; --line-strong:#3a4440;
    --sidebar:#0b2620; --sidebar-ink:#d8e6df; --sidebar-dim:#7fa094; --sidebar-act:#173f35;
    --accent:#3fb58c; --accent-ink:#06231a; --accent-soft:#183a30;
    --series-1:#3987e5; --series-2:#d95926; --series-prev:#5d6763; --grid:#252c29;
    --age-1:#256abf; --age-2:#3987e5; --age-3:#5598e7; --age-4:#86b6ef; --age-5:#b7d3f6;
    --good-ink:#5fd35f; --warning-ink:#fab219; --critical-ink:#ef7a7a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:#111513; --surface:#1a1f1d; --surface-2:#151a18; --ink:#ecf1ee; --ink-2:#b8c3be;
  --muted:#8c9893; --line:#2b3330; --line-strong:#3a4440;
  --sidebar:#0b2620; --sidebar-ink:#d8e6df; --sidebar-dim:#7fa094; --sidebar-act:#173f35;
  --accent:#3fb58c; --accent-ink:#06231a; --accent-soft:#183a30;
  --series-1:#3987e5; --series-2:#d95926; --series-prev:#5d6763; --grid:#252c29;
  --age-1:#256abf; --age-2:#3987e5; --age-3:#5598e7; --age-4:#86b6ef; --age-5:#b7d3f6;
  --good-ink:#5fd35f; --warning-ink:#fab219; --critical-ink:#ef7a7a;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.num, td.num, .kpi-value { font-variant-numeric: tabular-nums; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-ink);
  display: flex; flex-direction: column; padding: 20px 14px; gap: 24px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  background: var(--sidebar-act); color: #9fe0c4;
}
.brand strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.brand small { display: block; color: var(--sidebar-dim); font-size: 12.5px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-bottom { margin-top: auto; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px;
  color: var(--sidebar-ink); text-decoration: none; font-weight: 500; font-size: 14.5px;
}
.nav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; opacity: .8; }
.nav a:hover { background: rgba(255,255,255,.06); }
.nav a.active { background: var(--sidebar-act); color: #fff; }
.nav a.active svg { opacity: 1; color: #9fe0c4; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 28px;
  border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 19px; margin: 0; font-weight: 600; letter-spacing: -.015em; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.source-badge {
  font-size: 12.5px; font-weight: 500; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.source-badge.live { background: var(--accent); color: var(--accent-ink); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.icon-btn:hover { background: var(--surface-2); }
.menu-btn { display: none; }

.content { padding: 24px 28px 48px; max-width: 1440px; width: 100%; }
.content:focus { outline: none; }

/* ---------- Toolbar de filtros (siempre una fila arriba del contenido) ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 20px; }
.toolbar .spacer { flex: 1; }
.segmented {
  display: inline-flex; background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; padding: 3px; gap: 2px;
}
.segmented button {
  border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 13.5px;
  font-weight: 500; padding: 6px 12px; border-radius: 6px; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
input[type="text"], input[type="search"], input[type="date"], input[type="url"], input[type="password"], select, textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 11px; min-height: 38px;
}
input[type="search"] { min-width: 240px; }
textarea { font-family: ui-monospace, Consolas, monospace; font-size: 13px; resize: vertical; }
.btn {
  font: inherit; font-size: 14px; font-weight: 600; border-radius: 8px; padding: 8px 14px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px; min-height: 38px;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ---------- Paneles ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); min-width: 0;
}
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 16px 20px 4px; }
.panel-head h2 { font-size: 15.5px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.panel-head .sub { color: var(--muted); font-size: 13px; }
.panel-head .right { margin-left: auto; }
.panel-body { padding: 12px 20px 18px; }
.panel-body.flush { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid-dash { grid-template-columns: repeat(12, 1fr); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; }
.span-6 { grid-column: span 6; } .span-4 { grid-column: span 4; }

/* ---------- KPI: el de ventas es el protagonista ---------- */
.kpis { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.kpis.kpis-4 { grid-template-columns: repeat(4, 1fr); }
.kpi { padding: 18px 20px; }
.kpi-label { font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
.kpi-value { font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; margin-top: 4px; }
.kpi-hero .kpi-value { font-size: 40px; }
.kpi-foot { font-size: 13px; color: var(--muted); margin-top: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.delta { font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.delta.up { color: var(--good-ink); }
.delta.down { color: var(--critical-ink); }
.meta-bar { height: 8px; border-radius: 99px; background: var(--grid); margin-top: 14px; overflow: hidden; }
.meta-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-weight: 600; color: var(--ink-2); font-size: 13px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2);
  position: sticky; top: 0; white-space: nowrap; cursor: pointer; user-select: none;
}
table.data th.num, table.data td.num { text-align: right; }
table.data th[aria-sort="ascending"]::after { content: " ▲"; font-size: 10px; }
table.data th[aria-sort="descending"]::after { content: " ▼"; font-size: 10px; }
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.selected { background: var(--accent-soft); }
table.data tfoot td { font-weight: 600; background: var(--surface-2); border-bottom: 0; }
.cell-sub { display: block; font-size: 12.5px; color: var(--muted); }
.table-foot { display: flex; align-items: center; gap: 10px; padding: 10px 16px; font-size: 13px; color: var(--muted); }
.table-foot .spacer { flex: 1; }

/* ---------- Chips de estado (icono + texto) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600;
  padding: 2px 9px 2px 7px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2);
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.chip.good { color: var(--good-ink); } .chip.good::before { background: var(--good); }
.chip.warning { color: var(--warning-ink); } .chip.warning::before { background: var(--warning); }
.chip.critical { color: var(--critical-ink); } .chip.critical::before { background: var(--critical); }

/* ---------- Listas tipo ranking ---------- */
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 8px 0; }
.rank li + li { border-top: 1px solid var(--line); }
.rank .name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .val { font-size: 14px; font-weight: 600; text-align: right; }
.rank .bar { grid-column: 1 / -1; height: 6px; background: var(--grid); border-radius: 99px; overflow: hidden; }
.rank .bar span { display: block; height: 100%; background: var(--series-1); border-radius: 99px; }

/* ---------- Gráficas ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 11.5px; font-family: var(--font); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--line-strong); stroke-width: 1; }
.chart .crosshair { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.dashed { background: repeating-linear-gradient(90deg, var(--series-prev) 0 4px, transparent 4px 7px) !important; }

.tooltip {
  position: fixed; z-index: 50; pointer-events: none; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 11px; font-size: 13px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12); min-width: 140px;
}
.tooltip .t-title { font-weight: 600; margin-bottom: 4px; }
.tooltip .t-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tooltip .t-row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tooltip .t-row b { font-variant-numeric: tabular-nums; }
.tooltip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ---------- Detalle lateral ---------- */
.split { display: block; }
.detail {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 30;
  border-radius: 0; border-width: 0 0 0 1px; overflow-y: auto;
  transform: translateX(100%); transition: transform .2s ease; visibility: hidden;
  box-shadow: -12px 0 40px rgba(0,0,0,.14);
}
.detail.open { transform: none; visibility: visible; }
.detail .panel-head { position: sticky; top: 0; background: var(--surface); padding-bottom: 12px; border-bottom: 1px solid var(--line); z-index: 1; }
.detail .panel-head.sub-head { position: static; border: 0; padding-bottom: 4px; }
.detail .panel-head { align-items: center; flex-wrap: nowrap; }
.detail .close-btn { margin-left: auto; width: 32px; height: 32px; flex: none; }
.detail .panel-head .right + .close-btn { margin-left: 8px; }
@media (prefers-reduced-motion: reduce) { .detail { transition: none; } }
.detail dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; font-size: 14px; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; font-weight: 500; text-align: right; }
.detail h3 { margin: 0 0 2px; font-size: 17px; }

/* ---------- Estados vacíos, carga, error ---------- */
.empty, .error-box { padding: 36px 20px; text-align: center; color: var(--ink-2); }
.empty strong, .error-box strong { display: block; color: var(--ink); margin-bottom: 4px; }
.error-box { color: var(--critical-ink); }
.skeleton {
  background: linear-gradient(90deg, var(--grid) 25%, var(--surface-2) 50%, var(--grid) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px;
}
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 60; background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; font-size: 14px; font-weight: 500;
}

/* ---------- Configuración ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.radio-card {
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 14px 16px; cursor: pointer;
  display: flex; gap: 10px; align-items: flex-start;
}
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card strong { display: block; font-size: 14.5px; }
.radio-card span { font-size: 13px; color: var(--ink-2); }
.test-result { font-size: 14px; margin-top: 10px; }
.endpoint-table td { white-space: normal; }
.endpoint-table input { width: 100%; min-height: 34px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

/* ---------- Dirección ---------- */
.flujo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.flujo span { display: block; font-size: 12.5px; color: var(--muted); }
.flujo b { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.rank-meta { font-weight: 400; color: var(--muted); font-size: 12.5px; margin-left: 4px; }
.rank .val .delta { font-size: 12.5px; margin-left: 6px; }

/* Gráfica de bala (agentes vs cuota) */
table.agentes td { vertical-align: middle; }
.bullet { position: relative; height: 16px; min-width: 160px; cursor: default; }
.bullet .track, .bullet .proj, .bullet .fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 0 4px 4px 0; }
.bullet .track { background: var(--grid); border-radius: 0; }
.bullet .goal { position: absolute; top: -3px; width: 3px; height: 22px; background: var(--muted); border-radius: 1px; transform: translateX(-1.5px); }
.bullet .proj {
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--series-1) 45%, transparent) 0 3px, transparent 3px 6px);
}
.bullet .fill { background: var(--series-1); }
.bullet .tick { position: absolute; top: -4px; width: 2px; height: 24px; background: var(--ink); border-radius: 1px; transform: translateX(-1px); }
.bullet-legend i.track-key { background: var(--grid); border-right: 3px solid var(--muted); height: 10px; border-radius: 0; }
.bullet-legend i.proj-key { height: 10px; background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--series-1) 55%, transparent) 0 3px, transparent 3px 6px); }
.bullet-legend i.tick-key { width: 2px; height: 14px; background: var(--ink); }

/* ---------- Inventario físico ---------- */
.if-actions { margin-top: -6px; }
.check-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check-inline input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
.hint { font-size: 12.5px; color: var(--muted); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.kpi-de { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.dif-mas { color: var(--good-ink); font-weight: 600; }
.dif-menos { color: var(--critical-ink); font-weight: 600; }
.dif-ok { color: var(--muted); }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 0 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); vertical-align: 1px; }
.tag-new { background: color-mix(in srgb, var(--warning) 22%, transparent); color: var(--warning-ink); }

table.if-table td { vertical-align: middle; }
table.if-table tr.if-prod td:first-child { box-shadow: inset 3px 0 0 transparent; }
table.if-table tr.if-prod.is-done td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
table.if-table tr.if-lote td { background: var(--surface-2); padding-top: 7px; padding-bottom: 7px; border-bottom-color: color-mix(in srgb, var(--line) 60%, transparent); }
table.if-table tr.if-lote td:nth-child(2) { padding-left: 34px; }
.lote-name { font-size: 13.5px; font-weight: 500; }
table.if-table input { font: inherit; font-size: 14px; text-align: right; min-height: 34px; padding: 5px 9px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-variant-numeric: tabular-nums; }
table.if-table .in-conteo { width: 96px; }
table.if-table .in-costo { width: 112px; }
table.if-table input.changed { border-color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, var(--surface)); }
table.if-table input.invalid { border-color: var(--critical); }
table.if-table input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.suma { font-weight: 600; padding-right: 10px; }
table.if-table.ciegas .col-crol { display: none; }
.if-kpis.ciegas .panel:not(:first-child) { display: none; }
.link-btn { border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 2px 0; }
.link-btn:hover { text-decoration: underline; }
.add-lote { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding-left: 22px; }
.add-lote input { text-align: left !important; width: auto !important; }
.add-lote .btn { min-height: 34px; padding: 5px 12px; font-size: 13px; }
.aviso { border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent); background: color-mix(in srgb, var(--warning) 9%, transparent); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; font-size: 14px; display: grid; gap: 6px; }
.radio-line { display: flex; gap: 8px; align-items: center; cursor: pointer; color: var(--ink-2); }
.radio-line input { accent-color: var(--accent); margin: 0; }
.btn-block { width: 100%; justify-content: center; }
.drawer-actions { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); }

/* ---------- Suite: pantalla de módulos ---------- */
.suite-page { min-height: 100vh; }
.suite-bar {
  background: var(--sidebar); color: var(--sidebar-ink);
  display: flex; align-items: center; gap: 16px; padding: 14px 28px;
}
.suite-bar .topbar-right { margin-left: auto; }
.suite-bar .icon-btn { background: transparent; border-color: rgba(255,255,255,.16); color: var(--sidebar-ink); }
.suite-bar .icon-btn:hover { background: rgba(255,255,255,.08); }
.suite-bar .user-menu { border-left-color: rgba(255,255,255,.16); }
.suite-bar .avatar { background: var(--sidebar-act); color: #9fe0c4; }
.suite-bar .user-info small { color: var(--sidebar-dim); }
.suite-main { max-width: 880px; margin: 0 auto; padding: 56px 24px; }
.suite-main h1 { font-size: 30px; letter-spacing: -.02em; margin: 0; }
.suite-sub { color: var(--ink-2); margin: 6px 0 28px; }
.suite-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.suite-card {
  display: flex; align-items: center; gap: 16px; padding: 22px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none;
  box-shadow: var(--shadow); transition: border-color .15s ease;
}
.suite-card:hover { border-color: var(--accent); }
.suite-icon { width: 52px; height: 52px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.suite-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.suite-card-body { display: grid; gap: 3px; flex: 1; }
.suite-card-body strong { font-size: 17px; }
.suite-card-body span { font-size: 14px; color: var(--ink-2); }
.suite-go svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; }
@media (max-width: 700px) {
  .suite-grid { grid-template-columns: 1fr; }
  .suite-main { padding: 32px 16px; }
  .suite-bar { padding: 12px 16px; }
  .suite-bar .user-info { display: none; }
}

/* ---------- Usuario en la barra superior ---------- */
.user-menu { display: flex; align-items: center; gap: 10px; padding-left: 12px; margin-left: 2px; border-left: 1px solid var(--line); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 700;
}
.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-info strong { font-size: 13.5px; font-weight: 600; }
.user-info small { font-size: 12px; color: var(--muted); }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .kpis, .kpis.kpis-4 { grid-template-columns: 1fr 1fr; }
  .span-8, .span-6, .span-4 { grid-column: span 12; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 40;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .menu-btn { display: grid; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px 16px 40px; }
  .kpis, .kpis.kpis-4 { grid-template-columns: 1fr; }
  .kpi-hero .kpi-value { font-size: 34px; }
  input[type="search"] { min-width: 0; width: 100%; }
  .form-grid, .radio-cards { grid-template-columns: 1fr; }
  .source-badge { display: none; }
  .user-info { display: none; }
  /* Agentes: de tabla a tarjetas */
  table.agentes thead { display: none; }
  table.agentes, table.agentes tbody, table.agentes tr { display: block; }
  table.agentes tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  table.agentes td { display: flex; justify-content: space-between; gap: 8px; padding: 0; border: 0; white-space: normal; font-size: 13.5px; }
  table.agentes td.agente { display: block; grid-column: 1; }
  table.agentes td.estado { grid-column: 2; grid-row: 1; justify-content: flex-end; align-items: flex-start; }
  table.agentes td.bullet-cell { grid-column: 1 / -1; display: block; padding: 6px 0; }
  table.agentes td[data-label]::before { content: attr(data-label); color: var(--muted); }
  .bullet { min-width: 0; }
  .user-menu { padding-left: 8px; }
  .panel-head .right { margin-left: 0; flex-basis: 100%; }
  .detail .panel-head .right { flex-basis: auto; margin-left: auto; }
}

/* ---------- Configuración: tarjeta de la empresa ---------- */
.emp-card { display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; gap: 20px 28px; align-items: start; }
@media (max-width: 820px) { .emp-card { grid-template-columns: 1fr; } }
.emp-head { display: flex; gap: 14px; align-items: center; }
.emp-avatar { flex: none; width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 20px; letter-spacing: .5px; }
.emp-id { min-width: 0; }
.emp-nombre { font-size: 18px; font-weight: 700; color: var(--ink); line-height: 1.2; overflow-wrap: anywhere; }
.emp-razon { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.emp-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.emp-tag { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.emp-tag b { color: var(--ink); font-weight: 600; letter-spacing: .3px; }
.emp-rfc { font-variant-numeric: tabular-nums; }
.emp-ok { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
.emp-datos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.emp-datos li.emp-full { grid-column: 1 / -1; }
@media (max-width: 560px) { .emp-datos { grid-template-columns: 1fr; } }
.emp-datos li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); min-width: 0; }
.emp-ico { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.emp-ico svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.emp-lbl { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.emp-val { display: block; font-size: 13.5px; color: var(--ink); line-height: 1.35; overflow-wrap: anywhere; margin-top: 1px; }

/* ---------- Plataforma en la nube ---------- */
.banda-ssc { background: color-mix(in srgb, var(--warning) 16%, transparent); border-bottom: 1px solid var(--line); padding: 8px 24px; font-size: 13.5px; }
.banda-ssc a { color: var(--accent); font-weight: 600; margin-left: 8px; }
.banda-ssc[hidden] { display: none; }
