/* Sistema de diseño "Dark & Gold Executive Medical" — complementos a Tailwind */
:root {
  --bg: #0a0d14;
  --bg-2: #111827;
  --surface: #182032;
  --line: #2a3447;
  --gold: #d4af37;
  --gold-hover: #e6c249;
  --gold-glow: rgba(212, 175, 55, 0.15);
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  color-scheme: dark;
}

html { -webkit-tap-highlight-color: transparent; }
body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(212, 175, 55, 0.06), transparent 60%),
    radial-gradient(900px 400px at -10% 10%, rgba(30, 41, 59, 0.55), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

.tabular-nums, table, input, .num { font-variant-numeric: tabular-nums; }

::selection { background: rgba(212, 175, 55, 0.35); color: #fff; }

/* Scrollbars sobrios */
* { scrollbar-width: thin; scrollbar-color: #2a3447 transparent; }
*::-webkit-scrollbar { height: 8px; width: 8px; }
*::-webkit-scrollbar-thumb { background: #2a3447; border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* Inputs */
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type='date']::-webkit-calendar-picker-indicator { filter: invert(0.75) sepia(1) saturate(3) hue-rotate(5deg); opacity: 0.7; cursor: pointer; }
select { background-image: none !important; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: '';
  position: absolute; right: 10px; top: 50%;
  width: 6px; height: 6px; margin-top: -4px;
  border-right: 1.5px solid #64748b; border-bottom: 1.5px solid #64748b;
  transform: rotate(45deg); pointer-events: none;
}

/* Tabla del constructor */
.plan-table th { font-weight: 600; }
.plan-table tbody tr.row:hover { background: rgba(255, 255, 255, 0.018); }
.plan-table td { vertical-align: middle; }

/* Detalle dorado */
.gold-line { background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.55), transparent); height: 1px; }
.gold-text {
  background: linear-gradient(180deg, #f1d675 0%, #d4af37 55%, #a88a2a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.card-glow:hover { box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.35), 0 18px 40px -24px rgba(212, 175, 55, 0.35); }

/* Animaciones */
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.985) } to { opacity: 1; transform: none } }
@keyframes rise { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
.anim-fade { animation: fade 0.18s ease-out both; }
.anim-pop { animation: pop 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.anim-rise { animation: rise 0.28s ease-out both; }

@media (prefers-reduced-motion: reduce) {
  .anim-fade, .anim-pop, .anim-rise { animation: none; }
}

/* Pantalla de carga */
/* La marca de carga usa estilos críticos inline para aparecer antes de las librerías. */

/* Safe area móvil */
.safe-bottom { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }

/* Ficha profesional: jerarquía clara y detalles a demanda. */
.patient-summary { padding: 24px; }
.patient-summary-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.patient-context { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.patient-eyebrow { font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #94a3b8; margin-bottom: 6px; }
.patient-details { border-top: 1px solid var(--line); margin-top: 20px; }
.patient-details > summary { display: flex; align-items: center; gap: 12px; padding: 16px 0 0; cursor: pointer; list-style: none; color: #cbd5e1; font-size: 13px; font-weight: 500; }
.patient-details > summary::-webkit-details-marker { display: none; }
.patient-details > summary > span:first-child { flex: 1; }
.patient-details[open] > summary > svg { transform: rotate(180deg); }
.patient-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 20px; }
.patient-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.patient-nav-item { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 14px 8px; border-bottom: 2px solid transparent; margin-bottom: -1px; color: #94a3b8; font-size: 13px; font-weight: 600; transition: color .15s, border-color .15s; }
.patient-nav-item:hover { color: #f8fafc; }
.patient-nav-item.is-active { border-bottom-color: var(--gold); color: var(--gold); }
.patient-nav-item:focus-visible, .patient-details > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 4px; }
@media (max-width: 639px) {
  .patient-summary { padding: 20px; }
  .patient-summary-heading { flex-direction: column; gap: 20px; }
  .patient-context { grid-template-columns: 1fr; gap: 16px; margin-top: 20px; }
  .patient-nav-item { gap: 6px; font-size: 12px; }
}

@media print {
  header, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
}
