/* Füsion Fit — sistema visual
   Dos áreas que se fusionan: Entrenamiento (energía) y Faciales (calma).
   Los colores de marca se sobrescriben desde Configuración. */
:root {
  --bg: #F2F3F6;
  --surface: #FFFFFF;
  --surface-2: #F8F9FB;
  --ink: #1B1E2B;
  --ink-2: #3A3F52;
  --muted: #6B7083;
  --line: #E2E4EA;
  --primary: #E4405F;
  --ent: #FF7A1A;
  --fac: #B06AB3;
  --gen: #5B6478;
  --ok: #1F9D6B;
  --ok-bg: #E6F6EF;
  --bad: #D43C3C;
  --bad-bg: #FDECEC;
  --warn: #B87400;
  --warn-bg: #FFF4DC;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 20px;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fusion: linear-gradient(115deg, var(--ent) 0%, var(--primary) 52%, var(--fac) 100%);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.1; }
.display { font-stretch: 125%; font-weight: 800; letter-spacing: -0.01em; }
h1.display { font-size: clamp(26px, 3.2vw, 34px); }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.right { text-align: right; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, white); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Controles ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); padding: 9px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; white-space: nowrap; text-decoration: none; min-height: 40px; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: var(--ink-2); }
.btn.brand { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, white); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.btn.big { min-height: 54px; font-size: 17px; padding: 12px 22px; border-radius: 14px; }
.btn.sm { min-height: 32px; padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 12px; min-height: 40px; }
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent); }
label.field { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: grid; gap: 12px; }
.stack.lg { gap: 20px; }

/* Segmentado (áreas, filtros) */
.seg { display: inline-flex; background: color-mix(in srgb, var(--ink) 6%, transparent); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 13px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--ink-2); font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(27, 30, 43, .12); }

/* Etiquetas de área: el sistema de color que identifica cada mitad del negocio */
.area { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 2px 9px 2px 7px; border-radius: 999px; }
.area::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.area.entrenamiento { color: color-mix(in srgb, var(--ent) 80%, black); background: color-mix(in srgb, var(--ent) 13%, white); }
.area.faciales { color: color-mix(in srgb, var(--fac) 80%, black); background: color-mix(in srgb, var(--fac) 14%, white); }
.area.general { color: var(--gen); background: color-mix(in srgb, var(--gen) 12%, white); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink-2); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- Estructura de la app ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #fff; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; }
.brand img { height: 38px; width: auto; object-fit: contain; }
.wordmark { font-stretch: 125%; font-weight: 800; font-size: 21px; letter-spacing: -0.01em; line-height: 1; }
.wordmark i { font-style: normal; background: var(--fusion); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: rgba(255,255,255,.72); font-weight: 600; font-size: 14.5px; }
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav a.on { color: #fff; background: rgba(255,255,255,.12); }
.nav .sep { height: 1px; background: rgba(255,255,255,.1); margin: 10px 8px; }
.side .me { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255,255,255,.1); font-size: 13px; }
.side .me b { display: block; font-size: 14px; }
.side .me .btn { color: #fff; border-color: rgba(255,255,255,.2); background: transparent; margin-top: 10px; }
.main { min-width: 0; padding: 26px 30px 60px; }
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); margin-top: 6px; }
.tabbar { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 16px 14px 92px; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--ink); z-index: 40; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .tabbar a { display: grid; justify-items: center; gap: 2px; color: rgba(255,255,255,.65); text-decoration: none; font-size: 11px; font-weight: 600; padding: 4px 6px; border-radius: 8px; min-width: 56px; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.on { color: #fff; }
  .mobile-top { display: flex !important; }
}
.mobile-top { display: none; align-items: center; gap: 10px; margin-bottom: 14px; }

/* Paneles: bordes finos en vez de tarjetas con sombra */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.panel.tight { padding: 0; overflow: hidden; }
.panel > h2:first-child, .panel > .row:first-child { margin-bottom: 12px; }
.cols { display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); }
.c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; } .c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }
@media (max-width: 1100px) { .c4, .c5, .c6, .c7, .c8 { grid-column: span 12; } }

/* Indicadores */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; margin-bottom: 16px; }
.kpi { padding: 16px 18px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi .v { font-size: 26px; font-weight: 800; font-stretch: 112%; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .l { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi .d { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Tablas */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--surface-2); }
.table .num, .table .right { text-align: right; }
.scroll-x { overflow-x: auto; }
.list { display: grid; }
.list > .li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list > .li:last-child { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-size: 14px; }

/* ---------- Punto de venta ---------- */
.pos { display: grid; grid-template-columns: 1fr 390px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .pos { grid-template-columns: 1fr; } }
.pos-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.pos-filters .input { max-width: 260px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tile { position: relative; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 13px 13px 12px 17px; cursor: pointer; display: grid; gap: 6px; min-height: 112px; align-content: start; }
.tile::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gen); }
.tile.entrenamiento::before { background: var(--ent); }
.tile.faciales::before { background: var(--fac); }
.tile:hover { border-color: #C9CCD6; }
.tile:active { transform: scale(.985); }
.tile[disabled] { opacity: .45; cursor: not-allowed; }
.tile .n { font-weight: 700; font-size: 14.5px; line-height: 1.25; }
.tile .p { font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; margin-top: auto; }
.tile .m { font-size: 12px; color: var(--muted); }
.ticket { position: sticky; top: 16px; display: grid; gap: 12px; }
.ticket-lines { max-height: 40vh; overflow-y: auto; }
.tline { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.tline .qty { display: inline-flex; align-items: center; gap: 4px; }
.tline .qty button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; }
.totals { display: grid; gap: 4px; font-variant-numeric: tabular-nums; }
.totals .row { justify-content: space-between; }
.totals .grand { font-size: 28px; font-weight: 800; font-stretch: 115%; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.client-pick { position: relative; }
.dropdown { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(27, 30, 43, .14); max-height: 300px; overflow-y: auto; }
.dropdown button { display: flex; width: 100%; text-align: left; gap: 10px; align-items: center; padding: 10px 12px; border: 0; background: none; cursor: pointer; border-bottom: 1px solid var(--line); }
.dropdown button:hover, .dropdown button.on { background: var(--surface-2); }
.chosen { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--ink-2); flex: none; font-size: 14px; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--warn-bg); color: #6A4500; font-size: 14px; }
.notice.ok { background: var(--ok-bg); color: #0F5C3D; }
.notice.bad { background: var(--bad-bg); color: #8A1F1F; }

/* ---------- Acceso con QR ---------- */
.access { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .access { grid-template-columns: 1fr; } }
.cam { position: relative; aspect-ratio: 4 / 3; background: #0E1019; border-radius: 18px; overflow: hidden; display: grid; place-items: center; color: rgba(255,255,255,.7); text-align: center; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam .frame { position: absolute; inset: 18%; border-radius: 22px; box-shadow: 0 0 0 999px rgba(14, 16, 25, .45); border: 3px solid rgba(255,255,255,.85); pointer-events: none; }
.cam .msg { position: relative; z-index: 2; padding: 20px; max-width: 320px; }
.result { border-radius: 18px; padding: 22px; border: 1px solid var(--line); background: var(--surface); }
.result.ok { border-color: color-mix(in srgb, var(--ok) 45%, white); background: linear-gradient(180deg, var(--ok-bg), var(--surface) 60%); }
.result.bad { border-color: color-mix(in srgb, var(--bad) 45%, white); background: linear-gradient(180deg, var(--bad-bg), var(--surface) 60%); }
.result .big-name { font-size: 26px; font-weight: 800; font-stretch: 118%; line-height: 1.1; }
.pkg { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.pkg .count { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 52px; text-align: center; line-height: 1; }
.pkg .count small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 3px; }
.check-anim { width: 64px; height: 64px; border-radius: 50%; background: var(--ok); display: grid; place-items: center; animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Modal y avisos ---------- */
.overlay { position: fixed; inset: 0; background: rgba(14, 16, 25, .5); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 20px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px; box-shadow: 0 30px 80px rgba(14, 16, 25, .3); }
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); bottom: 24px; display: grid; gap: 8px; width: min(420px, calc(100% - 24px)); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; animation: fade .2s; box-shadow: 0 10px 30px rgba(14, 16, 25, .25); }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
@media (max-width: 900px) { .toasts { bottom: 86px; } }

/* Barras simples para reportes */
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 90px; gap: 10px; align-items: center; font-size: 13px; }
.bar-track { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; display: flex; }
.bar-fill { height: 100%; background: var(--ink-2); }
.bar-fill.entrenamiento { background: var(--ent); } .bar-fill.faciales { background: var(--fac); } .bar-fill.general { background: var(--gen); }
.spark { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 8px; }
.spark .col { flex: 1; display: flex; flex-direction: column-reverse; gap: 2px; height: 100%; position: relative; }
.spark .col span { display: block; border-radius: 3px; min-height: 0; }
.spark .col .entrenamiento { background: var(--ent); } .spark .col .faciales { background: var(--fac); } .spark .col .general { background: var(--gen); }
.spark-x { display: flex; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 6px; }
.spark-x span { flex: 1; text-align: center; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .art { background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login .art::after { content: ''; position: absolute; width: 140%; height: 46%; left: -20%; bottom: -12%; background: var(--fusion); transform: rotate(-8deg); opacity: .95; }
.login .art h1 { font-size: clamp(40px, 6vw, 76px); font-stretch: 125%; font-weight: 800; line-height: .95; position: relative; z-index: 1; letter-spacing: -0.02em; }
.login .art p { position: relative; z-index: 1; max-width: 34ch; color: rgba(255,255,255,.75); }
.login form { align-self: center; justify-self: center; width: min(380px, 100% - 40px); display: grid; gap: 14px; }
@media (max-width: 800px) { .login { grid-template-columns: 1fr; } .login .art { min-height: 220px; padding: 28px; } .login .art h1 { font-size: 42px; } .login form { padding: 28px 0; } }

/* Ticket impreso */
.print-area { display: none; }
@media print {
  body { background: #fff; }
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block; color: #000; }
}
.tk { width: 72mm; font-family: 'Archivo', Arial, sans-serif; font-size: 11.5px; line-height: 1.35; margin: 0 auto; }
.tk h3 { text-align: center; font-size: 16px; margin: 0 0 2px; }
.tk .c { text-align: center; }
.tk table { width: 100%; border-collapse: collapse; }
.tk td { padding: 2px 0; vertical-align: top; }
.tk .r { text-align: right; white-space: nowrap; }
.tk hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
.tk .tot td { font-weight: 800; font-size: 14px; }
.cred { width: 86mm; height: 54mm; border-radius: 4mm; border: 1px solid #ccc; padding: 4mm; display: flex; gap: 4mm; align-items: center; margin: 0 auto; background: #fff; }
.cred .qr { width: 40mm; height: 40mm; flex: none; }
.cred .qr svg { width: 100%; height: 100%; }
.cred b { font-size: 15px; display: block; }
.cred .bar { height: 3mm; border-radius: 2mm; background: var(--fusion); margin: 3mm 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

.ticket-jump { display: none; }
@media (max-width: 1100px) { .ticket-jump.show { display: flex; position: fixed; left: 14px; right: 14px; bottom: 76px; z-index: 35; box-shadow: 0 10px 30px rgba(27, 30, 43, .25); } }
@media (min-width: 901px) and (max-width: 1100px) { .ticket-jump.show { bottom: 18px; left: 250px; } }
