/* ══════════════════════════════════════════════════════════════════
   Clínica San Diego · Sistema de diseño del panel
   Escala compacta: 1rem = 14px en escritorio, 15px en teléfono.
   Fuentes servidas desde /assets/fonts (OFL 1.1); sin CDN (CSP: solo 'self').
   ══════════════════════════════════════════════════════════════════ */

@font-face { font-family: "Inter Var"; src: url("../fonts/inter-latin-var.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans Var"; src: url("../fonts/plus-jakarta-sans-latin-var.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }

:root {
  color-scheme: light only;
  /* Tipografía */
  --font: "Inter Var", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Plus Jakarta Sans Var", "Plus Jakarta Sans", "Inter Var", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --fs-xs: .75rem; --fs-sm: .875rem; --fs-md: 1rem; --fs-lg: 1.125rem;
  --fs-xl: 1.375rem; --fs-2xl: 1.875rem; --fs-kpi: 2.125rem;

  /* Color de marca */
  --navy-950: #071830; --navy-900: #0B2140; --navy-800: #102C52; --navy-700: #173A66;
  --ink: #0E1B2E; --ink-2: #334155; --muted: #5E6C80; --subtle: #93A0B2;
  --line: #E2E7EE; --line-2: #EDF1F5;
  --bg: #F5F5F9; --surface: #FFFFFF; --surface-2: #F8F8FB;
  --blue: #1E5A96; --blue-600: #174B80; --blue-500: #2F74BC; --blue-300: #8DBDEB; --blue-soft: #EAF2FB;
  --green: #18804F; --green-500: #1F9A61; --green-300: #7FD6AB; --green-soft: #E3F4EA;
  --teal: #0D7F78; --teal-500: #14A398; --teal-300: #6FD6CB; --teal-soft: #E1F3F1;
  --amber: #A86A10; --amber-500: #E19A2B; --amber-soft: #FDF2DA;
  --rose: #BF3F35; --rose-500: #E05A4E; --rose-soft: #FCE9E6;
  --violet: #5B4FC4; --violet-soft: #ECEAFB;
  /* Paleta DR CEO: gris lavanda y tinta */
  --lav-50: #F7F7FB; --lav-100: #F0EFF6; --lav-200: #E6E5EF; --lav-300: #D6D4E4; --lav-ink: #1B2033; --lav-muted: #6B7185;
  --grad-brand: linear-gradient(135deg, #1E5A96 0%, #136E86 100%);
  --grad-blue: linear-gradient(180deg, #2F74BC, #1E5A96);
  --grad-green: linear-gradient(180deg, #14A398, #0D7F78);

  /* Superficies */
  --ring: rgba(30,90,150,.14);
  --focus: 0 0 0 3px rgba(47,116,188,.22);
  --sh-xs: 0 1px 2px rgba(14,27,46,.05);
  --sh-sm: 0 1px 2px rgba(14,27,46,.04), 0 1px 3px rgba(14,27,46,.05);
  --sh-md: 0 1px 2px rgba(14,27,46,.04), 0 8px 20px -8px rgba(14,27,46,.12);
  --sh-lg: 0 2px 6px rgba(14,27,46,.06), 0 24px 48px -16px rgba(14,27,46,.28);
  --shadow: var(--sh-sm);
  --ease: cubic-bezier(.2,.8,.2,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);

  /* Espaciado, radios y medidas */
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1.25rem; --sp-5: 1.5rem; --sp-6: 2rem; --sp-7: 2.75rem;
  --r-xs: .3125rem; --r-sm: .4375rem; --r-md: .625rem; --r-lg: .875rem; --r-xl: 1.125rem;
  --sidebar-w: 17rem; --sidebar-w-collapsed: 4.75rem; --header-h: 4.25rem; --control-h: 2.75rem; --icon: 1.25rem; --content-max: 90rem;
}

/* ── Base ───────────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; }
html { font-size: 87.5%; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--bg); color: var(--ink);
  font: 400 var(--fs-md)/1.55 var(--font);
  font-feature-settings: "cv11", "ss03", "cv05";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
h1,h2,h3,h4 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; color: var(--ink); line-height: 1.2; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button,input,select,textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
img,svg { display: block; max-width: 100%; }
code { font-family: var(--mono); font-size: .9em; padding: .12em .45em; border-radius: var(--r-xs); background: var(--blue-soft); color: var(--blue); overflow-wrap: anywhere; }
pre { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 2px; border-radius: var(--r-xs); }
::selection { background: rgba(58,130,198,.22); }
svg.i { width: var(--icon); height: var(--icon); stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.num,td,.v,.meter-head b,.m-figure b { font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; color: var(--ink); }
.is-hidden { display: none !important; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

/* Fondo ambiental muy suave detrás del contenido */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: linear-gradient(180deg, #EEEEF6 0, var(--bg) 22rem); }
.aurora i { display: none; }
.aurora i:nth-child(1) { width: 38rem; height: 30rem; right: -10rem; top: -12rem; background: #CFE2F7; }
.aurora i:nth-child(2) { width: 32rem; height: 28rem; right: 22%; top: -16rem; background: #D3F0E2; animation-duration: 36s; animation-delay: -8s; }
.aurora i:nth-child(3) { width: 34rem; height: 30rem; left: 10%; bottom: -20rem; background: #DCE8F7; animation-duration: 40s; animation-delay: -14s; }
.aurora i:nth-child(4) { display: none; }
@keyframes drift { to { transform: translate(4rem,-3rem) scale(1.1); } }

/* ── Estructura ─────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0,1fr); min-height: 100vh; min-height: 100dvh; transition: grid-template-columns .3s var(--ease); }
.app.sidebar-collapsed { grid-template-columns: var(--sidebar-w-collapsed) minmax(0,1fr); }

/* Barra lateral clara, estilo DR CEO: lavanda suave, tinta oscura y acento azul clínico */
aside {
  position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: 40;
  display: flex; flex-direction: column; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-3) var(--sp-3);
  color: var(--lav-ink); overflow: hidden;
  background: linear-gradient(180deg, #FCFCFE 0%, var(--lav-50) 55%, var(--lav-100) 100%);
  border-right: 1px solid var(--lav-200);
}
aside::before { content: none; }
aside > * { position: relative; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-width: 0; padding: 0 var(--sp-1); }
.brand { min-width: 0; }
.bh { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.logo {
  width: 2.75rem; height: 2.75rem; flex: none; border-radius: .9rem; display: grid; place-items: center;
  background: #fff; box-shadow: 0 0 0 1px var(--lav-200), 0 4px 12px -6px rgba(27,32,51,.25);
}
.logo svg { width: 1.9rem; height: 1.9rem; }
.bt { min-width: 0; white-space: nowrap; }
.bt small { display: block; font-size: .65rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--teal); line-height: 1.2; }
.bt h2 { margin-top: .2rem; font-size: 1.1875rem; font-weight: 700; color: var(--lav-ink); letter-spacing: -.02em; line-height: 1.1; }
.sidebar-toggle {
  display: grid; place-items: center; flex: none; width: 2.125rem; height: 2.125rem; padding: 0;
  border: 1px solid var(--lav-200); border-radius: .65rem; background: #fff; color: var(--lav-muted);
  transition: background .2s, color .2s, border-color .2s;
}
.sidebar-toggle:hover { background: #fff; color: var(--blue); border-color: var(--lav-300); }
.sidebar-toggle svg { width: 1.1rem; height: 1.1rem; transition: transform .3s var(--ease); }

aside nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; margin: 0 calc(-1 * var(--sp-1)); padding: 0 var(--sp-1); scrollbar-width: thin; scrollbar-color: var(--lav-300) transparent; }
.nav-label { display: block; margin: var(--sp-4) var(--sp-3) var(--sp-1); font-size: .65rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: #9A9EB0; white-space: nowrap; }
.nav-label:first-child { margin-top: 0; }
aside nav a {
  position: relative; display: flex; align-items: center; gap: var(--sp-3);
  min-height: 2.5rem; padding: 0 var(--sp-3); border-radius: var(--r-md);
  color: #444A5E; font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
  transition: background .2s, color .2s, box-shadow .2s;
}
aside nav a .i { width: 1.2rem; height: 1.2rem; color: #7A7F93; transition: color .2s; }
aside nav a span { overflow: hidden; text-overflow: ellipsis; }
aside nav a:hover { background: rgba(27,32,51,.045); color: var(--lav-ink); }
aside nav a:hover .i { color: var(--lav-ink); }
aside nav a[aria-current] {
  color: #17457A; font-weight: 600;
  background: #E7EEF9;
  box-shadow: inset 0 0 0 1px #D5E1F3;
}
aside nav a[aria-current]::before { content: none; }
aside nav a[aria-current] .i { color: var(--blue); }
.foot { display: grid; gap: .45rem; padding: var(--sp-3); border-radius: var(--r-md); background: #fff; box-shadow: 0 0 0 1px var(--lav-200); font-size: var(--fs-xs); color: var(--lav-muted); white-space: nowrap; overflow: hidden; }
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.foot-row > span { display: inline-flex; align-items: center; gap: .45rem; }
.foot .dot { width: .5rem; height: .5rem; flex: none; border-radius: 50%; background: var(--teal-500); box-shadow: 0 0 0 3px rgba(20,163,152,.16); }
.foot .ghl { color: var(--lav-muted); font-weight: 500; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(127,214,171,0); } }

/* Marca DR CEO: "DR" en recuadro + "CEO", trazo fino */
.drceo { display: inline-flex; align-items: center; gap: .3em; color: var(--lav-ink); font: 400 1.05rem/1 var(--font-display); letter-spacing: .12em; }
.drceo b { display: inline-grid; place-items: center; padding: .2em .3em .16em; border: 1.3px solid currentColor; font-size: .66em; font-weight: 600; letter-spacing: .06em; }
.drceo.sm { font-size: .95rem; }
.drceo.lg { font-size: 1.35rem; font-weight: 400; }

/* Barra lateral contraída (escritorio) */
.sidebar-collapsed aside { padding-inline: var(--sp-2); }
.sidebar-collapsed .sidebar-head { flex-direction: column; padding: 0; }
.sidebar-collapsed .bt,.sidebar-collapsed aside nav a span,.sidebar-collapsed .foot-row:last-child,.sidebar-collapsed .foot .ghl,.sidebar-collapsed .foot .drceo { display: none; }
.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }
.sidebar-collapsed .nav-label { height: 1px; margin: var(--sp-2) var(--sp-3); overflow: hidden; font-size: 0; background: var(--lav-200); }
.sidebar-collapsed .nav-label:first-child { display: none; }
.sidebar-collapsed aside nav a { justify-content: center; padding: 0; }
.sidebar-collapsed aside nav a[aria-current]::before { left: 0; }
.sidebar-collapsed .foot { justify-items: center; padding: var(--sp-2); }
.sidebar-collapsed .foot-row { justify-content: center; }

/* Contenido */
main { min-width: 0; padding: 0 var(--sp-6) var(--sp-7); }
.page-body { max-width: var(--content-max); margin-inline: auto; min-width: 0; overflow-wrap: break-word; animation: page-in .45s var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } }

/* Encabezado */
.hdr {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--header-h); margin: 0 calc(-1 * var(--sp-6)); padding: 0 var(--sp-6);
  background: rgba(255,255,255,.86);
  -webkit-backdrop-filter: blur(14px) saturate(150%); backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid var(--line);
}
.crumb { display: flex; flex-direction: column; min-width: 0; margin-right: auto; line-height: 1.25; }
.crumb small { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
.crumb b { font-family: var(--font-display); font-size: 1.0625rem; font-weight: 700; color: var(--ink); letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search {
  display: flex; align-items: center; gap: var(--sp-2);
  width: min(22rem, 32vw); height: var(--control-h); padding: 0 var(--sp-3);
  border-radius: var(--r-md); background: var(--surface-2); color: var(--subtle);
  box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s, background .2s, width .3s var(--ease);
}
.search:focus-within { background: #fff; box-shadow: inset 0 0 0 1px var(--blue-500), var(--focus); color: var(--blue); }
.search input { flex: 1; min-width: 0; min-height: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: var(--fs-sm); }
.search input::placeholder { color: var(--subtle); }
.search kbd { font: 600 .6875rem var(--font); color: var(--subtle); padding: .1rem .4rem; border-radius: .35rem; box-shadow: inset 0 0 0 1px var(--line); }
.acts { display: flex; align-items: center; gap: var(--sp-2); }
.icon-btn,.nav-open,.search-btn {
  display: grid; place-items: center; flex: none; width: var(--control-h); height: var(--control-h); padding: 0;
  border: 0; border-radius: var(--r-md); background: var(--surface); color: var(--ink-2);
  box-shadow: 0 0 0 1px var(--line), var(--sh-xs); transition: box-shadow .2s, color .2s;
}
.icon-btn:hover,.nav-open:hover,.search-btn:hover { color: var(--blue); box-shadow: 0 0 0 1px var(--blue-300), var(--sh-xs); }
.search-btn,.nav-open { display: none; }
.pill {
  display: flex; align-items: center; gap: var(--sp-2); height: var(--control-h); padding: 0 var(--sp-3);
  border-radius: var(--r-md); background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--sh-xs);
  font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.pill svg { color: var(--blue); width: 1.1rem; height: 1.1rem; }
.acc { position: relative; }
.accb {
  display: flex; align-items: center; gap: var(--sp-2); height: var(--control-h); padding: 0 var(--sp-2) 0 .3rem;
  border: 0; border-radius: var(--r-md); background: var(--surface); text-align: left;
  box-shadow: 0 0 0 1px var(--line), var(--sh-xs); transition: box-shadow .2s;
}
.accb:hover,.accb[aria-expanded="true"] { box-shadow: 0 0 0 1px var(--blue-300), var(--sh-xs); }
.accb > .i { width: 1rem; height: 1rem; color: var(--muted); transition: transform .25s var(--ease); }
.accb[aria-expanded="true"] > .i { transform: rotate(180deg); }
.av { position: relative; width: 2.1rem; height: 2.1rem; flex: none; display: block; border-radius: 50%; overflow: visible; }
.av svg,.av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.av::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: .6rem; height: .6rem; border-radius: 50%; background: var(--teal-500); border: 2px solid #fff; }
.av.lg { width: 2.9rem; height: 2.9rem; }
.av.lg svg,.av.lg img { border-radius: 50%; }
.nm { display: flex; flex-direction: column; min-width: 0; max-width: 12rem; line-height: 1.25; }
.nm b { font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nm small { font-size: var(--fs-xs); color: var(--muted); }
.profile-avatar { display: block; width: 100%; height: 100%; object-fit: cover; }
.menu {
  position: absolute; right: 0; top: calc(100% + .6rem); z-index: 60; width: 17.5rem; max-width: calc(100vw - 1.5rem);
  padding: var(--sp-2); border-radius: var(--r-lg); background: rgba(255,255,255,.96);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: 0 0 0 1px var(--line), var(--sh-lg);
  visibility: hidden; opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top right;
  transition: opacity .18s var(--ease), transform .18s var(--ease), visibility 0s .18s;
}
.menu.on { visibility: visible; opacity: 1; transform: none; transition: opacity .18s var(--ease), transform .22s var(--ease); }
.menu .who { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3); margin-bottom: var(--sp-1); border-radius: var(--r-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.menu .who > div { min-width: 0; }
.menu .who b { display: block; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu .who small { font-size: var(--fs-xs); color: var(--muted); }
.menu a,.menu button.out { display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: 2.6rem; padding: 0 var(--sp-3); border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-2); font-size: var(--fs-sm); font-weight: 500; text-align: left; }
.menu a .i,.menu button.out .i { width: 1.1rem; height: 1.1rem; color: var(--muted); }
.menu a:hover { background: var(--surface-2); color: var(--blue); }
.menu a:hover .i { color: var(--blue); }
.menu button.out { color: var(--rose); }
.menu button.out .i { color: var(--rose); }
.menu button.out:hover:not(:disabled) { background: var(--rose-soft); }
.menu button.out:disabled { opacity: .6; cursor: wait; }
.menu hr { border: 0; height: 1px; margin: var(--sp-1) var(--sp-2); background: var(--line); }

/* ── Cabecera de página y secciones ─────────────────────────────── */
.top { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-3) var(--sp-5); margin: var(--sp-6) 0 var(--sp-5); }
.top > div:first-child { min-width: min(100%, 20rem); flex: 1 1 24rem; }
.top h1 { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.028em; }
.top p { margin-top: .4rem; max-width: 64ch; color: var(--muted); font-size: var(--fs-md); }
.top-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.eyebrow,.documentation-kicker { display: inline-flex; align-items: center; gap: .5rem; margin-bottom: .5rem; font-size: .65rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--teal); }
.eyebrow::before { content: ""; width: 1.1rem; height: 2px; border-radius: 2px; background: currentColor; }
.sec { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-3) var(--sp-5); margin: var(--sp-7) 0 var(--sp-4); }
.sec > div:first-child { min-width: min(100%, 16rem); }
.sec h2 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.022em; }
.sec p { margin-top: .3rem; color: var(--muted); font-size: var(--fs-sm); }
.legend { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .45rem; }
.legend i { width: .7rem; height: .7rem; border-radius: .2rem; }
.legend .l-blue { background: var(--blue); }
.legend .l-green { background: var(--teal-500); }
.legend .l-free { background: #D8E0EC; }
.link { display: inline-flex; align-items: center; gap: .35rem; color: var(--blue); font-weight: 600; font-size: var(--fs-sm); }
.link .i { width: 1rem; height: 1rem; transition: transform .2s var(--ease); }
.link:hover .i { transform: translateX(3px); }

/* ── Tarjetas ───────────────────────────────────────────────────── */
.card {
  position: relative; min-width: 0; padding: var(--sp-4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-sm); transition: box-shadow .2s var(--ease), border-color .2s;
}
.card::after { content: none; }
.card:hover { transform: none; border-color: #D5DCE6; box-shadow: var(--sh-md); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin-bottom: var(--sp-4); }
.card.flush > .card-head { margin: 0; padding: var(--sp-4) var(--sp-4) var(--sp-3); }
.card-head > div { min-width: 0; }
.card-title { display: flex; align-items: center; gap: var(--sp-3); font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.018em; color: var(--ink); }
.card-sub { margin-top: .2rem; color: var(--muted); font-size: var(--fs-sm); }
.card-ic { display: grid; place-items: center; flex: none; width: 2.4rem; height: 2.4rem; border-radius: var(--r-md); background: var(--blue-soft); color: var(--blue); box-shadow: inset 0 0 0 1px rgba(30,90,150,.08); }
.card-ic .i { width: 1.25rem; height: 1.25rem; }
.card-ic.green { background: var(--teal-soft); color: var(--teal); }
.card-ic.amber { background: var(--amber-soft); color: var(--amber); }
.card-ic.violet { background: var(--violet-soft); color: var(--violet); }
.card-ic.rose { background: var(--rose-soft); color: var(--rose); }
.card-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line-2); background: var(--surface-2); font-size: var(--fs-sm); color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: var(--sp-4); }
.grid-main { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(0,1fr); gap: var(--sp-4); align-items: stretch; }
.callout { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); border: 1px solid; font-size: var(--fs-sm); line-height: 1.5; }
.callout .i { margin-top: .1rem; }
.callout.warn { background: var(--amber-soft); border-color: #F3DDA8; color: #7A4E0B; }
.callout.info { background: var(--blue-soft); border-color: #CFE0F3; color: var(--navy-800); }
.callout.danger { background: var(--rose-soft); border-color: #F4CBC5; color: #8E2D25; }
.callout b { color: inherit; }

/* ── Bienvenida del inicio ──────────────────────────────────────── */
.welcome {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: var(--sp-5);
  margin: var(--sp-6) 0 var(--sp-5); padding: var(--sp-6) var(--sp-6);
  border-radius: var(--r-xl); color: var(--lav-ink);
  background: linear-gradient(115deg, #FFFFFF 0%, var(--lav-50) 45%, #ECEFF8 100%);
  border: 1px solid var(--lav-200);
  box-shadow: var(--sh-sm);
}
.welcome::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(34rem 16rem at 95% -20%, rgba(141,189,235,.28), transparent 65%), radial-gradient(24rem 12rem at 70% 130%, rgba(111,214,203,.18), transparent 65%); }
.welcome::after { content: ""; position: absolute; right: -6rem; top: 50%; z-index: -1; width: 24rem; height: 24rem; transform: translateY(-50%); border-radius: 50%;
  background: repeating-radial-gradient(circle, rgba(27,32,51,.06) 0 1px, transparent 1px 26px); -webkit-mask-image: radial-gradient(circle, #000 30%, transparent 70%); mask-image: radial-gradient(circle, #000 30%, transparent 70%); }
.welcome h1 { color: var(--lav-ink); font-size: clamp(1.7rem, 2.4vw, 2.2rem); font-weight: 700; letter-spacing: -.03em; }
.welcome p { margin-top: .5rem; max-width: 56ch; color: var(--lav-muted); font-size: var(--fs-md); }
.welcome .eyebrow { color: var(--teal); }
.welcome-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
.welcome-chip { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.1rem; padding: 0 .85rem; border-radius: 99px; background: #fff; box-shadow: inset 0 0 0 1px var(--lav-200); font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); }
.welcome-chip .i { width: 1rem; height: 1rem; color: var(--teal); }
.welcome-chip.on::before,.welcome-chip.off::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; }
.welcome-chip.on { color: var(--teal); font-weight: 600; }
.welcome-chip.on::before { background: var(--teal-500); box-shadow: 0 0 0 3px rgba(20,163,152,.18); }
.welcome-chip.off { color: var(--rose); font-weight: 600; }
.welcome-chip.off::before { background: var(--rose-500); }
.welcome-chip code { background: var(--lav-100); color: var(--lav-ink); }
.welcome-actions { display: flex; flex-direction: column; gap: var(--sp-2); }

/* ── Indicadores (KPI) ──────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: var(--sp-4); }
.kpi { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: .35rem; min-width: 0; min-height: 8.25rem; padding: var(--sp-4); }
.kpi::before { content: none; }
.kpi > * { position: relative; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.kpi-ic { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none; border-radius: var(--r-md); background: var(--tone-soft, var(--blue-soft)); color: var(--tone, var(--blue)); }
.kpi-ic .i { width: 1.2rem; height: 1.2rem; }
.kpi small { color: var(--muted); font-size: var(--fs-sm); font-weight: 500; line-height: 1.35; }
.kpi .v { margin-top: auto; font: 700 var(--fs-kpi)/1.05 var(--font-display); letter-spacing: -.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi .v sup,.kpi .v .u { font-size: .5em; font-weight: 600; color: var(--muted); margin-left: .15em; letter-spacing: 0; vertical-align: baseline; }
.kpi .d { color: var(--muted); font-size: var(--fs-sm); line-height: 1.4; }
.kpi .d b { color: var(--ink-2); font-weight: 600; }
.d { font-size: var(--fs-sm); color: var(--muted); }
.up { color: var(--green); font-weight: 600; }
.kpi[data-tone="green"] { --tone: var(--teal); --tone-soft: var(--teal-soft); }
.kpi[data-tone="amber"] { --tone: var(--amber); --tone-soft: var(--amber-soft); }
.kpi[data-tone="rose"] { --tone: var(--rose); --tone-soft: var(--rose-soft); }
.kpi[data-tone="violet"] { --tone: var(--violet); --tone-soft: var(--violet-soft); }
.kpi.hero { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: var(--sp-3); }
.kpi.hero > div { display: flex; flex-direction: column; gap: .35rem; min-width: 0; height: 100%; }
.rg-wrap { position: relative; width: 5.75rem; height: 5.75rem; flex: none; }
.rg { width: 100%; height: 100%; }
.rg circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.rg .t { stroke: #EAF0F6; }
.rg .p { stroke: url(#g); stroke-dasharray: 264; transform: rotate(-90deg); transform-origin: 50% 50%; animation: draw 1.6s var(--ease) both; transition: stroke-dashoffset 1s var(--ease); }
.rg-label { position: absolute; inset: 0; display: grid; place-items: center; font: 700 1.05rem/1 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }
@keyframes draw { from { stroke-dashoffset: 264; } }

/* Barra de progreso */
.progress { position: relative; height: .6rem; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.progress > i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--teal-500)); transform-origin: left; animation: grow 1.2s var(--ease) both; }
.progress > i::after { content: none; }
.progress.lg { height: .85rem; }
.progress.warn > i { background: linear-gradient(90deg, var(--amber), var(--amber-500)); }
.progress.over > i { background: linear-gradient(90deg, var(--rose), var(--rose-500)); }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes shine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.meter-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.meter-head b { font: 700 1.75rem/1 var(--font-display); letter-spacing: -.03em; color: var(--ink); }
.meter-head span { color: var(--muted); font-size: var(--fs-sm); }
.meter-stats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: var(--sp-2); margin-top: var(--sp-4); }
.meter-stats div { padding: var(--sp-3); border-radius: var(--r-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.meter-stats small { display: block; font-size: var(--fs-xs); color: var(--muted); }
.meter-stats b { font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }

/* Gráfico de barras local */
.chart { --h: 13rem; display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0,1fr)); align-items: end; gap: clamp(.5rem, 2vw, 1.5rem); height: calc(var(--h) + 3rem); padding-top: 1.75rem; position: relative;
  background: linear-gradient(var(--line-2) 1px, transparent 1px) 0 1.75rem / 100% calc(var(--h) / 4); }
.chart-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: .45rem; height: 100%; min-width: 0; }
.chart-stack { position: relative; display: flex; flex-direction: column-reverse; width: min(3.25rem, 72%); height: var(--h); border-radius: .6rem .6rem .3rem .3rem; }
.chart-stack i,.chart-stack b { display: block; width: 100%; transform-origin: bottom; animation: rise 1s var(--ease) both; animation-delay: calc(var(--k, 0) * 70ms + 120ms); }
.chart-stack i { background: var(--grad-blue); border-radius: 0 0 .25rem .25rem; }
.chart-stack b { background: var(--grad-green); border-radius: .4rem .4rem 0 0; margin-bottom: 2px; }
.chart-stack .total { position: absolute; left: 50%; transform: translate(-50%, -.4rem); font-size: var(--fs-sm); font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-col small { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); text-transform: capitalize; }
.chart-col.is-current small { color: var(--blue); }
@keyframes rise { from { transform: scaleY(0); } }
.chart-empty { display: grid; place-items: center; min-height: 12rem; color: var(--muted); font-size: var(--fs-sm); }
/* Compatibilidad con el gráfico anterior */
.local-chart { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); align-items: end; gap: var(--sp-3); height: 12rem; }

/* ── Botones ────────────────────────────────────────────────────── */
.btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--control-h); padding: 0 1.15rem; border: 0; border-radius: var(--r-md);
  background: var(--blue); color: #fff; font-size: var(--fs-sm); font-weight: 600; letter-spacing: .005em; line-height: 1.2; text-align: center; white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, 0 1px 2px rgba(14,27,46,.18), 0 4px 10px -4px rgba(30,90,150,.45);
  transition: background .18s, box-shadow .18s, color .18s, transform .18s var(--ease);
}
.btn::after { content: none; }
.btn:hover:not(:disabled) { background: var(--blue-600); box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, 0 1px 2px rgba(14,27,46,.18), 0 6px 14px -6px rgba(30,90,150,.55); }
.btn:active:not(:disabled) { transform: scale(.985); }
.btn:disabled { opacity: .45; transform: none; box-shadow: none; }
.btn .i { width: 1.05rem; height: 1.05rem; }
.btn.ghost { background: var(--surface); color: var(--ink-2); box-shadow: inset 0 0 0 1px #D9E0E9, var(--sh-xs); }
.btn.ghost::after { display: none; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--blue); box-shadow: inset 0 0 0 1px #C3D3E6, var(--sh-xs); }
.btn.ghost.is-active { background: var(--navy-800); color: #fff; box-shadow: none; }
.btn.danger { background: var(--rose); box-shadow: 0 1px 2px rgba(14,27,46,.18), 0 4px 10px -4px rgba(191,63,53,.5); }
.btn.danger:hover:not(:disabled) { background: #A8352C; }
.btn.ghost.danger,.btn.ghost.danger-ghost,.danger-ghost { background: var(--surface); color: var(--rose) !important; box-shadow: inset 0 0 0 1px #EFC9C3, var(--sh-xs); }
.btn.ghost.danger:hover:not(:disabled),.btn.ghost.danger-ghost:hover:not(:disabled) { background: var(--rose-soft); box-shadow: inset 0 0 0 1px var(--rose-500); }
.btn.success { background: var(--teal); }
.btn.success:hover:not(:disabled) { background: #0A6B65; }
.btn.light { background: #fff; color: var(--navy-900); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.btn.light:hover:not(:disabled) { background: #EEF4FA; }
.btn.glass { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.22); }
.btn.glass::after { display: none; }
.btn.glass:hover:not(:disabled) { background: rgba(255,255,255,.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.btn.sm,.btn.compact { min-height: 2.25rem; padding: 0 .8rem; font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn.block { width: 100%; }
.btn[aria-busy="true"] { pointer-events: none; }
.btn[aria-busy="true"]::before { content: ""; width: .9rem; height: .9rem; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.acts2 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }

/* Segmentos / filtros */
.chips { display: inline-flex; flex-wrap: wrap; gap: .3rem; padding: .3rem; border-radius: var(--r-md); background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--sh-xs); }
.chips a,.chips button { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.15rem; padding: 0 .85rem; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; transition: background .2s, color .2s; }
.chips a:hover,.chips button:hover { color: var(--ink); background: var(--surface-2); }
.chips a[aria-current],.chips a.is-active,.chips button.is-active { background: var(--blue); color: #fff; box-shadow: 0 1px 2px rgba(14,27,46,.2); }
.chips a.is-active.green { background: var(--teal); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.toolbar .count { color: var(--muted); font-size: var(--fs-sm); }
.toolbar .count b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ── Insignias ──────────────────────────────────────────────────── */
.badge,.tag { display: inline-flex; align-items: center; gap: .4rem; padding: .16rem .6rem; border-radius: 99px; font-size: .71rem; font-weight: 600; line-height: 1.5; letter-spacing: .005em; white-space: nowrap; background: var(--line-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px rgba(14,27,46,.05); }
.badge::before,.tag::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.success,.tag.ok { background: var(--green-soft); color: var(--green); }
.badge.error,.tag.warn { background: var(--rose-soft); color: var(--rose); }
.badge.pending,.tag.lock { background: var(--amber-soft); color: var(--amber); }
.badge.info { background: var(--blue-soft); color: var(--blue); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.plain::before,.tag.plain::before { display: none; }

/* ── Tablas ─────────────────────────────────────────────────────── */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table,.table,.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
thead th,.data-table th { position: sticky; top: 0; z-index: 1; padding: .7rem var(--sp-4); background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--muted); font-size: .65rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; text-align: left; white-space: nowrap; }
tbody td,.data-table td { padding: .85rem var(--sp-4); border-bottom: 1px solid var(--line-2); color: var(--ink-2); vertical-align: middle; text-align: left; }
tbody tr { transition: background .15s; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #F7F9FC; }
.data-table tbody tr:nth-child(even) { background: transparent; }
td.strong,td .strong { color: var(--ink); font-weight: 600; }
td.muted { color: var(--muted); }
td.actions { white-space: nowrap; text-align: right; }
td.actions .acts2 { justify-content: flex-end; flex-wrap: nowrap; }
td.empty-row { padding: var(--sp-6) var(--sp-4); text-align: center; color: var(--muted); }
.person { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.person .ini { display: grid; place-items: center; flex: none; width: 2rem; height: 2rem; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-family: var(--font-display); font-size: var(--fs-xs); font-weight: 700; box-shadow: inset 0 0 0 1px rgba(30,90,150,.1); }
.person b { display: block; color: var(--ink); font-weight: 600; white-space: nowrap; }
.person small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.mono { font-family: var(--mono); font-size: .92em; }

/* ── Formularios ────────────────────────────────────────────────── */
.page-body input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not(.otp-input),
.page-body select,.page-body textarea,.form-input {
  width: 100%; min-width: 0; min-height: var(--control-h); padding: .6rem .85rem;
  border: 1px solid #D6DDE6; border-radius: var(--r-md); background: #fff; color: var(--ink); font-size: var(--fs-sm);
  box-shadow: inset 0 1px 1px rgba(14,27,46,.03); transition: border-color .18s, box-shadow .18s, background .18s;
}
.page-body input::placeholder,.page-body textarea::placeholder { color: var(--subtle); }
.page-body input:not([type="checkbox"]):not([type="radio"]):hover,.page-body select:hover,.page-body textarea:hover { border-color: #B9C8DB; }
.page-body input:not([type="checkbox"]):not([type="radio"]):focus,.page-body select:focus,.page-body textarea:focus,.form-input:focus { outline: 0; border-color: var(--blue-500); box-shadow: var(--focus); }
.page-body input[aria-invalid="true"] { border-color: var(--rose-500); }
.page-body select { appearance: none; -webkit-appearance: none; padding-right: 2.4rem; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2362718A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right .8rem center / 1rem; }
.page-body textarea { min-height: 6.5rem; resize: vertical; line-height: 1.5; }
.page-body textarea.mono { font-family: var(--mono); font-size: var(--fs-xs); }
.page-body input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.page-body input[type="number"]::-webkit-inner-spin-button,.page-body input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.page-body input[type="checkbox"],.page-body input[type="radio"] { width: 1.15rem; height: 1.15rem; accent-color: var(--blue); }
.page-body input[type="date"] { min-width: 9.5rem; }
.field,.form-group { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.field > span:first-child,.field-label,.form-group > label,.page-body form > label > span:first-child {
  color: var(--ink-2); font-size: var(--fs-xs); font-weight: 650; letter-spacing: .02em;
}
.field .hint,.field-hint { color: var(--muted); font-size: var(--fs-xs); font-weight: 400; line-height: 1.45; }
.field-grid,.settings-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: var(--sp-4); }
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-3); }
.form-row > .field { flex: 1 1 14rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); align-items: end; gap: var(--sp-3); }
.page-body form > label:not(.field-label):not(.switch) { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
#change-password-form,#create-admin-form { display: grid !important; grid-template-columns: minmax(0,1fr); gap: var(--sp-3); }
#change-password-form .btn,#create-admin-form .btn { justify-self: start; margin-top: var(--sp-1); }
.input-group { display: flex; gap: var(--sp-2); min-width: 0; }
.input-group > input { flex: 1; }
.input-group > .icon-btn { width: var(--control-h); }
.status-line { min-height: 1.4em; margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--muted); }
.status-line.is-error,.profile-status.is-error { color: var(--rose); }
.status-line.is-success,.profile-status.is-success { color: var(--green); }

/* Interruptor */
.switch { position: relative; display: inline-flex; flex: none; width: 2.9rem; height: 1.65rem; cursor: pointer; }
.switch input { position: absolute; inset: 0; width: 100% !important; height: 100% !important; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 99px; background: #D3DCE8; box-shadow: inset 0 1px 2px rgba(15,31,58,.12); transition: background .25s var(--ease); }
.switch .track::after { content: ""; position: absolute; left: .2rem; top: .2rem; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(15,31,58,.25); transition: transform .3s var(--ease-spring); }
.switch input:checked + .track { background: var(--teal); }
.switch input:checked + .track::after { transform: translateX(1.25rem); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.toggle-row b { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.toggle-row small { display: block; margin-top: .1rem; font-size: var(--fs-xs); color: var(--muted); }
.toggle-list { display: grid; gap: var(--sp-2); }

/* ── Estado vacío y paginación ──────────────────────────────────── */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; padding: var(--sp-7) var(--sp-4); text-align: center; color: var(--muted); }
.empty-ic { display: grid; place-items: center; width: 3.25rem; height: 3.25rem; margin-bottom: var(--sp-2); border-radius: 50%; background: var(--blue-soft); color: var(--blue); box-shadow: 0 0 0 6px rgba(234,242,251,.6); }
.empty-ic .i { width: 1.5rem; height: 1.5rem; }
.empty b { color: var(--ink); font-family: var(--font-display); font-size: var(--fs-md); font-weight: 700; }
.empty span { font-size: var(--fs-sm); max-width: 42ch; }
.pager,.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line-2); font-size: var(--fs-sm); color: var(--muted); }
.pager b { color: var(--ink); }
.pager .acts2 { margin-left: auto; }

/* ── Barra de guardado (fija al pie mientras hay contenido) ─────── */
.save {
  position: relative; bottom: max(var(--sp-4), env(safe-area-inset-bottom)); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-3);
  margin-top: var(--sp-5); padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg); background: rgba(255,255,255,.88);
  -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
  box-shadow: 0 0 0 1px var(--line), var(--sh-lg);
}
.save:has(span.dirty),.save:has(span.error) { position: sticky; }
.save span { display: flex; align-items: center; gap: .55rem; font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }
.save span::before { content: ""; width: .55rem; height: .55rem; flex: none; border-radius: 50%; background: var(--teal-500); box-shadow: 0 0 0 3px rgba(20,163,152,.16); }
.save span.dirty { color: var(--amber); }
.save span.dirty::before { background: var(--amber-500); box-shadow: 0 0 0 3px rgba(225,154,43,.22); animation: pulse 1.6s ease-in-out infinite; }
.save span.error { color: var(--rose); line-height: 1.4; }
.save span.error::before { background: var(--rose-500); }

/* ── Control de cupos: tarjetas mensuales ───────────────────────── */
.months { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,15rem),1fr)); gap: var(--sp-4); align-items: stretch; }
.m { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; padding: var(--sp-4); animation: page-in .5s var(--ease) both; animation-delay: calc(var(--k, 0) * 60ms); }
.m { overflow: hidden; padding-top: 0; }
.m.now { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(47,116,188,.12), var(--sh-md); }
/* Banda de color del mes, como el mockup: mes actual en azul, los demás en verde azulado */
.m-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); margin: 0 calc(-1 * var(--sp-4)); padding: .8rem var(--sp-4); background: linear-gradient(135deg, var(--teal), #13938A); color: #fff; }
.m.now .m-band { background: linear-gradient(135deg, var(--blue), #2B6CB0); }
.m h3 { color: #fff; font-size: var(--fs-md); font-weight: 700; letter-spacing: .01em; line-height: 1.25; }
.m-band em { flex: none; padding: .12rem .55rem; border-radius: 99px; background: rgba(255,255,255,.2); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); color: #fff; font: 600 var(--fs-xs)/1.5 var(--font); font-style: normal; }
.m .row span { display: flex; align-items: flex-start; gap: .5rem; }
.m .row span .i { width: 1rem; height: 1rem; margin-top: .15rem; color: var(--blue); opacity: .75; }
.m-figure { display: flex; align-items: baseline; gap: .35rem; }
.m-figure b { font: 700 2rem/1 var(--font-display); letter-spacing: -.03em; color: var(--ink); }
.m-figure span { color: var(--muted); font-size: var(--fs-sm); }
.bar { display: flex; height: .55rem; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; transform-origin: left; animation: grow 1.1s var(--ease) both; animation-delay: calc(var(--k, 0) * 80ms + 200ms); }
.bar .f { background: var(--blue); }
.bar .f.w { background: linear-gradient(90deg, var(--amber), var(--amber-500)); }
.bar .f.x { background: linear-gradient(90deg, var(--rose), var(--rose-500)); }
.bar .o { background: var(--grad-green); }
.row,.m .row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: .5rem .75rem; padding: .3rem 0; font-size: var(--fs-sm); color: var(--muted); line-height: 1.45; white-space: normal; }
.m .row + .row { border-top: 1px dashed var(--line); }
.m .row span { min-width: 0; overflow-wrap: anywhere; }
.row b,.m .row b { color: var(--ink); font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
.m .row b.na { color: var(--amber); font-weight: 600; font-size: var(--fs-xs); }
.use { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--muted); }
.use b { padding: .12rem .6rem; border-radius: 99px; background: var(--teal-soft); color: var(--teal); font-weight: 700; font-variant-numeric: tabular-nums; transition: background .2s, color .2s; }
.use b.w { background: var(--amber-soft); color: var(--amber); }
.use b.x { background: var(--rose-soft); color: var(--rose); }
.quota { margin-top: auto; padding-top: var(--sp-3); border-top: 1px solid var(--line-2); }
.quota label { display: block; margin-bottom: .45rem; font-size: var(--fs-xs); font-weight: 650; color: var(--ink-2); line-height: 1.4; }
.step { display: flex; align-items: center; gap: .3rem; padding: .3rem; border-radius: var(--r-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s; }
.step:focus-within { box-shadow: inset 0 0 0 1px var(--blue-500), var(--focus); }
.step button { display: grid; place-items: center; flex: none; width: 2.25rem; height: 2.25rem; min-height: 0; padding: 0; border: 0; border-radius: var(--r-sm); background: #fff; color: var(--blue); font-size: 1.15rem; font-weight: 600; line-height: 1; box-shadow: var(--sh-xs), 0 0 0 1px var(--line); transition: background .2s, color .2s, transform .15s; }
.step button:hover { background: var(--blue); color: #fff; }
.step button:active { transform: scale(.92); }
.page-body .step input,.step input { flex: 1; width: 100%; min-width: 0; height: 2.25rem; min-height: 0; padding: 0; border: 0; border-radius: 0; outline: 0; background: transparent; box-shadow: none; text-align: center; font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.page-body .step input:focus { box-shadow: none; }
.m.is-dirty { border-color: var(--amber-500); box-shadow: 0 0 0 1px var(--amber-500), var(--sh-md); }

@media (min-width: 1100px) { .months { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (min-width: 1800px) { .months { grid-template-columns: repeat(6,minmax(0,1fr)); } }

/* ── Elegibilidad: tarjetas de carga ────────────────────────────── */
.files { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: var(--sp-4); }
.files .file-main { grid-column: 1 / -1; }
.quota-type + .quota-type { margin-top: var(--sp-5); }
.file { display: flex; flex-direction: column; gap: var(--sp-4); }
.file h3 { font-size: var(--fs-lg); font-weight: 700; }
.file .hd { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.file .hd > div { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.file .note,.file p.muted { font-size: var(--fs-xs); line-height: 1.5; color: var(--muted); }
.drop {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4);
  border: 1.5px dashed #A9C3E0; border-radius: var(--r-md);
  background: var(--surface-2); cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s var(--ease);
}
.drop:hover,.drop:focus-visible,.drop.is-over { border-color: var(--blue-500); background: var(--blue-soft); }
.drop.is-over { transform: scale(1.01); border-style: solid; }
.drop .drop-ic { display: grid; place-items: center; flex: none; width: 2.75rem; height: 2.75rem; border-radius: .8rem; background: #fff; color: var(--blue); box-shadow: var(--sh-sm); }
.drop .drop-ic svg { width: 1.35rem; height: 1.35rem; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.drop b { display: block; font-size: var(--fs-sm); color: var(--ink); }
.drop span { display: block; font-size: var(--fs-xs); color: var(--muted); line-height: 1.45; }
.upload-progress .progress { margin-top: var(--sp-1); }
.upload-progress p { margin-top: .4rem; text-align: center; font-size: var(--fs-xs); color: var(--muted); }
.hist { display: flex; flex-direction: column; font-size: var(--fs-sm); }
.hist div { display: flex; justify-content: space-between; gap: var(--sp-3); padding: .6rem 0; border-top: 1px solid var(--line-2); color: var(--muted); }
.hist b { color: var(--ink); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.steps { display: grid; gap: var(--sp-3); margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { display: grid; grid-template-columns: auto minmax(0,1fr); gap: var(--sp-3); align-items: start; font-size: var(--fs-sm); line-height: 1.5; color: var(--ink-2); counter-increment: step; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 1.55rem; height: 1.55rem; border-radius: 50%; background: var(--blue-soft); color: var(--blue); box-shadow: inset 0 0 0 1px rgba(30,90,150,.15); font-family: var(--font-display); font-size: var(--fs-xs); font-weight: 700; }
.alert-card .box { padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--rose-soft); color: var(--rose); font-size: var(--fs-sm); font-weight: 500; }

/* ── Ajustes ────────────────────────────────────────────────────── */
.settings-nav { position: sticky; top: calc(var(--header-h) + .75rem); z-index: 10; display: flex; gap: .3rem; overflow-x: auto; margin-bottom: var(--sp-5); padding: .3rem; border-radius: var(--r-md); background: rgba(255,255,255,.9); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 0 0 1px var(--line), var(--sh-sm); scrollbar-width: none; }
.settings-nav::-webkit-scrollbar { display: none; }
.derivation-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: var(--sp-2) var(--sp-5); }
.derivation-list li { display: flex; justify-content: space-between; gap: var(--sp-3); padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; min-width: 0; }
.derivation-list li b { font-size: 1rem; color: var(--lav-ink); }
.upload-mode { margin: var(--sp-3) 0 0; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-md); display: grid; gap: .35rem; min-width: 0; }
.upload-mode legend { padding: 0 .3rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.upload-mode label { display: flex; align-items: center; gap: .5rem; font-size: .9rem; cursor: pointer; }
.hosvital-lookup { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--line); display: grid; gap: var(--sp-3); }
.hosvital-lookup-result { margin: 0; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--lav-50); box-shadow: inset 0 0 0 1px var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font-size: .85rem; line-height: 1.55; }
.settings-nav a { display: inline-flex; align-items: center; min-height: 2.15rem; padding: 0 .85rem; border-radius: var(--r-sm); color: var(--muted); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; transition: background .2s, color .2s; }
.settings-nav a:hover { background: var(--surface-2); color: var(--blue); }
.settings-grid { display: flex; flex-direction: column; gap: var(--sp-4); }
.settings-section { scroll-margin-top: calc(var(--header-h) + 4.5rem); }
.settings-section .card-head { padding-bottom: var(--sp-4); border-bottom: 1px solid var(--line-2); }
.settings-section .card-head .acts2 { flex-direction: column; align-items: flex-end; gap: .35rem; }
.settings-section .card-head .acts2 small { color: var(--muted); font-size: var(--fs-xs); }
.webhook-box { margin-top: var(--sp-4); padding: var(--sp-4); border-radius: var(--r-md); background: var(--blue-soft); box-shadow: inset 0 0 0 1px #D2E2F3; }
.webhook-box > b { display: block; margin-bottom: var(--sp-2); font-size: var(--fs-xs); font-weight: 700; color: var(--blue); letter-spacing: .02em; }
.webhook-url-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: var(--sp-2); align-items: center; }
.webhook-url-row code { display: block; padding: .65rem .85rem; border-radius: var(--r-sm); background: rgba(255,255,255,.85); color: var(--ink); font-size: var(--fs-xs); word-break: break-all; box-shadow: inset 0 0 0 1px #D2E2F3; }
.webhook-box p { margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--muted); }

/* ── Entidad bloqueada por fase ─────────────────────────────────── */
.file.is-inactive { background: linear-gradient(180deg, #FBFBFD, var(--lav-50)); }
.file.is-inactive .drop { border-color: var(--lav-300); background: #fff; }
.phase-lock { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3); border-radius: var(--r-md); background: var(--lav-100); box-shadow: inset 0 0 0 1px var(--lav-200); color: var(--lav-ink); font-size: var(--fs-xs); line-height: 1.5; }
.phase-lock .i { width: 1.1rem; height: 1.1rem; margin-top: .1rem; color: var(--lav-muted); }
.phase-lock b { display: block; font-size: var(--fs-sm); letter-spacing: .02em; }
.phase-lock span { color: var(--lav-muted); }
.phase-lock a { color: var(--blue); font-weight: 600; }

/* ── Embudo de conversión ──────────────────────────────────────── */
.funnel { display: grid; gap: var(--sp-3); }
.funnel-row { display: grid; gap: .35rem; animation: page-in .45s var(--ease) both; animation-delay: calc(var(--k, 0) * 60ms); }
.funnel-head { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-sm); color: var(--ink-2); }
.funnel-head b { color: var(--ink); font-weight: 700; }
.funnel-bar { height: .8rem; border-radius: 99px; background: var(--lav-100); overflow: hidden; }
.funnel-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--teal-500)); transform-origin: left; animation: grow 1s var(--ease) both; }
.funnel-row small { font-size: var(--fs-xs); }
.funnel-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: var(--sp-2); margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--line-2); }
.funnel-chip { padding: var(--sp-3); border-radius: var(--r-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.funnel-chip small { display: block; font-size: var(--fs-xs); color: var(--muted); }
.funnel-chip b { font: 700 1.35rem/1.2 var(--font-display); color: var(--ink); }
.funnel-chip.green b { color: var(--teal); }
.funnel-chip.rose b { color: var(--rose); }
.funnel-chip.amber b { color: var(--amber); }

/* ── Prueba de plantillas y lista piloto ──────────────────────── */
.template-test { margin-top: var(--sp-4); padding: var(--sp-4); border-radius: var(--r-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.template-test-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.template-test-head b { display: block; font-size: var(--fs-sm); }
.template-test-head small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.template-test-head .input-group { flex: 1 1 22rem; max-width: 34rem; }
.template-test .code-block { margin-top: var(--sp-3); }
.pilot-form { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; align-items: end; gap: var(--sp-3); }
.pilot-list { display: grid; gap: var(--sp-2); margin: var(--sp-3) 0 0; padding: 0; list-style: none; }
.pilot-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.pilot-list li.muted { justify-content: center; font-size: var(--fs-sm); }
.pilot-list b { display: block; font-size: var(--fs-sm); color: var(--ink); }
.pilot-list small { display: block; color: var(--muted); font-size: var(--fs-xs); }

/* ── Toast ──────────────────────────────────────────────────────── */
.toast {
  position: fixed; top: calc(var(--header-h) + .5rem); right: var(--sp-4); z-index: 120;
  display: flex; align-items: center; gap: var(--sp-3); max-width: min(26rem, calc(100vw - 2rem));
  padding: .8rem .75rem .8rem 1rem; border-radius: var(--r-md);
  background: var(--navy-900); color: #fff; font-size: var(--fs-sm); font-weight: 500; line-height: 1.45;
  box-shadow: var(--sh-lg); border-left: 4px solid var(--blue-300);
  opacity: 0; pointer-events: none; transform: translateY(-.75rem) scale(.98);
  transition: opacity .25s var(--ease), transform .3s var(--ease-spring);
}
.toast.on { opacity: 1; pointer-events: auto; transform: none; }
.toast[data-tone="success"] { border-left-color: var(--teal-300); }
.toast[data-tone="error"] { border-left-color: #FF8B7F; }
.toast-close { display: grid; place-items: center; flex: none; width: 1.75rem; height: 1.75rem; min-height: 0; margin-left: auto; padding: 0; border: 0; border-radius: var(--r-sm); background: rgba(255,255,255,.08); color: rgba(255,255,255,.75); font-size: 1.1rem; line-height: 1; }
.toast-close:hover { background: rgba(255,255,255,.16); color: #fff; }

/* ── Modal ──────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; z-index: 110; display: flex; align-items: center; justify-content: center; padding: var(--sp-4); background: rgba(6,18,42,.48); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .2s var(--ease); }
.modal-box { width: min(28rem, 100%); max-height: calc(100dvh - 2rem); overflow-y: auto; padding: var(--sp-6) var(--sp-5) var(--sp-5); border-radius: var(--r-xl); background: #fff; box-shadow: var(--sh-lg); animation: pop .28s var(--ease-spring); }
.modal-ic { display: grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: var(--sp-4); border-radius: .9rem; background: var(--rose-soft); color: var(--rose); }
.modal-ic.primary { background: var(--blue-soft); color: var(--blue); }
.modal-ic .i { width: 1.4rem; height: 1.4rem; }
.modal-title { margin-bottom: var(--sp-2); font: 700 var(--fs-xl)/1.25 var(--font-display); letter-spacing: -.02em; }
.modal-body { margin-bottom: var(--sp-5); color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; }
.modal-body input { margin-top: var(--sp-3); width: 100%; min-height: var(--control-h); padding: 0 .85rem; border: 1px solid #D5DEEA; border-radius: var(--r-md); font-size: var(--fs-md); letter-spacing: .1em; }
.modal-body input:focus { outline: 0; border-color: var(--blue-500); box-shadow: var(--focus); }
.modal-body input[aria-invalid="true"] { border-color: var(--rose-500); box-shadow: 0 0 0 4px rgba(224,90,78,.18); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.96); } }
@keyframes fade { from { opacity: 0; } }

/* ── Perfil ─────────────────────────────────────────────────────── */
.profile-layout { display: grid; grid-template-columns: minmax(16rem,.75fr) minmax(0,1.8fr); align-items: start; gap: var(--sp-4); margin-bottom: var(--sp-6); }
.profile-summary { position: sticky; top: calc(var(--header-h) + 1rem); display: flex; flex-direction: column; align-items: center; overflow: hidden; padding: 0 0 var(--sp-5) !important; text-align: center; }
.profile-cover { width: 100%; height: 6.5rem; margin-bottom: -3.5rem; background: linear-gradient(115deg, var(--navy-900), var(--navy-800) 60%, #11506A); position: relative; }
.profile-cover::after { content: ""; position: absolute; inset: 0; background: radial-gradient(18rem 8rem at 85% 0%, rgba(111,214,203,.28), transparent 70%); }
.profile-photo-wrap { position: relative; width: 7rem; height: 7rem; margin-bottom: var(--sp-4); }
.profile-photo,.profile-photo-placeholder { width: 100%; height: 100%; border-radius: 50%; border: 4px solid #fff; box-shadow: var(--sh-md); object-fit: cover; }
.profile-photo-placeholder { display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font: 700 2rem/1 var(--font-display); }
.profile-role { position: absolute; left: 50%; bottom: -.7rem; transform: translateX(-50%); padding: .2rem .7rem; border: 2px solid #fff; border-radius: 99px; background: var(--teal); color: #fff; font-size: .6875rem; font-weight: 700; white-space: nowrap; }
.profile-summary h2 { margin: var(--sp-2) var(--sp-4) .2rem; font-size: var(--fs-xl); overflow-wrap: anywhere; }
.profile-summary > p { margin: 0 var(--sp-4); color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.profile-summary .profile-summary-note { margin: var(--sp-4) var(--sp-4) 0; padding-top: var(--sp-4); border-top: 1px solid var(--line-2); font-size: var(--fs-xs); line-height: 1.55; }
.profile-sections { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.profile-card { padding: var(--sp-5) !important; }
.profile-card-heading { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.profile-card-heading h2 { font-size: var(--fs-lg); }
.profile-card-heading p { margin-top: .15rem; color: var(--muted); font-size: var(--fs-sm); }
.profile-form { display: grid; grid-template-columns: minmax(0,1fr); gap: .45rem; max-width: 34rem; }
.profile-form .field-label { margin-top: .5rem; }
.profile-form .btn { justify-self: start; margin-top: var(--sp-2); }
.profile-status { min-height: 1.4em; color: var(--muted); font-size: var(--fs-sm); }
.photo-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.photo-picker { display: inline-flex; align-items: center; gap: .6rem; min-height: var(--control-h); padding: 0 1rem; border: 1.5px dashed #A9C3E0; border-radius: var(--r-md); background: var(--surface-2); color: var(--blue); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; transition: background .2s, border-color .2s; }
.photo-picker:hover { border-color: var(--blue-500); background: var(--blue-soft); }
.photo-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.photo-form .profile-status { flex-basis: 100%; }
.security-state { display: inline-flex; align-items: center; gap: .55rem; margin-bottom: var(--sp-3); padding: .45rem .85rem; border-radius: 99px; background: var(--amber-soft); color: var(--amber); font-size: var(--fs-sm); font-weight: 600; }
.security-state span { width: .55rem; height: .55rem; border-radius: 50%; background: currentColor; }
.security-state.is-enabled { background: var(--green-soft); color: var(--green); }
.profile-security-note { margin-bottom: var(--sp-3); color: var(--muted); font-size: var(--fs-sm); line-height: 1.55; }
.profile-security-note a { color: var(--blue); font-weight: 600; }

/* ── Documentación ──────────────────────────────────────────────── */
.documentation-toc { position: sticky; top: calc(var(--header-h) + .75rem); z-index: 10; display: flex; gap: .3rem; overflow-x: auto; margin: 0 0 var(--sp-5); padding: .3rem; border-radius: var(--r-md); background: rgba(255,255,255,.9); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 0 0 1px var(--line), var(--sh-sm); scrollbar-width: none; }
.documentation-toc::-webkit-scrollbar { display: none; }
.documentation-toc a { display: inline-flex; align-items: center; flex: none; min-height: 2.15rem; padding: 0 .85rem; border-radius: var(--r-sm); color: var(--muted); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.documentation-toc a:hover { background: var(--surface-2); color: var(--blue); }
.documentation-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: var(--sp-4); margin-bottom: var(--sp-6); }
.documentation-wide { grid-column: 1/-1; }
.documentation-card { padding: var(--sp-5) !important; scroll-margin-top: calc(var(--header-h) + 4.5rem); }
.documentation-card h2 { margin: .1rem 0 .65rem; font-size: var(--fs-xl); line-height: 1.25; }
.documentation-card h3 { margin: var(--sp-3) 0 .5rem; font-size: var(--fs-md); font-weight: 650; color: var(--blue); letter-spacing: -.01em; }
.documentation-card p,.documentation-card li { color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.7; }
.documentation-card p { margin: .5rem 0 .75rem; }
.documentation-card ul,.documentation-card ol { display: grid; gap: .45rem; margin: .75rem 0; padding-inline-start: 1.35rem; }
.documentation-card li { padding-inline-start: .15rem; }
.documentation-card li::marker { color: var(--blue-500); font-weight: 700; }
.documentation-card a { color: var(--blue); font-weight: 600; text-decoration: underline; text-decoration-color: rgba(30,90,150,.3); text-underline-offset: 3px; }
.documentation-card a:hover { text-decoration-color: currentColor; }
.documentation-card code { overflow-wrap: anywhere; }
.documentation-kicker { margin-bottom: .2rem; }
.documentation-note { padding: var(--sp-3) var(--sp-4) !important; border-left: 3px solid var(--blue-500); border-radius: 0 var(--r-md) var(--r-md) 0; background: var(--blue-soft); color: var(--navy-800) !important; }
.documentation-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: var(--sp-2); }
.documentation-list p { margin: 0; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); line-height: 1.6; }
.documentation-list p b { color: var(--ink); }
.documentation-settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: var(--sp-3); margin-top: var(--sp-4); }
.documentation-settings-grid article { min-width: 0; padding: var(--sp-4); border-radius: var(--r-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.documentation-settings-grid ul { padding-inline-start: 1.15rem; margin: 0; }

/* Datos del titular (JSON) */
.code-block { max-height: 24rem; overflow: auto; margin: 0; padding: var(--sp-4); border-radius: var(--r-md); background: var(--navy-950); color: #CFE2F7; font-size: var(--fs-xs); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ══════════════════════════════════════════════════════════════════
   Acceso (login)
   ══════════════════════════════════════════════════════════════════ */
body:has(.login-page) { background: #fff; }
.login-page { display: grid; grid-template-columns: minmax(0,1.05fr) minmax(0,1fr); min-height: 100vh; min-height: 100dvh; }
.login-hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between; gap: var(--sp-6);
  min-height: 100vh; min-height: 100dvh; padding: clamp(2rem, 4.5vw, 4.5rem);
  color: var(--lav-ink); background: linear-gradient(160deg, #FFFFFF 0%, var(--lav-50) 40%, #ECECF5 75%, #E4E9F5 100%); border-right: 1px solid var(--lav-200);
}
.login-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .55;
  background-image: radial-gradient(rgba(27,32,51,.07) 1px, transparent 1px); background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse at 30% 20%, #000, transparent 70%); mask-image: radial-gradient(ellipse at 30% 20%, #000, transparent 70%); }
.login-hero::after { content: ""; position: absolute; right: -14rem; bottom: -14rem; z-index: -1; width: 40rem; height: 40rem; border-radius: 50%;
  background: repeating-radial-gradient(circle, rgba(27,32,51,.07) 0 1px, transparent 1px 34px); -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 70%); mask-image: radial-gradient(circle, #000 20%, transparent 70%); animation: iris 40s linear infinite; }
@keyframes iris { to { transform: rotate(360deg); } }
.login-hero-aurora { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.login-hero-aurora i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .45; animation: drift 24s ease-in-out infinite alternate; }
.login-hero-aurora i:nth-child(1) { width: 30rem; height: 30rem; top: -10rem; left: -8rem; background: radial-gradient(circle, #C9DBF1, transparent 70%); }
.login-hero-aurora i:nth-child(2) { width: 26rem; height: 26rem; bottom: -8rem; right: -4rem; background: radial-gradient(circle, #CBEDE8, transparent 70%); animation-delay: -6s; animation-duration: 28s; }
.login-hero-aurora i:nth-child(3) { width: 18rem; height: 18rem; top: 38%; right: 12%; background: radial-gradient(circle, #DCD8F0, transparent 70%); animation-delay: -10s; animation-duration: 28s; }
.login-brand-top { display: flex; align-items: center; gap: var(--sp-3); }
.login-brand-logo { display: grid; place-items: center; width: 3.5rem; height: 3.5rem; flex: none; border-radius: 1.1rem; background: #fff; box-shadow: 0 0 0 1px var(--lav-200), 0 10px 24px -14px rgba(27,32,51,.35); }
.login-brand-logo svg { width: 2.2rem; height: 2.2rem; }
.login-brand-text small { display: block; font-size: .7rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--teal); }
.login-brand-text h2 { margin-top: .15rem; font-size: 1.6rem; font-weight: 700; color: var(--lav-ink); letter-spacing: -.025em; }
.login-hero-content { max-width: 34rem; }
.login-hero-content .eyebrow { color: var(--teal); }
.login-hero-content h1 { margin-bottom: var(--sp-4); color: var(--lav-ink); font-size: clamp(2.3rem, 4.1vw, 3.6rem); font-weight: 700; line-height: 1.06; letter-spacing: -.04em; }
.login-hero-content h1 em { font-style: normal; font-weight: 300; color: var(--blue); }
.login-hero-content p { max-width: 40ch; color: var(--lav-muted); font-size: 1.0625rem; line-height: 1.6; }
.login-features { display: grid; gap: var(--sp-2); margin: var(--sp-5) 0 0; padding: 0; list-style: none; }
.login-features li { display: flex; align-items: center; gap: var(--sp-3); color: var(--ink-2); font-size: var(--fs-sm); }
.login-features li span { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; flex: none; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1px var(--lav-200); color: var(--teal); }
.login-features li svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.login-hero-stats { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.login-stat { min-width: 7.5rem; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: rgba(255,255,255,.85); box-shadow: inset 0 0 0 1px var(--lav-200); }
.login-stat .v { font: 700 1.6rem/1.1 var(--font-display); letter-spacing: -.03em; color: var(--lav-ink); }
.login-stat .l { margin-top: .2rem; font-size: var(--fs-xs); color: var(--lav-muted); }
.login-form-panel { display: flex; align-items: center; justify-content: center; min-width: 0; padding: clamp(2rem, 6vw, 5.5rem); background: #fff; }
.login-form-inner { width: 100%; max-width: 27rem; margin: 0 auto; }
.login-step { animation: page-in .45s var(--ease) both; }
.login-step.hidden,.login-page .hidden { display: none !important; }
.login-mobile-brand { display: none; }
.login-form-title { margin: 0 0 .5rem; color: var(--ink); font: 700 clamp(1.85rem, 2.8vw, 2.25rem)/1.15 var(--font-display); letter-spacing: -.03em; }
.login-form-sub { margin: 0 0 var(--sp-6); color: var(--muted); font-size: 1.0625rem; line-height: 1.6; }
.login-form-inner .form-group { gap: .5rem; margin-bottom: var(--sp-4); }
.login-form-inner .form-label { color: var(--ink-2); font-size: var(--fs-sm); font-weight: 650; }
.login-input-wrap { position: relative; display: flex; align-items: center; }
.login-input-wrap > svg { position: absolute; left: 1rem; width: 1.15rem; height: 1.15rem; color: var(--subtle); pointer-events: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: color .2s; }
.login-input-wrap:focus-within > svg { color: var(--blue); }
.login-form-inner .form-control { width: 100%; min-width: 0; min-height: 3.4rem; padding: 0 1rem 0 2.85rem; border: 1px solid #D6DDE6; border-radius: var(--r-md); outline: 0; background: #fff; color: var(--ink); font-size: 1.0625rem; box-shadow: inset 0 1px 1px rgba(14,27,46,.03); transition: border-color .18s, box-shadow .18s; }
.login-form-inner .form-control.has-action { padding-right: 3.5rem; }
.login-form-inner .form-control::placeholder { color: var(--subtle); }
.login-form-inner .form-control:hover { border-color: #B9C8DB; }
.login-form-inner .form-control:focus { border-color: var(--blue-500); box-shadow: var(--focus); }
.login-pwd-toggle { position: absolute; right: .45rem; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); transition: background .2s, color .2s; }
.login-pwd-toggle:hover { background: var(--surface-2); color: var(--blue); }
.login-pwd-toggle svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.login-btn { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: .6rem; width: 100%; min-height: 3.4rem; margin-top: var(--sp-3); border: 0; border-radius: var(--r-md); background: var(--blue); color: #fff; font-size: 1.0625rem; font-weight: 600; letter-spacing: .005em; box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, 0 1px 2px rgba(14,27,46,.2), 0 8px 18px -8px rgba(30,90,150,.55); transition: background .18s, box-shadow .18s, opacity .2s; }
.login-btn svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--ease); }
.login-btn:hover:not(:disabled) { background: var(--blue-600); }
.login-btn:hover:not(:disabled) svg { transform: translateX(3px); }
.login-btn:disabled { opacity: .55; cursor: not-allowed; }
.login-btn:focus-visible,.login-back:focus-visible,.otp-input:focus-visible { outline: 3px solid rgba(58,130,198,.35); outline-offset: 3px; }
.login-alert { display: none; margin: 0 0 var(--sp-4); padding: .85rem 1rem; border: 1px solid #F4CBC5; border-radius: var(--r-md); background: var(--rose-soft); color: #8E2D25; font-size: var(--fs-sm); line-height: 1.45; }
.login-alert.show { display: block; animation: pop .25s var(--ease); }
.login-alert.success { border-color: #BFE6D0; background: var(--green-soft); color: #1B6A45; }
.login-back { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.5rem; margin: 0 0 var(--sp-5); padding: 0 .85rem; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; transition: background .2s, border-color .2s, color .2s; }
.login-back:hover { border-color: var(--blue-300); color: var(--blue); }
.otp-inputs { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: clamp(.4rem, 1.6vw, .85rem); margin: var(--sp-5) 0 var(--sp-4); }
.otp-input { width: 100%; min-width: 0; height: clamp(3.4rem, 7vw, 4.25rem); padding: 0; border: 1.5px solid #D6DDE6; border-radius: var(--r-md); background: #fff; color: var(--ink); text-align: center; font: 700 clamp(1.4rem,3vw,1.85rem)/1 var(--font-display); font-variant-numeric: tabular-nums; box-shadow: var(--sh-xs); transition: border-color .18s, box-shadow .18s, transform .18s; }
.otp-input:hover { border-color: #B9C8DB; }
.otp-input:focus { outline: 0; border-color: var(--blue-500); box-shadow: var(--focus); transform: translateY(-2px); }
.otp-resend { margin-top: var(--sp-4); color: var(--muted); text-align: center; font-size: var(--fs-sm); }
.otp-resend button { padding: 0; min-height: 0; border: 0; background: none; color: var(--blue); font-weight: 650; text-decoration: underline; text-decoration-color: rgba(30,90,150,.3); text-underline-offset: 3px; }
.otp-resend button:hover { text-decoration-color: currentColor; }
.login-footer { display: grid; justify-items: center; gap: .6rem; margin-top: var(--sp-6); padding-top: var(--sp-4); border-top: 1px solid var(--line-2); color: var(--subtle); text-align: center; font-size: var(--fs-xs); line-height: 1.5; }
.login-powered { display: inline-flex; align-items: center; gap: .5rem; color: var(--lav-muted); }
.login-secure { display: flex; align-items: center; justify-content: center; gap: .4rem; margin-top: var(--sp-4); color: var(--muted); font-size: var(--fs-xs); }
.login-secure svg { width: .95rem; height: .95rem; fill: none; stroke: var(--teal); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ══════════════════════════════════════════════════════════════════
   Adaptación a pantallas
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 1279px) {
  .pill { display: none; }
  .grid-main { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .documentation-grid { grid-template-columns: minmax(0,1fr); }
  .profile-layout { grid-template-columns: minmax(0,1fr); }
  .profile-summary { position: static; display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; column-gap: var(--sp-4); padding: var(--sp-4) !important; text-align: left; }
  .profile-cover { display: none; }
  .profile-photo-wrap { grid-row: span 2; width: 5.5rem; height: 5.5rem; margin: 0; }
  .profile-photo,.profile-photo-placeholder { border-radius: 50%; }
  .profile-summary h2,.profile-summary > p { margin-inline: 0; }
  .profile-summary .profile-summary-note { grid-column: 1/-1; margin-inline: 0; }
}

/* Tableta y teléfono: el menú se vuelve un panel deslizable sobre el contenido. */
@media (max-width: 860px) {
  .app,.app.sidebar-collapsed { grid-template-columns: minmax(0,1fr); }
  aside,.sidebar-collapsed aside {
    position: fixed; inset: 0 auto 0 0; z-index: 90; width: min(var(--sidebar-w), 86vw); height: 100dvh;
    padding: var(--sp-4) var(--sp-3) max(var(--sp-3), env(safe-area-inset-bottom));
    transform: translateX(-104%); visibility: hidden;
    transition: transform .32s var(--ease), visibility 0s .32s;
    box-shadow: 24px 0 60px -20px rgba(27,32,51,.35);
  }
  .sidebar-open aside { transform: none; visibility: visible; transition: transform .32s var(--ease); }
  .sidebar-collapsed .sidebar-head { flex-direction: row; padding: 0 var(--sp-1); }
  .sidebar-collapsed .bt,.sidebar-collapsed aside nav a span,.sidebar-collapsed .foot-row:last-child,.sidebar-collapsed .foot .ghl,.sidebar-collapsed .foot .drceo { display: revert; }
  .sidebar-collapsed .nav-label { height: auto; margin: var(--sp-3) var(--sp-3) var(--sp-1); font-size: .6875rem; background: none; }
  .sidebar-collapsed .nav-label:first-child { display: block; margin-top: 0; }
  .sidebar-collapsed aside nav a { justify-content: flex-start; padding: 0 var(--sp-3); }
  .sidebar-collapsed .foot { justify-items: stretch; padding: var(--sp-3); }
  .sidebar-collapsed .foot-row { justify-content: space-between; }
  .sidebar-toggle svg,.sidebar-collapsed .sidebar-toggle svg { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 80; background: rgba(27,32,51,.38); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; visibility: hidden; transition: opacity .3s var(--ease), visibility 0s .3s; }
  .sidebar-open .scrim { opacity: 1; visibility: visible; transition: opacity .3s var(--ease); }
  .nav-open { display: grid; }
  main { padding: 0 var(--sp-4) var(--sp-6); }
  .hdr { margin: 0 calc(-1 * var(--sp-4)); padding: 0 var(--sp-4); gap: var(--sp-2); }
  .search { width: min(18rem, 36vw); }
  .search kbd { display: none; }
  .form-grid > .field { grid-column: auto !important; }
  .grid-2 { grid-template-columns: minmax(0,1fr); }
  .welcome { grid-template-columns: minmax(0,1fr); padding: var(--sp-5); }
  .welcome-actions { flex-direction: row; flex-wrap: wrap; }
  .documentation-settings-grid { grid-template-columns: minmax(0,1fr); }
}
@media (min-width: 861px) { .scrim { display: none; } }

@media (min-width: 641px) and (max-width: 1279px) {
  .kpis:has(> :nth-child(4)) { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .kpis:has(> :nth-child(4)) > :last-child:nth-child(odd) { grid-column: 1/-1; }
}

@media (max-width: 768px) {
  .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .data-table { min-width: 0; }
}

@media (max-width: 640px) {
  html { font-size: 93.75%; }
  :root { --header-h: 3.75rem; --fs-2xl: 1.6rem; --fs-kpi: 1.75rem; }
  main { padding: 0 .85rem var(--sp-6); }
  .hdr { margin: 0 -.85rem; padding: 0 .85rem; }
  .crumb small { display: none; }
  .crumb b { font-size: 1rem; }
  .search { display: none; }
  .search-btn { display: grid; }
  .hdr.search-open .crumb,.hdr.search-open .search-btn,.hdr.search-open .nav-open { display: none; }
  .hdr.search-open .search { display: flex; flex: 1; width: auto; }
  .nm,.accb > .i { display: none; }
  .accb { padding: .25rem; width: var(--control-h); justify-content: center; }
  .icon-btn,.nav-open,.search-btn,.accb { width: 2.6rem; height: 2.6rem; }
  /* Evita el zoom automático de iOS en los campos */
  .page-body input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),.page-body select,.page-body textarea { font-size: 16px; }
  .top { margin: var(--sp-5) 0 var(--sp-4); }
  .top-actions { width: 100%; }
  .top-actions > .btn { flex: 1 1 auto; }
  .sec { margin: var(--sp-6) 0 var(--sp-3); }
  .sec > .acts2 { width: 100%; }
  .sec > .acts2 > .legend { flex-basis: 100%; margin: 0 0 var(--sp-1) !important; }
  .sec > .acts2 > .btn { flex: 1 1 0; }
  .welcome { margin-top: var(--sp-4); padding: var(--sp-5) var(--sp-4); border-radius: var(--r-lg); }
  .welcome::after { display: none; }
  .welcome-actions .btn { flex: 1 1 auto; }
  .kpis { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: var(--sp-3); }
  .kpi { min-height: 7.5rem; padding: var(--sp-3); }
  .kpi.hero { grid-column: 1/-1; }
  .kpis:not(:has(> .hero)) > :last-child:nth-child(odd),
  .kpis:has(> .hero:first-child) > :last-child:nth-child(even) { grid-column: 1/-1; }
  .kpi .d { font-size: var(--fs-xs); }
  .kpi-ic { width: 2rem; height: 2rem; }
  .card { padding: var(--sp-3) var(--sp-3) var(--sp-4); }
  .card.flush > .card-head { padding: var(--sp-4) var(--sp-3) var(--sp-3); }
  .card-head { margin-bottom: var(--sp-3); }
  .grid-3 { grid-template-columns: minmax(0,1fr); }
  .meter-stats { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .meter-stats div { padding: var(--sp-2); }
  .chart { --h: 10rem; gap: .4rem; }
  .chart-stack .total { font-size: var(--fs-xs); }
  .months { grid-template-columns: minmax(0,1fr); }
  .toolbar { flex-direction: column; align-items: stretch; }
  .chips { display: flex; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; min-width: 0; scrollbar-width: none; }
  .toolbar > *,.top-actions > * { min-width: 0; max-width: 100%; }
  .chips::-webkit-scrollbar { display: none; }
  .save { flex-direction: column; align-items: stretch; bottom: max(.6rem, env(safe-area-inset-bottom)); padding: var(--sp-3); }
  .save .acts2 { display: grid; grid-template-columns: 1fr 1fr; }
  .webhook-url-row { grid-template-columns: minmax(0,1fr); }
  .pilot-form { grid-template-columns: minmax(0,1fr); }
  .template-test-head .input-group { flex-direction: column; }
  .settings-section .card-head .acts2 { align-items: stretch; width: 100%; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  .toast { left: .85rem; right: .85rem; max-width: none; }
  .pager .acts2 { width: 100%; margin: 0; }
  .pager .acts2 .btn { flex: 1; }

  /* Tablas → tarjetas apiladas: cada celda muestra su encabezado */
  table.rtable,table.rtable tbody,table.rtable tr,table.rtable td { display: block; width: 100%; }
  table.rtable thead { display: none; }
  table.rtable tr { padding: var(--sp-3) var(--sp-3); border-bottom: 1px solid var(--line-2); }
  table.rtable tr:last-child { border-bottom: 0; }
  table.rtable tbody tr:hover td { background: transparent; }
  table.rtable td { display: grid; grid-template-columns: minmax(6.5rem, 38%) minmax(0,1fr); align-items: center; gap: var(--sp-3); padding: .3rem 0; border: 0; text-align: left; }
  table.rtable td::before { content: attr(data-label); color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
  table.rtable td.lead { display: block; padding-bottom: .5rem; }
  table.rtable td.lead::before { display: none; }
  table.rtable td.actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); padding-top: .6rem; text-align: left; }
  table.rtable td.actions::before { display: none; }
  table.rtable td.actions .acts2 { justify-content: stretch; flex-wrap: wrap; width: 100%; }
  table.rtable td.actions .btn { flex: 1 1 auto; }
  table.rtable td.empty-row { display: block; }
  table.rtable td.empty-row::before { display: none; }
  .table-wrap:has(table.rtable) { overflow: visible; }
}
@media (max-width: 380px) {
  .kpis { grid-template-columns: minmax(0,1fr); }
  .kpi.hero { grid-column: auto; }
  .meter-stats { grid-template-columns: minmax(0,1fr); }
  .save .acts2 { grid-template-columns: minmax(0,1fr); }
}

/* Login en pantallas angostas */
@media (max-width: 960px) {
  .login-page { grid-template-columns: minmax(0,.9fr) minmax(0,1fr); }
  .login-hero { padding: 2.5rem 2.25rem; }
  .login-form-panel { padding: 2.5rem; }
}
@media (max-width: 780px) {
  .login-page { grid-template-columns: minmax(0,1fr); }
  .login-hero { min-height: 0; gap: var(--sp-5); padding: 1.75rem 1.5rem 2rem; border-radius: 0 0 1.75rem 1.75rem; border-right: 0; border-bottom: 1px solid var(--lav-200); }
  .login-hero::after { width: 26rem; height: 26rem; right: -12rem; bottom: -14rem; }
  .login-brand-logo { width: 2.9rem; height: 2.9rem; border-radius: .9rem; }
  .login-brand-text h2 { font-size: 1.35rem; }
  .login-hero-content h1 { font-size: clamp(2rem, 9vw, 2.6rem); margin-bottom: var(--sp-2); }
  .login-hero-content p { font-size: var(--fs-sm); }
  .login-features,.login-hero-stats { display: none; }
  .login-form-panel { align-items: flex-start; padding: 2rem 1.5rem 2.5rem; }
  .login-form-sub { margin-bottom: var(--sp-5); }
}

/* Impresión de reportes */
@media print {
  aside,.hdr,.aurora,.toast,.top-actions,.no-print,.scrim { display: none !important; }
  .app { display: block; }
  main { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}

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