/* =====================================================================
   WOBI Registro · Estilos
   Identidad: Montserrat, base negro/blanco, acento coral, turquesa para éxito.
   ===================================================================== */
:root {
    --bg: #f5f6f7;
    --surface: #ffffff;
    --surface-2: #f8f9fa;
    --border: #e6e8eb;
    --border-strong: #d5d9de;
    --text: #161616;
    --text-2: #4a5059;
    --muted: #7a818c;
    --primary: #c4643f;          /* coral oscuro: contraste AA con texto blanco */
    --primary-hover: #ad5432;
    --accent: #df8765;           /* coral de marca WOBI */
    --accent-soft: #fbeee8;
    --success: #1f8f9a;
    --success-soft: #e3f6f8;
    --warning: #9a6b00;
    --warning-soft: #fff6d6;
    --danger: #c0392b;
    --danger-soft: #fdecea;
    --info: #3f79a0;
    --info-soft: #e8f1f7;
    --platinum-bg: #2b3744;
    --platinum-fg: #ffffff;
    --gold-bg: #ffe37e;
    --gold-fg: #4d3b00;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow: 0 4px 16px rgba(16, 24, 40, .06);
    --shadow-lg: 0 24px 48px rgba(16, 24, 40, .16);
    --radius: 14px;
    --radius-sm: 10px;
    --sidebar-w: 248px;
    --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --mono: ui-monospace, 'Cascadia Mono', Consolas, 'SFMono-Regular', Menlo, monospace;
    color-scheme: light;
}

/* Tema claro por defecto. El oscuro solo se activa con el botón "Apariencia". */
:root[data-theme="dark"] {
    --bg: #0f1113; --surface: #171a1e; --surface-2: #1d2126; --border: #2a2f36; --border-strong: #363c44;
    --text: #eceef1; --text-2: #c3c8cf; --muted: #8f97a2;
    --primary: #d0724c; --primary-hover: #e0845f; --accent-soft: #3a2a23;
    --success: #5fcad4; --success-soft: #16353a; --warning: #f2c94c; --warning-soft: #3a3115;
    --danger: #f07a6c; --danger-soft: #3d1f1c; --info: #79b3d6; --info-soft: #1b2e3b;
    --platinum-bg: #d9dee4; --platinum-fg: #1b232c;
    --shadow: 0 4px 16px rgba(0, 0, 0, .3); --shadow-lg: 0 24px 48px rgba(0, 0, 0, .5);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text);
    background: var(--bg); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.upper { text-transform: uppercase; }
.t-right { text-align: right !important; }
.mr-auto { margin-right: auto; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
    display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border);
    padding: 20px 14px; transition: transform .25s ease;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.sb-brand img { height: 30px; width: auto; }
.sb-tag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); border-left: 1px solid var(--border); padding-left: 10px; }
.logo-dark-theme { display: none; }
:root[data-theme="dark"] .logo-light-theme { display: none; }
:root[data-theme="dark"] .logo-dark-theme { display: block; }
.sb-tema { margin-top: auto; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sb-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 16px 12px 6px; }
.sb-nav a, .sb-link {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm);
    text-decoration: none; color: var(--text-2); font-weight: 500; font: inherit; font-weight: 500;
    background: none; border: 0; cursor: pointer; text-align: left; width: 100%;
}
.sb-nav a:hover, .sb-link:hover { background: var(--surface-2); color: var(--text); }
.sb-nav a.active { background: var(--surface-2); color: var(--text); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.sb-footer { display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--border); }
.sb-footer form { margin-left: auto; }
.sb-user { display: flex; flex-direction: column; min-width: 0; }
.sb-user strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user span { font-size: 12px; color: var(--muted); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
    background: var(--text); color: var(--surface); font-size: 12px; font-weight: 700;
}
.sb-backdrop { display: none; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
    height: 64px; padding: 0 28px; background: var(--bg); background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.crumbs svg { width: 14px; height: 14px; }
.crumbs strong { color: var(--text); font-weight: 600; }
.top-search {
    margin-left: auto; display: flex; align-items: center; gap: 8px; width: min(360px, 40vw);
    background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 14px; height: 38px; color: var(--muted);
}
.top-search input { border: 0; outline: 0; background: transparent; width: 100%; font: inherit; color: var(--text); }
.top-search:focus-within { border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--accent-soft); }
.content { padding: 28px; width: 100%; flex: 1; }
.only-mobile { display: none !important; }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
    border-radius: 999px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 13px;
    cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:focus-visible, .icon-btn:focus-visible, .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover:not(:disabled) { border-color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-lg { height: 46px; padding: 0 22px; font-size: 14px; }
.btn-block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after {
    content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn-outline.loading::after, .btn-ghost.loading::after { border-color: var(--border-strong); border-top-color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
    display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 0;
    background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: var(--text); }

/* ---------- Página ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card + .card, section + section { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.section-title { font-size: 13px; font-weight: 700; margin: 0 0 10px; }
.section-title small { font-weight: 500; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpis-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow-sm); }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi small { font-size: 12px; color: var(--muted); }
.kpi.kpi-warn .kpi-value { color: var(--warning); }
.kpi.kpi-ok .kpi-value { color: var(--success); }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field input, .field select, .filters select, .filters input {
    height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); font: inherit; outline: none; width: 100%; min-width: 0;
}
.field input:focus, .field select:focus, .filters select:focus, .filters input:focus { border-color: var(--text); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input[readonly] { background: var(--surface-2); color: var(--muted); }
.field.has-error input, .field.has-error select { border-color: var(--danger); }
.field-error { font-style: normal; font-size: 12px; color: var(--danger); min-height: 0; }
.field-error:empty { display: none; }
.hint { font-size: 12px; color: var(--muted); }
.grid { display: grid; gap: 0 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.filters select { width: auto; min-width: 140px; }
.search-input { position: relative; flex: 1 1 260px; }
.search-input svg { position: absolute; left: 12px; top: 11px; color: var(--muted); }
.search-input input { padding-left: 38px; }

/* ---------- Pills / chips ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .04em; white-space: nowrap; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.pill-platinum { background: var(--platinum-bg); color: var(--platinum-fg); border-color: transparent; }
.pill-gold { background: var(--gold-bg); color: var(--gold-fg); border-color: transparent; }
.pill-code { font-size: 13px; padding: 5px 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-ok { background: var(--success-soft); color: var(--success); }
.chip-warn { background: var(--warning-soft); color: var(--warning); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-muted { background: var(--surface-2); color: var(--muted); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.status-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.status-row:empty { display: none; }

/* ---------- Tabla ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 11px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table th.sort-asc::after { content: " ↑"; }
.table th.sort-desc::after { content: " ↓"; }
.table td { padding: 12px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .empty { text-align: center; color: var(--muted); padding: 40px 14px; }
.table-compact td { padding: 8px 12px; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--muted); }
.cell-missing { color: var(--warning); font-style: italic; font-size: 12px; }
.cell-actions { display: flex; justify-content: flex-end; gap: 2px; }
.meal { display: flex; flex-direction: column; gap: 3px; line-height: 1.3; font-size: 12px; white-space: nowrap; }
.meal b { font-weight: 600; }
.meal-line em { font-style: normal; color: var(--muted); display: inline-block; min-width: 44px; margin-right: 4px; }
.status-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
#tabla td:nth-child(4) { min-width: 180px; max-width: 260px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager-controls { display: flex; align-items: center; gap: 6px; }
.pager-controls select { height: 32px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; padding: 0 8px; margin-right: 8px; }
tr.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--warning); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 70; display: none; align-items: flex-start; justify-content: center; padding: 5vh 16px; background: rgba(15, 17, 19, .45); overflow-y: auto; }
.modal.open { display: flex; animation: fade .15s ease; }
.modal-card { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; border: 1px solid var(--border); animation: pop .18s ease; }
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 860px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px 20px 6px; }
.modal-body p { margin-bottom: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.history { margin-top: 6px; border-top: 1px solid var(--border); padding-top: 14px; }
.history:empty { display: none; }
.history ul { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 180px; overflow-y: auto; }
.history li { display: flex; gap: 10px; font-size: 12px; align-items: baseline; }
.history li time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Drawer de estadísticas ---------- */
.drawer-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(15, 17, 19, .3); opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 61; width: min(440px, 100vw);
    background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column; transform: translateX(100%); transition: transform .25s ease;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-head small { color: var(--muted); font-size: 12px; }
.drawer-actions { display: flex; align-items: center; gap: 10px; }
.tabs { display: flex; gap: 4px; margin: 14px 20px 0; padding: 4px; background: var(--surface-2); border-radius: 12px; border: 1px solid var(--border); }
.tab { flex: 1; height: 32px; border: 0; background: transparent; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; }
.tab.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; }
.drawer-body .empty { color: var(--muted); text-align: center; padding: 40px 0; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.stat { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.stat span { display: block; font-size: 12px; color: var(--muted); }
.stat strong { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat em { font-style: normal; font-size: 12px; color: var(--muted); margin-left: 4px; }
.bar-list { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bar-list li { font-size: 13px; }
.bar-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.bar-top b { font-weight: 600; }
.bar-top span { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar.bar-ok i { background: var(--success); }
.hours { display: flex; align-items: flex-end; gap: 4px; height: 90px; margin-bottom: 18px; padding-top: 6px; }
.hours div { flex: 1; max-width: 34px; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.hours i { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.hours span { font-size: 10px; color: var(--muted); }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.feed li { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.feed-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.feed p { font-size: 12px; color: var(--text-2); }
.feed time { font-size: 11px; color: var(--muted); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg); font-size: 13px; animation: pop .18s ease; }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: #1c6f77; color: #fff; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; background: #111316; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero {
    display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 48px; color: #fff;
    background: radial-gradient(1200px 600px at 10% 110%, rgba(223, 135, 101, .35), transparent 60%),
                radial-gradient(900px 500px at 110% -10%, rgba(68, 190, 203, .25), transparent 60%), #161616;
}
.login-logo { width: 150px; height: auto; }
.login-hero h1 { font-size: 40px; line-height: 1.1; margin-bottom: 10px; }
.login-hero p { color: rgba(255, 255, 255, .75); font-size: 16px; }
.login-hero small { color: rgba(255, 255, 255, .5); font-size: 12px; letter-spacing: .04em; }
.login-card { align-self: center; justify-self: center; width: min(400px, calc(100% - 32px)); background: var(--surface); border-radius: 20px; padding: 36px 32px; box-shadow: var(--shadow-lg); margin: 32px 16px; }
.login-card h2 { font-size: 22px; margin-bottom: 4px; }
.login-card .muted { margin-bottom: 24px; }
.error-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; color: #fff; padding: 16px; }
.error-page p { color: rgba(255, 255, 255, .7); }

/* ---------- Escaneo ---------- */
.scan-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.scan-card { padding: 24px; }
.scan-head { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.scan-title { flex: 1; min-width: 220px; }
/* Resultados de búsqueda en el escaneo */
.search-results { margin-top: 14px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.search-results-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.search-results ul { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow-y: auto; }
.sr-item { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) auto; gap: 6px 16px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.sr-item:last-child { border-bottom: 0; }
.sr-item:hover, .sr-item.activo { background: var(--accent-soft); }
.sr-main { min-width: 0; }
.sr-main b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-main span, .sr-sub span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-sub { min-width: 0; font-size: 13px; }
.sr-tags { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.sr-item mark { background: transparent; color: var(--primary); font-weight: 700; }
.sr-alta { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-top: 1px dashed var(--border-strong); font-size: 13px; }
.scan-hint { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
.scan-hint kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); color: var(--text-2); }
.scan-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--text); color: var(--surface); flex: none; }
.scan-icon svg { width: 24px; height: 24px; }
.scan-form { display: flex; gap: 10px; }
.scan-input {
    flex: 1; min-width: 0; height: 56px; padding: 0 18px; font-family: inherit; font-size: 20px; font-weight: 600;
    border: 2px solid var(--border-strong); border-radius: 14px; background: var(--surface); color: var(--text); outline: none;
}
.scan-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.scan-form .btn-lg { height: 56px; border-radius: 14px; }
.scan-status { margin-top: 12px; font-size: 13px; color: var(--muted); min-height: 20px; }
.scan-status.ok { color: var(--success); }
.scan-status.error { color: var(--danger); font-weight: 600; }
.result-card { padding: 22px; }
.result-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }
.result-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.actions-group { display: flex; gap: 10px; flex-wrap: wrap; }
.confirm-msg p { margin: 12px 0 0; font-size: 13px; }
.confirm-persona { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.confirm-persona strong { font-size: 18px; text-transform: uppercase; line-height: 1.2; }
.confirm-persona span { font-size: 13px; color: var(--text-2); }
.confirm-persona .mono { color: var(--muted); font-size: 12px; margin-top: 4px; }
.capture-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.capture-head p { margin-top: 4px; }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* Vista previa del gafete (proporción similar a la etiqueta) */
.badge-preview {
    background: #fff; color: #111; border-radius: 12px; border: 1px solid #dfe2e6; padding: 18px 18px 14px;
    box-shadow: var(--shadow); font-family: Arial, Helvetica, sans-serif; min-height: 210px; display: flex; flex-direction: column; gap: 4px;
}
.bp-name { font-size: 24px; font-weight: 800; line-height: 1.05; text-transform: uppercase; }
.bp-company { font-size: 13px; color: #333; margin-bottom: 8px; }
.bp-body { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; margin-top: auto; }
.bp-meals { font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.bp-meals u { font-weight: 700; text-decoration: underline; }
.bp-qr { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bp-qr .qr-box { width: 64px; height: 64px; border: 2px dashed #b9bec5; border-radius: 6px; display: grid; place-items: center; font-size: 9px; color: #8a9099; text-align: center; }
.bp-qr span { font-size: 9px; font-family: var(--mono); letter-spacing: .04em; }
.bp-type { font-size: 9px; font-weight: 700; letter-spacing: .1em; color: #666; text-transform: uppercase; }

.scan-side { padding: 18px; position: sticky; top: 84px; }
.recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 70vh; overflow-y: auto; }
.recent li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 12px; cursor: pointer; }
.recent li:hover { background: var(--surface-2); }
.recent li.empty { cursor: default; color: var(--muted); border-style: dashed; text-align: center; }
.recent-top { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.recent li b { font-size: 13px; }
.recent time { color: var(--muted); }

/* ---------- Importar ---------- */
.dropzone {
    margin: 18px; padding: 36px 20px; border: 2px dashed var(--border-strong); border-radius: var(--radius);
    display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.busy { pointer-events: none; opacity: .6; }
.dz-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; margin-bottom: 4px; }
.dz-icon svg { width: 26px; height: 26px; }
.dropzone .muted { font-size: 12px; max-width: 640px; }
.rules { margin: 0 18px 18px; padding: 14px 16px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 13px; }
.rules ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); }
.warnings { margin: 0; padding: 0 18px 16px 34px; font-size: 13px; color: var(--warning); max-height: 220px; overflow-y: auto; }
#impAdvertenciasCard { padding-top: 16px; }
#impAdvertenciasCard .section-title { padding: 0 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .kpis-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .scan-layout { grid-template-columns: minmax(0, 1fr); }
    .scan-side { position: static; }
}
@media (max-width: 1100px) {
    .result-grid { grid-template-columns: minmax(0, 1fr); }
    .badge-preview { max-width: 380px; }
}
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: none; }
    .sb-backdrop.open { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15, 17, 19, .35); }
    .main { margin-left: 0; }
    .only-mobile { display: inline-grid !important; }
    .hide-mobile { display: none !important; }
    .topbar { padding: 0 16px; }
    .topbar .btn-outline { margin-left: auto; }
    .content { padding: 18px 16px; }
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .login-wrap { grid-template-columns: 1fr; }
    .login-hero { padding: 32px 24px; gap: 20px; }
    .login-hero h1 { font-size: 28px; }
    .login-hero small { display: none; }

    /* Tabla de registros como tarjetas */
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
    .table-cards tr { border-bottom: 1px solid var(--border); padding: 12px 16px; }
    .table-cards td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
    .table-cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
    .table-cards td.empty { justify-content: center; }
    .table-cards td.empty::before { display: none; }
    .table-cards .meal, .table-cards .cell-actions, .table-cards .status-stack { align-items: flex-end; }
    .table-cards .td-v { min-width: 0; text-align: right; }
    .table-cards tr.row-warn { box-shadow: inset 3px 0 0 var(--warning); }
    .table-cards tr.row-warn td:first-child { box-shadow: none; }
    #tabla td:nth-child(4) { max-width: none; }
    .table-cards tbody tr:hover td { background: transparent; }
}
@media (max-width: 560px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .kpis-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi-value { font-size: 22px; }
    .scan-form { flex-direction: column; }
    .sr-item { grid-template-columns: minmax(0, 1fr); }
    .sr-tags { justify-content: flex-start; }
    .scan-input { font-size: 18px; }
    .filters select { flex: 1 1 calc(50% - 5px); min-width: 0; }
    .result-actions .btn, .modal-foot .btn { flex: 1 1 auto; }
    .result-actions .actions-group { width: 100%; }
    .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .kv dd { margin-bottom: 8px; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1; }
}
