:root {
  --bg: #f5f3ef; --surface: #ffffff; --surface-2: #faf8f5; --border: #e6e1d8; --border-strong: #d4ccbf;
  --text: #1f2430; --muted: #6b6f7a; --faint: #9a9da6;
  --brand: #b4532a; --brand-strong: #933f1c; --brand-soft: #f8e9e1;
  --nav: #1e2533; --nav-text: #c9ced9; --nav-active: #ffffff;
  --ok: #1f7a4d; --ok-soft: #e3f3ea; --warn: #a86700; --warn-soft: #fdf1d9; --err: #b42318; --err-soft: #fde7e5;
  --info: #2458a6; --info-soft: #e5eefb; --edit: #c77700;
  --radius: 10px; --shadow: 0 1px 2px rgba(20, 24, 32, .06), 0 4px 16px rgba(20, 24, 32, .05);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171d; --surface: #1c2028; --surface-2: #20252e; --border: #2d333e; --border-strong: #3a4250;
    --text: #e7e9ee; --muted: #9ba1ad; --faint: #6f7682; --brand: #e0784a; --brand-strong: #f08f63; --brand-soft: #3a2519;
    --nav: #0f1217; --ok: #4fc288; --ok-soft: #173326; --warn: #e3a83a; --warn-soft: #3a2d12; --err: #f07a6e; --err-soft: #3d1c19;
    --info: #7aa7ec; --info-soft: #1a2940; --edit: #f0a53a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14171d; --surface: #1c2028; --surface-2: #20252e; --border: #2d333e; --border-strong: #3a4250;
  --text: #e7e9ee; --muted: #9ba1ad; --faint: #6f7682; --brand: #e0784a; --brand-strong: #f08f63; --brand-soft: #3a2519;
  --nav: #0f1217; --ok: #4fc288; --ok-soft: #173326; --warn: #e3a83a; --warn-soft: #3a2d12; --err: #f07a6e; --err-soft: #3d1c19;
  --info: #7aa7ec; --info-soft: #1a2940; --edit: #f0a53a; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* Layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--nav); color: var(--nav-text); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; font-weight: 700; }
.brand .logo { width: 32px; height: 32px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; font-size: 16px; }
.brand small { display: block; font-weight: 500; color: var(--nav-text); font-size: 11px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--nav-text); font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.1); color: var(--nav-active); }
.nav .count { margin-left: auto; background: var(--brand); color: #fff; font-size: 11px; border-radius: 99px; padding: 1px 7px; }
.side .foot { margin-top: auto; padding: 10px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.side .foot b { color: #fff; display: block; font-size: 13px; }
.side .foot .badge { white-space: normal; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.content { padding: 24px 28px 60px; max-width: 1400px; }
.menu-btn { display: inline-flex; }
.shell { transition: grid-template-columns .15s; }
.shell.collapsed { grid-template-columns: 68px 1fr; }
.shell.collapsed .side { padding: 18px 10px; }
.shell.collapsed .lbl, .shell.collapsed .side .foot { display: none; }
.shell.collapsed .brand { justify-content: center; padding: 4px 0 18px; }
.shell.collapsed .nav a { justify-content: center; position: relative; padding: 10px 0; }
.shell.collapsed .nav .count { position: absolute; top: 2px; right: 4px; padding: 0 5px; }
.nav .ico { width: 18px; text-align: center; flex: none; }
@media (max-width: 900px) {
  .shell, .shell.collapsed { grid-template-columns: 1fr; }
  .shell.collapsed .lbl { display: inline; } .shell.collapsed .side .foot { display: block; }
  .shell.collapsed .nav a { justify-content: flex-start; padding: 9px 10px; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px 16px 60px; }
}

/* Components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-b { padding: 16px; }
.stack { display: grid; gap: 16px; }
.stack > * { min-width: 0; }
.grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; }
.kpi .l { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi .v { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi.err .v { color: var(--err); } .kpi.ok .v { color: var(--ok); }
.btn { font: inherit; font-weight: 600; font-size: 13px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--err); border-color: var(--err); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.lg { padding: 12px 20px; font-size: 15px; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); 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.err { background: var(--err-soft); color: var(--err); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.t td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tr.click { cursor: pointer; } .t tr.click:hover td { background: var(--surface-2); }
.t tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border-strong); }
.t .group td { background: var(--surface-2); font-weight: 700; font-size: 12px; color: var(--muted); }
.scroll-x { overflow-x: auto; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs .count { font-size: 11px; background: var(--surface-2); border-radius: 99px; padding: 0 6px; margin-left: 4px; }

.alert { display: flex; gap: 10px; padding: 10px 14px; border-radius: 8px; font-size: 13px; align-items: flex-start; }
.alert.err { background: var(--err-soft); color: var(--err); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--info-soft); color: var(--info); }

.stepper { display: flex; gap: 0; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--faint); padding: 4px 10px 4px 0; }
.step .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--border-strong); font-size: 11px; }
.step.done { color: var(--ok); } .step.done .n { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.now { color: var(--brand); } .step.now .n { border-color: var(--brand); background: var(--brand-soft); }
.step + .step::before { content: ''; width: 18px; height: 1.5px; background: var(--border-strong); margin-right: 2px; }

/* Checadas */
.grid-shifts td.cell { padding: 4px; min-width: 132px; }
.shift div { white-space: nowrap; }
.shift { border-radius: 7px; padding: 5px 7px; font-size: 11.5px; line-height: 1.3; border: 1px solid var(--border); background: var(--surface); cursor: pointer; position: relative; min-height: 42px; }
.shift:hover { border-color: var(--brand); }
.shift b { font-size: 12px; display: block; }
.shift.full { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.shift.half { background: var(--info-soft); border-color: transparent; color: var(--info); }
.shift.est { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.shift.off { background: var(--surface-2); color: var(--faint); }
.shift.missing { background: var(--err-soft); color: var(--err); border-color: transparent; }
.shift.excluded { opacity: .45; }
.shift.edited::after { content: '✎'; position: absolute; top: 3px; right: 5px; font-size: 11px; color: var(--edit); }
.shift .amt { color: var(--text); font-weight: 600; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* Bitácora */
.timeline { display: grid; gap: 0; }
.tl { display: grid; grid-template-columns: 150px 1fr; gap: 14px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.tl:last-child { border-bottom: 0; }
.tl.op { background: linear-gradient(90deg, var(--warn-soft), transparent 40%); }
.tl .when { font-size: 12px; color: var(--muted); }
.tl .who { font-weight: 600; }
.diff { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12.5px; }
.diff .old { text-decoration: line-through; color: var(--err); background: var(--err-soft); padding: 0 5px; border-radius: 4px; }
.diff .new { color: var(--ok); background: var(--ok-soft); padding: 0 5px; border-radius: 4px; font-weight: 600; }
.note { font-size: 12.5px; color: var(--muted); font-style: italic; margin-top: 2px; }
@media (max-width: 700px) { .tl { grid-template-columns: 1fr; gap: 2px; } }

/* Forms */
label.f { display: grid; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; font-size: 14px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--brand); flex: none; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; color: var(--text); font-size: 13.5px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select, .filters input { width: auto; min-width: 160px; }

/* Modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 18, 24, .5); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .12s; }
.modal { background: var(--surface); border-radius: 14px; width: min(520px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: min(860px, 100%); }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal-b { padding: 18px 20px; display: grid; gap: 14px; }
.modal-f { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--nav); color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 500; box-shadow: var(--shadow); animation: fade .15s; }
.toast.err { background: var(--err); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

/* Notificaciones */
.bell { position: relative; }
.bell .n { position: absolute; top: -3px; right: -3px; background: var(--brand); color: #fff; font-size: 10px; border-radius: 99px; padding: 0 5px; }
.dropdown { position: absolute; right: 0; top: 42px; width: min(360px, 90vw); z-index: 20; }
.notif { padding: 10px 14px; border-bottom: 1px solid var(--border); display: block; color: var(--text); }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.notif.unread { border-left: 3px solid var(--brand); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 20% 10%, var(--brand-soft), transparent 50%), var(--bg); }
.login .card { width: min(400px, 100%); padding: 28px; }
.demo-users { display: grid; gap: 6px; margin-top: 8px; }
.demo-users button { text-align: left; justify-content: flex-start; }

/* Recibo */
.receipt { max-width: 720px; margin: 0 auto; }
.receipt-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.total-big { font-size: 34px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.declaration { background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 8px; padding: 14px; font-size: 13.5px; }
.sigpad { border: 2px dashed var(--border-strong); border-radius: 10px; background: #fff; touch-action: none; width: 100%; height: 190px; display: block; cursor: crosshair; }
.sig-img { background: #fff; border: 1px solid var(--border); border-radius: 8px; max-width: 360px; width: 100%; padding: 4px; }
.receipt-card { display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
.receipt-card .amt { font-size: 20px; font-weight: 700; margin-left: auto; font-variant-numeric: tabular-nums; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; display: flex; border: 1px solid var(--border); }
.progress i { display: block; height: 100%; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }

@media print {
  .side, .topbar, .no-print, .toasts { display: none !important; }
  .shell { display: block; } .content { padding: 0; }
  .card { box-shadow: none; border: 0; }
  body { background: #fff; }
}

/* Ajustes: tarjetas de importe sin asignar */
.alloc-card { border: 1px solid var(--border); border-left: 5px solid var(--err); border-radius: var(--radius); background: var(--surface); }
.alloc-card.done { border-left-color: var(--ok); background: var(--surface-2); }
.alloc-card .card-h { background: var(--err-soft); border-radius: 0 var(--radius) 0 0; }
.alloc-card.done .card-h { background: var(--ok-soft); }
.section-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 6px 0 -4px; }
.linkish { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.t th[data-sort] { cursor: pointer; user-select: none; }

/* Checklist de importaciones */
.t.imports td { padding: 4px; min-width: 104px; }
.imp { border-radius: 7px; padding: 6px 8px; font-size: 11.5px; line-height: 1.3; border: 1px solid transparent; }
.imp b { font-size: 12.5px; display: block; }
.imp.ok { background: var(--ok-soft); color: var(--ok); }
.imp.empty { background: var(--warn-soft); color: var(--warn); }
.imp.miss { background: var(--err-soft); color: var(--err); }
.imp.can { cursor: pointer; }
.imp.can:hover { border-color: var(--brand); }

/* Logo de Grupo Gastronómico La Posta */
.logo-img { background: #fff url(/img/logo.png) center / contain no-repeat; border-radius: 50%; flex: none; }
.brand .logo.logo-img { width: 42px; height: 42px; border-radius: 50%; background: #fff url(/img/logo.png) center / 150% no-repeat; box-shadow: 0 0 0 2px rgba(255,255,255,.18); } /* en el menú: el agave centrado (el texto del sello no se lee a este tamaño) */
.login-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; margin-bottom: 4px; }
.login-brand .logo-img { width: 132px; height: 132px; margin-bottom: 10px; box-shadow: 0 4px 18px rgba(0,0,0,.12); }
.login-brand h1 { margin: 0; font-size: 22px; }
.brand .lbl { white-space: nowrap; font-size: 15px; }
code.dux-id { display: inline-block; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
