/* ===== Tokens: paleta clara (por defecto) ===== */
:root {
    --bg: #F7F7FB;
    --surface: #FFFFFF;
    --surface-elevated: #FFFFFF;
    --ink: #1C1D27;
    --ink-muted: #6B7280;
    --primary: #4F46E5;
    --primary-light: #6366F1;
    --primary-soft: rgba(79, 70, 229, 0.14);
    --accent: #14B8A6;
    --danger: #EF4444;
    --info: #3B82F6;
    --border: #E5E7EB;
    --border-strong: #D1D5DB;

    --font-display: "Space Grotesk", system-ui, sans-serif;
    --font-body: "Inter", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;

    --radius: 10px;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.07);
    --sidebar-w: 76px;

    /* El riel lateral se mantiene oscuro en ambos temas (patrón habitual
       de dashboards modernos), así que no se redefine en los bloques
       de modo oscuro de más abajo. */
    --sidebar-bg: #16152C;
    --sidebar-ink: #B9BAD6;
    --sidebar-ink-active: #FFFFFF;
    --sidebar-hover: rgba(255, 255, 255, 0.08);
}

/* ===== Tokens: modo oscuro por preferencia del sistema ===== */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0F1115;
        --surface: #181B23;
        --surface-elevated: #20242E;
        --ink: #E7E8EC;
        --ink-muted: #9AA0AC;
        --primary: #6366F1;
        --primary-light: #818CF8;
        --primary-soft: rgba(129, 140, 248, 0.22);
        --accent: #2DD4BF;
        --danger: #F87171;
        --info: #60A5FA;
        --border: #262A35;
        --border-strong: #383D4C;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    }
}

/* ===== Tokens: modo oscuro forzado por el usuario ===== */
:root[data-theme="dark"] {
    --bg: #0F1115;
    --surface: #181B23;
    --surface-elevated: #20242E;
    --ink: #E7E8EC;
    --ink-muted: #9AA0AC;
    --primary: #6366F1;
    --primary-light: #818CF8;
    --primary-soft: rgba(129, 140, 248, 0.22);
    --accent: #2DD4BF;
    --danger: #F87171;
    --info: #60A5FA;
    --border: #262A35;
    --border-strong: #383D4C;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

body.sidebar-open,
body.modal-open { overflow: hidden; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

h1, h2 { font-family: var(--font-display); margin: 0; color: var(--ink); }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 600; }

.muted { color: var(--ink-muted); margin: 0.25rem 0 0; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ===== Estructura general: sidebar + contenido ===== */
.app-shell {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 8, 16, 0.5);
    z-index: 35;
}
.backdrop[hidden] { display: none !important; }

/* ===== Sidebar: riel angosto solo-íconos, con popover de nombre ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    padding-bottom: env(safe-area-inset-bottom);
}
body.sidebar-open .sidebar { transform: translateX(0); }

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 1rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-rail { display: flex; }
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--accent);
    color: #0B1420;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    flex-shrink: 0;
}

/* Usado sólo en el topbar mobile (marca con nombre completo). */
.brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
}
.brand:hover { text-decoration: none; }

.btn-cerrar-sidebar {
    position: absolute;
    top: 0.85rem;
    right: 0.6rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    padding: 0.35rem;
    cursor: pointer;
    display: flex;
    border-radius: 6px;
}
.btn-cerrar-sidebar:hover { background: var(--sidebar-hover); }

.nav-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 0.5rem;
    gap: 0.3rem;
    flex: 1;
}
.nav-links a {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem;
    border-radius: 10px;
    color: var(--sidebar-ink);
}
.nav-links a:hover { background: var(--sidebar-hover); text-decoration: none; color: var(--sidebar-ink-active); }
.nav-links a.nav-active { background: var(--sidebar-hover); color: var(--sidebar-ink-active); }
.nav-links a.nav-active::before {
    content: "";
    position: absolute;
    left: -0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    border-radius: 3px;
    background: var(--accent);
}
.nav-icon { flex-shrink: 0; width: 20px; height: 20px; opacity: 0.95; }

/* Popover con el nombre: solo-ícono por defecto, el texto aparece al
   pasar el mouse/enfocar (desktop) o al tocar (mobile, vía :active). */
.nav-label {
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px) scale(0.96);
    background: var(--surface-elevated);
    color: var(--ink);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 0.4rem 0.7rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease, transform 0.12s ease;
    z-index: 45;
}
.nav-links a:hover .nav-label,
.nav-links a:focus-visible .nav-label,
.nav-links a:active .nav-label,
.btn-tema:hover .nav-label,
.btn-tema:focus-visible .nav-label,
.btn-tema:active .nav-label {
    opacity: 1;
    transform: translateY(-50%) translateX(0) scale(1);
}

.sidebar-foot {
    padding: 0.6rem 0.5rem 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-tema {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem;
    border-radius: 10px;
    background: none;
    border: none;
    color: var(--sidebar-ink);
    cursor: pointer;
}
.btn-tema:hover { background: var(--sidebar-hover); color: var(--sidebar-ink-active); }
.btn-tema .nav-label { left: calc(100% + 10px); }
.btn-tema .icon-luna { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .btn-tema .icon-sol { display: none; }
    :root:not([data-theme="light"]) .btn-tema .icon-luna { display: block; }
}
:root[data-theme="dark"] .btn-tema .icon-sol { display: none; }
:root[data-theme="dark"] .btn-tema .icon-luna { display: block; }

.main-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar-mobile {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    padding-top: calc(0.75rem + env(safe-area-inset-top));
    background: var(--sidebar-bg);
    position: sticky;
    top: 0;
    z-index: 20;
}
.brand-mobile { flex: 1; font-size: 1.05rem; }

.btn-menu {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    flex-shrink: 0;
}
.btn-menu:hover { background: var(--sidebar-hover); }
.btn-menu span {
    display: block;
    width: 100%;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}

/* ===== Layout de contenido ===== */
.page {
    max-width: 1080px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1.1rem 3rem;
}
.page-head { margin-bottom: 1.5rem; }
.page-head-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.footer {
    text-align: center;
    padding: 1.25rem 1rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}
.footer-text {
    font-size: 0.78rem;
    color: var(--ink-muted);
}
.footer-link {
    background: none;
    border: none;
    color: var(--ink-muted);
    font-size: 0.76rem;
    text-decoration: underline;
    cursor: pointer;
    padding: 0.2rem;
}
.footer-link:hover { color: var(--ink); }

/* Desktop: sidebar fija y visible, sin overlay ni hamburguesa */
@media (min-width: 900px) {
    .backdrop { display: none !important; }
    .topbar-mobile { display: none; }
    .btn-cerrar-sidebar { display: none; }
    .sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        transform: none;
        flex-shrink: 0;
    }
    body.sidebar-open { overflow: auto; }
}

/* Mobile: mismo riel solo-íconos, pero más ancho y con íconos/objetivos
   táctiles más grandes (no hay hover, así que el popover se apoya en
   :active al tocar). */
@media (max-width: 899px) {
    :root { --sidebar-w: 88px; }
    .nav-links a { padding: 0.9rem 0.6rem; }
    .nav-icon { width: 26px; height: 26px; }
    .sidebar-head { padding: 1.15rem 0.5rem 1.35rem; }
    .brand-mark { width: 38px; height: 38px; font-size: 1.15rem; }
    .btn-tema { padding: 0.8rem 0.6rem; }
    .btn-tema svg { width: 24px; height: 24px; }
}

/* ===== Cards ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.75rem;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.05rem 1.2rem;
    position: relative;
}
.card-stat {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    border-top: 3px solid var(--primary-light);
}
.card-label {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
    font-weight: 600;
}
.card-value {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    word-break: break-word;
}
.card-sub { font-size: 0.8rem; color: var(--ink-muted); }

/* ===== Panels ===== */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.15rem 1.2rem;
    margin-bottom: 1.25rem;
}
.panel-narrow { max-width: 480px; }
.panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.link { font-size: 0.88rem; font-weight: 500; }
.link-danger { color: var(--danger); background: none; border: none; padding: 0; cursor: pointer; font: inherit; }
.link-danger:hover { text-decoration: underline; }

/* ===== Tablas ===== */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -0.2rem;
}
.table { width: 100%; border-collapse: collapse; min-width: 460px; }
.table th, .table td {
    text-align: left;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
    white-space: nowrap;
}
.table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-muted);
    font-weight: 600;
}
.table .num { text-align: right; }
.row-inactiva { opacity: 0.55; }
.row-actions { display: flex; gap: 0.75rem; }
.inline-form { display: inline; }

.tag {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}
.tag-ok { background: var(--primary-soft); color: var(--primary); }
.tag-off { background: var(--border); color: var(--ink-muted); }
.tag-info { background: rgba(59, 130, 246, 0.15); color: var(--info); }

.empty {
    color: var(--ink-muted);
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

/* ===== Listas simples (ej. categorías) ===== */
.list-simple {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.list-simple li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0.2rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
}
.list-simple li:last-child { border-bottom: none; }

/* ===== Formularios ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    align-items: end;
}
.form-grid-inline { grid-template-columns: repeat(auto-fit, minmax(140px, 200px)) auto; }
.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ink-muted);
}
.form-grid input,
.form-grid select {
    font: inherit;
    font-size: 0.95rem;
    padding: 0.6rem 0.65rem;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    width: 100%;
}
.form-grid input:focus,
.form-grid select:focus {
    border-color: var(--primary-light);
}
.form-actions { display: flex; align-items: center; gap: 1rem; }

.check-inline {
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.55rem !important;
    font-size: 0.88rem !important;
    color: var(--ink) !important;
}
.check-inline input[type="checkbox"] { width: auto; accent-color: var(--primary); }

.campo-deshabilitado { opacity: 0.5; }

.btn-primary {
    font: inherit;
    font-weight: 600;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.65rem 1.1rem;
    cursor: pointer;
    height: fit-content;
    text-align: center;
}
.btn-primary:hover { background: var(--primary-light); text-decoration: none; color: #fff; }

.btn-secondary {
    font-weight: 600;
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 0.55rem 1rem;
    cursor: pointer;
    height: fit-content;
    white-space: nowrap;
}
.btn-secondary:hover { border-color: var(--primary-light); text-decoration: none; }

.btn-small { padding: 0.45rem 0.85rem; font-size: 0.85rem; }

.btn-texto {
    background: none;
    border: none;
    color: var(--ink-muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.4rem 0.5rem;
}
.btn-texto:hover { color: var(--ink); }

.alert {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
}

/* ===== Reportes: tabs de período ===== */
.periodo-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tab {
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ink);
}
.tab:hover { text-decoration: none; border-color: var(--primary-light); }
.tab-activa {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

canvas { max-width: 100%; margin-bottom: 0.5rem; }

/* ===== Banner de instalación (PWA) ===== */
.install-banner {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    z-index: 50;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    max-width: 440px;
    margin: 0 auto;
}
.install-banner[hidden] { display: none !important; }
.install-banner p { margin: 0; font-size: 0.88rem; flex: 1 1 220px; }
.install-banner-actions { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }

/* ===== Modal (términos y privacidad) ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(8, 8, 16, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}
.modal-overlay[hidden] { display: none !important; }
.modal {
    background: var(--surface-elevated);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 520px;
    width: 100%;
    max-height: min(85vh, 640px);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}
.modal h2 { margin-bottom: 0.9rem; }
.modal-body {
    overflow-y: auto;
    font-size: 0.9rem;
    color: var(--ink-muted);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.modal-body p { margin: 0; }
.modal-body strong { color: var(--ink); }
.modal-actions {
    margin-top: 1.25rem;
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 640px) {
    .card-value { font-size: 1.35rem; }
    .install-banner { flex-direction: column; align-items: stretch; text-align: center; }
    .install-banner-actions { justify-content: center; }
}

/* ===== Botón flotante de escaneo QR ===== */
.fab-scan {
    position: fixed;
    left: 50%;
    bottom: calc(1.25rem + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 55;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.4), var(--shadow);
    cursor: pointer;
    transition: bottom 0.2s ease;
}
.fab-scan:hover { background: var(--primary-light); }
/* Mientras el cartel de instalar PWA está visible, el botón sube para
   no quedar tapándolo (ver actualizarOffsetBanner en pwa.js). */
body.con-banner-instalacion .fab-scan {
    bottom: calc(var(--banner-height, 0px) + 1.75rem + env(safe-area-inset-bottom));
}

/* ===== Toast breve de confirmación ===== */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(6rem + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(8px);
    z-index: 65;
    background: var(--ink);
    color: var(--bg);
    padding: 0.65rem 1.1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    max-width: min(90vw, 380px);
    text-align: center;
}
.toast.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Modal de cámara ===== */
.modal-body-camara { align-items: center; }
.camara-visor {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}
.camara-visor video { width: 100%; height: 100%; object-fit: cover; }

/* ===== Modal de cantidad: control "gatillo" ===== */
.cantidad-producto-nombre { font-weight: 600; color: var(--ink); font-size: 1rem; margin: 0; }
.trigger-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    margin: 0.5rem 0;
}
.btn-cantidad {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--ink);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.btn-cantidad:hover { border-color: var(--primary-light); color: var(--primary); }
.trigger-track {
    position: relative;
    width: 140px;
    height: 40px;
    border-radius: 999px;
    background: var(--border);
    flex-shrink: 0;
}
.trigger-knob {
    position: absolute;
    top: 3px;
    left: 50%;
    width: 34px;
    height: 34px;
    margin-left: -17px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: var(--shadow);
    cursor: grab;
    touch-action: none;
    transition: transform 0.18s ease;
}
.trigger-knob.arrastrando { cursor: grabbing; transition: none; }
.trigger-ayuda { font-size: 0.78rem; text-align: center; margin: 0.25rem 0 0; }
.cantidad-valor {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0.35rem 0 0;
}

/* ===== Modal de método de pago ===== */
.metodo-pago-opciones {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
}
.metodo-pago-btn {
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    text-align: left;
}
.metodo-pago-btn:hover { border-color: var(--primary-light); }
.metodo-pago-btn.seleccionado {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
}
.modal-actions-split { justify-content: space-between; }

/* ===== QR de producto ===== */
.producto-qr-panel { text-align: center; }
.producto-qr {
    display: block;
    margin: 0.5rem auto 1rem;
    width: 220px;
    height: 220px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    padding: 0.5rem;
}

/* ===== Listado de QR de productos (para imprimir) ===== */
.qr-grupo { margin-bottom: 2rem; }
.qr-grupo[hidden] { display: none; }
.qr-grupo-titulo {
    margin: 0 0 0.9rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
}
.qr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
}
.qr-card { text-align: center; }
.qr-card .producto-qr { width: 100%; height: auto; margin: 0 0 0.5rem; }
.qr-card-nombre {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 500;
    word-break: break-word;
}
.qr-card .link { display: inline-block; margin-top: 0.25rem; font-size: 0.8rem; }
.qr-toolbar { flex-wrap: wrap; gap: 1.5rem; }
.link-volver { display: inline-flex; align-items: center; gap: 0.35rem; margin-left: auto; }
.input-buscador {
    flex: 1 1 220px;
    font: inherit;
    font-size: 0.95rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
}
.input-buscador:focus { border-color: var(--primary-light); }

/* ===== Impresión (ficha de producto con QR) ===== */
@media print {
    .no-print { display: none !important; }
    .app-shell { display: block; }
    .main-wrap { display: block; }
    .page { max-width: none; padding: 0; margin: 0; }
    .qr-grid { grid-template-columns: repeat(3, 1fr); }
}
