/* AIRIS RX — Consola de diagnóstico 2026 (tema dark)
   Fuente: mockups/dark-2026/bandeja-v9.html + nuevo-informe-v2.html (aprobados).
   Los valores se copian de los mockups, no se reinventan. */

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/space-grotesk-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/space-grotesk-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/space-grotesk-700.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/dm-sans-400.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/dm-sans-500.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/dm-sans-600.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/jetbrains-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/jetbrains-mono-500.woff2') format('woff2');
}

:root {
  --bg:        #0A0E14;
  --surface-1: #10161F;
  --surface-2: #151E2A;
  --surface-3: #1B2634;
  /* Los bordes deben SEPARAR cajas, no insinuarlas: con .09 la luminancia del
     borde era 36 sobre un fondo de 21 y la caja no tenía límite visible —
     junto a una .focus se leía como desalineada aunque estuviera alineada. */
  --line:      rgba(148,184,215,.16);
  --line-2:    rgba(148,184,215,.24);
  /* Altura única de todo control de formulario y botón. Ver bloque Formularios. */
  --control-h: 40px;
  --ink:       #E8EEF5;
  --ink-2:     #93A7BC;
  --ink-3:     #5C6E82;
  --accent:    #38C6EC;
  --accent-deep: #1490B4;
  --glow:      rgba(56,198,236,.16);
  --ok:        #3DDC97;
  --warn:      #F5B94B;
  --bad:       #FF7A7A;
  --radius:    14px;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Sin esta regla los <a> sin clase caen al azul #0000EE del navegador (y morado
   al visitarlos), que sobre el fondo oscuro se ve pésimo. Blanco por defecto;
   el cian aparece en hover para no perder la señal de que son clickeables. */
a { color: var(--ink); text-decoration: none; }
a:visited { color: var(--ink); }
a:hover { color: var(--accent); }

body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 14.5px;
  min-height: 100vh; display: flex;
}

/* ── Sidebar colapsable ── */
aside {
  width: 232px; min-height: 100vh; padding: 28px 18px;
  background: linear-gradient(180deg, #0C121B 0%, #0A0E14 100%);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 34px; flex-shrink: 0;
  transition: width .22s ease, padding .22s ease;
}
body.collapsed aside { width: 68px; padding: 28px 12px; }
body.collapsed .brand .logo-full { display: none; }
body.collapsed .brand .logo-mini { display: block; }
.brand { display: flex; align-items: center; padding: 0 4px; }
.brand .logo-full { height: 42px; display: block; }
.brand .logo-mini { display: none; width: 40px; margin: 0 auto; }
body.collapsed nav a span { display: none; }
body.collapsed nav a { justify-content: center; padding: 12px 0; }
body.collapsed .side-footer { display: none; }

nav { display: flex; flex-direction: column; gap: 4px; }
nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--ink-2); text-decoration: none; font-weight: 500;
  transition: all .15s;
}
nav a svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; }
nav a:hover { color: var(--ink); background: var(--surface-2); }
nav a.active {
  color: var(--accent); background: linear-gradient(90deg, var(--glow), transparent 80%);
  box-shadow: inset 2px 0 0 var(--accent);
}
.side-footer {
  margin-top: auto; padding: 14px 12px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-3); line-height: 1.6;
}
.side-footer b { color: var(--ink-2); font-weight: 600; }

.toggle-side {
  background: var(--surface-1); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink-2); cursor: pointer; padding: 9px 11px; display: grid; place-items: center;
}
.toggle-side svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.toggle-side:hover { color: var(--accent); border-color: rgba(56,198,236,.4); }

/* ── Main / topbar ── */
main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 26px 34px 40px; width: 100%; }

.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 20px 34px; border-bottom: 1px solid var(--line);
}
.topbar .spacer { flex: 1; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--line);
  font-weight: 600; font-size: 13px; color: var(--ink-2);
}
.topbar .logout { color: var(--ink-2); text-decoration: none; font-size: 13px; font-weight: 500; }
.topbar .logout:hover { color: var(--accent); }
.topbar .notif {
  position: relative; color: var(--ink-2); display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px; text-decoration: none;
}
.topbar .notif:hover { color: var(--accent); background: var(--surface-2); }
.topbar .notif svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.topbar .notif .badge {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px;
  border-radius: 999px; background: var(--bad); color: #2A0808;
  font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 3px;
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
h1 { font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.page-head .date { color: var(--ink-3); font-size: 13px; }

/* ── Botones ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h); border-radius: 10px; padding: 0 20px; cursor: pointer;
  font-family: var(--font-body); font-weight: 600; font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink);
  text-decoration: none;
  /* Sin nowrap, un botón de texto largo ("Agregar tipo") parte en dos líneas
     y crece de alto respecto del campo que tiene al lado. */
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #06222E; border: none; box-shadow: 0 4px 24px var(--glow);
}
.btn.primary:hover { color: #041820; filter: brightness(1.08); }

/* ── Stat tiles ── */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 26px; }
.tile {
  background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px;
}
.tile .label {
  font-size: 12px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px;
}
.tile .value { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1; }
.tile .hint { font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.tile.focus {
  border-color: rgba(56,198,236,.35);
  background: linear-gradient(160deg, rgba(56,198,236,.08), var(--surface-1) 55%);
}
.tile.focus .value { color: var(--accent); }

/* ── Card / panel ── */
.card, .panel {
  background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius);
}
.card { padding: 22px 24px; margin-bottom: 18px; }
.card.narrow { max-width: 420px; margin: 3rem auto; }
/* Dos .panel hermanos quedaban pegados: solo .card traía separación. */
.panel { overflow-x: auto; margin-bottom: 18px; }
.panel:last-child { margin-bottom: 0; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-family: var(--font-display); font-size: 15px; font-weight: 600; }

/* ── Tabla ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { white-space: nowrap; }
td.pt, td.exam, td.med { white-space: normal; }
td.exam { max-width: 260px; }
.med { color: var(--ink-2); max-width: 150px; }
th {
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-3); padding: 12px 20px; border-bottom: 1px solid var(--line);
}
td { padding: 14px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(56,198,236,.03); }
.pt { font-weight: 600; }
.mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); }
.exam { color: var(--ink-2); }

/* ── Chips de estado ── */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 999px;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.ok   { color: var(--ok);   background: rgba(61,220,151,.10); border: 1px solid rgba(61,220,151,.25); }
.chip.warn { color: var(--warn); background: rgba(245,185,75,.10); border: 1px solid rgba(245,185,75,.25); }
.chip.bad  { color: var(--bad);  background: rgba(255,122,122,.10); border: 1px solid rgba(255,122,122,.25); }
.row-action { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 13px; }

/* ── Filtros ── */
.filters { margin-left: auto; display: flex; gap: 8px; }
.filters button {
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-2); font-size: 12.5px; font-weight: 500; padding: 6px 14px; cursor: pointer;
}
.filters button.on { color: var(--accent); border-color: rgba(56,198,236,.4); background: var(--glow); }
.filters-adv { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 16px; }
/* Sin una base flex cada filtro tomaba su ancho natural y la fila quedaba
   con campos de anchos dispares. .wide para el campo de búsqueda libre. */
.filters-adv label { margin-bottom: 0; flex: 0 1 200px; }
.filters-adv label.wide { flex: 1 1 280px; }
.filters-adv .btn { flex: 0 0 auto; }

/* ── Formularios ── */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
input, select, textarea, .editor {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: 10px; color: var(--ink); font-family: var(--font-body); font-size: 14.5px;
  padding: 10px 14px; outline: none;
}
/* Altura idéntica en TODO control de una misma fila. Sin esto los <select>
   medían 20,5px contra 36-39px de los <input> vecinos (medido en producción
   2026-08-03): el navegador ignora el padding vertical del select nativo. */
input, select { height: var(--control-h); }
select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393A7BC' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 15px;
}
/* Los spinners nativos de number rompen la altura y son ajenos al tema. */
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* Multilínea: altura propia, no la de un control de una línea. */
textarea { height: auto; min-height: 8rem; resize: vertical; }
textarea.tall { min-height: 16rem; }
input:focus, select:focus, textarea:focus, .editor:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
.mono, input.mono { font-family: var(--font-mono); font-size: 13.5px; }
.field { margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px 18px; }
/* Cifras: alineadas a la derecha y con dígitos de ancho fijo, para que las
   unidades queden bajo las unidades al comparar montos de una columna. */
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Paciente encontrado */
.patient-found {
  display: flex; align-items: center; gap: 12px; margin-top: 12px;
  background: rgba(61,220,151,.06); border: 1px solid rgba(61,220,151,.25);
  border-radius: 10px; padding: 12px 16px;
}
.patient-found .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.patient-found b { color: var(--ink); font-weight: 600; }
.patient-found .meta { color: var(--ink-2); font-size: 13px; }
.patient-found a { color: var(--accent); font-size: 13px; font-weight: 600; text-decoration: none; margin-left: auto; }

/* ── Steps (formulario multi-paso) ── */
.step {
  background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 18px;
}
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.step-num {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  background: var(--glow); color: var(--accent); border: 1px solid rgba(56,198,236,.3);
}
.step-head h2 { font-family: var(--font-display); font-size: 16px; font-weight: 600; }
.label-row { display: flex; align-items: center; margin-bottom: 6px; }
.label-row label { margin-bottom: 0; }
.hint-ia {
  display: inline-flex; align-items: center; gap: 7px; margin-left: 10px;
  font-size: 12px; font-weight: 600; color: var(--accent);
  background: var(--glow); border: 1px solid rgba(56,198,236,.28);
  padding: 4px 11px; border-radius: 999px;
}

/* ── Editor B/I/U ── */
.toolbar { display: flex; gap: 4px; margin-bottom: 8px; }
.toolbar button {
  width: 34px; height: 30px; border-radius: 8px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line-2);
  color: var(--ink-2); font-family: var(--font-mono); font-size: 13px;
}
.toolbar button:hover { color: var(--accent); border-color: rgba(56,198,236,.4); }
.editor { min-height: 200px; line-height: 1.65; padding: 14px 16px; cursor: text; }
.editor.short { min-height: 90px; }
.editor p { margin-bottom: .6em; }

/* ── Barra de acciones fija ── */
.actionbar {
  position: fixed; bottom: 0; left: 232px; right: 0;
  background: rgba(12,18,27,.88); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 14px 34px; display: flex; align-items: center; gap: 12px; z-index: 10;
}
body.collapsed .actionbar { left: 68px; }
.actionbar .status { color: var(--ink-3); font-size: 13px; }
.actionbar .spacer { flex: 1; }

/* ── Alertas / textos auxiliares ── */
.alert { padding: .6rem .8rem; border-radius: 10px; font-size: .9rem; }
.alert.error { background: rgba(255,122,122,.10); color: var(--bad); border: 1px solid rgba(255,122,122,.25); }
.alert.ok { background: rgba(61,220,151,.10); color: var(--ok); border: 1px solid rgba(61,220,151,.25); }
.alert.info { background: var(--glow); color: var(--accent); border: 1px solid rgba(56,198,236,.28); }
/* Dentro de una alerta el enlace toma el color de la alerta (blanco sobre rojo
   se leería como error de estilo); ahí el subrayado es la señal de que es clic. */
.alert a { color: inherit; text-decoration: underline; }
.alert a:hover { color: inherit; opacity: .8; }
.muted { color: var(--ink-3); font-size: .85rem; }
.inline-form { display: inline; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

/* ── Enlaces dentro de tablas ──
   El nombre del paciente es el destino natural del clic en cada fila. Va en
   blanco como el resto del texto (Felipe, 2026-08-03) y se delata en hover. */
td a { color: var(--ink); text-decoration: none; }
td a:hover { color: var(--accent); text-decoration: underline; }
td.pt a { font-weight: 600; }

/* ── Migrado desde style.css (eliminado el 2026-08-03) ──
   style.css nació como puente mientras se reescribían las vistas al tema dark.
   Se cargaba DESPUÉS de theme.css y, con la misma especificidad, le ganaba en
   h1, h2, label y .filters: rompía el tamaño de títulos y labels en TODAS las
   páginas. Lo que sigue es lo único que estaba realmente en uso. */
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .6rem; align-items: center; }
.btn.danger { background: var(--bad); color: #2A0808; border: none; }
.btn.danger:hover { color: #2A0808; filter: brightness(1.08); }
.editor-toolbar { display: flex; gap: 4px; margin-bottom: 8px; }
.editor-toolbar .btn { height: 30px; width: 34px; padding: 0; }
.editor-area {
  border: 1px solid var(--line-2); border-radius: 10px; padding: 14px 16px;
  min-height: 6rem; background: var(--surface-2); color: var(--ink); line-height: 1.65;
}
.editor-area.tall { min-height: 14rem; }
.editor-area:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); }
.report-body p { margin: 0 0 .6rem; }
.report-body p:last-child { margin-bottom: 0; }
