/* Base común de las demos de Panacea Logic AI — sistema visual claro, de bordes finos.
   Lienzo blanco, contenedores definidos por una línea de 1 px (no por sombras), tipografía Inter
   (titulares en peso 500), etiquetas en píldora, botones de 8 px y tarjetas de 12 px.
   El color de acento es la marca de cada giro (--brand): las acciones de la clínica (agendar, confirmar, crear)
   van en ese color; el negro queda para los controles de Panacea (presentación, reiniciar, controles de la demo).
   Contraste AA; foco visible; sin dependencias externas. */

@font-face {
  font-family: "Inter";
  src: url("../../assets/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* Marca: la cambia cada giro desde main.js (hace de «azul eléctrico» del sistema) */
  --brand: #0b6e6e;
  --brand-dark: #084f4f;
  --brand-soft: #e1f1ef;
  --accent: #e8743b;
  --on-accent: #1a1a1a;
  --brand-ring: color-mix(in srgb, var(--brand) 25%, transparent);

  /* Neutros */
  --bg: #ffffff;
  --card: #ffffff;
  --surface-2: #fafafa;
  --surface-3: #f5f5f5;
  --line: #cdcdcd;          /* bordes de tarjetas, tablas y separadores */
  --line-strong: #999999;   /* bordes de controles y énfasis */
  --pebble: #c8c8c8;
  --black: #0a0a0a;
  --ink: #171717;
  --ink-2: #404040;
  --muted: #525252;
  --fog: #737373;

  /* Estados */
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #a16207;
  --warn-soft: #fef9c3;

  /* Acentos de las píldoras de función (uno por píldora) */
  --orange: #ea580c;
  --violet: #7c3aed;
  --green: #16a34a;

  /* Forma: píldora 9999 · botón 8 · tarjeta 12 · tarjeta grande 16 · campo 6 */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-pill: 9999px;
  --radius: var(--r-lg);

  /* Profundidad: casi nada; el borde manda */
  --sh-1: 0 1px 2px rgba(0, 0, 0, .07);
  --sh-ring: 0 0 0 4px rgba(0, 0, 0, .06);
  --sh-md: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -4px rgba(0, 0, 0, .1);
  --sh-2: none;
  --sh-3: var(--sh-md);
  --shadow: none;

  /* Escala tipográfica (la raíz crece con la pantalla: 16 px en móvil, 17 px en portátil, 18 px en monitor grande) */
  --fs-xs: .8125rem;
  --fs-sm: .9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.1875rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 2rem;

  --banner-h: 40px;
  --page-max: 2560px;   /* el contenido ocupa todo el ancho de la ventana (tope solo en pantallas gigantes) */
  --gutter: clamp(16px, 2.2vw, 44px);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: var(--font);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
* { scrollbar-width: thin; scrollbar-color: #c8c8c8 transparent; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--banner-h) + 84px); }
body {
  margin: 0; padding-top: var(--banner-h);
  font-family: var(--font); font-size: var(--fs-md); line-height: 1.5; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
@media (min-width: 900px) { html { font-size: 106.25%; } }
@media (min-width: 1500px) { html { font-size: 112.5%; } }
img, svg { max-width: 100%; }
/* Titulares: Inter 500 con tracking cerrado (sustituto de Satoshi, según la guía). */
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -.02em; font-weight: 500; text-wrap: balance; }
h3, h4 { font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--brand); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--brand-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ic { flex: none; vertical-align: -.2em; }
.num { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--r-xs); }
.skip { position: absolute; left: 12px; top: -80px; z-index: 100; background: var(--black); color: #fff; padding: 10px 14px; border-radius: var(--r-sm); }
.skip:focus { top: calc(var(--banner-h) + 8px); }

/* Banner fijo de demostración (obligatorio) */
.demo-banner {
  position: fixed; inset: 0 0 auto 0; z-index: 60; min-height: 40px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 14px;
  padding: 6px 16px; background: var(--black); color: #e5e5e5; font-size: var(--fs-sm); line-height: 1.35; text-align: center;
}
.demo-banner a { color: #fff; font-weight: 500; text-decoration-color: #737373; }
.demo-banner__cta { color: var(--black) !important; background: #fff; padding: 3px 12px; border-radius: var(--r-pill); text-decoration: none; font-weight: 500; transition: background .15s; }
.demo-banner__cta:hover { background: #e5e5e5; }
.demo-banner :focus-visible { outline-color: #fff; }

/* Botones: contorno por defecto; .btn--accent = acción de la clínica (color del giro); .btn--primary = control de Panacea (negro) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; color: var(--ink); font-size: var(--fs-sm); font-weight: 500;
  line-height: 1.2; cursor: pointer; text-decoration: none; box-shadow: var(--sh-1);
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.btn:active { background: var(--surface-3); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--black); border-color: var(--black); color: #fff; }
.btn--primary:hover { background: #262626; border-color: #262626; color: #fff; }
.btn--accent { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--accent:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn--dark { background: var(--black); border-color: var(--black); color: #fff; }
.btn--dark:hover { background: #262626; color: #fff; }
.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger:hover { background: #991b1b; border-color: #991b1b; color: #fff; }
.btn--danger-soft { background: #fff; border-color: #f3b8b8; color: var(--danger); box-shadow: none; }
.btn--danger-soft:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn--danger-soft[disabled] { background: var(--surface-2); border-color: var(--line); color: var(--fog); opacity: 1; }
.btn--sm { min-height: 32px; padding: 4px 12px; font-size: var(--fs-sm); }
.btn--lg { min-height: 44px; padding: 10px 20px; font-size: var(--fs-md); }
.btn--pill { border-radius: var(--r-pill); }
.btn--icon { min-width: 36px; padding: 4px; }

/* Formularios: borde casi negro (firma del sistema), 6 px */
.field { display: grid; gap: 6px; }
.field > label, .field > .label, legend { font-weight: 500; font-size: var(--fs-sm); color: var(--ink); }
input[type="text"], input[type="tel"], input[type="number"], input[type="date"], input[type="time"], input[type="search"], select, textarea, .input {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--black); border-radius: var(--r-xs); background: #fff; color: #111827; font-size: var(--fs-sm);
  transition: box-shadow .15s, border-color .15s;
}
input::placeholder, textarea::placeholder { color: var(--fog); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23525252' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
}
textarea { min-height: 88px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
[aria-invalid="true"] { border-color: var(--danger) !important; background-color: #fff8f8 !important; }
.field__hint { font-size: var(--fs-sm); color: var(--muted); }
.field__error { font-size: var(--fs-sm); color: var(--danger); font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 9px; min-height: 32px; cursor: pointer; font-size: var(--fs-sm); font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--black); cursor: pointer; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

/* Etiquetas de estado: píldora tintada con punto (no depende solo del color) */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 500; line-height: 1.6; white-space: nowrap; border: 1px solid transparent; }
.badge .ic { display: none; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge--pendiente { background: #fef9c3; color: #854d0e; border-color: #fde68a; }
.badge--confirmada { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.badge--reprogramada { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.badge--cancelada { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.badge--no_asistio { background: #ffedd5; color: #9a3412; border-color: #fed7aa; }
.badge--atendida { background: #f5f5f5; color: #404040; border-color: #e5e5e5; }
.badge--urgente { background: #b91c1c; color: #fff; border-color: #b91c1c; }
.badge--humano { background: #fef9c3; color: #854d0e; border-color: #fde68a; }
.badge--info { background: #f5f5f5; color: #404040; border-color: #e5e5e5; }
.badge--ok { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.badge--urgente .ic, .badge--humano .ic { display: inline-block; }
.badge--urgente::before, .badge--humano::before { display: none; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }

/* Avisos */
.toasts { position: fixed; z-index: 80; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
.toast { background: var(--black); color: #fff; padding: 11px 16px; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 500; box-shadow: var(--sh-md); animation: toast-in .2s var(--ease); }
.toast--warn { background: #854d0e; }
.toast--error { background: #991b1b; }
.toast--ok { background: #166534; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Diálogos */
.dlg { width: min(94vw, 560px); max-height: 92vh; padding: 0; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--card); color: var(--ink); box-shadow: var(--sh-md); overflow: hidden; }
.dlg--wide { width: min(96vw, 780px); }
.dlg[open] { display: flex; flex-direction: column; animation: dlg-in .18s var(--ease); }
.dlg::backdrop { background: rgba(10, 10, 10, .4); }
@keyframes dlg-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.dlg__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.dlg__title { font-size: var(--fs-lg); font-weight: 600; }
.dlg__body { padding: 20px; overflow-y: auto; }
.dlg__actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

@media (max-width: 480px) {
  .demo-banner { font-size: .8125rem; padding: 4px 10px; gap: 2px 8px; }
  .demo-banner__cta { padding: 2px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
