:root {
  /* Paleta tomada del logo VII Sacramentos: vinotinto #5a1118 y durazno #f5dbc4 */
  --bg: #faf5f0;
  --surface: #ffffff;
  --surface-2: #fdf8f3;
  --ink: #2a1517;
  --ink-2: #6b5153;
  --ink-3: #9b8486;
  --line: #eedfd2;
  --brand: #5a1118;        /* vinotinto de la marca */
  --brand-2: #74202a;
  --brand-deep: #33080d;
  --peach: #f5dbc4;        /* durazno de la marca */
  --gold: #f5dbc4;         /* acento = durazno */
  --gold-soft: #fbeadc;
  --gold-ink: #7a2a30;
  --on-brand: #f8e9dc;     /* texto sobre vinotinto */
  --on-brand-2: #dcb9a8;
  --on-brand-3: #b98f80;
  --ok: #2f7a4f;
  --ok-soft: #e3f1e8;
  --warn: #a5650a;
  --warn-soft: #fbefd9;
  --bad: #b0322c;
  --bad-soft: #f8e1df;
  --info: #2c5d8a;
  --info-soft: #e1ecf6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(90,17,24,.06), 0 4px 16px rgba(90,17,24,.06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Cinzel", "Cormorant Garamond", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-2); }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.muted { color: var(--ink-2); } .small { font-size: 13px; } .tiny { font-size: 12px; color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- botones e inputs ---------- */
.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: 550; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--surface-2); border-color: #e2cdbd; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.gold { background: var(--peach); border-color: #ecc7a9; color: var(--brand); font-weight: 650; }
.btn.gold:hover { background: #f1cfb3; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.bad { background: var(--surface); border-color: #e9c2bf; color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
label { display: block; font-size: 13px; font-weight: 550; color: var(--ink-2); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=datetime-local], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 11px; outline: none; min-height: 40px;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grow { flex: 1; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.gold { background: var(--gold-soft); color: var(--gold-ink); border-color: transparent; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 50% -10%, #74202a 0%, #5a1118 45%, #33080d 100%); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px; padding: 28px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.logo { font-family: var(--serif); font-weight: 700; font-size: 30px; letter-spacing: .02em; color: var(--brand); line-height: 1; }
.logo span { color: var(--gold); }
.logo-sub { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); margin-top: 6px; }
.demo-box { margin-top: 18px; padding: 14px; border-radius: 12px; background: var(--gold-soft); font-size: 13px; }
.demo-box .btn { margin-top: 8px; }

/* ---------- layout del panel ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100%; }
.side { background: var(--brand); color: var(--on-brand); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.side .logo { color: #fff; font-size: 26px; padding: 0 8px; }
.side .logo-sub { color: var(--on-brand-2); padding: 0 8px; margin-bottom: 22px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--on-brand-2); text-decoration: none; font-weight: 520; margin-bottom: 2px; }
.nav a:hover { background: rgba(245,219,196,.08); color: #fff; }
.nav a.active { background: rgba(245,219,196,.14); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav a .ic { width: 20px; text-align: center; opacity: .9; }
.nav a .count { margin-left: auto; background: var(--peach); color: var(--brand); font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.nav-sep { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--on-brand-3); margin: 16px 12px 6px; }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(245,219,196,.15); font-size: 13px; color: var(--on-brand-2); }
.side-foot b { color: #fff; font-weight: 600; display: block; }
.side-foot .btn { margin-top: 10px; background: transparent; color: var(--on-brand); border-color: rgba(245,219,196,.25); }
.side-foot .btn:hover { background: rgba(245,219,196,.1); }
.main { min-width: 0; }
.topbar { display: none; }
.content { padding: 26px 28px 60px; max-width: 1280px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 18px; }
.card + .card { margin-top: 14px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.filters .field { margin: 0; min-width: 140px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .l { font-size: 13px; color: var(--ink-2); }
.kpi.alert .v { color: var(--warn); }

/* ---------- tablas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 650; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fdf7f2; }
td.r, th.r { text-align: right; }
tr.anulada td { opacity: .45; text-decoration: line-through; }
.empty { padding: 36px 18px; text-align: center; color: var(--ink-3); }
.thumb { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); cursor: zoom-in; display: block; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-soft); color: var(--brand); font-weight: 700; font-size: 14px; flex: none; }

/* ---------- tiendas en inicio ---------- */
.stores { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.store { padding: 14px 16px; }
.store h3 { display: flex; justify-content: space-between; gap: 8px; }
.store .who { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px dashed var(--line); }
.store .who:first-of-type { border-top: 0; }

/* ---------- horarios ---------- */
.sched td { padding: 8px 10px; }
.sched input[type=time] { min-width: 108px; padding: 7px 8px; min-height: 36px; }
.sched .day { font-weight: 600; white-space: nowrap; }
.sched tr.off td:not(:first-child):not(:nth-child(2)) { opacity: .35; }
.sched .err { color: var(--bad); font-size: 12px; }
.totals { display: flex; gap: 18px; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(51,8,13,.55); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 18px; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.modal.wide { max-width: 880px; }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-b { padding: 18px 20px; }
.modal-f { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.photo-big { width: 100%; border-radius: 12px; display: block; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 80; font-weight: 550; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
.note { padding: 12px 14px; border-radius: 12px; background: var(--info-soft); color: #1f4466; font-size: 14px; }
.note.warn { background: var(--warn-soft); color: #6d4306; }
.note.bad { background: var(--bad-soft); color: #7b221e; }
.note + .note { margin-top: 8px; }
.loading { padding: 40px; text-align: center; color: var(--ink-3); }

/* ---------- modo punto de venta (kiosco) ---------- */
.kiosk { min-height: 100vh; background: linear-gradient(180deg, #5a1118 0%, #33080d 100%); color: #fff; display: flex; flex-direction: column; }
.k-head { padding: 18px 20px 6px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.k-head .logo { color: #fff; font-size: 24px; }
.k-head .logo-sub { color: var(--on-brand-2); }
.k-clock { text-align: right; }
.k-clock .t { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1; }
.k-clock .d { font-size: 13px; color: var(--on-brand-2); margin-top: 4px; }
.k-body { flex: 1; padding: 12px 18px 24px; display: flex; flex-direction: column; max-width: 560px; width: 100%; margin: 0 auto; }
.k-title { font-size: 20px; font-weight: 650; margin: 12px 0 14px; text-align: center; }
.k-names { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.k-name { background: rgba(245,219,196,.08); border: 1px solid rgba(245,219,196,.16); border-radius: 16px; padding: 16px 12px; color: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; text-align: center; }
.k-name:active { background: rgba(245,219,196,.18); }
.k-name .avatar { width: 54px; height: 54px; font-size: 18px; background: var(--peach); color: var(--brand); }
.k-pin-dots { display: flex; justify-content: center; gap: 14px; margin: 8px 0 22px; }
.k-pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--on-brand-3); }
.k-pin-dots i.on { background: var(--peach); border-color: var(--peach); }
.k-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 320px; margin: 0 auto; width: 100%; }
.k-pad button { height: 68px; border-radius: 18px; border: 0; background: rgba(245,219,196,.1); color: #fff; font-size: 26px; font-weight: 600; cursor: pointer; }
.k-pad button:active { background: rgba(245,219,196,.24); }
.k-pad button.fn { font-size: 15px; background: transparent; }
.k-err { text-align: center; color: #ffb4ae; min-height: 22px; margin: 6px 0; font-weight: 550; }
.k-cam { position: relative; border-radius: 22px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; max-height: 52vh; margin: 0 auto 12px; width: 100%; }
.k-cam video, .k-cam img { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.k-cam .oval { position: absolute; inset: 12% 20% 18%; border: 3px dashed rgba(255,255,255,.55); border-radius: 50%; pointer-events: none; }
.k-cam .msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: #ddd; }
.k-status { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.k-status .badge { background: rgba(255,255,255,.1); color: #ddd; border-color: transparent; }
.k-status .badge.ok { background: rgba(47,122,79,.35); color: #b8f0cb; }
.k-status .badge.warn { background: rgba(165,101,10,.35); color: #ffd99a; }
.k-big { height: 72px; font-size: 20px; border-radius: 18px; border: 0; width: 100%; font-weight: 700; cursor: pointer; letter-spacing: .02em; }
.k-big.in { background: #3c9d64; color: #fff; }
.k-big.out { background: var(--peach); color: var(--brand); }
.k-big:disabled { opacity: .6; }
.k-alt { background: transparent; border: 0; color: var(--on-brand-2); text-decoration: underline; margin: 12px auto 0; display: block; cursor: pointer; font-size: 14px; }
.k-done { text-align: center; padding-top: 6vh; }
.k-done .check { width: 96px; height: 96px; border-radius: 50%; background: #3c9d64; display: grid; place-items: center; margin: 0 auto 18px; font-size: 48px; }
.k-done .check.out { background: var(--peach); color: var(--brand); }
.k-done .hora { font-size: 44px; font-weight: 750; font-variant-numeric: tabular-nums; }
.k-info { background: rgba(245,219,196,.09); border-radius: 14px; padding: 12px 14px; margin-top: 14px; font-size: 14px; color: var(--on-brand); text-align: left; }
.k-info.warn { background: rgba(165,101,10,.28); color: #ffe2b0; }
.k-back { background: transparent; border: 0; color: var(--on-brand-2); cursor: pointer; font-size: 15px; padding: 6px 0; align-self: flex-start; }
.k-foot { text-align: center; font-size: 12px; color: var(--on-brand-3); padding: 10px; }
.k-foot button { background: transparent; border: 0; color: var(--on-brand-3); text-decoration: underline; cursor: pointer; font-size: 12px; }
.k-mine { background: rgba(245,219,196,.07); border-radius: 16px; overflow: hidden; }
.k-mine table { color: #eee; font-size: 13px; }
.k-mine th { background: rgba(245,219,196,.08); color: var(--on-brand-2); border-color: rgba(245,219,196,.1); }
.k-mine td { border-color: rgba(245,219,196,.1); }
.k-mine tbody tr:hover td { background: transparent; }
.k-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.k-kpis div { background: rgba(245,219,196,.09); border-radius: 12px; padding: 10px 12px; }
.k-kpis b { display: block; font-size: 20px; }
.k-kpis span { font-size: 12px; color: var(--on-brand-2); }

/* ---------- móvil ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 40; transform: translateX(-100%); transition: transform .2s; height: 100%; }
  .shell.open .side { transform: none; box-shadow: 0 0 0 9999px rgba(0,0,0,.4); }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 30; }
  .topbar .logo { color: #fff; font-size: 20px; }
  .topbar button { background: transparent; border: 0; color: #fff; font-size: 22px; cursor: pointer; padding: 2px 6px; }
  .content { padding: 18px 16px 60px; }
  .grid2 { grid-template-columns: 1fr; }
  .filters .field { min-width: calc(50% - 5px); flex: 1; }
  h1 { font-size: 20px; }
}

table.compact th, table.compact td { padding: 9px 9px; }
table.compact td:first-child { min-width: 190px; }
table.compact th { font-size: 11px; }
.shell { min-height: 100vh; }

/* ---------- marca: logo ---------- */
.brand-logo { display: block; height: auto; }
.login-card .brand-logo { width: 132px; margin: 0 auto; }
.login-card .logo-sub { text-align: center; }
.side .brand-logo { width: 96px; margin: 0 auto 6px; }
.side .logo-sub { text-align: center; }
.topbar .brand-logo { width: 34px; }
.k-head .brand-logo { width: 62px; }
.k-head .who-store { display: flex; align-items: center; gap: 10px; }
.logo-sub { font-family: var(--serif); font-weight: 600; letter-spacing: .14em; }
.topbar-name { font-family: var(--serif); font-weight: 700; letter-spacing: .08em; font-size: 15px; color: var(--on-brand); }
.kpi.alert .v { color: var(--brand-2); }
.nav a.active { box-shadow: inset 3px 0 0 var(--peach); }
.k-clock .t { white-space: nowrap; font-size: clamp(24px, 7.5vw, 34px); }
.k-head .logo-sub { white-space: nowrap; font-size: 11px; }
.k-head .who-store { min-width: 0; }
