/* =====================================================================
   Plataforma — hoja de estilos
   Idea: la barra superior es la carpeta del expediente; la sección activa
   es la pestaña que se une con la hoja de trabajo.
   ===================================================================== */

:root {
  --paper: #ECF0EC;
  --sheet: #FFFFFF;
  --ink: #18261F;
  --ink-2: #4F6058;
  --ink-3: #7B8B84;
  --line: #D3DCD6;
  --line-2: #E5EBE7;

  --brand: #285646;
  --brand-d: #1D4236;
  --brand-l: #DCEAE2;
  --brand-t: #F2F7F4;
  --on-brand: #F3F8F5;

  --amber: #9A620A;  --amber-bg: #F8EDD5;
  --rose: #A23B34;   --rose-bg: #F7E1DD;
  --sky: #2B5884;    --sky-bg: #E2EBF4;
  --wa: #1D7F47;

  --r-sheet: 14px;
  --r-ctl: 8px;
  --sh-1: 0 1px 2px rgba(24, 38, 31, .06);
  --sh-2: 0 1px 2px rgba(24, 38, 31, .05), 0 12px 30px -16px rgba(24, 38, 31, .30);
  --sh-3: 0 30px 70px -24px rgba(14, 28, 22, .50), 0 2px 6px rgba(14, 28, 22, .10);

  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

.theme-admin {
  --brand: #2F3E5E;
  --brand-d: #243150;
  --brand-l: #DEE4F0;
  --brand-t: #F3F5FA;
  --paper: #ECEEF2;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "tnum" 1, "ss01" 1;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-d); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 27px; font-weight: 700; }
h2 { font-size: 19px; font-weight: 650; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: 0 0 .8em; }
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.ic { width: 18px; height: 18px; flex: none; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--sheet); padding: 8px 12px; border-radius: var(--r-ctl); z-index: 99; }
.skip:focus { left: 8px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt { margin-top: 18px; }
.hide { display: none !important; }

/* ---------------------------------------------------------------- barra superior */
.topbar {
  background: var(--brand);
  color: var(--on-brand);
  padding: 0 clamp(14px, 3vw, 32px);
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.topbar-row { display: flex; align-items: center; gap: 16px; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.brand:hover { color: #fff; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--on-brand); color: var(--brand); font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.brand-logo { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; background: #fff; }
.brand-name { font-weight: 650; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search-trigger {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 12px;
  border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.08); color: inherit;
  border-radius: var(--r-ctl); font: inherit; font-size: 14px; cursor: pointer; min-width: 220px;
  transition: background .15s;
}
.search-trigger:hover { background: rgba(255,255,255,.14); }
.search-trigger span { opacity: .85; }
.search-trigger kbd { margin-left: auto; }
kbd {
  font: 500 11px var(--font); padding: 2px 6px; border-radius: 5px;
  border: 1px solid currentColor; opacity: .6;
}

.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 6px 4px 4px; border-radius: 99px; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: rgba(255,255,255,.1); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.16); font-size: 12px; font-weight: 650; letter-spacing: .03em;
}
.usermenu-name { font-size: 14px; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 260px;
  background: var(--sheet); color: var(--ink); border-radius: 12px; box-shadow: var(--sh-3);
  padding: 6px; transform-origin: top right; animation: pop .16s var(--ease);
}
.menu-head { padding: 10px 10px 8px; margin: 0 0 4px; border-bottom: 1px solid var(--line-2); display: grid; }
.menu-head span { color: var(--ink-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.menu a, .menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none;
  color: var(--ink); text-decoration: none; font: inherit; font-size: 14px; border-radius: 8px; cursor: pointer; text-align: left;
}
.menu a:hover, .menu button:hover { background: var(--brand-t); color: var(--ink); }
.menu .ic { color: var(--ink-3); }

.nav-toggle { display: none; background: none; border: 0; color: inherit; padding: 6px; cursor: pointer; border-radius: 8px; }

/* pestañas: la activa se une con el escritorio */
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 0 4px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: flex; align-items: center; gap: 7px;
  padding: 9px 16px 11px; color: rgba(243, 248, 245, .78); text-decoration: none; font-size: 14.5px; font-weight: 500;
  border-radius: 10px 10px 0 0; white-space: nowrap; transition: color .15s, background .15s;
}
.tab:hover { color: #fff; background: rgba(255,255,255,.07); }
.tab.is-active { background: var(--paper); color: var(--ink); font-weight: 600; }
.tab.is-active::before, .tab.is-active::after {
  content: ""; position: absolute; bottom: 0; width: 10px; height: 10px; pointer-events: none;
}
.tab.is-active::before { left: -10px; background: radial-gradient(circle at 0 0, transparent 10px, var(--paper) 10.5px); }
.tab.is-active::after  { right: -10px; background: radial-gradient(circle at 100% 0, transparent 10px, var(--paper) 10.5px); }
.tab-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; font-size: 11.5px; font-weight: 650;
  display: grid; place-items: center; background: var(--amber-bg); color: var(--amber);
}

.banner {
  display: flex; gap: 10px; align-items: center; justify-content: center;
  background: var(--amber-bg); color: var(--amber); font-size: 14px; padding: 9px 16px; font-weight: 500;
}

/* ---------------------------------------------------------------- escritorio */
.desk { max-width: 1320px; margin: 0 auto; padding: 26px clamp(14px, 3vw, 32px) 64px; }
.desk > .page-head, .desk > .sheet, .desk > .grid, .desk > .stats { animation: rise .42s var(--ease) both; }
.desk > :nth-child(3) { animation-delay: .04s; }
.desk > :nth-child(4) { animation-delay: .08s; }
.desk > :nth-child(5) { animation-delay: .12s; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-sub { color: var(--ink-2); margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 2px; font-size: 14px; color: var(--ink-2); text-decoration: none; margin-bottom: 6px; }
.back .ic { width: 16px; height: 16px; }

.sheet {
  background: var(--sheet); border-radius: var(--r-sheet); box-shadow: var(--sh-2);
  border: 1px solid rgba(24, 38, 31, .05); margin-bottom: 18px; overflow: hidden;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.sheet-head .muted { font-size: 14px; }
.sheet-body { padding: 20px; }
.sheet-flat { box-shadow: none; border: 1px solid var(--line); }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
.grid > .sheet { margin-bottom: 0; }

/* cifras del día: tipografía, no tarjetas */
.stats { display: flex; gap: 0; margin: -4px 0 22px; flex-wrap: wrap; }
.stat { padding: 2px 28px 2px 0; margin-right: 28px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stat span { color: var(--ink-2); font-size: 14px; }
.stat.warn b { color: var(--amber); }
.stat.bad b { color: var(--rose); }

/* ---------------------------------------------------------------- botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: var(--r-ctl);
  border: 1px solid var(--line); background: var(--sheet); color: var(--ink);
  font: 500 14.5px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: var(--sh-1); transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.btn:hover { background: var(--brand-t); border-color: #C3CFC8; color: var(--ink); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn .ic { width: 17px; height: 17px; }
.btn-primary { background: var(--brand); border-color: var(--brand-d); color: var(--on-brand); box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 2px 6px -2px rgba(29, 66, 54, .5); }
.btn-primary:hover { background: var(--brand-d); color: #fff; border-color: var(--brand-d); }
.btn-danger { color: var(--rose); }
.btn-danger:hover { background: var(--rose-bg); border-color: #E7B9B3; color: var(--rose); }
.btn-wa { background: var(--wa); border-color: #176a3b; color: #fff; }
.btn-wa:hover { background: #176a3b; color: #fff; border-color: #176a3b; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--brand-t); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-done { opacity: .55; pointer-events: none; }
.inline-form { display: inline; margin: 0; }
.icon-btn { width: 32px; padding: 0; }

/* ---------------------------------------------------------------- formularios */
form { margin: 0; }
.form { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 16px; }
.field { display: grid; gap: 6px; align-content: start; }
label { font-size: 14px; font-weight: 550; color: var(--ink); }
.opt { color: var(--ink-3); font-weight: 400; font-size: 13px; }
.hint { color: var(--ink-3); font-size: 13px; margin: 0; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--r-ctl);
  border: 1px solid var(--line); background: #FBFCFB; color: var(--ink);
  font: 15px var(--font); transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 84px; line-height: 1.45; }
select { 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% - 17px) 18px, calc(100% - 12px) 18px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px var(--brand-l); }
input[type=file] { font: 14px var(--font); }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; flex-wrap: wrap; }
.form-section { font-size: 15px; font-weight: 650; padding-top: 6px; border-top: 1px solid var(--line-2); margin-top: 4px; padding-top: 16px; }
.form-errors { background: var(--rose-bg); color: var(--rose); border-radius: var(--r-ctl); padding: 12px 14px; font-size: 14px; }
.form-errors ul { margin: 6px 0 0; padding-left: 18px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line-2); background: #FAFBFA; }
.filters input[type=search], .filters input[type=text] { max-width: 320px; }
.filters select, .filters input[type=date] { width: auto; min-width: 150px; }

/* ---------------------------------------------------------------- tablas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { text-align: left; font-weight: 550; color: var(--ink-2); font-size: 13px; padding: 10px 14px; background: #F7F9F8; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--brand-t); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td a.row-link { color: var(--ink); font-weight: 600; text-decoration: none; }
td a.row-link:hover { color: var(--brand); text-decoration: underline; }
td .sub { display: block; color: var(--ink-3); font-size: 13px; }
.actions-cell { text-align: right; white-space: nowrap; }
.actions-cell .btn { margin-left: 4px; }
tfoot td { font-weight: 650; background: #F7F9F8; }

/* ---------------------------------------------------------------- estados */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px;
  font-size: 12.5px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.ok { background: var(--brand-l); color: var(--brand-d); }
.badge.warn { background: var(--amber-bg); color: var(--amber); }
.badge.bad { background: var(--rose-bg); color: var(--rose); }
.badge.info { background: var(--sky-bg); color: var(--sky); }
.badge.plain::before { display: none; }

.empty { padding: 34px 20px; text-align: center; color: var(--ink-2); }
.empty h3 { color: var(--ink); margin-bottom: 4px; }
.empty .btn { margin-top: 10px; }

/* ---------------------------------------------------------------- mensajes */
.flash-stack { position: fixed; right: 18px; top: 74px; z-index: 40; display: grid; gap: 8px; width: min(380px, calc(100vw - 36px)); }
.flash {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 16px; border-radius: 11px;
  background: var(--ink); color: #fff; box-shadow: var(--sh-3); font-size: 14.5px; animation: slidein .3s var(--ease);
}
.flash span { flex: 1; padding-top: 1px; }
.flash-ok { background: var(--brand-d); }
.flash-error { background: var(--rose); }
.flash-info { background: var(--sky); }
.flash-x { background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; padding: 2px; }
.flash.is-leaving { animation: slideout .25s ease forwards; }

/* ---------------------------------------------------------------- hoy / agenda */
.day-list { list-style: none; margin: 0; padding: 0; }
.day-item { display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; align-items: center; padding: 13px 20px; border-bottom: 1px solid var(--line-2); }
.day-item:last-child { border-bottom: 0; }
.day-time { font-weight: 650; font-size: 15px; }
.day-time small { display: block; color: var(--ink-3); font-weight: 400; font-size: 12.5px; }
.day-who { min-width: 0; }
.day-who a { color: var(--ink); font-weight: 600; text-decoration: none; }
.day-who a:hover { color: var(--brand); }
.day-who span { display: block; color: var(--ink-2); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-item.is-past .day-time { color: var(--ink-3); }
.day-item.is-now { background: linear-gradient(90deg, var(--brand-t), transparent 70%); box-shadow: inset 3px 0 0 var(--brand); }

.rem-list { list-style: none; margin: 0; padding: 0; }
.rem { display: flex; gap: 12px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line-2); transition: background .2s, opacity .3s; }
.rem:last-child { border-bottom: 0; }
.rem-body { flex: 1; min-width: 0; }
.rem-body strong { display: block; }
.rem-body span { color: var(--ink-2); font-size: 13.5px; }
.rem.is-sent { opacity: .5; }
.rem.is-sent .btn-wa { background: var(--line-2); border-color: var(--line); color: var(--ink-2); }

/* semana */
.week-nav { display: flex; align-items: center; gap: 8px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); border-top: 1px solid var(--line-2); overflow-x: auto; }
.week-day { border-right: 1px solid var(--line-2); min-height: 360px; display: flex; flex-direction: column; }
.week-day:last-child { border-right: 0; }
.week-day-head { padding: 10px 12px; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: baseline; position: sticky; top: 0; background: var(--sheet); }
.week-day-head b { font-size: 20px; font-weight: 700; }
.week-day-head span { color: var(--ink-2); font-size: 13px; text-transform: capitalize; }
.week-day.is-today .week-day-head { box-shadow: inset 0 -2px 0 var(--brand); }
.week-day.is-today .week-day-head b { color: var(--brand); }
.week-day-body { padding: 8px; display: grid; gap: 6px; align-content: start; flex: 1; }
.week-day-body.is-weekend { background: repeating-linear-gradient(135deg, transparent 0 8px, rgba(24,38,31,.018) 8px 16px); }
.appt {
  display: block; padding: 8px 10px; border-radius: 8px; background: var(--brand-t); border-left: 3px solid var(--brand);
  color: var(--ink); text-decoration: none; font-size: 13px; line-height: 1.35; transition: transform .12s, box-shadow .12s;
}
.appt:hover { color: var(--ink); box-shadow: var(--sh-2); transform: translateY(-1px); }
.appt b { display: block; font-size: 13.5px; }
.appt span { color: var(--ink-2); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt.st-confirmada { border-left-color: var(--sky); background: var(--sky-bg); }
.appt.st-atendida { border-left-color: var(--ink-3); background: #F2F4F3; opacity: .75; }
.appt.st-no_asistio, .appt.st-cancelada { border-left-color: var(--rose); background: var(--rose-bg); opacity: .7; text-decoration: line-through; }
.week-add { margin-top: auto; padding: 6px; font-size: 13px; color: var(--ink-3); text-decoration: none; border-radius: 6px; text-align: center; }
.week-add:hover { background: var(--brand-t); color: var(--brand); }

/* ---------------------------------------------------------------- ficha de mascota */
.ficha { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center; padding: 22px; }
.ficha-photo { width: 92px; height: 92px; border-radius: 22px; object-fit: cover; background: var(--brand-l); display: grid; place-items: center; font-size: 30px; font-weight: 700; color: var(--brand); }
.ficha h1 { font-size: 30px; }
.ficha-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); margin-top: 6px; font-size: 14.5px; }
.ficha-meta b { color: var(--ink); font-weight: 600; }
.ficha-alert { margin-top: 10px; display: inline-flex; gap: 8px; align-items: center; background: var(--rose-bg); color: var(--rose); padding: 6px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 550; }
.ficha-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }

.subtabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--line-2); overflow-x: auto; }
.subtab { padding: 12px 12px 11px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 14.5px; border-bottom: 2px solid transparent; white-space: nowrap; }
.subtab:hover { color: var(--ink); }
.subtab.is-active { color: var(--ink); border-bottom-color: var(--brand); font-weight: 600; }
.subtab small { color: var(--ink-3); font-weight: 500; margin-left: 4px; }

.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; font-size: 14.5px; }
.dl dt { color: var(--ink-2); }
.dl dd { margin: 0; overflow-wrap: anywhere; }

.history { list-style: none; margin: 0; padding: 0; }
.hist { padding: 18px 20px; border-bottom: 1px solid var(--line-2); display: grid; grid-template-columns: 110px 1fr; gap: 16px; }
.hist:last-child { border-bottom: 0; }
.hist-date b { display: block; font-size: 15px; }
.hist-date span { color: var(--ink-3); font-size: 13px; }
.hist h3 { margin-bottom: 6px; }
.hist-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 20px; font-size: 14.5px; }
.hist-grid h4 { font-size: 13px; font-weight: 550; color: var(--ink-2); margin-bottom: 2px; }
.hist-grid p { margin: 0; white-space: pre-line; }
.hist-foot { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; background: #F4F6F5; border: 1px solid var(--line-2); font-size: 13px; color: var(--ink); text-decoration: none; }
.file-chip:hover { border-color: var(--brand); color: var(--brand); }
.file-chip .ic { width: 15px; height: 15px; }

.vac-row td:first-child { font-weight: 600; }
.due-late { color: var(--rose); font-weight: 600; }
.due-soon { color: var(--amber); font-weight: 600; }

/* ---------------------------------------------------------------- caja */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.pos-lines td { padding: 8px 10px; }
.pos-lines input, .pos-lines select { height: 36px; }
.pos-lines .qty { width: 80px; }
.pos-lines .price { width: 110px; }
.pos-total { position: sticky; top: 130px; }
.pos-sum { display: grid; gap: 10px; padding: 20px; }
.pos-sum div { display: flex; justify-content: space-between; font-size: 15px; }
.pos-sum .grand { font-size: 28px; font-weight: 700; border-top: 1px solid var(--line-2); padding-top: 12px; letter-spacing: -.02em; }
.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-methods label { display: flex; align-items: center; justify-content: center; gap: 6px; height: 40px; border: 1px solid var(--line); border-radius: var(--r-ctl); cursor: pointer; font-weight: 500; transition: all .15s; }
.pay-methods input { position: absolute; opacity: 0; pointer-events: none; }
.pay-methods label:has(input:checked) { border-color: var(--brand); background: var(--brand-t); color: var(--brand-d); box-shadow: 0 0 0 2px var(--brand-l); }
.pay-methods label:has(input:focus-visible) { outline: 2.5px solid var(--brand); }

.receipt { max-width: 420px; margin: 0 auto; padding: 28px; font-size: 14px; }
.receipt h2 { text-align: center; }
.receipt .center { text-align: center; color: var(--ink-2); }
.receipt table { margin: 14px 0; }
.receipt td, .receipt th { padding: 6px 4px; }
.receipt .tot { font-size: 18px; font-weight: 700; }
.void-stamp { text-align: center; color: var(--rose); font-weight: 700; font-size: 22px; border: 2px solid var(--rose); padding: 6px; border-radius: 8px; transform: rotate(-3deg); margin: 10px 0; }

/* ---------------------------------------------------------------- reportes */
.bars { display: grid; gap: 10px; padding: 20px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 110px; gap: 12px; align-items: center; font-size: 14px; }
.bar-track { height: 12px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--brand); border-radius: 99px; transition: width .7s var(--ease); }
.bar-row .num { text-align: right; font-weight: 600; }
.cols { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding: 20px 20px 0; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.col-bar { width: 100%; max-width: 46px; background: var(--brand); border-radius: 6px 6px 0 0; height: 0; transition: height .7s var(--ease); min-height: 2px; }
.col-bar.is-current { background: var(--amber); }
.col small { color: var(--ink-3); font-size: 12px; text-transform: capitalize; }
.col b { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.cols-foot { height: 26px; }

/* ---------------------------------------------------------------- diálogos */
dialog { border: 0; padding: 0; background: transparent; color: var(--ink); max-width: calc(100vw - 24px); }
dialog::backdrop { background: rgba(16, 28, 22, .38); backdrop-filter: blur(2px); }
dialog[open] { animation: pop .18s var(--ease); }
.search-dialog { width: 620px; margin-top: 10vh; background: var(--sheet); border-radius: 16px; box-shadow: var(--sh-3); }
.search-box { display: flex; align-items: center; gap: 10px; padding: 6px 16px; border-bottom: 1px solid var(--line-2); }
.search-box .ic { color: var(--ink-3); width: 20px; height: 20px; }
.search-box input { border: 0 !important; box-shadow: none !important; background: transparent !important; height: 52px !important; font-size: 17px !important; padding: 0 !important; }
.search-box kbd { color: var(--ink-3); }
.search-results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.search-results:empty { display: none; }
.sr { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.sr:hover, .sr.is-sel { background: var(--brand-t); color: var(--ink); }
.sr-type { font-size: 12px; color: var(--ink-3); width: 62px; flex: none; }
.sr b { font-weight: 600; }
.sr span { color: var(--ink-2); font-size: 13.5px; display: block; }
.sr-empty { padding: 18px; color: var(--ink-2); text-align: center; }

.confirm-dialog { width: 400px; background: var(--sheet); border-radius: 14px; box-shadow: var(--sh-3); }
.confirm-dialog form { padding: 22px; }
.confirm-text { font-size: 15.5px; margin-bottom: 18px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------------------------------------------------------------- varios */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line-2); font-size: 14px; color: var(--ink-2); }
.pager a { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-weight: 500; }
.pager a .ic { width: 16px; height: 16px; }
.code-box { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #F4F6F5; border: 1px dashed var(--line); padding: 12px; border-radius: 8px; font-size: 15px; letter-spacing: .08em; word-break: break-all; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-size: 13.5px !important; }
.note { background: var(--brand-t); border: 1px solid var(--brand-l); padding: 12px 14px; border-radius: 10px; font-size: 14px; color: var(--ink-2); }
.note.warn { background: var(--amber-bg); border-color: #EFD9AE; color: var(--amber); }
.kv-inline { display: flex; gap: 6px 18px; flex-wrap: wrap; color: var(--ink-2); font-size: 14px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; padding: 4px 10px; border-radius: 99px; background: var(--brand-t); border: 1px solid var(--brand-l); font-size: 13px; color: var(--brand-d); }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.module-grid .check { border: 1px solid var(--line); padding: 10px 12px; border-radius: var(--r-ctl); font-size: 14px; }
.module-grid .check:has(input:checked) { background: var(--brand-t); border-color: var(--brand-l); }
.tpl-vars { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-vars code { background: #F4F6F5; border: 1px solid var(--line-2); padding: 2px 6px; border-radius: 5px; font-size: 12.5px; }
.preview-bubble { background: #E7F4EA; border-radius: 12px 12px 12px 3px; padding: 10px 12px; font-size: 14px; white-space: pre-line; max-width: 420px; }

/* ---------------------------------------------------------------- páginas sueltas (login, error) */
body.bare { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--paper); }
.bare-card { width: min(440px, 100%); background: var(--sheet); border-radius: 18px; box-shadow: var(--sh-2); padding: 34px; animation: rise .4s var(--ease) both; }
.bare-card h1 { font-size: 24px; margin-bottom: 8px; }
.bare-card > p { color: var(--ink-2); }
.bare-code { font-size: 54px; font-weight: 700; color: var(--brand-l); line-height: 1; margin-bottom: 12px; -webkit-text-stroke: 1px var(--brand); }
.bare-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.bare-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; text-decoration: none; color: var(--ink); font-weight: 650; }
.bare-brand .brand-mark { background: var(--brand); color: var(--on-brand); }
.bare-foot { text-align: center; margin-top: 16px; font-size: 14px; color: var(--ink-2); }
.hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------------------------------------------------------------- sitio público */
body.site { background: var(--sheet); }
.site-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px clamp(18px, 5vw, 64px); max-width: 1240px; margin: 0 auto; }
.site-top nav { display: flex; gap: 6px; align-items: center; }
.site-top nav a:not(.btn) { color: var(--ink-2); text-decoration: none; font-weight: 500; padding: 8px 12px; border-radius: 8px; }
.site-top nav a:not(.btn):hover { color: var(--ink); background: var(--brand-t); }
.site-wrap { max-width: 1240px; margin: 0 auto; padding: 0 clamp(18px, 5vw, 64px); }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(28px, 5vw, 70px); align-items: center; padding: clamp(30px, 6vw, 80px) 0 clamp(40px, 7vw, 96px); }
.hero h1 { font-size: clamp(36px, 5.2vw, 62px); line-height: 1.02; letter-spacing: -.035em; font-weight: 700; max-width: 12ch; }
.hero p.lead { font-size: 19px; color: var(--ink-2); max-width: 46ch; margin: 22px 0 28px; line-height: 1.55; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hero-cta .btn { height: 46px; padding: 0 20px; font-size: 16px; }
.hero-cta small { color: var(--ink-3); width: 100%; margin-top: 4px; }

/* la "demo" del hero: la lista de recordatorios real del sistema */
.demo { position: relative; background: var(--paper); border-radius: 22px; padding: 22px; }
.demo-folder { background: var(--brand); border-radius: 14px 14px 0 0; display: flex; gap: 2px; padding: 10px 14px 0; }
.demo-folder span { padding: 8px 14px 10px; color: rgba(243,248,245,.75); font-size: 13.5px; border-radius: 9px 9px 0 0; }
.demo-folder span.on { background: var(--sheet); color: var(--ink); font-weight: 600; }
.demo-sheet { background: var(--sheet); border-radius: 0 0 14px 14px; box-shadow: var(--sh-2); }
.demo-sheet .rem { padding: 14px 18px; }
.demo-sheet .rem:nth-child(1) { animation: rise .5s .25s var(--ease) both; }
.demo-sheet .rem:nth-child(2) { animation: rise .5s .40s var(--ease) both; }
.demo-sheet .rem:nth-child(3) { animation: rise .5s .55s var(--ease) both; }
.demo-msg { position: absolute; right: -14px; bottom: -26px; max-width: 290px; box-shadow: var(--sh-3); animation: rise .6s .9s var(--ease) both; }

.band { padding: clamp(48px, 7vw, 96px) 0; border-top: 1px solid var(--line-2); }
.band h2 { font-size: clamp(26px, 3.2vw, 38px); letter-spacing: -.025em; max-width: 20ch; margin-bottom: 12px; }
.band > .site-wrap > p { color: var(--ink-2); max-width: 60ch; font-size: 17px; }
.systems { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-top: 34px; border-top: 2px solid var(--ink); }
.system { padding: 22px 24px 26px 0; border-right: 1px solid var(--line); margin-right: 24px; }
.system:last-child { border-right: 0; margin-right: 0; }
.system h3 { font-size: 21px; margin: 10px 0 6px; }
.system p { color: var(--ink-2); }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-top: 34px; align-items: stretch; }
.plan { border: 1px solid var(--line); border-radius: 18px; padding: 26px; display: flex; flex-direction: column; background: var(--sheet); }
.plan.is-featured { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--sh-2); }
.plan-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plan h3 { font-size: 20px; }
.plan-desc { color: var(--ink-2); margin: 6px 0 16px; min-height: 2.6em; }
.price { font-size: 46px; font-weight: 700; letter-spacing: -.035em; line-height: 1; }
.price small { font-size: 16px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.price-year { color: var(--ink-3); font-size: 14px; margin: 6px 0 18px; }
.plan ul { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 9px; flex: 1; }
.plan li { display: flex; gap: 9px; font-size: 15px; }
.plan li .ic { color: var(--brand); margin-top: 2px; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin-top: 32px; counter-reset: s; }
.step { counter-increment: s; }
.step::before { content: counter(s); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-l); color: var(--brand-d); font-weight: 700; margin-bottom: 12px; }
.step p { color: var(--ink-2); }
.site-foot { border-top: 1px solid var(--line-2); padding: 28px 0 40px; color: var(--ink-3); font-size: 14px; }
.site-foot .site-wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- carnet público */
.carnet { width: min(560px, 100%); }
.carnet-card { background: var(--sheet); border-radius: 20px; box-shadow: var(--sh-2); overflow: hidden; }
.carnet-top { background: var(--brand); color: var(--on-brand); padding: 22px 24px; display: flex; gap: 14px; align-items: center; }
.carnet-top .ficha-photo { width: 72px; height: 72px; border-radius: 18px; background: rgba(255,255,255,.15); color: #fff; }
.carnet-top h1 { font-size: 26px; }
.carnet-top p { margin: 2px 0 0; opacity: .85; }

/* ---------------------------------------------------------------- movimiento */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes slidein { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes slideout { to { opacity: 0; transform: translateX(16px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .grid-main, .pos { grid-template-columns: 1fr; }
  .pos-total { position: static; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .hero { grid-template-columns: 1fr; }
  .demo-msg { right: 8px; }
}
@media (max-width: 820px) {
  .search-trigger { min-width: 0; }
  .search-trigger span, .search-trigger kbd, .usermenu-name { display: none; }
  .nav-toggle { display: block; }
  .tabs { display: none; flex-direction: column; padding: 0 0 12px; }
  .tabs.is-open { display: flex; }
  .tab { border-radius: 9px; padding: 10px 12px; }
  .tab.is-active::before, .tab.is-active::after { display: none; }
  .grid-2, .grid-3, .systems, .steps { grid-template-columns: 1fr; }
  .system { border-right: 0; margin-right: 0; border-bottom: 1px solid var(--line); }
  .ficha { grid-template-columns: auto 1fr; }
  .ficha-actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .hist { grid-template-columns: 1fr; gap: 6px; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .stat { padding-right: 18px; margin-right: 18px; }
  .stat b { font-size: 24px; }
  .day-item { grid-template-columns: 60px 1fr; }
  .day-item > :last-child { grid-column: 2; }
  .bar-row { grid-template-columns: 90px 1fr 80px; }
  h1 { font-size: 23px; }
  .site-top nav a:not(.btn) { display: none; }
}

/* ---------------------------------------------------------------- impresión */
@media print {
  .topbar, .banner, .page-actions, .flash-stack, .no-print, .back { display: none !important; }
  body, .desk { background: #fff; padding: 0; }
  .sheet { box-shadow: none; border: 0; }
  .desk > * { animation: none !important; }
}
.pos-lines .qty.over { border-color: var(--rose); background: var(--rose-bg); }
.stock-note { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.label { font-size: 14px; font-weight: 550; }
.appt { overflow: hidden; }
.bar-row { grid-template-columns: 150px 1fr 100px; }
.bar-row > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-lines td:first-child { width: 48%; }
.pos-lines td:nth-child(2), .pos-lines td:nth-child(3) { width: 120px; }
@media (max-width: 820px) {
  .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 0; }
  .stat { border-right: 0; margin-right: 0; padding-right: 10px; }
  .day-time small { display: none; }
  .bar-row { grid-template-columns: 96px 1fr 80px; }
}
@media (max-width: 820px) { .ficha { align-items: start; } .ficha-photo { width: 72px; height: 72px; border-radius: 18px; } }
