/* ─── Micos ERP Tokens (matching globals.css) ─────── */
:root {
  --brand: #0fbbb6;
  --background: #f8fafb;
  --foreground: #0a1628;
  --card: #ffffff;
  --card-foreground: #0a1628;
  --surface: #f1f4f8;
  --surface-hover: #e8ecf1;
  --accent: #0fbbb6;
  --accent-hover: #0e9890;
  --accent-foreground: #ffffff;
  --muted: #f1f4f8;
  --muted-foreground: #64748b;
  --border: #e2e8f0;
  --input: #e2e8f0;
  --ring: #0fbbb6;
  --primary: #0a1628;
  --destructive: #ef4444;

  /* Estados semánticos — tokenizan los hex que se repetían a mano por el bundle
     (danger/success/warning); MISMO valor que antes → sin cambio visual. Al pintar
     un estado, referenciar estos tokens en vez del hex (regla §2: no inventar colores). */
  --danger: #dc2626;
  --success: #059669;
  --warning: #d97706;
  --warning-soft: #f59e0b;

  /* Pipeline */
  --pipeline-iniciado: #1d4ed8;
  --pipeline-iniciado-bg: #dbeafe;
  --pipeline-presupuesto: #6d28d9;
  --pipeline-presupuesto-bg: #ede9fe;
  --pipeline-oc: #4338ca;
  --pipeline-oc-bg: #e0e7ff;
  --pipeline-remito: #c2410c;
  --pipeline-remito-bg: #ffedd5;
  --pipeline-doc-medica: #be185d;
  --pipeline-doc-medica-bg: #fce7f3;
  --pipeline-factura: #0e7490;
  --pipeline-factura-bg: #cffafe;
  --pipeline-recibo: #047857;
  --pipeline-recibo-bg: #d1fae5;

  /* Sidebar */
  --sidebar: #ffffff;
  --sidebar-foreground: #0a1628;
  --sidebar-border: #e2e8f0;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(10, 22, 40, 0.04);
  --shadow-sm: 0 1px 3px rgba(10, 22, 40, 0.06), 0 1px 2px rgba(10, 22, 40, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(10, 22, 40, 0.06), 0 2px 4px -2px rgba(10, 22, 40, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(10, 22, 40, 0.06), 0 4px 6px -4px rgba(10, 22, 40, 0.04);
  --shadow-card: 0 1px 3px rgba(10, 22, 40, 0.04), 0 1px 2px rgba(10, 22, 40, 0.02);
  --shadow-card-hover: 0 8px 25px -5px rgba(10, 22, 40, 0.08), 0 4px 10px -5px rgba(10, 22, 40, 0.04);
  --shadow-elevated: 0 20px 40px -10px rgba(10, 22, 40, 0.1), 0 8px 16px -8px rgba(10, 22, 40, 0.06);
  --shadow-accent-soft: 0 20px 40px -15px rgba(15, 187, 182, 0.18);
  --shadow-accent-strong: 0 25px 60px -15px rgba(15, 187, 182, 0.35);
}

[data-theme="dark"] {
  --background: #0a1628;
  --foreground: #e8ecf2;
  --card: #111d30;
  --card-foreground: #e8ecf2;
  --surface: #152236;
  --surface-hover: #1a2a42;
  --accent: #0fbbb6;
  --accent-hover: #14d3cd;
  --accent-foreground: #0a1628;
  --muted: #1a2a42;
  --muted-foreground: #8896a8;
  --border: #1e3050;
  --input: #1e3050;
  --primary: #0fbbb6;
  --destructive: #ef4444;

  --pipeline-iniciado: #60a5fa;
  --pipeline-iniciado-bg: rgba(59, 130, 246, 0.15);
  --pipeline-presupuesto: #a78bfa;
  --pipeline-presupuesto-bg: rgba(139, 92, 246, 0.15);
  --pipeline-oc: #818cf8;
  --pipeline-oc-bg: rgba(99, 102, 241, 0.15);
  --pipeline-remito: #fb923c;
  --pipeline-remito-bg: rgba(249, 115, 22, 0.15);
  --pipeline-doc-medica: #f472b6;
  --pipeline-doc-medica-bg: rgba(236, 72, 153, 0.15);
  --pipeline-factura: #22d3ee;
  --pipeline-factura-bg: rgba(6, 182, 212, 0.15);
  --pipeline-recibo: #34d399;
  --pipeline-recibo-bg: rgba(16, 185, 129, 0.15);

  --sidebar: #0d1a2e;
  --sidebar-foreground: #e8ecf2;
  --sidebar-border: #1e3050;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-card-hover: 0 8px 20px rgba(0,0,0,0.5);
  --shadow-elevated: 0 20px 40px rgba(0,0,0,0.55);
  --shadow-accent-soft: 0 20px 40px -15px rgba(15, 187, 182, 0.25);
  --shadow-accent-strong: 0 25px 60px -15px rgba(15, 187, 182, 0.45);
}

/* ─── Base ─────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background-color: var(--background);
  color: var(--foreground);
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.4s ease, color 0.4s ease;
}

#root { min-height: 100vh; }

/* ─── Inline edit inputs ────────────────────────── */
/* Tinted, padded inputs that feel like intentional form controls — not afterthought */
.edit-input {
  background: color-mix(in oklab, var(--surface) 60%, transparent);
  outline: none;
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  padding: 6px 10px;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
  font-weight: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  border-radius: 8px;
  display: block;
  box-sizing: border-box;
  min-height: 36px;
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.02);
}
.edit-input:hover {
  background: color-mix(in oklab, var(--accent) 4%, var(--card));
  border-color: color-mix(in oklab, var(--accent) 35%, var(--border));
}
.edit-input:focus {
  background: var(--card);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent);
}
.edit-input::-webkit-inner-spin-button,
.edit-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.edit-input[type="number"] {
  -moz-appearance: textfield;
}
.edit-input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.edit-input[type="date"]:hover::-webkit-calendar-picker-indicator {
  opacity: 1;
}
/* Dark mode: invert date picker icon so it stays visible */
[data-theme="dark"] .edit-input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}
/* Filtros de fecha de las tablas (TableDateRange) — mismo arreglo */
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.85);
}
/* Native select arrow — recolor by theme via accent variable */
select.edit-input {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 5 L6 8 L9 5' stroke='%230fbbb6' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px;
  cursor: pointer;
}

/* Compact variant for table cells — same look, less vertical padding so rows stay tight */
.edit-input--cell {
  padding: 5px 8px;
  min-height: 0;
}

/* ─── Inventory picker popover (InventoryDescCell, portal a body) ── */
.inv-pop {
  position: fixed;
  z-index: 9999;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 44px -12px rgba(0, 0, 0, 0.35);
  padding: 6px;
  max-height: 320px;
  overflow-y: auto;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}
.inv-pop__head {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted-foreground);
  padding: 7px 10px 7px;
}
.inv-pop__row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) auto;
  /* P17b: align-items pasa de center a start — la descripción ahora hace wrap
     (ver .inv-pop__desc abajo) y puede ocupar 2+ líneas; centrar dejaba el
     SKU/precio "flotando" a mitad de un bloque de texto multilínea. */
  align-items: start;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.inv-pop__row + .inv-pop__row {
  border-top: 1px solid color-mix(in oklab, var(--border) 45%, transparent);
}
.inv-pop__row:hover {
  background: color-mix(in oklab, var(--accent) 9%, transparent);
}
.inv-pop__sku {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-pop__desc {
  font-size: 13px;
  font-weight: 600;
  color: var(--foreground);
  /* P17b (recorrido §4): si el nombre no entra, hace wrap y sigue abajo —
     antes truncaba con ellipsis y el usuario no podía leer el producto
     completo antes de elegirlo. */
  white-space: normal;
  overflow-wrap: break-word;
  min-width: 0;
}
.inv-pop__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  white-space: nowrap;
  padding-top: 1px;
}
.inv-pop__price {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}
.inv-pop__stock {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
}

/* ─── Date-range picker popover (TableDateRange, portal a body) ── */
.dr-pop {
  position: fixed;
  z-index: 9999;
  width: 288px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 44px -12px rgba(0, 0, 0, 0.35);
  padding: 12px;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  user-select: none;
}
.dr-pop__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.dr-pop__title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--foreground);
}
.dr-pop__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.dr-pop__nav:hover {
  background: color-mix(in oklab, var(--accent) 10%, transparent);
  color: var(--accent);
}
.dr-pop__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.dr-pop__wd {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  text-align: center;
  padding: 4px 0 6px;
}
.dr-pop__day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--foreground);
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.dr-pop__day:hover {
  background: color-mix(in oklab, var(--accent) 14%, transparent);
}
.dr-pop__day.is-today {
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 50%, transparent);
}
.dr-pop__day.in-range {
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  border-radius: 0;
}
.dr-pop__day.is-sel {
  background: var(--accent);
  color: var(--accent-foreground);
  font-weight: 800;
  box-shadow: none;
}
.dr-pop__day.range-start {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.dr-pop__day.range-end {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* Edit-mode textarea — matches input chrome */
.edit-textarea {
  background: color-mix(in oklab, var(--surface) 60%, transparent);
  outline: none;
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: 10px;
  padding: 12px 14px;
  width: 100%;
  resize: vertical;
  field-sizing: content;
  min-height: 5.4em;
  max-height: 60vh;
  font-family: inherit;
  font-weight: inherit;
  font-size: inherit;
  line-height: 1.6;
  color: var(--foreground);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.02);
}
.edit-textarea:hover {
  background: color-mix(in oklab, var(--accent) 4%, var(--card));
  border-color: color-mix(in oklab, var(--accent) 35%, var(--border));
}
.edit-textarea:focus {
  background: var(--card);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent);
}

/* ─── Edit-mode visual treatments ──────────────── */
.doc-card--editing {
  border-color: color-mix(in oklab, var(--accent) 25%, var(--border)) !important;
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--accent) 12%, transparent), var(--shadow-card);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Row highlight for items in edit mode */
.item-row--editing {
  position: relative;
  transition: background-color 0.15s ease;
}
.item-row--editing:hover {
  background: color-mix(in oklab, var(--accent) 4%, transparent);
}
.item-row--editing::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: color-mix(in oklab, var(--accent) 30%, transparent);
  border-radius: 0 2px 2px 0;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.item-row--editing:hover::before,
.item-row--editing:focus-within::before {
  opacity: 1;
}

/* Party edit button (top-right in party blocks) */
.party-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: color-mix(in oklab, var(--surface) 50%, transparent);
  border: 1px solid color-mix(in oklab, var(--border) 60%, transparent);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.party-edit-btn:hover {
  background: color-mix(in oklab, var(--accent) 10%, var(--card));
  border-color: color-mix(in oklab, var(--accent) 45%, var(--border));
  color: var(--accent);
}
.party-edit-btn:active {
  transform: scale(0.94);
}
.edit-banner {
  background: color-mix(in oklab, var(--accent) 7%, var(--card));
  border: 1px solid color-mix(in oklab, var(--accent) 35%, var(--border));
  border-radius: 14px;
}

@keyframes edit-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.edit-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  animation: edit-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

button { font-family: inherit; }
input, textarea { font-family: inherit; }

/* ─── Extracción IA por archivo (FileUploadCard) ───── */
.ai-extract-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.ai-extract-link:hover {
  background: color-mix(in oklab, var(--accent) 12%, var(--card));
  border-color: color-mix(in oklab, var(--accent) 32%, var(--border));
}
.ai-spin { animation: ai-spin 1s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-prog { width: 62%; animation: ai-prog 1.4s ease-in-out infinite; }
@keyframes ai-prog { 0% { width: 18%; } 50% { width: 78%; } 100% { width: 18%; } }

/* ─── Autocompletado IA: resalte del campo recién completado ───── */
.autofill-flash { animation: autofill-flash 2.2s ease-out; }
@keyframes autofill-flash {
  0%   { background: color-mix(in oklab, var(--accent) 22%, transparent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent); border-radius: 8px; }
  100% { background: transparent; box-shadow: 0 0 0 3px transparent; border-radius: 8px; }
}

/* ─── Ambient lights (DNA from public page) ────────── */
.ambient-lights {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.ambient-light {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  opacity: 0.55;
  transition: opacity 0.5s ease;
}
[data-theme="dark"] .ambient-light { opacity: 0.32; }

.al-1 {
  width: 720px; height: 720px;
  background: var(--accent);
  top: -280px; right: -200px;
  opacity: 0.13;
  animation: al-drift-1 7s ease-in-out infinite;
  will-change: transform;
}
[data-theme="dark"] .al-1 { opacity: 0.18; }

.al-2 {
  width: 520px; height: 520px;
  background: #0082F3;
  bottom: -180px; left: 100px;
  opacity: 0.08;
  animation: al-drift-2 9s ease-in-out infinite;
  will-change: transform;
}
[data-theme="dark"] .al-2 { opacity: 0.12; }

.al-3 {
  width: 360px; height: 360px;
  background: #8B5CF6;
  top: 40%; left: 45%;
  opacity: 0.05;
  animation: al-drift-3 10s ease-in-out infinite;
  will-change: transform;
}
[data-theme="dark"] .al-3 { opacity: 0.10; }

/* Drifting ambient lights — same vibe as login.html */
@keyframes al-drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25%      { transform: translate(-220px, 180px) scale(1.15); }
  50%      { transform: translate(140px, 260px) scale(1.05); }
  75%      { transform: translate(200px, 100px) scale(0.92); }
}
@keyframes al-drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(260px, -200px) scale(1.18); }
  66%      { transform: translate(-180px, -120px) scale(0.9); }
}
@keyframes al-drift-3 {
  0%, 100% { transform: translate(0, 0) scale(0.95); }
  50%      { transform: translate(-240px, -220px) scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
  .al-1, .al-2, .al-3 { animation: none; }
}

/* ─── Animations ──────────────────────────────────── */
/* Entrance animations: fade + lift from below. Honor prefers-reduced-motion. */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scale-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slide-in-left {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes glow-pulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 0.9; }
}
/* Directional thread navigation: messages slide in from the side you're heading toward */
@keyframes thread-slide-from-right {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes thread-slide-from-left {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}

.animate-fade-in-up    { animation: fade-in-up 0.55s cubic-bezier(0.16, 1, 0.3, 1) both; }
.animate-fade-in       { animation: fade-in 0.45s ease both; }
/* Feedback al confirmar una parte: el nombre entra con un pequeño pop */
@keyframes name-pop {
  0%   { opacity: 0; transform: translateX(26px); }
  100% { opacity: 1; transform: translateX(0); }
}
.animate-name-pop { animation: name-pop 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
/* Variantes direccionales para el título Cobros/Pagos (más recorrido, sin recorte) */
@keyframes name-pop-ltr {
  0%   { opacity: 0; transform: translateX(-38px); }
  100% { opacity: 1; transform: translateX(0); }
}
@keyframes name-pop-rtl {
  0%   { opacity: 0; transform: translateX(38px); }
  100% { opacity: 1; transform: translateX(0); }
}
.animate-name-pop-ltr { animation: name-pop-ltr 0.55s cubic-bezier(0.16, 1, 0.3, 1) both; }
.animate-name-pop-rtl { animation: name-pop-rtl 0.55s cubic-bezier(0.16, 1, 0.3, 1) both; }
.animate-scale-in      { animation: scale-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
.animate-slide-in-left { animation: slide-in-left 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
.thread-nav-next { animation: thread-slide-from-right 0.34s cubic-bezier(0.16, 1, 0.3, 1) both; }
.thread-nav-prev { animation: thread-slide-from-left 0.34s cubic-bezier(0.16, 1, 0.3, 1) both; }

@media (prefers-reduced-motion: reduce) {
  .animate-fade-in-up,
  .animate-fade-in,
  .animate-scale-in,
  .animate-slide-in-left,
  .thread-nav-next,
  .thread-nav-prev,
  .stagger > *,
  .stagger-rows > * {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Staggered children — same approach: visible by default */
.stagger > * { animation: fade-in-up 0.55s cubic-bezier(0.16, 1, 0.3, 1) both; }
.stagger > *:nth-child(1) { animation-delay: 30ms; }
.stagger > *:nth-child(2) { animation-delay: 80ms; }
.stagger > *:nth-child(3) { animation-delay: 130ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 230ms; }
.stagger > *:nth-child(6) { animation-delay: 280ms; }
.stagger > *:nth-child(7) { animation-delay: 330ms; }
.stagger > *:nth-child(8) { animation-delay: 380ms; }
.stagger > *:nth-child(9) { animation-delay: 430ms; }
.stagger > *:nth-child(10) { animation-delay: 480ms; }

.stagger-rows > * { animation: fade-in-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
.stagger-rows > *:nth-child(1) { animation-delay: 0ms; }
.stagger-rows > *:nth-child(2) { animation-delay: 35ms; }
.stagger-rows > *:nth-child(3) { animation-delay: 70ms; }
.stagger-rows > *:nth-child(4) { animation-delay: 105ms; }
.stagger-rows > *:nth-child(5) { animation-delay: 140ms; }
.stagger-rows > *:nth-child(6) { animation-delay: 175ms; }
.stagger-rows > *:nth-child(7) { animation-delay: 210ms; }
.stagger-rows > *:nth-child(8) { animation-delay: 245ms; }
.stagger-rows > *:nth-child(9) { animation-delay: 280ms; }
.stagger-rows > *:nth-child(10) { animation-delay: 315ms; }
.stagger-rows > *:nth-child(11) { animation-delay: 350ms; }
.stagger-rows > *:nth-child(12) { animation-delay: 385ms; }

/* ─── Cursor-spotlight (lifted from public Home) ───── */
/* A single system that every card-like surface opts into. The JS handler
   in shell.jsx updates --mx / --my on the element under the cursor.
   Default --mx/--my is far off-canvas so no glow shows until interaction. */
.glow-card,
.kpi-card,
.kpi-card-tile,
.stat-tile,
.sidebar-block {
  position: relative;
  isolation: isolate;
}
.glow-card::before,
.kpi-card::before,
.kpi-card-tile::before,
.stat-tile::before,
.sidebar-block::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    600px circle at var(--mx, -300px) var(--my, -300px),
    rgba(15, 187, 182, 0.10),
    transparent 40%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 0;
}
[data-theme="dark"] .glow-card::before,
[data-theme="dark"] .kpi-card::before,
[data-theme="dark"] .kpi-card-tile::before,
[data-theme="dark"] .stat-tile::before,
[data-theme="dark"] .sidebar-block::before {
  background: radial-gradient(
    600px circle at var(--mx, -300px) var(--my, -300px),
    rgba(15, 187, 182, 0.18),
    transparent 40%
  );
}
.glow-card:hover::before,
.kpi-card:hover::before,
.kpi-card-tile:hover::before,
.stat-tile:hover::before,
.sidebar-block:hover::before {
  opacity: 1;
}
/* Children sit above the spotlight pseudo-element */
.glow-card > *,
.kpi-card > *,
.kpi-card-tile > *,
.stat-tile > *,
.sidebar-block > * {
  position: relative;
  z-index: 1;
}

/* ─── Glow card (the larger surface variant) ────────────── */
.glow-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s ease;
  overflow: hidden;
}
.glow-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover), var(--shadow-accent-soft);
  border-color: color-mix(in oklab, var(--accent) 40%, var(--border));
}

/* ─── KPI card (Behance style: clean, no glow, no icon) ── */
.kpi-card {
  background: var(--card);
  border: 1px solid color-mix(in oklab, var(--border) 60%, transparent);
  border-radius: 1.5rem;
  box-shadow: var(--shadow-card);
  padding: 2rem;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.25s ease;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: color-mix(in oklab, var(--accent) 30%, var(--border));
}
.kpi-card-tile {
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.25s ease;
}
.kpi-card-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: color-mix(in oklab, var(--accent) 35%, var(--border)) !important;
}
.kpi-alert {
  background: rgba(249, 115, 22, 0.06);
  border-color: rgba(249, 115, 22, 0.25);
  box-shadow: none;
}
[data-theme="dark"] .kpi-alert {
  background: rgba(249, 115, 22, 0.10);
  border-color: rgba(249, 115, 22, 0.30);
}

/* ─── Table row hover ────────────────────────────── */
.table-row {
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.table-row:hover {
  background-color: var(--surface);
}

/* ─── Rich expediente row (with accent slide-in + per-row cursor spotlight) ── */
.exp-row {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transition: background-color 0.25s ease;
}
.exp-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
}
/* Cursor spotlight — per row, not per table */
.exp-row::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    320px circle at var(--mx, -300px) var(--my, -300px),
    rgba(15, 187, 182, 0.10),
    transparent 45%
  );
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  z-index: 0;
}
[data-theme="dark"] .exp-row::after {
  background: radial-gradient(
    320px circle at var(--mx, -300px) var(--my, -300px),
    rgba(15, 187, 182, 0.16),
    transparent 45%
  );
}
.exp-row:hover::after { opacity: 1; }
.exp-row > * { position: relative; z-index: 1; }
.exp-row:hover {
  background: color-mix(in oklab, var(--accent) 4%, var(--card));
}
[data-theme="dark"] .exp-row:hover {
  background: color-mix(in oklab, var(--accent) 6%, var(--card));
}
.exp-row:hover::before {
  opacity: 1;
  transform: translateX(0);
}
.exp-chev {
  opacity: 0.35;
  transform: translateX(0);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.25s ease;
}
.exp-row:hover .exp-chev {
  opacity: 1;
  transform: translateX(3px);
  color: var(--accent);
}
.exp-row:hover .exp-chev > span {
  color: var(--accent);
}

/* ─── Sidebar nav items ──────────────────────────── */
.nav-item {
  position: relative;
  overflow: hidden;
}
.nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120px circle at var(--mx, 0) var(--my, 0), color-mix(in oklab, var(--accent) 10%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.nav-item:hover::before { opacity: 1; }

/* ─── Nav link active indicator ──────────────────── */
.nav-active-indicator {
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 24px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 14px rgba(15, 187, 182, 0.6);
}

/* ─── Pipeline accordion ─────────────────────────── */
.accordion-content {
  overflow: hidden;
  transition: grid-template-rows 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: grid;
  grid-template-rows: 0fr;
}
.accordion-content.open {
  grid-template-rows: 1fr;
}
.accordion-content > div {
  overflow: hidden;
  min-height: 0;
}

/* ─── Scroll bar tasteful ──────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in oklab, var(--muted-foreground) 25%, transparent);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in oklab, var(--muted-foreground) 45%, transparent);
  background-clip: padding-box;
  border: 2px solid transparent;
}
.scrollbar-none::-webkit-scrollbar { display: none; }
.scrollbar-none { scrollbar-width: none; }

/* ─── Paper sheet (A4-like printed doc preview) ─── */
.paper-sheet {
  background: transparent;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  box-shadow:
    0 30px 60px -25px rgba(10, 22, 40, 0.18),
    0 12px 24px -12px rgba(10, 22, 40, 0.10);
}
[data-theme="dark"] .paper-sheet {
  box-shadow:
    0 30px 70px -20px rgba(0, 0, 0, 0.55),
    0 12px 30px -12px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.04);
}
.paper-sheet__inner {
  background: #fdfcfa;
  color: #1a1a1a;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 11.5px;
  line-height: 1.45;
  padding: 36px 40px;
  min-height: 600px;
  display: flex;
  flex-direction: column;
}
.paper-sheet__inner * { color: inherit; }

/* ── Print sub-elements ───────────── */
.prn-row {
  border: 1px solid #c9c9c9;
}
.prn-row + .prn-row {
  border-top: none;
}
.prn-row.prn-footer {
  margin-top: auto;
}

/* Header */
.prn-header {
  display: flex;
  align-items: stretch;
}
.prn-col {
  padding: 14px 16px;
}
.prn-empresa {
  flex: 1 1 48%;
}
.prn-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--accent);
}
.prn-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.prn-logo-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--accent);
}
.prn-logo-tag {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #777;
}
.prn-empresa-info {
  font-size: 11px;
  line-height: 1.55;
  color: #2a2a2a;
}
.prn-empresa-info strong { font-weight: 700; }

.prn-letra-wrap {
  flex: 0 0 86px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.prn-letra-box {
  background: #ececec;
  border: 1px solid #c9c9c9;
  border-top: none;
  padding: 8px 18px 10px;
  min-width: 60px;
  text-align: center;
}
.prn-letra {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: #1a1a1a;
}
.prn-codigo {
  font-size: 10px;
  color: #666;
  margin-top: 3px;
  font-weight: 600;
}

.prn-doc-data {
  flex: 1 1 40%;
  text-align: right;
}
.prn-tipo {
  margin-bottom: 14px;
}
.prn-tipo-titulo {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
}
.prn-tipo-sub {
  font-size: 10.5px;
  color: #555;
  margin-top: 2px;
  font-weight: 500;
}
.prn-numero {
  margin-bottom: 9px;
}
.prn-numero-line {
  font-size: 16px;
  font-weight: 500;
}
.prn-numero-line strong {
  font-weight: 800;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.prn-numero-line sup {
  font-size: 9px;
}
.prn-fecha {
  font-size: 12px;
  margin-top: 3px;
}
.prn-fecha strong { font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.prn-fecha-extra {
  font-size: 10.5px;
  color: #555;
}
.prn-fiscal {
  font-size: 11px;
  line-height: 1.55;
  color: #2a2a2a;
}

/* Cliente */
.prn-cliente {
  padding: 10px 16px;
  font-size: 11px;
  line-height: 1.65;
}
.prn-cliente-line span:first-child {
  font-weight: 600;
  color: #444;
}
.prn-cliente-line strong {
  font-weight: 700;
}
.prn-cliente-split {
  display: flex;
  margin-top: 4px;
  gap: 24px;
}
.prn-cliente-split > div {
  flex: 1;
}
.prn-cliente-split span {
  font-weight: 600;
  color: #444;
}

/* Items table */
.prn-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #c9c9c9;
  border-top: none;
  table-layout: fixed;
  flex: 1;
  font-size: 11px;
}
.prn-table thead tr {
  background: #6c6c6c;
  color: #e8e8e8;
}
.prn-table th {
  padding: 11px 8px;
  font-weight: 500;
  font-size: 10.5px;
  text-align: center;
  border-right: 1px solid #5a5a5a;
}
.prn-table th:last-child { border-right: none; }
.prn-table td {
  padding: 12px 8px 10px;
  border-right: 1px solid #d8d8d8;
  vertical-align: top;
  font-size: 11px;
}
.prn-table td:last-child { border-right: none; }
.prn-table tbody tr {
  border-bottom: 1px solid #ececec;
}
.prn-table tbody tr:last-child {
  border-bottom: none;
}
.prn-table .prn-filler td {
  height: 100%;
  padding: 0;
}
.prn-item-desc {
  font-weight: 500;
  line-height: 1.35;
}
.prn-item-lote {
  font-size: 9.5px;
  color: #777;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* Footer */
.prn-footer {
  display: flex;
  border-top: none;
}
.prn-footer-left {
  flex: 1 1 56%;
  padding: 12px 16px;
  border-right: 1px solid #c9c9c9;
}
.prn-footer-right {
  flex: 1 1 44%;
  padding: 12px 16px;
  text-align: right;
  display: flex;
  flex-direction: column;
}
.prn-letras {
  font-size: 10.5px;
  margin-bottom: 12px;
  line-height: 1.35;
  font-weight: 500;
}
.prn-paciente {
  font-size: 10px;
  line-height: 1.4;
  margin-bottom: 14px;
  color: #333;
}
.prn-paciente strong { font-weight: 700; }
.prn-terminos {
  font-size: 9.5px;
  line-height: 1.5;
  color: #333;
}
.prn-terminos-title {
  font-weight: 700;
  margin-bottom: 2px;
}
.prn-terminos-line {
  font-weight: 500;
}
.prn-desglose {
  font-size: 11.5px;
  line-height: 1.5;
  color: #333;
}
.prn-desglose div {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.prn-total {
  font-size: 17px;
  font-weight: 800;
  margin-top: auto;
  padding-top: 18px;
  color: var(--accent);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: baseline;
}
.prn-total span { font-family: 'JetBrains Mono', monospace; font-weight: 800; }

/* ─── Sidebar block ──────────────────────────────── */
.sidebar-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: border-color 0.25s ease;
}
.sidebar-block:hover {
  border-color: color-mix(in oklab, var(--accent) 25%, var(--border));
}

/* ─── Custom checkbox (estilo propio · light + dark) ── */
.cc-check {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 5px;
  border: 1.5px solid color-mix(in oklab, var(--muted-foreground) 48%, transparent);
  background: color-mix(in oklab, var(--card) 88%, transparent);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.cc-check:hover { border-color: color-mix(in oklab, var(--accent) 65%, var(--border)); }
.cc-check::after {
  content: '';
  width: 4px;
  height: 8px;
  margin-top: -1px;
  border: solid var(--accent-foreground);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.13s cubic-bezier(0.16, 1, 0.3, 1);
}
.cc-check:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.cc-check:checked::after { transform: rotate(45deg) scale(1); }
.cc-check:indeterminate {
  background: var(--accent);
  border-color: var(--accent);
}
.cc-check:indeterminate::after {
  width: 8px; height: 0; margin-top: 0;
  border-width: 0 0 2px 0;
  transform: rotate(0deg) scale(1);
}
.cc-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ─── Chip (filter button) ───────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.05rem;
  border-radius: 0.75rem;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.chip:hover {
  filter: brightness(0.97);
}

/* ─── Spotlight continuo sobre toda la tabla del CRM ── */
.crm-table-glow::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(520px circle at var(--mx, -500px) var(--my, -500px),
    color-mix(in oklab, var(--accent) 14%, transparent), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 0;
}
[data-theme="dark"] .crm-table-glow::after {
  background: radial-gradient(520px circle at var(--mx, -500px) var(--my, -500px),
    color-mix(in oklab, var(--accent) 20%, transparent), transparent 58%);
}
.crm-table-glow:hover::after { opacity: 1; }
.crm-table-glow > * { position: relative; z-index: 1; }
/* Dentro de la tabla NO hay efectos por fila: el único spotlight es el del card */
.crm-table-glow .exp-row::after { display: none !important; }
.crm-table-glow .exp-row::before { display: none !important; }
.crm-table-glow .exp-row:hover { background: transparent !important; }

/* ─── Stat tile (smaller variant of kpi-card) ────── */
.stat-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 1.125rem 1.25rem;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.stat-tile:hover {
  border-color: color-mix(in oklab, var(--accent) 30%, var(--border));
}

/* ─── Pipeline base/border ─────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid transparent;
}
.pill-iniciado { background: var(--pipeline-iniciado-bg); color: var(--pipeline-iniciado); }
.pill-presupuesto { background: var(--pipeline-presupuesto-bg); color: var(--pipeline-presupuesto); }
.pill-oc { background: var(--pipeline-oc-bg); color: var(--pipeline-oc); }
.pill-remito { background: var(--pipeline-remito-bg); color: var(--pipeline-remito); }
.pill-doc-medica { background: var(--pipeline-doc-medica-bg); color: var(--pipeline-doc-medica); }
.pill-doc-extra { background: color-mix(in oklab, var(--muted-foreground) 14%, transparent); color: var(--muted-foreground); }
.pill-factura { background: var(--pipeline-factura-bg); color: var(--pipeline-factura); }
.pill-recibo { background: var(--pipeline-recibo-bg); color: var(--pipeline-recibo); }

/* ─── Button base ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.5rem;
  padding: 0 1rem;
  font-size: 13px;
  font-weight: 600;
  text-transform: capitalize;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-foreground);
  box-shadow: 0 4px 14px -4px rgba(15, 187, 182, 0.45);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 8px 22px -6px rgba(15, 187, 182, 0.6);
  transform: translateY(-1px);
}
.btn-outline {
  background: var(--card);
  color: var(--foreground);
  border-color: var(--border);
}
.btn-outline:hover {
  border-color: color-mix(in oklab, var(--accent) 50%, var(--border));
  color: var(--accent);
  background: var(--card);
}
.btn-ghost {
  background: transparent;
  color: var(--muted-foreground);
}
.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--foreground);
}
.btn-icon {
  height: 2.25rem;
  width: 2.25rem;
  padding: 0;
  border-radius: 0.75rem;
}
/* Botón deshabilitado: gris plano, como un input deshabilitado, SIN feedback
   (sin sombra, sin lift, sin cambio en hover/active). Aplica a todas las variantes.
   El cursor not-allowed lo pone la regla global de cursores. */
.btn:disabled,
.btn[disabled],
.btn[aria-disabled="true"],
.btn.is-disabled {
  background: var(--muted);
  color: var(--muted-foreground);
  border-color: color-mix(in oklab, var(--border) 70%, transparent);
  box-shadow: none;
  transform: none;
}
.btn:disabled:hover,
.btn[disabled]:hover,
.btn[aria-disabled="true"]:hover,
.btn.is-disabled:hover {
  background: var(--muted);
  color: var(--muted-foreground);
  border-color: color-mix(in oklab, var(--border) 70%, transparent);
  box-shadow: none;
  transform: none;
}
.btn[aria-disabled="true"]:active,
.btn.is-disabled:active { transform: none; }

/* ─── Inputs ──────────────────────────────────────── */
.input {
  height: 2.5rem;
  padding: 0 0.875rem;
  font-size: 13px;
  font-weight: 500;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--foreground);
  border-radius: 0.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
  width: 100%;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent);
}
.input::placeholder { color: var(--muted-foreground); }

/* Form cells used inside Items breakdown */
.form-cell {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  font-size: 12.5px;
  font-weight: 500;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--foreground);
  border-radius: 8px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-cell:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent);
}
.form-cell[readonly] {
  background: var(--muted);
  cursor: default;
}

/* ─── Util text classes ───────────────────────────── */
.font-mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace; }
.text-accent { color: var(--accent); }
.text-foreground { color: var(--foreground); }
.text-muted { color: var(--muted-foreground); }
.bg-card { background: var(--card); }
.bg-surface { background: var(--surface); }
.bg-accent { background: var(--accent); }
.border-default { border-color: var(--border); }
.tabular-nums { font-variant-numeric: tabular-nums; }

/* ─── Visual feedback (system-wide) ───────────────── */
/* Consistent focus ring across every interactive element so keyboard
   users always see where they are. Mouse users never see it.
   Card-shaped buttons (.exp-row, .kpi-card-tile, .glow-card) get a
   subtle inner ring instead of a hard outline so they don't look
   "stuck-focused" after click. */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
.chip:focus-visible,
.nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 10px;
}
.exp-row:focus-visible,
.kpi-card-tile:focus-visible,
.glow-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 55%, transparent), var(--shadow-card);
  border-color: color-mix(in oklab, var(--accent) 55%, var(--border));
}
/* Mouse-driven clicks should never leave a card looking focused */
.exp-row:focus:not(:focus-visible),
.kpi-card-tile:focus:not(:focus-visible),
.glow-card:focus:not(:focus-visible) {
  outline: none;
  box-shadow: var(--shadow-card);
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none; /* inputs get their own focus styling via border + ring */
}

/* Tactile press feedback on the components that were missing it.
   `.btn` already has `:active { transform: scale(0.98) }`; mirror that
   for chips, rows, KPI tiles, and sidebar nav so the whole UI feels alive. */
.chip:active { transform: translateY(0) scale(0.97); }
.exp-row:active {
  background: color-mix(in oklab, var(--accent) 7%, var(--card));
}
.kpi-card-tile:active { transform: translateY(-1px) scale(0.995); }
.nav-item:active { transform: scale(0.98); }
.party-edit-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Standardized back-link (used on every detail screen) */
.back-link:hover { transform: translateX(-2px); }
.back-link {
  transition: color 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Cursores: interactivo vs no-interactivo ────────── */
/* Todo lo clickeable muestra el cursor de mano… */
button:not(:disabled),
[role="button"]:not([aria-disabled="true"]),
a[href],
label[for],
select:not(:disabled),
summary,
.chip,
.exp-row,
.nav-item,
.cursor-pointer {
  cursor: pointer;
}
/* …y todo lo deshabilitado/solo-lectura lo deja claro. */
button:disabled,
select:disabled,
input:disabled,
input[readonly],
textarea:disabled,
[aria-disabled="true"],
.is-disabled {
  cursor: not-allowed;
}

/* Overline / section label */
.overline {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}
.overline-muted {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

/* Focus ring */
.focus-ring:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Print clean */
@media print {
  .no-print { display: none !important; }
}
