/*
 * Sistema visual del portal (cliente y admin) — tema claro estilo hPanel
 * (25-sep-2026), tomado del canvas "Kairus Admin — Prototipo de
 * navegación". Mismas clases que el tema oscuro anterior: las ~60 páginas
 * que enlazan este archivo cambian sin tocarse una por una.
 *
 * Contraste: cada par texto/fondo de este archivo mide ≥ 4.5:1 (WCAG 2.2
 * SC 1.4.3). Los tonos del prototipo que no pasaban (#0B6B55 = 3.74,
 * #8A9A92 = 3.15) se reemplazaron (hoy: paleta de marca, ver :root).
 */

/* Fuentes de la landing, autoalojadas (antes Google Fonts: Montserrat +
 * Roboto, una petición externa por página). Misma regla que la landing:
 * Plus Jakarta Sans en toda la interfaz (títulos en 700, texto en 400 a
 * 600, 28-sep-2026); JetBrains Mono para etiquetas. */
/* Identidad Receta (9-oct-2026): Newsreader en títulos grandes y cifras; Hanken Grotesk en interfaz. */
@font-face { font-family: 'Newsreader'; font-style: normal; font-weight: 300 600; font-display: swap; src: url(fonts/newsreader-latin.woff2?v=2) format('woff2'); }
@font-face { font-family: 'Newsreader'; font-style: italic; font-weight: 300 600; font-display: swap; src: url(fonts/newsreader-italic-latin.woff2?v=2) format('woff2'); }
@font-face { font-family: 'Hanken Grotesk'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(fonts/hanken-grotesk-latin.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/jetbrains-mono-500-latin.woff2) format('woff2'); }

:root {
  /* Paleta del manual de marca (27-sep-2026, Drive "Kairus Logos" /
   * "Fondos de pantalla"): #0B6B55 azul Kairus, #BDEED3 cian, #10201B
   * pizarra oscuro, #4E5E58 pizarra, #F2F4EE blanco hueso. Líneas, tintes
   * y #2B3A35 son derivados de la misma familia pizarra.
   * Los nombres --teal/--blue se conservan para no tocar ~60 páginas: hoy
   * ambos son el azul Kairus. El cian nunca va como texto sobre blanco
   * (1.8:1): solo en fondos, bordes y rellenos. */
  --bg: #F2F4EE; --bg2: #E9EDE6;
  --card: #FBFCF8; --card-hover: #F2F4EE;
  --border: #D8DED6; --border-strong: #C9D3CC; --border-hover: #0B6B55;
  --text: #10201B; --text-mid: #2B3A35; --text-muted: #4E5E58;
  /* --text-dim: 7.2:1 sobre --bg, 7.6:1 sobre tarjetas blancas. */
  --text-dim: #4E5E58;
  --teal: #0B6B55; --teal-deep: #0B6B55; --blue: #0B6B55; --blue-deep: #0B6B55; --cyan: #BDEED3;
  --brand-tint: #DCEFE4; --brand-tint-border: #9FD9BE;
  --amber: #92400E; --red: #B91C1C; --green: #15803D;
  /* Sin degradados en texto ni botones: el cian no da contraste con blanco. */
  --grad: #0B6B55;
  --grad-soft: linear-gradient(90deg, #0B6B55, #0B6B55);
  --shadow-sm: 0 1px 2px rgba(16,32,27,.05);
  --shadow: 0 4px 20px rgba(16,32,27,.07);
  --radius: 10px; --radius-sm: 8px; --radius-pill: 100px;
  --font-display: 'Newsreader', Georgia, serif;
  --font-head: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --maxw: 1040px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-synthesis: none;
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); line-height: 1.6; -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-decoration: none; }
a:hover { color: #10201B; text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; color: var(--text); margin: 0; letter-spacing: -.01em; }
/* Títulos de página con la letra de la landing (pesos al final del archivo, tipografía v3). */
h1 { font-family: var(--font-display); font-weight: 400; letter-spacing: -.005em; }
p { margin: 0; }
img { max-width: 100%; }

/* --- foco de teclado ---
 * :focus-visible (no :focus): solo aparece cuando el foco llegó por
 * teclado, así un clic no deja el anillo pegado. Azul para que se
 * distinga del borde teal de los campos activos. */
:is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}
.k-btn:focus-visible { border-radius: var(--radius-pill); }
.k-input:focus-visible, .k-select:focus-visible, .k-textarea:focus-visible,
.k-card:focus-visible { border-radius: var(--radius-sm); }

/* --- encabezado simple (páginas sin sidebar: registro, candados de tier) --- */
.k-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.94); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; flex-wrap: wrap; gap: 10px;
}
.k-header .k-brand {
  font-family: var(--font-head); font-weight: 900; font-size: 15px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text);
}
.k-header nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.k-header nav a {
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  padding: 8px 12px; border-radius: 10px; white-space: nowrap;
}
.k-header nav a:hover { color: var(--text); background: var(--bg2); text-decoration: none; }
.k-header nav a.activo { color: #fff; background: var(--text); }

/* --- sidebar ---
 * body:has(> .k-sidebar) vuelve al body el contenedor flex cuando su
 * primer hijo es el sidebar, sin envolver cada página en un <div> extra.
 * Portal cliente y páginas de una clínica: una columna con grupos.
 * Admin (.k-sidebar-rail): riel de íconos por grupo + panel con los
 * enlaces del grupo activo, como hPanel de Hostinger.
 * Celular (<900px): barra superior con <details> nativo (sin JS, funciona
 * con la CSP estricta y el lector de pantalla lo anuncia como menú). */
body:has(> .k-sidebar) { display: flex; min-height: 100vh; align-items: flex-start; }
.k-sidebar {
  width: 248px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; background: var(--card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.k-sidebar-marca {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-head); font-weight: 800; font-size: 13px;
  color: var(--text); padding: 2px 8px 16px; line-height: 1.3;
}
.k-logo {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 900; font-size: 14px;
}
.k-sidebar-marca .k-sidebar-submarca { display: block; font-family: var(--font-body); font-size: 11.5px; font-weight: 500; letter-spacing: normal; text-transform: none; color: var(--text-dim); margin-top: 2px; }

.k-sidebar-contexto { padding: 0 8px 14px; }
.k-sidebar-contexto label {
  display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-dim); padding-bottom: 5px;
}
.k-sidebar-contexto select.k-select { font-size: 12.5px; padding: 8px 10px; }

.k-sidebar-nav-desk { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.k-sidebar-grupo { display: flex; flex-direction: column; gap: 2px; padding-bottom: 6px; }
.k-sidebar-grupo-titulo {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-dim); padding: 12px 12px 6px; margin: 0;
}
.k-sidebar-nav-desk a, .k-sidebar-movil-panel a, .k-panel a {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-muted); font-size: 13.5px; font-weight: 600;
  padding: 9px 12px; border-radius: 10px; white-space: nowrap;
}
.k-sidebar-nav-desk a svg, .k-sidebar-movil-panel a svg, .k-panel a svg { flex-shrink: 0; }
.k-sidebar-nav-desk a:hover, .k-sidebar-movil-panel a:hover, .k-panel a:hover { color: var(--text); background: var(--bg2); text-decoration: none; }
.k-sidebar-nav-desk a.activo, .k-sidebar-movil-panel a.activo, .k-panel a.activo { color: #fff; background: var(--text); }
.k-nav-candado { margin-left: auto; font-size: 11px; opacity: .75; flex-shrink: 0; }
/* Etiquetas largas ("Integración de calendarios") bajan de línea en vez de cortarse. */
.k-panel a { white-space: normal; line-height: 1.3; }
.k-sidebar-contador {
  display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: auto;
  font-size: 10.5px; font-weight: 800; line-height: 1.5; text-align: center;
  border-radius: var(--radius-pill); background: var(--red); color: #fff;
}

/* admin: riel + panel */
.k-sidebar.k-sidebar-rail { width: 324px; flex-direction: row; padding: 0; }
.k-rail {
  width: 80px; flex-shrink: 0; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 16px 8px;
}
.k-rail .k-logo { margin: 0 auto 14px; }
.k-rail a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 2px; border-radius: 12px;
  color: var(--text-dim); font-size: 11px; font-weight: 600; text-align: center;
}
.k-rail a:hover { background: var(--bg2); color: var(--text); text-decoration: none; }
.k-rail a.activo { background: var(--brand-tint); color: var(--teal); }
.k-rail .k-rail-salir { margin-top: auto; }
.k-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 20px 12px; overflow-y: auto; }
.k-panel-titulo { font-family: var(--font-head); font-weight: 800; font-size: 15px; color: var(--text); padding: 2px 12px 2px; }
.k-panel-sub { font-size: 12px; color: var(--text-dim); padding: 0 12px 14px; }

.k-sidebar-movil { display: none; }
.k-sidebar-movil summary {
  list-style: none; cursor: pointer; user-select: none;
  color: var(--text); font-size: 13px; font-weight: 700;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--card);
}
.k-sidebar-movil summary::-webkit-details-marker { display: none; }
.k-sidebar-movil summary::after { content: '☰'; margin-left: 6px; }
.k-sidebar-movil[open] summary { border-color: var(--teal); }
.k-sidebar-movil-panel { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.k-sidebar-movil-titulo {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-dim); margin: 10px 6px 2px; padding-top: 8px; border-top: 1px solid var(--border);
}
.k-sidebar-movil-titulo:first-child { margin-top: 0; padding-top: 0; border-top: none; }

.k-sidebar-salir { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.k-sidebar-salir a { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 13.5px; font-weight: 600; padding: 9px 12px; border-radius: 10px; }
.k-sidebar-salir a:hover { color: var(--text); background: var(--bg2); text-decoration: none; }

body:has(> .k-sidebar) main.k-main { flex: 1; min-width: 0; max-width: none; margin: 0; }

@media (max-width: 900px) {
  body:has(> .k-sidebar) { flex-direction: column; align-items: stretch; }
  .k-sidebar, .k-sidebar.k-sidebar-rail {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 50;
    /* flex-start (no center): al abrir el menú la fila crece hacia abajo y
     * center recentraba la marca y "Salir" a media altura. */
    flex-direction: row; align-items: flex-start; flex-wrap: wrap;
    border-right: none; border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
    padding: 10px 16px; gap: 10px;
  }
  .k-sidebar-marca { padding: 2px 0 0; flex: 1; min-width: 0; }
  /* Nombre de la clínica: hasta 2 líneas en vez de cortarse en una
   * ("Clínica Dental …" en 390 px). */
  .k-sidebar-marca > span:last-child { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
  .k-sidebar-contexto { padding: 0; order: 3; width: 100%; }
  .k-sidebar-nav-desk, .k-rail, .k-panel { display: none; }
  .k-sidebar-movil { display: block; }
  .k-sidebar-salir { margin: 0 0 0 auto; padding: 2px 0 0; border-top: none; }
  .k-sidebar-movil[open] { width: 100%; order: 4; }
  .k-sidebar-movil[open] .k-sidebar-movil-panel { max-height: 70vh; overflow-y: auto; }
}

main.k-main { max-width: var(--maxw); margin: 0 auto; padding: 28px 32px 60px; }
/* encabezado de página: título + una línea de contexto */
.k-titulo { font-size: 32px; line-height: 1.1; margin: 0 0 6px; }
.k-subtitulo { font-size: 13.5px; color: var(--text-muted); line-height: 1.55; }
main.k-main > .k-subtitulo { font-size: 13.5px; color: var(--text-muted); line-height: 1.55; margin: 0 0 20px; max-width: 760px; }

/* --- tarjetas --- */
.k-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow-sm);
}
.k-card h2 { font-size: 15px; margin: 0 0 14px; }
.k-card .k-subtitulo { font-size: 12.5px; color: var(--text-muted); margin: -8px 0 14px; line-height: 1.5; }

/* --- botones --- */
.k-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 13px; padding: 11px 20px; border-radius: var(--radius-pill);
  border: none; white-space: nowrap; font-family: inherit; text-decoration: none;
}
.k-btn:hover { text-decoration: none; }
.k-btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(11,107,85,.22); transition: transform .12s, box-shadow .12s; }
.k-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(11,107,85,.3); color: #fff; }
.k-btn-ghost { background: var(--card); border: 1px solid var(--border-strong); color: var(--text-mid); transition: border-color .12s, color .12s, background .12s; }
.k-btn-ghost:hover { border-color: var(--teal); color: var(--teal); background: var(--brand-tint); }
.k-btn-danger { background: #FEE2E2; color: var(--red); border: 1px solid #FECACA; }
.k-btn-danger:hover { background: #FECACA; color: #991B1B; }
.k-btn-sm { padding: 7px 14px; font-size: 12px; }
.k-btn:disabled { opacity: .5; cursor: not-allowed; }
.k-btn:active:not(:disabled) { transform: scale(.98); }

/* --- formularios --- */
.k-campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.k-campo:last-child { margin-bottom: 0; }
.k-campo label { font-size: 12.5px; font-weight: 600; color: var(--text-mid); }
.k-input, .k-select, .k-textarea {
  width: 100%; padding: 10px 13px; border-radius: 10px; font-size: 14px; font-family: inherit;
  background: var(--card); border: 1px solid var(--border-strong); color: var(--text);
}
.k-input:focus, .k-select:focus, .k-textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px rgba(11,107,85,.15); }
.k-textarea { min-height: 84px; resize: vertical; }
.k-input::placeholder, .k-textarea::placeholder { color: var(--text-dim); }
.k-select option { background: var(--card); color: var(--text); }
.k-form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.k-form-row .k-campo { flex: 1; min-width: 130px; margin-bottom: 0; }
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: #0B6B55; }

/* --- badges de estado --- */
.k-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 4px 11px; border-radius: var(--radius-pill); white-space: nowrap; }
.k-badge-teal { background: var(--brand-tint); color: #0B6B55; }
.k-badge-green { background: #DCFCE7; color: #166534; }
.k-badge-amber { background: #FEF3C7; color: #92400E; }
.k-badge-red { background: #FEE2E2; color: #B91C1C; }
.k-badge-blue { background: #DCEFE4; color: #0B6B55; }
.k-badge-muted { background: #E9EDE6; color: #4E5E58; }

/* --- mensajes de estado --- */
.k-alerta { padding: 12px 16px; border-radius: 12px; font-size: 13.5px; margin-bottom: 18px; border: 1px solid transparent; }
.k-alerta-ok { background: #DCFCE7; color: #166534; border-color: #BBF7D0; }
.k-alerta-error { background: #FEE2E2; color: #991B1B; border-color: #FECACA; }
/* enlaces dentro de avisos: mismo color del aviso + subrayado (el teal
   sobre rojo claro medía 4.48) */
.k-alerta a { color: inherit; text-decoration: underline; font-weight: 700; }

/* --- tablas --- */
.k-tabla { width: 100%; border-collapse: collapse; }
.k-tabla th, .k-tabla td { text-align: left; padding: 11px 12px; font-size: 13px; border-bottom: 1px solid var(--border); }
.k-tabla th { color: var(--text-dim); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; background: var(--card-hover); }
.k-tabla tr:last-child td { border-bottom: none; }
.k-tabla tbody tr:hover td { background: var(--card-hover); }

/* --- stat tiles --- */
.k-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.k-stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; box-shadow: var(--shadow-sm); }
.k-stat .k-valor {
  font-family: var(--font-display); font-size: 34px; font-weight: 400; line-height: 1.05;
  background: var(--grad-soft); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.k-stat .k-etiqueta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* --- explicación de cálculo (ⓘ con <details>, sin JS) --- */
.k-explica-calculo { margin-top: 6px; }
.k-explica-calculo summary {
  list-style: none; cursor: pointer; font-size: 12px; font-weight: 700;
  color: var(--text-dim); display: inline-flex; align-items: center; gap: 4px;
}
.k-explica-calculo summary::-webkit-details-marker { display: none; }
.k-explica-calculo summary:hover, .k-explica-calculo[open] summary { color: var(--teal); }
.k-explica-calculo p {
  font-size: 12px; color: var(--text-muted); line-height: 1.55;
  margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border);
}

/* --- tasas (stat con explicación) --- */
.k-tasas { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 18px; }
.k-tasa { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; box-shadow: var(--shadow-sm); }
.k-tasa .k-valor { font-family: var(--font-display); font-size: 32px; font-weight: 400; line-height: 1.05; color: var(--teal); }
.k-tasa .k-etiqueta { font-size: 12.5px; font-weight: 600; color: var(--text); margin-top: 4px; }
.k-tasa .k-explica { font-size: 12px; color: var(--text-dim); margin-top: 4px; line-height: 1.45; }

/* --- filtros tipo pill --- */
.k-filtros { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.k-filtros a { font-size: 12.5px; font-weight: 600; padding: 7px 14px; border-radius: var(--radius-pill); background: var(--card); color: var(--text-mid); border: 1px solid var(--border-strong); }
.k-filtros a:hover { border-color: var(--teal); color: var(--teal); text-decoration: none; }
.k-filtros a.activo { background: var(--text); color: #fff; border-color: var(--text); }

/* --- listas de fila (tickets, mejoras) --- */
.k-fila { display: block; padding: 13px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.k-fila:hover { text-decoration: none; }
.k-fila:last-child { border-bottom: none; }
.k-fila:hover .k-fila-titulo { color: var(--teal); }
.k-fila-titulo { font-size: 13.5px; font-weight: 600; color: var(--text); }
.k-fila-meta { font-size: 12px; color: var(--text-dim); margin-top: 3px; }

/* --- vacío --- */
.k-vacio { color: var(--text-dim); font-size: 13px; padding: 14px 0; }

/* --- búsqueda + paginación --- */
.k-buscador { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.k-buscador input[type="search"] { flex: 1; min-width: 180px; max-width: 320px; background: var(--card); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-pill); padding: 8px 14px; font-size: 13px; }
.k-paginacion { display: flex; gap: 12px; align-items: center; margin-top: 14px; font-size: 12.5px; }
.k-paginacion a { color: var(--teal); }
.k-paginacion span.actual { color: var(--text-dim); }

/* --- burbujas de chat (hilos de ticket) --- */
.k-hilo { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.k-burbuja { padding: 12px 15px; border-radius: 14px; font-size: 13.5px; line-height: 1.55; max-width: 85%; color: var(--text); }
.k-burbuja.propia { background: var(--brand-tint); align-self: flex-end; border: 1px solid var(--brand-tint-border); }
.k-burbuja.otro { background: var(--card); align-self: flex-start; border: 1px solid var(--border); }
.k-burbuja .k-autor { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.k-burbuja .k-fecha { font-size: 11px; color: var(--text-dim); margin-top: 6px; }

/* --- bloqueado por tier --- */
.k-candado-box { max-width: 480px; margin: 64px auto; padding: 0 24px; text-align: center; }
.k-candado-box .k-icono { font-size: 38px; margin-bottom: 14px; }
.k-candado-box h1 { font-size: 28px; margin-bottom: 10px; }
.k-candado-box p { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; margin-bottom: 22px; }

/* --- feature/addon rows (planes-addons) --- */
.k-feature-fila { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.k-feature-fila:last-child { border-bottom: none; }
/* Sin opacity: bajaba el contraste del texto abajo de 4.5:1. */
.k-feature-fila.bloqueada { color: var(--text-dim); }
.k-feature-fila .k-feature-icono { width: 18px; text-align: center; flex-shrink: 0; }
.k-feature-fila .k-feature-texto { flex: 1; }

.k-addons-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.k-addon-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; background: var(--card); box-shadow: var(--shadow-sm); }
.k-addon-card.activo { border-color: #86EFAC; background: #F0FDF4; }
.k-addon-card h3 { font-size: 14px; margin: 0 0 6px; font-family: var(--font-head); font-weight: 700; }
.k-addon-card p { font-size: 12.5px; color: var(--text-muted); margin: 0 0 10px; line-height: 1.5; }
.k-addon-card .k-precio { font-family: var(--font-head); font-size: 14px; font-weight: 700; color: var(--teal); margin-bottom: 10px; }

/* --- tarjeta destacada (upsell/Max, "valor generado") --- */
.k-card-destacada { background: linear-gradient(135deg, #DCEFE4, #E9EDE6); border: 1px solid var(--brand-tint-border); }
.k-card-destacada h2 { color: var(--text); }
.k-card-destacada p { font-size: 13.5px; color: var(--text-mid); line-height: 1.6; margin-bottom: 14px; }

/* --- login y pantallas de acceso ---
 * Dos columnas en escritorio: marca a la izquierda (solo mensajes que ya
 * son ciertos: nada de testimonios ni "desde hace N meses"), formulario a
 * la derecha. En celular queda solo el formulario. */
.k-login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr; background: var(--card); }
.k-login-marca { display: none; }
.k-login-form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.k-login-card { width: 100%; max-width: 380px; }
.k-login-card .k-login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; font-family: var(--font-head); font-weight: 900; letter-spacing: .1em; font-size: 14px; color: var(--text); }
.k-login-card h1 { font-size: 32px; margin-bottom: 6px; }
.k-login-card .k-login-sub { font-size: 13.5px; color: var(--text-muted); margin-bottom: 26px; }
.k-login-card .k-subtitulo { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; line-height: 1.55; }
.k-login-pie { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); text-align: center; font-size: 13px; color: var(--text-muted); }
@media (min-width: 960px) {
  .k-login-wrap { grid-template-columns: minmax(420px, 44%) 1fr; }
  .k-login-marca {
    display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
    position: relative; overflow: hidden; padding: 44px;
    background: #E9EDE6; color: var(--text); border-right: 1px solid var(--border);
  }
  .k-login-marca > * { position: relative; }
  .k-login-marca .k-login-logo { display: flex; align-items: center; }
  .k-login-marca h2 { color: var(--text); font-family: var(--font-display); font-weight: 400; font-size: 44px; line-height: 1.04; letter-spacing: -.02em; margin-bottom: 14px; max-width: 440px; }
  .k-login-marca p { color: var(--text-mid); font-size: 15px; line-height: 1.65; max-width: 440px; }
  .k-login-ilus img { mix-blend-mode: multiply; max-height: 340px; width: auto; }
  .k-login-puntos { display: flex; flex-direction: column; gap: 10px; }
  .k-login-punto {
    align-self: flex-start; display: inline-flex; align-items: center; gap: 8px;
    background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-pill);
    padding: 8px 16px; font-size: 12.5px; font-weight: 600;
    animation: k-flotar 5.5s ease-in-out infinite;
  }
  .k-login-punto:nth-child(2) { margin-left: 36px; animation-duration: 6s; animation-delay: -2s; }
  .k-login-punto:nth-child(3) { margin-left: 12px; animation-duration: 6.5s; animation-delay: -4s; }
  .k-login-punto svg { color: var(--teal); }
  .k-login-card .k-login-logo { display: none; }
}
@keyframes k-flotar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

/* --- checklist de activación ---
 * El estado se codifica en la marca Y en la franja izquierda, nunca solo
 * en color. */
.k-activacion-cabeza { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.k-activacion-avance { font-family: var(--font-head); font-weight: 800; font-size: 13px; color: var(--text-mid); font-variant-numeric: tabular-nums; white-space: nowrap; }
.k-barra-avance { height: 6px; border-radius: 3px; background: var(--bg2); overflow: hidden; margin: 12px 0 18px; }
.k-barra-avance > span { display: block; height: 100%; background: linear-gradient(90deg, #0B6B55, #BDEED3); transition: width .35s ease; }

.k-siguiente {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: var(--brand-tint); border: 1px solid var(--brand-tint-border);
  border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 18px;
}
.k-siguiente .k-eyebrow { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--teal); font-weight: 700; }
.k-siguiente strong { display: block; font-family: var(--font-head); font-size: 14px; color: var(--text); margin-top: 3px; }

.k-pasos { display: flex; flex-direction: column; gap: 10px; }
.k-paso {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--border);
  border-left: 4px solid var(--franja, var(--border));
  border-radius: var(--radius-sm); padding: 13px 15px;
}
.k-paso[data-estado="hecho"] { --franja: #16A34A; }
.k-paso[data-estado="pendiente"] { --franja: #D97706; }
.k-paso[data-estado="bloqueado"] { --franja: var(--blue); }
.k-paso[data-estado="bloqueado_plan"] { --franja: var(--border-strong); background: var(--card-hover); }
.k-paso .k-marca { flex: 0 0 auto; font-size: 14px; line-height: 1.5; width: 18px; text-align: center; }
.k-paso .k-cuerpo { flex: 1; min-width: 0; }
.k-paso .k-titulo-paso { font-family: var(--font-head); font-weight: 700; font-size: 14px; color: var(--text); }
.k-paso[data-estado="hecho"] .k-titulo-paso { color: var(--text-mid); }
.k-paso .k-detalle-paso { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; margin-top: 4px; }
.k-paso .k-accion-paso { display: inline-block; margin-top: 9px; font-size: 12.5px; font-weight: 700; }

/* --- bandeja "Requiere atención" (inicio del admin) ---
 * Borde = prioridad (1 más urgente), repetida en texto, nunca solo color. */
.k-bandeja-cabeza { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.k-bandeja-vacia { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: var(--text-mid); font-size: 13.5px; }
.k-asuntos { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; }
.k-asunto {
  display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border);
  border-left: 4px solid var(--franja, var(--border));
  border-radius: var(--radius-sm); padding: 12px 15px;
}
.k-asunto[data-prioridad="1"] { --franja: #DC2626; }
.k-asunto[data-prioridad="2"] { --franja: #D97706; }
.k-asunto[data-prioridad="3"] { --franja: var(--blue); }
.k-asunto[data-prioridad="4"] { --franja: var(--border-strong); }
.k-asunto .k-cuerpo { flex: 1 1 260px; min-width: 0; }
.k-asunto .k-titulo-asunto { font-family: var(--font-head); font-weight: 700; font-size: 14px; color: var(--text); }
.k-asunto .k-detalle-asunto { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; margin-top: 4px; }
.k-asunto .k-asunto-meta { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.k-asunto .k-antiguedad { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.k-mas-asuntos { text-align: center; font-size: 12.5px; color: var(--text-muted); margin-top: 10px; }

/* --- responsive --- */
/* 901-1200px: ventana en split screen 50/50, donde más hace falta el ajuste. */
@media (max-width: 1200px) {
  main.k-main { padding: 22px 20px 48px; }
  .k-tabla th, .k-tabla td { padding: 9px 9px; font-size: 12.5px; }
}
@media (max-width: 640px) {
  main.k-main { padding: 18px 14px 48px; }
  .k-header { padding: 12px 16px; }
  .k-card { padding: 18px; }
  /* tablas anchas: se desplazan de lado dentro de sí mismas, sin empujar
     la página (display:block es lo que permite el overflow en <table>) */
  .k-tabla { display: block; max-width: 100%; overflow-x: auto; }
}

/* --- movimiento reducido ---
 * Quien activa "reducir movimiento" lo hace por un motivo médico
 * (vértigo, migraña vestibular). Aquí apagarlo no quita función. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .k-btn-primary:hover, .k-btn:active:not(:disabled) { transform: none; }
}

/* admin: la marca y "Salir" sueltos solo se ven en celular (en escritorio
   ya están en el riel) */
.k-sidebar-rail [data-movil] { display: none; }
@media (max-width: 900px) { .k-sidebar-rail [data-movil] { display: flex; } .k-sidebar-rail .k-sidebar-salir[data-movil] { display: block; } }
/* páginas de una clínica (sin menú plegable): en celular los enlaces de
   regreso se quedan visibles en la barra en vez de desaparecer */
@media (max-width: 900px) {
  .k-sidebar:not(:has(.k-sidebar-movil)) .k-sidebar-nav-desk { display: flex; flex-direction: row; flex-wrap: wrap; width: 100%; order: 5; flex: none; }
}

/* botones sin clase (algunas páginas viejas del admin): mismo aspecto que
   .k-btn-ghost en vez del botón gris del sistema */
main.k-main button:not([class]) {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 700 12.5px var(--font-body); padding: 8px 16px; border-radius: var(--radius-pill);
  background: var(--card); color: var(--text-mid); border: 1px solid var(--border-strong);
}
main.k-main button:not([class]):hover { border-color: var(--teal); color: var(--teal); }

/* separadores del panel: "Operar" (día a día) y "Configurar" (poco uso) */
/* botón "Avisarme en este navegador" (portal vivo, cliente/_nav.php) */
.k-panel-avisos {
  display: flex; align-items: center; gap: 8px; width: calc(100% - 16px); margin: 16px 8px 0; padding: 9px 10px;
  background: var(--teal-soft, rgba(11,107,85,.08)); color: var(--teal-dark, #0B6B55); border: 1px dashed currentColor;
  border-radius: 8px; font-family: inherit; font-size: 12.5px; font-weight: 600; line-height: 1.35; text-align: left; cursor: pointer;
}
.k-panel-avisos[hidden] { display: none; }
.k-panel-avisos:hover { background: rgba(11,107,85,.14); }
.k-sidebar-contador[hidden] { display: none; }
.k-panel-seccion { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); padding: 14px 12px 4px; margin: 0; }

/* barra fija "Estás en la cuenta de X" (admin dentro de una clínica) */
.k-barra-cuenta {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 80;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100vw - 24px); padding: 10px 12px 10px 16px;
  background: var(--text); color: #fff; border-radius: 16px; box-shadow: 0 12px 32px rgba(18,20,28,.28);
}
.k-barra-cuenta-texto { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.k-barra-cuenta-texto strong { color: #fff; }
.k-barra-cuenta-aviso { font-size: 12.5px; font-weight: 700; color: #FDE68A; }
.k-barra-cuenta .k-btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.k-barra-cuenta .k-btn-ghost:hover { background: rgba(255,255,255,.1); color: #fff; border-color: #fff; }
body:has(.k-barra-cuenta) main.k-main { padding-bottom: 120px; }

/* Acciones sugeridas (Kairus\Diagnostico\AccionSugerida): 💡 regla conocida, ✨ redactada por Claude */
.k-explica { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; margin: 0 0 10px; }
.k-sugerencia {
  margin-top: 6px; padding: 6px 9px; border-radius: 6px; font-size: 12px; line-height: 1.45;
  background: rgba(189,238,211, .10); border-left: 3px solid var(--teal); color: var(--text);
}
.k-leyenda-sugerencias { font-size: 12px; color: var(--text-dim); margin: 0 0 12px; line-height: 1.8; }
.k-sugerencia-chip { display: inline-block; padding: 1px 7px; border-radius: 10px; background: rgba(189,238,211, .16); color: var(--text); font-size: 11.5px; }
.k-sugerencia-chip-ia { background: rgba(11,107,85, .10); }

/* --- marcas de estado (reemplazan emojis, ver portalEstado() en _iconos.php) --- */
.k-ico { display: inline-flex; vertical-align: -3px; }
.k-ico-ok { color: var(--green); }
.k-ico-error { color: var(--red); }
.k-ico-aviso { color: var(--amber); }
.k-ico-espera, .k-ico-candado, .k-ico-vacio { color: var(--text-dim); }
.k-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.k-dot-rojo { background: var(--red); } .k-dot-ambar { background: #D97706; }
.k-dot-verde { background: #16A34A; } .k-dot-azul { background: var(--teal); } .k-dot-gris { background: #8A9A92; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- tablas que en celular se vuelven filas (clase opcional .k-tabla-apilable):
 * .k-ap-cabeza = primera línea en negritas (fecha/hora), .k-ap-sec = dato
 * secundario en gris. Evita el scroll horizontal de 3-4 columnas en 390 px. */
@media (max-width: 640px) {
  .k-tabla.k-tabla-apilable, .k-tabla-apilable tbody { display: block; overflow: visible; }
  .k-tabla-apilable thead { display: none; }
  .k-tabla-apilable tr { display: flex; flex-wrap: wrap; gap: 2px 8px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
  .k-tabla-apilable tr:last-child { border-bottom: none; }
  .k-tabla-apilable td { display: block; flex: 1 1 100%; border: none; padding: 0; font-size: 14px; background: none !important; }
  .k-tabla-apilable td.k-ap-cabeza { flex: 0 0 auto; font-weight: 700; color: var(--text); }
  .k-tabla-apilable td.k-ap-cabeza + td.k-ap-cabeza::before { content: "· "; color: var(--text-dim); font-weight: 400; }
  .k-tabla-apilable td.k-ap-sec { color: var(--text-muted); font-size: 13px; }
}

/* celular angosto: "Salir" solo con ícono (conserva aria-label) para dejarle
 * espacio al nombre de la clínica. */
@media (max-width: 480px) {
  .k-sidebar-salir .k-salir-txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

.k-logo-img { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; display: block; }

/* Barra superior: campanita (PLAN.md E39, E40) */
.k-barra-sup {
  position: fixed; top: 0; left: 324px; right: 0; height: 64px; z-index: 60;
  display: flex; gap: 12px; align-items: center; padding: 0 14px 0 32px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.k-barra-iconos { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.k-campana { position: relative; }
.k-campana-btn { position: relative; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface, #fff); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.k-campana-btn:hover { border-color: var(--text-dim); }
.k-campana-n { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #B42318; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.k-campana-n[hidden] { display: none; }
.k-campana-panel { position: absolute; right: 0; top: 52px; width: min(360px, calc(100vw - 28px)); max-height: 70vh; overflow: auto; background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px rgba(16,32,27, .16); padding: 12px; }
.k-campana-titulo { font-weight: 700; font-size: 13px; margin: 2px 4px 8px; }
.k-campana-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.k-campana-lista li { padding: 10px; border-radius: 10px; }
.k-campana-lista li.nueva { background: #DCEFE4; }
.k-campana-lista .t { font-weight: 600; font-size: 13px; margin: 0; }
.k-campana-lista .t a { color: inherit; }
.k-campana-lista .c { font-size: 12.5px; color: var(--text-muted); margin: 4px 0 0; }
.k-campana-lista .f { font-size: 11px; color: var(--text-dim); margin: 4px 0 0; }
.k-campana-vacia { color: var(--text-muted); font-size: 13px; }
/* Menú de perfil (PLAN.md E41) */
.k-perfil-btn { padding: 0; overflow: hidden; background: #0B6B55; color: #fff; border-color: #0B6B55; font-weight: 700; font-size: 14px; }
.k-perfil-btn img { width: 100%; height: 100%; object-fit: cover; }
.k-perfil-panel { width: min(260px, calc(100vw - 28px)); }
.k-perfil-nombre { font-weight: 700; font-size: 14px; margin: 4px 6px 0; }
.k-perfil-correo { font-size: 12.5px; color: var(--text-muted); margin: 2px 6px 10px; word-break: break-all; }
.k-perfil-panel a { display: flex; gap: 10px; align-items: center; min-height: 44px; padding: 0 8px; border-radius: 10px; color: var(--text); font-size: 14px; text-decoration: none; }
.k-perfil-panel a:hover { background: var(--bg2, #E9EDE6); }
.k-perfil-foto { width: 96px; height: 96px; border-radius: 50%; background: #0B6B55; color: #fff; display: grid; place-items: center; font-size: 32px; font-weight: 700; overflow: hidden; }
.k-perfil-foto img { width: 100%; height: 100%; object-fit: cover; }
body:has(.k-barra-sup) main.k-main { padding-top: 92px; }
@media (max-width: 900px) {
  body:has(.k-barra-sup) .k-sidebar { padding-right: 170px; }
  body:has(.k-perfil) .k-sidebar-salir { display: none; }
  body:has(.k-barra-sup) main.k-main { padding-top: 18px; }
}

/* Consumo de mensajes automáticos (PLAN.md E11) */
.k-consumo-cab { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: 14px; }
.k-consumo-barra { height: 10px; border-radius: 6px; background: var(--bg2, #E9EDE6); margin: 10px 0; overflow: hidden; }
.k-consumo-barra span { display: block; height: 100%; background: #0B6B55; border-radius: 6px; }
.k-consumo-barra span.medio { background: #92400E; }
.k-consumo-barra span.alto { background: #B42318; }
.k-consumo-nota { font-size: 12.5px; color: var(--text-muted); margin: 0; }

/* Buscador de funciones (PLAN.md E23) */
/* Búsqueda siempre visible al centro de la barra superior (28-sep-2026). */
.k-busqueda { flex: 1; display: flex; justify-content: center; min-width: 0; }
.k-busqueda-abrir { display: none; }
.k-busqueda-caja { position: relative; width: min(560px, 100%); }
.k-busqueda-caja input {
  width: 100%; height: 44px; padding: 0 64px 0 42px; border: 1px solid var(--border-strong, #C9D3CC); border-radius: 12px;
  background: var(--card, #fff); color: var(--text); font: inherit; font-size: 14px; box-shadow: 0 1px 2px rgba(16,32,27,.05);
}
.k-busqueda-caja input::placeholder { color: var(--text-dim); }
.k-busqueda-caja input:focus { outline: none; border-color: #7FC9A6; box-shadow: 0 0 0 3px rgba(189,238,211,.22); }
.k-busqueda-caja input::-webkit-search-cancel-button { display: none; }
.k-busqueda-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-dim); display: flex; pointer-events: none; }
.k-busqueda-atajo { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; background: var(--bg); pointer-events: none; }
.k-busqueda-caja input:focus ~ .k-busqueda-atajo { display: none; }
.k-busqueda-lista {
  position: absolute; left: 0; right: 0; top: 52px; list-style: none; margin: 0; padding: 8px; display: grid; gap: 2px;
  max-height: 60vh; overflow: auto; background: var(--card, #fff); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px rgba(16,32,27,.16);
}
.k-busqueda-lista[hidden] { display: none; }
.k-busqueda-lista a { display: flex; justify-content: space-between; gap: 10px; padding: 10px; border-radius: 10px; color: var(--text); font-size: 13.5px; text-decoration: none; min-height: 44px; align-items: center; }
.k-busqueda-lista a span { font-size: 11.5px; color: var(--text-dim); }
.k-busqueda-lista li[aria-selected="true"] a, .k-busqueda-lista a:hover { background: #DCEFE4; }
@media (max-width: 900px) {
  /* Celular: la barra vuelve a ser solo íconos arriba a la derecha y la
     lupa abre la búsqueda a todo lo ancho sobre el encabezado. */
  .k-barra-sup { left: auto; right: 14px; top: 10px; height: auto; padding: 0; background: none; border: 0; }
  .k-busqueda { flex: none; }
  .k-busqueda-abrir { display: grid; }
  .k-busqueda-caja { display: none; }
  .k-busqueda.abierta .k-busqueda-caja { display: block; position: fixed; left: 10px; right: 10px; top: 10px; width: auto; z-index: 80; }
  .k-busqueda.abierta .k-busqueda-caja input { box-shadow: 0 8px 24px rgba(16,32,27,.18); }
  .k-busqueda-atajo { display: none; }
  /* Salir ya está en el menú de perfil: el encabezado deja espacio al nombre. */
  body:has(.k-perfil) .k-sidebar-rail .k-sidebar-salir[data-movil] { display: none; }
}

/* Cambios recientes (PLAN.md E47) */
.k-cambio { border-bottom: 1px solid var(--border); }
.k-cambio:last-child { border-bottom: none; }
.k-cambio summary { cursor: pointer; padding: 12px 0; min-height: 44px; display: flex; flex-direction: column; gap: 2px; list-style: none; }
.k-cambio summary::-webkit-details-marker { display: none; }
.k-cambio .q { font-weight: 600; font-size: 13.5px; }
.k-cambio .m { font-size: 12.5px; color: var(--text-muted); }
.k-cambio pre { white-space: pre-wrap; font-family: inherit; font-size: 12.5px; margin: 4px 0 10px; padding: 8px 10px; border-radius: 8px; }
.k-cambio-antes pre { background: #FEF2F2; color: #7F1D1D; }
.k-cambio-despues pre { background: #F0FDF4; color: #14532D; }
.k-cambio strong { font-size: 12px; }

/* Tipografía Receta (9-oct-2026): h1, cifras y el panel del login en Newsreader 400. */
h1 { font-weight: 400; letter-spacing: -.02em; }
.k-titulo { font-family: var(--font-display); font-weight: 400; letter-spacing: -.02em; }
.k-stat .k-valor, .k-tasa .k-valor, .k-login-marca h2 { font-family: var(--font-display); font-weight: 400; letter-spacing: -.03em; }
.k-stat .k-valor { font-size: 34px; background: none; -webkit-text-fill-color: currentColor; color: var(--text); }
.k-login-marca h2 { font-size: 44px; }


/* Ilustraciones de acceso (28-sep-2026): recuperar, activar y sesión
   vencida arriba del título; la de marca en tarjeta blanca sobre el
   degradado, solo en escritorio como el resto de la columna. */
.k-acceso-ilus { display: block; width: 100%; max-width: 150px; height: auto; margin: 0 0 14px; }
.k-login-ilus { display: none; }
@media (min-width: 960px) {
  /* La columna cabe en la pantalla: la ilustración toma el alto que sobra
     y se encoge primero (antes se cortaban los puntos de abajo). */
  .k-login-wrap { height: 100vh; min-height: 560px; }
  .k-login-marca { padding: clamp(28px, 5vh, 48px) 48px; gap: clamp(14px, 3vh, 32px); }
  .k-login-marca h2 { font-size: clamp(28px, 4.4vh, 38px); }
  .k-login-ilus { display: flex; flex: 1 1 auto; min-height: 0; align-self: flex-start; background: #fff; border-radius: 20px; padding: 12px; box-shadow: 0 18px 40px rgba(0,0,0,.22); }
  .k-login-ilus img { display: block; height: 100%; width: auto; max-width: 100%; object-fit: contain; }
  .k-login-form { overflow-y: auto; }
}

/* Páginas de error estáticas (webroot/404.html y 500.html) */
.k-error { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.k-error-card { max-width: 440px; width: 100%; text-align: center; padding: 28px 26px; }
.k-error-card img { display: block; width: 100%; max-width: 240px; height: auto; margin: 0 auto 18px; }
.k-error-card h1 { font-size: 26px; margin-bottom: 8px; }
.k-error-card p { color: var(--text-muted); font-size: 14px; margin: 0 0 20px; }
.k-error-card .k-error-pie { margin: 18px 0 0; font-size: 13px; }

/* Campos de lista (portal/assets/campos-lista.js): filas con + y ×
   en lugar de textarea de "uno por línea". */
.k-lista { display: flex; flex-direction: column; gap: 8px; }
.k-lista-filas { display: flex; flex-direction: column; gap: 8px; }
.k-lista-fila { display: grid; grid-template-columns: repeat(var(--k-lista-cols, 1), minmax(0, 1fr)) 40px; gap: 8px; align-items: center; }
.k-lista-cab span { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.k-lista-quitar { width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text-muted); font-size: 20px; line-height: 1; cursor: pointer; }
.k-lista-quitar:hover { color: var(--red); border-color: var(--red); }
.k-lista-agregar { align-self: flex-start; }
.k-vars { display: flex; flex-direction: column; gap: 8px; }
.k-vars-fila { display: grid; grid-template-columns: 56px 1fr; gap: 8px; align-items: center; margin: 0; }
.k-vars-fila code { font-size: 13px; color: var(--teal); font-weight: 700; }
.k-vars-vacio { margin: 0; font-size: 13px; color: var(--text-muted); }

/* --- acciones en lote (assets/seleccion-lote.js) --- */
.k-tabla th.k-col-sel, .k-tabla td.k-col-sel { width: 28px; padding-right: 0; }
.k-col-sel input { width: 16px; height: 16px; margin: 0; cursor: pointer; accent-color: #0B6B55; }
.k-barra-lote { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; margin-bottom: 10px; }
.k-barra-lote .k-conteo-sel { font-size: 12.5px; font-weight: 700; margin-right: 6px; }
.k-tabla tbody tr.k-fila-seleccionada td { background: var(--card-hover); }

/* ================= Botones y tarjetas planos (identidad Receta, 9-oct-2026) ================= */
.k-card { background: var(--card); box-shadow: none; }
.k-card-destacada { background: #DCEFE4; box-shadow: none; }
.k-btn { transition: background .12s ease, border-color .12s ease, color .12s ease; }
.k-btn-primary { background: #0B6B55; box-shadow: none; }
.k-btn-primary:hover { background: #095A48; box-shadow: none; }
.k-btn-ghost { background: transparent; box-shadow: none; }
.k-btn-ghost:hover { background: #DCEFE4; }
.k-btn-danger { background: #FFF1F1; box-shadow: none; }
.k-btn:active:not(:disabled) { transform: scale(.98); }
@media (prefers-reduced-motion: reduce) { .k-btn { transition: none; } .k-btn:active:not(:disabled) { transform: none; } }

/* Estados vacíos con ilustración 3D suave */
.k-vacio-img { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 22px 12px; }
.k-vacio-img img { width: 140px; height: auto; mix-blend-mode: multiply; }
.k-vacio-img span { max-width: 46ch; }

/* Fase 3: ilustraciones 3D suaves en avisos, confirmaciones y cabeceras */
.k-ilus { display: block; height: auto; max-width: 100%; mix-blend-mode: multiply; }
.k-ilus-cab { width: 100%; max-width: 280px; margin: 0 auto 12px; }
.k-ilus-hero { width: 100%; max-width: 360px; margin: 0 auto; }
.k-ilus-aviso { display: flex; align-items: center; gap: 14px; }
.k-ilus-aviso .k-ilus { flex-shrink: 0; width: 112px; }
.k-ilus-aviso > :last-child { min-width: 0; flex: 1; }
@media (max-width: 480px) { .k-ilus-aviso { flex-direction: column; text-align: center; } }

/* ---------- Fase 1 (7-oct-2026): capa de movimiento del portal ---------- */
/* Solo opacity/transform; `backwards` evita dejar un transform activo
   (que rompería elementos fixed dentro de la tarjeta). */
@keyframes k-entra { from { opacity: 0; transform: translateY(10px); } }
@keyframes k-brillo { to { background-position: -200% 0; } }
@keyframes k-aviso { from { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .k-sidebar-rail { view-transition-name: k-sidebar; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; animation-timing-function: cubic-bezier(.2,.7,.3,1); }

  /* Entrada escalonada: primeras 8 tarjetas del contenido y primeras 12 filas */
  main.k-main > .k-card, main.k-main > * > .k-card { animation: k-entra .38s cubic-bezier(.2,.7,.3,1) backwards; }
  main.k-main > .k-card:nth-child(2), main.k-main > * > .k-card:nth-child(2) { animation-delay: 50ms; }
  main.k-main > .k-card:nth-child(3), main.k-main > * > .k-card:nth-child(3) { animation-delay: 100ms; }
  main.k-main > .k-card:nth-child(4), main.k-main > * > .k-card:nth-child(4) { animation-delay: 150ms; }
  main.k-main > .k-card:nth-child(n+5), main.k-main > * > .k-card:nth-child(n+5) { animation-delay: 200ms; }
  .k-tabla tbody tr:nth-child(-n+12) { animation: k-entra .32s cubic-bezier(.2,.7,.3,1) backwards; }
  .k-tabla tbody tr:nth-child(2) { animation-delay: 30ms; } .k-tabla tbody tr:nth-child(3) { animation-delay: 60ms; }
  .k-tabla tbody tr:nth-child(4) { animation-delay: 90ms; } .k-tabla tbody tr:nth-child(n+5) { animation-delay: 120ms; }

  .k-alerta-ok, .k-alerta-error { animation: k-aviso .3s cubic-bezier(.2,.7,.3,1) backwards; }

  /* Hover de tarjetas enlazadas y foco con transición */
  a.k-card, .k-card[tabindex] { transition: transform .18s ease, box-shadow .18s ease; }
  a.k-card:hover, .k-card[tabindex]:hover { transform: translateY(-2px); }
  .k-sidebar a, .k-rail a, .k-panel a { transition: background-color .15s ease, color .15s ease; }
  input, select, textarea { transition: border-color .15s ease, box-shadow .15s ease; }
}

/* Esqueleto de carga: <div class="k-skel" style="height:14px;width:60%"></div> */
.k-skel { display: block; border-radius: 8px; background: linear-gradient(90deg, #EEF1EC 25%, #F2F4EE 50%, #EEF1EC 75%); background-size: 200% 100%; }
@media (prefers-reduced-motion: no-preference) { .k-skel { animation: k-brillo 1.4s linear infinite; } }

/* Login: entrada de la tarjeta y del panel de marca (solo opacity/transform) */
@keyframes k-entra-x { from { opacity: 0; transform: translateX(-14px); } }
@media (prefers-reduced-motion: no-preference) {
  .k-login-card { animation: k-entra .5s cubic-bezier(.2,.7,.3,1) backwards; }
  .k-login-marca > * { animation: k-entra-x .6s cubic-bezier(.2,.7,.3,1) backwards; }
  .k-login-marca > :nth-child(2) { animation-delay: .08s; }
  .k-login-marca > :nth-child(3) { animation-delay: .16s; }
  /* Indicador del menú: el cambio de fondo y color se desliza en vez de saltar */
  .k-rail a, .k-sidebar-nav-desk a, .k-panel a { transition: background-color .18s ease, color .18s ease, transform .18s ease; }
  .k-rail a:hover { transform: translateX(1px); }
}

/* Botón enviando (portal-motion.js) */
@keyframes k-giro { to { transform: rotate(360deg); } }
.k-btn.k-cargando { position: relative; }
.k-btn.k-cargando::after { content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 8px; vertical-align: -2px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: k-giro .7s linear infinite; }
@media (prefers-reduced-motion: reduce) { .k-btn.k-cargando::after { animation: none; } }

/* Barra de una tasa (portal-motion.js): se llena una vez hasta el dato real */
.k-tasa-barra { height: 4px; border-radius: 999px; background: var(--border); margin: 8px 0 2px; overflow: hidden; }
.k-tasa-barra i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--cyan)); transform: scaleX(0); transform-origin: left; transition: transform .9s cubic-bezier(.2,.7,.3,1); }
.k-tasa-barra.on i { transform: scaleX(var(--p)); }

/* Bandeja: lista y burbujas con movimiento discreto (solo opacity/transform) */
@media (prefers-reduced-motion: no-preference) {
  .k-band-lista a { transition: background-color .15s ease, transform .15s ease; }
  .k-band-lista a:hover { transform: translateX(2px); }
  .k-band-lista a:nth-child(-n+10) { animation: k-entra .3s cubic-bezier(.2,.7,.3,1) backwards; }
  .k-band-lista a:nth-child(2) { animation-delay: 30ms; } .k-band-lista a:nth-child(3) { animation-delay: 60ms; }
  .k-band-lista a:nth-child(4) { animation-delay: 90ms; } .k-band-lista a:nth-child(n+5) { animation-delay: 120ms; }
  /* Solo los últimos 6 mensajes del hilo (los más recientes), uno tras otro */
  .k-band-bubble:nth-last-child(-n+6) { animation: k-entra .3s cubic-bezier(.2,.7,.3,1) backwards; }
  .k-band-bubble:nth-last-child(3) { animation-delay: 40ms; } .k-band-bubble:nth-last-child(2) { animation-delay: 80ms; }
  .k-band-bubble:nth-last-child(1) { animation-delay: 120ms; }
  .k-band-badge { transition: background-color .2s ease, color .2s ease; }
}

/* Agenda: solo opacidad en los bloques (están posicionados y se arrastran; sin transform para no chocar) */
@keyframes k-aparece { from { opacity: 0; } }
@keyframes k-dialogo-entra { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (prefers-reduced-motion: no-preference) {
  .k-bloque { animation: k-aparece .35s ease backwards; transition: box-shadow .15s ease, background-color .15s ease; }
  .k-dia-col:nth-child(2) .k-bloque { animation-delay: 40ms; } .k-dia-col:nth-child(3) .k-bloque { animation-delay: 80ms; }
  .k-dia-col:nth-child(4) .k-bloque { animation-delay: 120ms; } .k-dia-col:nth-child(n+5) .k-bloque { animation-delay: 160ms; }
  .k-mes-dia { transition: background-color .15s ease; }
  .k-chip { animation: k-aparece .3s ease backwards; }
  dialog.k-dialogo[open] { animation: k-dialogo-entra .22s cubic-bezier(.2,.7,.3,1); }
  dialog.k-dialogo[open]::backdrop { animation: k-aparece .22s ease; }
  .k-cal-flecha { transition: transform .15s ease, background-color .15s ease; }
  .k-cal-flecha:active { transform: scale(.94); }
}

/* Logo Receta en accesos y riel del admin */
.k-logo-wm { display: block; height: 32px; width: auto; }
.k-logo img { display: block; }
.k-vacio-img img, img[src*="/ilustraciones/"] { mix-blend-mode: multiply; }

/* Receta (9-oct-2026): superficies planas y sobrias. Botones sin degradado,
   tarjetas con borde fino y sombra mínima, ilustración sin marco. */
.k-btn { border-radius: 6px; box-shadow: none; }
.k-btn-primary { background: var(--teal); border-color: var(--teal); color: #FBFCF8; }
.k-btn-primary:hover:not(:disabled) { background: #095A48; border-color: #095A48; }
.k-btn-ghost { background: var(--card); border: 1px solid var(--border-strong); color: var(--text); }
.k-btn-ghost:hover:not(:disabled) { border-color: var(--text); background: var(--card); }
.k-card, .k-stat { background: var(--card); box-shadow: 0 1px 0 rgba(16,32,27,.03); border: 1px solid var(--border); }
.k-card-destacada { background: #E5EFE8; border-color: #C9DDD1; box-shadow: none; }
.k-login-ilus { background: none !important; box-shadow: none !important; border: 0 !important; padding: 0 !important; }
.k-login-ilus img { border-radius: 0; }
