/* Denti+ · sistema visual
   Concepto: consultorio luminoso. Fondo con un matiz azul tenue, superficies blancas, el azul del logo como acento principal,
   celeste para información, verde del logo para lo "bien" y rojo del logo para lo que requiere atención. */
:root {
  --bg: #F3F6FC; --surface: #FFFFFF; --surface-2: #F7F9FE; --ink: #141A4D; --ink-2: #3B4577; --muted: #667196;
  --line: #E4E9F5; --line-2: #D3DBEE;
  --primary: #2E3192; --primary-hover: #23267A; --on-primary: #FFFFFF; --link: #2E3192; --brand-tint: #E8EBFA;
  --sky: #0F8FD8; --sky-tint: #E1F2FC; --sky-ink: #0B6FA8;
  --red: #ED1C24; --red-tint: #FDE8E9; --red-ink: #B3121A;
  --green: #8DC63F; --green-tint: #EDF7DC; --green-ink: #4C8A12;
  --amber: #C77700; --amber-tint: #FFF1D6; --amber-ink: #8A5200;
  --wa: #1FAF54;
  --shadow: 0 1px 2px rgba(20,26,77,.06), 0 12px 32px -16px rgba(20,26,77,.22);
  --shadow-sm: 0 1px 2px rgba(20,26,77,.07);
  --radius: 14px; --radius-sm: 10px;
  --font: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Semibold", "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0E2B; --surface: #14183F; --surface-2: #1A1F4D; --ink: #EAEEFF; --ink-2: #C3CAF0; --muted: #98A2D2;
    --line: #252B63; --line-2: #333B82;
    --primary: #4B53D8; --primary-hover: #5C64E6; --on-primary: #FFFFFF; --link: #AEB6FF; --brand-tint: #232A6E;
    --sky: #38A9EA; --sky-tint: #0F3552; --sky-ink: #7CC6F3;
    --red: #FF5C63; --red-tint: #46182A; --red-ink: #FF9CA1;
    --green: #A5D95A; --green-tint: #1E3516; --green-ink: #B7E27A;
    --amber: #F0A43A; --amber-tint: #43330E; --amber-ink: #F4C37A;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 34px -16px rgba(0,0,0,.6); --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B0E2B; --surface: #14183F; --surface-2: #1A1F4D; --ink: #EAEEFF; --ink-2: #C3CAF0; --muted: #98A2D2;
  --line: #252B63; --line-2: #333B82;
  --primary: #4B53D8; --primary-hover: #5C64E6; --on-primary: #FFFFFF; --link: #AEB6FF; --brand-tint: #232A6E;
  --sky: #38A9EA; --sky-tint: #0F3552; --sky-ink: #7CC6F3;
  --red: #FF5C63; --red-tint: #46182A; --red-ink: #FF9CA1;
  --green: #A5D95A; --green-tint: #1E3516; --green-ink: #B7E27A;
  --amber: #F0A43A; --amber-tint: #43330E; --amber-ink: #F4C37A;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 34px -16px rgba(0,0,0,.6); --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14.5px/1.5 var(--font); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 650; }
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--sky) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); } .center { text-align: center; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- estructura ---------- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; gap: 6px; z-index: 30; }
.brand { padding: 4px 6px 12px; }
.brand .logo { display: block; }
.brand img { width: 100%; max-width: 188px; display: block; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.side nav { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 2px; padding: 4px 0; }
.side nav > a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px; color: var(--ink-2); text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.side nav > a:hover { background: var(--surface-2); color: var(--ink); }
.side nav > a.on { background: var(--brand-tint); color: var(--link); font-weight: 650; }
.side nav > a .ico { opacity: .85; } .side nav > a.on .ico { opacity: 1; }
.side nav .badge-n { margin-left: auto; background: var(--wa); color: #fff; border-radius: 99px; padding: 0 7px; font-size: 11px; font-weight: 700; line-height: 18px; }
.sub { display: flex; flex-direction: column; margin: 2px 0 6px 22px; padding-left: 14px; border-left: 2px solid var(--line); }
.sub a { padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 13px; }
.sub a:hover { background: var(--surface-2); color: var(--ink); } .sub a.on { color: var(--link); font-weight: 650; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.me .av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--primary), var(--sky)); flex: none; }
.me b { display: block; font-size: 13px; line-height: 1.2; } .me span { font-size: 12px; color: var(--muted); } .me a { margin-left: auto; color: var(--muted); display: grid; place-items: center; padding: 6px; border-radius: 8px; }
.me a:hover { background: var(--line); color: var(--ink); }

main { min-width: 0; padding: 0 28px 40px; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 16px 0 14px; margin-bottom: 8px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); }
.top h1 { margin: 0; font-size: 24px; font-weight: 700; flex: 1; min-width: 0; }
.search { position: relative; width: min(320px, 38vw); }
.search input { padding-left: 38px; border-radius: 99px; background: var(--surface); }
.search .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }
.burger { display: none; }

/* ---------- componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.tablewrap { padding: 0; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2); position: sticky; top: 0; }
tbody tr:hover td, .card table tr:hover td { background: color-mix(in srgb, var(--brand-tint) 45%, var(--surface)); }
tr:last-child td { border-bottom: 0; }
td { font-variant-numeric: tabular-nums; }

.btn { display: inline-flex; align-items: center; gap: 7px; background: var(--primary); color: var(--on-primary); border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 15px; cursor: pointer; text-decoration: none; font: inherit; font-weight: 600; box-shadow: var(--shadow-sm); transition: background .15s, transform .05s, box-shadow .15s; }
.btn:hover { background: var(--primary-hover); } .btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--surface); color: var(--link); border-color: var(--line-2); box-shadow: none; }
.btn.ghost:hover { background: var(--brand-tint); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.danger { background: var(--red); color: #fff; } .btn.danger:hover { filter: brightness(.92); }
.btn.warn { background: var(--amber); color: #fff; } .btn.warn:hover { filter: brightness(.92); }
.btn.wa { background: var(--wa); color: #fff; }
td.rowact { text-align: right; white-space: nowrap; width: 1%; position: sticky; right: 0; background: var(--surface); box-shadow: -10px 0 14px -12px rgba(20,26,77,.3); }
td.rowact > * { display: inline-block; vertical-align: middle; margin: 0 0 0 4px; }
td.rowact form { margin: 0; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input, select, textarea { font: inherit; color: var(--ink); padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); width: 100%; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sky) 22%, transparent); }
.filters input, .filters select { width: auto; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--primary); padding: 0; }
input[type=file] { padding: 7px 10px; }
label span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.wide { grid-column: 1 / -1; } .actions { margin-top: 16px; display: flex; gap: 8px; }
.flash { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid transparent; font-weight: 500; }
.flash.ok { background: var(--green-tint); color: var(--green-ink); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.flash.err { background: var(--red-tint); color: var(--red-ink); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.b-creado, .b-activo, .b-atendida, .b-conforme, .b-pagado, .b-confirmada { background: var(--green-tint); color: var(--green-ink); border-color: transparent; }
.b-anulado, .b-cancelada, .b-no_conforme, .b-rechazado { background: var(--red-tint); color: var(--red-ink); border-color: transparent; }
.b-no_asistio, .b-en_tramite, .b-urgencia { background: var(--amber-tint); color: var(--amber-ink); border-color: transparent; }
.b-programada, .b-primera_vez { background: var(--sky-tint); color: var(--sky-ink); border-color: transparent; }
.b-pyp { background: var(--brand-tint); color: var(--link); border-color: transparent; } .b-control { background: var(--sky-tint); color: var(--sky-ink); border-color: transparent; }
.pager { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.pager a { padding: 5px 11px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); text-decoration: none; }
.pager .cur { background: var(--primary); color: var(--on-primary); border-color: transparent; }

@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand .logo { background: #fff; border-radius: 12px; padding: 8px 10px; } }
:root[data-theme="dark"] .brand .logo { background: #fff; border-radius: 12px; padding: 8px 10px; }

/* ---------- inicio ---------- */
.hero { position: relative; overflow: hidden; border-radius: 20px; padding: 26px 28px; margin-bottom: 18px; color: #fff; background: radial-gradient(120% 140% at 100% 0%, #0F8FD8 0%, rgba(15,143,216,0) 55%), linear-gradient(135deg, #23267A 0%, #2E3192 55%, #3a3fb0 100%); box-shadow: var(--shadow); }
.hero h2 { color: #fff; font-size: 26px; margin: 0 0 4px; font-weight: 700; } .hero p { margin: 0; color: rgba(255,255,255,.82); }
.hero .quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; position: relative; z-index: 1; }
.hero .quick .btn { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.28); color: #fff; box-shadow: none; backdrop-filter: blur(4px); }
.hero .quick .btn:hover { background: rgba(255,255,255,.26); } .hero .quick .btn.wa { background: var(--wa); border-color: transparent; }
.hero .gems { position: absolute; right: 0; top: 0; width: 280px; height: 200px; pointer-events: none; }
.gem { position: absolute; display: inline-block; animation: gemFloat 5.5s ease-in-out infinite; } .gem.g2 { animation-duration: 6.5s; animation-delay: -2s; }
.gem svg { position: relative; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 9px var(--hc)) drop-shadow(0 7px 10px rgba(5, 8, 50, .4)); }
.gem-halo { position: absolute; inset: -34%; border-radius: 50%; background: radial-gradient(closest-side, var(--hc), transparent 72%); filter: blur(10px); opacity: .7; animation: gemPulse 3.4s ease-in-out infinite; pointer-events: none; }
.gspark { position: absolute; width: 12px; height: 12px; background: #fff; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); filter: drop-shadow(0 0 6px #fff); animation: tw 3.6s ease-in-out infinite; } .gspark.s2 { width: 9px; height: 9px; animation-delay: 1.4s; }
@keyframes gemFloat { 0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); } 50% { transform: translateY(-8px) rotate(calc(var(--r, 0deg) + 4deg)); } }
@keyframes gemPulse { 0%, 100% { opacity: .5; transform: scale(.94); } 50% { opacity: .95; transform: scale(1.08); } }
.gp3d { position: absolute; transform-style: preserve-3d; } .gp3d > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.gp3d .gem-halo { transform: translateZ(-70px); inset: -62%; opacity: .95; filter: blur(16px) saturate(1.3); } .gp3d > svg:last-child { filter: drop-shadow(0 0 14px var(--hc)); }
.gp3d.red { animation: bob2 7s ease-in-out infinite; } .gp3d.green { animation: bob2 8s ease-in-out -2s infinite; }
.tooth-aura { position: absolute; left: 50%; top: 50%; width: 400px; height: 400px; margin: -215px 0 0 -200px; background: radial-gradient(closest-side, rgba(215, 238, 255, .78), rgba(110, 175, 255, .34) 50%, rgba(40, 90, 220, 0) 76%); filter: blur(14px); transform: translateZ(-60px); animation: gemPulse 4.8s ease-in-out infinite; pointer-events: none; }
.tsweep { animation: tsweep 5.8s ease-in-out infinite; transform: skewX(-16deg); } @keyframes tsweep { 0%, 50% { transform: translateX(0) skewX(-16deg); } 100% { transform: translateX(200px) skewX(-16deg); } }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.tile .chip { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.tile b { display: block; font-family: var(--font-display); font-size: 21px; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; } .tile > div:last-child { min-width: 0; } .tile span { color: var(--muted); font-size: 12.5px; }
.tone-blue .chip { background: var(--brand-tint); color: var(--link); } .tone-sky .chip { background: var(--sky-tint); color: var(--sky-ink); }
.tone-green .chip { background: var(--green-tint); color: var(--green-ink); } .tone-red .chip { background: var(--red-tint); color: var(--red-ink); } .tone-amber .chip { background: var(--amber-tint); color: var(--amber-ink); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-family: var(--font-display); font-size: 22px; font-variant-numeric: tabular-nums; } .stat span { color: var(--muted); font-size: 12.5px; }

/* ---------- agenda ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(158px, 1fr)); gap: 10px; overflow: auto; padding-bottom: 6px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: 180px; padding: 10px; }
.day h3 { margin: 0 0 8px; font-size: 13px; font-weight: 650; display: flex; justify-content: space-between; }
.day.today { border-color: var(--sky); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sky) 20%, transparent); }
.ev { display: block; text-decoration: none; color: var(--ink); padding: 7px 9px; border-radius: 10px; margin-bottom: 6px; font-size: 12.5px; background: var(--brand-tint); border: 1px solid transparent; transition: transform .1s, box-shadow .15s; }
.ev:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); } .ev small { color: var(--muted); }
.ev.k-urgencia { background: var(--amber-tint); } .ev.k-primera_vez { background: var(--sky-tint); } .ev.k-pyp { background: var(--green-tint); } .ev.k-control { background: var(--surface-2); border-color: var(--line); }
.ev.s-cancelada, .ev.s-no_asistio { opacity: .5; text-decoration: line-through; }

/* ---------- entrada (login) con escena 3D ---------- */
body.auth { min-height: 100vh; margin: 0; overflow-x: hidden; color: #fff; background: radial-gradient(90% 70% at 15% 10%, #3a3fb8 0%, rgba(58,63,184,0) 60%), radial-gradient(70% 60% at 90% 100%, #0F8FD8 0%, rgba(15,143,216,0) 62%), linear-gradient(160deg, #161A5C 0%, #23267A 48%, #1b4f9b 100%); }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); align-items: center; gap: 24px; padding: 28px clamp(20px, 5vw, 64px); max-width: 1500px; margin: 0 auto; position: relative; }
.auth-stage { position: relative; min-height: 620px; display: grid; place-items: center; }
.auth-copy { position: absolute; left: 0; bottom: 8px; max-width: 460px; z-index: 2; }
.auth-copy h1 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.08; margin: 0 0 10px; font-weight: 750; text-shadow: 0 6px 30px rgba(8,10,50,.35); }
.auth-copy p { margin: 0; color: rgba(255,255,255,.82); font-size: 16px; max-width: 40ch; }
.auth-copy ul { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.auth-copy li { padding: 5px 12px; border-radius: 99px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); font-size: 13px; backdrop-filter: blur(4px); }
.persp { width: min(100%, 620px); height: 460px; perspective: 1300px; perspective-origin: 50% 40%; position: relative; margin-top: -150px; }
.tilt { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateX(calc(10deg + var(--rx, 0deg))) rotateY(var(--ry, 0deg)); transition: transform .25s ease-out; }
.sway { position: absolute; inset: 0; transform-style: preserve-3d; animation: sway 14s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotateY(-16deg) rotateZ(-1deg); } to { transform: rotateY(16deg) rotateZ(1deg); } }
.glow { position: absolute; left: 50%; top: 52%; width: 520px; height: 520px; transform: translate(-50%, -50%); background: radial-gradient(closest-side, rgba(15,143,216,.55), rgba(15,143,216,0)); filter: blur(10px); }
.floor { position: absolute; left: 50%; top: 82%; width: 420px; height: 70px; transform: translateX(-50%) translateZ(-60px); background: radial-gradient(closest-side, rgba(6,8,45,.55), rgba(6,8,45,0)); filter: blur(6px); }
.ring3d { position: absolute; left: 50%; top: 50%; width: 470px; height: 340px; margin: -170px 0 0 -235px; transform-style: preserve-3d; transform: rotateX(58deg) rotateZ(-22deg); animation: spin 26s linear infinite; }
.ring3d i { position: absolute; inset: 0; border-radius: 50%; border: 16px solid #2E3192; background: transparent; box-shadow: 0 0 22px rgba(90, 130, 255, .45), inset 0 0 14px rgba(140, 180, 255, .4); }
.ring3d i:nth-child(odd) { border-color: #3a3fb8; }
@keyframes spin { to { transform: rotateX(58deg) rotateZ(338deg); } }
.tooth3d { position: absolute; left: 50%; top: 50%; width: 200px; height: 240px; margin: -130px 0 0 -100px; transform-style: preserve-3d; animation: bob 6s ease-in-out infinite; }
.tooth3d svg { position: absolute; inset: 0; width: 100%; height: 100%; }
@keyframes bob { 0%, 100% { transform: translateY(-6px) rotateY(0deg); } 50% { transform: translateY(8px) rotateY(10deg); } }
.plus3d { position: absolute; transform-style: preserve-3d; }
.plus3d.red { left: 8%; top: 8%; animation: bob2 7s ease-in-out infinite; } .plus3d.green { right: 6%; top: 2%; animation: bob2 8s ease-in-out -2s infinite; }
@keyframes bob2 { 0%, 100% { transform: translateY(0) rotateY(-18deg) rotateX(8deg); } 50% { transform: translateY(-14px) rotateY(18deg) rotateX(-6deg); } }
.cub { position: absolute; transform-style: preserve-3d; }
.cub .f { position: absolute; background: var(--c); }
.cub .f.fr { background: linear-gradient(140deg, rgba(255,255,255,.38), rgba(255,255,255,0) 45%), var(--c); }
.cub .f.bk, .cub .f.lf { filter: brightness(.7); } .cub .f.rt { filter: brightness(.82); } .cub .f.tp { filter: brightness(1.18); } .cub .f.bt { filter: brightness(.6); }
.sparkle { position: absolute; border-radius: 50%; background: rgba(255,255,255,.85); box-shadow: 0 0 14px 3px rgba(255,255,255,.5); animation: tw 4s ease-in-out infinite; }
@keyframes tw { 0%, 100% { opacity: .15; transform: scale(.6); } 50% { opacity: 1; transform: scale(1); } }
.auth-card { position: relative; z-index: 3; background: color-mix(in srgb, var(--surface) 94%, transparent); color: var(--ink); border: 1px solid rgba(255,255,255,.55); border-radius: 24px; padding: 30px 30px 26px; max-width: 440px; width: 100%; margin-left: auto; box-shadow: 0 40px 80px -30px rgba(5,7,40,.7), 0 2px 0 rgba(255,255,255,.4) inset; backdrop-filter: blur(14px); }
.auth-card .brand-img { display: block; width: 100%; max-width: 250px; margin: 0 auto 6px; }
.auth-card h2 { text-align: center; font-size: 20px; margin: 6px 0 2px; } .auth-card .sub-t { text-align: center; color: var(--muted); margin: 0 0 18px; }
.auth-card .field { display: block; margin-bottom: 14px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 12px 16px; font-size: 15px; border-radius: 12px; background: linear-gradient(135deg, #2E3192, #3b44c9); color: #fff; box-shadow: 0 10px 24px -10px rgba(46,49,146,.8); }
.auth-card .btn:hover { filter: brightness(1.08); }
.auth-card .foot { text-align: center; color: var(--muted); font-size: 12px; margin: 16px 0 0; }
.legal { position: absolute; left: clamp(20px, 5vw, 64px); bottom: 14px; font-size: 12px; color: rgba(255,255,255,.6); }

/* ---------- bioseguridad ---------- */
.chip-i { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-tint); color: var(--link); flex: none; }
.tabs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0 0 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.tab { border: 0; background: transparent; color: var(--ink-2); font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 10px; cursor: pointer; }
.tab:hover { background: var(--surface-2); } .tab.on { background: var(--brand-tint); color: var(--link); }
.mgrid th.c { text-align: center; } .mgrid td { padding: 5px 8px; } .mgrid tr.wk td { background: var(--surface-2); }
.mgrid input { padding: 6px 8px; border-radius: 8px; } .mgrid input.num { width: 84px; text-align: right; }
.mgrid input.bad { border-color: var(--red); background: var(--red-tint); color: var(--red-ink); font-weight: 650; }
.mgrid input:disabled { background: transparent; border-color: transparent; }
.pkg-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px auto; gap: 10px; align-items: end; margin-bottom: 8px; }

/* ---------- inventario ---------- */
.exp-r { color: var(--red-ink); font-weight: 650; } .exp-a { color: var(--amber-ink); font-weight: 600; } .exp-g { color: var(--green-ink); }
dialog { border: 0; border-radius: 18px; padding: 22px; width: min(430px, 92vw); background: var(--surface); color: var(--ink); box-shadow: 0 30px 70px -20px rgba(5,7,40,.6); }
dialog::backdrop { background: rgba(8,10,40,.5); backdrop-filter: blur(2px); }

/* ---------- cuadre de caja ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.chip { padding: 8px 16px; border: 1px solid var(--line-2); border-radius: 99px; background: var(--surface); color: var(--ink-2); text-decoration: none; font-weight: 550; transition: background .15s; }
.chip:hover { background: var(--surface-2); } .chip.on { background: var(--brand-tint); color: var(--link); border-color: color-mix(in srgb, var(--link) 35%, transparent); font-weight: 650; }
.v-in { color: var(--green-ink); } .v-out { color: var(--red-ink); }
tfoot td { background: var(--surface-2); border-top: 1px solid var(--line); } tfoot tr.tot td { font-size: 15px; border-top: 2px solid var(--line-2); }
details.card > summary { list-style-position: inside; }

/* ---------- ficha de paciente ---------- */
.pt-wrap { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.pt-side { position: sticky; top: 12px; padding: 0; overflow: hidden; }
.pt-id { text-align: center; padding: 22px 18px 14px; border-bottom: 1px solid var(--line); position: relative; }
.pt-av { width: 104px; height: 104px; border-radius: 50%; object-fit: cover; margin: 0 auto 10px; display: block; }
.pt-ini { display: flex; align-items: center; justify-content: center; background: var(--brand-tint); color: var(--link); font-size: 36px; font-weight: 700; }
.pt-act { position: absolute; top: 10px; right: 10px; }
.icon-btn { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; border: 1px solid var(--line-2); border-radius: 50%; color: var(--ink-2); text-decoration: none; }
.pt-name { font-size: 16px; margin: 4px 0 2px; line-height: 1.25; } .pt-sub { font-size: 12px; color: var(--ink-3, #8a90a8); letter-spacing: .04em; }
.pt-dl { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 9px 10px; margin: 0; padding: 16px 18px; font-size: 13.5px; }
.pt-dl dt { color: var(--ink-2); } .pt-dl dd { margin: 0; overflow-wrap: anywhere; }
.pt-btns { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 18px 18px; }
.pt-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; } .pt-main > .card, .pt-main > .stats { margin: 0; }
.hc { padding: 0; } .hc > h2 { margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--line); font-size: 16px; }
.hc-sec { border-bottom: 1px solid var(--line); } .hc-sec:last-child { border-bottom: 0; }
.hc-sec > summary { display: flex; align-items: center; gap: 10px; padding: 12px 20px; cursor: pointer; list-style: none; min-height: 28px; }
.hc-sec > summary::-webkit-details-marker, .hc-item > summary::-webkit-details-marker { display: none; }
.hc-chev { width: 8px; height: 8px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(-45deg); transition: transform .15s; margin-right: 6px; flex: none; }
details[open] > summary > .hc-chev { transform: rotate(45deg); }
.hc-n { background: var(--surface-2); border-radius: 99px; font-size: 11px; padding: 1px 8px; color: var(--ink-2); } .hc-sp { flex: 1; }
.btn.soft { background: var(--brand-tint); color: var(--link); border: 0; }
.hc-list { padding: 0 20px 14px 38px; display: flex; flex-direction: column; gap: 6px; }
.hc-item { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.hc-item > summary { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 9px 12px; cursor: pointer; list-style: none; }
a.hc-link { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 9px 12px; text-decoration: none; color: inherit; transition: background .12s; }
a.hc-link:hover { background: var(--surface-2); } .hc-go { margin-left: auto; color: var(--link); font-size: 12.5px; font-weight: 600; }
.hc-det { max-width: 920px; } .hc-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 12px; } .hc-head h1 { margin: 6px 0 2px; font-size: 20px; } .hc-clinic { color: var(--ink-2); font-weight: 650; text-align: right; }
.hc-det .hc-body { border-top: 0; padding: 0 0 8px; } .hc-det .hc-dl { grid-template-columns: 190px minmax(0, 1fr); font-size: 14.5px; gap: 10px 16px; }
@media print { .sidebar, .toolbar, .topbar { display: none !important; } .hc-det { box-shadow: none; border: 0; max-width: none; } }
.pt-main .card { overflow-x: auto; } .pt-main .grid2 > .card { min-width: 0; }
.hc-proc { width: 100%; font-size: 13px; } .hc-proc th, .hc-proc td { padding: 5px 8px; text-align: left; } .hc-proc .r { text-align: right; white-space: nowrap; }
/* presupuesto (detalle) */
.bud { max-width: 1060px; } .bud-top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.bud-crumb { font-size: 13.5px; color: var(--ink-2); } .bud-crumb a { color: inherit; text-decoration: none; } .bud h1 { font-size: 22px; margin: 4px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bud-act { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 650; padding: 2px 10px; border-radius: 99px; } .pill-ok { background: #e3f4e6; color: #2e7d32; } .pill-warn { background: #fdf0cf; color: #b7791f; }
.bud-card { padding: 0; overflow: hidden; } .bud-h { display: flex; gap: 12px; align-items: center; padding: 18px 20px; font-weight: 700; border-bottom: 1px solid var(--line); }
.bud-ico { width: 32px; height: 32px; border-radius: 8px; background: var(--brand-tint); color: var(--link); display: inline-flex; align-items: center; justify-content: center; }
.bud-sec { padding: 16px 20px; border-bottom: 1px solid var(--line); } .bud-sec.flush { padding: 16px 0 0; } .bud-lbl { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 10px; } .bud-lbl.pad { padding: 0 20px; }
.bud-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } .bud-tile { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 14px; } .bud-tile.wide { margin-bottom: 10px; }
.bud-tile b { display: block; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 6px; }
.bud-t { width: 100%; border-collapse: collapse; font-size: 13.5px; } .bud-t th { text-align: left; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 10px 20px; border-bottom: 1px solid var(--line); } .bud-t td { padding: 14px 20px; border-bottom: 1px solid var(--line); } .bud-t .r { text-align: right; white-space: nowrap; } .bud-t .c { text-align: center; white-space: nowrap; } .bud-t tbody tr:hover { background: var(--surface-2); }
.bud-tot { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding: 14px 20px; } .bud-tot > div { display: flex; justify-content: space-between; width: 240px; } .bud-tot .big { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 700; font-size: 17px; color: var(--link); }
@media (max-width: 720px) { .bud-tiles { grid-template-columns: 1fr; } }
@media print { .bud-act, .toolbar { display: none !important; } }
.bud-body.pad { padding: 16px 20px; } .bud-txt { padding: 16px 20px; line-height: 1.6; } .bud-body .bud-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } @media (max-width: 900px) { .bud-body .bud-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pt-tabs { display: flex; gap: 4px; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 8px; margin-bottom: 16px; }
.pt-tabs a { padding: 14px 16px; white-space: nowrap; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; font-weight: 550; } .pt-tabs a:hover { color: var(--ink); } .pt-tabs a.on { color: var(--link); border-bottom-color: var(--link); font-weight: 700; }
.alert-row { padding: 11px 14px; border-radius: 10px; margin-bottom: 8px; border: 1px solid var(--line); border-left-width: 4px; background: var(--surface-2); } .al-danger { border-left-color: #ED1C24; } .al-warn { border-left-color: #e0a100; } .al-info { border-left-color: #0F8FD8; }
.ihce-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 16px; } .ihce-list .ok { color: #2e7d32; } .ihce-list .no { color: #ED1C24; }
td.r, th.r { text-align: right; }
.cgrid-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; } .cgrid { border-collapse: collapse; font-size: 12.5px; width: max-content; min-width: 100%; }
.cgrid th, .cgrid td { border: 1px solid var(--line); padding: 3px; text-align: center; } .cgrid thead th { background: var(--surface-2); font-weight: 650; } .cgrid th small { display: block; font-weight: 500; color: var(--muted); font-size: 10px; }
.cgrid th.wk { background: var(--brand-tint); } .cgrid th.mt { font-size: 11px; color: var(--ink-2); min-width: 40px; } .cgrid th.lab { position: sticky; left: 0; background: var(--surface-2); z-index: 1; min-width: 56px; }
.cgrid input.cin { width: 38px; padding: 5px 2px; text-align: center; border-radius: 6px; font-size: 12px; -moz-appearance: textfield; } .cgrid input.cin::-webkit-outer-spin-button, .cgrid input.cin::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cgrid input.cin.bad { border-color: var(--red); background: var(--red-tint); color: var(--red-ink); font-weight: 650; } .cgrid input.cin:disabled { background: transparent; border-color: transparent; }
.cgrid tr.resp td { height: 96px; vertical-align: middle; background: var(--surface-2); } .cgrid tr.resp td span, .cgrid tr.resp th span { writing-mode: vertical-rl; transform: rotate(180deg); display: inline-block; font-size: 11px; white-space: nowrap; }
.clima-obs { display: grid; margin-top: 16px; } .clima-obs form { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 12px; align-items: start; } .clima-obs textarea { width: 100%; } .obs-btns { display: flex; flex-direction: column; gap: 8px; padding-top: 22px; } .obs-btns .btn { text-align: center; }
@media (max-width: 720px) { .clima-obs form { grid-template-columns: 1fr; } .obs-btns { padding-top: 0; } }
.hc-item.flat { display: flex; gap: 12px; padding: 9px 12px; }
.hc-d { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; } .hc-t { font-weight: 550; } .hc-m { color: var(--ink-2); font-size: 12.5px; }
.hc-body { padding: 4px 14px 14px; border-top: 1px dashed var(--line); }
.hc-dl { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 14px; margin: 10px 0 0; font-size: 13.5px; }
.hc-dl dt { color: var(--ink-2); } .hc-dl dd { margin: 0; overflow-wrap: anywhere; }
.hc-raw { margin-top: 10px; white-space: normal; font-size: 13.5px; }
@media (max-width: 900px) { .pt-wrap { grid-template-columns: 1fr; } .pt-side { position: static; } .hc-dl { grid-template-columns: 1fr; } .hc-list { padding-left: 20px; } }

/* ---------- responsive ---------- */
@media (max-width: 1060px) {
  .auth-wrap { grid-template-columns: 1fr; padding-top: 12px; gap: 0; }
  .auth-stage { min-height: 340px; } .persp { height: 330px; margin-top: 0; transform: scale(.7); transform-origin: 50% 20%; }
  .auth-copy { position: static; text-align: center; margin: -40px auto 14px; } .auth-copy p { margin: 0 auto; } .auth-copy ul { justify-content: center; }
  .auth-card { margin: 0 auto 40px; } .legal { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 276px; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow); height: 100dvh; }
  body.nav-open .side { transform: none; } body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(8,10,40,.45); z-index: 25; }
  .burger { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; }
  main { padding: 0 max(14px, env(safe-area-inset-left, 0px)) 32px max(14px, env(safe-area-inset-right, 0px)); } .top h1 { font-size: 20px; } .search { width: 44vw; }
  .hero { padding: 20px; } .hero h2 { font-size: 21px; } .hero .deco { width: 120px; height: 120px; opacity: .6; }
}
@media (max-width: 520px) { .hero .deco { display: none; } .search { display: none; } .tiles { grid-template-columns: 1fr 1fr; } .tile { flex-direction: column; align-items: flex-start; } }
@media (prefers-reduced-motion: reduce) { .sway, .ring3d, .tooth3d, .plus3d, .sparkle, .gem, .gem-halo, .gp3d, .tooth-aura, .tsweep, .gspark { animation: none !important; } .tilt { transition: none; } .btn, .ev, .side { transition: none; } }
