/* Endoteca — sistema de diseño "liquid glass" */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI Variable Display", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-xl: 28px; --r-lg: 22px; --r-md: 16px; --r-sm: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --accent: #0fb5a5; --accent-2: #2f7bff; --accent-ink: #057a6f;
  --grad: linear-gradient(135deg, #2dd4bf 0%, #2f7bff 100%);
  --ok: #16a34a; --warn: #f59e0b; --danger: #e5484d;

  --ink: #0e1a2b; --ink-2: #44546a; --ink-3: #6b7a90;
  --bg-a: #dff3ff; --bg-b: #efe6ff; --bg-c: #ddfbf3; --bg-base: #eef3fa;
  --glass: rgba(255, 255, 255, .56); --glass-strong: rgba(255, 255, 255, .78); --glass-weak: rgba(255, 255, 255, .34);
  --glass-border: rgba(255, 255, 255, .72); --hl: rgba(255, 255, 255, .9); --edge: rgba(15, 30, 60, .08);
  --shadow: 0 10px 34px -10px rgba(25, 50, 100, .25), 0 2px 6px rgba(25, 50, 100, .06);
  --shadow-lg: 0 24px 60px -18px rgba(25, 50, 100, .34), 0 4px 14px rgba(25, 50, 100, .08);
  --blur: 26px;
  --field: rgba(255, 255, 255, .7);
  --focus: #2f7bff;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #eaf1fb; --ink-2: #b4c1d4; --ink-3: #8394ab;
  --bg-a: #0b2a44; --bg-b: #2a1650; --bg-c: #06352f; --bg-base: #070b14;
  --glass: rgba(26, 34, 52, .52); --glass-strong: rgba(30, 40, 62, .8); --glass-weak: rgba(255, 255, 255, .05);
  --glass-border: rgba(255, 255, 255, .13); --hl: rgba(255, 255, 255, .22); --edge: rgba(255, 255, 255, .08);
  --shadow: 0 12px 38px -10px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
  --shadow-lg: 0 28px 70px -18px rgba(0, 0, 0, .75), 0 4px 14px rgba(0, 0, 0, .35);
  --field: rgba(255, 255, 255, .07);
  --accent: #3be0cf; --accent-ink: #5eead4; --focus: #7db2ff;
  color-scheme: dark;
}
:root[data-contrast="high"] {
  --ink: #000; --ink-2: #1a1a1a; --ink-3: #2c2c2c; --glass: rgba(255, 255, 255, .96); --glass-strong: #fff; --glass-border: #000; --edge: #000;
  --field: #fff; --accent-ink: #00574f; --focus: #0036d6; --hl: #fff;
}
:root[data-theme="dark"][data-contrast="high"] {
  --ink: #fff; --ink-2: #fff; --ink-3: #e9e9e9; --glass: rgba(0, 0, 0, .94); --glass-strong: #000; --glass-border: #fff; --edge: #fff; --field: #000; --accent-ink: #7ff5e8; --focus: #9cc4ff;
}
:root[data-glass="off"] { --blur: 0px; --glass: var(--glass-strong); }
:root[data-theme="dark"][data-glass="off"] { --glass: #141b2b; }

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html[data-fs="s"] { font-size: 90%; } html[data-fs="l"] { font-size: 112.5%; } html[data-fs="xl"] { font-size: 128%; } html[data-fs="xxl"] { font-size: 150%; }
html[data-font="legible"] { --font: Verdana, "Atkinson Hyperlegible", Tahoma, sans-serif; }
html[data-spacing="wide"] body { letter-spacing: .025em; word-spacing: .12em; line-height: 1.75; }
body {
  margin: 0; min-height: 100dvh; font-family: var(--font); color: var(--ink); background: var(--bg-base);
  font-size: 1rem; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
/* fondo vivo */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg-base); }
.bg i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .85; animation: float 26s ease-in-out infinite; }
.bg i:nth-child(1) { width: 52vmax; height: 52vmax; left: -14vmax; top: -16vmax; background: var(--bg-a); }
.bg i:nth-child(2) { width: 46vmax; height: 46vmax; right: -12vmax; top: 6vmax; background: var(--bg-b); animation-delay: -9s; }
.bg i:nth-child(3) { width: 50vmax; height: 50vmax; left: 18vmax; bottom: -26vmax; background: var(--bg-c); animation-delay: -17s; }
@keyframes float { 0%, 100% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(4vmax, 3vmax, 0) scale(1.08); } }
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { :root:not([data-motion="full"]) * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
:root[data-contrast="high"] .bg i { opacity: .15; }

a { color: var(--accent-ink); text-underline-offset: 3px; }
:root[data-links="on"] a { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
:root[data-focus="strong"] :focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; box-shadow: 0 0 0 7px color-mix(in srgb, var(--focus) 30%, transparent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -80px; z-index: 100; background: var(--ink); color: var(--bg-base); padding: 10px 16px; border-radius: 12px; transition: top .2s; }
.skip:focus { top: 12px; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ===== Vidrio ===== */
.glass {
  position: relative; background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--r-lg);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%); backdrop-filter: blur(var(--blur)) saturate(180%);
  box-shadow: var(--shadow), inset 0 1px 0 var(--hl), inset 0 -1px 0 var(--edge);
}
.glass::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(140deg, rgba(255, 255, 255, .5) 0%, rgba(255, 255, 255, 0) 38%); opacity: .55; }
:root[data-theme="dark"] .glass::before { background: linear-gradient(140deg, rgba(255, 255, 255, .13) 0%, rgba(255, 255, 255, 0) 36%); opacity: 1; }
:root[data-contrast="high"] .glass::before { display: none; }
:root[data-contrast="high"] .glass { border-width: 2px; }
.glass > * { position: relative; }

/* ===== Estructura ===== */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 18px; padding: 18px; max-width: 1760px; margin: 0 auto; }
.side { position: sticky; top: 18px; height: calc(100dvh - 36px); display: flex; flex-direction: column; padding: 18px 14px; border-radius: var(--r-xl); gap: 6px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 16px; text-decoration: none; color: var(--ink); }
.brand img { width: 44px; height: 44px; border-radius: 13px; box-shadow: 0 6px 16px -4px rgba(47, 123, 255, .5); }
.brand b { display: block; font-size: 1.18rem; letter-spacing: -.02em; line-height: 1.1; }
.brand small { color: var(--ink-3); font-size: .74rem; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 13px; padding: 11px 14px; border-radius: 15px; color: var(--ink-2); text-decoration: none; font-weight: 560; transition: background .2s, color .2s, transform .2s var(--ease); }
.nav a svg { width: 22px; height: 22px; flex: none; }
.nav a:hover { background: var(--glass-weak); color: var(--ink); }
.nav a[aria-current="page"] { color: #fff; background: var(--grad); box-shadow: 0 8px 20px -8px rgba(47, 123, 255, .65), inset 0 1px 0 rgba(255, 255, 255, .4); }
:root[data-contrast="high"] .nav a[aria-current="page"] { background: #000; color: #fff; }
:root[data-theme="dark"][data-contrast="high"] .nav a[aria-current="page"] { background: #fff; color: #000; }
.nav .badge { margin-left: auto; font-size: .72rem; background: var(--danger); color: #fff; border-radius: 99px; padding: 1px 8px; font-weight: 700; }
.side .grow { flex: 1; }
.side-foot { display: grid; gap: 8px; }
.main { min-width: 0; padding-bottom: 40px; outline: none; }
.top { display: flex; align-items: center; gap: 12px; margin: 2px 2px 18px; }
.top h1 { font-size: clamp(1.55rem, 2.6vw, 2.15rem); letter-spacing: -.03em; margin: 0; line-height: 1.12; font-weight: 750; }
.top .sub { color: var(--ink-3); font-size: .95rem; margin-top: 2px; }
.top .grow { flex: 1; min-width: 0; }

/* barra inferior (móvil) */
.tabbar { display: none; }
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; padding: 12px 12px 112px; }
  .side { display: none; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 40; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 7px; border-radius: 30px; gap: 2px; max-width: 560px; margin: 0 auto; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; border-radius: 23px; color: var(--ink-3); text-decoration: none; font-size: .68rem; font-weight: 650; position: relative; min-width: 0; }
  .tabbar a svg { width: 24px; height: 24px; }
  .tabbar a[aria-current="page"] { color: var(--ink); background: var(--glass-strong); box-shadow: inset 0 1px 0 var(--hl), 0 4px 14px -6px rgba(25, 50, 100, .35); }
  .tabbar a[aria-current="page"] svg { color: var(--accent-2); }
  .tabbar .dot { position: absolute; top: 5px; right: calc(50% - 20px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .62rem; display: grid; place-items: center; }
}

/* ===== Controles ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 0 18px; border-radius: 15px; border: 1px solid var(--glass-border); background: var(--glass-strong); color: var(--ink);
  font-weight: 640; cursor: pointer; text-decoration: none; box-shadow: inset 0 1px 0 var(--hl), 0 3px 10px -4px rgba(25, 50, 100, .22); transition: transform .18s var(--ease), box-shadow .2s, background .2s; white-space: nowrap; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.btn:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 var(--hl), 0 8px 20px -8px rgba(25, 50, 100, .35); }
.btn:active { transform: scale(.97); }
.btn svg { width: 19px; height: 19px; flex: none; }
.btn.primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 10px 24px -8px rgba(47, 123, 255, .7); text-shadow: 0 1px 1px rgba(0, 0, 0, .18); }
:root[data-contrast="high"] .btn.primary { background: #0036d6; text-shadow: none; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 36px; padding: 0 13px; border-radius: 12px; font-size: .9rem; }
.btn.icon { width: 44px; padding: 0; }
.btn.sm.icon { width: 36px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.field { display: grid; gap: 6px; }
.field > span { font-size: .8rem; font-weight: 650; color: var(--ink-2); letter-spacing: .01em; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 0 15px; border-radius: 15px; border: 1px solid var(--edge); background: var(--field); color: var(--ink); font: inherit;
  box-shadow: inset 0 1px 2px rgba(20, 40, 80, .07); transition: border-color .2s, box-shadow .2s; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
textarea.input { padding: 12px 15px; min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 24%, transparent); }
.input::placeholder { color: var(--ink-3); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.search { position: relative; }
.search svg { z-index: 2; position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 21px; height: 21px; color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 46px; min-height: 54px; border-radius: 20px; font-size: 1.05rem; padding-right: 54px; }
.search .kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
.kbd { font-family: var(--mono); font-size: .75rem; border: 1px solid var(--edge); border-radius: 7px; padding: 1px 7px; color: var(--ink-3); background: var(--glass-weak); }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--edge); background: var(--glass-weak); color: var(--ink-2); font-size: .88rem; font-weight: 600; cursor: pointer; transition: all .2s var(--ease); user-select: none; }
.chip:hover { background: var(--glass); color: var(--ink); }
.chip[aria-pressed="true"], .chip.on { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 16px -7px rgba(47, 123, 255, .7); }
:root[data-contrast="high"] .chip[aria-pressed="true"], :root[data-contrast="high"] .chip.on { background: #0036d6; }
.chip .n { opacity: .65; font-weight: 500; font-size: .78rem; }
.chip.x::after { content: "×"; font-size: 1.1rem; line-height: 1; margin-left: 2px; opacity: .8; }
.seg { display: inline-grid; grid-auto-flow: column; gap: 3px; padding: 4px; border-radius: 16px; background: var(--glass-weak); border: 1px solid var(--edge); }
.seg button { border: 0; background: transparent; min-height: 38px; padding: 0 15px; border-radius: 12px; cursor: pointer; font-weight: 620; color: var(--ink-2); display: inline-flex; align-items: center; gap: 7px; justify-content: center; }
.seg button[aria-pressed="true"], .seg button[aria-checked="true"] { background: var(--glass-strong); color: var(--ink); box-shadow: inset 0 1px 0 var(--hl), 0 3px 10px -4px rgba(25, 50, 100, .3); }
.seg svg { width: 18px; height: 18px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 4px; cursor: pointer; }
.switch + .switch { border-top: 1px solid var(--edge); }
.switch .t b { display: block; font-weight: 650; } .switch .t small { color: var(--ink-3); }
.switch input { appearance: none; width: 54px; height: 32px; border-radius: 99px; background: var(--edge); position: relative; flex: none; cursor: pointer; transition: background .25s; border: 1px solid var(--edge); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform .28s var(--ease); }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(22px); }

/* ===== Tarjetas ===== */
.card { padding: 20px; border-radius: var(--r-lg); }
.card h2, .card h3 { margin: 0 0 4px; letter-spacing: -.02em; }
.card h2 { font-size: 1.12rem; } .card h3 { font-size: 1rem; }
.card .hint { color: var(--ink-3); font-size: .85rem; margin: 0 0 14px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
@media (max-width: 1180px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .g2, .g3 { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .card { padding: 16px; } }
.kpi { padding: 18px; display: flex; flex-direction: column; gap: 4px; text-align: left; cursor: pointer; border: 1px solid var(--glass-border); color: inherit; font: inherit; width: 100%; transition: transform .25s var(--ease), box-shadow .25s; }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--hl); }
.kpi .ico { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; color: #fff; margin-bottom: 8px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45); }
.kpi .ico svg { width: 21px; height: 21px; }
.kpi .v { font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 760; letter-spacing: -.035em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--ink-2); font-weight: 600; font-size: .9rem; } .kpi .s { color: var(--ink-3); font-size: .78rem; }

/* ===== Etiquetas clínicas ===== */
.tag { --c: #64748b; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 650; color: color-mix(in srgb, var(--c) 78%, var(--ink)); background: color-mix(in srgb, var(--c) 15%, transparent); border: 1px solid color-mix(in srgb, var(--c) 28%, transparent); white-space: nowrap; text-decoration: none; }
button.tag { cursor: pointer; font-family: inherit; }
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.tag.alta { --c: #e5484d; } .tag.media { --c: #f08a00; }
.g-Esófago { --c: #8b5cf6; } .g-Estómago { --c: #d97706; } .g-Duodeno { --c: #db2777; } .g-Colon { --c: #0891b2; } .g-Procedimientos { --c: #64748b; } .g-Atencion { --c: #e5484d; } .g-Calidad { --c: #7c8aa0; }
.type { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; padding: 3px 9px; border-radius: 9px; font-size: .74rem; font-weight: 780; letter-spacing: .03em; color: #fff; }
.type.VEDA { background: linear-gradient(135deg, #a78bfa, #6d5df6); } .type.VCC { background: linear-gradient(135deg, #22d3ee, #0e8fd0); } .type.RSC { background: linear-gradient(135deg, #34d399, #0d9b6b); } .type.IMG, .type.OTRO { background: linear-gradient(135deg, #94a3b8, #64748b); }
.alertdot { width: 11px; height: 11px; border-radius: 50%; flex: none; display: inline-block; background: transparent; }
.alertdot.a2 { background: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 22%, transparent); } .alertdot.a1 { background: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 22%, transparent); }

/* ===== Listas ===== */
.list { display: grid; gap: 10px; }
.row { display: grid; grid-template-columns: 72px minmax(190px, 1.1fr) minmax(0, 2fr) auto; gap: 16px; align-items: center; padding: 14px 18px; border-radius: 20px; cursor: pointer; color: inherit; text-decoration: none; transition: transform .22s var(--ease), box-shadow .22s; }
.row:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--hl); }
.row .date { font-variant-numeric: tabular-nums; line-height: 1.2; } .row .date b { display: block; font-size: 1.25rem; letter-spacing: -.02em; } .row .date span { font-size: .75rem; color: var(--ink-3); text-transform: uppercase; font-weight: 650; letter-spacing: .06em; }
.row .who b { display: block; font-size: 1.02rem; letter-spacing: -.01em; } .row .who small { color: var(--ink-3); font-size: .84rem; }
.row .dx { min-width: 0; } .row .dx p { margin: 0 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink); font-size: .95rem; }
.row .dx p.muted { color: var(--ink-3); font-style: italic; }
.row .tags { display: flex; flex-wrap: wrap; gap: 5px; }
.row .end { display: flex; align-items: center; gap: 10px; }
@media (max-width: 860px) {
  .row { grid-template-columns: 56px minmax(0, 1fr) auto; gap: 8px 12px; padding: 14px; }
  .row .dx { grid-column: 1 / -1; order: 5; }
  .row .date b { font-size: 1.1rem; }
}
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty > svg { width: 54px; height: 54px; opacity: .6; margin-bottom: 8px; } .empty b { display: block; color: var(--ink-2); font-size: 1.1rem; margin-bottom: 4px; }
.skeleton { border-radius: 20px; height: 84px; background: linear-gradient(100deg, var(--glass-weak) 30%, var(--glass) 50%, var(--glass-weak) 70%); background-size: 220% 100%; animation: sh 1.4s linear infinite; border: 1px solid var(--edge); }
@keyframes sh { to { background-position: -220% 0; } }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 22px 0 4px; color: var(--ink-3); }

/* ===== Barra de filtros ===== */
.toolbar { display: grid; gap: 12px; margin-bottom: 16px; }
.toolbar .line { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .grow { flex: 1; min-width: 220px; }
.filters-open { display: inline-flex; }
.sheet-bg { position: fixed; inset: 0; background: rgba(8, 14, 28, .42); z-index: 60; -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); animation: fade .25s; }
.sheet { position: fixed; z-index: 61; top: 14px; right: 14px; bottom: 14px; width: min(480px, calc(100vw - 28px)); display: flex; flex-direction: column; border-radius: var(--r-xl); animation: slidein .38s var(--ease); background: var(--glass-strong); }
.sheet header { display: flex; align-items: center; gap: 10px; padding: 18px 20px 12px; } .sheet header h2 { margin: 0; flex: 1; font-size: 1.25rem; letter-spacing: -.02em; }
.sheet .body { grid-template-columns: minmax(0, 1fr); overflow-x: hidden; overflow-y: auto; padding: 4px 20px 20px; display: grid; gap: 22px; align-content: start; overscroll-behavior: contain; }
.sheet footer { display: flex; gap: 10px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--edge); } .sheet footer .btn { flex: 1; }
.sheet .group h3 { font-size: .74rem; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px; font-weight: 750; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } } @keyframes fade { from { opacity: 0; } }
@media (max-width: 700px) {
  .sheet { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 92dvh; animation-name: slideup; }
  @keyframes slideup { from { transform: translateY(60px); opacity: 0; } }
}
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; } .two > * { min-width: 0; } input[type=date].input { min-width: 0; max-width: 100%; }

/* ===== Detalle ===== */
.crumbs { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.hero { padding: 24px; display: grid; gap: 18px; margin-bottom: 16px; }
.hero .name { font-size: clamp(1.6rem, 3.4vw, 2.5rem); font-weight: 780; letter-spacing: -.035em; line-height: 1.08; margin: 0; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--ink-2); }
.hero .meta div { display: flex; flex-direction: column; } .hero .meta small { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; } .hero .meta b { font-size: 1.05rem; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.menu { position: relative; }
.pop { position: absolute; z-index: 30; right: 0; top: calc(100% + 8px); min-width: 250px; padding: 8px; border-radius: 20px; background: var(--glass-strong); animation: fade .15s; }
.pop button, .pop a { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; background: transparent; border-radius: 13px; cursor: pointer; text-align: left; color: var(--ink); text-decoration: none; font-weight: 600; }
.pop button:hover, .pop a:hover { background: var(--glass-weak); } .pop svg { width: 20px; height: 20px; color: var(--accent-2); } .pop small { display: block; color: var(--ink-3); font-weight: 500; }
.alertbar { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: 18px; border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); background: color-mix(in srgb, var(--danger) 11%, var(--glass)); margin-bottom: 16px; }
.alertbar.m { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 12%, var(--glass)); }
.alertbar svg { width: 24px; height: 24px; color: var(--danger); flex: none; margin-top: 1px; } .alertbar.m svg { color: var(--warn); }
.dxbox { padding: 22px; border-radius: var(--r-lg); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--glass)), color-mix(in srgb, var(--accent-2) 12%, var(--glass))); }
.dxbox small { font-size: .72rem; letter-spacing: .1em; font-weight: 800; color: var(--accent-ink); } .dxbox p { margin: 6px 0 0; font-size: clamp(1.2rem, 2.2vw, 1.55rem); font-weight: 720; letter-spacing: -.02em; line-height: 1.25; }
.sections { display: grid; gap: 0; } .sec { padding: 14px 0; border-top: 1px solid var(--edge); } .sec:first-child { border-top: 0; padding-top: 0; } .sec h3 { margin: 0 0 4px; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); } .sec p { margin: 0; line-height: 1.65; }
.tabs { margin-bottom: 14px; }
.timeline { display: grid; gap: 4px; position: relative; padding-left: 4px; }
.tl { display: grid; grid-template-columns: 20px 1fr; gap: 12px; padding: 10px 8px; border-radius: 14px; color: inherit; text-decoration: none; cursor: pointer; }
.tl:hover { background: var(--glass-weak); } .tl[aria-current="true"] { background: var(--glass-strong); box-shadow: inset 0 1px 0 var(--hl); }
.tl i { width: 12px; height: 12px; border-radius: 50%; background: var(--grad); margin-top: 6px; position: relative; justify-self: center; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-2) 20%, transparent); }
.tl b { font-variant-numeric: tabular-nums; } .tl small { display: block; color: var(--ink-3); } .tl p { margin: 2px 0 0; font-size: .9rem; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.viewer { padding: 14px; display: grid; gap: 14px; justify-items: center; }
.viewer .bar { display: flex; gap: 8px; align-items: center; justify-self: stretch; flex-wrap: wrap; }
.viewer .pages { display: grid; gap: 14px; justify-items: center; width: 100%; max-height: 78dvh; overflow: auto; padding: 4px; }
.viewer canvas { max-width: 100%; height: auto; border-radius: 10px; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .45); background: #fff; }
.boston { display: flex; gap: 4px; margin-top: 6px; } .boston i { width: 100%; height: 9px; border-radius: 9px; background: var(--edge); } .boston i.on { background: var(--grad); }

/* ===== Gráficos ===== */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.chart .grid-l { stroke: var(--edge); stroke-width: 1; }
.chart .area { fill: url(#ga); } .chart .line { fill: none; stroke: url(#gl); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { fill: var(--accent-2); stroke: #fff; stroke-width: 2; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart-wrap { position: relative; }
.tip { position: absolute; pointer-events: none; padding: 7px 11px; border-radius: 12px; font-size: .82rem; font-weight: 650; background: var(--ink); color: var(--bg-base); transform: translate(-50%, -120%); white-space: nowrap; z-index: 5; box-shadow: var(--shadow); }
.hbars { display: grid; gap: 9px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 40%) 1fr auto; gap: 10px; align-items: center; background: none; border: 0; padding: 4px 6px; margin: 0 -6px; border-radius: 12px; text-align: left; cursor: pointer; width: calc(100% + 12px); }
.hbar:hover { background: var(--glass-weak); }
.hbar span { font-size: .9rem; font-weight: 580; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .tr { height: 10px; border-radius: 8px; background: var(--edge); overflow: hidden; } .hbar .tr i { display: block; height: 100%; border-radius: 8px; background: var(--c, var(--grad)); background: var(--grad); }
.hbar.alta .tr i { background: linear-gradient(90deg, #f97316, #e5484d); } .hbar.media .tr i { background: linear-gradient(90deg, #fbbf24, #f08a00); }
.hbar em { font-style: normal; font-variant-numeric: tabular-nums; font-weight: 700; font-size: .88rem; color: var(--ink-2); }
.donut-row { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: center; }
.legend { display: grid; gap: 8px; } .legend div { display: flex; align-items: center; gap: 9px; font-size: .92rem; } .legend i { width: 12px; height: 12px; border-radius: 4px; } .legend b { margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 10px; }
.quick button { text-align: left; border: 1px solid var(--edge); background: var(--glass-weak); border-radius: 18px; padding: 13px 14px; cursor: pointer; transition: all .22s var(--ease); display: grid; gap: 1px; }
.quick button:hover { background: var(--glass-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.quick b { font-size: 1.35rem; letter-spacing: -.03em; font-variant-numeric: tabular-nums; } .quick span { font-size: .82rem; color: var(--ink-2); font-weight: 600; }

/* ===== Login ===== */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login .box { width: min(440px, 100%); padding: 34px 30px; display: grid; gap: 20px; border-radius: 34px; box-shadow: var(--shadow-lg), inset 0 1px 0 var(--hl); }
.login .logo { width: 84px; height: 84px; border-radius: 26px; margin: 0 auto; box-shadow: 0 16px 36px -10px rgba(47, 123, 255, .6); animation: pop .7s var(--ease); }
@keyframes pop { from { transform: scale(.6) rotate(-8deg); opacity: 0; } }
.login h1 { margin: 0; text-align: center; font-size: 2rem; letter-spacing: -.04em; } .login p.s { margin: -12px 0 0; text-align: center; color: var(--ink-3); }
.login form { display: grid; gap: 14px; }
.err { color: var(--danger); font-weight: 600; font-size: .92rem; min-height: 1.2em; text-align: center; }
.pw { position: relative; } .pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.toast-wrap { position: fixed; z-index: 90; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100vw - 24px)); pointer-events: none; }
@media (min-width: 961px) { .toast-wrap { bottom: 28px; } }
.toast { padding: 13px 18px; border-radius: 18px; background: var(--glass-strong); font-weight: 620; animation: pop .35s var(--ease); display: flex; gap: 10px; align-items: center; }
.progress { height: 12px; border-radius: 8px; background: var(--edge); overflow: hidden; } .progress i { display: block; height: 100%; background: var(--grad); transition: width .4s; }
.drop { border: 2px dashed color-mix(in srgb, var(--accent-2) 45%, transparent); border-radius: 24px; padding: 34px 20px; text-align: center; color: var(--ink-2); cursor: pointer; transition: all .2s; }
.drop.over, .drop:hover { background: color-mix(in srgb, var(--accent-2) 10%, transparent); border-color: var(--accent-2); }
.drop svg { width: 44px; height: 44px; color: var(--accent-2); }
table.audit { width: 100%; border-collapse: collapse; font-size: .85rem; } table.audit td { padding: 7px 8px; border-top: 1px solid var(--edge); vertical-align: top; } table.audit td:first-child { color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.mb { margin-bottom: 16px; } .mt { margin-top: 16px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .between { justify-content: space-between; }
.a11y-preview { padding: 14px; border-radius: 16px; background: var(--glass-weak); border: 1px solid var(--edge); }

/* ===== Impresión: se imprime solo el informe ===== */
@media print {
  .bg, .side, .tabbar, .actions, .crumbs, .tabs, .no-print, .toast-wrap, .sheet, .sheet-bg { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .shell { display: block; padding: 0; } .glass { background: #fff !important; box-shadow: none !important; border: 1px solid #ccc !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .glass::before { display: none; } .grid { display: block; } .grid > * { margin-bottom: 12px; break-inside: avoid; }
  .dxbox { background: #eef9f7 !important; }
}
