/* ==========================================================================
   Dental Home — sistema de diseño
   Paleta, tipografía y movimiento tomados del landing: morado #4A2E80, acento
   #7B1FA2, lavanda #B39DDB · Manrope + Montserrat · curva cubic-bezier(.2,.8,.2,1)
   ========================================================================== */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("/static/vendor/fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600 800; font-display: swap;
  src: url("/static/vendor/fonts/montserrat-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f8f9fc;
  --surface: #ffffff;
  --surface-2: #f1f2f7;
  --surface-3: #e7e9f2;
  --ink: #1e2433;
  --ink-2: #424b60;
  --muted: #68738a;
  --line: #e6e9f2;
  --line-2: #d5dbe8;
  --brand: #635ba6;
  --brand-deep: #4c4688;
  --brand-hover: #5b5399;
  --brand-accent: #635ba6;
  --brand-2: #a8a3d8;
  --brand-soft: #eef0fa;
  --brand-ink: #3f3a73;
  --on-brand: #ffffff;
  --ok: #1f7a53;
  --ok-soft: #e8f6ef;
  --warn: #9a6210;
  --warn-soft: #fdf4e3;
  --bad: #b83b5e;
  --bad-soft: #fbe9ef;
  --info-soft: #eef0fa;
  --shadow-sm: 0 1px 2px rgba(30, 36, 51, .05);
  --shadow: 0 18px 40px -24px rgba(30, 36, 51, .28);
  --shadow-lg: 0 36px 70px -32px rgba(30, 36, 51, .35), 0 0 0 1px var(--line);
  --grad: linear-gradient(135deg, #4c4688 0%, #6b64b3 100%);
  --r: 20px;
  --r-sm: 14px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-marca: "Montserrat", var(--font);
  --logo: url("/static/img/logo.png");
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #11131a;
  --surface: #181b25;
  --surface-2: #202432;
  --surface-3: #282d3e;
  --ink: #edf0f7;
  --ink-2: #c6cddc;
  --muted: #8e97ad;
  --line: #272c3c;
  --line-2: #343b50;
  --brand: #a9a4e0;
  --brand-deep: #5a539c;
  --brand-hover: #6c65b0;
  --brand-accent: #6861ab;
  --brand-2: #9892d0;
  --brand-soft: #23253a;
  --brand-ink: #d4d1f5;
  --ok: #60c898;
  --ok-soft: #132a21;
  --warn: #e5b25d;
  --warn-soft: #2d2312;
  --bad: #e87a98;
  --bad-soft: #311722;
  --info-soft: #212438;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 20px 44px -22px rgba(0, 0, 0, .6);
  --shadow-lg: 0 40px 80px -36px rgba(0, 0, 0, .7), 0 0 0 1px var(--line);
  --grad: linear-gradient(135deg, #5a539c 0%, #7a73bf 100%);
  --logo: url("/static/img/logo-oscuro.png");
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 500 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.025em; line-height: 1.12; font-weight: 800; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
[x-cloak] { display: none !important; }
::selection { background: color-mix(in srgb, var(--brand-2) 45%, transparent); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i.lg { width: 22px; height: 22px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 10px; }

/* ---------- movimiento (vocabulario del landing) ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(36px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes rise-sm { from { opacity: 0; transform: translateY(14px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes floaty2 { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(10px); } }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pc, #7b1fa2) 45%, transparent); } 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes grow { from { transform: scaleY(.15); } to { transform: scaleY(1); } }
@keyframes sparkle { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes wave { from { transform: translateX(0); } to { transform: translateX(-120px); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ring { from { stroke-dashoffset: var(--len); } }
.view > * { animation: rise .8s var(--ease) both; }
.stagger > * { animation: rise-sm .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }
.in1 { animation: rise .9s var(--ease) both .05s; }
.in2 { animation: rise .9s var(--ease) both .18s; }
.in3 { animation: rise .9s var(--ease) both .3s; }
.in4 { animation: rise 1.1s var(--ease) both .42s; }
.float1 { animation: floaty 6s ease-in-out infinite; }
.float2 { animation: floaty2 7s ease-in-out infinite; }
.pulse { animation: pulse 2s infinite; }
.spark { animation: sparkle 2.4s ease-in-out infinite; }
.blink { animation: blink 1.6s ease-in-out infinite; }
.dot-live { width: 9px; height: 9px; border-radius: 50%; background: var(--pc, var(--brand)); flex: none; animation: pulse 2s infinite; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- botones ---------- */
.btn {
  --h: 42px; position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 18px; border-radius: 999px; border: 0; background: var(--surface); color: var(--brand-ink);
  box-shadow: inset 0 0 0 1.5px var(--line-2); font-weight: 700; font-size: 14px; white-space: nowrap; user-select: none;
  transition: transform .35s var(--ease), box-shadow .35s, background .3s, color .3s, opacity .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1.5px var(--brand-2); }
.btn:active { transform: translateY(0) scale(.97); }
.btn[disabled], .btn.is-busy { opacity: .55; pointer-events: none; }
.btn.primary { background: var(--brand-deep); color: #fff; box-shadow: 0 10px 30px -10px rgba(74, 46, 128, .65); }
.btn.primary:hover { background: var(--brand-hover); box-shadow: 0 18px 40px -12px rgba(123, 31, 162, .7); }
.btn.primary::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent); transform: skewX(-20deg); transition: left .7s ease; }
.btn.primary:hover::after { left: 130%; }
.btn.ghost { background: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--brand-ink); box-shadow: none; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); color: var(--bad); box-shadow: none; }
.btn.danger-fill { background: var(--bad); color: #fff; box-shadow: none; }
/* WhatsApp */
.btn.wa { color: var(--ok); }
.btn.wa:hover { background: var(--ok-soft); color: var(--ok); }
.btn.wa-fill, a.btn.wa-fill { background: #25d366; color: #0b3d1f; box-shadow: none; }
.btn.wa-fill:hover, a.btn.wa-fill:hover { background: #1ebe5b; color: #0b3d1f; }
.btn.sm { --h: 34px; padding: 0 13px; font-size: 13px; }
.btn.lg { --h: 52px; padding: 0 26px; font-size: 16px; }
.btn.icon { width: var(--h); padding: 0; }
.btn .arr { transition: transform .35s var(--ease); }
.btn:hover .arr { transform: translateX(4px); }
.btn.is-busy::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }

/* ---------- formularios ---------- */
.field { display: grid; gap: 6px; }
.field > label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%; height: 46px; padding: 0 16px; border-radius: var(--r-sm); border: 1.5px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; transition: border-color .25s, box-shadow .25s;
  appearance: none; -webkit-appearance: none;
}
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%236b5f80' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 38px; }
textarea.input { height: auto; min-height: 96px; padding: 12px 16px; resize: vertical; line-height: 1.5; }
.input:hover { border-color: var(--brand-2); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.input::placeholder { color: var(--muted); opacity: .85; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.filtros-auditoria { grid-template-columns: 1fr 1fr 1.2fr 1.2fr auto; }
.hint { font-size: 12.5px; color: var(--muted); }
.error-text { color: var(--bad); font-size: 13.5px; font-weight: 600; background: var(--bad-soft); padding: 11px 15px; border-radius: 12px; animation: rise-sm .35s var(--ease); }
.ok-text { color: var(--ok); font-size: 13.5px; font-weight: 600; background: var(--ok-soft); padding: 11px 15px; border-radius: 12px; animation: rise-sm .35s var(--ease); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--brand); width: 17px; height: 17px; margin-top: 2px; }

/* ---------- superficies ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; box-shadow: var(--shadow-sm); }
.card.hover { transition: transform .5s var(--ease), box-shadow .5s; }
.card.hover:hover { transform: translateY(-6px); box-shadow: 0 30px 60px -30px rgba(74, 46, 128, .45); }
.card.soft { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.card.deep { background: var(--brand-deep); color: #fff; border-color: transparent; }
.card h3 { font-size: 16px; font-weight: 800; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.tile { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; transition: transform .5s var(--ease); }
.tile.deep { background: var(--brand-deep); color: #fff; }
.tile.accent { background: var(--brand-accent); color: #fff; }
.tile.outline { background: var(--surface); box-shadow: 0 0 0 1px var(--line-2); }
.hover:hover .tile { transform: scale(1.08) rotate(-4deg); }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 25px; padding: 0 11px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.badge.deep { background: var(--brand-deep); color: #fff; }
.badge.plain::before { display: none; }

.avatar { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--brand-ink); background: var(--surface-3); flex: none; }
.avatar.sm { width: 32px; height: 32px; font-size: 11px; border-radius: 11px; }
.avatar.lg { width: 60px; height: 60px; font-size: 20px; border-radius: 20px; background: var(--brand-deep); color: #fff; }

.seg { display: inline-flex; padding: 4px; background: var(--surface-2); border-radius: 999px; gap: 2px; box-shadow: inset 0 0 0 1px var(--line-2); }
.seg button { border: 0; background: transparent; padding: 0 16px; height: 34px; border-radius: 999px; font-size: 13.5px; font-weight: 700; color: var(--brand-ink); transition: background .3s, color .3s; }
.seg button:hover { color: var(--brand); }
.seg button.on { background: var(--brand-deep); color: #fff; }

.kbd { font: 700 11px var(--font); padding: 2px 7px; border-radius: 7px; box-shadow: inset 0 0 0 1px var(--line-2); background: var(--surface); color: var(--muted); }

/* ---------- tablas / listas ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 800; color: var(--brand); text-transform: uppercase; letter-spacing: .1em; padding: 0 14px 12px; }
.table td { padding: 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .25s; animation: rise-sm .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
.table tbody tr:hover { background: var(--surface-2); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity .25s; }
tr:hover .row-actions, .row-actions:focus-within { opacity: 1; }
.cell-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-user strong { display: block; font-weight: 700; }
.cell-user span { font-size: 13px; color: var(--muted); }
.table-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }

.empty { display: grid; place-items: center; text-align: center; gap: 10px; padding: 56px 20px; color: var(--muted); }
.empty .art { width: 110px; height: auto; margin-bottom: 4px; }
.empty h3 { color: var(--ink); font-size: 18px; }
.skel { background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 12px; min-height: 16px; }

/* ---------- marca ---------- */
.marca { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.marca .logo { width: 38px; height: 37px; background: var(--logo) center / contain no-repeat; flex: none; }
.marca .word { font-family: var(--font-marca); font-weight: 700; font-size: 17px; letter-spacing: .04em; color: var(--brand-ink); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); border-right: 1px solid var(--line); }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 14px; border-radius: 14px; color: var(--ink-2); font-weight: 700; font-size: 14.5px; transition: background .25s, color .25s, transform .35s var(--ease); }
.nav a:hover { background: var(--surface-2); color: var(--brand); transform: translateX(3px); }
.nav a.on { background: var(--brand-deep); color: #fff; box-shadow: 0 10px 24px -12px rgba(74, 46, 128, .7); }
.side-foot { margin-top: auto; display: grid; gap: 10px; }
.usage { padding: 16px; border-radius: 18px; background: var(--surface-2); font-size: 13px; display: grid; gap: 8px; }
.meter { height: 7px; border-radius: 9px; background: var(--line-2); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 9px; background: var(--grad); width: var(--w, 0%); transition: width 1.1s var(--ease); }
.meter.hot > i { background: linear-gradient(90deg, var(--warn), var(--bad)); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 32px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); border-bottom: 1px solid var(--line); }
.top .search { flex: 1; min-width: 0; max-width: 440px; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 14px; border-radius: 999px; border: 0; box-shadow: inset 0 0 0 1.5px var(--line-2); background: var(--surface); color: var(--muted); text-align: left; transition: box-shadow .25s; }
.top .search:hover { box-shadow: inset 0 0 0 1.5px var(--brand-2); }
.top .search span:not(.kbd) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .spacer { flex: 1; }
.page { padding: 12px 32px 64px; width: 100%; max-width: 1240px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 14px 0 26px; flex-wrap: wrap; }
.page-head h1 { font-size: 32px; letter-spacing: -.035em; }
.page-head p { color: var(--muted); margin-top: 6px; }
.kicker { font-size: 12.5px; font-weight: 800; color: var(--brand); text-transform: uppercase; letter-spacing: .12em; }
.banner { margin: 12px 32px 0; padding: 12px 18px; border-radius: 16px; display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; background: var(--brand-soft); color: var(--brand-ink); box-shadow: inset 0 0 0 1px var(--line-2); animation: rise-sm .6s var(--ease); }
.banner.bad { background: var(--bad-soft); color: var(--bad); box-shadow: none; }
.banner a { margin-left: auto; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.tabbar { display: none; }
.hide-d { display: none; }

.grid-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat { display: grid; gap: 2px; position: relative; overflow: hidden; }
.stat .k { font-size: 13px; color: var(--muted); font-weight: 700; }
.stat .v { font-size: 36px; font-weight: 800; letter-spacing: -.04em; line-height: 1.1; }
.stat .tile { position: absolute; right: 18px; top: 18px; }
.cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.cols > * { min-width: 0; }
.cols-par { grid-template-columns: 1fr 1fr; }
.cols-form { grid-template-columns: 1fr 1.25fr; }
.cols-ancha { grid-template-columns: 1.2fr 1fr; }
.cols-split { grid-template-columns: 1fr 1.15fr; align-items: stretch; }
.stack { display: grid; gap: 16px; }

.timeline { display: grid; gap: 8px; }
.tl-item { display: grid; grid-template-columns: 62px 4px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--surface); transition: background .25s, transform .35s var(--ease); }
.tl-item:hover { background: var(--surface-2); transform: translateX(3px); }
.tl-item .t { font-weight: 800; font-size: 14px; color: var(--brand-ink); }
.tl-item .t small { display: block; font-weight: 600; font-size: 11.5px; color: var(--muted); }
.tl-item .rail { align-self: stretch; border-radius: 4px; background: var(--rc, var(--brand)); }
.tl-item .who strong { font-weight: 700; display: block; }
.tl-item .who span { font-size: 13px; color: var(--muted); }
.tl-item.done .rail { --rc: var(--ok); }
.tl-item.cancel { opacity: .6; }
.tl-item.cancel .rail { --rc: var(--muted); }
.tl-item.cancel .who strong { text-decoration: line-through; }

.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; }
.bars .b { flex: 1; display: grid; gap: 8px; justify-items: center; height: 100%; align-content: end; font-size: 12px; font-weight: 700; color: var(--muted); }
.bars .b i { display: block; width: 100%; max-width: 40px; border-radius: 10px 10px 5px 5px; background: var(--brand-2); transform-origin: bottom; animation: grow 1.4s var(--ease) both; animation-delay: calc(.2s + var(--i) * 90ms); }
.bars .b.today i { background: var(--brand-deep); }
.bars .b em { font-style: normal; font-weight: 800; color: var(--ink); font-size: 12px; }

.ringbox { display: flex; align-items: center; gap: 18px; }
.ring { position: relative; width: 96px; height: 96px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring .bg { stroke: var(--surface-3); }
.ring .fg { stroke: url(#grad-ring); stroke-dasharray: var(--len); stroke-dashoffset: var(--off); animation: ring 1.4s var(--ease) both .2s; }
.ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 21px; font-weight: 800; letter-spacing: -.03em; }

.todo { display: grid; gap: 4px; }
.todo a { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; font-weight: 600; transition: background .25s; }
.todo a:hover { background: var(--surface-2); }
.todo .dot { width: 24px; height: 24px; border-radius: 9px; box-shadow: inset 0 0 0 1.5px var(--line-2); display: grid; place-items: center; color: #fff; transition: all .35s var(--ease); }
.todo .done .dot { background: var(--brand-deep); box-shadow: none; }
.todo .done span { color: var(--muted); text-decoration: line-through; }
.todo .dot svg { width: 13px; height: 13px; stroke-width: 3; }

.feed { display: grid; gap: 14px; margin: 0; padding: 0; }
.feed li { list-style: none; display: grid; grid-template-columns: 12px 1fr; gap: 12px; font-size: 14px; }
.feed li::before { content: ""; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--brand-2); }
.feed li:first-child::before { background: var(--brand); animation: pulse 2s infinite; }
.feed small { color: var(--muted); display: block; font-weight: 600; }

/* ---------- modal / drawer / toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(30, 20, 51, .42); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; animation: fade .25s; overflow: auto; }
.overlay.right { place-items: stretch end; padding: 0; }
.modal { width: min(540px, 100%); background: var(--surface); border-radius: 28px; padding: 30px; box-shadow: var(--shadow-lg); animation: rise .5s var(--ease); }
.modal.wide { width: min(700px, 100%); }
.drawer { width: min(500px, 100%); background: var(--surface); height: 100%; padding: 30px; box-shadow: var(--shadow-lg); animation: slide .5s var(--ease); overflow: auto; }
.modal h2, .drawer h2 { font-size: 23px; margin-bottom: 4px; letter-spacing: -.03em; }
.modal .sub, .drawer .sub { color: var(--muted); margin-bottom: 22px; }
.form { display: grid; gap: 16px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: grid; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 14px 18px; min-width: 260px; max-width: 400px; background: var(--brand-deep); color: #fff; border-radius: 18px; box-shadow: 0 24px 50px -20px rgba(74, 46, 128, .7); font-size: 14px; font-weight: 600; animation: rise .5s var(--ease); }
.toast .i { color: var(--brand-2); }
.toast.error { background: var(--bad); box-shadow: none; }
.toast.error .i { color: #fff; }

.cmdk { width: min(600px, 100%); background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-lg); overflow: hidden; animation: rise .45s var(--ease); align-self: start; margin-top: 12vh; }
.cmdk input { width: 100%; height: 60px; border: 0; outline: 0; background: transparent; padding: 0 22px; font: inherit; font-size: 16px; color: var(--ink); border-bottom: 1px solid var(--line); }
.cmdk ul { list-style: none; margin: 0; padding: 8px; max-height: 340px; overflow: auto; }
.cmdk li { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; cursor: pointer; font-weight: 600; }
.cmdk li.on { background: var(--brand-deep); color: #fff; }
.cmdk li small { margin-left: auto; opacity: .7; }
.cmdk .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--brand); font-weight: 800; padding: 10px 14px 4px; cursor: default; }

/* ---------- agenda ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .grow { flex: 1; }
.datenav { display: flex; align-items: center; gap: 4px; }
.datenav h2 { font-size: 19px; min-width: 200px; text-align: center; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.day-col { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 12px; min-height: 230px; display: grid; gap: 8px; align-content: start; transition: border-color .25s; }
.day-col.today { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 30%, transparent); }
.day-col header { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 800; color: var(--brand-2); text-transform: uppercase; letter-spacing: .06em; cursor: pointer; }
.day-col header b { font-size: 21px; color: var(--ink); letter-spacing: -.02em; }
.chip-cita { padding: 8px 10px; border-radius: 12px; background: var(--brand-deep); color: #fff; font-size: 12px; line-height: 1.3; cursor: pointer; transition: transform .35s var(--ease); font-weight: 700; }
.chip-cita:hover { transform: translateY(-2px); }
.chip-cita span { display: block; font-weight: 600; opacity: .85; }
.chip-cita.completada { background: var(--brand-2); color: var(--ink); }
.chip-cita.cancelada { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.month .dow { font-size: 12px; color: var(--brand-2); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; text-align: center; padding-bottom: 6px; }
.mcell { aspect-ratio: 1.15; min-height: 76px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); padding: 8px 10px; display: flex; flex-direction: column; justify-content: space-between; transition: transform .35s var(--ease), border-color .25s; text-align: left; }
.mcell:hover { transform: translateY(-3px); border-color: var(--brand-2); }
.mcell.off { opacity: .4; background: transparent; }
.mcell.today { border-color: var(--brand); }
.mcell.today b { color: var(--brand); }
.mcell i { font-style: normal; font-size: 11.5px; font-weight: 800; color: #fff; background: var(--brand-deep); border-radius: 99px; padding: 1px 8px; align-self: flex-start; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; }
.slot { height: 38px; border-radius: 12px; border: 0; box-shadow: inset 0 0 0 1.5px var(--line-2); background: var(--surface); font-size: 13.5px; font-weight: 700; color: var(--brand-ink); transition: all .3s var(--ease); }
.slot:hover:not([disabled]) { box-shadow: inset 0 0 0 1.5px var(--brand); transform: translateY(-2px); }
.slot.on { background: var(--brand-deep); color: #fff; box-shadow: 0 10px 22px -10px rgba(74, 46, 128, .7); }
.slot[disabled] { opacity: .35; text-decoration: line-through; cursor: not-allowed; }
.picker { max-height: 200px; overflow: auto; border-radius: 16px; margin-top: 6px; box-shadow: inset 0 0 0 1.5px var(--line-2); padding: 4px; }
.picker button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 12px; background: transparent; text-align: left; font-weight: 600; transition: background .2s; }
.picker button:hover { background: var(--surface-2); }

/* ---------- historial / odontograma ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 22px; padding: 4px; border-radius: 999px; background: var(--surface-2); width: fit-content; max-width: 100%; overflow-x: auto; box-shadow: inset 0 0 0 1px var(--line-2); }
.tabs button { border: 0; background: transparent; height: 38px; padding: 0 18px; border-radius: 999px; font-weight: 700; color: var(--brand-ink); white-space: nowrap; transition: background .3s, color .3s; }
.tabs button.on { background: var(--brand-deep); color: #fff; }
.consult { position: relative; padding-left: 30px; padding-bottom: 22px; }
.consult::before { content: ""; position: absolute; left: 8px; top: 24px; bottom: 0; width: 2px; background: var(--line-2); }
.consult:last-child::before { display: none; }
.consult::after { content: ""; position: absolute; left: 0; top: 6px; width: 18px; height: 18px; border-radius: 7px; background: var(--brand-deep); box-shadow: 0 0 0 4px var(--bg); }
.consult .box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; display: grid; gap: 12px; }
.consult dl { margin: 0; display: grid; gap: 10px; }
.consult dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--brand); font-weight: 800; }
.consult dd { margin: 2px 0 0; }
.rx { padding: 14px 16px; border-radius: 16px; background: var(--surface-2); font-size: 13.5px; display: grid; gap: 4px; }
.odo-wrap { overflow-x: auto; padding-bottom: 4px; }
.odo { min-width: 780px; width: 100%; height: auto; display: block; }
.odo .face { cursor: pointer; transition: fill .3s var(--ease), filter .2s; }
.odo .face:hover { filter: brightness(.93) drop-shadow(0 0 3px rgba(123, 31, 162, .55)); }
.odo .fresh .mark, .odo .fresh .face { transform-box: fill-box; transform-origin: center; animation: rise-sm .45s var(--ease); }
.conds { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.cond { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; border: 0; box-shadow: inset 0 0 0 1.5px var(--line-2); background: var(--surface); font-size: 13px; font-weight: 700; color: var(--ink-2); transition: all .3s var(--ease); }
.cond i { width: 11px; height: 11px; border-radius: 4px; background: var(--c); }
.cond:hover { transform: translateY(-2px); }
.cond.on { box-shadow: inset 0 0 0 2px var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.cond small { font-weight: 600; color: var(--muted); }
.meds { display: grid; gap: 10px; }
.med-row { display: grid; grid-template-columns: 1.3fr .9fr 74px 1.6fr 36px; gap: 8px; position: relative; }
.pat-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.pat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.log { display: grid; gap: 2px; max-height: 320px; overflow: auto; }
.log div { display: grid; grid-template-columns: 120px 52px 1fr; gap: 10px; padding: 8px 10px; border-radius: 12px; font-size: 13px; }
.log div:nth-child(odd) { background: var(--surface-2); }

/* ---------- suscripción / equipo / auditoría ---------- */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: stretch; }
.plan { position: relative; display: flex; flex-direction: column; gap: 16px; padding: 32px 28px; border-radius: 30px; background: var(--surface-2); transition: transform .5s var(--ease), box-shadow .5s; }
.plan:hover { transform: translateY(-8px); }
.plan.hot { background: var(--brand-deep); color: #fff; box-shadow: 0 40px 80px -30px rgba(74, 46, 128, .7); }
.plan.hot .muted, .plan.hot li { color: #e1d5e7; }
.plan .tag { position: absolute; top: 22px; right: 22px; padding: 6px 12px; border-radius: 999px; background: #fff; color: #4a2e80; font-size: 12px; font-weight: 800; }
.plan .price { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.plan .price small { font-size: 15px; font-weight: 600; letter-spacing: 0; opacity: .75; }
.plan ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; flex: 1; }
.plan li { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; color: var(--ink-2); }
.plan li .i { color: var(--brand); margin-top: 2px; width: 18px; height: 18px; stroke-width: 2.4; }
.plan.hot li .i { color: var(--brand-2); }
.plan.hot .btn { background: #fff; color: #4a2e80; box-shadow: none; }
.member { display: flex; align-items: center; gap: 14px; padding: 18px 20px; }
.member .info { flex: 1; min-width: 0; }
.member .info strong { display: block; }
.member.off { opacity: .55; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.file-row { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-top: 1px solid var(--line); }
.file-row:first-child { border-top: 0; }
.file-row .grow { flex: 1; min-width: 0; }
.big-status { display: flex; align-items: center; gap: 18px; }
.audit td small { display: block; color: var(--muted); font-size: 12px; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.checkout { width: min(460px, 100%); margin: 8vh auto; }

/* ---------- autenticación ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--bg); }
.auth-form { display: grid; align-content: center; justify-items: center; padding: 40px 24px; }
.auth-form .inner { width: min(410px, 100%); display: grid; gap: 22px; }
.auth-form h1 { font-size: 34px; letter-spacing: -.035em; }
.auth-art { position: relative; overflow: hidden; margin: 16px; border-radius: 36px; background: #4a2e80; color: #fff; display: grid; place-items: center; padding: 48px; text-align: center; }
.auth-art::before { content: ""; position: absolute; top: -200px; left: 50%; transform: translateX(-50%); width: 760px; height: 520px; border-radius: 50%; background: radial-gradient(closest-side, rgba(179, 157, 219, .45), rgba(179, 157, 219, 0)); }
.auth-art .emblem { position: relative; width: 96px; height: 94px; border-radius: 26px; background: #fff url("/static/img/logo.png") center / 70% no-repeat; margin: 0 auto 28px; }
.auth-art blockquote { position: relative; margin: 0; max-width: 440px; font-size: 26px; line-height: 1.3; letter-spacing: -.03em; font-weight: 800; }
.auth-art blockquote small { display: block; margin-top: 16px; font-size: 15px; font-weight: 600; color: #e1d5e7; letter-spacing: 0; }
.auth-art .spark { position: absolute; fill: #b39ddb; }
.link { color: var(--brand); font-weight: 800; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .cols, .cols.cols-2, .cols.cols-split, .cols-par, .cols-form, .cols-ancha { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .top { padding: 12px 16px; }
  .page { padding: 6px 16px 112px; }
  .banner { margin: 10px 16px 0; }
  .tabbar { display: flex; position: fixed; z-index: 30; left: 12px; right: 12px; bottom: 12px; padding: 6px; border-radius: 24px; gap: 2px; background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--shadow-lg); }
  .tabbar a, .tabbar button { flex: 1; min-width: 60px; display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border: 0; background: transparent; border-radius: 18px; font: inherit; font-size: 10.5px; font-weight: 700; color: var(--muted); transition: all .3s; }
  .tabbar a.on, .tabbar button.on { background: var(--brand-deep); color: #fff; }
  .mas-hoja { align-items: end; padding: 12px 12px 96px; }
  .mas-hoja .modal { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px; }
  .mas-hoja a { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px; border-radius: 16px; background: var(--surface-2); font-weight: 700; color: var(--brand-ink); }
  .mas-hoja a.on { background: var(--brand-deep); color: #fff; }
  .plans { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .week { grid-template-columns: 1fr; }
  .day-col { min-height: 0; }
  .page-head h1 { font-size: 26px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .med-row { grid-template-columns: 1fr 70px 36px; }
  .med-row .pres, .med-row .ind { grid-column: 1 / -1; }
  .row-actions { opacity: 1; }
  .hide-m { display: none !important; }
  .hide-d { display: inline-flex; }
  .top .search .kbd { display: none; }
  .team-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .grid-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .v { font-size: 28px; }
  .stat .tile { display: none; }
  .datenav h2 { min-width: 0; font-size: 16px; }
  .toasts { left: 16px; right: 16px; bottom: 98px; }
  .toast { min-width: 0; max-width: none; }
  .tl-item { grid-template-columns: 50px 4px 1fr; }
  .tl-item > :last-child { grid-column: 3; }
}


/* =========================================
   SIDEBAR RETRÁCTIL (CSS Grid + sticky preservado)
   ========================================= */
.shell {
  --side-w: 256px;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  transition: grid-template-columns .28s var(--ease);
}
.shell.side-collapsed { --side-w: 76px; }
.shell .side { width: 100%; min-width: 0; overflow-x: hidden; overflow-y: auto; scrollbar-width: none; }
.shell .side::-webkit-scrollbar { display: none; }
.side-header { display: flex; align-items: center; justify-content: space-between; min-height: 46px; padding: 0 4px 16px; gap: 6px; }
.side-header .marca { padding: 0 4px; min-width: 0; flex: 1; overflow: hidden; }
.side-toggle { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border: 0; border-radius: 10px; color: var(--ink-2); background: transparent; transition: background .2s, transform .28s var(--ease); }
.side-toggle:hover { background: var(--surface-2); color: var(--brand); }
.shell .side .nav a { white-space: nowrap; overflow: hidden; }
.shell .side .nav a .i { flex: none; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; min-width: 0; }
.side-user .user-info { min-width: 0; flex: 1; overflow: hidden; }
.side-user .user-name, .side-user .user-role { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.shell.side-collapsed .side-header { flex-direction: column; justify-content: center; padding: 0 0 12px; }
.shell.side-collapsed .side-header .marca { display: none; }
.shell.side-collapsed .side-toggle { transform: rotate(180deg); }
.shell.side-collapsed .side .nav a { justify-content: center; padding: 0; gap: 0; }
.shell.side-collapsed .side .nav a span { display: none; }
.shell.side-collapsed .usage { display: none !important; }
.shell.side-collapsed .side-user { flex-direction: column; padding: 6px 0; gap: 6px; }
.shell.side-collapsed .side-user .user-info { display: none; }

@media (max-width: 900px) {
  .shell, .shell.side-collapsed { grid-template-columns: 1fr; }
}
@media (min-width: 901px) {
  .shell { overflow-x: clip; }
}

/* ---------- cobros, métodos de pago y adjuntos ---------- */
.pay-methods { display: flex; flex-wrap: wrap; gap: 8px; }
.pay-chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line-2); font-size: 13px; font-weight: 700; color: var(--ink-2); transition: all .25s var(--ease); }
.pay-chip:hover { box-shadow: inset 0 0 0 1.5px var(--brand-2); }
.pay-chip.on { background: var(--brand-deep); color: #fff; box-shadow: none; }
.badge.yape { background: #f3e5f5; color: #742284; }
.badge.plin { background: #e0f7fa; color: #006978; }
:root[data-theme="dark"] .badge.yape { background: #33183d; color: #e1a8f0; }
:root[data-theme="dark"] .badge.plin { background: #0f2c33; color: #7ae5f5; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.media-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; transition: transform .35s var(--ease), box-shadow .35s; }
.media-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.media-thumb { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; cursor: pointer; position: relative; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-meta { padding: 12px 14px; display: grid; gap: 4px; font-size: 13px; }
.media-meta strong { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-templates { display: flex; flex-wrap: wrap; gap: 6px; }
.wa-templates button { border: 0; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); color: var(--brand-ink); font-size: 12.5px; font-weight: 700; transition: background .2s, color .2s; }
.wa-templates button:hover, .wa-templates button.on { background: var(--ok-soft); color: var(--ok); }
.tl-item.sala .rail { --rc: var(--ok); }
.tl-item.conf .rail { --rc: var(--brand-deep); }
.chip-cita.en_sala { background: var(--ok); color: #fff; }
.chip-cita.confirmada { background: var(--brand); color: #fff; }

/* ---------- celular (360 px): nada se sale, toques de 48 px, letra de 16 en campos ---------- */
@media (max-width: 600px) {
  .input, select.input, textarea.input { font-size: 16px; height: 48px; }
  textarea.input { height: auto; }
  .btn, .btn.sm { --h: 48px; }
  .seg button, .tabs button { height: 48px; }
  .check { min-height: 48px; align-items: center; }
  .check input { width: 22px; height: 22px; margin-top: 0; }
  .link { display: inline-flex; align-items: center; min-height: 48px; }
  .member { flex-wrap: wrap; }
  .member .info { flex: 1 1 calc(100% - 80px); min-width: 0; overflow-wrap: anywhere; }
  .tabbar a, .tabbar button { min-height: 52px; }
  .top .search { height: 48px; }
  .banner a { display: inline-flex; align-items: center; min-height: 48px; white-space: nowrap; }
  .marca { min-height: 48px; }
}
