/* Panel web · SaaS All-In-One (sin compilación). Colores como variables: claro / oscuro + color de marca. */
:root {
  --brand: #4f46e5;
  --brand-ink: #ffffff;
  --brand-soft: color-mix(in srgb, var(--brand) 12%, transparent);
  --bg: #f4f5f9;
  --panel: #ffffff;
  --panel-2: #f8f9fc;
  --ink: #161a2b;
  --muted: #667085;
  --line: #e4e7ef;
  --ok: #12a150;
  --ok-soft: #e3f6ec;
  --warn: #d97706;
  --warn-soft: #fdf1df;
  --bad: #dc2626;
  --bad-soft: #fde7e7;
  --info: #2563eb;
  --info-soft: #e3ecfd;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
  --radius: 12px;
  --side: 248px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d1017;
  --panel: #151a24;
  --panel-2: #1b2130;
  --ink: #e8ebf3;
  --muted: #98a2b3;
  --line: #262e3f;
  --ok-soft: #10301f;
  --warn-soft: #33250d;
  --bad-soft: #3a1414;
  --info-soft: #132443;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
small, .muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; word-break: break-all; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 26px; height: 26px; }

/* ---------- Botones y formularios ---------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
button:hover, .btn:hover { background: var(--panel-2); text-decoration: none; }
button:disabled { opacity: .55; cursor: not-allowed; }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
button.primary:hover { filter: brightness(1.07); background: var(--brand); }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
button.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--brand-soft); }
button.sm { min-height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
button.icon-only { padding: 0; width: 36px; }
button.sm.icon-only { width: 30px; }
button.block { width: 100%; }
label { display: block; font-weight: 550; font-size: 13px; margin-bottom: 4px; }
.field { margin-bottom: 14px; min-width: 0; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
input, select, textarea {
  width: 100%; min-height: 38px; padding: 8px 11px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit;
}
textarea { min-height: 80px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; min-height: 0; accent-color: var(--brand); vertical-align: -3px; }
input[type="color"] { padding: 3px; width: 56px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 1px; border-color: var(--brand); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 6px 0; cursor: pointer; }
.grid { display: grid; gap: 14px; }
.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; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px 20px;
  display: flex; flex-direction: column; gap: 2px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; font-weight: 700; font-size: 16px; }
.brand img { max-height: 34px; max-width: 150px; object-fit: contain; }
.brand .logo-dot { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 800; }
.side .sec { margin: 14px 10px 4px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.nav-a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
  color: var(--ink); font-weight: 520; text-decoration: none !important;
}
.nav-a:hover { background: var(--panel-2); }
.nav-a.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.nav-a .soon { margin-left: auto; font-size: 10px; padding: 1px 6px; border-radius: 99px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.nav-a .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 11px; display: grid; place-items: center; font-weight: 700; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 10px;
  padding: 0 22px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top .who { text-align: right; line-height: 1.2; }
.top .who b { display: block; font-size: 13px; }
.top .who small { font-size: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.menu-btn { display: none; }
.content { padding: 22px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.banner { padding: 10px 22px; font-weight: 550; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.info { background: var(--info-soft); color: var(--info); }

/* ---------- Tarjetas, tablas, etiquetas ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card.flat { box-shadow: none; }
.card.pad0 { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.kpi { display: flex; gap: 14px; align-items: flex-start; }
.kpi .ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.kpi .v { font-size: 22px; font-weight: 750; line-height: 1.15; }
.kpi .l { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; background: var(--panel-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--panel-2) 60%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.green { background: var(--ok); } .dot.orange { background: var(--warn); } .dot.red { background: var(--bad); }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.empty .icon { width: 34px; height: 34px; margin-bottom: 8px; opacity: .6; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; border-radius: 0; background: transparent; border-bottom: 2px solid transparent; min-height: 40px; color: var(--muted); }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.bar { height: 10px; background: var(--panel-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .6s; }
.goal.ACHIEVED .bar > span { background: var(--ok); }
.goal.BEHIND .bar > span { background: var(--warn); }
.goal.MISSED .bar > span { background: var(--bad); }
.goal .nums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.goal .nums div { background: var(--panel-2); border-radius: 9px; padding: 8px 10px; }
.goal .nums b { display: block; font-size: 17px; }
.goal .nums small { font-size: 12px; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Modal y avisos ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(10, 14, 25, .5); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--panel); border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { width: min(880px, 100%); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-b { padding: 18px; overflow-y: auto; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--panel); padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow); animation: fade .2s; display: flex; gap: 8px; align-items: flex-start; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* ---------- Login partido ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-art { position: relative; background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #0b1020)); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.auth-art img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.auth-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .55), rgba(0, 0, 0, .05) 60%); }
.auth-art > * { position: relative; z-index: 1; }
.auth-art h1 { font-size: 34px; max-width: 520px; }
.auth-art p { font-size: 16px; opacity: .9; max-width: 520px; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; background: var(--panel); }
.auth-box { width: min(420px, 100%); }
.auth-box .brand { padding: 0 0 22px; }
.auth-box h2 { font-size: 22px; margin-bottom: 4px; }
.auth-box > p { color: var(--muted); margin: 0 0 20px; }
.niche-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 330px; overflow-y: auto; padding: 2px; }
.niche { display: flex; align-items: center; gap: 8px; text-align: left; justify-content: flex-start; min-height: 46px; white-space: normal; font-weight: 500; font-size: 13px; line-height: 1.2; padding: 6px 10px; }
.niche.sel { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 650; }

/* ---------- WhatsApp (bandeja) ---------- */
.inbox { display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px; height: calc(100vh - 60px - 44px); min-height: 520px; gap: 0; }
.inbox > div { min-height: 0; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); }
.inbox > div:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.inbox > div:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.inbox > div + div { border-left: 0; }
.conv-filters { padding: 10px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.conv-list { overflow-y: auto; flex: 1; }
.conv { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.conv:hover { background: var(--panel-2); }
.conv.sel { background: var(--brand-soft); }
.conv .t { display: flex; gap: 6px; align-items: center; }
.conv .t b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .p { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { background: var(--ok); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.chat-head { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.messages { flex: 1; overflow-y: auto; padding: 16px; background: var(--panel-2); display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 72%; padding: 8px 11px; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; box-shadow: 0 1px 1px rgba(0, 0, 0, .06); }
.msg.IN { background: var(--panel); align-self: flex-start; border-top-left-radius: 3px; }
.msg.OUT { background: color-mix(in srgb, var(--ok) 18%, var(--panel)); align-self: flex-end; border-top-right-radius: 3px; }
.msg.SYSTEM, .msg.NOTE { align-self: center; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; }
.msg img, .msg video { max-width: 260px; max-height: 260px; border-radius: 8px; display: block; margin-bottom: 4px; }
.msg audio { max-width: 260px; display: block; }
.msg .meta { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }
.composer { padding: 10px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.composer textarea { min-height: 44px; height: 44px; }
.side-panel { overflow-y: auto; padding: 12px; }
.side-panel h3 { margin: 14px 0 6px; font-size: 13px; }
.note { background: var(--warn-soft); border-radius: 9px; padding: 8px 10px; margin-bottom: 6px; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.board .note { color: #3b2f0b; min-height: 120px; padding: 14px; box-shadow: var(--shadow); }
.qr-box { text-align: center; padding: 10px; }
.qr-box img { width: 260px; height: 260px; background: #fff; padding: 8px; border-radius: 10px; }

/* ---------- Agenda ---------- */
.cal { display: grid; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); max-height: calc(100vh - 220px); }
.cal-col-h { position: sticky; top: 0; z-index: 3; background: var(--panel-2); border-bottom: 1px solid var(--line); padding: 8px; font-weight: 650; font-size: 13px; text-align: center; border-left: 1px solid var(--line); }
.cal-times { position: sticky; left: 0; z-index: 2; background: var(--panel); }
.cal-time { height: 48px; font-size: 11px; color: var(--muted); padding: 2px 6px; border-top: 1px solid var(--line); text-align: right; }
.cal-col { position: relative; border-left: 1px solid var(--line); }
.cal-slot { height: 48px; border-top: 1px solid var(--line); }
.cal-slot:nth-child(odd) { background: color-mix(in srgb, var(--panel-2) 45%, transparent); }
.cal-slot.free { cursor: pointer; }
.cal-slot.free:hover { background: var(--brand-soft); }
.appt { position: absolute; left: 3px; right: 3px; border-radius: 8px; padding: 4px 7px; font-size: 12px; line-height: 1.25; overflow: hidden; cursor: pointer; color: #fff; background: var(--brand); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); border-left: 4px solid rgba(0, 0, 0, .25); }
.appt.CANCELLED, .appt.NO_SHOW { opacity: .45; text-decoration: line-through; }
.appt.COMPLETED { filter: saturate(.55); }
.appt.BLOCK { background: repeating-linear-gradient(45deg, #9aa3b5, #9aa3b5 6px, #aab2c2 6px, #aab2c2 12px) !important; color: #1d2433; }
.slot-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.slot-pick button.sel { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* ---------- Punto de venta ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.item-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 84px; padding: 10px 12px; text-align: left; white-space: normal; border-left: 4px solid var(--brand); }
.item-btn b { font-size: 13.5px; line-height: 1.25; }
.item-btn .price { font-weight: 750; color: var(--brand); margin-top: auto; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.qty { display: inline-flex; align-items: center; gap: 4px; }
.qty input { width: 52px; text-align: center; padding: 4px; min-height: 30px; }
.total-big { font-size: 28px; font-weight: 800; }

/* ---------- Fichaje ---------- */
.clock-card { text-align: center; padding: 28px 18px; }
.clock-big { font-size: 56px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .02em; margin: 14px 0 4px; line-height: 1.1; }
.clock-btn { min-height: 52px; padding: 0 22px; font-size: 16px; border-radius: 12px; }

/* ---------- Gráfico ingresos/gastos (paleta categórica validada: azul / naranja) ---------- */
.chart-wrap { position: relative; }
.bar-in { fill: #2a78d6; }
.bar-out { fill: #eb6834; }
:root[data-theme="dark"] .bar-in { fill: #3987e5; }
:root[data-theme="dark"] .bar-out { fill: #d95926; }
.axis-label { fill: var(--muted); font-size: 11px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.in { background: #2a78d6; } .sw.out { background: #eb6834; }
:root[data-theme="dark"] .sw.in { background: #3987e5; } :root[data-theme="dark"] .sw.out { background: #d95926; }
.chart-tip { position: absolute; top: 4px; min-width: 170px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 9px; padding: 8px 10px; font-size: 12.5px; pointer-events: none; color: var(--ink); }
details summary { cursor: pointer; }

/* ---------- Restaurante: sala ---------- */
.floor-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.floor { position: relative; width: 100%; aspect-ratio: 24 / 16; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background-image: radial-gradient(color-mix(in srgb, var(--muted) 30%, transparent) 1px, transparent 1px); background-size: calc(100% / 24) calc(100% / 16); }
.floor.editing { outline: 2px dashed var(--brand); outline-offset: 2px; }
.floor-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.table-node { position: absolute; width: calc(100% / 24 * 2.6); height: calc(100% / 16 * 2.6); min-width: 64px; min-height: 58px; padding: 4px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; line-height: 1.15; white-space: normal; text-align: center;
  border: 2px solid var(--ok); background: var(--ok-soft); color: var(--ink); touch-action: none; box-shadow: var(--shadow); }
.table-node b { font-size: 15px; }
.table-node small { font-size: 11px; color: var(--muted); }
.table-node small.res { color: var(--info); font-weight: 600; }
.table-node.shape-ROUND { border-radius: 50%; }
.table-node.shape-RECT { width: calc(100% / 24 * 4); }
.table-node.t-OCCUPIED { border-color: var(--brand); background: var(--brand-soft); }
.table-node.t-READY { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 22%, var(--panel)); animation: pulse 1.6s infinite; }
.table-node.t-BILL { border-color: var(--warn); background: var(--warn-soft); }
.floor.editing .table-node { cursor: grab; border-style: dashed; }
.table-badge { position: absolute; top: -8px; right: -8px; background: var(--ok); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; }
.table-vip { position: absolute; top: -8px; left: -8px; background: #b45309; color: #fff; border-radius: 6px; font-size: 9px; font-weight: 800; padding: 1px 4px; }
.legend-dot { width: 12px; height: 12px; border-radius: 4px; border: 2px solid var(--ok); background: var(--ok-soft); display: inline-block; }
.legend-dot.t-OCCUPIED { border-color: var(--brand); background: var(--brand-soft); }
.legend-dot.t-READY { background: color-mix(in srgb, var(--ok) 35%, var(--panel)); }
.legend-dot.t-BILL { border-color: var(--warn); background: var(--warn-soft); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ok) 25%, transparent); } }

/* ---------- Restaurante: cuenta ---------- */
.modal.order-modal { width: min(1180px, 100%); height: calc(100vh - 32px); }
.order-view { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 16px; height: 100%; }
.order-left { min-height: 0; overflow-y: auto; }
.order-right { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.order-modal .modal-b { flex: 1; min-height: 0; overflow: hidden; }
.order-lines { flex: 1; min-height: 120px; overflow-y: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.order-line { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 8px 2px; border-bottom: 1px dashed var(--line); }
.order-line.draft { background: var(--warn-soft); border-radius: 8px; padding: 8px; }
.order-line.cancelled { opacity: .45; text-decoration: line-through; }
.qty-b { font-weight: 800; font-size: 15px; }
.order-totals { padding: 10px 2px; }
.order-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ---------- Cocina y barra ---------- */
.kds { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; align-items: start; }
.kds-card { background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.kds-card.warn { border-color: var(--warn); }
.kds-card.late { border-color: var(--bad); }
.kds-card.done { opacity: .7; border-color: var(--ok); }
.kds-head { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.kds-age { font-weight: 800; font-variant-numeric: tabular-nums; }
.kds-card.warn .kds-age { color: var(--warn); } .kds-card.late .kds-age { color: var(--bad); }
.kds-item { display: block; width: 100%; text-align: left; white-space: normal; padding: 8px 10px; margin-top: 6px; min-height: 0; border-radius: 9px; font-weight: 500; }
.kds-item b { font-size: 15px; display: block; }
.kds-item.s-PREPARING { background: var(--info-soft); border-color: var(--info); }
.kds-item.s-READY { background: var(--ok-soft); border-color: var(--ok); }
.kds-note { color: var(--bad); font-weight: 600; font-size: 13px; }

/* ---------- Para llevar / delivery ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; align-items: start; }
.kanban-col { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; min-height: 200px; }
.kanban-h { display: flex; align-items: center; gap: 8px; padding: 4px 6px 8px; }
.kanban-card { padding: 10px; margin-bottom: 8px; }


/* ---------- Membresías ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.plan-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; min-height: 0; height: auto; white-space: normal; text-align: left;
  border: 2px solid var(--line); border-left: 5px solid var(--plan, var(--brand)); border-radius: 10px; background: var(--panel); }
.plan-card.active { border-color: var(--plan, var(--brand)); background: color-mix(in srgb, var(--plan, var(--brand)) 10%, var(--panel)); }
.plan-card .plan-price { font-size: 17px; font-weight: 800; }
.plan-card small { font-size: 12px; }
.member-view { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.member-card { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.member-card img { border-radius: 8px; background: #fff; padding: 4px; width: 120px; height: 120px; }
.membership-item { padding: 12px; }

/* ---------- Control de acceso ---------- */
.access-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.scan-input { font-size: 20px; min-height: 54px; }
.scan-video { width: 100%; max-height: 300px; margin-top: 10px; border-radius: 10px; background: #000; object-fit: cover; }
.access-result { border-radius: var(--radius); padding: 28px 18px; text-align: center; border: 2px solid var(--line); background: var(--panel); min-height: 240px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.access-result.idle { color: var(--muted); }
.access-result.ok { border-color: var(--ok); background: var(--ok-soft); }
.access-result.bad { border-color: var(--bad); background: var(--bad-soft); }
.access-result.warn { border-color: var(--warn); background: var(--warn-soft); }
.access-big { font-size: 34px; font-weight: 900; letter-spacing: .5px; }
.access-result.ok .access-big { color: var(--ok); } .access-result.bad .access-big { color: var(--bad); } .access-result.warn .access-big { color: var(--warn); }
.access-name { font-size: 24px; font-weight: 700; }
.access-reason { font-size: 18px; font-weight: 600; }
.access-meta { font-size: 15px; }
.access-log { display: flex; flex-direction: column; max-height: 62vh; overflow-y: auto; margin-top: 8px; }
.access-row { display: grid; grid-template-columns: 10px 46px minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; text-align: left; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; background: transparent; min-height: 36px; padding: 4px 2px; font-weight: 400; }
.access-row .dot, .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Clases ---------- */
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: start; }
.week-col { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; min-height: 160px; display: flex; flex-direction: column; gap: 6px; }
.week-col.today { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.week-h { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px; }
.class-chip { display: flex; flex-direction: column; align-items: stretch; gap: 2px; text-align: left; white-space: normal; height: auto; min-height: 0; padding: 7px 8px;
  border-radius: 9px; border: 1px solid var(--line); border-left: 4px solid var(--c, var(--brand)); background: var(--panel); font-weight: 400; }
.class-chip b { font-size: 13px; }
.class-chip small { font-size: 11.5px; }
.class-chip.past { opacity: .6; }
.class-chip.cancelled { opacity: .55; text-decoration: line-through; }
.cap-bar { position: relative; height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 4px; }
.cap-bar span { position: absolute; inset: 0 auto 0 0; background: var(--c, var(--brand)); }
.warn-t { color: var(--warn); font-weight: 600; }
.bad-t { color: var(--bad); font-weight: 600; }
.print-card { display: grid; place-items: center; }
.print-card-in { width: 85.6mm; min-height: 54mm; border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; background: #fff; color: #111; }


/* ---------- Expedientes ---------- */
.case-board { align-items: start; }
.case-col-list { display: flex; flex-direction: column; gap: 8px; min-height: 80px; border-radius: 10px; padding: 2px; transition: background .15s; }
.case-col-list.over { background: var(--brand-soft); }
.case-drop-hint { color: var(--muted); font-size: 12px; text-align: center; padding: 18px 0; border: 1px dashed var(--line); border-radius: 10px; }
.case-card { display: flex; flex-direction: column; align-items: stretch; gap: 3px; text-align: left; white-space: normal; height: auto; min-height: 0; padding: 10px; cursor: grab; font-weight: 400; border: 1px solid var(--line); }
.case-card.dragging { opacity: .5; }
.case-card.overdue { border-left: 4px solid var(--bad); }
.case-card.stuck:not(.overdue) { border-left: 4px solid var(--warn); }
.case-title { font-size: 14px; line-height: 1.3; }
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }
.case-modal { width: min(1180px, 100%); }
.case-view { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stepper { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.stepper .step { flex: 1 1 0; min-width: 92px; display: flex; flex-direction: column; align-items: center; gap: 4px; height: auto; padding: 6px 4px; border: 0; background: transparent; white-space: normal; text-align: center; font-weight: 500; }
.stepper .step .dot { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--line); background: var(--panel); }
.stepper .step.done .dot { background: var(--ok); border-color: var(--ok); }
.stepper .step.current .dot { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.stepper .step.current small { color: var(--ink); font-weight: 700; }
.stepper .step:disabled { opacity: 1; cursor: default; }
.kv { display: flex; flex-direction: column; gap: 6px; }
.kv-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.case-desc { white-space: pre-wrap; background: var(--panel-2); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.check-row { display: flex; align-items: center; gap: 6px; border-bottom: 1px dashed var(--line); padding: 2px 0; }
.doc-row { border-bottom: 1px dashed var(--line); padding: 4px 0; }
.timeline { display: flex; flex-direction: column; gap: 0; max-height: 70vh; overflow-y: auto; }
.tl-item { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tl-ic { width: 26px; height: 26px; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; font-size: 13px; }
.tl-body { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; }
.stage-row { border-bottom: 1px dashed var(--line); padding: 4px 0; }

/* ---------- Cobranzas ---------- */
.aging { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.aging-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 110px 34px; gap: 10px; align-items: center; height: auto; min-height: 34px; padding: 4px 6px; border: 0; background: transparent; font-weight: 400; text-align: left; }
.aging-row:hover, .aging-row.active { background: var(--brand-soft); }
.aging-bar { height: 12px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.aging-bar span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: #2a78d6; }
:root[data-theme="dark"] .aging-bar span { background: #3987e5; }
.aging-v { text-align: right; font-variant-numeric: tabular-nums; }
.aging-c { text-align: right; }
.agenda-row { display: flex; flex-wrap: wrap; width: 100%; align-items: center; gap: 8px; height: auto; min-height: 38px; padding: 6px 8px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; font-weight: 400; }
.mini-kpis { gap: 8px; }
.mini { padding: 8px 10px; display: flex; flex-direction: column; }
.mini b { font-size: 16px; font-variant-numeric: tabular-nums; }

/* ---------- Colegios: grupos y asistencia ---------- */
.group-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.group-card { display: flex; flex-direction: column; gap: 6px; }
.muted-card { opacity: .6; }
.capacity { display: flex; align-items: center; gap: 8px; }
.capacity-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.capacity-bar span { display: block; height: 100%; background: var(--brand); }
.att-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 12px; align-items: start; }
.att-groups { display: flex; flex-direction: column; gap: 4px; }
.att-group { display: grid; grid-template-columns: minmax(0, 1fr) 10px; grid-template-areas: "n d" "s d"; align-items: center; height: auto; min-height: 48px; padding: 6px 10px; text-align: left; font-weight: 400; gap: 0 6px; }
.att-group b { grid-area: n; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-group > small { grid-area: s; }
.att-group.active { border-color: var(--brand); background: var(--brand-soft); }
.att-dot { grid-area: d; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.att-dot.ok { background: var(--ok); }
.att-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name seg" "note note"; gap: 4px 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.att-name { grid-area: name; min-width: 0; overflow-wrap: anywhere; }
.att-seg { grid-area: seg; display: inline-flex; gap: 4px; }
.att-note { grid-area: note; height: 32px; }
.att-btn { width: 40px; min-width: 40px; height: 36px; padding: 0; font-weight: 700; }
.att-btn.on.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.att-btn.on.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.att-btn.on.warn { background: var(--warn, #d97706); border-color: var(--warn, #d97706); color: #fff; }
.att-btn.on.info { background: #2a78d6; border-color: #2a78d6; color: #fff; }
.att-hist { gap: 8px; font-size: 13px; }
.cert { font-family: Georgia, "Times New Roman", serif; font-size: 15px; line-height: 1.75; max-width: 620px; margin: 0 auto; }
.cert p { text-align: justify; }

/* ---------- Idioma en la pantalla de acceso ---------- */
.lang-float { position: fixed; right: 12px; bottom: 12px; width: auto; z-index: 5; font-size: 13px; padding: 6px 8px; }

/* ---------- Inventario ---------- */
.pline { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.pline-name { min-width: 0; overflow-wrap: anywhere; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .floor-wrap { grid-template-columns: minmax(0, 1fr); }
  .access-wrap { grid-template-columns: minmax(0, 1fr); }
  .week-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .case-view { grid-template-columns: minmax(0, 1fr); }
  .order-view { grid-template-columns: minmax(0, 1fr) 360px; }
  .inbox { grid-template-columns: 280px minmax(0, 1fr); }
  .inbox > .side-panel-wrap { display: none !important; }
  .pos { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; z-index: 60; width: 270px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .shell.open .side { transform: none; }
  .shell.open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 50; }
  .menu-btn { display: inline-flex; }
  .top { padding: 0 12px; }
  .top .who { display: none; }
  .content { padding: 16px; }
  .banner { padding: 8px 12px; font-size: 12.5px; gap: 6px; }
  .banner .btn, .banner button { min-height: 28px; padding: 0 9px; font-size: 12px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { min-height: 190px; padding: 24px; }
  .auth-art h1 { font-size: 24px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .inbox { grid-template-columns: minmax(0, 1fr); height: auto; }
  .inbox > div { border-radius: var(--radius) !important; border-left: 1px solid var(--line) !important; margin-bottom: 10px; }
  .inbox .conv-list { max-height: 320px; }
  .inbox .messages { min-height: 360px; }
  .msg { max-width: 88%; }
  .goal .nums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clock-big { font-size: 42px; }
  .floor-wrap { grid-template-columns: minmax(0, 1fr); }
  .floor { aspect-ratio: 3 / 4; }
  .order-view { grid-template-columns: minmax(0, 1fr); height: auto; }
  .modal.order-modal { height: auto; }
  .order-modal .modal-b { overflow-y: auto; }
  .order-left { max-height: 45vh; }
  .kanban { grid-template-columns: repeat(5, minmax(240px, 85vw)); }
  .week-grid { grid-template-columns: minmax(0, 1fr); }
  .case-view { grid-template-columns: minmax(0, 1fr); }
  .att-layout { grid-template-columns: minmax(0, 1fr); }
  .pline { grid-template-columns: minmax(0, 1fr) auto auto; }
  .pline .pline-name { grid-column: 1 / -1; }
  .att-groups { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .att-group { min-width: 150px; }
  .att-row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "name" "seg" "note"; }
  .kv-row { grid-template-columns: 96px minmax(0, 1fr); }
  .aging-row { grid-template-columns: 92px minmax(0, 1fr) 96px 26px; gap: 6px; }
  .mini-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .week-col { min-height: 0; }
  .member-view { grid-template-columns: minmax(0, 1fr); }
  .access-big { font-size: 26px; }
  .access-row { grid-template-columns: 10px 44px minmax(0, 1.2fr) minmax(0, 1fr) auto; }
  .access-result { min-height: 150px; padding: 18px 12px; }
  .member-view > :last-child { order: -1; }
  th, td { padding: 9px 10px; }
}
@media print {
  body.printing > *:not(.overlay) { display: none !important; }
  body.printing .overlay { position: static; background: none; padding: 0; }
  body.printing .modal { box-shadow: none; max-height: none; width: 100%; }
  body.printing .modal-h, body.printing .modal-f { display: none !important; }
  .side, .top, .banner, .no-print { display: none !important; }
  .shell { display: block; }
  .card { box-shadow: none; }
}
