/* MiPueblo — Design System v0.3 (post taste-skill + emil + impeccable + soft-skill audit) */

@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&family=Fira+Sans:wght@400;500;600;700&family=Fira+Code:wght@400;600&display=swap');

:root {
  /* === Color palette — alineada con sistema de diseño accesible === */
  --primary-900: #020617;          /* texto principal — máximo contraste */
  --primary-800: #0F172A;          /* navy primario */
  --primary-700: #1E293B;
  --primary-600: #334155;          /* secundario */
  --primary-500: #475569;

  --cta-700: #075985;
  --cta-600: #0369A1;              /* CTA principal */
  --cta-500: #0284C7;
  --cta-50:  #E0F2FE;

  --accent-500: #FFD54A;           /* amarillo de marca, solo decorativo */
  --accent-600: #F4B400;

  --success-700: #15803D;
  --success-600: #16A34A;
  --success-50:  #DCFCE7;
  --warning-600: #D97706;          /* AAA compliant */
  --warning-50:  #FEF3C7;
  --danger-700:  #991B1B;
  --danger-600:  #B91C1C;          /* contraste 4.5:1+ sobre blanco */
  --danger-50:   #FEE2E2;
  --critical-900: #111827;

  --slate-900: #0F172A;
  --slate-800: #1E293B;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748B;
  --slate-400: #94A3B8;
  --slate-300: #CBD5E1;
  --slate-200: #E2E8F0;
  --slate-100: #F1F5F9;
  --slate-50:  #F8FAFC;            /* fondo de app */
  --white:     #FFFFFF;

  /* === Typography === */
  --font-citizen: 'Atkinson Hyperlegible', system-ui, -apple-system, sans-serif;
  --font-app:     'Fira Sans', system-ui, -apple-system, sans-serif;
  --font-mono:    'Fira Code', 'SF Mono', Monaco, monospace;

  /* === Spacing === */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* === Radius === */
  --radius-sm: 4px;
  --radius:    8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* === Shadow (tintadas al hue navy de la paleta, no negro genérico) === */
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04);
  --shadow:    0 2px 8px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 8px 24px -8px rgba(15,23,42,0.10), 0 2px 6px rgba(15,23,42,0.04);
  --shadow-lg: 0 16px 40px -12px rgba(15,23,42,0.14), 0 4px 12px rgba(15,23,42,0.06);
  --shadow-xl: 0 24px 60px -16px rgba(15,23,42,0.20), 0 8px 20px rgba(15,23,42,0.08);
  /* "Lift" shadow para hover en tarjetas, más cinematográfica */
  --shadow-lift: 0 20px 50px -16px rgba(7,89,133,0.22), 0 6px 16px rgba(15,23,42,0.08);
  /* Inset highlight tipo "edge refraction" (Emil/taste) */
  --shadow-inset-top: inset 0 1px 0 rgba(255,255,255,0.65);

  /* === Z-index scale === */
  --z-base:    1;
  --z-dropdown: 10;
  --z-sticky:  20;
  --z-fixed:   30;
  --z-modal:   50;
  --z-toast:   60;

  /* === Easing curves (Emil + soft-skill) === */
  /* ease-out es el default para entradas — feedback responsivo */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  /* ease-in para salidas */
  --ease-in:     cubic-bezier(0.5, 0, 0.75, 0);
  /* Inertia/spring suave para hover y micro-interactions */
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  /* "Snappy" para interfaces operativas (bandeja) */
  --ease-snappy: cubic-bezier(0.3, 0, 0.2, 1);

  /* === Transitions (siempre con propiedades específicas, nunca all) === */
  --t-color: 120ms var(--ease-snappy);
  --t-bg:    150ms var(--ease-snappy);
  --t-transform: 200ms var(--ease-spring);
  --t-shadow: 250ms var(--ease-out);
  /* Legacy aliases — los mantenemos hasta migrar todo */
  --transition-fast: 150ms var(--ease-snappy);
  --transition:      200ms var(--ease-spring);
  --transition-slow: 300ms var(--ease-out);

  /* === Focus ring === */
  --focus-ring: 0 0 0 3px rgba(3, 105, 161, 0.32);

  /* === Eyebrow micro-tag (taste-skill / soft-skill) === */
  --eyebrow-font-size: 11px;
  --eyebrow-tracking: 0.18em;
}

/* === Reset + Base === */
* { box-sizing: border-box; margin: 0; padding: 0; }
*:focus { outline: none; }
*:focus-visible {
  outline: 3px solid var(--cta-600);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

html, body {
  font-family: var(--font-app);
  color: var(--primary-900);
  background: var(--slate-50);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Contenidos para el ciudadano (mensajes, PDFs, web chat) usan Atkinson */
.citizen-text, .citizen-text * {
  font-family: var(--font-citizen);
  line-height: 1.65;
}

a {
  color: var(--cta-600);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { text-decoration-thickness: 2px; }

button { font-family: inherit; }

/* === Reduced motion preference === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* === Skip link (accesibilidad) === */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--primary-900);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  z-index: var(--z-toast);
  text-decoration: none;
  transition: top var(--transition);
}
.skip-link:focus { top: 16px; }

/* === Iconos SVG === */
.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

/* === App shell === */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--primary-800);
  color: rgba(255,255,255,0.92);
  padding: var(--space-4) 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-5) var(--space-6);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: var(--space-4);
}
.brand-mark {
  width: 40px; height: 40px;
  background: var(--accent-500);
  color: var(--primary-900);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 20px;
  font-family: var(--font-app);
}
.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 2px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 var(--space-3);
  flex: 1;
  overflow-y: auto;
}
.nav-section {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: var(--space-3) var(--space-3) var(--space-2);
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  color: rgba(255,255,255,0.85);
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast);
}
.nav-item:hover {
  background: rgba(255,255,255,0.08);
  text-decoration: none;
  color: #fff;
}
.nav-item.active {
  background: var(--cta-700);
  color: #fff;
  font-weight: 600;
}
.nav-item:focus-visible {
  outline-color: var(--accent-500);
}
.nav-badge {
  margin-left: auto;
  background: var(--danger-600);
  color: #fff;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

.user-card {
  margin: var(--space-4) var(--space-3) 0;
  padding: var(--space-3);
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--cta-600);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
}
.user-info { font-size: 12px; line-height: 1.3; }
.user-name { color: #fff; font-weight: 600; }
.user-role { color: rgba(255,255,255,0.65); margin-top: 2px; font-size: 11px; }

/* === Topbar === */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--slate-200);
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}
.crumbs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--slate-600);
}
.crumbs .sep { color: var(--slate-300); }
.crumbs .current { color: var(--primary-900); font-weight: 600; }

.topbar-search {
  margin-left: auto;
  display: flex;
  align-items: center;
  background: var(--slate-100);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  width: 320px;
  gap: var(--space-2);
  transition: background var(--transition-fast);
}
.topbar-search:focus-within {
  background: #fff;
  box-shadow: var(--focus-ring);
}
.topbar-search input {
  border: 0;
  background: transparent;
  outline: none;
  font-size: 14px;
  flex: 1;
  color: var(--primary-900);
  font-family: inherit;
}
.topbar-search input::placeholder { color: var(--slate-500); }

.topbar-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.icon-btn {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  background: var(--slate-100);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  position: relative;
  color: var(--slate-700);
  transition: background var(--transition-fast);
}
.icon-btn:hover { background: var(--slate-200); }
.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--danger-600);
  border: 2px solid #fff;
}

/* === Content === */
.content { padding: var(--space-6); flex: 1; }
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
}
.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-900);
  line-height: 1.2;
}
.page-sub {
  color: var(--slate-600);
  margin-top: 6px;
  font-size: 14px;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px var(--space-4);
  min-height: 44px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  background: var(--slate-100);
  color: var(--primary-900);
  transition: all var(--transition-fast);
  font-family: inherit;
}
.btn:hover { background: var(--slate-200); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
  outline: 3px solid var(--cta-600);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--cta-600);
  color: #fff;
}
.btn-primary:hover { background: var(--cta-700); }

.btn-success { background: var(--success-600); color: #fff; }
.btn-success:hover { background: var(--success-700); }
.btn-danger  { background: var(--danger-600); color: #fff; }
.btn-danger:hover { background: var(--danger-700); }

.btn-outline {
  background: transparent;
  border-color: var(--slate-300);
  color: var(--primary-800);
}
.btn-outline:hover { background: var(--slate-100); border-color: var(--slate-400); }

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  min-height: 36px;
}
.btn-lg {
  padding: var(--space-3) var(--space-5);
  font-size: 15px;
  min-height: 48px;
}

/* === Cards === */
.card {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-900);
}
.card-body { padding: var(--space-5); }

/* === KPI cards === */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.kpi {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-sm);
}
.kpi-label {
  font-size: 12px;
  color: var(--slate-600);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}
.kpi-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary-900);
  margin: 6px 0 4px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi-delta {
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}
.kpi-delta.up   { color: var(--success-700); }
.kpi-delta.down { color: var(--danger-700); }

/* === Tables === */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 720px;
}
thead th {
  text-align: left;
  font-size: 11px;
  color: var(--slate-600);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  padding: var(--space-3) var(--space-5);
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
  white-space: nowrap;
}
tbody td {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--slate-100);
  color: var(--primary-900);
  vertical-align: middle;
}
tbody tr {
  cursor: pointer;
  transition: background var(--transition-fast);
}
tbody tr:hover { background: var(--slate-50); }
tbody tr:last-child td { border-bottom: 0; }

/* === Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
}
.badge-green  { background: var(--success-50); color: var(--success-700); }
.badge-amber  { background: var(--warning-50); color: var(--warning-600); }
.badge-red    { background: var(--danger-50);  color: var(--danger-700); }
.badge-blue   { background: var(--cta-50);     color: var(--cta-700); }
.badge-slate  { background: var(--slate-100);  color: var(--slate-700); }

/* === Semáforo plazos === */
.semaforo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--slate-100);
  color: var(--slate-700);
  white-space: nowrap;
}
.semaforo::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--slate-400);
}
.semaforo.verde     { background: var(--success-50); color: var(--success-700); }
.semaforo.verde::before { background: var(--success-600); }
.semaforo.amarillo  { background: var(--warning-50); color: var(--warning-600); }
.semaforo.amarillo::before { background: var(--warning-600); }
.semaforo.rojo      { background: var(--danger-50);  color: var(--danger-700); }
.semaforo.rojo::before { background: var(--danger-600); }
.semaforo.vencido   { background: var(--critical-900); color: #fff; }
.semaforo.vencido::before { background: var(--accent-500); }

/* === Forms === */
.field { margin-bottom: var(--space-4); }
.label {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-800);
  display: block;
  margin-bottom: 6px;
}
.label .required { color: var(--danger-600); margin-left: 2px; }

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius);
  padding: 12px var(--space-4);
  font-size: 16px;
  min-height: 44px;
  font-family: var(--font-app);
  color: var(--primary-900);
  background: #fff;
  outline: none;
  transition: border var(--transition-fast), box-shadow var(--transition-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--slate-500); }
.input:hover, .select:hover, .textarea:hover {
  border-color: var(--slate-400);
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--cta-600);
  box-shadow: var(--focus-ring);
}
.input[aria-invalid="true"], .select[aria-invalid="true"] {
  border-color: var(--danger-600);
}
.input-error {
  font-size: 12px;
  color: var(--danger-700);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.input-help {
  font-size: 12px;
  color: var(--slate-600);
  margin-top: 4px;
}
.textarea { min-height: 100px; resize: vertical; line-height: 1.5; }

/* === Avatar variants === */
.av    { width: 28px; height: 28px; font-size: 11px; }
.av-lg { width: 48px; height: 48px; font-size: 16px; }

/* === Utility === */
.row     { display: flex; align-items: center; gap: var(--space-3); }
.col     { display: flex; flex-direction: column; gap: var(--space-2); }
.spacer  { flex: 1; }
.muted   { color: var(--slate-600); }
.small   { font-size: 13px; }
.bold    { font-weight: 700; }
.mono    { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-5); }

/* === Loading state === */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
}
.skeleton {
  background: linear-gradient(90deg, var(--slate-100), var(--slate-200), var(--slate-100));
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius);
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* === Responsive breakpoints (mobile-first thinking) === */
@media (max-width: 1023px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    height: auto;
    flex-direction: row;
    padding: 8px;
    z-index: var(--z-fixed);
  }
  .sidebar-brand, .nav-section, .user-card { display: none; }
  .nav { flex-direction: row; padding: 0; gap: 4px; justify-content: space-around; overflow-x: auto; }
  .nav-item { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px; }
  .main { padding-bottom: 80px; }
  .content { padding: var(--space-4); }
  .page-title { font-size: 22px; }
  .topbar-search { width: auto; max-width: 200px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: var(--space-3); }
  .kpi-value { font-size: 24px; }
  table { min-width: 100%; }
}

/* === Visually hidden (a11y) === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   PREMIUM AUDIT v0.3 — extensions
   Inspirado en: taste-skill, soft-skill, emil-design-eng, impeccable
   Sin romper accesibilidad: respeta prefers-reduced-motion, contrastes y touch targets.
   ============================================================ */

/* === Eyebrow — micro-tag arriba de los H1/H2 === */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-app);
  font-size: var(--eyebrow-font-size);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--eyebrow-tracking);
  color: var(--cta-700);
  margin-bottom: 12px;
  line-height: 1;
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1.5px;
  background: var(--cta-600);
  border-radius: 2px;
}
.eyebrow--accent { color: var(--accent-600); }
.eyebrow--accent::before { background: var(--accent-500); }
.eyebrow--muted  { color: var(--slate-600); }
.eyebrow--muted::before  { background: var(--slate-400); }
.eyebrow--invert { color: var(--accent-500); }
.eyebrow--invert::before { background: var(--accent-500); }

/* === Display headings — más presencia (taste rule 1) === */
.display-1 {
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  font-weight: 700;
}
.display-2 {
  font-size: clamp(28px, 3.5vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.display-num {
  font-family: var(--font-mono);
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1;
  letter-spacing: -0.02em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
/* Page title con más presencia */
.page-title {
  letter-spacing: -0.02em;
}

/* === Pressed state global para botones (emil + taste rule 5) === */
.btn:not(:disabled):active { transform: translateY(1px); }
.btn-primary:not(:disabled):active { transform: translateY(1px) scale(0.985); }
.iconbtn-sm:not(:disabled):active,
.icon-btn:not(:disabled):active { transform: scale(0.94); }

/* === Hover lift para tarjetas (opt-in) === */
.lift {
  transition: transform var(--t-transform), box-shadow var(--t-shadow);
}
.lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

/* === KPI mejorado — visual density según Rule 4 (sin caja en grupos) === */
.kpi-bare {
  background: transparent;
  border: 0;
  border-right: 1px solid var(--slate-200);
  border-radius: 0;
  padding: var(--space-3) var(--space-5);
  box-shadow: none;
}
.kpi-bare:last-child { border-right: 0; }
.kpis-bare {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: var(--space-6);
}
@media (max-width: 1023px) {
  .kpis-bare { grid-template-columns: repeat(2, 1fr); }
  .kpi-bare:nth-child(2n) { border-right: 0; }
}
@media (max-width: 600px) {
  .kpis-bare { grid-template-columns: 1fr; }
  .kpi-bare { border-right: 0; border-bottom: 1px solid var(--slate-200); }
  .kpi-bare:last-child { border-bottom: 0; }
}

/* === Skeleton loader (taste rule 5 — loading states) === */
@keyframes mp-shimmer {
  0%   { background-position: -100% 0; }
  100% { background-position: 200% 0; }
}
.skeleton-row {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--slate-100) 0%, var(--slate-200) 50%, var(--slate-100) 100%);
  background-size: 200% 100%;
  animation: mp-shimmer 1.4s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-row { animation: none; background: var(--slate-100); }
}

/* === Section macro-whitespace (soft-skill spatial rhythm) === */
.section-pad { padding-block: var(--space-12); }
.section-pad-lg { padding-block: var(--space-16); }

/* === Card with subtle edge refraction (taste anti-flat) === */
.card-refract {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm), var(--shadow-inset-top);
}

/* === Asymmetric reveal stagger (respeta reduced-motion) === */
@keyframes mp-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up {
  animation: mp-fade-up 380ms var(--ease-out) backwards;
}
.fade-up.delay-1 { animation-delay: 60ms; }
.fade-up.delay-2 { animation-delay: 120ms; }
.fade-up.delay-3 { animation-delay: 180ms; }
.fade-up.delay-4 { animation-delay: 240ms; }
@media (prefers-reduced-motion: reduce) {
  .fade-up { animation: none; }
}

/* === Mejora visual del KPI grande (display num) === */
.kpi-value {
  letter-spacing: -0.02em;
}
.kpi-value--xl {
  font-size: clamp(40px, 4vw, 52px);
  line-height: 1;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

/* === Premium card hover (cinematic) === */
.card-premium {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-transform), box-shadow var(--t-shadow), border-color var(--t-color);
}
.card-premium:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
  border-color: var(--slate-300);
}

/* === Refinamiento focus en contenedores complejos === */
.focus-frame:focus-within {
  box-shadow: var(--focus-ring);
  border-color: var(--cta-600);
}

/* === Min-height correcto para iOS Safari === */
@supports (height: 100dvh) {
  .min-h-screen { min-height: 100dvh; }
}

/* === Print-friendly (para mockups en PDF de presentación) === */
@media print {
  .sidebar, .topbar-actions, .row-actions { display: none !important; }
  body { background: white; }
}
