/* =========================================================
   Tema Global - Cyberia
   Los dos colores de marca salen muestreados del logo de
   Cyberia (dos cuadrados entrelazados): marino #001324 y
   cian #00BCF9.

   El cian puro NO se usa nunca para texto: sobre blanco da
   2.2:1 y falla WCAG. Solo vive como acento no textual
   (indicadores, graficas, anillo de foco, la marca) o sobre
   el marino, donde da 8.6:1. Para texto y botones se usa su
   version profunda --brand (#00698C, 6.2:1 con blanco).

   Rampa de marca completa:  cian -> cian profundo -> marino.
   ========================================================= */
:root {
    /* --- Superficies --- */
    --bg: #f5f7fa;
    --surface: rgba(255, 255, 255, 0.96);
    --surface-strong: #ffffff;
    --surface-sunk: #ecf0f5;
    --surface-dark: #001324;
    --surface-dark-alt: #0a2233;

    /* --- Tinta (verificada: 17.5:1 / 6.6:1 / 5.1:1 sobre --bg) --- */
    --text: #001324;
    --text-2: #4a5a67;
    --muted: #5a6b78;
    --muted-soft: #8595a3;
    --on-dark: #ffffff;
    --on-dark-soft: #9db3c4;

    /* --- Lineas --- */
    --line: rgba(0, 19, 36, 0.11);
    --line-strong: rgba(0, 19, 36, 0.2);

    /* --- Marca --- */
    --brand: #00698c;
    --brand-rgb: 0, 105, 140;
    --brand-strong: #00506b;
    --brand-soft: rgba(var(--brand-rgb), 0.1);
    --accent: #00bcf9;
    --accent-rgb: 0, 188, 249;
    --accent-wash: #e5f7fe;
    --ink-deep: #001324;

    /* --- Semanticos (todos >= 5:1 sobre --bg) --- */
    --danger: #b3261e;
    --danger-soft: rgba(179, 38, 30, 0.12);
    --warn: #8a5200;
    --warn-soft: rgba(138, 82, 0, 0.12);
    --success: #0f7350;
    --success-soft: rgba(15, 115, 80, 0.14);

    /* --- Escala z-index semantica --- */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-backdrop: 300;
    --z-modal: 400;
    --z-toast: 500;
    --z-tooltip: 600;
    --shadow: 0 18px 45px rgba(0, 19, 36, 0.06);
    --shadow-soft: 0 4px 6px -1px rgba(0, 19, 36, 0.05), 0 12px 24px rgba(0, 19, 36, 0.04);
    --radius-lg: 18px;
}

/* =========================================================
   Reset y Base
   Normaliza box model, tipografia, enlaces y elementos de
   formulario compartidos por todas las vistas.
   ========================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    /* Fondo plano. Los dos degradados radiales que habia aqui eran papel tapiz:
       no informaban nada y ensuciaban cada pantalla del sistema. */
    background: var(--bg);
}

body.modal-open {
    overflow: hidden;
}

body.menu-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

input,
select,
textarea,
button {
    font: inherit;
}

button {
    cursor: pointer;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.9rem 0.95rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(var(--brand-rgb), 0.3);
    box-shadow: 0 0 0 4px rgba(var(--brand-rgb), 0.08);
}

/* Los decimales marcados como manuales no deben mostrar controles nativos. */
input[data-manual-decimal-input] {
    appearance: textfield;
    -moz-appearance: textfield;
}

input[data-manual-decimal-input]::-webkit-outer-spin-button,
input[data-manual-decimal-input]::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* =========================================================
   Botones Globales
   Estilos base para botones primarios, secundarios, outline
   y variantes compactas usadas en todo el sistema.
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 42px;
    padding: 0.78rem 1.05rem;
    border: 0;
    border-radius: 12px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: 0.92rem;
    line-height: 1;
    letter-spacing: 0.01em;
    white-space: nowrap;
    box-shadow: 0 10px 22px rgba(var(--brand-rgb), 0.14);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(var(--brand-rgb), 0.18);
}

.btn:disabled,
.btn.is-loading {
    opacity: 0.7;
    cursor: wait;
}

.btn-outline,
.btn-secondary {
    box-shadow: none;
}

.btn-outline {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.24);
    color: var(--text);
}

.btn-outline:hover {
    border-color: rgba(var(--brand-rgb), 0.22);
    background: #f8fafc;
    box-shadow: 0 10px 18px rgba(148, 163, 184, 0.12);
}

.btn-secondary {
    background: var(--ink-deep);
}

.btn-secondary:hover {
    box-shadow: 0 14px 28px rgba(16, 47, 80, 0.18);
}

.btn-sm {
    min-height: 34px;
    padding: 0.52rem 0.78rem;
    font-size: 0.82rem;
    border-radius: 12px;
}

/* =========================================================
   Estructura Principal
   Define el shell general de la aplicacion: sidebar, area
   principal y contenedores base del layout autenticado.
   ========================================================= */
.layout,
.shell {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
}



/* =========================================================
   Topbar y Contenido
   Barra superior fija, acciones del encabezado y separacion
   general del contenido interno.
   ========================================================= */
.topbar,
.topbar-modern {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem 1.6rem;
    background: rgba(255, 255, 255, 0.84);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar h1,
.topbar-modern h2 {
    margin: 0.18rem 0 0;
    font-size: 1.35rem;
}

.topbar small,
.topbar-modern small {
    color: var(--muted);
}

.content,
.content-modern {
    padding: 1.8rem;
}

.content > * + *,
.content-modern > * + * {
    margin-top: 1.25rem;
}

/* =========================================================
   Encabezados, Grids y Tarjetas
   Cabeceras de pagina, metricas, cards y estructuras de
   columnas reutilizadas en modulos operativos.
   ========================================================= */
.page-title,
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1.55rem;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 20px;
    background: var(--surface-strong);
    box-shadow: var(--shadow-soft);
}

.page-title > div,
.page-header > div {
    flex: 1 1 320px;
}

.page-title h2,
.page-header h2 {
    margin: 0.2rem 0 0.35rem;
    font-size: clamp(1.65rem, 2vw, 2.2rem);
    line-height: 1.05;
}

.page-header p,
.page-title p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.header-summary,
.metric-grid,
.grid.cards,
.grid.two,
.grid.three,
.workspace-grid,
.balance-grid,
.report-links,
.process-layout {
    display: grid;
    gap: 1rem;
}

.header-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: min(460px, 100%);
    align-self: stretch;
}

.header-summary > div,
.metric-card,
.report-card {
    min-width: 0;
    min-height: 100%;
    padding: 1.05rem 1.1rem;
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 16px;
    background: var(--surface-strong);
    box-shadow: var(--shadow-soft);
}

.header-summary span,
.metric-card span,
.report-card span {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--muted);
    font-size: 0.86rem;
}

.header-summary strong,
.metric-card strong,
.report-card strong {
    display: block;
    font-size: 1.35rem;
}

.metric-grid,
.grid.cards {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.metric-card.danger {
    background: var(--danger-soft);
}

.workspace-grid,
.grid.two {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.process-layout {
    grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.9fr);
    align-items: start;
}

.process-layout-single {
    grid-template-columns: minmax(0, 1fr);
}

.process-main {
    min-width: 0;
}

.process-aside {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.process-form {
    gap: 1rem;
}

.process-main-compact {
    gap: 0.8rem;
    padding: 1rem 1.05rem 1.1rem;
}

.section-head-compact {
    margin-bottom: 0.35rem;
    gap: 0.75rem;
}

.section-head-compact p {
    line-height: 1.45;
}

.quick-actions-compact {
    gap: 0.45rem;
}

.quick-actions-compact .btn {
    min-height: 42px;
    padding: 0.72rem 0.95rem;
}

.process-form-compact {
    gap: 0.8rem 0.9rem;
}

.process-form-compact label {
    gap: 0.32rem;
}

.process-form-compact input,
.process-form-compact select,
.process-form-compact textarea {
    min-height: 46px;
    padding: 0.72rem 0.82rem;
}

.process-form-compact textarea {
    min-height: 88px;
}

.client-search-shell-compact {
    gap: 0.5rem;
}

.client-search-shell-compact .client-search-selected {
    padding: 0.72rem 0.82rem;
    gap: 0.28rem;
}

.client-search-shell-compact .client-search-panel {
    padding: 0.45rem;
}

.live-panel-compact {
    padding: 0.82rem 0.9rem;
    gap: 0.55rem;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}

.live-panel-compact strong {
    font-size: 1rem;
}

.process-submit-compact {
    min-height: 48px;
}

.invoice-workbench {
    display: grid;
    gap: 1rem;
}

.invoice-panel {
    display: grid;
    gap: 0.9rem;
    min-width: 0;
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 20px;
    background: var(--surface-strong);
}

.invoice-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.invoice-panel-head h4 {
    margin: 0;
    font-size: 1rem;
}

.invoice-panel-head p {
    margin: 0.22rem 0 0;
    color: var(--muted);
    line-height: 1.45;
}

.invoice-panel-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: rgba(var(--brand-rgb), 0.1);
    color: var(--brand-strong);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.invoice-meta-grid {
    display: grid;
    gap: 0.75rem 0.85rem;
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.invoice-workbench-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.95fr);
    align-items: start;
}

.invoice-summary-stage,
.invoice-workbench-notes,
.invoice-workbench-submit {
    grid-column: 1 / -1;
}

.invoice-panel-items {
    overflow: hidden;
}

.invoice-panel-items .line-item-card {
    padding: 0.85rem;
    border-radius: 16px;
}

.invoice-panel-items .line-item-grid {
    grid-template-columns: minmax(0, 1.85fr) minmax(92px, 0.62fr) minmax(138px, 0.82fr) minmax(170px, 0.86fr);
}

.line-catalog-shell-inline {
    padding: 0.88rem 0.95rem;
}

.invoice-items-summary {
    background: var(--accent-wash);
}

.invoice-line-items-list {
    max-height: min(56vh, 720px);
    overflow-y: auto;
    padding-right: 0.25rem;
}

.invoice-panel-checkout {
    position: sticky;
    top: 1rem;
}

.invoice-checkout-fields {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.invoice-quick-cash {
    display: grid;
    gap: 0.7rem;
    padding: 0.9rem 0.95rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 18px;
    background: var(--surface-strong);
}

.invoice-quick-cash-head strong,
.invoice-quick-cash-head small {
    display: block;
}

.invoice-quick-cash-head small {
    margin-top: 0.18rem;
    color: var(--muted);
    line-height: 1.45;
}

.invoice-quick-cash-grid {
    display: grid;
    gap: 0.55rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.invoice-quick-cash-grid-amounts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.invoice-quick-cash .btn {
    min-height: 40px;
}

.invoice-total-board {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 1rem;
    min-height: clamp(320px, 42vh, 560px);
}

.invoice-total-board-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    min-height: 0;
    padding: 0.95rem 1.05rem;
    border: 1px solid rgba(var(--brand-rgb), 0.16);
    border-radius: 18px;
    background: var(--accent-wash);
}

.invoice-total-board-hero-copy {
    display: grid;
    gap: 0.16rem;
    min-width: 0;
}

.invoice-total-board-hero-copy span,
.invoice-total-board-hero-copy small {
    display: block;
}

.invoice-total-board-hero strong {
    font-size: 1.6rem;
    line-height: 1.05;
    text-align: right;
    white-space: nowrap;
}

.invoice-total-board-hero-copy small {
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.invoice-total-board-metrics {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem;
}

.invoice-total-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    min-width: 0;
    padding: 0.78rem 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.76);
}

.invoice-total-stat span {
    color: var(--muted);
}

.invoice-total-stat strong {
    font-size: 1.04rem;
    text-align: right;
    flex-shrink: 0;
}

.invoice-advanced-notes {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.9);
}

.invoice-advanced-notes summary {
    cursor: pointer;
    list-style: none;
    padding: 0.9rem 1rem;
    font-weight: 700;
}

.invoice-advanced-notes summary::-webkit-details-marker {
    display: none;
}

.invoice-advanced-grid {
    display: grid;
    gap: 0.8rem;
    padding: 0 1rem 1rem;
}

.invoice-submit-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    background: var(--surface-sunk);
}

.invoice-submit-bar strong,
.invoice-submit-bar small {
    display: block;
}

.invoice-submit-bar small {
    margin-top: 0.2rem;
    color: var(--muted);
    line-height: 1.45;
}

.invoice-submit-bar .btn {
    min-width: 220px;
}

@media (max-width: 1180px) {
    .invoice-workbench-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .invoice-panel-checkout {
        position: static;
    }

    .invoice-meta-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .invoice-meta-grid,
    .invoice-checkout-fields,
    .invoice-panel-items .line-item-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .invoice-total-board-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .invoice-panel-items .line-item-grid > :first-child,
    .invoice-panel-items .line-item-grid > :last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .invoice-meta-grid,
    .invoice-checkout-fields,
    .invoice-panel-items .line-item-grid,
    .invoice-advanced-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .invoice-quick-cash-grid,
    .invoice-quick-cash-grid-amounts {
        grid-template-columns: minmax(0, 1fr);
    }

    .invoice-total-board-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .invoice-total-board-hero strong {
        text-align: left;
        white-space: normal;
    }

    .invoice-total-board {
        min-height: 0;
    }

    .invoice-total-board-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .invoice-panel-head,
    .invoice-submit-bar,
    .invoice-section-head {
        flex-direction: column;
        align-items: stretch;
    }

    .invoice-submit-bar .btn {
        width: 100%;
        min-width: 0;
    }

    .invoice-total-board-hero strong {
        font-size: 1.45rem;
    }
}

@media (max-width: 520px) {
    .invoice-total-board-metrics {
        grid-template-columns: minmax(0, 1fr);
    }
}

.form-span-full {
    grid-column: 1 / -1;
}

.form-span-2 {
    grid-column: span 2;
}

.process-totals {
    margin-top: 0.25rem;
}

.process-submit {
    min-height: 52px;
    font-size: 1rem;
}

.grid.three,
.balance-grid,
.report-links {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card,
.balance-card {
    display: grid;
    align-content: start;
    gap: 1rem;
    position: relative;
    overflow: hidden;
    min-width: 0;
    padding: 1.35rem;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: var(--radius-lg);
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.card-feature {
    background:
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.08), transparent 24%),
        var(--surface-strong);
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    width: 100%;
}

.section-head > div,
.page-header > div,
.topbar-leading > div {
    min-width: 0;
}

.section-head h3,
.balance-card h3,
.card h3 {
    margin: 0;
    font-size: 1.08rem;
}

.section-head p {
    margin: 0.2rem 0 0;
    color: var(--muted);
}

/* =========================================================
   Acciones y Formularios
   Botoneras, formularios, paneles en vivo y bloques de
   resumen usados en compras, ventas, gastos y procesos.
   ========================================================= */
.quick-actions,
.actions-row,
.report-tools,
.kpi-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.quick-actions .btn,
.actions-row .btn,
.report-tools .btn {
    flex: 1 1 180px;
}

.actions-row {
    align-items: center;
    justify-content: flex-end;
}

.actions-row form {
    margin: 0;
}

.history-filters-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
    margin-bottom: 0.9rem;
}

.history-filters-actions {
    align-self: end;
    justify-content: flex-end;
}

.history-filters-actions .btn {
    flex: 0 0 auto;
    min-width: 132px;
}

.history-caption {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    margin-bottom: 0.85rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.history-caption strong {
    color: var(--text);
    font-size: 1rem;
}

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 0.9rem;
}

.table-pagination-meta {
    color: var(--muted);
    font-size: 0.86rem;
}

.table-pagination-pages {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.table-pagination-button {
    min-width: 44px;
}

.table-pagination-button.is-active {
    border-color: rgba(var(--brand-rgb), 0.22);
    background: rgba(var(--brand-rgb), 0.1);
    color: var(--brand-strong);
}

.document-actions {
    gap: 0.65rem;
}

.document-actions .btn,
.document-actions form {
    flex: 0 0 auto;
}

.document-action-form {
    display: flex;
}

.document-actions .btn {
    min-width: 88px;
}

.btn-pdf {
    background: var(--brand);
    box-shadow: 0 12px 24px rgba(29, 78, 216, 0.18);
}

.btn-pdf:hover {
    box-shadow: 0 16px 30px rgba(29, 78, 216, 0.22);
}

.btn-danger-soft {
    border: 1px solid rgba(220, 38, 38, 0.14);
    background: var(--danger-soft);
    color: #b91c1c;
    box-shadow: none;
}

.btn-danger-soft:hover {
    border-color: rgba(220, 38, 38, 0.24);
    background: var(--danger-soft);
    box-shadow: 0 10px 18px rgba(220, 38, 38, 0.10);
}

.form {
    display: grid;
    gap: 0.95rem;
}

.form label {
    display: flex;
    flex-direction: column;
    gap: 0.42rem;
    color: #334155;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.form.two-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.col-span-2 {
    grid-column: 1 / -1;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 1rem;
}

.inline-form label {
    min-width: 180px;
    flex: 1 1 180px;
}

.client-search-shell {
    position: relative;
    display: grid;
    gap: 0.65rem;
}

.client-search-shell > label {
    margin: 0;
}

.client-search-panel {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 18;
    padding: 0.55rem;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 36px rgba(0, 19, 36, 0.1);
}

.client-search-status {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    margin: 0.1rem 0.1rem 0.55rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.1);
    color: var(--muted);
    font-size: 0.77rem;
    line-height: 1.3;
}

.client-search-results {
    display: grid;
    gap: 0.45rem;
    max-height: 280px;
    overflow-y: auto;
}

.client-option {
    width: 100%;
    padding: 0.82rem 0.9rem;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 14px;
    background: var(--surface-strong);
    text-align: left;
    box-shadow: none;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.client-option:hover {
    border-color: rgba(var(--brand-rgb), 0.22);
    background: rgba(240, 253, 250, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(0, 19, 36, 0.06);
}

.client-option strong,
.client-option span,
.client-option small {
    display: block;
}

.client-option strong {
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.35;
}

.client-option span {
    margin-top: 0.16rem;
    color: #334155;
    font-size: 0.8rem;
}

.client-option small {
    margin-top: 0.28rem;
    color: var(--muted);
    font-size: 0.76rem;
}

.client-search-selected {
    display: grid;
    gap: 0.35rem;
    padding: 0.82rem 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 14px;
    background: var(--surface-strong);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.client-search-selected.is-selected {
    border-color: rgba(var(--brand-rgb), 0.18);
    background: var(--accent-wash);
    box-shadow: 0 10px 18px rgba(var(--brand-rgb), 0.08);
}

.client-search-selected-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.client-search-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.14);
    color: #475569;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.client-search-selected.is-selected .client-search-badge {
    background: rgba(var(--brand-rgb), 0.14);
    color: var(--brand-strong);
}

.client-search-clear {
    padding: 0.18rem 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.client-search-clear:hover {
    color: var(--brand-strong);
}

.client-search-selected span,
.client-search-selected strong,
.client-search-selected small {
    display: block;
}

.client-search-selected span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.client-search-selected strong {
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.35;
}

.client-search-selected small {
    color: var(--muted);
    line-height: 1.45;
}

.line-items-shell,
.line-items-list {
    display: grid;
    gap: 0.75rem;
}

.line-items-inline,
.line-items-head,
.line-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.line-items-inline > :first-child,
.line-items-head > :first-child,
.line-item-head > :first-child {
    flex: 1 1 220px;
    min-width: 0;
}

.line-items-head strong,
.line-item-head strong,
.line-items-inline strong,
.line-items-head small,
.line-item-head small,
.line-items-inline small {
    display: block;
}

.line-items-inline small,
.line-items-head small,
.line-item-head small {
    margin-top: 0.18rem;
    color: var(--muted);
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.line-item-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    flex: 0 0 auto;
    max-width: 100%;
}

.line-item-quick-qty {
    display: grid;
    gap: 0.18rem;
    min-width: 164px;
    max-width: 100%;
}

.line-item-quick-qty span {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.line-item-quick-qty-controls {
    display: grid;
    grid-template-columns: 34px minmax(72px, 1fr) 34px;
    gap: 0.35rem;
    align-items: center;
}

.line-item-quick-qty-btn {
    min-height: 36px;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.line-item-quick-qty-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(var(--brand-rgb), 0.28);
    box-shadow: 0 8px 18px rgba(0, 19, 36, 0.08);
}

.line-item-quick-qty-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.line-item-quick-qty-input {
    width: 100%;
    min-width: 0;
    padding: 0.52rem 0.58rem;
    text-align: center;
    font-weight: 700;
}

.line-items-summary {
    display: grid;
    gap: 0.7rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 18px;
    background: var(--surface-strong);
}

.line-items-summary-head strong,
.line-items-summary-head small {
    display: block;
}

.line-items-summary-head small {
    margin-top: 0.18rem;
    color: var(--muted);
    line-height: 1.4;
}

.line-items-summary-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.line-summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.52rem 0.7rem;
    border: 1px solid rgba(var(--brand-rgb), 0.14);
    border-radius: 999px;
    background: rgba(240, 253, 250, 0.92);
    color: var(--text);
    font-size: 0.84rem;
    line-height: 1.3;
}

.line-summary-pill strong {
    font-size: 0.84rem;
}

.line-summary-pill span {
    color: var(--muted);
    font-size: 0.78rem;
}

.line-item-card {
    display: grid;
    gap: 0.75rem;
    padding: 0.92rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 18px;
    background: var(--surface-strong);
    overflow: visible;
}

.line-item-card.is-collapsed {
    gap: 0.35rem;
}

.line-item-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(0, 1.7fr) minmax(120px, 0.75fr) minmax(140px, 0.9fr) minmax(190px, 1fr);
    align-items: start;
}

.line-item-grid[hidden] {
    display: none;
}

.line-item-grid > *,
.line-item-product {
    min-width: 0;
}

.line-item-grid > label {
    display: flex;
    flex-direction: column;
    gap: 0.32rem;
    margin: 0;
    color: #334155;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.line-item-grid > label > span {
    display: inline-block;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.2;
    word-break: break-word;
}

.line-item-grid > label > small {
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.35;
}

.import-shell {
    display: grid;
    gap: 1.25rem;
}

.import-intro {
    display: grid;
    gap: 0.75rem;
}

.import-intro p {
    margin: 0;
    color: var(--text, #001324);
    font-size: 0.92rem;
    line-height: 1.45;
}

.import-intro .actions-row {
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
}

.import-file-name {
    color: var(--muted);
    font-size: 0.84rem;
    align-self: center;
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.import-status {
    display: block;
    padding: 0.7rem 0.85rem;
    border-radius: 12px;
    border: 1px dashed rgba(148, 163, 184, 0.45);
    background: rgba(248, 250, 252, 0.7);
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.import-status[data-tone="ok"] {
    border-style: solid;
    border-color: rgba(var(--brand-rgb), 0.35);
    background: rgba(var(--brand-rgb), 0.08);
    color: var(--brand-strong);
}

.import-status[data-tone="danger"] {
    border-style: solid;
    border-color: rgba(220, 38, 38, 0.45);
    background: rgba(254, 226, 226, 0.55);
    color: #b91c1c;
}

.import-mapping,
.import-preview {
    display: grid;
    gap: 0.55rem;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 16px;
    background: var(--surface-strong);
}

.import-mapping h4,
.import-preview-head h4 {
    margin: 0;
    font-size: 0.98rem;
    color: var(--brand-strong);
}

.import-mapping > p {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    border: 0;
    background: transparent;
    padding: 0;
}

.import-mapping-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.65rem;
    margin-top: 0.25rem;
}

.import-mapping-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 10px;
    background: rgba(248, 250, 252, 0.6);
    font-size: 0.82rem;
}

.import-mapping-field > span {
    display: block;
    color: var(--brand-strong);
    font-weight: 700;
    font-size: 0.84rem;
}

.import-mapping-field > span small {
    display: block;
    margin-top: 0.15rem;
    color: var(--muted);
    font-weight: 400;
    font-size: 0.72rem;
}

.import-mapping-field .import-required {
    color: #b91c1c;
    font-style: normal;
    margin-left: 0.2rem;
}

.import-mapping-field select {
    min-height: 32px;
    padding: 0.3rem 0.5rem;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 8px;
    background: #fff;
    font-size: 0.82rem;
}

.import-preview-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.import-preview-head small {
    color: var(--muted);
    font-size: 0.8rem;
}

.import-preview-wrap {
    max-height: 360px;
    overflow: auto;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 10px;
}

.import-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.import-preview-table th,
.import-preview-table td {
    padding: 0.45rem 0.55rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    text-align: left;
    white-space: nowrap;
}

.import-preview-table thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    color: var(--brand-strong);
    z-index: 1;
    font-weight: 700;
}

.import-preview-table tr.import-row-error {
    background: rgba(254, 226, 226, 0.6);
}

.import-actions {
    justify-content: flex-end;
    gap: 0.55rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
    margin-top: 0.25rem;
}

.import-actions .btn {
    min-width: 140px;
}

.line-item-caption {
    display: inline-block;
    margin-bottom: 0.38rem;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.line-item-identity {
    display: grid;
    gap: 0.22rem;
    min-height: 72px;
    padding: 0.78rem 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 14px;
    background: var(--surface-strong);
}

.line-item-identity strong,
.line-item-identity small {
    display: block;
}

.line-item-identity strong {
    font-size: 0.92rem;
    line-height: 1.35;
}

.line-item-identity small {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.line-item-product .product-selection-inline {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.22rem 0.65rem;
    align-items: center;
    padding: 0.58rem 0.7rem;
    border-radius: 12px;
}

.line-item-product .product-selection-inline .client-search-badge {
    min-height: 24px;
    padding: 0.18rem 0.55rem;
    font-size: 0.68rem;
}

.line-item-product .product-selection-inline strong {
    font-size: 0.88rem;
    line-height: 1.25;
}

.line-item-product .product-selection-inline small {
    grid-column: 2 / 4;
    margin-top: 0;
    font-size: 0.74rem;
    line-height: 1.35;
}

.line-item-product .product-selection-inline .client-search-clear {
    padding: 0;
    font-size: 0.76rem;
    white-space: nowrap;
}

.line-item-metrics {
    display: grid;
    gap: 0.55rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0.8rem 0.85rem;
    border: 1px solid rgba(var(--brand-rgb), 0.12);
    border-radius: 16px;
    background: var(--accent-wash);
}

.line-item-metrics span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
}

.line-item-metrics strong {
    display: block;
    margin-top: 0.16rem;
    font-size: 1rem;
}

.modal-card-wide {
    width: min(92vw, 1240px);
    max-width: 100%;
    margin: 0 auto;
}

.line-items-modal-card {
    display: grid;
    gap: 1rem;
    max-height: 84vh;
    overflow-x: hidden;
    overflow-y: auto;
}

.line-items-modal-card .line-items-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.line-catalog-shell {
    display: grid;
    gap: 0.7rem;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 18px;
    background: var(--surface-sunk);
}

.line-catalog-shell > label {
    margin: 0;
}

.line-catalog-status {
    color: var(--muted);
    line-height: 1.4;
}

.line-catalog-results {
    display: grid;
    gap: 0.55rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    max-height: min(26vh, 280px);
    overflow-y: auto;
}

.line-items-modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.2rem;
}

.line-item-product .client-search-panel {
    z-index: 42;
}

.live-panel,
.stack-list {
    display: grid;
    gap: 0.7rem;
}

.live-panel {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    padding: 1rem;
    border: 1px solid rgba(var(--brand-rgb), 0.12);
    border-radius: 18px;
    background: var(--accent-wash);
}

.live-panel span,
.stack-row span,
.balance-row span,
.kpi-pill span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
}

.live-panel strong,
.stack-row strong,
.balance-row strong,
.kpi-pill strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1.1rem;
}

.stack-row,
.balance-row,
.kpi-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0.95rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.84);
}

.header-summary small,
.kpi-pill small,
.money-stack small,
.balance-row small {
    display: block;
    margin-top: 0.22rem;
    color: var(--muted-soft);
    font-size: 0.78rem;
    line-height: 1.45;
}

.money-stack strong {
    display: block;
}

/* =========================================================
   Dashboard y Analitica
   Hero principal, KPIs, graficos, accesos rapidos y tarjetas
   del panel ejecutivo.
   ========================================================= */
.dashboard {
    display: grid;
    gap: 1.05rem;
}

.dashboard-header {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    justify-content: space-between;
    flex-wrap: wrap;
}

.dashboard-range {
    width: min(560px, 100%);
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
}

.dashboard-summary {
    margin: 0;
}

.dashboard-grids {
    display: grid;
    grid-template-columns: 1.75fr 1fr;
    gap: 1rem;
}

.dashboard-chart-card {
    gap: 0.75rem;
}

.chart-shell {
    position: relative;
    width: 100%;
    min-height: 320px;
    max-width: 100%;
    overflow: hidden;
}

.chart-shell canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-height: 100%;
}

.chart-shell--composition {
    min-height: 350px;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.chart-shell--composition canvas {
    width: min(100%, 420px) !important;
    aspect-ratio: 1 / 1;
    height: auto !important;
    max-height: min(100%, 420px);
}

.dashboard-products {
    margin-bottom: 0.2rem;
}

.dashboard-actions {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-actions .btn {
    width: 100%;
}

.premium-dashboard {
    gap: 1.25rem;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr);
    gap: 1rem;
}

.dashboard-hero-main,
.dashboard-hero-side {
    padding: 1.5rem;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 22px;
    background: var(--surface-strong);
    box-shadow: var(--shadow-soft);
}

.dashboard-hero-main {
    background:
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.08), transparent 22%),
        var(--surface-strong);
}

.dashboard-hero-main h2 {
    margin: 0.25rem 0 0.5rem;
    font-size: clamp(2rem, 3vw, 2.6rem);
    line-height: 1.08;
}

.dashboard-hero-main p,
.dashboard-hero-side p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.dashboard-hero-side {
    display: grid;
    gap: 1rem;
    align-content: start;
}

.dashboard-hero-side-head h3 {
    margin: 0.2rem 0 0.35rem;
    font-size: 1.15rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.35rem;
}

.hero-actions .btn {
    flex: 1 1 180px;
}

.hero-note-grid {
    display: grid;
    gap: 0.75rem;
}

.hero-note-item {
    padding: 0.95rem 1rem;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 14px;
    background: #f8fafc;
}

.hero-note-item span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hero-note-item strong {
    display: block;
    margin-top: 0.35rem;
    color: var(--text);
    font-size: 1rem;
}

.metric-card-premium {
    gap: 0.5rem;
}

.metric-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.metric-card-head span {
    margin-bottom: 0;
}

.metric-card-head small {
    color: var(--muted-soft);
    font-size: 0.78rem;
    white-space: nowrap;
}

.dashboard-grids-main {
    grid-template-columns: 1.5fr 1fr;
}

.dashboard-grids-secondary {
    grid-template-columns: 1.25fr 0.95fr;
}

.chart-shell--compact {
    min-height: 280px;
}

.dashboard-side-card {
    align-content: start;
}

.dashboard-link-list {
    display: grid;
    gap: 0.95rem;
}

.dashboard-link-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 14px;
    background: #f8fafc;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-link-card:hover {
    transform: translateY(-1px);
    border-color: rgba(var(--brand-rgb), 0.18);
    box-shadow: var(--shadow-soft);
}

.dashboard-link-card strong {
    display: block;
    color: var(--text);
    font-size: 0.96rem;
}

.dashboard-link-card small {
    display: block;
    margin-top: 0.25rem;
    color: var(--muted);
    line-height: 1.5;
}

.dashboard-link-card span {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: rgba(var(--brand-rgb), 0.1);
    color: var(--brand-strong);
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}

.dashboard-link-card--report span {
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
}

.text-right {
    text-align: right;
}

.currency-subtitle {
    display: block;
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.inventory-report-section-head {
    display: block;
    margin-bottom: 0.85rem;
}

.inventory-report-section-head .section-head-copy {
    max-width: none;
}

.inventory-category-card .table-wrap {
    margin-top: 0;
}

.inventory-category-strip {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.inventory-category-strip .kpi-pill {
    min-height: 100%;
}

.stack-row small {
    display: block;
    color: var(--muted-soft);
}

/* =========================================================
   Tablas, Badges y Reportes
   Listados tabulares, estados visuales y tarjetas enlazadas
   para reporteria y vistas administrativas.
   ========================================================= */
.table-wrap {
    overflow: auto;
    margin-top: 0.2rem;
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: #ffffff;
}

.table-wrap-scrollable {
    max-height: min(62vh, 720px);
    overflow: auto;
    overscroll-behavior: contain;
}

.production-recipes-scroll {
    max-height: min(56vh, 560px);
    overflow: auto;
    overscroll-behavior: contain;
}

.production-recipes-card {
    grid-template-rows: auto auto minmax(0, 1fr);
    max-height: min(76vh, 760px);
    min-height: 0;
}

.production-recipes-card .catalog-toolbar {
    margin-bottom: 0;
}

.production-recipes-card .production-recipes-scroll {
    max-height: none;
    min-height: 0;
    height: 100%;
}

.catalog-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.catalog-search {
    flex: 1 1 320px;
    display: grid;
    gap: 0.38rem;
    max-width: 420px;
}

.catalog-search span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.catalog-results {
    flex: 0 0 auto;
    padding: 0.82rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
}

.table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    background: #ffffff;
}

.table th,
.table td {
    padding: 0.92rem 0.95rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid rgba(16, 32, 51, 0.07);
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    font-size: 0.83rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    background: #f8fafc;
}

.table tbody tr:hover {
    background: #f8fafc;
}

.document-products-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: 0.7rem;
}

.document-products-summary > div {
    min-width: 0;
}

.document-products-summary span {
    display: block;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.document-products-summary strong {
    display: block;
    margin-top: 0.16rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.document-products-table {
    min-width: 560px;
    table-layout: fixed;
}

.document-products-table th:first-child,
.document-products-table td:first-child {
    width: 44%;
}

.document-products-table th:nth-child(2),
.document-products-table td:nth-child(2) {
    width: 16%;
}

.document-products-table th:nth-child(3),
.document-products-table td:nth-child(3),
.document-products-table th:nth-child(4),
.document-products-table td:nth-child(4) {
    width: 20%;
}

.document-products-table td {
    overflow-wrap: anywhere;
}

.document-products-table td:nth-child(2),
.document-products-table td:nth-child(3),
.document-products-table td:nth-child(4) {
    white-space: nowrap;
}

.document-products-notes p {
    margin: 0.25rem 0 0;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.table-empty-state td {
    padding: 1.25rem 1rem;
    text-align: center;
    color: var(--muted);
    background: rgba(248, 250, 252, 0.92);
}

.is-filter-hidden {
    display: none !important;
}

.is-pagination-hidden {
    display: none !important;
}

.purchase-history-filters {
    margin-bottom: 1rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.34rem 0.7rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.badge-ok {
    color: var(--success);
    background: var(--success-soft);
}

.badge-danger {
    color: var(--danger);
    background: var(--danger-soft);
}

.badge-neutral {
    color: #1d4ed8;
    background: rgba(59, 130, 246, 0.12);
}

.report-card {
    display: block;
    min-height: 100%;
    border: 1px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.report-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.report-card.is-active {
    border-color: rgba(var(--brand-rgb), 0.28);
    background:
        radial-gradient(circle at top right, rgba(var(--brand-rgb), 0.12), transparent 28%),
        var(--accent-wash);
    box-shadow: 0 18px 40px rgba(var(--brand-rgb), 0.12);
}

.report-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.report-card .tag {
    display: inline-flex;
    margin-top: 0.85rem;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    background: rgba(249, 115, 22, 0.12);
    font-size: 0.78rem;
    font-weight: 700;
}

.balance-total {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    text-align: right;
}

/* =========================================================
   Estados, Alertas y Modales
   Mensajes de feedback, vacios de datos y ventanas modales
   del sistema.
   ========================================================= */
.empty-state {
    padding: 1rem;
    border: 1px dashed rgba(16, 32, 51, 0.18);
    border-radius: 18px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.52);
}

.alert {
    margin-bottom: 1rem;
    padding: 0.95rem 1rem;
    border-radius: 16px;
}

.alert.success {
    color: #065f46;
    background: rgba(16, 185, 129, 0.13);
}

.alert.danger {
    color: #991b1b;
    background: rgba(254, 226, 226, 0.92);
}

.modal-shell {
    position: fixed;
    inset: 0;
    width: 100vw;
    min-height: 100dvh;
    display: none;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
    isolation: isolate;
    z-index: 120;
}

.modal-shell.is-open {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 21, 33, 0.6);
    backdrop-filter: blur(6px);
}

.modal-card {
    position: relative;
    z-index: 1;
    width: min(760px, 100%);
    max-height: calc(100vh - 2.5rem);
    overflow: auto;
    padding: 1.75rem 1.85rem;
    border-radius: 24px;
    background: var(--surface-strong);
    box-shadow: 0 30px 80px rgba(8, 21, 33, 0.32);
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.25rem;
}

.modal-header h3 {
    margin: 0.15rem 0 0;
    font-size: 1.18rem;
    line-height: 1.25;
}

.modal-header .eyebrow {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: rgba(var(--brand-rgb), 0.12);
    color: var(--brand-strong);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.modal-close {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(16, 32, 51, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    line-height: 1;
}


/* =========================================================
   Layout Invitado (pagina de error)
   La pantalla de acceso tiene su propia hoja: css/login.css,
   que solo carga layouts/guest.php.
   ========================================================= */
/* Antes era un style="" en layouts/error.php (SEC-04). */
.error-container {
    max-width: 700px;
    padding-top: 3rem;
}

.guest-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 3vw, 2rem);
    /* El velo va como degradado: un color suelto solo vale en la ULTIMA capa,
       y en cualquier otra el navegador descarta la declaracion entera (sin
       foto y sin velo). */
    background:
        linear-gradient(rgba(0, 19, 36, 0.52), rgba(0, 19, 36, 0.52)),
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), transparent 30%),
        radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.05), transparent 24%),
        url('../img/baco1.jpg') center/cover no-repeat !important;
    font-family: "Inter", "Segoe UI", Roboto, sans-serif;
}

/* =========================================================
   Impresion y Utilidades
   Reglas para vistas imprimibles y helpers de apoyo.
   ========================================================= */
.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
}

.float-right {
    float: right;
}

.print-body {
    padding: 1rem;
    background: #edf2f7;
}

.print-actions {
    max-width: 1100px;
    margin: 0 auto 1rem;
    display: flex;
    gap: 0.75rem;
}

.print-container {
    max-width: 1100px;
    margin: 0 auto;
}

.ledger-negative {
    color: var(--danger);
}

.ledger-positive {
    color: var(--success);
}

/* =========================================================
   Responsive
   Ajustes para tablet y movil: sidebar off-canvas, tablas
   apiladas, formularios y espaciados adaptativos.
   ========================================================= */
@media (min-width: 1100px) {
    .process-form-compact {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        align-items: start;
    }

    .process-form-compact .col-span-2.form-span-2 {
        grid-column: span 2;
    }
}

@media (max-width: 1240px) {
    .modal-card-wide {
        width: min(88vw, 1040px);
    }

    .line-item-grid {
        grid-template-columns: minmax(0, 1.5fr) minmax(120px, 0.85fr) minmax(140px, 0.95fr);
    }

    .line-item-metrics {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1024px) {
    .layout,
    .shell {
        display: block;
    }

    .process-layout,
    .process-layout-single {
        grid-template-columns: 1fr;
    }

    .modal-card-wide {
        width: min(94vw, 920px);
    }

    .line-items-modal-card {
        max-height: 86vh;
        padding: 1rem;
        border-radius: 22px;
    }

    .line-item-grid {
        grid-template-columns: minmax(0, 1fr) minmax(110px, 0.85fr) minmax(130px, 0.95fr);
    }

    .line-item-metrics {
        grid-column: 1 / -1;
    }

    .sidebar,
    .shell-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(320px, 84vw);
        padding: 1rem;
        z-index: 80;
        overflow-y: auto;
        transform: translateX(-102%);
        transition: transform 0.24s ease;
        box-shadow: 0 24px 80px rgba(8, 21, 33, 0.34);
    }

    .sidebar-mobile-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        margin-bottom: 0.9rem;
    }

    body.menu-open .sidebar,
    body.menu-open .shell-sidebar {
        transform: translateX(0);
    }

    .nav,
    .nav-modern {
        display: grid;
        grid-auto-flow: row;
        overflow: visible;
        padding-bottom: 0;
    }

    .nav-overlay {
        position: fixed;
        inset: 0;
        z-index: 70;
        background: rgba(8, 21, 33, 0.45);
        backdrop-filter: blur(3px);
    }

    .dashboard-grids {
        grid-template-columns: 1fr;
    }

    .dashboard-hero,
    .dashboard-grids-main,
    .dashboard-grids-secondary {
        grid-template-columns: 1fr;
    }

    .chart-shell--composition {
        min-height: 300px;
    }

    .chart-shell--composition canvas {
        width: min(420px, 100%) !important;
        max-width: 100%;
        max-height: 320px;
    }

    .dashboard-header {
        align-items: stretch;
    }

    .dashboard-range {
        grid-template-columns: 1fr;
        width: 100%;
    }

    body.menu-open .nav-overlay {
        display: block;
    }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .header-summary {
        min-width: 0;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

@media (max-width: 900px) {
    .page-title,
    .page-header,
    .section-head,
    .modal-header {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar,
    .topbar-modern {
        align-items: flex-start;
        padding-right: 1rem;
    }

    .topbar-actions {
        width: auto;
        margin-left: auto;
    }

    .content,
    .content-modern {
        padding: 0.55rem 0.9rem 0.9rem;
    }

    .header-summary {
        grid-template-columns: 1fr;
    }

    .modal-card {
        width: 100%;
    }

    .hero-actions .btn {
        flex: 1 1 100%;
    }

    .topbar-logout {
        display: none;
    }

    .sidebar-logout {
        display: block;
    }
}

@media (max-width: 720px) {
    .catalog-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .catalog-search,
    .catalog-results {
        max-width: none;
        width: 100%;
    }

    .purchase-history-filters .history-filters-actions {
        width: 100%;
    }

    .table-wrap-scrollable {
        max-height: none;
    }

    .production-recipes-scroll {
        max-height: min(62vh, 480px);
    }

    .production-recipes-card {
        max-height: min(74vh, 640px);
    }

    .form.two-cols {
        grid-template-columns: 1fr;
    }

    .btnCompactar{
        display: none !important;
    }

    .form-span-2,
    .form-span-full {
        grid-column: auto;
    }

    .line-items-head,
    .line-item-head,
    .line-item-grid {
        grid-template-columns: 1fr;
        display: grid;
    }

    .line-items-inline {
        display: grid;
        grid-template-columns: 1fr;
    }

    .line-item-quick-qty {
        width: 100%;
        min-width: 0;
    }

    .line-item-metrics {
        grid-template-columns: 1fr 1fr;
    }

    .line-items-inline .btn,
    .line-items-head .btn,
    .line-item-head .btn {
        width: 100%;
    }

    .line-items-modal-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .line-item-head {
        align-items: stretch;
    }

    .line-item-actions {
        width: 100%;
    }

    .line-item-actions .line-item-quick-qty {
        width: 100%;
    }

    .page-header,
    .header-summary,
    .quick-actions,
    .actions-row,
    .report-tools {
        width: 100%;
    }

    .quick-actions .btn,
    .actions-row .btn,
    .report-tools .btn,
    .section-head .btn {
        width: 100%;
    }

    .history-filters-form {
        grid-template-columns: 1fr;
    }

    .history-filters-actions {
        justify-content: stretch;
    }

    .history-filters-actions .btn {
        flex: 1 1 auto;
    }

    .inline-form label,
    .inline-form .btn {
        width: 100%;
        flex: 1 1 100%;
    }

    .document-actions {
        justify-content: stretch;
    }

    .document-actions .btn,
    .document-actions form {
        flex: 1 1 calc(50% - 0.5rem);
    }

    .document-action-form .btn {
        width: 100%;
    }

    .content,
    .content-modern {
        padding: 0.5rem 0.7rem 0.9rem;
    }

    .page-header,
    .card,
    .balance-card {
        gap: 0.8rem;
    }

    .card,
    .balance-card,
    .header-summary > div {
        padding: 1rem;
        border-radius: 18px;
    }

    .topbar,
    .topbar-modern {
        padding: 0.95rem 0.85rem;
    }

    .topbar-leading {
        align-items: flex-start;
        width: calc(100% - 58px);
        flex: 1 1 auto;
    }

    .topbar-actions {
        width: auto;
        margin-left: auto;
    }

    .table-wrap {
        overflow: visible;
        border: 0;
        background: transparent;
    }

    .table-wrap-mobile-slider {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        border: 1px solid rgba(226, 232, 240, 0.9);
        background: #ffffff;
        scrollbar-gutter: stable both-edges;
    }

    .table-wrap-mobile-slider.table-wrap-scrollable {
        overflow-y: auto;
    }

    .table-wrap-mobile-slider .table {
        width: max-content;
        min-width: 100%;
    }

    .table-wrap-mobile-slider .table.mobile-cards {
        min-width: 760px;
    }

    .table-wrap-mobile-slider .table.mobile-cards thead {
        display: table-header-group;
    }

    .table-wrap-mobile-slider .table.mobile-cards,
    .table-wrap-mobile-slider .table.mobile-cards tbody,
    .table-wrap-mobile-slider .table.mobile-cards tr {
        display: table;
        width: auto;
    }

    .table-wrap-mobile-slider .table.mobile-cards tbody {
        display: table-row-group;
        padding: 0;
    }

    .table-wrap-mobile-slider .table.mobile-cards tr {
        display: table-row;
        margin-bottom: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .table-wrap-mobile-slider .table.mobile-cards td,
    .table-wrap-mobile-slider .table.mobile-cards th {
        display: table-cell;
        width: auto;
    }

    .table-wrap-mobile-slider .table.mobile-cards td {
        white-space: nowrap;
    }

    .table-wrap-mobile-slider .table.mobile-cards td::before {
        content: none;
        display: none;
    }

    .table-wrap-mobile-slider .table.mobile-cards td:last-child {
        border-bottom: 1px solid rgba(16, 32, 51, 0.07);
    }

    .table.mobile-cards {
        min-width: 100%;
    }

    .table.mobile-cards thead {
        display: none;
    }

    .table.mobile-cards,
    .table.mobile-cards tbody,
    .table.mobile-cards tr,
    .table.mobile-cards td {
        display: block;
        width: 100%;
    }

    .table.mobile-cards tbody {
        padding: 0.2rem 0;
    }

    .table.mobile-cards tr {
        margin-bottom: 0.9rem;
        border: 1px solid rgba(16, 32, 51, 0.08);
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.92);
        overflow: hidden;
        box-shadow: var(--shadow-soft);
    }

    .table.mobile-cards td {
        padding: 0.8rem 0.9rem;
        border-bottom: 1px solid rgba(16, 32, 51, 0.06);
        white-space: normal;
        word-break: break-word;
    }

    .table.mobile-cards td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.35rem;
        color: var(--muted);
        font-size: 0.78rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .table.mobile-cards td:last-child {
        border-bottom: 0;
    }

    .modal-shell {
        padding: 0.6rem;
        align-items: flex-end;
    }

    .modal-card {
        border-radius: 22px 22px 0 0;
        max-height: 90vh;
        padding: 1.15rem 1.1rem 1.25rem;
        gap: 0.9rem;
    }

    .import-mapping,
    .import-preview {
        padding: 0.85rem 0.9rem;
    }

    .import-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .import-actions .btn {
        width: 100%;
    }

    .client-search-panel {
        position: static;
        padding: 0.65rem 0 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .menu-toggle {
        width: 42px;
        height: 42px;
        padding: 0.55rem;
    }

    .stack-row,
    .balance-row,
    .kpi-pill {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* =========================================================
   Navegacion Agrupada
   Version enriquecida del sidebar con grupos, etiquetas y
   bloque informativo final.
   ========================================================= */
.nav-stack {
    display: grid;
    gap: 1rem;
    margin-top: 1.1rem;
}

.nav-group {
    display: grid;
    gap: 0.55rem;
    padding: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
}

.nav-group-title {
    padding: 0 0.3rem;
}

.nav-group-title span {
    display: block;
    color: rgba(147, 197, 253, 0.82);
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.nav-group-title strong {
    display: block;
    margin-top: 0.12rem;
    color: rgba(248, 250, 252, 0.92);
    font-size: 0.92rem;
}

.nav-group-title.is-active strong {
    color: #ffffff;
}

.nav-modern {
    margin-top: 0;
}

.nav-modern a {
    display: block;
    background: rgba(255, 255, 255, 0.03);
}

.nav-label {
    display: block;
    font-weight: 700;
}

.nav-hint {
    display: block;
    margin-top: 0.2rem;
    color: rgba(241, 245, 249, 0.62);
    font-size: 0.78rem;
    line-height: 1.35;
}

.sidebar-footnote {
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-footnote strong {
    display: block;
    color: #f8fafc;
    font-size: 0.98rem;
}

.sidebar-footnote small {
    display: block;
    margin-top: 0.35rem;
    color: rgba(241, 245, 249, 0.68);
    line-height: 1.5;
}

.sidebar-logout {
    display: none;
    margin-top: 0.9rem;
}

.sidebar-logout .btn {
    width: 100%;
}

@media (max-width: 720px) {
    .nav-group-title {
        padding: 0;
    }
}
/* =========================================================
   SHELL SAAS PREMIUM
   Más expresivo, más producto, sin verse recargado
   ========================================================= */

:root {
    --shell-bg: #eef1f5;

    --shell-panel: rgba(255, 255, 255, 0.72);
    --shell-panel-strong: rgba(255, 255, 255, 0.94);
    --shell-card: rgba(255, 255, 255, 0.88);

    --shell-border: rgba(0, 19, 36, 0.08);
    --shell-border-strong: rgba(0, 19, 36, 0.14);

    --shell-text: #001324;
    --shell-text-soft: #334155;
    --shell-muted: #64748b;

    /* Sidebar operacional */
    --shell-sidebar-bg: #f8fafc;
    --shell-sidebar-border: rgba(0, 19, 36, 0.10);

    --shell-primary: var(--brand);
    --shell-primary-2: var(--accent);
    --shell-primary-soft: rgba(var(--brand-rgb), 0.10);
    --shell-primary-soft-2: rgba(var(--brand-rgb), 0.10);

    --shell-shadow-xs: 0 2px 10px rgba(0, 19, 36, 0.04);
    --shell-shadow-sm: 0 8px 24px rgba(0, 19, 36, 0.06);
    --shell-shadow-md: 0 16px 40px rgba(0, 19, 36, 0.08);
    --shell-shadow-lg: 0 24px 60px rgba(0, 19, 36, 0.12);

    --shell-radius-xl: 28px;
    --shell-radius-lg: 22px;
    --shell-radius-md: 16px;
    --shell-radius-sm: 12px;
}

/* =========================================================
   Base shell
   ========================================================= */

body.app-shell {
    min-height: 100vh;
    background: var(--shell-bg);
    color: var(--shell-text);
    overflow: hidden;
}

.shell {
    display: flex;
    min-height: 100vh;
    height: 100vh;
    gap: 0;
    position: relative;
    transition: all 0.22s ease;
}

/* =========================================================
   Sidebar
   ========================================================= */

.sidebar,
.shell-sidebar {
    position: relative;
    width: 268px;
    height: 100vh;
    padding: 0.85rem 0.7rem;
    color: var(--shell-text);
    background: var(--shell-sidebar-bg);
    border-right: 1px solid var(--shell-sidebar-border);
    box-sizing: border-box;
    overflow: hidden;
    transition: width 0.22s ease, padding 0.22s ease, opacity 0.22s ease;
}

.sidebar::before,
.shell-sidebar::before {
    content: none;
}

.sidebar-shell {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 0.55rem;
    min-height: 100%;
    height: 100%;
    align-content: start;
}

.sidebar-content {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.6rem;
    min-height: 0;
    overflow: hidden;
}

/* =========================================================
   Brand
   ========================================================= */

.brand,
.brand-block {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.6rem;
    border: 0;
    border-bottom: 1px solid var(--shell-sidebar-border);
    border-radius: 0;
    background: transparent;
    overflow: hidden;
}

.brand-block[data-app-initials]::before {
    content: attr(data-app-initials);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--shell-primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

.brand-block .eyebrow {
    display: none;
}

.brand-block h1,
.brand h2 {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--shell-text);
}

.brand-block p,
.brand small {
    display: none;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    color: var(--shell-primary);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: rgba(var(--brand-rgb), 0.08);
    border: 1px solid rgba(var(--brand-rgb), 0.10);
}

/* =========================================================
   Navegación agrupada
   ========================================================= */

.nav-stack {
    display: grid;
    gap: 1rem;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.32rem;
    margin-right: -0.18rem;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, 0.38) transparent;
}

.nav-stack::-webkit-scrollbar {
    width: 8px;
}

.nav-stack::-webkit-scrollbar-track {
    background: transparent;
}

.nav-stack::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.22);
    border: 2px solid transparent;
    background-clip: padding-box;
}

.nav-stack::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.34);
    background-clip: padding-box;
}

.nav-group {
    display: grid;
    gap: 0.15rem;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: 0;
}

.nav-group-title {
    display: block;
    padding: 0.2rem 0.7rem 0.3rem;
}

.nav-group-title span {
    display: block;
    color: var(--shell-muted);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.nav-group-title strong {
    display: none;
}

.nav-group-title.is-active strong {
    color: var(--shell-text);
}

/* =========================================================
   Navegación
   ========================================================= */

.nav,
.nav-modern {
    display: grid;
    gap: 0.1rem;
    margin-top: 0;
}

.nav a,
.nav-modern a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.7rem;
    border: 0;
    border-radius: 8px;
    color: var(--shell-text-soft);
    text-decoration: none;
    background: transparent;
    overflow: hidden;
    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.nav a::before,
.nav-modern a::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 3px;
    height: 0;
    border-radius: 0 3px 3px 0;
    background: var(--shell-primary);
    transform: translateY(-50%);
    transition: height 0.15s ease;
}

.nav-ic {
    flex: 0 0 auto;
    width: 18px;
    font-size: 1rem;
    line-height: 1;
    color: var(--shell-muted);
    text-align: center;
    transition: color 0.15s ease;
}

.nav a:hover,
.nav-modern a:hover {
    color: var(--shell-text);
    background: rgba(0, 19, 36, 0.05);
}

.nav a:hover .nav-ic,
.nav-modern a:hover .nav-ic {
    color: var(--shell-text-soft);
}

.nav a.is-active,
.nav-modern a.is-active {
    color: var(--shell-primary);
    font-weight: 600;
    background: var(--shell-primary-soft);
}

.nav a.is-active .nav-ic,
.nav-modern a.is-active .nav-ic {
    color: var(--shell-primary);
}

.nav a.is-active::before,
.nav-modern a.is-active::before {
    height: 60%;
}

.nav-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-modern a.is-active .nav-label {
    font-weight: 600;
}

.nav-compact-label {
    display: none;
}

.nav-hint {
    display: none;
}

/* =========================================================
   Sidebar footnote
   ========================================================= */

.sidebar-footnote {
    position: relative;
    margin-top: auto;
    display: grid;
    gap: 0.35rem;
    padding: 0.5rem 0.4rem 0.2rem;
    border-radius: 0;
    background: transparent;
    border: 0;
    border-top: 1px solid var(--shell-sidebar-border);
}

.sidebar-footnote strong {
    display: block;
    color: var(--shell-text);
    font-size: 1rem;
    letter-spacing: -0.015em;
}

.sidebar-footnote small {
    display: block;
    color: var(--shell-muted);
    line-height: 1.45;
}

.sidebar-logout,
.topbar-logout {
    margin-top: 0.45rem;
}

/* =========================================================
   Main
   ========================================================= */

.main,
.shell-main {
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: transparent;
    overflow-y: auto;
}

/* =========================================================
   Topbar
   ========================================================= */

.topbar,
.topbar-modern {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.35rem 1rem;
    min-height: 0;
    background: rgba(245, 247, 251, 0.74);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 1px 0 rgba(0, 19, 36, 0.03);
}

.topbar-leading {
    display: flex;
    align-items: center;
    gap: 0.95rem;
    min-width: 0;
    flex: 1 1 320px;
}

.topbar-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.7rem;
    flex: 0 1 auto;
    margin-left: auto;
}

.topbar-actions form {
    margin: 0;
}

.topbar-leading-minimal {
    flex: 0 0 auto;
    min-width: auto;
}

.topbar-trailing {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: auto;
}

.alert-center {
    position: relative;
}

.alert-center--brand {
    margin-left: auto;
    flex: 0 0 auto;
}

.alert-center-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: rgba(255, 255, 255, 0.85);
    color: #1f2937;
    font-size: 1.15rem;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.alert-center--brand .alert-center-trigger {
    width: 32px;
    height: 32px;
    font-size: 0.98rem;
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(var(--brand-rgb), 0.22);
    color: var(--shell-text, #1f2937);
}

.alert-center-trigger:hover {
    background: #fff;
    border-color: rgba(var(--brand-rgb), 0.45);
    color: var(--brand-strong, #00698c);
    transform: translateY(-1px);
}

.alert-center--brand .alert-center-trigger:hover {
    border-color: rgba(var(--brand-rgb), 0.55);
    color: var(--brand-strong);
}

.alert-center-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 0 0 2px rgba(245, 247, 251, 0.95);
    animation: alert-center-pulse 2.2s ease-in-out infinite;
}

.alert-center--brand .alert-center-badge {
    top: -3px;
    right: -3px;
    min-width: 16px;
    height: 16px;
    font-size: 0.62rem;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.95);
}

@keyframes alert-center-pulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(245, 247, 251, 0.95), 0 0 0 0 rgba(220, 38, 38, 0.45); }
    50% { box-shadow: 0 0 0 2px rgba(245, 247, 251, 0.95), 0 0 0 6px rgba(220, 38, 38, 0); }
}

.alert-center-trigger[data-seen="1"] .alert-center-badge {
    display: none;
}

body.sidebar-collapsed .alert-center--brand {
    display: none;
}

.alert-center-panel {
    position: fixed;
    width: min(380px, 92vw);
    max-height: min(70vh, 540px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 18px;
    background: #fff;
    border: 1px solid rgba(0, 19, 36, 0.08);
    box-shadow: 0 22px 60px rgba(8, 21, 33, 0.18);
    z-index: 1080;
}

.alert-center-panel[hidden] {
    display: none;
}

.alert-center-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0.85rem 1rem 0.55rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.alert-center-head strong {
    color: var(--brand-strong, #00698c);
    font-size: 0.92rem;
}

.alert-center-head span {
    color: var(--muted, #64748b);
    font-size: 0.78rem;
}

.alert-center-body {
    overflow-y: auto;
    padding: 0.35rem 0 0.55rem;
}

.alert-center-group {
    padding: 0.55rem 0.85rem 0.3rem;
}

.alert-center-group + .alert-center-group {
    border-top: 1px dashed rgba(148, 163, 184, 0.22);
}

.alert-center-group header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.35rem;
    color: #334155;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.alert-center-group header i {
    color: var(--brand-strong, #00698c);
}

.alert-center-count {
    margin-left: auto;
    padding: 0.06rem 0.45rem;
    border-radius: 999px;
    background: rgba(var(--brand-rgb), 0.1);
    color: var(--brand-strong, #00698c);
    font-size: 0.7rem;
}

.alert-center-group ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.2rem;
}

.alert-center-item a {
    display: flex;
    gap: 0.55rem;
    padding: 0.5rem 0.55rem;
    border-radius: 10px;
    color: #1f2937;
    text-decoration: none;
    transition: background 0.16s ease;
}

.alert-center-item a:hover {
    background: rgba(var(--brand-rgb), 0.06);
}

.alert-center-item strong {
    display: block;
    font-size: 0.85rem;
    line-height: 1.25;
}

.alert-center-item small {
    display: block;
    color: var(--muted, #64748b);
    font-size: 0.75rem;
    margin-top: 0.15rem;
    line-height: 1.35;
}

.alert-center-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #94a3b8;
    margin-top: 0.42rem;
    flex: 0 0 auto;
}

.alert-center-item--critical .alert-center-dot {
    background: #dc2626;
}

.alert-center-item--warning .alert-center-dot {
    background: #d97706;
}

.alert-center-item--info .alert-center-dot {
    background: #2563eb;
}

.alert-center-empty {
    display: grid;
    place-items: center;
    gap: 0.45rem;
    padding: 1.8rem 1rem;
    color: var(--muted, #64748b);
    text-align: center;
}

.alert-center-empty i {
    font-size: 2rem;
    color: var(--brand-strong, #00698c);
}

.alert-center-empty p {
    margin: 0;
    font-size: 0.85rem;
}

.alert-center-foot {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(248, 250, 252, 0.6);
    font-size: 0.78rem;
}

.alert-center-foot a {
    color: var(--brand-strong, #00698c);
    text-decoration: none;
    font-weight: 600;
}

.alert-center-foot a:hover {
    text-decoration: underline;
}

@media (max-width: 540px) {
    .alert-center-panel {
        width: calc(100vw - 1.5rem);
    }
}

.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(var(--brand-rgb), 0.12);
    border-radius: 14px;
    background: var(--surface-sunk);
    box-shadow: var(--shell-shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.user-menu-trigger:hover {
    transform: translateY(-1px);
    border-color: rgba(var(--brand-rgb), 0.2);
    box-shadow: 0 14px 24px rgba(0, 19, 36, 0.1);
}

.user-menu-trigger[aria-expanded="true"] {
    border-color: rgba(var(--brand-rgb), 0.26);
    box-shadow: 0 16px 28px rgba(var(--brand-rgb), 0.12);
}

.user-menu-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 14px;
    background: var(--brand);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1;
}

.user-menu-avatar-lg {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    font-size: 1rem;
}

.user-menu-panel {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;
    z-index: 40;
    display: grid;
    gap: 0.95rem;
    width: min(320px, calc(100vw - 2rem));
    padding: 1rem;
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 22px;
    background:
        radial-gradient(circle at top right, rgba(var(--brand-rgb), 0.08), transparent 34%),
        var(--surface-strong);
    box-shadow: 0 22px 50px rgba(0, 19, 36, 0.12);
    transform-origin: top right;
    animation: shellFadeUp 0.18s ease;
}

.user-menu-panel[hidden] {
    display: none;
}

@keyframes shellFadeUp {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-menu-profile {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.85rem;
    align-items: center;
}

.user-menu-profile strong,
.user-menu-profile small {
    display: block;
}

.user-menu-profile strong {
    color: var(--shell-text);
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.user-menu-profile small {
    margin-top: 0.2rem;
    color: var(--shell-muted);
    line-height: 1.4;
}

.user-menu-meta {
    display: grid;
    gap: 0.7rem;
    padding: 0.9rem;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 18px;
    background: rgba(248, 250, 252, 0.85);
}

.user-menu-meta span,
.user-menu-meta strong {
    display: block;
}

.user-menu-meta span {
    color: var(--shell-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.user-menu-meta strong {
    margin-top: 0.18rem;
    color: var(--shell-text);
    font-size: 0.95rem;
    line-height: 1.35;
}

.user-menu-logout {
    margin: 0;
}

.user-menu-logout .btn {
    width: 100%;
}

.sidebar-desktop-toggle {
    display: inline-flex;
}

.sidebar-footnote .sidebar-desktop-toggle:not(.sidebar-icon-btn) {
    width: 100%;
    min-width: 0;
    min-height: 28px;
    padding: 0.22rem 0.5rem;
    border-radius: 8px;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    justify-content: center;
    color: var(--shell-muted);
    border-color: rgba(148, 163, 184, 0.3);
    background: transparent;
}

.sidebar-desktop-toggle-icon {
    font-size: 0.95rem;
    line-height: 1;
}

.topbar h1,
.topbar-modern h2 {
    margin: 0.15rem 0 0;
    font-size: 1.48rem;
    font-weight: 760;
    letter-spacing: -0.04em;
    color: var(--shell-text);
}

.topbar small,
.topbar-modern small {
    color: var(--shell-muted);
    font-size: 0.91rem;
}

.topbar-modern .eyebrow,
.topbar .eyebrow {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* =========================================================
   Botones del shell
   ========================================================= */

.btn-outline {
    color: var(--shell-text);
    background:
        var(--surface-strong);
    border: 1px solid var(--shell-border);
    border-radius: 14px;
    box-shadow: var(--shell-shadow-sm);
    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease;
}

.btn-outline:hover {
    background: #fff;
    border-color: rgba(var(--brand-rgb), 0.16);
    box-shadow: 0 12px 24px rgba(0, 19, 36, 0.08);
    transform: translateY(-1px);
}

/* =========================================================
   Contenido
   ========================================================= */

.content,
.content-modern {
    padding: 0.5rem 1rem 1rem;
}

.content > * + *,
.content-modern > * + * {
    margin-top: 0.7rem;
}

/* =========================================================
   Alertas del shell
   ========================================================= */

.alert {
    padding: 1rem 1.05rem;
    border-radius: 18px;
    border: 1px solid transparent;
    box-shadow: var(--shell-shadow-xs);
}

.alert.success {
    color: #065f46;
    background: rgba(16, 185, 129, 0.10);
    border-color: rgba(16, 185, 129, 0.16);
}

.alert.danger {
    color: #991b1b;
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.16);
}

/* =========================================================
   Mobile
   ========================================================= */

.menu-toggle {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0.65rem;
    border: 1px solid rgba(0, 19, 36, 0.08);
    border-radius: 15px;
    background:
        var(--surface-strong);
    box-shadow: var(--shell-shadow-sm);
}

.menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 0;
    border-radius: 999px;
    background: var(--shell-text);
}

.nav-overlay {
    display: none;
}

.sidebar-mobile-bar {
    display: none;
}

.sidebar-mobile-label {
    color: var(--shell-muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-mobile-copy {
    display: grid;
    gap: 0.32rem;
    min-width: 0;
}

.sidebar-mobile-copy strong {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    padding: 0.38rem 0.7rem;
    border: 1px solid rgba(var(--brand-rgb), 0.12);
    border-radius: 999px;
    color: var(--shell-text-soft);
    background: var(--surface-strong);
    box-shadow: var(--shell-shadow-xs);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--shell-border);
    border-radius: 14px;
    color: var(--shell-text);
    background: rgba(255, 255, 255, 0.90);
    box-shadow: var(--shell-shadow-xs);
    font-size: 1.4rem;
    line-height: 1;
}

@media (min-width: 1025px) {
    body.sidebar-collapsed .shell-sidebar {
        width: 72px;
        padding: 0.85rem 0.55rem;
    }

    body.sidebar-collapsed .sidebar-shell {
        gap: 0.85rem;
    }

    body.sidebar-collapsed .brand-block {
        min-height: 0;
        padding: 0.45rem;
        place-items: center;
        text-align: center;
    }

    body.sidebar-collapsed .brand-block .eyebrow,
    body.sidebar-collapsed .brand-block h1,
    body.sidebar-collapsed .brand-block p,
    body.sidebar-collapsed .nav-group-title,
    body.sidebar-collapsed .nav-label,
    body.sidebar-collapsed .nav-hint,
    body.sidebar-collapsed .sidebar-footnote .eyebrow,
    body.sidebar-collapsed .sidebar-footnote strong,
    body.sidebar-collapsed .sidebar-footnote small,
    body.sidebar-collapsed .sidebar-logout {
        display: none;
    }

    body.sidebar-collapsed .brand-block[data-app-initials]::before {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border-radius: 10px;
        background: var(--shell-primary);
        color: #fff;
        font-size: 1rem;
        font-weight: 800;
        letter-spacing: 0.08em;
    }

    body.sidebar-collapsed .nav-group {
        gap: 0.15rem;
        padding: 0;
    }

    body.sidebar-collapsed .nav-modern a {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0;
        min-height: 42px;
        padding: 0.5rem;
        border-radius: 10px;
    }

    body.sidebar-collapsed .nav-ic {
        width: auto;
        font-size: 1.1rem;
    }

    body.sidebar-collapsed .nav-modern a::before {
        display: none;
    }

    body.sidebar-collapsed .sidebar-footnote {
        min-height: 52px;
        padding: 0.55rem;
        place-items: center;
    }

    body.sidebar-collapsed .sidebar-footnote [data-sidebar-toggle-label] {
        display: none;
    }
}

@media (max-width: 1024px) {
    .shell {
        display: block;
        height: auto;
    }

    .sidebar,
    .shell-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(330px, 86vw);
        height: 100dvh;
        padding: 1rem;
        z-index: 80;
        overflow-y: auto;
        transform: translateX(-104%);
        transition: transform 0.24s ease;
        box-shadow: var(--shell-shadow-lg);
        background: rgba(248, 250, 252, 0.96);
    }

    .sidebar::before,
    .shell-sidebar::before {
        content: none;
    }

    body.menu-open .sidebar,
    body.menu-open .shell-sidebar {
        transform: translateX(0);
    }

    .sidebar-mobile-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        margin-bottom: 0.55rem;
        padding: 0.15rem 0 0.8rem;
        position: relative;
        z-index: 1;
        border-bottom: 1px solid rgba(0, 19, 36, 0.08);
    }

    .nav-overlay {
        position: fixed;
        inset: 0;
        z-index: 70;
        background: rgba(8, 21, 33, 0.32);
        backdrop-filter: blur(4px);
    }

    body.menu-open .nav-overlay {
        display: block;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .sidebar-desktop-toggle {
        display: none;
    }
}

@media (max-width: 720px) {
    .topbar,
    .topbar-modern {
        padding: 0.4rem 0.85rem;
    }

    .content,
    .content-modern {
        padding: 0.5rem 0.85rem 1rem;
    }

    .topbar h1,
    .topbar-modern h2 {
        font-size: 1.22rem;
    }

    .topbar-logout {
        display: none;
    }

    .sidebar-logout {
        display: block;
    }

    .user-menu-trigger {
        width: 48px;
        height: 48px;
        border-radius: 16px;
    }

    .user-menu-panel {
        width: min(300px, calc(100vw - 1.2rem));
    }
}

/* =========================================================
   Sidebar Mobile Fix
   Evita superposicion entre marca, grupos de menu y pie del
   sidebar en pantallas pequenas.
   ========================================================= */

.sidebar-shell {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.sidebar-content {
    flex: 1 1 auto;
    min-height: 0;
}

.nav-stack {
    min-height: 0;
}

.sidebar-footnote {
    flex-shrink: 0;
}

@media (max-width: 1024px) {
    .sidebar,
    .shell-sidebar {
        height: 100dvh;
        max-height: 100dvh;
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        padding: max(0.95rem, env(safe-area-inset-top)) 0.95rem max(0.95rem, env(safe-area-inset-bottom));
        -webkit-overflow-scrolling: touch;
        
    }


  
       
    

    .sidebar-shell {
        height: auto;
        min-height: auto;
        gap: 0.8rem;
        max-height: none;
        background: transparent;
    }

    .sidebar-mobile-bar {
        position: sticky;
        top: 0;
        margin-bottom: 0;
        justify-content: flex-end;
        padding: 0 0 0.45rem;
        background: transparent;
        backdrop-filter: none;
        border-bottom: 0;
        
    }

    .brand-block {
        padding: 0.5rem 0.7rem;
        border-radius: 12px;
    }

    .sidebar-content {
        flex: 0 0 auto;
        grid-template-rows: auto auto;
        gap: 0.75rem;
        min-height: 0;
        overflow: visible;
    }

    .nav-stack {
        flex: 0 0 auto;
        overflow: visible;
        padding: 0;
        margin: 0;
        scrollbar-gutter: auto;
    }

    .sidebar-footnote {
        margin-top: 0;
        position: relative;
        z-index: 1;
        padding: 0.5rem 0.55rem;
        border-radius: 12px;
    }

    .nav-group {
        gap: 0.32rem;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .nav-group + .nav-group {
        margin-top: 0.2rem;
        padding-top: 0.85rem;
        border-top: 1px solid rgba(0, 19, 36, 0.08);
    }

    .nav-modern a {
        min-height: 58px;
    }
}

@media (max-width: 720px) {
    .sidebar,
    .shell-sidebar {
        width: min(360px, 92vw);
        padding: max(0.8rem, env(safe-area-inset-top)) 0.8rem max(0.8rem, env(safe-area-inset-bottom));
    }

    .sidebar-mobile-bar {
        padding-bottom: 0.35rem;
    }

    .nav-stack {
        gap: 0.7rem;
    }

    .nav-group {
        gap: 0.28rem;
    }

    .nav-group-title {
        gap: 0.18rem;
        padding: 0.1rem 0.2rem 0.4rem;
    }

    .nav-group-title strong {
        font-size: 0.9rem;
        line-height: 1.32;
    }

    .nav-modern {
        margin-top: 0;
    }

    .nav-modern a {
        gap: 0.12rem;
        min-height: 54px;
        padding: 0.82rem 0.82rem 0.82rem 0.92rem;
        border-radius: 14px;
    }

    .nav-hint {
        font-size: 0.74rem;
        line-height: 1.3;
    }

    .sidebar-footnote {
        padding: 0.82rem 0.85rem;
        border-radius: 18px;
    }

    .brand-block p,
    .sidebar-footnote small {
        font-size: 0.84rem;
    }
}

@media (max-width: 480px) {
    .brand-block {
        padding: 0.45rem 0.6rem;
        border-radius: 10px;
    }

    .brand-block h1 {
        font-size: 0.92rem;
    }

    .brand-block p {
        display: none;
    }

    .nav-group-title strong {
        font-size: 0.88rem;
        line-height: 1.28;
    }

    .nav-hint {
        display: none;
    }

    .nav-modern a {
        padding: 0.82rem 0.8rem 0.82rem 0.92rem;
    }

    .sidebar-mobile-copy strong {
        font-size: 0.92rem;
    }
}

/* =========================================================
   POS Workspace (Facturacion rapida)
   Layout de 3 columnas tipo punto de venta: cliente/meta a
   la izquierda, items al centro, totales + cobro pegados a
   la derecha. Optimizado para velocidad y densidad.
   ========================================================= */
.pos-workspace {
    --pos-gap: 0.7rem;
    --pos-radius: 14px;
    --pos-border: 1px solid rgba(148, 163, 184, 0.22);
    --pos-surface: #ffffff;
    --pos-muted-surface: rgba(248, 250, 252, 0.92);
    display: block;
    margin-bottom: 1rem;
}

.pos-form {
    display: grid;
    gap: var(--pos-gap);
}

.pos-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.55rem 0.85rem;
    border: var(--pos-border);
    border-radius: var(--pos-radius);
    background: var(--accent-wash);
}

.pos-topbar-title h3 {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.1;
}

.pos-topbar-title small {
    display: block;
    margin-top: 0.15rem;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.35;
}

.pos-topbar-title kbd,
.pos-submit kbd,
.pos-card-head kbd,
.pos-hint kbd {
    display: inline-block;
    padding: 0.04rem 0.32rem;
    border: 1px solid rgba(148, 163, 184, 0.5);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.85);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.7rem;
    line-height: 1;
    color: var(--brand-strong);
}

.pos-topbar-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.pos-topbar-actions .btn {
    min-height: 34px;
    padding: 0.32rem 0.7rem;
    font-size: 0.82rem;
}

.pos-grid {
    display: grid;
    gap: var(--pos-gap);
    grid-template-columns: minmax(260px, 0.95fr) minmax(0, 1.6fr) minmax(280px, 1fr);
    align-items: start;
}

.pos-col {
    display: grid;
    gap: var(--pos-gap);
    min-width: 0;
}

.pos-col-right {
    position: sticky;
    top: 0.7rem;
}

/* En escritorio la columna de cobro se acota al alto visible: el total
   queda siempre a la vista, el bloque de cobro hace scroll interno si hace
   falta y el boton "Guardar factura" se ancla al fondo sin scrollear. */
@media (min-width: 1101px) {
    .pos-col-right {
        display: flex;
        flex-direction: column;
        gap: var(--pos-gap);
        max-height: calc(100vh - 1.4rem);
    }

    .pos-col-right > .pos-total-card,
    .pos-col-right > .pos-submit {
        flex-shrink: 0;
    }

    .pos-col-right > .pos-card:not(.pos-total-card) {
        min-height: 0;
        overflow-y: auto;
    }
}

.pos-card {
    display: grid;
    gap: 0.55rem;
    min-width: 0;
    padding: 0.75rem 0.85rem;
    border: var(--pos-border);
    border-radius: var(--pos-radius);
    background: var(--pos-surface);
    box-shadow: 0 1px 2px rgba(0, 19, 36, 0.04);
}

.pos-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 0;
}

.pos-card-head strong {
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--brand-strong);
}

.pos-hint {
    color: var(--muted);
    font-size: 0.72rem;
}

/* ---- Columna izquierda: cliente + meta ---- */
.pos-client {
    display: grid;
    gap: 0.4rem;
    position: relative;
}

.pos-client-input {
    width: 100%;
    min-height: 38px;
    padding: 0.45rem 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 10px;
    background: #fff;
    font-size: 0.9rem;
}

.pos-client-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.15);
}

.pos-client .client-search-panel {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    z-index: 50;
    padding: 0.4rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 19, 36, 0.12);
}

.pos-client .client-search-results {
    max-height: 260px;
    overflow-y: auto;
}

.pos-client-selected {
    display: grid;
    gap: 0.15rem;
    padding: 0.5rem 0.65rem;
    border: 1px dashed rgba(148, 163, 184, 0.45);
    border-radius: 10px;
    background: var(--pos-muted-surface);
}

.pos-client-selected-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.pos-client-selected strong {
    font-size: 0.92rem;
    line-height: 1.2;
}

.pos-client-selected small {
    color: var(--muted);
    font-size: 0.74rem;
}

.pos-meta-grid {
    display: grid;
    gap: 0.45rem 0.55rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pos-meta-grid label {
    display: grid;
    gap: 0.18rem;
    font-size: 0.74rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0;
}

.pos-meta-grid input,
.pos-meta-grid select {
    min-height: 36px;
    padding: 0.4rem 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 9px;
    background: #fff;
    font-size: 0.88rem;
    color: var(--text, #001324);
    text-transform: none;
    letter-spacing: 0;
}

.pos-meta-span {
    grid-column: 1 / -1;
}

.pos-meta-hint {
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.35;
}

.pos-notes summary {
    cursor: pointer;
    list-style: none;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--brand-strong);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pos-notes summary::-webkit-details-marker {
    display: none;
}

.pos-notes summary::before {
    content: "+ ";
}

.pos-notes[open] summary::before {
    content: "- ";
}

.pos-notes-grid {
    display: grid;
    gap: 0.45rem;
    margin-top: 0.5rem;
}

.pos-notes-grid textarea {
    min-height: 60px;
    padding: 0.4rem 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 9px;
    font-size: 0.85rem;
    resize: vertical;
}

/* ---- Columna central: items ---- */
.pos-items {
    min-height: 360px;
}

.pos-items-head strong {
    color: var(--brand-strong);
}

.pos-search {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.4rem;
    align-items: start;
}

.pos-search-input {
    grid-column: 1;
    width: 100%;
    min-height: 42px;
    padding: 0.55rem 0.75rem;
    border: 1.5px solid rgba(var(--brand-rgb), 0.3);
    border-radius: 10px;
    background: #fff;
    font-size: 0.95rem;
    font-weight: 500;
}

.pos-search-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.18);
}

.pos-search-add {
    grid-column: 2;
    align-self: stretch;
    min-height: 42px;
    white-space: nowrap;
}

.pos-search-status {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.35;
}

.pos-search-results {
    grid-column: 1 / -1;
    display: grid;
    gap: 0.3rem;
    max-height: 260px;
    overflow-y: auto;
}

.pos-search-results:empty {
    display: none;
}

.pos-hidden-summary {
    display: none !important;
}

.pos-items-list {
    display: grid;
    gap: 0.4rem;
    max-height: calc(100vh - 280px);
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.2rem;
}

.pos-items-list:empty {
    display: none;
}

.pos-items-list .line-item-card {
    padding: 0.55rem 0.7rem;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: var(--pos-muted-surface);
}

.pos-items-list .line-item-head {
    gap: 0.5rem;
}

.pos-items-list .line-item-head strong {
    font-size: 0.92rem;
    line-height: 1.2;
}

.pos-items-list .line-item-head small {
    font-size: 0.76rem;
    line-height: 1.35;
    color: var(--muted);
}

.pos-items-list .line-item-actions .btn {
    min-height: 30px;
    padding: 0.22rem 0.6rem;
    font-size: 0.78rem;
}

.pos-items-list .line-item-grid {
    margin-top: 0.5rem;
    gap: 0.4rem 0.55rem;
    grid-template-columns: minmax(0, 1.6fr) minmax(70px, 0.55fr) minmax(100px, 0.7fr) minmax(140px, 0.8fr);
}

.pos-items-list .line-item-grid input,
.pos-items-list .line-item-grid select {
    min-height: 34px;
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
}

.pos-items-empty {
    display: grid;
    place-items: center;
    gap: 0.2rem;
    padding: 2rem 1rem;
    border: 1.5px dashed rgba(148, 163, 184, 0.4);
    border-radius: 12px;
    background: var(--pos-muted-surface);
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.pos-items-empty strong {
    color: var(--text, #001324);
    font-size: 0.95rem;
}

.pos-items[data-has-items="1"] .pos-items-empty {
    display: none;
}

/* ---- Columna derecha: totales + cobro ---- */
.pos-total-card {
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--ink-deep);
    background: var(--ink-deep);
    color: #fff;
    gap: 0;
}

.pos-total-hero {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 0.35rem 0.7rem;
    padding: 0.85rem 1rem 0.7rem;
}

.pos-total-hero span {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.pos-total-hero strong {
    grid-column: 1;
    grid-row: 2;
    font-size: 2.05rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.pos-total-hero em {
    grid-column: 2;
    grid-row: 2;
    align-self: end;
    padding-bottom: 0.32rem;
    color: rgba(255, 255, 255, 0.85);
    font-style: normal;
    font-weight: 600;
    font-size: 0.95rem;
}

.pos-total-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    padding: 0;
    background: rgba(255, 255, 255, 0.12);
}

.pos-total-grid > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    /* Mismo marino que la cabecera: la tarjeta era azul arriba y de otro azul
       abajo, y el corte se leia como un error de render. */
    background: var(--ink-deep);
}

.pos-total-grid span {
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.pos-total-grid strong {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
}

.pos-total-grid-wide {
    grid-column: 1 / -1;
    background: rgba(var(--brand-rgb), 0.96) !important;
}

.pos-checkout {
    background: var(--pos-surface);
}

.pos-quick-methods,
.pos-quick-amounts {
    display: grid;
    gap: 0.35rem;
}

.pos-quick-methods {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pos-quick-amounts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pos-quick-methods .btn,
.pos-quick-amounts .btn {
    min-height: 32px;
    padding: 0.28rem 0.5rem;
    font-size: 0.78rem;
}

.pos-checkout-grid {
    display: grid;
    gap: 0.45rem 0.55rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pos-checkout-grid label {
    display: grid;
    gap: 0.18rem;
    margin: 0;
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pos-checkout-grid input,
.pos-checkout-grid select {
    min-height: 34px;
    padding: 0.35rem 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 9px;
    background: #fff;
    font-size: 0.86rem;
    color: var(--text, #001324);
    text-transform: none;
    letter-spacing: 0;
}

.pos-checkout-full {
    grid-column: 1 / -1;
}

.pos-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 52px;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 12px;
    background: var(--brand);
    color: #fff;
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(var(--brand-rgb), 0.32);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.pos-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(var(--brand-rgb), 0.38);
}

.pos-submit:active {
    transform: translateY(0);
}

.pos-submit kbd {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
}

/* ---- Breakpoints ---- */
@media (max-width: 1280px) {
    .pos-grid {
        grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.45fr) minmax(260px, 0.95fr);
    }

    .pos-total-hero strong {
        font-size: 1.75rem;
    }
}

@media (max-width: 1100px) {
    .pos-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .pos-col-left {
        grid-column: 1 / 2;
    }

    .pos-col-center {
        grid-column: 2 / 3;
        grid-row: 1 / span 2;
    }

    .pos-col-right {
        grid-column: 1 / 2;
        position: static;
    }

    .pos-items-list {
        max-height: calc(100vh - 320px);
    }
}

@media (max-width: 820px) {
    .pos-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .pos-col-left,
    .pos-col-center,
    .pos-col-right {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .pos-col-right {
        position: sticky;
        bottom: 0;
        top: auto;
        z-index: 20;
    }

    .pos-items-list {
        max-height: 50vh;
    }

    .pos-meta-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .pos-meta-span {
        grid-column: span 2;
    }
}

@media (max-width: 560px) {
    .pos-meta-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pos-meta-span {
        grid-column: 1 / -1;
    }

    .pos-quick-methods,
    .pos-checkout-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pos-total-hero strong {
        font-size: 1.6rem;
    }

    .pos-items-list .line-item-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .pos-search {
        grid-template-columns: 1fr;
    }

    .pos-search-add {
        grid-column: 1;
    }
}

/* =========================================================
   Sidebar Profile (mi perfil al pie del menu)
   ========================================================= */
.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 10px;
    border: 1px solid transparent;
    color: var(--shell-text);
    text-decoration: none;
    transition: border-color 0.18s ease, background 0.18s ease;
}

.sidebar-profile:hover {
    border-color: transparent;
    background: rgba(0, 19, 36, 0.05);
}

.sidebar-profile[aria-current="page"] {
    border-color: rgba(var(--brand-rgb), 0.28);
    background: var(--shell-primary-soft);
}

.sidebar-profile-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--shell-primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.74rem;
    letter-spacing: 0.02em;
}

.sidebar-profile-info {
    display: grid;
    gap: 0;
    min-width: 0;
    flex: 1 1 auto;
}

.sidebar-profile-info strong {
    color: var(--shell-text);
    font-size: 0.82rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-profile-info small {
    color: var(--shell-muted);
    font-size: 0.68rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-profile-edit {
    color: var(--shell-muted);
    font-size: 1rem;
    line-height: 1;
    flex: 0 0 auto;
}

.sidebar-profile-logout {
    margin: 0;
    flex: 1 1 0;
    min-width: 0;
}

.sidebar-profile-logout .btn {
    width: 100%;
}

.sidebar-footer-actions {
    display: flex;
    gap: 0.4rem;
    align-items: stretch;
    margin-top: 0.55rem;
}

.sidebar-footer-actions > * {
    flex: 1 1 0;
    min-width: 0;
}

.sidebar-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    min-height: 36px;
    padding: 0.32rem 0.55rem;
    border-radius: 9px;
    font-size: 0.78rem;
    line-height: 1;
    color: var(--shell-muted, #64748b);
    border-color: rgba(148, 163, 184, 0.35);
    background: transparent;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.sidebar-icon-btn i {
    font-size: 1rem;
    line-height: 1;
}

.sidebar-icon-btn:hover {
    background: rgba(var(--brand-rgb), 0.08);
    color: var(--brand-strong, #00698c);
    border-color: rgba(var(--brand-rgb), 0.35);
}

.sidebar-logout-btn:hover {
    background: rgba(220, 38, 38, 0.08);
    color: #b91c1c;
    border-color: rgba(220, 38, 38, 0.35);
}

.sidebar-icon-btn-label {
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.sidebar-collapsed .sidebar-footer-actions {
    flex-direction: column;
    gap: 0.35rem;
}

body.sidebar-collapsed .sidebar-icon-btn-label {
    display: none;
}

body.sidebar-collapsed .sidebar-icon-btn {
    width: 40px;
    min-width: 40px;
    padding: 0.4rem 0;
    margin: 0 auto;
}

body.sidebar-collapsed .sidebar-footer-actions > * {
    flex: 0 0 auto;
}

/* Estado compactado (sidebar colapsado): solo avatar */
body.sidebar-collapsed .sidebar-profile {
    justify-content: center;
    padding: 0.5rem;
}

body.sidebar-collapsed .sidebar-profile-info,
body.sidebar-collapsed .sidebar-profile-edit {
    display: none;
}

/* =========================================================
   Vista Mi Perfil
   ========================================================= */
.profile-identity-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(var(--brand-rgb), 0.14);
    border-radius: 16px;
    background: var(--surface-sunk);
    box-shadow: var(--shadow-soft, 0 4px 14px rgba(0, 19, 36, 0.06));
    min-width: min(320px, 100%);
}

.profile-avatar-lg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    flex: 0 0 auto;
}

.profile-identity-card strong {
    display: block;
    font-size: 1.05rem;
    line-height: 1.2;
}

.profile-identity-card small {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.35;
}

.profile-meta {
    margin-top: 0.18rem;
}

.profile-section-divider {
    display: grid;
    gap: 0.1rem;
    margin-top: 0.45rem;
    padding-top: 0.65rem;
    border-top: 1px dashed rgba(148, 163, 184, 0.45);
}

.profile-section-divider strong {
    font-size: 0.9rem;
    color: var(--brand-strong);
}

.profile-section-divider small {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.profile-tips {
    margin-top: 0.85rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.85);
}

.profile-tips strong {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--brand-strong);
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.profile-tips ul {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.profile-tips li + li {
    margin-top: 0.25rem;
}

/* =========================================================
   Historial de facturas colapsable
   ========================================================= */
.pos-history {
    padding: 0;
    overflow: hidden;
}

.pos-history > .pos-history-summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-lg);
    transition: background 0.18s ease;
}

.pos-history > .pos-history-summary::-webkit-details-marker,
.pos-history > .pos-history-summary::marker {
    display: none;
    content: "";
}

.pos-history > .pos-history-summary:hover {
    background: rgba(248, 250, 252, 0.85);
}

.pos-history-summary-copy h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.2;
}

.pos-history-summary-copy p {
    margin: 0.18rem 0 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

.pos-history-count {
    margin-left: 0.3rem;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.pos-history-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 0.85rem;
    border: 1px solid rgba(var(--brand-rgb), 0.22);
    border-radius: 999px;
    background: rgba(var(--brand-rgb), 0.08);
    color: var(--brand-strong);
    font-size: 0.8rem;
    font-weight: 600;
    flex: 0 0 auto;
}

.pos-history-toggle-hide,
.pos-history[open] .pos-history-toggle-show {
    display: none;
}

.pos-history[open] .pos-history-toggle-hide {
    display: inline;
}

.pos-history-chevron {
    display: inline-block;
    font-size: 1.05rem;
    line-height: 1;
    transform: rotate(90deg);
    transition: transform 0.18s ease;
}

.pos-history[open] .pos-history-chevron {
    transform: rotate(-90deg);
}

.pos-history-body {
    display: grid;
    gap: 0.85rem;
    padding: 0 1.1rem 1.1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    padding-top: 0.9rem;
}

.pos-history-export {
    justify-content: flex-end;
}

.quotation-history > .pos-history-summary {
    padding: 0.75rem 1rem;
}

.quotation-history .pos-history-summary-copy h3 {
    font-size: 0.96rem;
}

.quotation-history .pos-history-summary-copy p {
    margin-top: 0.1rem;
    font-size: 0.78rem;
}

.quotation-history-filters {
    display: grid;
    grid-template-columns: minmax(140px, 170px) minmax(140px, 170px) minmax(220px, 1fr) auto;
    align-items: end;
    gap: 0.55rem;
    padding: 0.65rem 1rem;
    margin: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(248, 250, 252, 0.45);
}

.quotation-history-filters label {
    display: grid;
    gap: 0.22rem;
    margin: 0;
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 600;
}

.quotation-history-filters input {
    width: 100%;
    min-height: 38px;
    padding: 0.44rem 0.65rem;
    border-radius: 10px;
}

.quotation-history-filters .btn {
    min-height: 38px;
    padding: 0.42rem 0.75rem;
    white-space: nowrap;
}

.quotation-history > .table-wrap {
    margin-top: 0;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0;
}

@media (max-width: 820px) {
    .quotation-history-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .quotation-history-filters label:nth-child(3),
    .quotation-history-filters .btn {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .pos-history > .pos-history-summary {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
    }

    .pos-history-toggle {
        justify-content: center;
    }

    .quotation-history-filters {
        grid-template-columns: 1fr;
        padding: 0.6rem 0.8rem;
    }

    .quotation-history-filters label:nth-child(3),
    .quotation-history-filters .btn {
        grid-column: auto;
    }
}

/* =========================================================
   POS Workspace - Variantes Produccion
   ========================================================= */
.pos-grid-production {
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
}

@media (max-width: 1100px) {
    .pos-grid-production {
        grid-template-columns: minmax(0, 1fr);
    }

    .pos-grid-production .pos-col-right {
        position: static;
    }
}

.pos-topbar-stat {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: rgba(var(--brand-rgb), 0.08);
    color: var(--brand-strong);
    font-size: 0.74rem;
    letter-spacing: 0.03em;
}

.pos-topbar-stat strong {
    font-size: 0.92rem;
    font-weight: 700;
}

.pos-production-summary .pos-total-hero strong {
    font-size: 2.4rem;
}

.pos-production-summary .pos-total-hero em {
    padding-bottom: 0.45rem;
}

.pos-production-summary .pos-total-grid > div {
    padding: 0.55rem 0.85rem;
}

.pos-production-summary .pos-total-grid span {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.78rem;
    line-height: 1.4;
}

.pos-meta-grid textarea {
    min-height: 70px;
    padding: 0.4rem 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 9px;
    background: #fff;
    font-size: 0.86rem;
    text-transform: none;
    letter-spacing: 0;
    resize: vertical;
}

/* =========================================================
   Settings - toggle de modulo
   ========================================================= */
.settings-toggle {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.85);
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
}

.settings-toggle input[type="checkbox"] {
    margin-top: 0.18rem;
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--brand, #00698c);
    flex: 0 0 auto;
}

.settings-toggle span {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
}

.settings-toggle strong {
    color: var(--text, #001324);
    font-size: 0.92rem;
}

.settings-toggle small {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

/* =========================================================
   POS - Compras: panel de producto personalizado
   ========================================================= */
.pos-supplier-label {
    margin: 0;
}

.pos-supplier-select {
    width: 100%;
    min-height: 38px;
    padding: 0.45rem 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 10px;
    background: #fff;
    font-size: 0.9rem;
}

.pos-custom-product {
    display: grid;
    gap: 0.55rem;
    padding: 0.85rem 0.95rem;
    margin-top: 0.2rem;
    border: 1.5px dashed rgba(99, 102, 241, 0.4);
    border-radius: 12px;
    background: var(--surface-sunk);
}

.pos-custom-product[hidden] {
    display: none;
}

.pos-custom-product-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.pos-custom-product-head strong {
    font-size: 0.86rem;
    color: var(--brand-strong);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pos-custom-close {
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.2rem;
}

.pos-custom-close:hover {
    color: var(--text, #001324);
}

.pos-custom-product > small {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.pos-custom-grid {
    display: grid;
    gap: 0.45rem 0.55rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pos-custom-span {
    grid-column: 1 / -1;
}

.pos-custom-grid label {
    display: grid;
    gap: 0.18rem;
    margin: 0;
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pos-custom-grid input,
.pos-custom-grid select {
    min-height: 34px;
    padding: 0.35rem 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 9px;
    background: #fff;
    font-size: 0.86rem;
    color: var(--text, #001324);
    text-transform: none;
    letter-spacing: 0;
}

.pos-custom-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.pos-custom-actions .btn {
    min-height: 34px;
    padding: 0.35rem 0.85rem;
    font-size: 0.85rem;
}

.line-item-card-custom {
    border-color: rgba(99, 102, 241, 0.35) !important;
    background: var(--surface-sunk) !important;
}

@media (max-width: 720px) {
    .pos-custom-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .pos-custom-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* =========================================================
   POS - Gastos: layout especifico
   ========================================================= */
.pos-grid-expense {
    grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.5fr) minmax(280px, 1fr);
}

@media (max-width: 1100px) {
    .pos-grid-expense {
        grid-template-columns: minmax(0, 1fr);
    }
}

.pos-custom-toggle-inline {
    align-self: flex-start;
    min-height: 28px;
    padding: 0.22rem 0.65rem;
    font-size: 0.76rem;
}

.pos-expense-input-card {
    gap: 0.4rem;
}

.pos-expense-amount-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.55rem;
    align-items: stretch;
}

.pos-expense-amount {
    width: 100%;
    min-height: 64px;
    padding: 0.65rem 0.95rem;
    border: 1.5px solid rgba(var(--brand-rgb), 0.3);
    border-radius: 12px;
    background: #fff;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text, #001324);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.pos-expense-amount:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(var(--brand-rgb), 0.18);
}

.pos-expense-currency {
    min-height: 64px;
    padding: 0.5rem 0.95rem;
    border: 1.5px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    background: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--brand-strong);
    letter-spacing: 0.04em;
}

.pos-expense-currency:focus {
    outline: none;
    border-color: var(--brand);
}

.pos-expense-hint {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.pos-expense-description {
    width: 100%;
    min-height: 110px;
    padding: 0.55rem 0.7rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 10px;
    background: #fff;
    font-size: 0.9rem;
    resize: vertical;
}

.pos-expense-description:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.15);
}

@media (max-width: 640px) {
    .pos-expense-amount {
        font-size: 1.6rem;
        min-height: 52px;
    }
    .pos-expense-currency {
        min-height: 52px;
        font-size: 0.95rem;
    }
}

/* =========================================================
   Inventario - Catalogo (layout denso)
   ========================================================= */
.inventory-shell {
    display: grid;
    gap: 0.6rem;
    margin-bottom: 0.7rem;
}

.inventory-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.5rem 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 14px;
    background: var(--accent-wash);
}

.inventory-topbar-title h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.15;
}

.inventory-topbar-title small {
    display: block;
    margin-top: 0.15rem;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.35;
}

.inventory-topbar-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.inventory-topbar-actions .btn {
    min-height: 32px;
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

.inventory-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
}

.inventory-kpis-services {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.inventory-kpi {
    display: grid;
    gap: 0.15rem;
    padding: 0.55rem 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 19, 36, 0.04);
}

.inventory-kpi span {
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.inventory-kpi strong {
    color: var(--text, #001324);
    font-size: 1.05rem;
    line-height: 1.1;
    font-weight: 700;
}

.inventory-kpi em {
    color: var(--muted);
    font-style: normal;
    font-size: 0.75rem;
}

.inventory-kpi-warning {
    border-color: rgba(220, 38, 38, 0.32);
    background: rgba(254, 226, 226, 0.4);
}

.inventory-kpi-warning strong {
    color: #b91c1c;
}

.inventory-kpi-in {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(209, 250, 229, 0.4);
}

.inventory-kpi-in strong {
    color: #047857;
}

.inventory-kpi-out {
    border-color: rgba(220, 38, 38, 0.28);
    background: rgba(254, 226, 226, 0.35);
}

.inventory-kpi-out strong {
    color: #b91c1c;
}

.inventory-history-date-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 0.4rem;
    align-items: end;
    grid-column: span 2;
}

.inventory-history-date-actions {
    display: flex;
    align-items: flex-end;
    padding-bottom: 0.1rem;
}

.inventory-history-date-actions .btn {
    min-height: 36px;
}

@media (max-width: 1100px) {
    .inventory-history-date-form {
        grid-column: 1 / -1;
    }
}

@media (max-width: 560px) {
    .inventory-history-date-form {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .inventory-history-date-actions {
        grid-column: 1 / -1;
    }
}

/* =========================================================
   Reportes - layout denso (chips + filtros + KPIs)
   ========================================================= */
.reports-shell {
    display: grid;
    gap: 0.55rem;
    margin-bottom: 0.7rem;
}

.reports-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.5rem 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 14px;
    background: var(--accent-wash);
}

.reports-topbar-title h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.15;
}

.reports-topbar-title small {
    display: block;
    margin-top: 0.15rem;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.4;
}

.reports-topbar-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.reports-topbar-actions .btn {
    min-height: 32px;
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
}

/* Chips de tipos de reporte: tarjetas con mas presencia */
.reports-chips {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.55rem;
    padding: 0;
    background: transparent;
    border: none;
}

.reports-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.18rem;
    padding: 0.7rem 0.95rem;
    min-height: 62px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 14px;
    background: #fff;
    color: var(--text, #001324);
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0, 19, 36, 0.05);
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.reports-chip strong {
    font-size: 1rem;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.reports-chip small {
    font-size: 0.66rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    line-height: 1;
}

.reports-chip:hover {
    border-color: rgba(var(--brand-rgb), 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 19, 36, 0.08);
}

.reports-chip.is-active {
    background: var(--brand);
    border-color: rgba(var(--brand-rgb), 0.85);
    color: #fff;
    box-shadow: 0 8px 20px rgba(var(--brand-rgb), 0.3);
    transform: translateY(-1px);
}

.reports-chip.is-active strong {
    color: #fff;
}

.reports-chip.is-active small {
    color: rgba(255, 255, 255, 0.88);
}

/* Toolbar de filtros */
.reports-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.5rem 0.6rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    background: #fff;
}

.reports-filters > .reports-filter {
    flex: 1 1 150px;
    min-width: 140px;
    max-width: 220px;
}

.reports-filter {
    display: grid;
    gap: 0.18rem;
    margin: 0;
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.reports-filter input,
.reports-filter select {
    min-height: 34px;
    padding: 0.35rem 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    background: #fff;
    font-size: 0.86rem;
    color: var(--text, #001324);
    text-transform: none;
    letter-spacing: 0;
}

.reports-filter input:focus,
.reports-filter select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.15);
}

.reports-filter-actions {
    display: flex;
    align-items: flex-end;
    flex: 0 0 auto;
}

.reports-filter-actions .btn {
    min-height: 34px;
}

.reports-rate-context {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    background: rgba(var(--brand-rgb), 0.08);
    color: var(--brand-strong);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    margin-left: auto;
    flex: 0 0 auto;
}

/* KPIs strip de reportes (reutiliza .inventory-kpi) */
.reports-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
}

@media (max-width: 720px) {
    .reports-filters > .reports-filter {
        flex: 1 1 calc(50% - 0.3rem);
        max-width: none;
    }

    .reports-rate-context {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }

    .reports-filter-actions {
        width: 100%;
    }

    .reports-filter-actions .btn {
        width: 100%;
    }
}

.inventory-kpi-money strong {
    font-size: 0.98rem;
}

.inventory-create-panel {
    position: relative;
    border-color: rgba(99, 102, 241, 0.32);
    background: var(--surface-sunk);
}

.inventory-create-panel[hidden] {
    display: none;
}

.inventory-create-panel .pos-custom-close {
    position: absolute;
    top: 0.6rem;
    right: 0.7rem;
}

.inventory-catalog-card {
    padding: 0.75rem 0.85rem;
}

.inventory-catalog-toolbar {
    display: grid;
    grid-template-columns: minmax(180px, 1.6fr) repeat(3, minmax(120px, 1fr)) auto;
    gap: 0.5rem;
    align-items: end;
    margin-bottom: 0.6rem;
}

.inventory-filter {
    display: grid;
    gap: 0.18rem;
    margin: 0;
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.inventory-filter input,
.inventory-filter select {
    min-height: 36px;
    padding: 0.4rem 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 9px;
    background: #fff;
    font-size: 0.86rem;
    color: var(--text, #001324);
    text-transform: none;
    letter-spacing: 0;
}

.inventory-filter input:focus,
.inventory-filter select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.15);
}

.inventory-filter-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    padding-bottom: 0.2rem;
    line-height: 1.1;
}

.inventory-filter-meta strong {
    color: var(--brand-strong);
    font-size: 1.2rem;
    font-weight: 700;
}

.inventory-filter-meta small {
    color: var(--muted);
    font-size: 0.7rem;
}

@media (max-width: 1100px) {
    .inventory-catalog-toolbar {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
    }

    .inventory-filter-meta {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: baseline;
        gap: 0.35rem;
        justify-content: flex-end;
    }
}

@media (max-width: 720px) {
    .inventory-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .inventory-catalog-toolbar {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
}

@media (max-width: 480px) {
    .inventory-kpis {
        grid-template-columns: minmax(0, 1fr);
    }

    .inventory-catalog-toolbar {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* =========================================================
   Ajustes moviles POS
   Capa exclusiva para pantallas pequenas: evita desbordes en
   facturacion, notas de entrega, compras y cotizaciones.
   ========================================================= */
@media (max-width: 720px) {
    .shell-main {
        height: auto;
        min-height: 100dvh;
        overflow-y: visible;
    }

    .topbar,
    .topbar-modern {
        position: relative;
        top: auto;
        z-index: 30;
        min-height: 56px;
        padding: max(0.48rem, env(safe-area-inset-top)) 0.75rem 0.36rem;
        align-items: center;
        justify-content: flex-start;
        background: transparent;
        border-bottom: 0;
        box-shadow: none;
        backdrop-filter: none;
    }

    .topbar-leading,
    .topbar-leading-minimal {
        width: auto;
        flex: 0 0 auto;
        align-items: center;
        min-width: 0;
    }

    .menu-toggle {
        width: 42px;
        height: 42px;
        padding: 0.58rem;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 8px 22px rgba(0, 19, 36, 0.09);
    }

    .content-modern {
        padding-top: 0.25rem;
    }

    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    .pos-workspace {
        margin-inline: -0.15rem;
    }

    .pos-form {
        gap: 0.55rem;
    }

    .pos-topbar {
        align-items: stretch;
        gap: 0.55rem;
        padding: 0.65rem;
        border-radius: 12px;
    }

    .pos-topbar-title,
    .pos-topbar-actions {
        min-width: 0;
        width: 100%;
    }

    .pos-topbar-title h3 {
        font-size: 0.98rem;
    }

    .pos-topbar-title small {
        font-size: 0.72rem;
        overflow-wrap: anywhere;
    }

    .pos-topbar-title kbd,
    .pos-submit kbd,
    .pos-card-head kbd,
    .pos-hint kbd {
        display: none;
    }

    .pos-topbar-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pos-topbar-actions .btn,
    .pos-submit,
    .pos-search-add,
    .pos-quick-methods .btn,
    .pos-quick-amounts .btn {
        width: 100%;
    }

    .pos-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.55rem;
    }

    .pos-col-left,
    .pos-col-center,
    .pos-col-right {
        grid-column: 1 / -1;
        grid-row: auto;
        min-width: 0;
    }

    .pos-col-right {
        position: static;
        z-index: auto;
    }

    .pos-card {
        padding: 0.65rem;
        border-radius: 12px;
    }

    .pos-card-head {
        align-items: flex-start;
    }

    .pos-hint {
        font-size: 0.68rem;
        text-align: right;
    }

    .pos-meta-grid,
    .pos-checkout-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.42rem;
    }

    .pos-meta-span,
    .pos-checkout-full {
        grid-column: 1 / -1;
    }

    .pos-meta-grid input,
    .pos-meta-grid select,
    .pos-checkout-grid input,
    .pos-checkout-grid select,
    .pos-client-input,
    .pos-search-input,
    .pos-notes-grid textarea {
        min-width: 0;
        font-size: 16px;
    }

    .pos-client .client-search-panel {
        position: static;
        margin-top: 0.35rem;
        max-height: 54vh;
        overflow-y: auto;
    }

    .pos-search {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.38rem;
    }

    .pos-search-input,
    .pos-search-add,
    .pos-search-status,
    .pos-search-results {
        grid-column: 1;
    }

    .pos-search-results {
        max-height: 42vh;
    }

    .pos-items {
        min-height: auto;
    }

    .pos-items-list {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .pos-items-list .line-item-card,
    .line-item-card {
        min-width: 0;
        padding: 0.65rem;
        border-radius: 12px;
    }

    .pos-items-list .line-item-head,
    .line-item-head {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 0.45rem;
    }

    .pos-items-list .line-item-head > :first-child,
    .line-item-head > :first-child {
        min-width: 0;
    }

    .pos-items-list .line-item-actions,
    .line-item-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.4rem;
        width: 100%;
    }

    .pos-items-list .line-item-actions .btn,
    .line-item-actions .btn {
        width: 100%;
        min-width: 0;
        padding-inline: 0.45rem;
        white-space: normal;
    }

    .line-item-quick-qty {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
    }

    .line-item-quick-qty-controls {
        grid-template-columns: 38px minmax(0, 1fr) 38px;
    }

    .pos-items-list .line-item-grid,
    .line-item-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.48rem;
    }

    .pos-items-list .line-item-grid > *,
    .line-item-grid > *,
    .line-item-product {
        min-width: 0;
    }

    .line-item-product {
        padding: 0.65rem;
        border-radius: 12px;
    }

    .line-item-identity strong,
    .line-item-identity small,
    .line-item-head strong,
    .line-item-head small,
    .money-stack strong,
    .money-stack small {
        overflow-wrap: anywhere;
    }

    .line-item-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pos-total-card {
        border-radius: 12px;
    }

    .pos-total-hero {
        grid-template-columns: minmax(0, 1fr) auto;
        padding: 0.75rem 0.85rem 0.65rem;
    }

    .pos-total-hero strong {
        min-width: 0;
        font-size: 1.42rem;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .pos-total-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pos-total-grid > div {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.18rem;
        padding: 0.52rem 0.7rem;
    }

    .pos-total-grid strong {
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .pos-quick-methods {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pos-quick-amounts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pos-custom-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pos-custom-actions .btn {
        width: 100%;
        min-width: 0;
    }

    .pos-submit {
        min-height: 46px;
        border-radius: 12px;
        font-size: 0.96rem;
    }

    .document-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.42rem;
    }

    .document-actions .btn,
    .document-actions form {
        min-width: 0;
        width: 100%;
        flex: none;
    }

    .table.mobile-cards td {
        overflow-wrap: anywhere;
    }

    .table.mobile-cards td[data-label="Acciones"]::before {
        margin-bottom: 0.55rem;
    }
}

@media (max-width: 480px) {
    .content,
    .content-modern {
        padding-inline: 0.45rem;
    }

    .pos-workspace {
        margin-inline: 0;
    }

    .pos-topbar,
    .pos-card {
        border-radius: 10px;
    }

    .pos-topbar-actions,
    .pos-meta-grid,
    .pos-checkout-grid,
    .pos-quick-methods,
    .document-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .pos-quick-amounts,
    .line-item-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pos-custom-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .pos-total-hero {
        grid-template-columns: minmax(0, 1fr);
    }

    .pos-total-hero em {
        grid-column: 1;
        grid-row: 3;
        padding-bottom: 0;
        font-size: 0.82rem;
    }

    .pos-total-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .pos-items-empty {
        padding: 1.25rem 0.75rem;
    }

    .table.mobile-cards tr {
        border-radius: 12px;
    }

    .table.mobile-cards td {
        padding: 0.7rem 0.75rem;
    }
}


/* =========================================================
   Cyberia
   Suscripcion y soporte del hub. El color fuerte se reserva
   para los estados en los que hay algo que hacer; con el
   servicio al dia la pantalla se mantiene neutra.
   ========================================================= */
.alert.warn {
    color: #92400e;
    background: rgba(251, 191, 36, 0.18);
}

.cyberia-notice a {
    font-weight: 700;
    text-decoration: underline;
}

.inventory-kpi.cyberia-kpi-ok strong {
    color: var(--success);
}

.inventory-kpi.cyberia-kpi-warn strong {
    color: #b45309;
}

.inventory-kpi.cyberia-kpi-danger strong {
    color: var(--danger);
}

.cyberia-hint {
    margin: 0.75rem 0 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.55;
}

.cyberia-env-list {
    margin: 0.5rem 0 0;
    padding-left: 1.1rem;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.9;
}

.cyberia-plans {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.cyberia-plan {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-strong);
}

.cyberia-plan strong {
    display: block;
    font-size: 1.02rem;
}

.cyberia-plan-price {
    display: block;
    margin-top: 0.3rem;
    color: var(--brand);
    font-size: 1.24rem;
    font-weight: 700;
}

.cyberia-plan-price small {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 500;
}

.cyberia-plan p {
    margin: 0.55rem 0 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

/* El hilo del ticket: las respuestas del staff se separan visualmente de lo
   que escribio el cliente, porque leerlo mezclado obliga a buscar quien dijo
   que en cada mensaje. */
.cyberia-thread {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.cyberia-message {
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-strong);
}

.cyberia-message.is-staff {
    border-color: rgba(var(--brand-rgb), 0.28);
    background: rgba(var(--brand-rgb), 0.06);
}

.cyberia-message header {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}

.cyberia-message header small {
    color: var(--muted);
    font-size: 0.78rem;
}

.cyberia-message p {
    margin: 0;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

/* Panel pausado. No es un modal: no se puede cerrar, porque el acceso
   depende de una decision del hub, no de la voluntad del usuario. */
.cyberia-lock {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 1rem;
}

.cyberia-lock-card {
    max-width: 520px;
    text-align: center;
}

.cyberia-lock-card h2 {
    margin: 0.35rem 0 0.6rem;
}

.cyberia-lock-card p {
    color: var(--muted);
    line-height: 1.6;
}

.cyberia-lock-note {
    margin-top: 0.75rem;
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.92);
    color: var(--text);
    font-size: 0.88rem;
}

.cyberia-lock-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.1rem;
}

/* Aviso de vencimiento del hub. Fondo tenido, sin contorno: es lo unico
   de la pantalla que tiene que leerse primero. */
.card.cyberia-expiry {
    background: var(--warn-soft);
}

.cyberia-expiry h3 {
    color: var(--warn);
}

.cyberia-expiry-message {
    margin: 0 0 0.9rem;
    line-height: 1.6;
    white-space: normal;
}

.cyberia-lock-card .cyberia-expiry-message {
    margin-top: 0.75rem;
    color: var(--text);
}

/* ==========================================================================
   Renglones de documento: abiertos por defecto y buscador navegable
   ========================================================================== */

/* El renglon nace expandido, asi que la vista previa del encabezado
   ("Producto | Cant. 2 | Precio 12,00") repetiria lo que ya se ve editable
   justo debajo. Solo aparece cuando el renglon esta colapsado. */
.line-item-card:not(.is-collapsed) [data-line-head-meta] {
    display: none;
}

/* Lo mismo con el contador rapido de cantidad del encabezado: con el detalle
   abierto habria dos campos de cantidad compitiendo por el mismo dato. */
.line-item-card:not(.is-collapsed) .line-item-quick-qty {
    display: none;
}

/* Producto repetido: en vez de abrir un renglon duplicado se suma cantidad en
   el que ya existe, y el destello dice cual fue. */
.line-item-card.is-line-merged {
    animation: line-item-merge 0.9s ease;
}

/* Se anima solo el anillo y no el fondo: el mismo renglon vive en la mesa de
   facturacion y dentro del modal de compras, con fondos distintos. */
@keyframes line-item-merge {
    0% {
        box-shadow: 0 0 0 2px rgba(var(--brand-rgb), 0.55);
    }
    100% {
        box-shadow: 0 0 0 2px rgba(var(--brand-rgb), 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .line-item-card.is-line-merged {
        animation: none;
        box-shadow: 0 0 0 2px rgba(var(--brand-rgb), 0.55);
    }

    .client-option {
        transition: none;
    }
}

/* =========================================================
   Centro de control (dashboard)
   =========================================================
   Reemplaza el bloque .ops-* que vivia incrustado en la
   vista. Aquello apilaba seccion > panel > tarjeta > chip:
   cuatro niveles de caja para mostrar un numero. Aqui hay un
   solo nivel de superficie (.cb-pnl) y la jerarquia la hace
   el peso tipografico, no el recuadro.
   ========================================================= */

.cb {
    --cb-gap: 24px;
    --cb-pad: 18px;
    --cb-radius: 10px;
    --cb-ease: cubic-bezier(.2, .7, .3, 1);

    /* Ancho completo del area de contenido: el dashboard es la pantalla que
       mas datos muestra a la vez y acotarla a 1240px desperdiciaba el monitor. */
    padding: 20px 26px 40px;
    display: grid;
    gap: var(--cb-gap);
}

.cb *,
.cb *::before,
.cb *::after { box-sizing: border-box; min-width: 0; }

.cb h2,
.cb h3 { margin: 0; text-wrap: balance; }

.cb-sr {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Cifras en mono tabular: se alinean en columna y se comparan de un vistazo.
   Es lo que hace que la pantalla se lea como un libro de cuentas. */
.cb-num {
    font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.cb-num-lg { font-size: 20px; font-weight: 600; }
.cb-num-xl { font-size: 30px; font-weight: 600; letter-spacing: -0.025em; }
.cb-num.is-pos { color: var(--success); }
.cb-num.is-neg { color: var(--danger); }
.cb-dim { color: var(--muted); }
.cb-r { text-align: right; }
.cb-unit { color: var(--muted); font-size: 11px; }

/* ---------- Barra de mando ---------- */

.cb-cmd {
    display: grid;
    gap: 18px;
    padding: 16px 20px 18px;
    border: 1px solid var(--line);
    border-radius: var(--cb-radius);
    background: var(--surface-strong);
    color: var(--text);
}

/* Dos filas: arriba identidad y controles, abajo el saludo a lo ancho. En una
   sola fila el saludo competia con el rango de fechas y se partia en tres.

   Flex y no grid: con el dashboard a ancho completo, una pista grid "auto"
   absorbia el espacio libre y estiraba las fechas a media pantalla. Aqui los
   controles miden lo que miden y el margen automatico del bloque de identidad
   los empuja a la derecha. */
.cb-cmd-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 24px;
}

.cb-cmd-id { margin-right: auto; }
.cb-cmd-find {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 1 340px;
}

.cb-cmd-find i {
    position: absolute;
    left: 11px;
    top: 50%;
    color: var(--muted);
    transform: translateY(-50%);
    font-size: 13px;
    pointer-events: none;
}

.cb-cmd-range {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 6px;
}

.cb-cmd-range label { display: flex; align-items: center; }
.cb-cmd-range input[type="date"] { width: 140px; }

.cb-cmd-shortcuts { display: flex; gap: 4px; margin-left: 4px; }

.cb-cmd-id { display: flex; align-items: center; gap: 11px; }

.cb-mark { display: block; width: 34px; height: 34px; color: #fff; flex: 0 0 auto; }
.cb-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* El logo se asienta una sola vez al cargar, en silencio. */
    animation: cbLock .7s var(--cb-ease) both;
}

@keyframes cbLock {
    from { opacity: 0; transform: translate(-4px, -4px); }
    to   { opacity: 1; transform: none; }
}

.cb-cmd-name { display: grid; line-height: 1.25; }
/* ---------- Barra de mando en claro (reemplaza el bloque oscuro) ---------- */

.cb-cmd-name strong { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.cb-cmd-name small { font-size: 11px; color: var(--muted); }

.cb-cmd-greet {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px 24px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.cb-cmd-period { text-align: right; line-height: 1.4; }
.cb-cmd-period strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); }
.cb-cmd-period small { font-size: 11.5px; color: var(--muted); }

.cb-cmd-greet h2 {
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text);
}

.cb-cmd-greet p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.cb-cmd-find input {
    width: 100%;
    height: 38px;
    padding: 0 12px 0 31px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: var(--surface-sunk);
    color: var(--text);
    font-size: 13px;
    transition: border-color .16s var(--cb-ease), background .16s var(--cb-ease);
}

.cb-cmd-find input::placeholder { color: var(--muted); }
.cb-cmd-find input:hover { background: var(--surface-strong); }
.cb-cmd-find input:focus { outline: none; border-color: var(--brand); background: var(--surface-strong); }

.cb-cmd-range-sep { color: var(--muted); }

.cb-cmd-range input[type="date"] {
    height: 38px;
    padding: 0 8px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 12px;
    color-scheme: light;
}

.cb-cmd-range button {
    height: 38px;
    padding: 0 14px;
    border: 1px solid var(--brand);
    border-radius: 7px;
    background: var(--brand);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    transition: background .16s var(--cb-ease), border-color .16s var(--cb-ease);
}

.cb-cmd-range button:hover { background: var(--brand-strong); border-color: var(--brand-strong); }

.cb-cmd-shortcuts button {
    height: 38px;
    padding: 0 11px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: var(--surface-strong);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
    transition: color .16s var(--cb-ease), border-color .16s var(--cb-ease), background .16s var(--cb-ease);
}

.cb-cmd-shortcuts button:hover { color: var(--brand); border-color: var(--brand); background: var(--accent-wash); }

.cb-cmd :is(input, button):focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* ---------- Botones de creacion ---------- */

/* Son botones, no tarjetas: icono y verbo, nada de titulo + parrafo + etiqueta.
   El primero va lleno porque facturar es lo que mas se hace; el resto en linea
   para que la fila no compita con el carril de atencion que viene debajo. */
.cb-acts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.cb-act {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 62px;
    padding: 0 18px;
    border: 1px solid var(--line-strong);
    border-radius: var(--cb-radius);
    background: var(--surface-strong);
    color: var(--text);
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: border-color .16s var(--cb-ease), background .16s var(--cb-ease), color .16s var(--cb-ease);
}

.cb-act i { font-size: 18px; color: var(--brand); transition: color .16s var(--cb-ease); }

.cb-act:hover { border-color: var(--brand); background: var(--accent-wash); color: var(--brand-strong); }
.cb-act:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.cb-act.is-primary {
    border-color: var(--ink-deep);
    background: var(--ink-deep);
    color: #fff;
}

.cb-act.is-primary i { color: var(--accent); }
.cb-act.is-primary:hover { background: var(--surface-dark-alt); border-color: var(--surface-dark-alt); color: #fff; }


/* ---------- Carril de atencion ---------- */

/* Todo en orden: una linea y se acabo. La pantalla se acorta sola. */
.cb-clear {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: var(--cb-radius);
    background: var(--surface-strong);
    color: var(--text-2);
    font-size: 13px;
}

.cb-clear i { color: var(--success); font-size: 15px; }

.cb-attn h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 9px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.cb-attn-total {
    display: inline-grid;
    place-items: center;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 5px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

.cb-attn ul { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; }

.cb-attn-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    transition: border-color .16s var(--cb-ease);
}

.cb-attn-row:first-child { border-radius: var(--cb-radius) var(--cb-radius) 0 0; }
.cb-attn-row:last-child { border-radius: 0 0 var(--cb-radius) var(--cb-radius); }
.cb-attn-row:only-child { border-radius: var(--cb-radius); }
.cb-attn-row + .cb-attn-row { margin-top: -1px; }
.cb-attn-row:hover { border-color: var(--line-strong); z-index: 1; }

.cb-attn-n {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
    font-size: 22px;
    font-weight: 600;
    line-height: 1;
    text-align: right;
    letter-spacing: -0.03em;
}

.cb-attn-row.is-critical .cb-attn-n { color: var(--danger); }
.cb-attn-row.is-warn .cb-attn-n { color: var(--warn); }
.cb-attn-row.is-info .cb-attn-n { color: var(--brand); }

.cb-attn-copy { display: grid; gap: 1px; line-height: 1.35; }
.cb-attn-copy strong { font-size: 13.5px; font-weight: 600; color: var(--text); }
.cb-attn-copy small { font-size: 12px; color: var(--muted); }

.cb-attn-go,
.cb-go {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--brand);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    transition: gap .16s var(--cb-ease), color .16s var(--cb-ease);
}

.cb-attn-go i,
.cb-go i { font-size: 12px; }
.cb-attn-go:hover,
.cb-go:hover { gap: 9px; color: var(--brand-strong); }

.cb-attn-go:focus-visible,
.cb-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* ---------- Rejilla y paneles ---------- */

/* Dos columnas iguales y los paneles colocados por el propio grid: sin
   envoltorios de columna, cada fila empareja dos paneles y ambos crecen a la
   misma altura. Asi la pantalla queda simetrica aunque un panel desaparezca
   (por reponer y mas vendidos son condicionales). */
.cb-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--cb-gap);
    align-items: stretch;
}

/* Un solo nivel de superficie. Nunca un panel dentro de otro. */
.cb-pnl {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: var(--cb-pad);
    border: 1px solid var(--line);
    border-radius: var(--cb-radius);
    background: var(--surface-strong);
}

.cb-pnl-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.cb-pnl-head h3 { font-size: 13px; font-weight: 600; color: var(--text); }
.cb-pnl-note { font-size: 11.5px; color: var(--muted); }

/* ---------- Panel del periodo ---------- */

.cb-figs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 14px 20px;
    margin: 0 0 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.cb-figs > div { display: grid; gap: 3px; }
.cb-figs dt { font-size: 11.5px; color: var(--muted); }
.cb-figs dd { margin: 0; font-size: 16px; color: var(--text); }

.cb-chart { height: 210px; }

.cb-legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 12px 0 0; }

.cb-key {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--muted);
}

.cb-key::before {
    content: "";
    width: 14px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
}

.cb-key-sales::before { background: var(--accent); height: 3px; }
.cb-key-purchases::before { background: var(--text); }
.cb-key-expenses::before { background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 7px); }

.cb-void {
    margin: 0;
    padding: 22px 0;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

/* ---------- Tabla de reposicion ---------- */

.cb-tbl { width: 100%; border-collapse: collapse; }

.cb-tbl thead th {
    padding: 0 0 8px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    text-align: left;
}

.cb-tbl thead th.cb-r { text-align: right; }

.cb-tbl tbody th,
.cb-tbl tbody td {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    font-weight: 400;
    text-align: left;
    vertical-align: middle;
}

.cb-tbl tbody tr:last-child :is(th, td) { border-bottom: 0; }
.cb-tbl tbody td.cb-r { text-align: right; }
.cb-tbl tbody th { display: flex; align-items: center; gap: 9px; padding-right: 12px; }

.cb-tbl-name { display: grid; gap: 1px; line-height: 1.3; }
.cb-tbl-name small {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 11px;
    color: var(--muted);
}

.cb-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.cb-dot.is-critical { background: var(--danger); }
.cb-dot.is-warn { background: var(--warn); }

.cb-flag {
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 10.5px;
    font-style: normal;
    font-weight: 500;
}

/* ---------- Ranking de productos ---------- */

.cb-rank { display: grid; gap: 11px; margin: 0; padding: 0; list-style: none; }

.cb-rank li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 5px 12px;
}

/* La barra ocupa el ancho completo debajo del renglon: flotando en una columna
   fija de 96px quedaba un hueco raro entre el nombre corto y la barra. */
.cb-rank-bar { grid-column: 1 / -1; }

.cb-rank-name {
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cb-rank-bar { height: 4px; border-radius: 2px; background: var(--surface-sunk); overflow: hidden; }

.cb-rank-bar i {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
    transform-origin: left;
    animation: cbGrow .5s var(--cb-ease) both;
}

@keyframes cbGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.cb-rank-val { font-size: 12.5px; color: var(--text-2); }

/* ---------- Actividad reciente ---------- */

.cb-feed { display: grid; margin: 0; padding: 0; list-style: none; }

.cb-feed-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}

.cb-feed-row:last-child { border-bottom: 0; padding-bottom: 0; }
.cb-feed-row:first-child { padding-top: 0; }
.cb-feed-row.is-void { opacity: .5; }
.cb-feed-row.is-void .cb-feed-amt { text-decoration: line-through; }

.cb-feed-ic {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: var(--surface-sunk);
    color: var(--text-2);
    font-size: 12px;
}

.cb-feed-ic--invoice { background: var(--accent-wash); color: var(--brand); }
.cb-feed-ic--purchase { background: var(--warn-soft); color: var(--warn); }
.cb-feed-ic--delivery { background: var(--success-soft); color: var(--success); }

.cb-feed-copy { display: grid; gap: 1px; line-height: 1.3; }
.cb-feed-copy strong {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cb-feed-copy small { font-size: 11px; color: var(--muted); }
.cb-feed-copy:hover strong { color: var(--brand); }
.cb-feed-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.cb-feed-amt { font-size: 12.5px; color: var(--text-2); }

/* ---------- Inventario y cuentas ---------- */

.cb-lead { display: flex; align-items: baseline; gap: 6px; margin: 0; }
.cb-lead-cur { font-size: 12px; color: var(--muted); }
.cb-lead-sub { margin: 4px 0 0; font-size: 11.5px; color: var(--muted); }

.cb-mini {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 16px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.cb-mini > div { display: grid; gap: 2px; }
.cb-mini dt { font-size: 11px; color: var(--muted); }
.cb-mini dd { margin: 0; font-size: 15px; color: var(--text); }

.cb-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0; }
.cb-split > div { display: grid; gap: 3px; }
.cb-split dt { font-size: 11.5px; color: var(--muted); }
.cb-split dd { margin: 0; }

.cb-go-block {
    justify-content: center;
    width: 100%;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

/* ---------- Responsive: estructural, no tipografia fluida ---------- */

@media (max-width: 1080px) {
    .cb-grid { grid-template-columns: minmax(0, 1fr); }

    .cb-cmd-find { flex: 1 1 240px; }
    .cb-cmd-range { flex: 1 1 100%; flex-wrap: wrap; }
}

@media (max-width: 700px) {
    .cb { padding: 14px 16px 32px; --cb-gap: 18px; }
    .cb-cmd { padding: 16px; }
    .cb-cmd-greet h2 { font-size: 18px; }
    .cb-cmd-period { text-align: left; }
    .cb-cmd-range input[type="date"] { width: auto; flex: 1 1 120px; }

    /* Dos botones por fila: cuatro en columna empujan el resto fuera de vista. */
    .cb-acts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .cb-act { min-height: 56px; padding: 0 10px; font-size: 13px; gap: 7px; }
    .cb-act i { font-size: 16px; }

    /* Objetivos tactiles: el sistema se usa desde el telefono en el deposito. */
    .cb-cmd-range :is(input, button),
    .cb-cmd-shortcuts button { height: 40px; }
    .cb-cmd-shortcuts { margin-left: 0; flex: 1 1 100%; }
    .cb-cmd-shortcuts button { flex: 1; }

    .cb-attn-row { grid-template-columns: 34px minmax(0, 1fr); row-gap: 8px; }
    .cb-attn-go { grid-column: 2; justify-self: start; }

    .cb-figs { grid-template-columns: repeat(2, 1fr); }
    .cb-chart { height: 180px; }

    /* En un telefono no caben cuatro columnas. Se va el minimo: "Faltan" ya
       dice lo unico que hay que hacer, y el nombre recupera el ancho. */
    .cb-tbl .cb-col-min { display: none; }
    .cb-tbl tbody th { flex-wrap: wrap; row-gap: 4px; }
    .cb-tbl-name { flex: 1 1 auto; }
    .cb-flag { flex: 0 0 auto; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
    .cb-mark img,
    .cb-rank-bar i { animation: none; }

    .cb-attn-go,
    .cb-go,
    .cb-act,
    .cb-act i,
    .cb-cmd :is(input, button) { transition: none; }
}

/* =========================================================
   Buscadores (cliente y catalogo de productos)
   =========================================================
   Los dos comparten `.client-option`, asi que esto los arregla
   de una vez.

   Que estaba mal: cada resultado era una TARJETA con borde y
   radio, apilada con separacion dentro de otra tarjeta con
   borde y radio. Tarjetas dentro de tarjetas, cinco resultados
   ocupando media pantalla, y encima una caja punteada de
   "Sin cliente seleccionado" que repetia el placeholder y
   empujaba el panel hacia abajo.

   Que se hace: los resultados pasan a ser renglones con
   separador — como una lista de verdad —, el estado pasa a ser
   una linea callada en vez de una pildora, y el recuadro del
   seleccionado solo aparece cuando de verdad hay algo
   seleccionado.
   ========================================================= */

/* ---- El panel ---- */

.client-search-panel,
.pos-client .client-search-panel,
.line-catalog-results,
.pos-search-results {
    z-index: var(--z-dropdown);
}

.client-search-panel,
.pos-client .client-search-panel {
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: var(--surface-strong);
    box-shadow: 0 10px 28px rgba(0, 19, 36, 0.13);
    overflow: hidden;
}

/* ---- El estado: una linea, no una pildora ---- */

.client-search-status,
.line-catalog-status,
.pos-search-status {
    display: block;
    min-height: 0;
    margin: 0;
    padding: 8px 12px;
    border-radius: 0;
    background: var(--surface-sunk);
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.35;
}

/* ---- Los resultados: renglones con separador ---- */

.client-search-results,
.pos-client .client-search-results,
.line-catalog-results,
.pos-search-results {
    display: block;
    gap: 0;
    max-height: 300px;
    overflow-y: auto;
}

.client-option {
    display: grid;
    /* El nombre manda y el identificador cede: con `auto` en la segunda columna,
       un SKU largo dejaba el nombre del producto en "DEMO-FRA...". */
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    align-items: baseline;
    gap: 1px 12px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: var(--surface-strong);
    box-shadow: none;
    text-align: left;
    transition: background .12s cubic-bezier(.2, .7, .3, 1);
}

.client-option:last-child { border-bottom: 0; }

.client-option:hover,
.client-option.is-highlighted {
    transform: none;
    border-color: var(--line);
    background: var(--accent-wash);
    box-shadow: none;
}

.client-option strong,
.client-option span,
.client-option small { display: block; margin: 0; }

.client-option strong {
    grid-column: 1;
    grid-row: 1;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* El identificador (cedula o SKU) a la derecha y en mono: se lee en columna
   cuando hay varios resultados parecidos, que es justo cuando hace falta. */
.client-option span {
    grid-column: 2;
    grid-row: 1;
    color: var(--muted);
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 11px;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-option small {
    grid-column: 1 / -1;
    grid-row: 2;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

/* ---- El seleccionado: aparece solo cuando hay algo seleccionado ---- */

/* Con nada elegido esta caja decia "Pendiente / Sin cliente seleccionado /
   Busca y elige un cliente": tres renglones para repetir el placeholder del
   campo que tiene justo encima. */
.client-search-selected:not(.is-selected),
.pos-client-selected:not(.is-selected) {
    display: none;
}

.client-search-selected.is-selected,
.pos-client-selected.is-selected {
    display: flex;
    align-items: center;
    gap: 4px 10px;
    flex-wrap: wrap;
    padding: 8px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--accent-wash);
}

.client-search-selected.is-selected .client-search-selected-top,
.pos-client-selected.is-selected .pos-client-selected-top {
    order: 3;
    margin-left: auto;
}

.client-search-selected.is-selected .client-search-badge,
.pos-client-selected.is-selected .client-search-badge { display: none; }

.client-search-selected.is-selected strong,
.pos-client-selected.is-selected strong {
    order: 1;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.client-search-selected.is-selected small,
.pos-client-selected.is-selected small {
    order: 2;
    color: var(--text-2);
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 11px;
}

.client-search-clear {
    padding: 2px 8px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface-strong);
    color: var(--text-2);
    font-size: 11px;
    line-height: 1.6;
}

.client-search-clear:hover { border-color: var(--brand); color: var(--brand); background: var(--surface-strong); }

/* ---- Campos de busqueda ---- */

.pos-client-input,
.pos-search-input {
    min-height: 40px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface-strong);
    font-size: 13.5px;
}

.pos-client-input:focus,
.pos-search-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.14);
}

.client-option:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
    .client-option { transition: none; }
}

/* =========================================================
   Ajustes generales
   =========================================================
   Tres bloques, un proposito cada uno, y campos en rejilla en
   vez de una columna de inputs a ancho completo: un campo de
   "IVA" que mide 700px pide un numero de dos digitos y se lee
   como un error.
   ========================================================= */

.st {
    --st-ease: cubic-bezier(.2, .7, .3, 1);
    display: grid;
    gap: 20px;
    padding: 20px 26px 40px;
}

.st *, .st *::before, .st *::after { box-sizing: border-box; min-width: 0; }
.st h2, .st h3 { margin: 0; text-wrap: balance; }

.st-sr {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
}

.st-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 24px;
}

.st-head h2 { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; color: var(--text); }
.st-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.st-head-links { display: flex; flex-wrap: wrap; gap: 8px; }

.st-block {
    display: grid;
    gap: 18px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-strong);
}

.st-block-head h3 { font-size: 14px; font-weight: 600; color: var(--text); }
.st-block-head p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); max-width: 72ch; }

/* ---------- Campos ---------- */

.st-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px 18px;
}

.st-field { display: grid; gap: 5px; align-content: start; margin: 0; }
.st-field-wide { grid-column: 1 / -1; }

.st-field > span { font-size: 12px; font-weight: 500; color: var(--text-2); }

.st-field :is(input, select) {
    width: 100%;
    height: 40px;
    padding: 0 11px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 13.5px;
    transition: border-color .16s var(--st-ease), box-shadow .16s var(--st-ease);
}

.st-field input[type="number"] {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
}

.st-field :is(input, select):hover { border-color: var(--muted-soft); }

.st-field :is(input, select):focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.14);
}

.st-field > small { font-size: 11.5px; color: var(--muted); line-height: 1.4; }

/* ---------- Identidad ---------- */

.st-identity {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.st-logo { display: grid; justify-items: center; gap: 8px; text-align: center; }

.st-logo-frame {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 1;
    padding: 14px;
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    background: var(--surface-sunk);
    overflow: hidden;
}

.st-logo-frame img { max-width: 100%; max-height: 100%; object-fit: contain; }

.st-logo-frame em {
    color: var(--brand);
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 34px;
    font-style: normal;
    font-weight: 600;
    letter-spacing: -0.03em;
}

/* El <input type=file> nativo es feo y no se puede estilar; se esconde y la
   etiqueta hace de boton, que es el patron estandar y accesible. */
.st-logo-pick { cursor: pointer; }
.st-logo-pick:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }

.st-logo-drop {
    padding: 3px 9px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--danger);
    font-size: 11.5px;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.st-logo-drop:hover { background: var(--danger-soft); text-decoration: none; }
.st-logo > small { font-size: 11px; color: var(--muted); line-height: 1.4; }

/* ---------- Estado de la tasa ---------- */

.st-rate {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px 20px;
    margin: 0;
    padding: 14px 16px;
    border-radius: 8px;
    background: var(--surface-sunk);
}

.st-rate > div { display: grid; gap: 3px; }
.st-rate dt { font-size: 11.5px; color: var(--muted); }
.st-rate dd { margin: 0; font-size: 13px; color: var(--text); }

.st-rate dd strong {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.st-rate dd span { color: var(--muted); font-size: 11.5px; }
.st-rate .is-warn dd { color: var(--warn); }

/* ---------- Interruptor de modulo ---------- */

.st-switch {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-sunk);
    cursor: pointer;
}

.st-switch input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--brand); flex: 0 0 auto; }
.st-switch span { display: grid; gap: 2px; }
.st-switch strong { font-size: 13px; font-weight: 600; color: var(--text); }
.st-switch small { font-size: 11.5px; color: var(--muted); line-height: 1.45; max-width: 80ch; }
.st-switch:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Pie de bloque ---------- */

.st-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.st-actions > small { font-size: 11.5px; color: var(--muted); }

/* ---------- Historial ---------- */

.st-history { gap: 0; padding: 0; }

.st-history > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
}

.st-history > summary::-webkit-details-marker { display: none; }
.st-history > summary > span:first-child { display: grid; gap: 2px; }
.st-history summary strong { font-size: 14px; font-weight: 600; color: var(--text); }
.st-history summary small { font-size: 12px; color: var(--muted); }

.st-history-toggle {
    width: 9px; height: 9px;
    border-right: 1.5px solid var(--muted);
    border-bottom: 1.5px solid var(--muted);
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform .18s var(--st-ease);
}

.st-history[open] .st-history-toggle { transform: rotate(-135deg) translate(-2px, -2px); }
.st-history-body { padding: 0 20px 20px; border-top: 1px solid var(--line); }
.st-search { display: block; margin: 16px 0; max-width: 340px; }

.st-search input {
    width: 100%;
    height: 38px;
    padding: 0 11px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface-strong);
    font-size: 13px;
}

.st-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.14); }

/* ---------- Logo en el menu lateral ---------- */

.brand-block .brand-logo {
    display: block;
    max-width: 100%;
    max-height: 46px;
    width: auto;
    object-fit: contain;
    /* Va en fila con el nombre: sin margen propio queda centrado con el. */
    flex: none;
    margin: 0;
}

body.sidebar-collapsed .brand-block .brand-logo { max-height: 30px; }

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
    .st { padding: 14px 16px 32px; gap: 16px; }
    .st-block { padding: 16px; }
    .st-identity { grid-template-columns: minmax(0, 1fr); }
    .st-logo { justify-items: start; text-align: left; }
    .st-logo-frame { width: 132px; }
    .st-actions { justify-content: stretch; }
    .st-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .st-field :is(input, select),
    .st-history-toggle { transition: none; }
}

/* Con logo cargado, el cuadrito de iniciales sobra: eran dos marcas pegadas
   compitiendo por el mismo sitio. Sin logo se queda, que para eso existe. */
.brand-block.has-logo[data-app-initials]::before { content: none; display: none; }

body.sidebar-collapsed .brand-block.has-logo[data-app-initials]::before { display: none; }

/* Compactado solo cabe una cosa: el logo, centrado y del tamano del avatar. */
body.sidebar-collapsed .brand-block.has-logo .brand-logo {
    max-height: 40px;
    max-width: 40px;
    margin: 0 auto;
}

/* =========================================================
   Mesa POS: pulido de comodidad
   Facturas, notas de entrega, cotizaciones, compras,
   produccion y gastos comparten esta mesa; lo de aqui vale
   para las seis.

   Que estaba mal:
   - El renglon era una rejilla de 4 columnas calculada por el
     ancho de la VENTANA, pero vive en la columna central, que
     en una laptop mide ~430px: el nombre del producto quedaba
     en una palabra por linea y el subtotal se salia de su caja.
   - Los resultados del buscador iban en linea y empujaban los
     renglones 300px hacia abajo cada vez que aparecian.
   - En la tarjeta de totales, "Subtotal 11.398,40" no cabia en
     media tarjeta y se recortaba.
   - Rotulos en mayusculas con tracking y una caja con contorno
     gris por cada cosa: mucho ruido para una mesa de trabajo.

   Que se hace: el renglon se mide contra su propia columna
   (container query), los resultados flotan, los totales se leen
   como un libro de cuentas y los rotulos van en minuscula.
   ========================================================= */

/* ---- Superficies y rotulos ---- */

.pos-workspace {
    --pos-radius: 10px;
    --pos-border: 1px solid transparent;
}

/* La tarjeta se separa del fondo por contraste y sombra, no por contorno. */
.pos-card {
    box-shadow: 0 1px 3px rgba(0, 19, 36, 0.08);
}

.pos-card-head strong,
.pos-items-head strong,
.pos-notes summary,
.pos-custom-product-head strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.pos-meta-grid label,
.pos-checkout-grid label,
.pos-custom-grid label {
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.pos-checkout-grid label small,
.pos-meta-hint {
    color: var(--muted);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.35;
}

.pos-workspace .btn-sm {
    border-radius: 8px;
}

.pos-submit {
    border-radius: 10px;
}

/* ---- Buscador: los resultados flotan, no empujan ---- */

.pos-search.line-catalog-shell {
    border-color: transparent;
    border-radius: 10px;
}

/* Una sola linea: si el aviso ("Agregado: ...") se partia en dos, la lista de
   renglones bajaba y subia con cada producto. */
.pos-search .pos-search-status {
    overflow: hidden;
    padding: 0 2px;
    background: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* La tarjeta tiene alto minimo; sin esto la rejilla repartia el sobrante
   entre sus filas y el buscador se separaba de la lista hasta que hubiera
   tres o cuatro renglones. */
.pos-items {
    align-content: start;
}

/* Fecha y numero caben en media columna sin que el icono del calendario
   quede cortado. */
.pos-meta-grid input,
.pos-meta-grid select {
    min-width: 0;
    padding-inline: 8px;
    font-size: 13px;
}

.pos-search .pos-search-results:empty {
    display: none;
}

@media (min-width: 761px) {
    .pos-search .pos-search-results {
        position: absolute;
        top: calc(100% + 4px);
        right: 0;
        left: 0;
        grid-column: auto;
        max-height: min(320px, 46vh);
        border: 1px solid var(--line-strong);
        border-radius: 9px;
        background: var(--surface-strong);
        box-shadow: 0 10px 28px rgba(0, 19, 36, 0.13);
        overscroll-behavior: contain;
    }
}

/* ---- La lista de renglones ---- */

.pos-items-list {
    container: pos-lines / inline-size;
    counter-reset: pos-line;
    gap: 0;
    padding-right: 4px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

/* Renglon = fila de lista con separador, no una caja dentro de la tarjeta.
   Encabezado y detalle se funden en una sola rejilla (display: contents):

     1. Nombre del producto ........................ Quitar
        SKU | Stock | Precio
     Cantidad   Precio unitario · USD             Subtotal
     [  1  ]    [   13   ]                       11.398,40          */
.pos-items-list .line-item-card {
    counter-increment: pos-line;
    display: grid;
    grid-template-columns: minmax(0, 0.65fr) minmax(0, 1.15fr) minmax(0, 0.8fr) auto;
    gap: 8px 10px;
    align-items: start;
    min-width: 0;
    padding: 10px 2px 12px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
}

.pos-items-list .line-item-card:last-child {
    border-bottom: 0;
}

/* Producto que todavia no existe en el catalogo (compras): fondo tenido. */
.pos-items-list .line-item-card-custom {
    padding-inline: 10px;
    border-radius: 8px;
}

.pos-items-list .line-item-head,
.pos-items-list .line-item-card:not(.is-collapsed) .line-item-grid {
    display: contents;
}

.pos-items-list .line-item-card .line-item-grid[hidden] {
    display: none;
}

/* "Renglon N" lo dice el numero delante del nombre. El rotulo solo vuelve si
   el renglon queda colapsado, que es cuando el nombre no esta a la vista. */
.pos-items-list .line-item-head > :first-child {
    display: none;
}

.pos-items-list .line-item-card.is-collapsed .line-item-head > :first-child {
    display: block;
    grid-column: 1 / 4;
    grid-row: 1;
    min-width: 0;
}

/* Con el renglon en dos lineas ya no hay nada que plegar, y el contador
   rapido del encabezado duplicaria el campo de cantidad. */
.pos-items-list [data-line-toggle],
.pos-items-list .line-item-quick-qty {
    display: none;
}

.pos-items-list .line-item-actions {
    display: flex;
    grid-column: 4;
    grid-row: 1;
    gap: 4px;
    width: auto;
    justify-self: end;
}

.pos-items-list .line-item-actions .btn {
    width: auto;
    min-height: 28px;
    padding: 3px 9px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    box-shadow: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.15s cubic-bezier(0.2, 0.7, 0.3, 1), color 0.15s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.pos-items-list .line-item-actions .btn:hover {
    transform: none;
    background: var(--danger-soft);
    box-shadow: none;
    color: var(--danger);
}

.pos-items-list .line-item-actions .btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.pos-items-list .line-item-product {
    grid-column: 1 / 4;
    grid-row: 1;
    min-width: 0;
    padding: 0;
    border-radius: 0;
}

.pos-items-list .line-item-caption {
    display: none;
}

.pos-items-list .line-item-identity {
    display: block;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
}

.pos-items-list .line-item-identity strong {
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.pos-items-list .line-item-identity strong::before {
    content: counter(pos-line) ". ";
    color: var(--muted);
    font-weight: 500;
}

.pos-items-list .line-item-identity small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.pos-items-list .line-item-grid > label {
    grid-row: 2;
    gap: 3px;
    min-width: 0;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
}

.pos-items-list .line-item-grid > label > span {
    display: block;
    overflow: hidden;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1.25;
    text-overflow: ellipsis;
    text-transform: none;
    white-space: nowrap;
    word-break: normal;
}

/* La moneda en la que se escribe el precio, pegada a su rotulo. Reemplaza la
   linea "Se convierte segun la moneda." que colgaba debajo de cada campo. */
.pos-items-list [data-line-price-label][data-currency]::after {
    content: " \00b7  " attr(data-currency);
    color: var(--muted);
}

.pos-items-list [data-line-price-help] {
    display: none;
}

.pos-items-list .line-item-grid input {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    padding: 6px 8px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface-strong);
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-size: 14px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.pos-items-list .line-item-grid input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.16);
}

/* Subtotal: una cifra alineada a la derecha, sin caja. El stock ya esta en la
   linea del producto, asi que su celda no se repite. */
.pos-items-list .line-item-metrics {
    display: block;
    grid-column: 3 / -1;
    grid-row: 2;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    text-align: right;
}

.pos-items-list .line-item-metrics > div:first-child {
    display: none;
}

.pos-items-list .line-item-metrics span {
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.25;
}

.pos-items-list .line-item-metrics strong {
    margin-top: 3px;
    color: var(--text);
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 36px;
    overflow-wrap: anywhere;
}

/* Columna ancha (monitor grande): todo el renglon en una sola linea. */
@container pos-lines (min-width: 660px) {
    .pos-items-list .line-item-card {
        grid-template-columns: minmax(0, 1fr) minmax(76px, max-content) 128px minmax(112px, auto) auto;
        column-gap: 14px;
        align-items: end;
    }

    .pos-items-list .line-item-product {
        grid-column: 1;
        align-self: center;
    }

    .pos-items-list .line-item-grid > label {
        grid-row: 1;
    }

    .pos-items-list .line-item-metrics {
        grid-column: 4;
        grid-row: 1;
    }

    .pos-items-list .line-item-actions {
        grid-column: 5;
        align-self: center;
    }
}

/* Columna de telefono: cantidad y precio a medias, subtotal en su linea. */
@container pos-lines (max-width: 359px) {
    .pos-items-list .line-item-card {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    }

    .pos-items-list .line-item-product {
        grid-column: 1 / 3;
    }

    .pos-items-list .line-item-actions {
        grid-column: 3;
    }

    .pos-items-list .line-item-grid > label:nth-of-type(2) {
        grid-column: 2 / -1;
    }

    .pos-items-list .line-item-metrics {
        grid-column: 1 / -1;
        grid-row: 3;
    }

    .pos-items-list .line-item-metrics > div:last-child {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 12px;
    }

    .pos-items-list .line-item-metrics strong {
        margin-top: 0;
        line-height: 1.3;
    }
}

@media (pointer: coarse) {
    .pos-items-list .line-item-grid input {
        min-height: 44px;
        font-size: 16px;
    }

    .pos-items-list .line-item-actions .btn {
        min-height: 44px;
        padding-inline: 12px;
    }

    .pos-items-list .line-item-metrics strong {
        line-height: 44px;
    }
}

/* Renglon recien agregado (o al que se le sumo cantidad): un destello de
   fondo dice cual fue, en vez de mover la pantalla para ensenarlo. */
.pos-items-list .line-item-card.is-line-merged {
    animation: pos-line-arrive 0.9s cubic-bezier(0.2, 0.7, 0.3, 1);
}

@keyframes pos-line-arrive {
    0% {
        background-color: var(--accent-wash);
    }
    100% {
        background-color: transparent;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pos-items-list .line-item-card.is-line-merged {
        animation: none;
        background-color: var(--accent-wash);
        box-shadow: none;
    }

    .pos-items-list .line-item-actions .btn {
        transition: none;
    }
}

/* ---- Totales: se leen como un libro de cuentas ---- */

.pos-total-card {
    container: pos-total / inline-size;
}

.pos-total-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 4px 10px;
    padding: 14px 16px 12px;
}

.pos-total-hero span {
    align-self: baseline;
    color: var(--on-dark-soft);
    font-size: 12px;
    letter-spacing: 0;
    text-transform: none;
}

/* La moneda sube junto al rotulo y la cifra se queda con todo el ancho: en
   bolivares un total de siete cifras no cabia al lado de "VES". */
.pos-total-hero em {
    grid-column: 2;
    grid-row: 1;
    align-self: baseline;
    padding: 0;
    color: var(--on-dark-soft);
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-size: 12px;
    font-weight: 600;
}

.pos-total-hero strong {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-size: 26px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    line-height: 1.15;
    overflow-wrap: anywhere;
    white-space: normal;
}

.pos-total-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 6px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: none;
}

.pos-total-grid > div {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 16px;
    background: none;
}

.pos-total-grid > div:last-child:not(.pos-total-grid-wide) {
    padding-bottom: 10px;
}

.pos-total-grid span {
    flex: none;
    color: var(--on-dark-soft);
    font-size: 12px;
    letter-spacing: 0;
    text-transform: none;
}

.pos-total-grid strong {
    min-width: 0;
    max-width: none;
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
    text-align: right;
}

.pos-total-grid > .pos-total-grid-wide {
    margin-top: 6px;
    padding-block: 8px;
}

.pos-total-grid-wide span {
    color: #ffffff;
}

/* Varias franjas seguidas (gastos): pegadas, con un filete entre ellas. */
.pos-total-grid > .pos-total-grid-wide + .pos-total-grid-wide {
    margin-top: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
}

@container pos-total (min-width: 340px) {
    .pos-total-hero strong {
        font-size: 34px;
    }
}

@container pos-total (min-width: 420px) {
    .pos-total-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ---- Cobro ---- */

@media (min-width: 1101px) {
    .pos-col-right > .pos-card:not(.pos-total-card) {
        overscroll-behavior: contain;
        scrollbar-width: thin;
    }
}

/* Laptop de 768px de alto: la columna de cobro se aprieta para caber entera
   en vez de sacar una barra de desplazamiento en medio de la tarjeta. */
@media (min-width: 1101px) and (max-height: 800px) {
    .pos-workspace {
        --pos-gap: 8px;
    }

    .pos-total-hero {
        padding: 10px 14px 8px;
    }

    .pos-total-grid {
        padding-top: 4px;
    }

    .pos-total-grid > div {
        padding: 2px 14px;
    }

    .pos-total-grid > .pos-total-grid-wide {
        margin-top: 4px;
        padding-block: 6px;
    }

    .pos-checkout {
        gap: 6px;
        padding: 8px 12px 10px;
    }

    .pos-checkout-grid {
        gap: 5px 8px;
    }

    .pos-checkout-grid label small {
        display: none;
    }

    .pos-checkout-grid input,
    .pos-checkout-grid select {
        min-height: 32px;
        padding-block: 4px;
    }

    .pos-quick-methods .btn,
    .pos-quick-amounts .btn {
        min-height: 28px;
        padding-block: 3px;
    }

    .pos-submit {
        min-height: 44px;
    }
}

/* Y con la ventana del navegador de esa misma laptop (~620px utiles) todavia
   sobraban 100px: el rotulo pasa al lado de su campo y los metodos rapidos
   suben junto al titulo. */
@media (min-width: 1101px) and (max-height: 700px) {
    /* Una sola rejilla de cuatro pistas (rotulo, campo, rotulo, campo) que
       cada <label> hereda con subgrid. Antes cada rotulo media su propia
       columna: los campos de Monto y Moneda arrancaban en otra vertical que
       los de Metodo, Cuenta y Referencia y el bloque se veia torcido. */
    .pos-checkout {
        --pos-label-w: 72px;
    }

    .pos-checkout-grid {
        grid-template-columns: var(--pos-label-w) minmax(0, 1fr) auto minmax(0, 1fr);
        gap: 6px 8px;
    }

    .pos-checkout-grid label {
        grid-column: span 2;
        grid-template-columns: subgrid;
        align-items: center;
        gap: 8px;
        line-height: 1.15;
    }

    .pos-checkout-grid label.pos-checkout-full {
        grid-column: 1 / -1;
    }

    .pos-checkout-grid label.pos-checkout-full > :is(input, select) {
        grid-column: 2 / -1;
    }

    /* "Cuenta de tesoreria" partia en dos renglones la columna de rotulos. */
    .pos-label-more {
        display: none;
    }

    /* Las dos filas de botones miden justo la columna de campos y se apoyan a
       la derecha: con "Cobro" los metodos quedan al lado del titulo; con un
       titulo largo bajan al renglon siguiente y siguen en la misma vertical. */
    .pos-checkout > :is(.pos-quick-methods, .pos-quick-amounts) {
        flex: 0 0 calc(100% - var(--pos-label-w) - 8px) !important;
        margin-left: auto;
    }

    /* Titulo y metodos rapidos en la misma linea cuando caben ("Cobro");
       con un titulo largo ("Pago al proveedor") los botones bajan solos. */
    .pos-checkout {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        column-gap: 8px;
    }

    .pos-checkout > * {
        flex: 0 0 100%;
        min-width: 0;
    }

    /* El titulo ocupa justo la columna de rotulos: asi los metodos rapidos
       empiezan en la misma vertical que los campos. Un titulo largo ("Pago al
       proveedor") la desborda y los botones bajan solos al renglon siguiente. */
    .pos-checkout > .pos-card-head {
        flex: 0 0 auto;
        min-width: var(--pos-label-w);
    }

    .pos-checkout > .pos-card-head .pos-hint {
        display: none;
    }

    .pos-checkout > .pos-quick-methods {
        flex: 1 1 190px;
    }
}

/* ---- Telefono ---- */

/* El bloque Documento apilaba sus cinco campos de uno en uno: habia que
   pasar una pantalla entera antes de llegar a los productos. */
@media (max-width: 480px) {
    .pos-meta-grid,
    .pos-topbar-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pos-meta-span {
        grid-column: 1 / -1;
    }
}

/* =========================================================
   Menu lateral discreto

   El menu ocupaba 268px con fondo propio, linea de contorno,
   rotulos en mayusculas y una franja de color en el elemento
   activo: competia con la pantalla de trabajo en vez de
   acompanarla.

   Ahora mide 208px, comparte el fondo de la aplicacion (lo
   que resalta son las tarjetas blancas de la operacion) y el
   elemento activo se marca con fondo tenido, sin franja.

   Los colores del menu salen de variables --side-*: la
   identidad del sistema las cambia para el tono oscuro.
   ========================================================= */

.shell-sidebar {
    --side-text: var(--text-2);
    --side-strong: var(--text);
    --side-muted: var(--muted);
    --side-hover: rgba(0, 19, 36, 0.06);
    --side-active-bg: var(--brand-soft);
    --side-active-text: var(--brand-strong);
    --side-line: var(--line);
    padding: 10px 8px;
    border-right: 0;
    color: var(--side-text);
}

@media (min-width: 1025px) {
    .shell-sidebar {
        width: 208px;
        background: transparent;
    }

    body.sidebar-collapsed .shell-sidebar {
        width: 56px;
        padding: 10px 6px;
    }
}

.sidebar-shell {
    gap: 8px;
}

/* ---- Marca ---- */

.brand-block {
    gap: 8px;
    padding: 4px 6px 8px;
    border-bottom: 0;
    overflow: visible;
}

.brand-block .brand-logo {
    max-width: 34px;
    max-height: 30px;
}

.brand-block h1 {
    display: -webkit-box;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: var(--side-strong);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.alert-center--brand .alert-center-trigger {
    width: 28px;
    height: 28px;
    border-color: transparent;
    background: transparent;
    color: var(--side-muted);
    font-size: 15px;
}

.alert-center--brand .alert-center-trigger:hover {
    transform: none;
    border-color: transparent;
    background: var(--side-hover);
    color: var(--side-strong);
}

/* ---- Navegacion ---- */

.nav-stack {
    gap: 14px;
    margin-right: 0;
    padding-right: 0;
    scrollbar-gutter: auto;
}

.nav-group {
    gap: 2px;
}

.nav-group-title {
    padding: 0 10px 2px;
}

.nav-group-title span {
    color: var(--side-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.nav-modern {
    gap: 1px;
}

.nav-modern a {
    gap: 9px;
    padding: 6px 10px;
    border-radius: 7px;
    color: var(--side-text);
    transition: background 0.15s cubic-bezier(0.2, 0.7, 0.3, 1), color 0.15s cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* Sin franja lateral: lo activo se dice con fondo y color. */
.nav-modern a::before {
    content: none;
}

.nav-ic {
    width: 16px;
    color: var(--side-muted);
    font-size: 15px;
}

.nav-label {
    font-size: 13px;
}

.nav-modern a:hover {
    background: var(--side-hover);
    color: var(--side-strong);
}

.nav-modern a:hover .nav-ic {
    color: var(--side-text);
}

.nav-modern a.is-active {
    background: var(--side-active-bg);
    color: var(--side-active-text);
}

.nav-modern a.is-active .nav-ic {
    color: var(--side-active-text);
}

.nav-modern a:focus-visible,
.sidebar-profile:focus-visible,
.sidebar-icon-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* ---- Pie: perfil, salir y compactar ---- */

.sidebar-footnote {
    gap: 2px;
    padding: 8px 0 0;
    border-top: 1px solid var(--side-line);
}

.sidebar-profile {
    gap: 8px;
    padding: 5px 8px;
    border: 0;
    border-radius: 7px;
    color: var(--side-strong);
}

.sidebar-profile:hover {
    background: var(--side-hover);
}

.sidebar-profile[aria-current="page"] {
    background: var(--side-active-bg);
}

.sidebar-profile-avatar {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 600;
}

.sidebar-profile-info strong {
    color: var(--side-strong);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
}

.sidebar-profile-info small {
    color: var(--side-muted);
    font-size: 11px;
}

.sidebar-profile-edit {
    color: var(--side-muted);
}

.sidebar-footer-actions {
    justify-content: space-between;
    gap: 4px;
    margin-top: 0;
}

.sidebar-footer-actions > * {
    flex: 0 0 auto;
}

.sidebar-icon-btn,
.sidebar-profile-logout .sidebar-icon-btn {
    width: auto;
    min-height: 30px;
    padding: 4px 8px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    box-shadow: none;
    color: var(--side-muted);
    font-size: 12px;
}

.sidebar-icon-btn i {
    font-size: 15px;
}

.sidebar-icon-btn:hover {
    transform: none;
    border: 0;
    background: var(--side-hover);
    box-shadow: none;
    color: var(--side-strong);
}

.sidebar-logout-btn:hover {
    border: 0;
    background: var(--danger-soft);
    color: var(--danger);
}

/* Compactar: solo el icono. El nombre de la accion va en el title. */
.sidebar-desktop-toggle.sidebar-icon-btn {
    width: 30px;
    padding: 0;
}

/* ---- Compactado ---- */

@media (min-width: 1025px) {
    body.sidebar-collapsed .brand-block {
        justify-content: center;
        padding: 4px 0 8px;
    }

    body.sidebar-collapsed .nav-stack {
        gap: 8px;
    }

    body.sidebar-collapsed .nav-modern a {
        min-height: 36px;
        padding: 6px;
        border-radius: 8px;
    }

    body.sidebar-collapsed .nav-ic {
        font-size: 16px;
    }

    body.sidebar-collapsed .sidebar-footnote {
        min-height: 0;
        padding: 8px 0 0;
    }

    body.sidebar-collapsed .sidebar-profile {
        padding: 5px;
    }

    body.sidebar-collapsed .sidebar-footer-actions {
        align-items: center;
        gap: 2px;
    }

    body.sidebar-collapsed .sidebar-icon-btn,
    body.sidebar-collapsed .sidebar-profile-logout .sidebar-icon-btn {
        width: 36px;
        min-width: 36px;
        min-height: 32px;
        padding: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nav-modern a,
    .shell-sidebar {
        transition: none;
    }
}

/* ---- Menu lateral oscuro (Ajustes > Apariencia) ---- */

body.sidebar-tone-dark .shell-sidebar {
    --side-text: rgba(255, 255, 255, 0.8);
    --side-strong: #ffffff;
    --side-muted: rgba(255, 255, 255, 0.6);
    --side-hover: rgba(255, 255, 255, 0.08);
    --side-active-bg: rgba(255, 255, 255, 0.14);
    --side-active-text: #ffffff;
    --side-line: rgba(255, 255, 255, 0.14);
    background: var(--ink-deep);
}

body.sidebar-tone-dark .nav-stack {
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

body.sidebar-tone-dark .nav-modern a.is-active .nav-ic {
    color: var(--accent);
}

body.sidebar-tone-dark .alert-center--brand .alert-center-badge {
    box-shadow: 0 0 0 2px var(--ink-deep);
}

/* El escritorio ya no usa la barra superior (solo lleva el boton del menu
   del telefono): era una franja vacia encima de cada pantalla. */
@media (min-width: 1025px) {
    .topbar-modern {
        display: none;
    }
}

/* =========================================================
   Teclas rapidas del panel
   La tecla va escrita en el boton: nadie aprende un atajo que
   no ve.
   ========================================================= */

.cb-act kbd,
.cb-cmd-find kbd {
    padding: 2px 6px;
    border: 0;
    border-radius: 5px;
    background: var(--surface-sunk);
    color: var(--text-2);
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
}

.cb-act kbd {
    margin-left: 2px;
}

.cb-act.is-primary kbd {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.cb-cmd-find input {
    padding-right: 36px;
}

.cb-cmd-find kbd {
    position: absolute;
    top: 50%;
    right: 8px;
    background: var(--surface-strong);
    pointer-events: none;
    transform: translateY(-50%);
}

.cb-cmd-find input:focus + kbd,
.cb-cmd-find input:not(:placeholder-shown) + kbd {
    display: none;
}

/* En telefono no hay teclado de funciones. */
@media (pointer: coarse), (max-width: 720px) {
    .cb-act kbd,
    .cb-cmd-find kbd {
        display: none;
    }
}

/* =========================================================
   Ajustes > Apariencia
   ========================================================= */

.st-look-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
    gap: 20px 28px;
    align-items: start;
}

.st-look-controls {
    display: grid;
    gap: 18px;
}

.st-look-group {
    display: grid;
    gap: 7px;
}

.st-look-group > small {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.4;
}

.st-look-label {
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
}

/* ---- Paletas ---- */

.st-palettes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.st-palette {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 4px 11px 4px 6px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 12.5px;
    font-weight: 500;
    transition: border-color 0.15s cubic-bezier(0.2, 0.7, 0.3, 1), background 0.15s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.st-palette:hover {
    border-color: var(--muted-soft);
}

.st-palette[aria-pressed="true"] {
    border-color: var(--brand);
    background: var(--accent-wash);
    color: var(--brand-strong);
}

.st-palette:focus-visible,
.st-tone input:focus-visible + span,
.st-look-reset:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.st-palette-chips {
    display: inline-flex;
    overflow: hidden;
    border-radius: 5px;
}

.st-palette-chips i {
    display: block;
    width: 12px;
    height: 22px;
}

/* ---- Colores ---- */

.st-colors {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px 18px;
}

.st-color {
    display: grid;
    gap: 5px;
    align-content: start;
    margin: 0;
}

.st-color > span:first-child {
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
}

.st-color > small {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.4;
}

.st-color-input {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 8px 0 4px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface-strong);
    transition: border-color 0.15s cubic-bezier(0.2, 0.7, 0.3, 1), box-shadow 0.15s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.st-color-input:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.14);
}

.st-color-input input[type="color"] {
    flex: none;
    width: 30px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: none;
    box-shadow: none;
    cursor: pointer;
}

.st-color-input input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.st-color-input input[type="color"]::-webkit-color-swatch {
    border: 0;
    border-radius: 5px;
}

.st-color-input input[type="color"]::-moz-color-swatch {
    border: 0;
    border-radius: 5px;
}

.st-color-input input[type="text"] {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    padding: 0 2px;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: var(--text);
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-size: 13px;
    text-transform: lowercase;
}

.st-color-input input[type="text"]:focus {
    outline: none;
    box-shadow: none;
}

.st-color-input input[type="text"].is-invalid {
    color: var(--danger);
}

.st-look-note {
    margin: 0;
    padding: 8px 11px;
    border-radius: 8px;
    background: var(--warn-soft);
    color: var(--warn);
    font-size: 12px;
    line-height: 1.45;
}

.st-look-note[hidden] {
    display: none;
}

/* ---- Tono del menu ---- */

.st-tone {
    display: inline-flex;
    width: fit-content;
    padding: 3px;
    border-radius: 8px;
    background: var(--surface-sunk);
}

.st-tone label {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.st-tone input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.st-tone span {
    display: block;
    padding: 5px 16px;
    border-radius: 6px;
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 500;
    transition: background 0.15s cubic-bezier(0.2, 0.7, 0.3, 1), color 0.15s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.st-tone input:checked + span {
    background: var(--surface-strong);
    box-shadow: 0 1px 2px rgba(0, 19, 36, 0.12);
    color: var(--text);
    font-weight: 600;
}

/* ---- Vista previa ---- */

.st-look-preview {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: 10px;
    background: var(--surface-sunk);
}

.st-look-total {
    display: grid;
    gap: 4px;
    overflow: hidden;
    border-radius: 9px;
    background: var(--ink-deep);
    color: #ffffff;
}

.st-look-total > span {
    display: flex;
    justify-content: space-between;
    padding: 11px 13px 0;
    color: var(--on-dark-soft);
    font-size: 11.5px;
}

.st-look-total em {
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-style: normal;
    font-weight: 600;
}

.st-look-total strong {
    padding: 0 13px 9px;
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.1;
}

.st-look-total small {
    display: flex;
    justify-content: space-between;
    padding: 7px 13px;
    background: var(--brand);
    color: #ffffff;
    font-size: 11.5px;
}

.st-look-total b {
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-weight: 600;
}

.st-look-samples {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.st-look-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 7px;
    background: var(--brand);
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 600;
}

.st-look-btn.is-dark {
    background: var(--ink-deep);
}

.st-look-btn.is-dark i {
    color: var(--accent);
}

.st-look-chip {
    padding: 5px 10px;
    border-radius: 7px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: 12.5px;
    font-weight: 600;
}

.st-look-link {
    color: var(--brand);
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.st-look-reset {
    padding: 6px 2px;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.st-look-reset:hover {
    color: var(--danger);
}

@media (max-width: 820px) {
    .st-look-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .st-palette,
    .st-color-input,
    .st-tone span {
        transition: none;
    }
}

/* =========================================================
   Catalogo en ventana (mesa POS) y altas en ventana

   "Ver todos", al lado del titulo de los items, abre la tabla
   completa de productos: un clic en la fila lo agrega y la
   ventana sigue abierta. Es para cuando no se sabe que escribir
   en el buscador.

   Nuevo producto y Nuevo servicio dejaron de abrirse como un
   panel dentro de la pagina (empujaban el catalogo hacia abajo)
   y son ventanas, igual que editar.
   ========================================================= */

.pos-items-head {
    flex-wrap: wrap;
    row-gap: 4px;
}

.pos-catalog-open {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-right: auto;
    padding: 3px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--brand);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    transition: background 0.15s cubic-bezier(0.2, 0.7, 0.3, 1), color 0.15s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.pos-catalog-open i {
    font-size: 13px;
}

.pos-catalog-open:hover {
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.pos-catalog-open:focus-visible,
.cat-pick:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.modal-lead {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.4;
}

.modal-card-form,
.modal-card-catalog {
    padding: 20px 22px 22px;
    border-radius: 14px;
}

.modal-card-form .modal-header h3,
.modal-card-catalog .modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.modal-card-form .modal-close,
.modal-card-catalog .modal-close {
    flex: none;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
}

.modal-card-form .modal-close:hover,
.modal-card-catalog .modal-close:hover {
    background: var(--surface-sunk);
    color: var(--text);
}

/* En telefono la cabecera de los modales se apila; aqui el titulo y la X van
   siempre en la misma linea. */
.modal-card-form .modal-header,
.modal-card-catalog .modal-header {
    flex-direction: row;
    align-items: flex-start;
    margin-bottom: 0;
}

.modal-card-form .modal-header > div,
.modal-card-catalog .modal-header > div {
    flex: 1 1 auto;
    min-width: 0;
}

/* Formulario de alta: campos mas bajos para que quepa sin desplazarse en una
   laptop; con la altura de siempre el boton de guardar quedaba fuera. */
.modal-card-form {
    gap: 14px;
}

.modal-card-form .form {
    gap: 11px 14px;
}

.modal-card-form .form label {
    gap: 4px;
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 500;
}

.modal-card-form .form :is(input, select, textarea) {
    padding: 8px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 400;
}

.modal-card-form .form :is(input, select, textarea):focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.16);
}

.modal-card-form .form textarea {
    height: 58px;
    min-height: 58px;
}

.modal-card-form .form .live-panel strong {
    font-size: 15px;
}

.modal-card-form .form .empty-state {
    padding: 8px 11px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.4;
    text-align: left;
}

.modal-card-form .form .live-panel {
    padding: 8px 11px;
    border-radius: 8px;
}

/* ---- La ventana del catalogo ---- */

.modal-card-catalog {
    width: min(860px, 100%);
    height: min(660px, calc(100vh - 2.5rem));
    gap: 12px;
    overflow: hidden;
}

.cat-filter {
    flex: none;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface-strong);
    font-size: 14px;
}

.cat-filter:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.16);
}

.cat-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.cat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.cat-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 7px 10px;
    background: var(--surface-sunk);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
}

.cat-table thead th:first-child {
    border-radius: 7px 0 0 7px;
}

.cat-table thead th:last-child {
    border-radius: 0 7px 7px 0;
}

.cat-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    color: var(--text-2);
    vertical-align: middle;
}

.cat-table tbody tr {
    cursor: pointer;
    transition: background 0.12s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.cat-table tbody tr:hover,
.cat-table tbody tr:focus-within {
    background: var(--accent-wash);
}

.cat-table .is-num {
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.cat-table td.is-num {
    color: var(--text);
}

/* El rotulo de la columna va en la letra normal; la mono es para cifras. */
.cat-table thead th.is-num {
    font-family: inherit;
}

.cat-table td.is-out {
    color: var(--danger);
}

.cat-pick {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.cat-pick strong {
    display: block;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.cat-pick small {
    display: block;
    color: var(--muted);
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-size: 11.5px;
    line-height: 1.35;
}

.cat-col-state {
    width: 86px;
    text-align: right;
    white-space: nowrap;
}

/* Vacio muestra "Agregar" al pasar por la fila; con el producto ya en el
   documento, la cantidad que lleva. */
.cat-state {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
}

.cat-state:empty::before {
    content: "Agregar";
    color: var(--brand);
    opacity: 0;
    transition: opacity 0.12s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.cat-table tbody tr:hover .cat-state:empty::before,
.cat-table tbody tr:focus-within .cat-state:empty::before {
    opacity: 1;
}

.cat-table tr.is-added .cat-state {
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-weight: 600;
}

.cat-table tr.is-just-added {
    animation: pos-line-arrive 0.7s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.cat-empty {
    margin: 0;
    padding: 36px 12px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.cat-empty[hidden] {
    display: none;
}

.cat-foot {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 12.5px;
}

.cat-foot .btn {
    flex: none;
    min-height: 36px;
    padding: 6px 18px;
    border-radius: 8px;
}

.cat-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

@media (max-width: 620px) {
    .modal-card-catalog {
        height: calc(100dvh - 2rem);
        padding: 16px 14px;
    }

    .cat-col-category {
        display: none;
    }

    .cat-table td,
    .cat-table thead th {
        padding-inline: 7px;
    }

    .cat-col-state {
        width: 58px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cat-table tbody tr,
    .cat-state:empty::before,
    .pos-catalog-open {
        transition: none;
    }

    .cat-table tr.is-just-added {
        animation: none;
    }
}

/* =========================================================
   Auditoria (/audit)

   Una bitacora, no un tablero: dia, hora, nivel y una frase
   que se entiende sola. Los tres niveles se distinguen por el
   color de su etiqueta (fondo tenido, nunca una franja), y lo
   critico ademas tine apenas todo el renglon para que salte al
   recorrer la lista.
   ========================================================= */

.au {
    --au-ease: cubic-bezier(0.2, 0.7, 0.3, 1);
    display: grid;
    gap: 16px;
    max-width: 1100px;
    padding: 20px 26px 40px;
}

.au *,
.au *::before,
.au *::after {
    box-sizing: border-box;
    min-width: 0;
}

.au-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.au-head h2 {
    margin: 0;
    color: var(--text);
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.au-head p {
    margin: 3px 0 0;
    max-width: 68ch;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.45;
}

.au-head .btn {
    gap: 6px;
    border-radius: 8px;
}

/* ---- Niveles ---- */

.au-levels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

.au-level {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 8px 14px;
    border-radius: 10px;
    background: var(--surface-strong);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 19, 36, 0.08);
    transition: background 0.15s var(--au-ease), color 0.15s var(--au-ease);
}

.au-level i {
    font-size: 15px;
}

.au-level strong {
    margin-left: auto;
    color: var(--text);
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.au-level:hover {
    color: var(--text);
}

.au-level:focus-visible,
.au-clear:focus-visible,
.au-meta a:focus-visible,
.au-more summary:focus-visible,
.au-tracking a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.au-level-info i { color: var(--brand); }
.au-level-warning i { color: var(--warn); }
.au-level-critical i { color: var(--danger); }

.au-level.is-current {
    background: var(--ink-deep);
    color: #ffffff;
}

.au-level.is-current strong,
.au-level.is-current i {
    color: #ffffff;
}

/* ---- Filtros ---- */

.au-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(130px, 150px)) repeat(2, minmax(140px, 180px)) minmax(200px, 1fr) auto;
    gap: 10px 12px;
    align-items: end;
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--surface-strong);
    box-shadow: 0 1px 3px rgba(0, 19, 36, 0.08);
}

.au-field {
    display: grid;
    gap: 4px;
    margin: 0;
}

.au-field > span {
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
}

.au-field :is(input, select) {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 13px;
}

.au-field :is(input, select):focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.16);
}

.au-filter-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.au-filter-actions .btn {
    min-height: 36px;
    padding: 6px 16px;
    border-radius: 8px;
}

.au-clear {
    color: var(--muted);
    font-size: 12.5px;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

.au-clear:hover {
    color: var(--text);
}

.au-tracking {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin: 0;
    padding: 9px 14px;
    border-radius: 10px;
    background: var(--accent-wash);
    color: var(--text);
    font-size: 13px;
}

.au-tracking i {
    color: var(--brand);
}

.au-tracking a {
    margin-left: auto;
    color: var(--brand);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ---- La bitacora ---- */

.au-list {
    display: grid;
    margin: 0;
    padding: 4px 18px 6px;
    border-radius: 10px;
    background: var(--surface-strong);
    box-shadow: 0 1px 3px rgba(0, 19, 36, 0.08);
    list-style: none;
}

.au-day {
    padding: 14px 0 6px;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 600;
}

.au-day:not(:first-child) {
    margin-top: 6px;
}

.au-entry {
    display: grid;
    grid-template-columns: 46px 118px minmax(0, 1fr);
    gap: 4px 12px;
    align-items: start;
    padding: 10px 8px;
    border-top: 1px solid var(--line);
    border-radius: 0;
}

.au-entry-critical {
    margin-inline: -8px;
    padding-inline: 16px;
    border-top-color: transparent;
    border-radius: 8px;
    background: rgba(179, 38, 30, 0.05);
}

.au-entry-critical + .au-entry {
    border-top-color: transparent;
}

/* Dos criticos seguidos: se separan para leerse como dos hechos, no uno. */
.au-entry-critical + .au-entry-critical {
    margin-top: 3px;
}

.au-time {
    padding-top: 2px;
    color: var(--muted);
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

.au-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
}

.au-tag i {
    font-size: 12px;
}

.au-tag-info {
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.au-tag-warning {
    background: var(--warn-soft);
    color: var(--warn);
}

.au-tag-critical {
    background: var(--danger-soft);
    color: var(--danger);
}

.au-text {
    margin: 0;
    max-width: 78ch;
    color: var(--text);
    font-size: 13.5px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.au-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 14px;
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.au-meta a {
    color: var(--brand);
    font-weight: 500;
}

.au-meta a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.au-ip {
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-size: 11.5px;
}

/* ---- Detalle ---- */

.au-more {
    margin-top: 6px;
}

.au-more summary {
    width: fit-content;
    color: var(--brand);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
}

.au-more summary::-webkit-details-marker {
    display: none;
}

.au-more summary::after {
    content: " +";
}

.au-more[open] summary::after {
    content: " -";
}

.au-changes {
    width: 100%;
    max-width: 640px;
    margin-top: 8px;
    border-collapse: collapse;
    font-size: 12.5px;
}

.au-changes thead th {
    padding: 5px 10px;
    background: var(--surface-sunk);
    color: var(--text-2);
    font-size: 11.5px;
    font-weight: 500;
    text-align: left;
}

.au-changes thead th:first-child {
    border-radius: 6px 0 0 6px;
}

.au-changes thead th:last-child {
    border-radius: 0 6px 6px 0;
}

.au-changes tbody th,
.au-changes tbody td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    font-weight: 400;
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.au-changes tbody th {
    color: var(--text-2);
    font-weight: 500;
}

.au-changes tbody td:nth-child(2) {
    color: var(--muted);
}

.au-changes tbody td:last-child {
    font-weight: 600;
}

.au-changes em {
    color: var(--muted);
    font-weight: 400;
}

.au-details {
    display: grid;
    gap: 5px;
    max-width: 640px;
    margin: 8px 0 0;
    font-size: 12.5px;
}

.au-details > div {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 10px;
}

.au-details dt {
    color: var(--text-2);
    font-weight: 500;
}

.au-details dd {
    margin: 0;
    color: var(--text);
    overflow-wrap: anywhere;
}

/* ---- Vacio y pie ---- */

.au-empty {
    display: grid;
    gap: 4px;
    justify-items: center;
    padding: 44px 20px;
    border-radius: 10px;
    background: var(--surface-strong);
    box-shadow: 0 1px 3px rgba(0, 19, 36, 0.08);
    text-align: center;
}

.au-empty strong {
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

.au-empty span {
    max-width: 56ch;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.5;
}

.au-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 12.5px;
}

.au-pages {
    display: flex;
    align-items: center;
    gap: 10px;
}

.au-pages .btn {
    border-radius: 8px;
}

@media (max-width: 1100px) {
    .au-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .au-field-search,
    .au-filter-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .au {
        padding: 14px 12px 32px;
    }

    .au-list {
        padding-inline: 12px;
    }

    /* Hora y nivel en una linea; la frase, debajo y a todo el ancho. */
    .au-entry {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .au-body {
        grid-column: 1 / -1;
    }

    .au-details > div {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .au-tracking a {
        margin-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .au-level {
        transition: none;
    }
}

/* =========================================================
   Productos (/inventory)

   La pantalla es la tabla. El estado (activos, bajo minimo,
   inactivos) es resumen y filtro a la vez; cada fila tiene una
   accion visible y el resto en el menu "..."; las categorias
   van al final. Prefijo `prod-` propio: los nombres cortos
   chocan con otras pantallas.
   ========================================================= */

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.prod-page {
    display: grid;
    gap: 18px;
}

.prod-num {
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

/* ---- Cabecera ---- */

.prod-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 24px;
}

.prod-head-title h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}

.prod-head-title p {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--text-2);
}

.prod-head-title p strong {
    font-weight: 600;
    color: var(--text);
}

.prod-head-sub {
    color: var(--muted);
}

.prod-head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.prod-head-actions .btn,
.prod-empty-actions .btn {
    min-height: 40px;
    border-radius: 8px;
}

.prod-new {
    padding-inline: 16px;
    font-weight: 600;
}

/* ---- Panel: estado + filtros + tabla ---- */

.prod-panel {
    border-radius: 10px;
    background: var(--surface-strong);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.prod-toolbar {
    display: grid;
    gap: 12px;
    padding: 14px 16px;
    background: color-mix(in srgb, var(--surface-sunk) 55%, var(--surface-strong));
}

/* Estados como control segmentado: el numero ES el resumen. */
.prod-states {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border-radius: 9px;
    background: var(--surface-sunk);
    justify-self: start;
}

.prod-state {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-2);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.prod-state:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.6);
}

.prod-state.is-active {
    background: var(--surface-strong);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(0, 19, 36, 0.08), 0 2px 8px rgba(0, 19, 36, 0.05);
}

.prod-state-count {
    min-width: 22px;
    padding: 2px 6px;
    border-radius: 5px;
    background: rgba(0, 19, 36, 0.06);
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    font-size: 12px;
    text-align: center;
}

.prod-state-warn .prod-state-count {
    background: var(--warn-soft);
    color: var(--warn);
    font-weight: 600;
}

.prod-state:focus-visible,
.prod-sort:focus-visible,
.prod-edit:focus-visible,
.prod-more-btn:focus-visible,
.prod-cat-pick:focus-visible,
.prod-icon-btn:focus-visible,
.prod-menu [role="menuitem"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.prod-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(160px, 220px) minmax(150px, 190px) auto;
    align-items: center;
    gap: 8px;
}

.prod-search {
    position: relative;
    display: block;
}

.prod-search i {
    position: absolute;
    top: 50%;
    left: 12px;
    color: var(--muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.prod-search input,
.prod-select select {
    width: 100%;
    height: 40px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--surface-strong);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    box-shadow: inset 0 0 0 1px rgba(0, 19, 36, 0.06);
}

.prod-search input {
    padding: 0 12px 0 36px;
}

.prod-select select {
    padding: 0 10px;
}

.prod-search input::placeholder {
    color: var(--muted);
}

.prod-search input:focus,
.prod-select select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.prod-count {
    margin: 0;
    padding-left: 4px;
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
}

.prod-count strong {
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    color: var(--text);
}

/* ---- Tabla ---- */

.prod-table-wrap {
    overflow-x: auto;
}

.prod-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.prod-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 10px 14px;
    background: var(--surface-strong);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    box-shadow: inset 0 -1px 0 var(--line);
}

.prod-table td {
    padding: 12px 14px;
    vertical-align: middle;
    border-top: 1px solid var(--line);
}

.prod-table tbody tr:first-child td {
    border-top: 0;
}

.prod-table tbody tr {
    transition: background-color 0.12s ease;
}

.prod-table tbody tr:hover {
    background: color-mix(in srgb, var(--accent-wash) 55%, transparent);
}

.prod-table tbody tr.is-inactive td:not(.prod-col-actions) {
    opacity: 0.6;
}

.prod-col-num {
    text-align: right;
    white-space: nowrap;
}

.prod-table th.prod-col-num {
    text-align: right;
}

.prod-col-actions {
    width: 1%;
    white-space: nowrap;
}

.prod-sort {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.prod-sort::after {
    content: "\2195";
    font-size: 11px;
    opacity: 0.35;
}

.prod-sort:hover {
    color: var(--text);
}

.prod-sort.is-sorted {
    color: var(--brand);
}

.prod-sort.is-sorted::after {
    content: "\2191";
    opacity: 1;
}

.prod-sort.is-sorted.is-desc::after {
    content: "\2193";
}

.prod-cell-name strong {
    display: block;
    font-weight: 600;
    color: var(--text);
}

.prod-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 3px;
    font-size: 12px;
    color: var(--muted);
}

.prod-sku {
    font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    color: var(--text-2);
}

.prod-type {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.prod-type-raw_material {
    background: var(--warn-soft);
    color: var(--warn);
}

.prod-type-finished_good {
    background: var(--success-soft);
    color: var(--success);
}

.prod-stock {
    display: block;
    color: var(--text);
}

.prod-stock .prod-num {
    font-weight: 600;
}

.prod-stock.is-low {
    color: var(--danger);
}

.prod-stock-bar {
    display: block;
    width: 72px;
    height: 4px;
    margin: 5px 0 4px auto;
    border-radius: 2px;
    background: var(--surface-sunk);
    overflow: hidden;
}

.prod-stock-bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--success);
}

.prod-stock-bar.is-low i {
    background: var(--danger);
}

.prod-stock-min {
    display: block;
    font-size: 11px;
    color: var(--muted);
}

.prod-stock.is-low ~ .prod-stock-min {
    color: var(--danger);
    font-weight: 500;
}

.prod-col-num small {
    font-size: 11px;
    color: var(--muted);
}

.prod-margin {
    color: var(--success);
    font-weight: 500;
}

.prod-margin.is-thin {
    color: var(--warn);
}

.prod-margin.is-negative {
    color: var(--danger);
}

.prod-muted {
    color: var(--muted);
    font-size: 13px;
}

.prod-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    white-space: nowrap;
}

.prod-status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.prod-status-on {
    color: var(--success);
}

.prod-status-on::before {
    background: var(--success);
}

.prod-status-off {
    color: var(--muted);
}

.prod-status-off::before {
    background: var(--muted-soft);
}

/* ---- Acciones de fila ---- */

.prod-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.prod-edit,
.prod-more-btn,
.prod-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-2);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.prod-edit {
    padding: 0 12px;
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.prod-edit:hover {
    background: rgba(var(--brand-rgb), 0.18);
}

.prod-more-btn,
.prod-icon-btn {
    width: 34px;
    padding: 0;
}

.prod-more-btn:hover,
.prod-icon-btn:hover,
.prod-more[open] .prod-more-btn {
    background: var(--surface-sunk);
    color: var(--text);
}

.prod-more {
    position: relative;
}

.prod-more > summary {
    list-style: none;
}

.prod-more > summary::-webkit-details-marker {
    display: none;
}

/* Capa fija: la tabla desplaza en horizontal y recortaria un menu
   absoluto. La posicion la pone el script de la pantalla al abrir
   (placeMenu en inventory/workspace.php). */
.prod-menu {
    position: fixed;
    z-index: var(--z-dropdown);
    display: grid;
    min-width: 210px;
    padding: 6px;
    border-radius: 10px;
    background: var(--surface-strong);
    box-shadow: 0 2px 6px rgba(0, 19, 36, 0.08), 0 16px 40px rgba(0, 19, 36, 0.16);
    animation: prodMenuIn 0.14s cubic-bezier(.2, .7, .3, 1);
}

@keyframes prodMenuIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

.prod-menu form {
    margin: 0;
}

.prod-menu [role="menuitem"] {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.prod-menu [role="menuitem"] i {
    width: 16px;
    color: var(--muted);
}

.prod-menu [role="menuitem"]:hover {
    background: var(--surface-sunk);
}

.prod-menu [role="menuitem"].is-danger,
.prod-menu [role="menuitem"].is-danger i {
    color: var(--danger);
}

.prod-menu [role="menuitem"].is-danger:hover {
    background: var(--danger-soft);
}

.prod-menu-note {
    display: flex;
    gap: 8px;
    max-width: 220px;
    margin: 4px 0 0;
    padding: 8px 10px;
    border-radius: 6px;
    background: var(--surface-sunk);
    color: var(--text-2);
    font-size: 12px;
    line-height: 1.4;
}

/* ---- Vacio ---- */

.prod-empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--text-2);
}

.prod-empty strong {
    display: block;
    font-size: 16px;
    color: var(--text);
}

.prod-empty p {
    margin: 6px 0 0;
    font-size: 14px;
}

.prod-empty-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}

.prod-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--brand);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

/* ---- Categorias (al final) ---- */

.prod-cats {
    padding: 16px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--surface-sunk) 45%, var(--surface-strong));
}

.prod-cats-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.prod-cats-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.prod-cats-head p {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.prod-cat-create {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.prod-cat-create input {
    height: 36px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: var(--surface-strong);
    font: inherit;
    font-size: 13px;
    box-shadow: inset 0 0 0 1px rgba(0, 19, 36, 0.08);
}

.prod-cat-create input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.prod-cat-create .btn {
    min-height: 36px;
    border-radius: 6px;
}

.prod-cat-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.prod-cat {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 4px 4px 0;
    border-radius: 8px;
    background: var(--surface-strong);
}

.prod-cat-pick {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.prod-cat-pick:hover {
    background: var(--accent-wash);
}

.prod-cat-pick strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.prod-cat-pick span {
    display: block;
    overflow: hidden;
    font-size: 12px;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prod-cat-tools {
    display: flex;
    gap: 2px;
}

.prod-cat-tools form {
    margin: 0;
}

.prod-icon-danger:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.prod-cats-empty {
    margin: 0;
    font-size: 14px;
    color: var(--text-2);
}

/* ---- Formulario ---- */

.prod-optional {
    font-weight: 400;
    color: var(--muted);
}

.prod-form-note {
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--accent-wash);
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.45;
}

/* ---- Pantallas medianas y telefono ---- */

@media (max-width: 1100px) {
    .prod-filters {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .prod-search {
        grid-column: 1 / -1;
    }

    .prod-count {
        grid-column: 1 / -1;
    }

    .prod-col-type {
        display: none;
    }
}

/* Telefono: cada producto es una tarjeta. Nombre arriba, cifras en una
   rejilla de tres y las acciones a todo el ancho abajo. */
@media (max-width: 760px) {
    .prod-head-actions {
        width: 100%;
    }

    .prod-head-actions .prod-new {
        flex: 1 1 100%;
        order: -1;
    }

    .prod-head-actions .btn-outline {
        flex: 1 1 0;
    }

    .prod-states {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-self: stretch;
    }

    .prod-state {
        justify-content: space-between;
    }

    .prod-search input,
    .prod-select select {
        font-size: 16px;
    }

    /* A 390px "Todas las categorias" no cabe en media columna. */
    .prod-filters {
        grid-template-columns: minmax(0, 1fr);
    }

    .prod-table thead {
        display: none;
    }

    .prod-table,
    .prod-table tbody {
        display: block;
    }

    .prod-table tbody tr {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px 12px;
        padding: 14px 16px;
        border-top: 1px solid var(--line);
    }

    .prod-table tbody tr[hidden] {
        display: none;
    }

    .prod-table tbody tr:first-child {
        border-top: 0;
    }

    .prod-table td {
        display: block;
        padding: 0;
        border: 0;
        text-align: left;
    }

    .prod-table td.prod-col-num {
        text-align: left;
    }

    .prod-table td[data-label]:not(.prod-cell-name):not(.prod-col-actions)::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 2px;
        font-size: 11px;
        color: var(--muted);
    }

    .prod-cell-name {
        grid-column: 1 / -1;
    }

    .prod-stock-bar {
        margin-left: 0;
    }

    .prod-col-actions {
        grid-column: 1 / -1;
        width: auto;
    }

    .prod-actions {
        justify-content: stretch;
    }

    .prod-edit {
        flex: 1 1 auto;
        min-height: 40px;
    }

    .prod-more-btn {
        width: 40px;
        min-height: 40px;
    }

    .prod-cat-create,
    .prod-cat-create label {
        width: 100%;
    }

    .prod-cat-create input {
        width: 100%;
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .prod-menu {
        animation: none;
    }

    .prod-state,
    .prod-table tbody tr,
    .prod-edit,
    .prod-more-btn,
    .prod-icon-btn {
        transition: none;
    }
}

/* Lista de errores del importador de productos (antes style="" en el JS, SEC-04). */
.import-error-list {
    max-height: 160px;
    margin: 0;
    padding-left: 1.1rem;
    overflow: auto;
    font-size: 0.85rem;
    text-align: left;
}
