/*
 * StockPago — sistema visual "panel violeta"
 * Concepto: tarjetas blancas sobre un fondo lavanda suave, líneas finas, botones y campos
 * en forma de píldora, un solo acento índigo y tipografía Montserrat (títulos firmes en azul
 * marino, textos livianos). Cifras con números tabulares para leer montos de un vistazo.
 */
:root {
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #f6f6fb;
  --hover: #f4f2fe;
  --border: #e2e3ee;
  --border-strong: #d2d4e3;
  --item-border: #c9cee4;
  --text: #25243b;
  --muted: #6e7086;
  --ink: #25243b;            /* botón oscuro, chip activo, toast */
  --on-ink: #ffffff;
  /* Acento: índigo */
  --brand: #6a43e8;
  --brand-dark: #5530cf;
  --brand-soft: #f0ebff;
  --on-brand: #ffffff;
  /* Estados (apagados, para no romper la calma) */
  --ok: #2e8b62;
  --ok-soft: #e8f5ef;
  --warn: #a8701a;
  --warn-soft: #fbf4e6;
  --danger: #c4475a;
  --danger-soft: #fcedf0;
  --violet: #6a43e8;
  --violet-soft: #efeefc;
  --line-warn: #eedcb6;
  --line-danger: #f1cad2;
  --line-info: #ddd3fb;
  --flash: #e9e7fc;
  --overlay: rgba(34, 32, 90, .38);
  --qr-bg: #ffffff;
  /* Gráficos */
  --series-1: #6a43e8;
  --series-2: #e3876b;
  /* Acentos por función: todos de la misma familia índigo/lavanda (minimal) */
  --c-blue: #6a43e8;   --c-blue-soft: #efeefc;
  --c-green: #2e8b62;  --c-green-soft: #e8f5ef;
  --c-violet: #8a7fe0; --c-violet-soft: #f1effd;
  --c-amber: #a8701a;  --c-amber-soft: #fbf4e6;
  --c-pink: #c25d8f;   --c-pink-soft: #fbeef5;
  --c-teal: #3f8f9a;   --c-teal-soft: #e8f4f6;
  --page-tint: none;
  --grid-line: #ececf6;
  --axis: #a4a3bf;
  /* Forma y tipografía */
  --radius: 14px;
  --radius-sm: 12px;
  --pill: 999px;
  /* Degradé principal (barra superior, menú activo, botón principal, bienvenida) */
  --hero: linear-gradient(100deg, var(--brand), color-mix(in srgb, var(--brand) 62%, #b56cff));
  --shadow-card: 0 1px 3px rgba(37, 36, 59, .04);
  --shadow-pop: 0 18px 50px rgba(34, 32, 90, .16);
  --deco: rgba(255, 255, 255, .95); /* curvas finas del fondo */
  --font: 'Montserrat', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Montserrat', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121220; --surface: #1a1a2c; --surface-2: #212135; --hover: #232339; --border: #2b2b42; --border-strong: #3a3a55; --item-border: #41436a;
    --text: #ecebff; --muted: #a3a2c8; --ink: #ecebff; --on-ink: #141330;
    --brand: #8f6cf7; --brand-dark: #b9a3ff; --brand-soft: #2a2357; --on-brand: #141330;
    --ok: #5fc495; --ok-soft: #173329; --warn: #e2b061; --warn-soft: #332914; --danger: #ef7d8e; --danger-soft: #3a1c26;
    --violet: #b8b3f7; --violet-soft: #2a2860; --line-warn: #4d3d1d; --line-danger: #57283a; --line-info: #3a3878; --flash: #2f2d69;
    --overlay: rgba(6, 6, 20, .62); --qr-bg: #ffffff; --series-1: #9b94f2; --series-2: #e9977c; --grid-line: #29284f; --axis: #77769e;
    --c-blue: #9b94f2; --c-blue-soft: #2a2860; --c-green: #5fc495; --c-green-soft: #173329; --c-violet: #b8b3f7; --c-violet-soft: #2b2963;
    --c-amber: #e2b061; --c-amber-soft: #332914; --c-pink: #e58ab7; --c-pink-soft: #3a1f33; --c-teal: #6cc0cb; --c-teal-soft: #173238;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .25); --shadow-pop: 0 18px 50px rgba(0, 0, 0, .5); --deco: rgba(155, 148, 242, .16);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121220; --surface: #1a1a2c; --surface-2: #212135; --hover: #232339; --border: #2b2b42; --border-strong: #3a3a55; --item-border: #41436a;
  --text: #ecebff; --muted: #a3a2c8; --ink: #ecebff; --on-ink: #141330;
  --brand: #8f6cf7; --brand-dark: #b9a3ff; --brand-soft: #2a2357; --on-brand: #141330;
  --ok: #5fc495; --ok-soft: #173329; --warn: #e2b061; --warn-soft: #332914; --danger: #ef7d8e; --danger-soft: #3a1c26;
  --violet: #b8b3f7; --violet-soft: #2a2860; --line-warn: #4d3d1d; --line-danger: #57283a; --line-info: #3a3878; --flash: #2f2d69;
  --overlay: rgba(6, 6, 20, .62); --qr-bg: #ffffff; --series-1: #9b94f2; --series-2: #e9977c; --grid-line: #29284f; --axis: #77769e;
  --c-blue: #9b94f2; --c-blue-soft: #2a2860; --c-green: #5fc495; --c-green-soft: #173329; --c-violet: #b8b3f7; --c-violet-soft: #2b2963;
  --c-amber: #e2b061; --c-amber-soft: #332914; --c-pink: #e58ab7; --c-pink-soft: #3a1f33; --c-teal: #6cc0cb; --c-teal-soft: #173238;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .25); --shadow-pop: 0 18px 50px rgba(0, 0, 0, .5); --deco: rgba(155, 148, 242, .16);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; font-weight: 600; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.01em; }
.right { text-align: right; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Botones e inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45em; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: .55em .95em; border-radius: var(--radius-sm); font: inherit; font-weight: 500; cursor: pointer; transition: background .12s, border-color .12s; white-space: nowrap; }
.btn:hover { background: var(--hover); border-color: var(--border-strong); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn-dark:hover { background: var(--ink); border-color: var(--ink); opacity: .88; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: var(--on-ink); }
.btn-ok:hover { background: var(--ok); border-color: var(--ok); opacity: .9; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--line-danger); }
.btn-sm { padding: .3em .65em; font-size: .84rem; }
.btn-lg { padding: .78em 1.25em; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { border-color: transparent; }

label { display: block; font-size: .82rem; font-weight: 500; color: var(--muted); margin-bottom: .3em; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55em .7em; outline: none; transition: border-color .12s; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=checkbox] { width: auto; accent-color: var(--brand); }
input[type=number] { font-variant-numeric: tabular-nums; }
.field { margin-bottom: .9rem; }
.grid { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* ---------- Tarjetas: planas, separadas por línea ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; min-width: 0; }
.card h3 { display: flex; align-items: center; gap: .5em; }
.kpi { display: flex; flex-direction: column; gap: .15rem; }
.kpi .label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.kpi .value { font-family: var(--mono); font-size: 1.5rem; font-weight: 500; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: .82rem; }
.up { color: var(--ok); } .down { color: var(--danger); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .14em .55em; border-radius: 999px; font-size: .74rem; font-weight: 500; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-brand { background: var(--brand-soft); color: var(--brand-dark); }
.b-violet { background: var(--violet-soft); color: var(--violet); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .76rem; font-weight: 500; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; letter-spacing: .02em; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--hover); }
td.actions { white-space: nowrap; text-align: right; }

/* ---------- Layout de la app ---------- */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); color: var(--muted); padding: 1rem .7rem; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: .15rem; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 600; font-size: 1.05rem; letter-spacing: -.02em; padding: .3rem .5rem 1rem; }
.logo .mark { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, var(--c-blue), var(--c-violet)); display: grid; place-items: center; color: var(--on-brand); font-size: .85rem; font-family: var(--mono); }
.logo:hover { text-decoration: none; }
.biz { padding: .3rem .55rem .9rem; font-size: .82rem; border-bottom: 1px solid var(--border); margin-bottom: .5rem; }
.biz b { color: var(--text); display: block; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: .6rem; padding: .48rem .6rem; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; font-size: .92rem; }
.nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.nav a.active .ico { background: var(--surface); box-shadow: 0 0 0 1px var(--line-info); }
.nav .ico { width: 1.75rem; height: 1.75rem; display: grid; place-items: center; border-radius: 7px; font-size: .9em; background: var(--surface-2); flex: none; }
.nav .count { margin-left: auto; background: var(--danger); color: var(--on-ink); border-radius: 999px; font-size: .7rem; padding: .05em .5em; font-family: var(--mono); }
.sidebar .bottom { margin-top: auto; font-size: .84rem; border-top: 1px solid var(--border); padding-top: .6rem; }
.sidebar .bottom b { color: var(--text); }
.sidebar .bottom a { color: var(--muted); }
.main { padding: 1.6rem 2rem 3rem; min-width: 0; max-width: 1440px; }
.app { background: var(--page-tint), var(--bg); background-repeat: no-repeat; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-head p { margin: .1rem 0 0; font-size: .9rem; }
.topbar { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; width: 260px; left: -270px; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 0 0 0 100vmax var(--overlay); }
  .topbar { display: flex; align-items: center; gap: .6rem; padding: .65rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); color: var(--text); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40; }
  .topbar button { background: none; border: 0; color: var(--text); font-size: 1.3rem; cursor: pointer; }
  .main { padding: 1rem 1rem 3rem; }
}

/* ---------- Selector de tema ---------- */
.theme-toggle { display: inline-flex; align-items: center; gap: .45rem; background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 999px; padding: .3rem .7rem; font: inherit; font-size: .82rem; cursor: pointer; }
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle svg { width: 15px; height: 15px; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 1.2rem; align-items: start; }
@media (max-width: 1100px) { .pos { grid-template-columns: 1fr; } }
.scan { font-size: 1.05rem; padding: .8em .95em; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: .5rem; margin-top: .8rem; }
.prod { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem .75rem; cursor: pointer; text-align: left; font: inherit; color: inherit; transition: border-color .12s, background .12s; display: flex; flex-direction: column; gap: .2rem; min-height: 88px; }
.prod:hover { border-color: var(--brand); background: var(--hover); }
.prod .name { font-weight: 500; font-size: .88rem; line-height: 1.25; }
.prod .price { font-family: var(--mono); font-weight: 500; margin-top: auto; font-variant-numeric: tabular-nums; }
.prod .stk { font-size: .74rem; }
.cart { position: sticky; top: 1rem; }
.cart-fab { display: none; }
@media (max-width: 1100px) {
  .cart { position: static; }
  .cart-fab { display: block; position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 30; background: var(--brand); color: var(--on-brand); border: 0; border-radius: var(--radius); padding: .9rem; font: inherit; font-weight: 600; box-shadow: var(--shadow-pop); cursor: pointer; }
}
.cart-items { max-height: 42vh; overflow: auto; margin: 0 -1.2rem; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: .2rem .6rem; padding: .6rem 1.2rem; border-bottom: 1px solid var(--border); }
.cart-line > div > b { font-weight: 500; }
.cart-line .qty { display: flex; align-items: center; gap: .3rem; }
.cart-line .qty input { width: 66px; padding: .25em .4em; text-align: center; }
.total-box { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.5rem; font-weight: 500; margin: .7rem 0; letter-spacing: -.02em; }
.total-box span:last-child { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.pay-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: var(--radius); padding: .8rem .4rem; font: inherit; font-weight: 500; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .3rem; font-size: .84rem; }
.pay-btn .i { font-size: 1.4rem; }
.pay-btn:hover { border-color: var(--border-strong); }
.pay-btn.mp { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.qr-box { display: grid; place-items: center; padding: 1rem; background: var(--qr-bg); border-radius: var(--radius); border: 1px solid var(--border); }
.qr-box svg { width: 232px; height: 232px; }
.pulse { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--brand-soft); } 100% { box-shadow: 0 0 0 10px transparent; } }

/* ---------- Modal y avisos ---------- */
.modal-bg { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; z-index: 100; padding: 1rem; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; width: min(560px, 100%); max-height: 92vh; overflow: auto; box-shadow: var(--shadow-pop); }
.modal.wide { width: min(920px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .95rem 1.2rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 1.2rem; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; padding: .9rem 1.2rem; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }
.x { background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--muted); line-height: 1; }
#toasts { position: fixed; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: .5rem; z-index: 200; max-width: min(380px, calc(100vw - 2rem)); }
.toast { background: var(--ink); color: var(--on-ink); padding: .75rem 1rem; border-radius: var(--radius); box-shadow: var(--shadow-pop); font-size: .92rem; animation: slide .2s ease-out; }
.toast.err { background: var(--danger); }
.toast.warn { background: var(--warn); color: var(--on-ink); }
.toast.ok { background: var(--ok); }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Gráficos simples ---------- */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding-top: .5rem; border-bottom: 1px solid var(--border); }
.bars .b { flex: 1; background: linear-gradient(180deg, var(--c-blue), var(--c-violet)); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; opacity: .45; }
.bars .b:hover { opacity: 1; }
.bars .b.today { opacity: 1; }
.bars-labels { display: flex; gap: 4px; font-size: .68rem; color: var(--muted); margin-top: .35rem; font-family: var(--mono); }
.bars-labels span { flex: 1; text-align: center; overflow: hidden; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem .6rem; margin-bottom: .65rem; font-size: .88rem; }
.hbar > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--series-1); border-radius: 99px; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); margin-bottom: 1.1rem; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: .65rem .8rem; font: inherit; font-weight: 500; font-size: .92rem; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--brand-dark); border-bottom-color: var(--brand); }
.alert-banner { display: flex; gap: .8rem; align-items: center; padding: .75rem 1rem; border-radius: var(--radius); background: var(--warn-soft); border: 1px solid var(--line-warn); margin-bottom: 1rem; flex-wrap: wrap; font-size: .92rem; }
.alert-banner.danger { background: var(--danger-soft); border-color: var(--line-danger); }
.info-banner { padding: .75rem 1rem; border-radius: var(--radius); background: var(--brand-soft); border: 1px solid var(--line-info); margin-bottom: 1rem; font-size: .92rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; padding: .28em .8em; cursor: pointer; font: inherit; font-size: .84rem; font-weight: 500; }
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

@media print {
  .sidebar, .topbar, .no-print, .modal-foot, .modal-head .x, .theme-toggle { display: none !important; }
  .app { display: block; } .modal-bg { position: static; background: none; } .modal { box-shadow: none; max-height: none; border: 0; }
}

/* ---------- Gráficos del panel admin ---------- */
.chart-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-bottom: .4rem; }
.chart-legend i, .chart-tip i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: .4em; vertical-align: 0; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-pop); border-radius: var(--radius-sm); padding: .45rem .6rem; font-size: .8rem; white-space: nowrap; z-index: 5; }
.chart svg text { fill: var(--muted); font-family: var(--mono); }
.chart .xhair { opacity: 0; }
.chart .hit.hover .xhair { opacity: 1; }
.chart-table { margin-top: .4rem; font-size: .84rem; }
.chart-table summary { color: var(--muted); cursor: pointer; font-weight: 500; }
.chart-table table { margin-top: .4rem; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: .55rem 0; }
.progress > div { height: 100%; background: var(--ok); border-radius: 99px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .88rem; }

/* ---------- Búsqueda rápida y lector de códigos ---------- */
.search-box { position: relative; }
.search-box .scan { width: 100%; }
.sugg { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); overflow: hidden; }
.sugg-item { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem .9rem; cursor: pointer; border-bottom: 1px solid var(--border); }
.sugg-item:last-child { border-bottom: 0; }
.sugg-item > span { display: flex; flex-direction: column; min-width: 0; }
.sugg-item b { font-weight: 500; }
.sugg-item .right { align-items: flex-end; white-space: nowrap; font-family: var(--mono); }
.sugg-item.on, .sugg-item:hover { background: var(--brand-soft); }
.sugg-empty { padding: .8rem .9rem; color: var(--muted); font-size: .88rem; }
kbd { font-family: var(--mono); font-size: .72rem; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35em; background: var(--surface); color: var(--text); }
.scanner-pill { display: inline-flex; align-items: center; gap: .35em; color: var(--ok); font-weight: 500; white-space: nowrap; }
.scanner-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.scanner-pill.hit { animation: scanhit .6s ease-out; }
@keyframes scanhit { 0% { transform: scale(1.08); } 100% { transform: scale(1); } }
.cart-line.flash { animation: flash 1s ease-out; }
@keyframes flash { 0% { background: var(--flash); } 100% { background: transparent; } }

/* ---------- Capa "panel": barra superior violeta, menú agrupado con íconos de línea, tarjetas de color ---------- */
body { font-weight: 400; background: var(--bg); }
h1, h2, h3, h4 { color: var(--text); font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.08rem; } h3 { font-size: .96rem; font-weight: 600; }
label { font-weight: 500; color: var(--muted); font-size: .8rem; }
.num, .kpi .value, .total-box span:last-child, .prod .price, .posnet-card .price, .readout { font-family: var(--font); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.i-line { display: block; flex: none; }
.app { background: var(--bg); }

/* Barra superior: degradé del color principal, en todas las pantallas */
.topbar { display: flex; align-items: center; gap: .8rem; padding: .7rem 1.2rem; background: var(--hero); color: #fff; border: 0; box-shadow: 0 2px 12px color-mix(in srgb, var(--brand) 30%, transparent);
  position: sticky; top: 0; z-index: 40; min-height: 58px; }
.topbar b { color: #fff; font-weight: 700; font-size: 1.12rem; display: flex; align-items: center; gap: .5rem; letter-spacing: -.01em; }
.topbar b::before { content: '$'; width: 28px; height: 28px; border-radius: 9px; background: rgba(255, 255, 255, .2); display: grid; place-items: center; font-size: .9rem; }
.topbar b:has(img)::before { display: none; }
.topbar button { background: rgba(255, 255, 255, .16); border: 0; color: #fff; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; font-size: 1.1rem; }
.topbar .theme-toggle { width: auto; color: #fff; border-color: rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .12); }
.topbar .biz-logo-top { background: #fff; padding: 3px 6px; border-radius: 7px; height: 28px; }
@media (min-width: 901px) {
  #menu { display: none; }
  .sidebar { top: 58px; height: calc(100vh - 58px); }
  .sidebar > .logo { display: none; }
}

/* Menú lateral blanco: grupos con etiqueta en píldora, íconos de línea grises, activo en violeta */
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: .9rem .8rem; box-shadow: none; }
.biz { border-bottom: 1px solid var(--border); padding: .3rem .4rem .9rem; }
.nav-group { display: inline-block; align-self: flex-start; margin: .9rem 0 .3rem .2rem; padding: .18em .8em; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-size: .72rem; font-weight: 700; letter-spacing: .02em; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 10px; color: var(--muted); font-weight: 500; font-size: .9rem; }
.nav a .lbl { flex: 1; min-width: 0; line-height: 1.25; }
.nav a:hover { background: var(--hover); color: var(--text); }
.nav .ico { width: auto; height: auto; background: none !important; box-shadow: none !important; color: var(--muted); filter: none; opacity: 1; display: block; }
.nav a:hover .ico { color: var(--brand); }
.nav a.active { background: var(--hero); color: #fff; font-weight: 600; box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 32%, transparent); }
.nav a.active .ico { color: #fff; }
.nav a.active .count { background: rgba(255, 255, 255, .25); color: #fff; }
.nav .count { font-family: var(--font); font-weight: 700; background: var(--brand); color: #fff; }
.nav .count-wait { background: var(--brand-soft); color: var(--brand-dark); }
.sidebar .bottom { border-top: 1px solid var(--border); }
.sidebar .biz .badge { background: var(--brand-soft); color: var(--brand-dark); }
.sidebar .biz .branch-pill { margin-top: .55rem; display: inline-flex; align-items: center; gap: .3em; font-size: .8rem; font-weight: 600; color: var(--brand-dark); background: var(--brand-soft); padding: .25em .8em; border-radius: 999px; border: 0; }

/* Encabezado de página */
.page-head h1 { font-size: 1.55rem; }
/* Bienvenida: tarjeta grande con el degradé */
.page-head.hero { background: var(--hero); color: #fff; border-radius: 16px; padding: 1.4rem 1.6rem; align-items: center; box-shadow: 0 10px 30px color-mix(in srgb, var(--brand) 25%, transparent); }
.page-head.hero h1 { color: #fff; }
.page-head.hero .muted { color: rgba(255, 255, 255, .82); }
.page-head.hero .btn { background: #fff; color: var(--brand-dark); border-color: #fff; box-shadow: none; }

/* Botones */
.btn { border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 600; padding: .55em 1.05em; }
.btn:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--surface); }
.btn-primary { background: var(--hero); border-color: transparent; color: #fff; box-shadow: 0 6px 14px color-mix(in srgb, var(--brand) 26%, transparent); }
.btn-primary:hover { background: var(--hero); color: #fff; filter: brightness(1.06); }
.btn-dark { background: var(--text); border-color: var(--text); color: var(--surface); }
.btn-dark:hover { background: var(--text); color: var(--surface); opacity: .9; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { color: var(--danger); border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--hover); border-color: transparent; }
.btn-sm { padding: .3em .75em; font-size: .8rem; border-radius: 8px; }
.btn-lg { padding: .78em 1.4em; }

/* Campos */
input, select, textarea { border-radius: 10px; border: 1px solid var(--border-strong); padding: .58em .85em; background: var(--surface); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
.scan { border-radius: 999px; padding: .85em 1.3em; }

/* Tarjetas blancas con borde suave */
.card { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-card); padding: 1.2rem 1.3rem; }
.table-wrap { border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-card); }
th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .74rem; letter-spacing: .03em; }
.modal { border: 0; border-radius: 16px; }
.modal-head { background: var(--surface); }

/* Indicadores: tarjetas de color con un aro, como en el panel de la imagen */
.grid > .kpi { color: #fff; border: 0; min-height: 112px; justify-content: center; padding-right: 82px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--k1), var(--k2)); box-shadow: 0 10px 24px color-mix(in srgb, var(--k1) 28%, transparent); }
.grid > .kpi:nth-child(4n+1) { --k1: #b13fc4; --k2: #d062d3; }
.grid > .kpi:nth-child(4n+2) { --k1: #7848e8; --k2: #9b6cf4; }
.grid > .kpi:nth-child(4n+3) { --k1: #4c7bea; --k2: #6c98f3; }
.grid > .kpi:nth-child(4n+4) { --k1: #0fa1b4; --k2: #2cbccb; }
.grid > .kpi .label { color: rgba(255, 255, 255, .9); font-weight: 600; font-size: .8rem; order: 2; }
.grid > .kpi .label::before { display: none; }
.grid > .kpi .value { color: #fff; font-size: clamp(1.25rem, 1.9vw, 1.85rem); font-weight: 700; order: 1; line-height: 1.15; white-space: nowrap; }
.grid > .kpi .delta, .grid > .kpi .muted, .grid > .kpi .up, .grid > .kpi .down { color: rgba(255, 255, 255, .85) !important; order: 3; }
.grid > .kpi::after { content: ''; position: absolute; right: 18px; top: 50%; width: 46px; height: 46px; margin-top: -23px; border-radius: 50%;
  border: 6px solid rgba(255, 255, 255, .28); border-top-color: #fff; border-right-color: #fff; background: none; opacity: 1; transform: rotate(-20deg); }
.grid > .kpi > * { position: relative; z-index: 1; }

/* Badges, chips y pestañas */
.badge { font-weight: 600; }
.b-brand, .b-violet { background: var(--brand-soft); color: var(--brand-dark); }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--muted); }
.chip:hover { color: var(--brand-dark); border-color: var(--brand); }
.chip.on { background: var(--hero); color: #fff; border-color: transparent; }
.tabs { border-bottom: 1px solid var(--border); }
.tabs button.active { color: var(--brand-dark); font-weight: 700; border-bottom-color: var(--brand); }

/* Avisos */
.alert-banner, .info-banner { border-radius: 12px; }
.toast { border-radius: 12px; border-left: 0; }

/* Caja (POS) */
.prod { border: 1px solid var(--border); border-radius: 12px; box-shadow: none; }
.prod:hover { border-color: var(--brand); background: var(--surface); }
.prod .name { font-weight: 600; color: var(--text); }
.prod .price { color: var(--brand-dark); font-weight: 700; margin-top: auto; }
.total-box { color: var(--text); font-weight: 700; }
#pay-cash, #pay-transfer, #pay-cc, #pay-other { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); font-weight: 600; }
#pay-cash:hover, #pay-transfer:hover, #pay-cc:hover, #pay-other:hover { border-color: var(--brand); color: var(--brand-dark); }
#pay-mp { background: var(--hero); border-color: transparent; color: #fff; font-weight: 600; }
.pay-btn { border-radius: 12px; }
.pay-btn.mp { border-color: var(--brand); background: var(--brand-soft); }
.cart-fab { background: var(--hero) !important; border-radius: 999px !important; }
.scanner-pill { background: var(--ok-soft); padding: .1em .65em; border-radius: 999px; }
.sugg { border-radius: 12px; }

/* Gráficos */
.bars { gap: 8px; }
.bars .b { background: linear-gradient(180deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #c084fc)); border-radius: 6px 6px 0 0; opacity: .35; max-width: 26px; margin: 0 auto; }
.bars .b:hover, .bars .b.today { opacity: 1; }
.hbar .fill { background: var(--brand); }
.progress > div { background: var(--brand); }

/* Otros */
.logo .mark { background: var(--hero); border: 0; color: #fff; border-radius: 9px; font-family: var(--font); }
.card.quick:hover { border-color: var(--brand); }
kbd { border-radius: 6px; font-family: var(--font); }

/* Valor calculado que acompaña a un formulario (mismo alto y ancho que un campo, nunca desborda) */
.readout { display: block; width: 100%; min-height: 2.45em; padding: .55em .7em; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

/* ---- Logo del local en el menú ---- */
.sidebar .logo.has-logo { padding: .2rem .4rem .9rem; }
.sidebar .logo .biz-logo { display: block; max-width: 100%; max-height: 54px; object-fit: contain; }
.topbar .biz-logo-top { height: 22px; max-width: 90px; object-fit: contain; vertical-align: middle; margin-right: .3rem; }

/* ---- Reclamos y sugerencias: accesos rápidos y conversación ---- */
.card.quick { display: flex; flex-direction: column; gap: .3rem; text-align: left; cursor: pointer; font: inherit; color: var(--text); }
.card.quick:hover { border-color: var(--brand); }
.thread { display: flex; flex-direction: column; gap: .7rem; max-height: 46vh; overflow-y: auto; padding: .2rem; }
.thread .msg { max-width: 85%; padding: .6rem .8rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.thread .msg.me { align-self: flex-end; background: var(--brand-soft); border-color: var(--line-info); }
.thread .msg.team { align-self: flex-start; background: var(--surface-2); }
.thread .msg.internal { align-self: center; background: var(--warn-soft); border-color: var(--line-warn); border-style: dashed; }
.thread .body { margin-top: .2rem; overflow-wrap: anywhere; }
.thread .shot { display: block; margin-top: .5rem; max-height: 220px; max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); }
/* ---- Diseño del panel ---- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.theme-card { border: 2px solid var(--border); border-radius: var(--radius); padding: .6rem; background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: var(--text); display: grid; gap: .5rem; }
.theme-card:hover { border-color: var(--border-strong); }
.theme-card.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.theme-card .tc-name { font-weight: 600; display: flex; justify-content: space-between; gap: .4rem; align-items: center; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; }
.swatches button.on { box-shadow: 0 0 0 3px var(--text); }
.logo-box { display: grid; place-items: center; min-height: 110px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); padding: 1rem; }
.logo-box img { max-height: 90px; max-width: 100%; object-fit: contain; }
/* ---- Posnet ---- */
.posnet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.posnet-card { display: flex; flex-direction: column; gap: .6rem; }
.posnet-card .pic { height: 150px; border-radius: var(--radius-sm); background: linear-gradient(135deg, #fff159, #ffe600 60%, #00b1ea); display: grid; place-items: center; font-size: 3.2rem; overflow: hidden; }
.posnet-card .pic img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.posnet-card ul { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: .9rem; }
.posnet-card .price { font-family: var(--mono); font-size: 1.35rem; font-weight: 500; }
/* El logo del local va sobre una placa clara: se lee igual con el menú claro, oscuro o de color */
.sidebar .logo .biz-logo { background: #ffffff; padding: 6px 8px; border-radius: 8px; max-height: 60px; }

/* Pedido del DNI (usuario para entrar) a cuentas anteriores */
.dni-gate { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: rgba(10, 20, 35, .55); }
.dni-gate .modal { width: min(460px, 100%); }
.client-code { font-family: var(--mono); font-size: .78rem; color: var(--muted); letter-spacing: .02em; }

/* Ventas en espera (Vender): una franja arriba de la venta actual, cada una se retoma con un toque */
.parked { margin: -.2rem -.2rem .9rem; padding: .8rem; border-radius: var(--radius-sm); background: var(--brand-soft); border: 0; }
.parked-list { display: grid; gap: .4rem; max-height: 220px; overflow-y: auto; }
.parked-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .2rem; }
.parked-go { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: .6rem; text-align: left; padding: .45rem .6rem; border-radius: var(--pill);
  border: 0; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; min-width: 0; }
.parked-go:hover { box-shadow: 0 0 0 1.5px var(--brand); }
.parked-go b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parked-go .num { font-family: var(--mono); font-weight: 600; }
.parked-go .small { grid-column: 1 / -1; }
.nav .count-wait { background: var(--brand-soft); color: var(--brand-dark); }

/* Impresora fiscal: resultado de la impresión */
.info-banner.ok-banner { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-soft); }

/* Íconos de línea dentro de avisos, botones y títulos */
.bi { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--surface); color: var(--brand); flex: none; box-shadow: 0 0 0 1px var(--border); }
.info-banner .bi { display: inline-grid; vertical-align: middle; width: 32px; height: 32px; margin-right: .45rem; }
.btn .i-line, h3 .i-line, .tabs .i-line { flex: none; }
.card > h3 .i-line { color: var(--brand); }
.pay-btn .i { color: var(--brand); }

/* Logo: una S y un $ enfrentados, en línea blanca sobre el degradé principal */
.logo .mark { background: url(../img/logo-mark.svg) center / 82% no-repeat, var(--hero) !important; color: transparent !important; font-size: 0 !important; border: 0 !important; border-radius: 9px !important; width: 30px; height: 30px; }
.topbar b::before { content: "" !important; width: 30px; height: 30px; background: url(../img/logo-mark.svg) center / 82% no-repeat, rgba(255, 255, 255, .18) !important; }

/* Avisos: el texto ocupa el ancho disponible y los botones bajan cuando no entran (celular) */
.alert-banner > .grow { flex: 1 1 240px; min-width: 0; }
.cart-fab .i-line, .btn .i-line { display: inline-block; vertical-align: -3px; }

/* ---------- Agenda de turnos ---------- */
.agenda-bar { gap: .6rem; margin-bottom: .8rem; flex-wrap: wrap; }
.agenda-title { font-size: 1.05rem; margin: .2rem 0 .8rem; text-transform: capitalize; }
.appt-list { display: flex; flex-direction: column; gap: .6rem; }
.appt { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: .9rem; align-items: start; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 12px; padding: .8rem 1rem; }
.appt.st-pendiente { border-left-color: var(--warn); }
.appt.st-realizado { border-left-color: var(--ok); }
.appt.off { opacity: .6; border-left-color: var(--border-strong); }
.appt-time { display: flex; flex-direction: column; gap: .1rem; font-size: 1.05rem; }
.appt-main { min-width: 0; }
.appt-main a { color: inherit; }
.appt-side { display: flex; flex-direction: column; align-items: flex-end; gap: .45rem; }
@media (max-width: 640px) { .appt { grid-template-columns: 52px minmax(0, 1fr); } .appt-side { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; } }
.week { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: .5rem; overflow-x: auto; padding-bottom: .3rem; }
.week-day { display: flex; flex-direction: column; gap: .35rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .5rem; min-height: 160px; }
.week-day.is-today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.week-head { all: unset; cursor: pointer; display: flex; align-items: baseline; gap: .35rem; padding: .1rem .2rem .3rem; border-bottom: 1px solid var(--border); }
.week-head span { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.week-item { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: .05rem; font-size: .84rem; padding: .35rem .45rem; border-radius: 8px; background: var(--brand-soft); border-left: 3px solid var(--brand); }
.week-item.st-pendiente { border-left-color: var(--warn); }
.week-item.st-realizado { border-left-color: var(--ok); }
.week-item.off { opacity: .55; text-decoration: line-through; }
.week-item .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-none { padding: .2rem; }
.week-add { all: unset; cursor: pointer; margin-top: auto; color: var(--brand); padding: .2rem; }
.svc-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .4rem; }
.svc-opt { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; color: var(--text); font-size: .92rem; }
.svc-opt .grow { display: flex; flex-direction: column; min-width: 0; }
.svc-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.svc-opt input { width: auto; }
.appt-sum { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .7rem .9rem; border-radius: 10px; background: var(--surface-2); font-size: 1rem; }
.appt-tag { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem .7rem; margin-bottom: .5rem; border-radius: 10px; background: var(--brand-soft); border: 1px solid var(--brand); }
.appt-tag .small { display: block; }

/* ---------- Novedades (aviso al entrar) ---------- */
.news-modal { max-width: 520px; padding: 0; overflow: hidden; }
.news-card { padding: 1.4rem 1.5rem 1.2rem; display: flex; flex-direction: column; gap: .7rem; background: var(--surface); }
.news-preview .news-card { border: 1px solid var(--border-strong); border-radius: 14px; }
.news-top { display: flex; align-items: center; gap: .6rem; }
.news-ic { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.news-kind { font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
.news-card.k-aviso .news-ic { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.news-card.k-aviso .news-kind { color: var(--warn); }
.news-card.k-mejora .news-ic { background: var(--ok-soft); color: var(--ok); }
.news-card.k-mejora .news-kind { color: var(--ok); }
.news-title { margin: 0; font-size: 1.3rem; line-height: 1.25; text-wrap: balance; }
.news-body { color: var(--text); line-height: 1.55; max-height: 50vh; overflow-y: auto; overflow-wrap: anywhere; }
.news-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; margin-top: .3rem; }
.news-actions [data-never], .news-actions .btn-ghost { margin-right: auto; }
@media (max-width: 560px) {
  .grid.g4:has(> .kpi) { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .grid.g4 > .kpi { min-height: 0; padding: .75rem .9rem; }
  .grid.g4 > .kpi::after { display: none; }
  .grid.g4 > .kpi .value { font-size: 1.25rem; white-space: normal; }
}
.appt-meta { display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin-top: .25rem; }
.appt-meta .am { display: inline-flex; align-items: flex-start; gap: .3rem; min-width: 0; }
.appt-meta .am svg { flex: none; margin-top: .1em; }

/* ---------- Paneles en gama de azules (todas las pantallas) ---------- */
.grid > .kpi:nth-child(4n+1) { --k1: #1e3a8a; --k2: #2f5fd0; }
.grid > .kpi:nth-child(4n+2) { --k1: #1d4ed8; --k2: #3b82f6; }
.grid > .kpi:nth-child(4n+3) { --k1: #0369a1; --k2: #0ea5e9; }
.grid > .kpi:nth-child(4n+4) { --k1: #3451c7; --k2: #6b8cff; }
.page-head.hero { background: linear-gradient(100deg, #1d4ed8 0%, #2f6fe8 55%, #38a3f1 100%); box-shadow: 0 10px 24px rgba(29, 78, 216, .28); }

/* ---------- Productos e ítems: borde fino para que se vean separados ---------- */
.prod { border: 1px solid var(--item-border); }
.prod:hover { border-color: var(--brand); }
.cart-items { margin: 0; padding: .35rem 0; display: flex; flex-direction: column; gap: .4rem; }
.cart-line { border: 1px solid var(--item-border); border-radius: 10px; padding: .55rem .8rem; background: var(--surface); }
.cart-items .empty { border: 1px dashed var(--item-border); border-radius: 10px; }
th, td { border-bottom-color: var(--item-border); }
.appt { border-top-color: var(--item-border); border-right-color: var(--item-border); border-bottom-color: var(--item-border); }
.svc-opt, .week-day { border-color: var(--item-border); }
.sugg-item { border-bottom-color: var(--item-border); }
.grid > .kpi .value { color: #fff !important; } /* sobre el azul, los números siempre en blanco (también los de color de alerta) */
.sim-head { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; font: inherit; color: inherit; margin: 0; }
.sim-head input { width: 96px; padding: .2em .4em; text-align: right; font-weight: 600; text-transform: none; letter-spacing: 0; }

/* ---------- Interruptor (activar / desactivar) ---------- */
.switch { display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; color: var(--text); font-size: .88rem; font-weight: 500; user-select: none; margin: 0; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 42px; height: 24px; margin: 0; padding: 0; border-radius: 999px; border: 1px solid var(--item-border); background: var(--surface-2); position: relative; cursor: pointer; transition: background .18s, border-color .18s; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(20, 20, 60, .3); transition: transform .18s; }
.switch input:checked { background: var(--brand); border-color: var(--brand); }
.switch input:checked::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }

/* ---------- Campo con prefijo / sufijo ($, %, días) ---------- */
.affix { display: flex; align-items: center; border: 1px solid var(--item-border); border-radius: 10px; background: var(--surface); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.affix:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.affix input { border: 0 !important; box-shadow: none !important; background: transparent; padding: .5rem .55rem; width: 100%; min-width: 0; font-variant-numeric: tabular-nums; }
.affix span { padding: 0 .6rem; color: var(--muted); font-size: .85rem; white-space: nowrap; }
.affix span:first-child { border-right: 1px solid var(--item-border); align-self: stretch; display: flex; align-items: center; background: var(--surface-2); }
.affix input + span { border-left: 1px solid var(--item-border); align-self: stretch; display: flex; align-items: center; background: var(--surface-2); }

/* ---------- Medios de pago ---------- */
.pm-ic { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent); }
.pm-sim { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; margin-bottom: 1rem; border: 1px solid var(--item-border); border-radius: 14px; }
.pm-sim .grow { flex: 1 1 220px; min-width: 0; }
.pm-sim-in { width: 180px; } .pm-sim-in input { font-size: 1.1rem; font-weight: 700; }
.pm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 430px), 1fr)); gap: .9rem; }
.pm-card { display: flex; flex-direction: column; gap: .9rem; padding: 1rem 1.1rem; border: 1px solid var(--item-border); border-radius: 14px; transition: border-color .15s, box-shadow .15s, opacity .15s; }
.pm-card:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--item-border)); }
.pm-card.dirty { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.pm-card.off .pm-ic { background: var(--surface-2); color: var(--muted); border-color: var(--item-border); }
.pm-card.off .pm-fields, .pm-card.off .pm-res { opacity: .55; }
.pm-head { display: flex; align-items: center; gap: .8rem; }
.pm-name { border: 1px solid transparent !important; background: transparent; box-shadow: none !important; font-weight: 700; font-size: 1.02rem; padding: .25rem .4rem; margin-left: -.4rem; border-radius: 8px; width: 100%; }
.pm-name:hover { border-color: var(--item-border) !important; }
.pm-name:focus { border-color: var(--brand) !important; background: var(--surface); }
.pm-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.pm-fields .field { margin: 0; }
.pm-fields .field > label { font-size: .74rem; }
.pm-iva { height: 38px; display: flex; align-items: center; }
@media (max-width: 560px) { .pm-fields { grid-template-columns: 1fr 1fr; } }
.pm-foot { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; padding-top: .8rem; border-top: 1px solid var(--item-border); }
.pm-res { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.pm-res > div { display: flex; flex-direction: column; }
.pm-res b { font-size: 1.1rem; }

/* ---------- Admin: inicio ---------- */
.insights { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.insight { display: inline-flex; align-items: center; gap: .55rem; padding: .6rem .9rem; border-radius: 12px; border: 1px solid var(--item-border); background: var(--surface); font-weight: 600; font-size: .92rem; }
.insight span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); }
.insight.ok span { background: var(--ok-soft); color: var(--ok); }
.insight.warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--item-border)); }
.insight.warn span { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.feed { display: flex; flex-direction: column; }
.feed-row { display: flex; align-items: center; gap: .7rem; padding: .55rem 0; border-bottom: 1px solid var(--item-border); }
.feed-row:last-child { border-bottom: 0; }
.feed-ic { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.mini-bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; height: 130px; align-items: end; }
.mini-bars > div { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.mini-bars i { display: block; width: 100%; border-radius: 6px 6px 3px 3px; background: color-mix(in srgb, var(--brand) 45%, transparent); }
.mini-bars i.now { background: var(--brand); }
.mini-bars span { font-size: .68rem; color: var(--muted); }

/* ---------- Puestos de venta ---------- */
.st-tabs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: .6rem; margin-bottom: 1rem; }
.st-tab { display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; border: 1px solid var(--item-border); border-radius: 14px; background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.st-tab:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--item-border)); }
.st-tab.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.st-tab.off { opacity: .55; cursor: default; }
.st-tab .pm-ic { width: 40px; height: 40px; }
.st-pos { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 900px) { .st-pos { grid-template-columns: 1fr; } }
.st-cart .cart-items { max-height: 46vh; margin: .6rem 0; }
.st-qr { width: min(240px, 70vw); margin: 0 auto .5rem; padding: 10px; background: #fff; border-radius: 14px; border: 1px solid var(--item-border); }
.st-qr svg { width: 100%; height: auto; display: block; }
.empty-state { text-align: center; padding: 2rem 1rem; display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.pm-opts { border: 1px dashed var(--item-border); border-radius: 12px; padding: .55rem .75rem; }
.pm-opts > summary { cursor: pointer; font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: .4rem; list-style: none; }
.pm-opts > summary::-webkit-details-marker { display: none; }
.pm-opt { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, .9fr) minmax(0, .9fr) minmax(0, .9fr) auto auto; gap: .4rem; align-items: center; margin-bottom: .45rem; }
.pm-opt > input { border: 1px solid var(--item-border); border-radius: 10px; padding: .45rem .55rem; min-width: 0; }
.pm-opt .switch { font-size: .8rem; gap: .35rem; }
@media (max-width: 640px) { .pm-opt { grid-template-columns: 1fr 1fr; } .pm-opt > input { grid-column: 1 / -1; } }

/* ---------- Admin: roles y funciones ---------- */
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: .9rem; margin-top: .8rem; }
.role-card { border: 1px solid var(--item-border); }
.perm-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .5rem; }
.perm-tags span { font-size: .74rem; padding: .2rem .55rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: .35rem; }
.perm-opt { display: flex; align-items: flex-start; gap: .5rem; padding: .45rem .6rem; border: 1px solid var(--item-border); border-radius: 10px; cursor: pointer; color: var(--text); font-size: .88rem; margin: 0; }
.perm-opt input { width: auto; margin-top: .15rem; }
.perm-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- Migrar desde otro sistema ---------- */
.imp-drop { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .5rem; padding: 2.4rem 1.2rem; border: 2px dashed color-mix(in srgb, var(--brand) 45%, var(--item-border)); border-radius: 18px; cursor: pointer; transition: border-color .15s, background .15s; }
.imp-drop:hover, .imp-drop.over, .imp-drop:focus-visible { border-color: var(--brand); background: var(--brand-soft); outline: none; }
.imp-drop h2 { margin: .3rem 0 0; }
.imp-ic { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 20px; background: var(--brand-soft); color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); }
.imp-ic.ok { background: var(--ok-soft); color: var(--ok); }
.imp-ic.spin svg { animation: impspin 1.2s linear infinite; }
@keyframes impspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .imp-ic.spin svg { animation: none; } }
.imp-loading, .imp-done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .5rem; padding: 2.4rem 1.2rem; }
.imp-step { border: 1px solid var(--item-border); }
.imp-sheet { display: flex; gap: .7rem; padding: .6rem 0; border-bottom: 1px solid var(--item-border); }
.imp-sheet:last-child { border-bottom: 0; }
.imp-ask { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; border: 2px solid var(--brand); background: var(--brand-soft); }
.imp-cat { padding: 0; margin-bottom: .7rem; border: 1px solid var(--item-border); overflow: hidden; }
.imp-cat > summary { display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; cursor: pointer; list-style: none; flex-wrap: wrap; }
.imp-cat > summary::-webkit-details-marker { display: none; }
.imp-cat[open] > summary { border-bottom: 1px solid var(--item-border); background: var(--surface-2); }
.imp-cat .pm-ic { width: 36px; height: 36px; }
.imp-cat-sum { display: flex; gap: 1rem; flex-wrap: wrap; }
.imp-cat .table-wrap { border: 0; border-radius: 0; box-shadow: none; }
.imp-table input:not([type=checkbox]) { border: 1px solid transparent; background: transparent; padding: .3rem .4rem; border-radius: 8px; width: 100%; min-width: 0; }
.imp-table input:not([type=checkbox]):hover { border-color: var(--item-border); }
.imp-table input:not([type=checkbox]):focus { border-color: var(--brand); background: var(--surface); }
.imp-table select { padding: .3rem .4rem; min-width: 130px; }
.imp-table .imp-num { width: 105px; text-align: right; font-variant-numeric: tabular-nums; }
.imp-table .imp-name { min-width: 240px; }
.imp-table .imp-name > input { font-weight: 600; }
.imp-table tr.off { opacity: .45; }
.imp-badges { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .2rem; }
.imp-badges .badge { font-size: .68rem; }
.imp-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-top: 1rem; padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom, 0px)); background: var(--surface); border: 1px solid var(--item-border); border-radius: 14px; box-shadow: 0 -8px 24px rgba(20, 20, 60, .08); }
