/* ============================================================
   YiQi Design System — ds-styles.css
   Versión: DS v1.2.7
   Fecha: 04/06/2026
   Fuente canónica: yiqi-design-system.html
   ============================================================ */

/* ── 1. TOKENS BASE — DARK MODE (default) ─────────────────── */
:root {
  /* Tokens de componente — Navegación (solo doc del DS) */
  --nav-label-color:        #625f5f;
  --nav-item-text:          #908e8e;
  --nav-item-bg:            rgba(24, 24, 28, 0.82);
  --nav-item-border:        rgba(255, 255, 255, 0.08);
  --nav-item-hover-text:    #f0f1f3;
  --nav-item-hover-bg:      rgba(0, 204, 255, 0.10);
  --nav-item-hover-border:  rgba(0, 204, 255, 0.24);
  --nav-item-active-text:   #f0f1f3;
  --nav-item-active-bg:     rgba(0, 204, 255, 0.16);
  --nav-item-active-border: transparent;
  /* Tokens de componente — Login / Auth (solo doc del DS) */
  --login-status-bg:     rgba(24, 24, 28, 0.72);
  --login-status-text:   #908e8e;
  --login-status-border: rgba(255, 255, 255, 0.08);
  --login-gate-bg:       linear-gradient(145deg, rgba(24, 24, 28, 0.96), rgba(12, 12, 14, 0.90));
  --login-card-bg:       rgba(255, 255, 255, 0.03);
  --login-card-border:   rgba(255, 255, 255, 0.08);
}

/* ── 2. TOKENS — LIGHT MODE ───────────────────────────────── */
html[data-theme="light"] {
  --nav-label-color:        #5e5a57;
  --nav-item-text:          #17191c;
  --nav-item-bg:            #f6f4ef;
  --nav-item-border:        rgba(0, 0, 0, 0.10);
  --nav-item-hover-text:    #0a0a0b;
  --nav-item-hover-bg:      rgba(0, 159, 199, 0.10);
  --nav-item-hover-border:  rgba(0, 159, 199, 0.28);
  --nav-item-active-text:   #0a0a0b;
  --nav-item-active-bg:     rgba(0, 159, 199, 0.16);
  --nav-item-active-border: transparent;
  --login-status-bg:     rgba(0, 0, 0, 0.05);
  --login-status-text:   #17191c;
  --login-status-border: rgba(0, 0, 0, 0.10);
  --login-gate-bg:       linear-gradient(145deg, rgba(246, 244, 239, 0.98), rgba(236, 233, 226, 0.95));
  --login-card-bg:       rgba(255, 255, 255, 0.92);
  --login-card-border:   rgba(0, 0, 0, 0.08);
}

/* ── 3. RESET & BASE ──────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  width: 100%;
  overflow-x: clip;
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.4;
}

/* v1.2.5 — Fondo: solo radiales, sin grilla */
body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 72% 8%, rgba(0, 204, 255, 0.07), transparent 28%),
    radial-gradient(circle at 12% 60%, rgba(0, 204, 255, 0.04), transparent 22%),
    var(--bg);
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at 72% 8%, rgba(0, 159, 199, 0.06), transparent 28%),
    radial-gradient(circle at 12% 60%, rgba(0, 159, 199, 0.04), transparent 22%),
    var(--bg);
}

a       { color: inherit; text-decoration: none; }
button  { font: inherit; cursor: pointer; }

h1, h2, h3, h4, p { margin: 0; }

h1 { font-size: 30px; letter-spacing: -0.04em; }
h2 { font-size: 30px; letter-spacing: -0.04em; max-width: 12ch; }
h3 { font-size: 18px; letter-spacing: -0.02em; }
h4 { font-size: 15px; letter-spacing: -0.02em; }

/* ── 4. TIPOGRAFÍA HERO — v1.2.5 ─────────────────────────── */
/* .hero-claim: claim de marca, énfasis medio */
.hero-claim {
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
}

/* .hero-sub: descripción funcional, tono apagado */
.hero-sub {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--muted);
}

/* ── 5. LAYOUT — APP SHELL ────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  min-width: 0;
}

/* ── 6. SIDEBAR ───────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(24, 24, 28, 0.96), rgba(17, 17, 20, 0.92));
  backdrop-filter: blur(18px);
}

html[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, rgba(238, 236, 231, 0.98), rgba(230, 228, 223, 0.96));
}

.brand-block {
  display: grid;
  gap: 10px;
  margin-bottom: 28px;
}

.brand-wordmark { display: grid; gap: 4px; }
.brand-logo     { width: 100px; height: auto; display: block; }

/* Logo dark/light toggle */
.brand-logo-light { display: none; }
html[data-theme="light"] .brand-logo-dark  { display: none; }
html[data-theme="light"] .brand-logo-light { display: block; }

/* ── 7. NAVEGACIÓN ────────────────────────────────────────── */
.nav         { display: grid; gap: 24px; }
.nav-section { display: grid; gap: 10px; }

.nav-label {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--nav-label-color);
  font-size: 9px;
  font-weight: 700;
}

/* v1.2.5: nav-item sin borde por defecto — borde solo en hover/active */
.nav-item {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: var(--nav-item-bg);
  color: var(--nav-item-text);
  transition: all 0.18s ease;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.nav-item:hover {
  color: var(--nav-item-hover-text);
  border-color: var(--nav-item-hover-border);
  background: var(--nav-item-hover-bg);
}

.nav-item.is-active {
  color: var(--nav-item-active-text);
  border-color: var(--nav-item-active-border);
  background: var(--nav-item-active-bg);
  box-shadow: var(--glow);
}

/* ── 8. TOPBAR ────────────────────────────────────────────── */
.topbar {
  min-height: var(--topbar-h);
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar > div       { min-width: 0; }
.topbar-actions     {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

/* ── 9. CONTENT ───────────────────────────────────────────── */
.content {
  padding: 28px 36px 40px;
  display: grid;
  gap: 20px;
  min-width: 0;
}

/* ── 10. KICKERS & LABELS ─────────────────────────────────── */
.brand-kicker,
.page-kicker,
.section-kicker,
.panel-kicker,
.nav-label,
.kpi-label,
.status-label {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.brand-kicker,
.section-kicker,
.panel-kicker { color: var(--cyan); font-size: 10px; font-weight: 700; }

.page-kicker  { font-size: 10px; font-weight: 700; color: var(--muted-2); margin-bottom: 6px; }
.status-label,
.kpi-label    { color: var(--muted-2); font-size: 10px; font-weight: 700; }
.kpi-label    { display: flex; align-items: flex-start; gap: 8px; }

/* ── 11. BOTONES ──────────────────────────────────────────── */
/* v1.2.5: botones sin borde por defecto */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--bg-elev-2);
  color: var(--text);
  transition: all 0.18s ease;
  font-size: 13px;
  font-weight: 600;
}

.btn:hover { border-color: var(--line-strong); background: var(--bg-soft); }

.btn-primary {
  background: var(--cyan-soft);
  border-color: rgba(0, 204, 255, 0.28);
  color: var(--cyan);
}
.btn-primary:hover { background: var(--cyan-soft-2); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); }

.btn-danger {
  background: rgba(242, 95, 92, 0.08);
  border-color: rgba(242, 95, 92, 0.20);
  color: var(--red);
}

/* v1.2.5 — Nuevo: btn-amber para instalación / descarga / activación */
.btn-amber {
  background: linear-gradient(180deg, #f6a623, #d08800);
  border-color: rgba(246, 166, 35, 0.28);
  color: #1a1200;
  font-weight: 700;
}
.btn-amber:hover {
  border-color: rgba(246, 166, 35, 0.38);
  background: linear-gradient(180deg, #f8be50, #d9980a);
}

.btn-sm { padding: 7px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 24px; font-size: 15px; }

/* Ícono inline en botón */
.btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ── 12. BADGE ────────────────────────────────────────────── */
/* v1.2.5: badges sin borde en dark, borde en light mode */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid transparent;
}

/* Dot antes del texto */
.badge::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-cyan   { color: var(--cyan);   background: var(--cyan-soft); }
.badge-cyan::before { background: var(--cyan); }

.badge-green  { color: var(--green);  background: rgba(0, 196, 140, 0.08); }
.badge-green::before { background: var(--green); }

.badge-amber  { color: var(--amber);  background: rgba(246, 166, 35, 0.08); }
.badge-amber::before { background: var(--amber); }

.badge-red    { color: var(--red);    background: rgba(242, 95, 92, 0.08); }
.badge-red::before { background: var(--red); }

.badge-blue   { color: var(--blue);   background: rgba(122, 183, 255, 0.08); }
.badge-blue::before { background: var(--blue); }

.badge-muted  { color: var(--muted);  background: var(--bg-soft); }
.badge-muted::before { background: var(--muted-2); }

/* v1.2.5: borde visible en light mode */
html[data-theme="light"] .badge-cyan   { border-color: rgba(0, 159, 199, 0.22); }
html[data-theme="light"] .badge-green  { border-color: rgba(12, 155, 109, 0.22); }
html[data-theme="light"] .badge-amber  { border-color: rgba(199, 128, 0, 0.22); }
html[data-theme="light"] .badge-red    { border-color: rgba(212, 72, 94, 0.22); }
html[data-theme="light"] .badge-blue   { border-color: rgba(52, 125, 230, 0.22); }
html[data-theme="light"] .badge-muted  { border-color: var(--line); }

/* ── 13. CARDS ────────────────────────────────────────────── */
/* v1.2.5: cards sin borde por defecto */
.card,
.source-card,
.kpi-card,
.panel,
.hero-card,
.backlog-card,
.decision-card,
.status-panel,
.summary-card,
.watchlist-card,
.pulse-card,
.highlight-card {
  border: 1px solid transparent;
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
}

/* v1.2.5: .card-accent es la excepción — sí lleva borde */
.card-accent {
  border: 1px solid rgba(0, 204, 255, 0.22);
  background: var(--bg-elev-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--glow);
}

html[data-theme="light"] .card,
html[data-theme="light"] .source-card,
html[data-theme="light"] .kpi-card,
html[data-theme="light"] .panel,
html[data-theme="light"] .hero-card,
html[data-theme="light"] .backlog-card,
html[data-theme="light"] .decision-card,
html[data-theme="light"] .status-panel,
html[data-theme="light"] .summary-card,
html[data-theme="light"] .watchlist-card,
html[data-theme="light"] .pulse-card,
html[data-theme="light"] .highlight-card,
html[data-theme="light"] .runtime-banner,
html[data-theme="light"] .account-chip,
html[data-theme="light"] .login-card {
  background: rgba(255, 255, 255, 0.92);
}

/* KPI card */
.kpi-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  position: relative;
  overflow: visible;
}

.kpi-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 204, 255, 0.08), transparent 52%);
  pointer-events: none;
}

.kpi-card > * { position: relative; z-index: 1; }

.kpi-value {
  font-family: var(--kpi-num);
  font-size: clamp(32px, 2.2vw, 42px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  width: fit-content;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font: 600 11px var(--mono);
  letter-spacing: 0.02em;
  line-height: 1.3;
  justify-self: center;
}

.kpi-note { font: 400 12px var(--sans); color: var(--muted-2); line-height: 1.4; }
.kpi-trend      { height: 36px; }
.kpi-trend svg  { width: 100%; height: 100%; }

.kpi-trend-grid { stroke: rgba(255, 255, 255, 0.10); stroke-width: 1; }
html[data-theme="light"] .kpi-trend-grid { stroke: rgba(16, 36, 54, 0.12); }

.kpi-trend-line {
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Summary card */
.summary-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-elev-2);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 8px;
  min-width: 0;
  overflow: visible;
}

.summary-label {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.summary-value {
  font-family: var(--kpi-num);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Pulse card */
.pulse-card { padding: 16px; }

.pulse-label {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pulse-value {
  margin-top: 12px;
  margin-bottom: 8px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

/* Watchlist card */
.watchlist-card { padding: 16px; }

/* v1.2.5: glow de color solo en hover/focus */
.watchlist-card.tone-cyan:hover  { box-shadow: 0 0 0 1px rgba(0, 204, 255, 0.18) inset; }
.watchlist-card.tone-green:hover { box-shadow: 0 0 0 1px rgba(0, 196, 140, 0.16) inset; }
.watchlist-card.tone-amber:hover { box-shadow: 0 0 0 1px rgba(246, 166, 35, 0.16) inset; }
.watchlist-card.tone-blue:hover  { box-shadow: 0 0 0 1px rgba(0, 204, 255, 0.16) inset; }

.watchlist-metric {
  margin: 10px 0 8px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* Source card */
.source-card { display: grid; gap: 8px; padding: 14px; }

/* Hero card */
.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 18px;
  padding: 28px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(0, 204, 255, 0.04));
  pointer-events: none;
}

.hero-copy   { display: grid; gap: 12px; position: relative; z-index: 1; }
.hero-status { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Highlight card */
.highlight-card { padding: 14px; display: grid; gap: 6px; }
.highlight-name   { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 8px; }
.highlight-metric { font-size: 21px; letter-spacing: -0.03em; font-weight: 700; }

/* ── 14. PANEL ────────────────────────────────────────────── */
.panel       { display: grid; gap: 18px; padding: 20px; border-radius: var(--radius-xl); }
.panel-wide  { grid-column: span 2; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status-panel { flex: 1; display: grid; gap: 10px; padding: 18px; border-radius: var(--radius-lg); min-height: 100%; }

/* ── 15. GRIDS ────────────────────────────────────────────── */
.kpi-grid         { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.pulse-grid       { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.dashboard-grid   { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.summary-grid     { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.watchlist-grid   { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.decision-grid,
.backlog-columns  { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.highlight-cards  { display: grid; gap: 10px; }
.progress-list    { display: grid; gap: 12px; }

/* ── 16. TABLA ────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  background: linear-gradient(135deg, rgba(0, 204, 255, 0.03), transparent);
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--muted-2);
  background: var(--bg-elev);
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
}

.data-table th:hover { color: var(--text); }

.data-table th[aria-sort]::after             { content: " ↕"; font-size: 9px; opacity: 0.5; }
.data-table th[aria-sort="ascending"]::after  { content: " ↑"; opacity: 1; color: var(--cyan); }
.data-table th[aria-sort="descending"]::after { content: " ↓"; opacity: 1; color: var(--cyan); }

.data-table tbody tr { transition: background 0.2s ease; }
.data-table tbody tr:hover { background: rgba(127, 136, 150, 0.04); }
.data-table th.num, .data-table td.num { text-align: right; }
.data-table td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* Tabla inputs — excepción: mantienen borde */
.data-table input,
.data-table select {
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--bg-elev-2);
  color: var(--text);
  padding: 4px 8px;
  font-family: var(--sans);
  font-size: 12px;
}

/* ── 17. ESTADOS SEMÁNTICOS ───────────────────────────────── */
.is-positive { color: var(--green); }
.is-negative { color: var(--red); }
.is-neutral  { color: var(--muted); }

.kpi-delta.is-positive { color: var(--green); border-color: rgba(0, 196, 140, 0.28);  background: rgba(0, 196, 140, 0.10); }
.kpi-delta.is-negative { color: var(--red); border-color: rgba(242, 95, 92, 0.28);  background: rgba(242, 95, 92, 0.10); }
.kpi-delta.is-neutral  { color: var(--muted); border-color: var(--line-strong); background: var(--bg-soft); }

.kpi-trend-line.is-positive { stroke: var(--green); }
.kpi-trend-line.is-negative { stroke: var(--red); }
.kpi-trend-line.is-neutral  { stroke: var(--muted); }

.kpi-trend-fill { opacity: 0.18; }
.kpi-trend-fill.is-positive { fill: var(--green); }
.kpi-trend-fill.is-negative { fill: var(--red); }
.kpi-trend-fill.is-neutral  { fill: var(--muted); }

/* ── 18. METRIC ICON ──────────────────────────────────────── */
.metric-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid rgba(0, 204, 255, 0.22);
  background: var(--cyan-soft);
  color: var(--cyan);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.watchlist-card.tone-green .metric-icon { color: var(--green); border-color: rgba(0, 196, 140, 0.25); background: rgba(0, 196, 140, 0.12); }
.watchlist-card.tone-amber .metric-icon { color: var(--amber); border-color: rgba(246, 166, 35, 0.25);  background: rgba(246, 166, 35, 0.12); }
.watchlist-card.tone-blue  .metric-icon { color: var(--cyan);  border-color: rgba(0, 204, 255, 0.25); background: rgba(0, 204, 255, 0.12); }

/* ── 19. MOCK CHIP ────────────────────────────────────────── */
.mock-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(246, 166, 35, 0.20);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  border: 1px solid rgba(246, 166, 35, 0.28);
  vertical-align: middle;
}

/* ── 20. SIGNALS ──────────────────────────────────────────── */
.signal       { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; }
.signal-green { background: var(--green); }
.signal-amber { background: var(--amber); }
.signal-red   { background: var(--red); }
.signal-cyan { background: var(--cyan); }

.signal-list    { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.signal-list li { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }

/* ── 21. RANGE FILTER ─────────────────────────────────────── */
/* v1.2.5: el contenedor mantiene borde (es un input compuesto) */
.range-filter {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev-2);
  overflow: hidden;
  max-width: 100%;
  flex-wrap: wrap;
}

.range-btn {
  padding: 7px 14px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: none;
  border-right: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.range-btn:last-child  { border-right: none; }
.range-btn:hover       { background: var(--cyan-soft); color: var(--text); }
.range-btn.is-active   { background: var(--cyan-soft-2); color: var(--cyan); }
.range-btn:focus-visible { outline: 2px solid rgba(0, 204, 255, 0.38); outline-offset: -2px; }

/* ── 22. THEME SWITCH ─────────────────────────────────────── */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  border-radius: var(--radius-pill);
  padding: 6px 10px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.18s ease;
}

.theme-switch:hover         { border-color: rgba(0, 204, 255, 0.28); color: var(--text); }

/* Override: cuando .theme-switch es el grupo de 3 botones del topbar, no debe tener borde ni fondo */
.ds-topbar .theme-switch {
  border: none; background: none; padding: 3px; gap: 1px; cursor: default;
}
.theme-switch:focus-visible { outline: 2px solid rgba(0, 204, 255, 0.38); outline-offset: 1px; }

html[data-theme="light"] .theme-switch { background: var(--bg-soft); }

.theme-switch-track {
  width: 44px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, rgba(246, 166, 35, 0.24), rgba(122, 183, 255, 0.26));
  border: 1px solid var(--line);
  position: relative;
}

.theme-switch-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s ease;
}

html[data-theme="light"] .theme-switch-thumb { transform: translateX(22px); }

/* ── 23. ACCOUNT CHIP ─────────────────────────────────────── */
/* v1.2.5: inputs mantienen borde — account chip es un control */
.account-chip {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24, 24, 28, 0.80);
  min-width: 260px;
}

.account-user {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* ── 24. SCHEMA SELECTOR ──────────────────────────────────── */
.schema-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  color: var(--text);
  padding: 8px 10px;
  cursor: pointer;
}

.schema-toggle:hover { border-color: rgba(0, 204, 255, 0.24); }

.schema-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(320px, 84vw);
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 20;
}

.schema-option {
  width: 100%;
  text-align: left;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  padding: 10px;
  cursor: pointer;
  display: grid;
  gap: 4px;
}

.schema-option:hover,
.schema-option:focus-visible { outline: none; background: var(--cyan-soft); }
.schema-option.is-active     { background: rgba(0, 196, 140, 0.10); }

.schema-option-name { font-size: 13px; font-weight: 600; }
.schema-option-id   { color: var(--muted); font-size: 11px; font-family: var(--mono); }

/* ── 25. SESSION WARNING ──────────────────────────────────── */
.session-warning {
  margin: 0;
  max-width: 52ch;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(246, 166, 35, 0.28);
  background: rgba(246, 166, 35, 0.10);
  color: var(--amber);
  font-size: 12px;
  line-height: 1.4;
}

/* ── 26. RUNTIME BANNER ───────────────────────────────────── */
.runtime-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  background: rgba(24, 24, 28, 0.78);
}

.runtime-banner strong { display: block; margin-top: 4px; font-size: 16px; }
.runtime-banner p      { color: var(--muted); max-width: 48ch; margin: 0; }

.runtime-banner[data-state="mock"]  { border-color: rgba(0, 204, 255, 0.24); box-shadow: var(--glow); }
.runtime-banner[data-state="error"] { border-color: rgba(242, 95, 92, 0.30); }

/* ── 27. LOAD PROGRESS ────────────────────────────────────── */
.load-progress {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: none;
  background: var(--bg-elev-2);
}

.load-progress-track {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--line-strong);
  overflow: hidden;
}

.load-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--cyan);
  transition: width 0.35s ease;
}

.load-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.load-progress-meta strong { color: var(--text); font-family: var(--mono); font-size: 11px; }

/* ── 28. LOGIN / AUTH ─────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.login-stage { width: min(100%, 460px); display: grid; gap: 18px; }
.login-brand { justify-items: center; text-align: center; margin-bottom: 6px; }

.login-gate {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--login-gate-bg);
  overflow: hidden;
}

.login-card {
  width: 100%;
  display: grid;
  gap: 14px;
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--login-card-border);
  background: var(--login-card-bg);
}

.login-form { display: grid; gap: 10px; }

.login-label {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* v1.2.5: inputs siempre llevan borde — excepción documentada */
.login-input {
  min-width: 0;
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 12px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 14px;
  transition: border-color 0.18s;
}

.login-input:focus         { outline: none; border-color: rgba(0, 204, 255, 0.28); box-shadow: var(--glow); }
.login-input::placeholder  { color: var(--muted-2); }
.login-submit              { margin-top: 6px; }
.login-hint                { margin-top: 6px; font-size: 13px; color: var(--muted); }

.auth-status {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--login-status-border);
  border-radius: var(--radius);
  color: var(--login-status-text);
  background: var(--login-status-bg);
  font-size: 13px;
}

.auth-status[data-state="success"] { color: var(--green); border-color: rgba(0, 196, 140, 0.28); }
.auth-status[data-state="error"]   { color: var(--red);   border-color: rgba(242, 95, 92, 0.28); }

/* ── 29. PROGRESS BARS ────────────────────────────────────── */
.progress-row {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.progress-name   { font-size: 13px; font-weight: 600; }
.progress-detail,
.progress-value  { color: var(--muted); font-size: 12px; }

.progress-bar {
  height: 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
  overflow: hidden;
  border: 1px solid var(--line);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--cyan);
}

/* Barras horizontales unificadas (canal/franja/sucursal) — track visible, fill animado */
.channel-bar, .hourly-bar-track, .branch-bar { height: 14px; border-radius: var(--radius-pill); background: var(--line-strong); overflow: hidden; }
.channel-fill, .hourly-bar-fill, .branch-fill { height: 100%; min-width: 5px; border-radius: inherit; background: var(--cyan); transform-origin: left center; animation: funnelGrow 0.8s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
@media (prefers-reduced-motion: reduce) { .channel-fill, .hourly-bar-fill, .branch-fill { animation: none; } }

/* Coherence bars */
.coherence-bar              { display: block; height: 6px; min-width: 4px; border-radius: var(--radius-pill); }
.coherence-bar.is-orders    { background: linear-gradient(90deg, var(--cyan), var(--blue)); }
.coherence-bar.is-created   { background: linear-gradient(90deg, #4ea9ff, #2f7de5); }
.coherence-bar.is-issued    { background: linear-gradient(90deg, var(--green), #0ea273); }
.coherence-bar.is-remitos   { background: linear-gradient(90deg, var(--amber), #d68b0c); }
.coherence-bar.is-collections { background: linear-gradient(90deg, #f472b6, #ec4899); }

/* ── 30. FUNNEL (v2: barras sobre ancho original + fuga + total) ── */
@keyframes funnelGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.funnel { display: grid; gap: 14px; }
.funnel-total { text-align: right; flex-shrink: 0; }
.funnel-total-val { font: 700 22px var(--kpi-num); color: var(--green); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; line-height: 1; }
.funnel-total-lbl { font: 700 8px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-2); margin-top: 3px; }
.funnel-step-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.funnel-step-name { font: 500 11px var(--sans); color: var(--text); }
.funnel-step-count { font: 500 11px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.funnel-leak { font: 600 10px var(--mono); color: var(--red); }
.funnel-leak.is-ok { color: var(--green); }
.funnel-track { height: 16px; border-radius: var(--radius-pill); background: var(--line-strong); overflow: hidden; }
.funnel-fill { height: 100%; min-width: 5px; border-radius: var(--radius-pill); background: var(--cyan); transform-origin: left center; animation: funnelGrow 0.85s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
.funnel-fill.is-end { background: var(--green); }
@media (prefers-reduced-motion: reduce) { .funnel-fill { animation: none; } }
.funnel-note { margin: 4px 0 0; font-size: 11px; line-height: 1.5; color: var(--muted-2); }
.funnel-note strong { color: var(--red); font-weight: 600; }
.funnel-empty { margin: 0; font-size: 12px; color: var(--muted-2); }
.progress-empty { margin: 0; padding: 4px 0; font-size: 12px; color: var(--muted-2); }

/* ── 31. TREND CHART ──────────────────────────────────────── */
.trend-chart {
  min-height: 240px;
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--bg-soft);
}
.trend-bar-wrap { flex: 1; min-width: 0; }

.trend-bar-wrap {
  min-height: 190px;
  display: grid;
  grid-template-rows: auto minmax(60px, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.trend-bar {
  width: 100%;
  border-radius: var(--radius-sm) var(--radius-sm) 2px 2px;
  background: var(--cyan);
  min-height: 24px;
  transition: filter 0.2s ease;
  cursor: pointer;
}
.trend-bar:hover { filter: brightness(1.08); }

/* v1.2.5: glow de color solo en hover */
.trend-bar:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 204, 255, 0.22);
}

.trend-value,
.trend-day { text-align: center; font-size: 11px; }
.trend-value { color: var(--muted); }
.trend-day   { font-family: var(--mono); }

/* ── 32. SKELETON / SHIMMER ───────────────────────────────── */
.skeleton-card  { min-height: 156px; }

.skeleton-line {
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.12),
    rgba(255, 255, 255, 0.06));
  background-size: 200% 100%;
  animation: yiqi-shimmer 1.4s linear infinite;
}

html[data-theme="light"] .skeleton-line {
  background: linear-gradient(90deg, rgba(0,0,0,.04), rgba(0,0,0,.08), rgba(0,0,0,.04));
  background-size: 200% 100%;
}

.skeleton-label { width: 42%; height: 12px; }
.skeleton-value { width: 70%; height: 28px; }
.skeleton-text  { width: 100%; height: 12px; }

@keyframes yiqi-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── 33. COHERENCE BADGE ──────────────────────────────────── */
.coherence-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid transparent;
}

.coherence-badge.is-good  { color: var(--green); background: rgba(0, 196, 140, 0.12); border-color: rgba(0, 196, 140, 0.24); }
.coherence-badge.is-alert { color: var(--amber); background: rgba(246, 166, 35, 0.12);  border-color: rgba(246, 166, 35, 0.24); }

.coherence-bars  { width: 170px; display: grid; gap: 4px; }
.coherence-empty { color: var(--muted); text-align: center; padding: 18px; }
.coherence-gap   { margin-top: 4px; color: var(--muted); font-size: 11px; }

/* ── 34. PRODUCT META ─────────────────────────────────────── */
.product-title { font-weight: 600; }
.product-sku   { margin-top: 2px; font-size: 11px; color: var(--muted-2); font-family: var(--mono); }

/* ── 35. ACCENT VARIANT ───────────────────────────────────── */
.accent-cyan {
  background:
    linear-gradient(180deg, rgba(0, 204, 255, 0.12), rgba(24, 24, 28, 0.90)),
    rgba(24, 24, 28, 0.82);
}

/* ── 36. UTILIDADES ───────────────────────────────────────── */
.kpi-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  margin-left: auto;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.kpi-help:hover,
.kpi-help:focus-visible,
.kpi-help.is-open {
  color: var(--text);
  border-color: var(--cyan);
  outline: none;
}
.kpi-help-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  width: max-content;
  max-width: 260px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  box-shadow: var(--shadow-md);
  color: var(--muted);
  font: 400 12px/1.45 var(--sans);
  letter-spacing: normal;
  text-transform: none;
  text-align: left;
  white-space: normal;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  z-index: 60;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.kpi-help.is-open .kpi-help-pop {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.kpi-collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  transition: color 0.15s ease, transform 0.2s ease;
}
.kpi-collapse svg { width: 14px; height: 14px; }
.kpi-collapse:hover,
.kpi-collapse:focus-visible { color: var(--text); outline: none; }
.kpi-card.is-collapsed .kpi-collapse { transform: rotate(-90deg); }
.kpi-body {
  display: grid;
  gap: 10px;
  overflow: hidden;
  max-height: 320px;
  opacity: 1;
  transition: max-height 0.26s ease, opacity 0.2s ease, margin-top 0.26s ease;
}
.kpi-card.is-collapsed .kpi-body {
  max-height: 0;
  opacity: 0;
  margin-top: -10px;
}


.source-row     { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.channel-share  { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.branch-revenue { font-family: var(--mono); font-size: 12px; color: var(--text); }
.branch-empty   { color: var(--muted); font-size: 13px; }
.watchlist-title { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 8px; }
.watchlist-grid-compact { grid-template-columns: 1fr; }
.dashboard-shell { display: grid; gap: 20px; }

/* ── 37. RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 1180px) {
  .kpi-grid,
  .pulse-grid,
  .dashboard-grid,
  .summary-grid,
  .decision-grid,
  .backlog-columns,
  .watchlist-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-wide,
  .hero-card { grid-column: auto; }
  .hero-card { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }

  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 20px;
  }

  .content { padding: 20px; }
  .login-screen { padding: 20px 16px; }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions { width: 100%; flex-wrap: wrap; }
  .account-chip   { width: 100%; min-width: 0; }
  .schema-menu    { width: 100%; }
  .login-input    { min-width: 0; }
}

@media (max-width: 720px) {
  .kpi-grid,
  .pulse-grid,
  .dashboard-grid,
  .summary-grid,
  .decision-grid,
  .backlog-columns,
  .watchlist-grid {
    grid-template-columns: 1fr;
  }

  .hero-status { display: grid; grid-template-columns: 1fr; }
  .trend-chart { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .progress-row,
  .hourly-row,
  .channel-row,
  .branch-row { grid-template-columns: 1fr; }

  .coherence-bars { width: 100%; }
}

/* ── 38. TOGGLE TEMA 3 PASOS (v1.2.5) ────────────────────── */
/* Oscuro | Sistema | Claro — Sistema por defecto            */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elev-2);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 1px;
  box-shadow: var(--shadow-sm);
}

.theme-opt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 10px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted-2);
  font: 500 11px var(--sans);
  cursor: pointer;
  transition: background var(--tr, 180ms ease), color var(--tr, 180ms ease);
  white-space: nowrap;
}

.theme-opt svg {
  width: 13px; height: 13px;
  stroke: currentColor; fill: none;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

.theme-opt:hover  { color: var(--text); }
.theme-opt.active { background: var(--bg-elev-2); color: var(--text); }

/* ── 39. MÓDULO ACCORDION BORDERLESS (v1.2.5) ────────────── */
.module-demo {
  border: none;
  border-radius: var(--radius-md);
  background: var(--bg-elev-2);
  overflow: hidden;
}

.module-demo.open {
  box-shadow: 0 0 0 1px rgba(0, 204, 255, 0.10) inset;
}

/* Estado open: texto usa text-cyan-muted, no cyan puro */
.module-demo.open .module-title-text { color: var(--text-cyan-muted); }
.module-demo.open .module-icon       { color: var(--text-cyan-muted); }

/* ── 40. MOD-CARD CON ZONAS SEPARADAS (v1.2.5) ───────────── */
.mod-card        { border: none; border-radius: var(--radius-lg); background: var(--bg-elev-2); overflow: hidden; }
.mod-card:hover  { box-shadow: 0 0 0 1px rgba(0, 204, 255, 0.14) inset; }

.mod-card-header { display: flex; align-items: stretch; overflow: hidden; }

.mod-card-header-left {
  display: flex; align-items: center; gap: 10px;
  flex: 1; padding: 14px 16px; cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}
.mod-card-header-left:hover { background: var(--cyan-soft-2); }

.mod-card-header-right {
  display: flex; align-items: center; justify-content: center;
  padding: 0 12px; min-width: 48px; flex-shrink: 0;
  border-left: 1px solid var(--line);
  transition: background 180ms ease;
}
.mod-card-header-right:hover { background: var(--cyan-soft); }

/* Estado abierto — text-cyan-muted, no cyan puro */
.mod-card.open .mod-card-header-left {
  color: var(--text-cyan-muted);
  background: var(--cyan-soft);
}
.mod-card.open .mod-icon { color: var(--text-cyan-muted); }

/* ── 41. CARD-REVEAL — ANIMACIÓN DE ENTRADA (v1.2.5) ─────── */
.card-reveal {
  will-change: transform, opacity;
  opacity: 0;
  transition: opacity .65s cubic-bezier(.22,1,.36,1), transform .65s cubic-bezier(.22,1,.36,1);
}
.card-reveal:nth-child(1), .card-reveal:nth-child(3) { transform: translateX(-52px) translateY(12px); }
.card-reveal:nth-child(2), .card-reveal:nth-child(4) { transform: translateX(52px)  translateY(12px); }
.card-reveal:nth-child(1) { transition-delay: .00s; }
.card-reveal:nth-child(2) { transition-delay: .07s; }
.card-reveal:nth-child(3) { transition-delay: .14s; }
.card-reveal:nth-child(4) { transition-delay: .21s; }
.card-reveal.visible { opacity: 1; transform: none; }

/* ── FOOTER CANÓNICO ──────────────────────────────────────── */
/* © 2026 YiQi S.A. · styles.css · DS v1.2.7 · 04/06/2026  */

/* ── 42. INPUTS — COMPONENTES DS (v1.2.5) ────────────────── */
/* Borderless: sin border, fondo elevado, focus ring cyan.    */
/* Altura estándar 40px. border-radius 14px en todos.         */

.ds-input,
.ds-textarea,
.ds-select {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--text);
  font: 400 var(--fs-body)/1 var(--sans);
  outline: none;
  -webkit-appearance: none;
  transition: box-shadow var(--tr);
}

.ds-input,
.ds-select {
  height: 40px;
  padding: 0 14px;
}

.ds-input::placeholder { color: var(--muted-2); }

.ds-input:focus,
.ds-select:focus,
.ds-textarea:focus {
  box-shadow: 0 0 0 3px var(--cyan-soft);
}

.ds-input.err,
.ds-textarea.err {
  box-shadow: 0 0 0 3px var(--red-soft);
}

/* Textarea */
.ds-textarea {
  height: auto;
  padding: 10px 14px;
  resize: vertical;
  min-height: 96px;
  line-height: 1.4;
}
.ds-textarea::placeholder { color: var(--muted-2); }


/* ── Toggle switch ──────────────────────────────────────── */
.switch-label {
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; user-select: none;
}
.switch-track {
  position: relative; width: 40px; height: 22px; flex-shrink: 0;
  background: var(--bg-soft);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transition: background 200ms ease;
}
.switch-track.on { background: var(--cyan); }
.switch-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: var(--text);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,.28);
  transition: transform 200ms cubic-bezier(.4,0,.2,1), background 200ms ease;
}
.switch-track.on .switch-thumb {
  transform: translateX(18px);
  background: #fff;
}
.switch-text { font: 500 13px var(--sans); color: var(--text); }

/* ── Checkbox ───────────────────────────────────────────── */
.checkbox-label {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
  font: 500 13px var(--sans); color: var(--text);
}
.checkbox {
  width: 18px; height: 18px; flex-shrink: 0;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  display: grid; place-items: center;
  transition: background 180ms ease, box-shadow 180ms ease;
}
.checkbox.checked {
  background: var(--cyan);
  box-shadow: none;
}
.checkbox svg {
  width: 11px; height: 11px;
  fill: none; stroke: #fff;
  stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
  opacity: 0; transition: opacity 150ms ease;
}
.checkbox.checked svg { opacity: 1; }

/* Select */
.ds-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236f7785' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

/* Input con ícono interno */
.ds-input-wrap { position: relative; }
.ds-input-wrap .ds-input { padding-left: 38px; }
.ds-input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; stroke: var(--muted-2); fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
}
.ds-input-shortcut {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  height: 22px; padding: 0 8px; border-radius: 8px;
  border: 1px solid var(--line);
  display: flex; align-items: center;
  font: 600 10px var(--mono); color: var(--muted); background: var(--bg);
}

/* Label */
.ds-label {
  display: block;
  font: 500 var(--fs-meta)/1 var(--sans);
  color: var(--muted);
  margin-bottom: 6px;
}
.ds-label .req { color: var(--cyan); margin-left: 2px; }

/* Field error */
.ds-field-err {
  font: 400 var(--fs-caption)/1 var(--sans);
  color: var(--red);
  display: none;
  margin-top: 4px;
}
.ds-field-err.show { display: block; }

/* Alias para compatibilidad con páginas existentes */
.field-err { font: 400 var(--fs-caption)/1 var(--sans); color: var(--red); display: none; margin-top: 4px; }
.field-err.show { display: block; }

/* ── 43. BACKGROUND GRID — CUADRÍCULA (v1.2.5) ───────────── */
/* Patrón de grilla cuadriculada para uso en cards, banners,   */
/* heroes y secciones de énfasis. Siempre vía ::before o       */
/* elemento dedicado — nunca sobre texto directamente.          */

/* Clase utilitaria — aplica la grilla al elemento mismo       */
/* Requiere position: relative en el contenedor                */
.bg-grid {
  --grid-size:   36px;
  --grid-color:  rgba(255, 255, 255, 0.045);
  background-image:
    linear-gradient(90deg,  var(--grid-color) 1px, transparent 1px),
    linear-gradient(180deg, var(--grid-color) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
}

html[data-theme="light"] .bg-grid {
  --grid-color: rgba(0, 159, 199, 0.18);
}

/* Variante — grilla más fina */
.bg-grid-sm {
  --grid-size:  20px;
  --grid-color: rgba(255, 255, 255, 0.04);
  background-image:
    linear-gradient(90deg,  var(--grid-color) 1px, transparent 1px),
    linear-gradient(180deg, var(--grid-color) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
}

html[data-theme="light"] .bg-grid-sm {
  --grid-color: rgba(0, 159, 199, 0.16);
}

/* Variante — grilla más amplia */
.bg-grid-lg {
  --grid-size:  64px;
  --grid-color: rgba(255, 255, 255, 0.04);
  background-image:
    linear-gradient(90deg,  var(--grid-color) 1px, transparent 1px),
    linear-gradient(180deg, var(--grid-color) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
}

html[data-theme="light"] .bg-grid-lg {
  --grid-color: rgba(0, 159, 199, 0.16);
}

/* Máscara de fade — para suavizar bordes de la grilla         */
/* Usar junto con .bg-grid en un ::before                      */
.bg-grid-fade-b  { mask-image: linear-gradient(180deg, rgba(0,0,0,.55), transparent 80%); }
.bg-grid-fade-t  { mask-image: linear-gradient(0deg,   rgba(0,0,0,.55), transparent 80%); }
.bg-grid-fade-c  { mask-image: radial-gradient(ellipse at center, rgba(0,0,0,.55), transparent 72%); }

/* Convención: usar como overlay en ::before del contenedor     */
/*                                                              */
/* .mi-hero { position: relative; }                            */
/* .mi-hero::before {                                          */
/*   content: ""; position: absolute; inset: 0;               */
/*   pointer-events: none;                                      */
/*   background-image:                                         */
/*     linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px), */
/*     linear-gradient(180deg, rgba(255,255,255,.045) 1px, transparent 1px); */
/*   background-size: 36px 36px;                               */
/*   mask-image: linear-gradient(180deg, rgba(0,0,0,.5), transparent 80%); */
/* }                                                            */


/* ── Demo Form (Hero Form) ───────────────────────────────── */
/* Formulario multi-paso para solicitud de demo. v1.2.5      */
.demo-form-wrap {
  width: 100%; max-width: 400px;
  background: var(--bg-elev-2);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.hf-header { padding: 20px 24px 0; }
.hf-kicker {
  font: 600 9px var(--mono); letter-spacing: .15em; text-transform: uppercase;
  color: var(--muted-2); display: block; margin-bottom: 6px;
}
.hf-title { font: 600 15px var(--sans); color: var(--text); letter-spacing: -.01em; margin-bottom: 2px; }
.hf-sub   { font: 400 11px var(--sans); color: var(--muted-2); line-height: 1.4; }
.hf-step  { padding: 16px 24px 0; display: none; }
.hf-step.active { display: block; animation: hfIn .2s ease; }
@keyframes hfIn { from { opacity:0; transform:translateY(4px) } to { opacity:1; transform:translateY(0) } }
.hf-field { margin-bottom: 12px; }
.hf-field:last-child { margin-bottom: 0; }
.hf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* Inputs — excepción borderless: controles interactivos llevan borde en dark via box-shadow */
.demo-form-wrap .input {
  width: 100%; height: 38px;
  background: var(--bg-elev); border: none;
  border-radius: var(--radius-sm); padding: 0 12px;
  color: var(--text); font: 400 16px var(--sans);
  transition: box-shadow .18s ease, background .18s ease;
  outline: none; appearance: none;
}
.demo-form-wrap .input::placeholder { color: var(--muted-2); }
.demo-form-wrap .input:focus { box-shadow: var(--glow); }
html[data-theme="light"] .demo-form-wrap .input {
  background: var(--bg-soft); box-shadow: 0 0 0 1px var(--line);
}
html[data-theme="light"] .demo-form-wrap .input:focus { box-shadow: var(--glow); }
.demo-form-wrap select.input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236f7785' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px;
}
select.input option { background: var(--bg-elev-2); color: var(--text); }
.demo-form-wrap textarea.input { height: 72px; padding: 10px 12px; resize: none; line-height: 1.4; }
/* Error */
.hf-err {
  font: 400 10px var(--sans); color: var(--red);
  margin-top: 4px; display: none; align-items: center; gap: 3px;
}
.hf-err.show { display: flex; }
/* Section label */
.hf-section-label {
  display: flex; align-items: center; gap: 10px;
  font: 600 9px var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted-2); margin-bottom: 14px;
}
.hf-section-label::after { content:''; flex:1; height:1px; background:var(--line); }
.hf-section-sublabel {
  font: 500 10px var(--sans); color: var(--muted-2);
  letter-spacing: .02em; margin-bottom: 8px;
}
/* Chips */
.hf-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 4px; }
.hf-chip {
  font: 500 11px var(--sans); padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: var(--bg-elev); color: var(--muted);
  cursor: pointer; border: none; user-select: none;
  transition: background .15s, color .15s;
}
html[data-theme="light"] .hf-chip { background: var(--bg-soft); }
.hf-chip:hover { color: var(--text); }
.hf-chip.active { background: var(--cyan-soft); color: var(--cyan); }
/* Footer */
.hf-footer {
  padding: 16px 24px 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.hf-footer-row {
  display: flex; align-items: center;
  padding: 0 24px 14px;
}
.hf-footer-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.hf-btn-autofill {
  height: 34px; padding: 0 12px;
  background: none; border: none; border-radius: var(--radius-sm);
  color: var(--muted-2); font: 500 11px var(--mono); letter-spacing: .02em;
  cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
  transition: color .15s, background .15s; white-space: nowrap; flex-shrink: 0;
}
.hf-btn-autofill:hover { color: var(--cyan); background: var(--cyan-soft); }
.hf-btn-cta {
  height: 34px; padding: 0 18px;
  background: rgba(127,231,250,.07); border: none; border-radius: var(--radius-sm);
  color: var(--muted); font: 600 12px var(--sans); letter-spacing: .01em;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: background .16s, color .16s; margin-left: auto;
}
.hf-btn-cta:hover { background: rgba(127,231,250,.14); color: var(--text); }
.hf-btn-ghost {
  width: 100%; height: 32px; background: none; border: none;
  color: var(--muted-2); font: 500 11px var(--sans);
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 5px;
  transition: color .16s;
}
.hf-btn-ghost:hover { color: var(--muted); }
.hf-btn-back {
  background: none; border: none; padding: 0;
  color: var(--muted-2); font: 500 10px var(--sans);
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  transition: color .16s;
}
.hf-btn-back:hover { color: var(--muted); }
.hf-legal {
  font: 400 10px var(--sans); color: var(--muted-2);
  text-align: center; line-height: 1.5;
}
.hf-legal a { color: var(--muted-2); text-decoration: underline; }
.hf-divider { height: 1px; background: var(--line); margin: 4px 24px 0; }
/* Success */
.hf-success {
  display: none; flex-direction: column; align-items: center;
  gap: 10px; padding: 40px 24px; text-align: center;
}
.hf-success.show { display: flex; animation: hfIn .3s ease; }
.hf-success-icon {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--green-soft); color: var(--green);
  display: grid; place-items: center;
}
.hf-success-title { font: 600 14px var(--sans); color: var(--text); }
.hf-success-sub   { font: 400 12px var(--sans); color: var(--muted); max-width: 280px; line-height: 1.4; }
/* Step indicator */
.hf-step-bar {
  display: flex; gap: 4px; padding: 16px 24px 0;
}
.hf-step-dot {
  height: 2px; flex: 1; border-radius: 2px;
  background: var(--line); transition: background .25s;
}
.hf-step-dot.active { background: var(--cyan); }
.hf-step-dot.done   { background: var(--muted-2); }

/* Demo Form — light mode overrides */
html[data-theme="light"] .hf-btn-cta {
  background: var(--cyan-soft);
  color: var(--cyan);
}
html[data-theme="light"] .hf-btn-cta:hover {
  background: var(--cyan-soft-2);
  color: var(--cyan);
}
html[data-theme="light"] .hf-btn-autofill {
  color: var(--muted);
}
html[data-theme="light"] .hf-btn-autofill:hover {
  color: var(--cyan);
  background: var(--cyan-soft);
}
html[data-theme="light"] .hf-btn-ghost {
  color: var(--muted-2);
}
html[data-theme="light"] .hf-btn-ghost:hover { color: var(--muted); }
html[data-theme="light"] .hf-btn-back  { color: var(--muted-2); }
html[data-theme="light"] .hf-btn-back:hover { color: var(--muted); }

/* ── Logo iA Ready — v1.2.5 ─────────────────────────────────────────────────
   Clases globales para SVG inline del logo iA Ready.
   Uso: <path class="iar" .../> para letras, <path class="iar-a" .../> para la A.
   Las variables se sobreescriben localmente en cada contenedor demo si hace falta.
   ────────────────────────────────────────────────────────────────────────── */
.iar   { fill: var(--text); }
.iar-a { fill: var(--cyan); }


/* ═══ Sync panel gerencial: semáforo-resumen, donut, status-pills ═══ */
.signal-summary { align-items: center; background: var(--bg-soft); border-radius: var(--radius-md); padding: 11px 14px; margin-bottom: 4px; }
.signal-summary .signal { margin-top: 0; }
.signal-summary strong { font: 600 12px var(--sans); color: var(--text); }
.signal-summary p { margin-top: 1px; font-size: 11px; }
.signal-summary.tone-red { background: var(--red-soft); }
.signal-summary.tone-amber { background: var(--amber-soft); }
.signal-summary.tone-green { background: var(--green-soft); }
.signal-summary.tone-red .signal-summary-state { color: var(--red); }
.signal-summary.tone-amber .signal-summary-state { color: var(--amber); }
.signal-summary.tone-green .signal-summary-state { color: var(--green); }
.signal-body { min-width: 0; }
.signal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.signal-metric { font: 600 13px var(--mono); color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; flex-shrink: 0; }

.donut-block { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr); gap: 18px; align-items: center; }
.panel:has(.donut-block) { container-type: inline-size; }
@container (max-width: 360px) { .donut-block { grid-template-columns: 1fr; justify-items: center; gap: 14px; } .donut-legend { width: 100%; max-width: 300px; } }
.donut-chart { position: relative; height: 180px; min-width: 0; }
.donut-legend { display: grid; gap: 8px; align-content: center; }
.legend-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 6px 12px; align-items: center; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-label { font: 400 12px var(--sans); color: var(--muted); }
.legend-pct { font: 600 12px var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .donut-block { grid-template-columns: 1fr; gap: 16px; justify-items: center; } .donut-legend { width: 100%; max-width: 320px; } }

.status-pill { flex-shrink: 0; font: 700 9px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 8px; border-radius: var(--radius-pill); white-space: nowrap; }
.status-pill.pill-muted { background: var(--bg-elev-2); color: var(--muted); }
.status-pill.pill-amber { background: var(--amber-soft); color: var(--amber); }
.status-pill.pill-cyan { background: var(--cyan-soft); color: var(--cyan); }
.backlog-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.backlog-card-top h4 { margin: 0; }


/* Actividad horaria — mini-histograma vertical (sync panel) */
@keyframes ribGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.heat-ribbon { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.rib-col { display: grid; grid-template-rows: auto 1fr auto; gap: 6px; justify-items: center; }
.rib-val { font: 700 11px var(--mono); color: var(--muted-2); font-variant-numeric: tabular-nums; }
.rib-val.is-peak { color: var(--text); }
.rib-track { width: 100%; height: 84px; display: flex; align-items: flex-end; background: var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.rib-fill { width: 100%; min-height: 4px; background: var(--cyan-chart-bar); border-radius: var(--radius-sm); transform-origin: bottom center; animation: ribGrow 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
.rib-fill.is-peak { background: var(--cyan); }
.rib-lbl { font: 600 9px var(--mono); color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.04em; text-align: center; }
@media (prefers-reduced-motion: reduce) { .rib-fill { animation: none; } }


/* Toggle de tipo de gráfico (línea / barras) — sync panel */
.spark-toggle { display: inline-flex; gap: 2px; padding: 2px; background: var(--bg-soft); border-radius: var(--radius-pill); }
.spark-opt { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 24px; border: 0; background: none; color: var(--muted); border-radius: var(--radius-pill); cursor: pointer; transition: all 0.15s ease; }
.spark-opt svg { width: 15px; height: 15px; }
.spark-opt.is-active { background: var(--cyan-soft); color: var(--cyan); }

/* ════════════════════════════════════════════════════════════════════
   App shell · componentes de aplicación (v1.2.7)
   Catálogo: yiqi-design-system.html §27 (Aplicaciones · Kit base)
   ════════════════════════════════════════════════════════════════════ */
.topbar-l{ display:flex; align-items:center; gap:10px; min-width:0; }
.topbar-r{ display:flex; align-items:center; gap:8px; min-width:0; margin-left:auto; }

.t-pill{ display:inline-flex; align-items:center; height:30px; padding:0 12px; border:1px solid var(--line); border-radius:var(--radius-pill); background:var(--bg-elev-2); color:var(--muted); font:700 10px var(--mono); letter-spacing:.12em; text-transform:uppercase; white-space:nowrap; }

.btn-refresh{ height:32px; padding:0 12px; display:inline-flex; align-items:center; gap:6px; border:none; border-radius:var(--radius-pill); background:var(--cyan-soft-2); color:var(--cyan); font:600 12px var(--sans); cursor:pointer; transition:all .18s ease; white-space:nowrap; }
.btn-refresh:hover{ background:var(--cyan-soft); }
.btn-refresh:disabled{ opacity:.6; cursor:default; }
.btn-refresh .rico{ width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.btn-refresh.is-loading .rico{ animation: ricospin .7s linear infinite; }
@keyframes ricospin{ to{ transform:rotate(360deg); } }

.btn-exit{ height:32px; padding:0 14px; display:inline-flex; align-items:center; border:none; border-radius:var(--radius-pill); background:var(--bg-elev-2); color:var(--muted); font:600 12px var(--sans); cursor:pointer; transition:all .18s ease; }
.btn-exit:hover{ color:var(--red); }

.nav-icon{ width:26px; height:26px; border-radius:var(--radius-xs); background:var(--bg-soft); color:var(--muted); display:grid; place-items:center; transition:background .15s, color .15s; }
.nav-icon svg{ width:14px; height:14px; }
.nav-item:hover .nav-icon{ color:var(--text); }
.nav-item.active .nav-icon, .nav-item.is-active .nav-icon{ background:var(--cyan-soft-2); color:var(--cyan); }

.sb-footer{ margin-top:auto; padding-top:14px; border-top:1px solid var(--line); }
.sb-theme-switch{ display:flex; width:100%; gap:2px; padding:3px; border:1px solid var(--line); background:var(--bg-elev-2); border-radius:var(--radius-pill); margin-bottom:10px; }
.sb-theme-switch .theme-opt, .sb-theme-switch .theme-option{ flex:1; min-width:0; height:30px; display:inline-flex; align-items:center; justify-content:center; padding:0; background:transparent; border:none; color:var(--muted); border-radius:var(--radius-pill); cursor:pointer; transition:all .15s; }
.sb-theme-switch .theme-opt svg, .sb-theme-switch .theme-option svg{ width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.sb-theme-switch .theme-opt:hover, .sb-theme-switch .theme-option:hover{ color:var(--text); }
.sb-theme-switch .theme-opt.active, .sb-theme-switch .theme-option.active{ background:var(--cyan-soft); color:var(--cyan); }
.sb-copy{ color:var(--muted-2); font:500 10px/1.45 var(--mono); padding-left:2px; }

.card-flush{ background:transparent; box-shadow:none; border:none; padding:0; }


/* Sidebar · navegación (panel) — sync */
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-lbl { display: block; padding: 10px 8px 4px; color: var(--muted-2); font: 700 9px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; }
.nav-div { height: 1px; margin: 5px 0; background: var(--line); }
.nav-link { display: flex; width: 100%; align-items: center; gap: 8px; min-height: 40px; padding: 7px 9px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer; font: 500 12.5px var(--sans); text-align: left; text-decoration: none; transition: background 0.18s ease, color 0.18s ease; }
.nav-link:hover { background: var(--bg-soft); color: var(--text); }
.nav-link.is-active { background: var(--cyan-soft); color: var(--cyan); }
.n-ico { display: grid; width: 26px; height: 26px; flex-shrink: 0; place-items: center; border-radius: var(--radius-xs); background: var(--bg-soft); color: var(--muted); transition: background 0.18s ease, color 0.18s ease; }
.nav-link:hover .n-ico { color: var(--text); }
.nav-link.is-active .n-ico { background: var(--cyan-soft-2); color: var(--cyan); }
.n-ico svg { width: 13px; height: 13px; }
