/* ============================================================================
   TRÍADA RESTAURANT CRM · Base + componentes compartidos
   Newsreader (titulares) + Hanken Grotesk (UI). Íconos de línea. AA obligatorio.
   ========================================================================== */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--color-bg);
  font-family: var(--font-sans);
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--color-primary-100); color: var(--color-primary-700); }

/* Scrollbars discretas */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--color-border-2); border-radius: var(--radius-full); border: 3px solid var(--color-bg); }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-3); }

h1, h2, h3, h4 { margin: 0; font-family: var(--font-serif); color: var(--color-ink); font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
button { font-family: inherit; }

/* Cifras siempre tabulares */
.tnum { font-variant-numeric: tabular-nums; }
.serif { font-family: var(--font-serif); }

/* Overline / eyebrow */
.eyebrow {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--color-text-3);
}

/* ---- Accesibilidad: foco visible siempre (§9 UX-2) ---- */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
a.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 200;
  background: var(--color-primary); color: #fff; padding: 10px 16px;
  border-radius: var(--radius-sm); font-weight: 700; text-decoration: none;
}
a.skip-link:focus { left: 8px; }
.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;
}

/* ============================================================================
   Botones — grotesk 600, radius-sm, tap target >= 44px en táctil
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border: none; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer;
  transition: background var(--dur-base) var(--ease-ui), transform var(--dur-base) var(--ease-ui), box-shadow var(--dur-base) var(--ease-ui);
  white-space: nowrap; color: var(--color-ink); background: var(--color-surface);
}
.btn svg { flex: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none !important; }
.btn-sm { height: 38px; padding: 0 14px; font-size: 13.5px; }
.btn-lg { height: 52px; padding: 0 22px; font-size: 16px; font-weight: 700; }
.btn-block { width: 100%; }

.btn-primary { background: var(--color-primary); color: #fff; box-shadow: 0 4px 12px rgba(12,124,136,.28); }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); transform: translateY(-1px); }
.btn-success { background: var(--color-success); color: #fff; box-shadow: 0 4px 12px rgba(46,155,115,.28); }
.btn-success:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(.96); }
.btn-navy { background: var(--color-navy); color: #fff; }
.btn-navy:hover:not(:disabled) { background: var(--color-navy-700); transform: translateY(-1px); }
.btn-secondary { background: var(--color-surface); border: 1px solid var(--color-border-2); color: var(--color-ink); }
.btn-secondary:hover:not(:disabled) { background: var(--color-surface-2); }
.btn-ghost { background: transparent; color: var(--color-text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--color-surface-2); color: var(--color-ink); }
.btn-danger { background: var(--color-surface); border: 1px solid var(--color-border-2); color: var(--color-error-fg); }
.btn-danger:hover:not(:disabled) { background: var(--color-error-soft); border-color: var(--color-error); }

/* Botón ícono cuadrado (stepper, cerrar) */
.icon-btn {
  width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--color-border-2); background: var(--color-surface); color: var(--color-text-2);
  border-radius: var(--radius-sm); cursor: pointer; transition: background var(--dur-fast) var(--ease-ui);
}
.icon-btn:hover { background: var(--color-surface-2); color: var(--color-ink); }

/* ============================================================================
   Badges / pills de estado — nunca solo color: punto + texto (§5.7 AA)
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; padding: 4px 11px; border-radius: var(--radius-full);
  white-space: nowrap; color: var(--color-text-2); background: var(--color-surface-2);
}
.badge .dot { width: 7px; height: 7px; border-radius: var(--radius-full); flex: none; }
.badge-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--radius-full);
  font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* ============================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); box-shadow: var(--shadow);
}
.card-pad { padding: var(--space-5); }

/* ============================================================================
   Inputs
   ========================================================================== */
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--color-text-2); margin-bottom: 7px; }
.input, .textarea, .select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--color-border-2);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 15px;
  color: var(--color-text); background: var(--color-surface);
}
.input::placeholder, .textarea::placeholder { color: var(--color-text-3); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--color-primary); box-shadow: var(--ring);
}
.textarea { min-height: 64px; resize: vertical; }

/* ============================================================================
   Estados de datos: vacío / cargando / error (§9 UX-6, exigido por brand)
   ========================================================================== */
.state { text-align: center; padding: 56px 20px; color: var(--color-text-3); }
.state-icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--color-surface-2); color: var(--color-text-3);
}
.state-title { font-family: var(--font-serif); font-size: 19px; font-weight: 600; color: var(--color-ink); }
.state-sub { font-size: 13.5px; margin-top: 6px; line-height: 1.5; max-width: 360px; margin-left: auto; margin-right: auto; }

/* Skeleton (carga) */
.skeleton { background: var(--color-surface-2); border-radius: var(--radius-sm); position: relative; overflow: hidden; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
  animation: triadaShimmer 1.3s infinite;
}
[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); }

/* ============================================================================
   Toast
   ========================================================================== */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 120; display: inline-flex; align-items: center; gap: 10px;
  max-width: calc(100vw - 32px); padding: 13px 18px; border-radius: var(--radius-md);
  background: var(--color-ink); color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg); animation: triadaToastIn var(--dur-med) var(--ease);
}
.toast svg { flex: none; color: var(--color-primary-300); }

/* ============================================================================
   Modal (comprobante, detalle)
   ========================================================================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 110; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(11,19,38,.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: triadaFade var(--dur-base) var(--ease-ui);
}
.modal {
  width: 100%; max-width: 440px; max-height: 92vh; overflow-y: auto;
  background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: triadaPop var(--dur-med) var(--ease);
}

/* ============================================================================
   Animaciones (§14). Respetar prefers-reduced-motion.
   ========================================================================== */
@keyframes triadaFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes triadaFadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes triadaPop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
@keyframes triadaToastIn { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes triadaPulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
@keyframes triadaShimmer { to { transform: translateX(100%); } }
@keyframes triadaSheetUp { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: triadaFadeUp var(--dur-slow) var(--ease); }
.live-dot { width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--color-success); animation: triadaPulse 2.4s ease-in-out infinite; flex: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::after { animation: none !important; transition: none !important; }
}
