@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700&family=Figtree:wght@400;500;600;700&display=swap');

:root {
  --bg: #F3F2F7;
  --surface: #FFFFFF;
  --sunken: #ECEAF2;
  --ink: #23202E;
  --muted: #6E6880;
  --line: #E1DDEA;
  --pelu: #B23A6F;   --pelu-soft: #F7E6EE;
  --ropa: #2F5D8A;   --ropa-soft: #E3ECF5;
  --colmena: #B87A00; --colmena-soft: #FBF0D9;
  --ok: #2E7D57;     --ok-soft: #E2F2E9;
  --danger: #C2362B; --danger-soft: #FBE7E5;
  --warn: #9A6A00;   --warn-soft: #FFF4D6;
  --radius-s: 8px; --radius-m: 14px; --radius-l: 22px;
  --shadow: 0 1px 2px rgba(35,32,46,.06), 0 8px 24px -12px rgba(35,32,46,.18);
  --font-ui: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font-ui); font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.08rem; }
a { color: var(--ropa); }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; } .center { text-align: center; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--ropa) 55%, transparent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Formularios ---------- */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .8rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem; font: inherit; font-weight: 400; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-s); padding: .6rem .7rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; }
input.big { font-size: 1.6rem; font-family: var(--font-display); font-weight: 700; padding: .5rem .7rem; }
.row { display: flex; gap: .8rem; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 160px; }
.row > .shrink { flex: 0 0 auto; }
.check { display: flex; align-items: center; gap: .55rem; font-weight: 500; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; margin: 0; flex: none; accent-color: var(--ink); }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: inherit; font-weight: 600;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: .55rem 1.05rem;
  cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: #3a3550; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--sunken); border-color: transparent; }
.btn-s { padding: .3rem .7rem; font-size: .84rem; }
.btn-l { padding: .85rem 1.4rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn svg { width: 1.1em; height: 1.1em; }

/* ---------- Superficies ---------- */
.panel { background: var(--surface); border-radius: var(--radius-m); padding: 1.2rem 1.3rem; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 1rem; }
.grid-2 > .panel + .panel { margin-top: 0; }
#c-prev:not(:empty) { margin-top: 1rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.panel-head h2, .panel-head h3 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; }
.stat { background: var(--surface); border-radius: var(--radius-m); padding: .95rem 1.05rem; border: 1.5px solid var(--line); }
.stat span { display: block; color: var(--muted); font-size: .84rem; font-weight: 500; }
.stat strong { display: block; font-family: var(--font-display); font-size: 1.45rem; font-variant-numeric: tabular-nums; margin-top: .15rem; }
.stat.key { background: var(--ink); color: #fff; border-color: var(--ink); }
.stat.key span { color: #C9C4D8; }

.alert { padding: .7rem .9rem; border-radius: var(--radius-s); margin: 0 0 1rem; font-weight: 500; }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-info { background: var(--ropa-soft); color: var(--ropa); }

.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--sunken); color: var(--muted); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-pelu { background: var(--pelu-soft); color: var(--pelu); }
.badge-ropa { background: var(--ropa-soft); color: var(--ropa); }
.badge-colmena { background: var(--colmena-soft); color: var(--colmena); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; padding: .5rem .6rem; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.is-anulada td { color: var(--muted); text-decoration: line-through; }
tr.is-diff td { background: var(--danger-soft); }
tr.is-ok td { background: var(--ok-soft); }
tfoot td { font-weight: 700; border-bottom: none; }
td input, td select { margin-top: 0; padding: .4rem .5rem; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

/* ---------- Íconos de sección ---------- */
.ico { display: inline-grid; place-items: center; border-radius: 12px; flex: none; }
.ico svg { width: 60%; height: 60%; }
.ico-pelu { background: var(--pelu-soft); color: var(--pelu); }
.ico-ropa { background: var(--ropa-soft); color: var(--ropa); }
.ico-colmena { background: var(--colmena-soft); color: var(--colmena); }

/* ---------- Login ---------- */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); padding: 2rem; border-radius: var(--radius-l); box-shadow: var(--shadow); }
.login-card h1 { margin-top: .9rem; margin-bottom: .15rem; }
.login-card form { margin-top: 1.4rem; }
.login-mark { display: flex; gap: 6px; }
.login-mark .dot { width: 26px; height: 30px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.dot-pelu { background: var(--pelu); } .dot-ropa { background: var(--ropa); } .dot-colmena { background: var(--colmena); }

/* ---------- Barra superior ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; padding: .65rem 1.2rem; background: var(--surface); border-bottom: 1.5px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .6rem; font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.brand .login-mark .dot { width: 14px; height: 16px; }
.brand .login-mark { gap: 3px; }
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; }
.tab { flex: none; white-space: nowrap; font: inherit; font-weight: 600; border: none; background: none; color: var(--muted); padding: .5rem .85rem; border-radius: 999px; cursor: pointer; }
.tab:hover { color: var(--ink); background: var(--sunken); }
.tab.active { color: #fff; background: var(--ink); }
.topbar .spacer { flex: 1; }
.status-pill { display: inline-flex; align-items: center; gap: .4rem; font-size: .84rem; font-weight: 600; padding: .3rem .7rem; border-radius: 999px; background: var(--ok-soft); color: var(--ok); }
.status-pill.closed { background: var(--danger-soft); color: var(--danger); }
.status-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
main.page { padding: 1.2rem; max-width: 1400px; margin: 0 auto; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1rem; align-items: start; }
@media (max-width: 980px) { .pos { grid-template-columns: minmax(0, 1fr); } .cart { position: static; } }
.secciones { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-bottom: 1rem; }
.seccion { display: flex; align-items: center; gap: .75rem; padding: .75rem .9rem; border-radius: var(--radius-m); border: 2px solid transparent; background: var(--surface); cursor: pointer; font: inherit; text-align: left; box-shadow: var(--shadow); }
.seccion .ico { width: 44px; height: 44px; }
.seccion b { display: block; font-family: var(--font-display); font-size: 1.05rem; }
.seccion small { color: var(--muted); }
.seccion.active[data-cat=peluqueria] { border-color: var(--pelu); }
.seccion.active[data-cat=ropa] { border-color: var(--ropa); }
.seccion.active[data-cat=colmena] { border-color: var(--colmena); }
@media (max-width: 600px) {
  .seccion small { display: none; }
  .seccion { flex-direction: column; gap: .35rem; padding: .6rem .3rem; text-align: center; }
  .seccion b { font-size: .92rem; }
  .seccion .ico { width: 36px !important; height: 36px !important; }
  .items-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .topbar { gap: .5rem; padding: .5rem .8rem; }
  .topbar .tabs { order: 5; width: 100%; flex-wrap: nowrap; overflow-x: auto; }
  .topbar .muted.small { display: none; }
  main.page { padding: .8rem; }
}

.items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.item-btn { position: relative; display: flex; flex-direction: column; gap: .45rem; padding: .85rem; min-height: 132px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-m); cursor: pointer; font: inherit; text-align: left; color: var(--ink); transition: transform .08s ease; }
.item-btn:hover { border-color: var(--ink); }
.item-btn:active { transform: scale(.97); }
.item-btn .ico { width: 34px; height: 34px; border-radius: 10px; }
.item-btn .name { font-weight: 600; line-height: 1.25; flex: 1; }
.item-btn .foot { display: flex; justify-content: space-between; align-items: center; gap: .3rem; flex-wrap: wrap; }
.item-btn .price { font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; }
.item-btn.low { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.item-btn.out { opacity: .5; }
.item-btn .qty-tag { position: absolute; top: .6rem; right: .6rem; background: var(--ink); color: #fff; border-radius: 999px; min-width: 1.6rem; height: 1.6rem; display: grid; place-items: center; font-size: .8rem; font-weight: 700; padding: 0 .35rem; }

.cart { position: sticky; top: 76px; }
.cart-lines { max-height: 42vh; overflow-y: auto; margin: 0 -.3rem; }
.cart-line { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: center; padding: .55rem .3rem; border-bottom: 1px solid var(--line); }
.cart-line .ico { width: 28px; height: 28px; border-radius: 8px; }
.cart-line .who { font-size: .8rem; color: var(--muted); }
.qty { display: inline-flex; align-items: center; gap: .2rem; }
.qty button { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; line-height: 1; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; margin: 1rem 0; }
.cart-total strong { font-family: var(--font-display); font-size: 2rem; font-variant-numeric: tabular-nums; }

/* ---------- Selector segmentado ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .4rem; margin-bottom: 1rem; }
.seg button { font: inherit; font-weight: 600; padding: .7rem .4rem; border-radius: var(--radius-s); border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .3rem; color: var(--ink); }
.seg button svg { width: 22px; height: 22px; }
.seg button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0 1rem; }
.chip { font: inherit; font-weight: 600; padding: .45rem .85rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip small { font-weight: 500; opacity: .7; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(35,32,46,.45); display: grid; place-items: center; padding: 1rem; z-index: 100; animation: fade .12s ease; }
.modal { background: var(--surface); border-radius: var(--radius-l); width: 100%; max-width: 520px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 30px 80px -20px rgba(0,0,0,.4); animation: pop .16s ease; }
.modal.wide { max-width: 900px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.3rem .4rem; }
.modal-head h2 { margin: 0; }
.modal-body { padding: .6rem 1.3rem 1rem; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .9rem 1.3rem 1.2rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: .4rem; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow); animation: pop .16s ease; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* ---------- Contabilidad (barra lateral) ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #fff; padding: 1.1rem .8rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { color: #fff; padding: 0 .5rem 1.1rem; }
.side nav { display: flex; flex-direction: column; gap: .15rem; }
.side nav button { font: inherit; font-weight: 500; text-align: left; color: #C9C4D8; background: none; border: none; padding: .55rem .75rem; border-radius: var(--radius-s); cursor: pointer; display: flex; gap: .6rem; align-items: center; }
.side nav button svg { width: 18px; height: 18px; opacity: .8; }
.side nav button:hover { background: rgba(255,255,255,.07); color: #fff; }
.side nav button.active { background: #fff; color: var(--ink); font-weight: 700; }
.side .who { margin-top: 1.2rem; padding: .8rem .5rem 0; border-top: 1px solid rgba(255,255,255,.12); font-size: .85rem; color: #C9C4D8; }
.side .who a { color: #fff; }
.content { padding: 1.4rem; min-width: 0; }
.content-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.1rem; }
.content-head h1 { margin: 0; }
.filters { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.filters label { margin: 0; }
.filters input, .filters select { padding: .45rem .6rem; }
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
  .side.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 1rem; }
}
.bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: .5rem; }
.bars div { flex: 1; max-width: 44px; background: var(--ink); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars div:hover { background: var(--pelu); }
.bars-labels { display: flex; gap: 4px; font-size: .7rem; color: var(--muted); }
.bars-labels span { flex: 1; max-width: 44px; text-align: center; overflow: hidden; }
.split { display: flex; height: 12px; border-radius: 999px; overflow: hidden; margin: .5rem 0 .8rem; background: var(--sunken); }
.split > div { height: 100%; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .85rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; }

/* ---------- Portal equipo ---------- */
.equipo { max-width: 520px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.equipo-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.serv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; margin-bottom: 1rem; }
.serv-btn { font: inherit; font-weight: 600; text-align: left; padding: .75rem; border-radius: var(--radius-m); border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink); }
.serv-btn small { display: block; color: var(--muted); font-weight: 500; }
.serv-btn.active { border-color: var(--pelu); background: var(--pelu-soft); }
.pin-input { letter-spacing: .6em; text-align: center; font-size: 1.5rem; }

/* ---------- Impresión ---------- */
.print-only { display: none; }
@media print {
  body { background: #fff; }
  body.printing > *:not(.print-area) { display: none !important; }
  .print-area { display: block !important; padding: 0; }
  .print-area .no-print { display: none !important; }
}
