/* =========================================================
   FARMA+ · Estilos globales
   ========================================================= */

:root {
    --fp-primary: #0d9488;
    --fp-primary-dark: #0f766e;
    --fp-primary-darker: #115e59;
    --fp-primary-soft: #e6f6f4;
    --fp-bg: #f4f6f9;
    --fp-surface: #ffffff;
    --fp-border: #e5e8ef;
    --fp-text: #1f2937;
    --fp-muted: #6b7280;
    --fp-sidebar-width: 260px;
    --fp-topbar-height: 64px;
    --fp-radius: 12px;

    /* Integración con Bootstrap */
    --bs-primary: #0d9488;
    --bs-primary-rgb: 13, 148, 136;
    --bs-link-color: #0f766e;
    --bs-link-color-rgb: 15, 118, 110;
    --bs-link-hover-color: #115e59;
    --bs-link-hover-color-rgb: 17, 94, 89;
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-color: #1f2937;
    --bs-body-bg: #f4f6f9;
}

html, body { height: 100%; }
body { background: var(--fp-bg); color: var(--fp-text); }
h1:focus { outline: none; }

.btn-primary {
    --bs-btn-bg: var(--fp-primary);
    --bs-btn-border-color: var(--fp-primary);
    --bs-btn-hover-bg: var(--fp-primary-dark);
    --bs-btn-hover-border-color: var(--fp-primary-dark);
    --bs-btn-active-bg: var(--fp-primary-darker);
    --bs-btn-active-border-color: var(--fp-primary-darker);
    --bs-btn-disabled-bg: var(--fp-primary);
    --bs-btn-disabled-border-color: var(--fp-primary);
    --bs-btn-focus-shadow-rgb: 13, 148, 136;
}

.btn-outline-primary {
    --bs-btn-color: var(--fp-primary);
    --bs-btn-border-color: var(--fp-primary);
    --bs-btn-hover-bg: var(--fp-primary);
    --bs-btn-hover-border-color: var(--fp-primary);
    --bs-btn-active-bg: var(--fp-primary-dark);
    --bs-btn-active-border-color: var(--fp-primary-dark);
    --bs-btn-focus-shadow-rgb: 13, 148, 136;
}

.text-primary { color: var(--fp-primary) !important; }

.form-control:focus, .form-select:focus {
    border-color: #5eead4;
    box-shadow: 0 0 0 .2rem rgba(13, 148, 136, .18);
}

/* ---------- Estructura ---------- */

.app-shell { min-height: 100vh; }

.app-sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: var(--fp-sidebar-width);
    background: var(--fp-surface);
    border-right: 1px solid var(--fp-border);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .2s ease;
}

.sidebar-brand {
    height: var(--fp-topbar-height);
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--fp-border);
}

.brand-mark {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--fp-primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
}

.brand-text { font-weight: 800; font-size: 1.25rem; letter-spacing: .02em; }
.brand-plus { color: var(--fp-primary); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 1rem .75rem; }

.nav-section {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--fp-muted);
    padding: 1rem .75rem .4rem;
}
.nav-section:first-child { padding-top: 0; }

.nav-item-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem .75rem;
    margin-bottom: 2px;
    border-radius: 8px;
    color: #374151;
    text-decoration: none;
    font-size: .925rem;
    font-weight: 500;
}
.nav-item-link i { font-size: 1.1rem; color: var(--fp-muted); }
.nav-item-link:hover { background: #f3f4f6; color: var(--fp-text); }
.nav-item-link.active { background: var(--fp-primary-soft); color: var(--fp-primary-dark); font-weight: 600; }
.nav-item-link.active i { color: var(--fp-primary); }

.sidebar-footer {
    padding: .75rem 1.25rem;
    border-top: 1px solid var(--fp-border);
    color: var(--fp-muted);
}

.app-main {
    margin-left: var(--fp-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--fp-topbar-height);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--fp-border);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
}

.topbar-date { color: var(--fp-muted); font-size: .875rem; text-transform: capitalize; }

.btn-icon {
    width: 40px; height: 40px;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid var(--fp-border);
    background: #fff;
    font-size: 1.25rem;
    color: var(--fp-text);
}

.user-chip { display: flex; align-items: center; gap: .6rem; }

.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--fp-primary-soft);
    color: var(--fp-primary-dark);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .85rem;
}

.app-content { flex: 1; padding: 1.5rem; }

.sidebar-backdrop { display: none; }

/* ---------- Componentes ---------- */

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.page-title { font-size: 1.5rem; font-weight: 700; margin: 0; }
.page-subtitle { color: var(--fp-muted); margin: .25rem 0 0; }

.card-soft {
    background: var(--fp-surface);
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
    padding: 1.1rem 1.25rem;
    background: var(--fp-surface);
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.stat-icon {
    flex: 0 0 48px;
    width: 48px; height: 48px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
}
.stat-label { color: var(--fp-muted); font-size: .825rem; font-weight: 500; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-hint { color: var(--fp-muted); font-size: .75rem; }

.stat-primary .stat-icon { background: var(--fp-primary-soft); color: var(--fp-primary-dark); }
.stat-success .stat-icon { background: #dcfce7; color: #15803d; }
.stat-warning .stat-icon { background: #fef3c7; color: #b45309; }
.stat-danger  .stat-icon { background: #fee2e2; color: #b91c1c; }
.stat-info    .stat-icon { background: #e0f2fe; color: #0369a1; }

.empty-state { text-align: center; padding: 4rem 1rem; max-width: 520px; margin: 0 auto; }
.empty-icon { font-size: 3rem; color: var(--fp-muted); margin-bottom: .5rem; }

/* ---------- Responsive ---------- */

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-main { margin-left: 0; }
    .app-topbar { padding: 0 1rem; }
    .app-content { padding: 1rem; }

    .sidebar-open .app-sidebar {
        transform: translateX(0);
        box-shadow: 0 10px 40px rgba(0, 0, 0, .15);
    }
    .sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(17, 24, 39, .4);
        z-index: 1030;
    }
}

/* ---------- Blazor (validación y errores) ---------- */

.validation-message { color: #b91c1c; font-size: .8rem; margin-top: .3rem; }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: .6rem 1.25rem .7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}
.blazor-error-boundary::after { content: "Ocurrió un error."; }


/* =========================================================
   Fase 2 · Formularios, tablas, modales y notificaciones
   ========================================================= */

.btn { font-weight: 600; border-radius: 8px; padding: .5rem 1rem; }

.btn-white {
    --bs-btn-bg: #fff;
    --bs-btn-color: var(--fp-text);
    --bs-btn-border-color: var(--fp-border);
    --bs-btn-hover-bg: var(--fp-hover);
    --bs-btn-hover-color: var(--fp-text);
    --bs-btn-hover-border-color: #d1d5db;
    --bs-btn-active-bg: #e5e7eb;
    --bs-btn-active-color: var(--fp-text);
    --bs-btn-active-border-color: #d1d5db;
    --bs-btn-disabled-bg: #fff;
    --bs-btn-disabled-color: var(--fp-muted);
    --bs-btn-disabled-border-color: var(--fp-border);
}

.btn-danger {
    --bs-btn-bg: #b91c1c;
    --bs-btn-border-color: #b91c1c;
    --bs-btn-hover-bg: #991b1b;
    --bs-btn-hover-border-color: #991b1b;
    --bs-btn-active-bg: #7f1d1d;
    --bs-btn-active-border-color: #7f1d1d;
    --bs-btn-disabled-bg: #b91c1c;
    --bs-btn-disabled-border-color: #b91c1c;
}

.form-label { font-size: .8125rem; font-weight: 600; color: var(--fp-text-secondary, #374151); margin-bottom: .375rem; }
.form-control, .form-select { min-height: 40px; border-radius: 8px; border-color: var(--fp-border); }
.form-text { font-size: .75rem; color: var(--fp-muted); margin-top: .3rem; }

.form-check-input:checked { background-color: var(--fp-primary); border-color: var(--fp-primary); }
.form-check-input:focus { border-color: #5eead4; box-shadow: 0 0 0 .2rem rgba(13, 148, 136, .18); }
.form-switch .form-check-input { width: 2.25em; height: 1.25em; margin-top: .1em; cursor: pointer; }
.form-switch .form-check-label { margin-left: .35rem; cursor: pointer; }

.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--fp-muted); pointer-events: none; }
.input-icon > .form-control { padding-left: 36px; }

/* Indicadores pequeños */
.mini-stat { padding: .875rem 1.125rem; height: 100%; }
.mini-stat-label { font-size: .8125rem; font-weight: 500; color: var(--fp-muted); }
.mini-stat-value { font-size: 1.375rem; font-weight: 700; line-height: 1.25; }
.text-primary-dark { color: var(--fp-primary-dark) !important; }
.text-warning-dark { color: #b45309 !important; }
.text-danger-dark { color: #b91c1c !important; }
.text-info-dark { color: #0369a1 !important; }

/* Tablas */
.fp-table { --bs-table-bg: #fff; --bs-table-border-color: var(--fp-border); }
.fp-table thead th {
    background: var(--fp-bg);
    color: var(--fp-muted);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
    padding: .8rem 1.25rem;
}
.fp-table tbody td { padding: .75rem 1.25rem; font-size: .9rem; }
.fp-table tbody tr:hover > * { --bs-table-bg: #fafbfc; }
.fp-table tbody tr.row-selected > * { --bs-table-bg: var(--fp-primary-soft); }
.fp-table tbody tr.row-inactive td { color: var(--fp-muted); }
.fp-table tbody tr:last-child td { border-bottom: 0; }
.cell-sub { font-size: .8rem; color: var(--fp-muted); max-width: 320px; }
.fp-table-footer {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .75rem 1.25rem; border-top: 1px solid var(--fp-border);
}
.table-empty { text-align: center; padding: 3rem 1rem; color: var(--fp-muted); }
.table-empty i { font-size: 2rem; display: block; margin-bottom: .5rem; }

/* Badges suaves */
.badge-soft {
    display: inline-flex; align-items: center; gap: .25rem;
    padding: .2rem .625rem; border-radius: 999px;
    font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.badge-soft-success { background: #dcfce7; color: #15803d; }
.badge-soft-warning { background: #fef3c7; color: #b45309; }
.badge-soft-danger  { background: #fee2e2; color: #b91c1c; }
.badge-soft-info    { background: #e0f2fe; color: #0369a1; }
.badge-soft-neutral { background: #f3f4f6; color: #6b7280; }

/* Botones de ícono en tablas */
.btn-icon-sm {
    width: 32px; height: 32px;
    display: inline-grid; place-items: center;
    border-radius: 8px; border: 1px solid var(--fp-border);
    background: #fff; color: var(--fp-muted);
    font-size: .95rem; padding: 0;
}
.btn-icon-sm:hover { background: var(--fp-hover); color: var(--fp-text); }
.btn-icon-sm.danger { color: #b91c1c; }
.btn-icon-sm.danger:hover { background: #fee2e2; }
.btn-icon-sm.success { color: #15803d; }
.btn-icon-sm.success:hover { background: #dcfce7; }
.btn-icon-sm:disabled { opacity: .5; }

/* Paginación */
.fp-pager { display: flex; gap: .375rem; }
.fp-page-btn {
    min-width: 32px; height: 32px; padding: 0 .5rem;
    border-radius: 8px; border: 1px solid var(--fp-border); background: #fff;
    font-size: .8125rem; font-weight: 600; color: #374151;
}
.fp-page-btn:hover:not(:disabled) { background: var(--fp-hover); }
.fp-page-btn.active { background: var(--fp-primary); border-color: var(--fp-primary); color: #fff; }
.fp-page-btn:disabled { opacity: .45; }

/* Avisos en línea */
.fp-note { display: flex; gap: .625rem; align-items: flex-start; padding: .75rem .875rem; border-radius: 10px; font-size: .8125rem; }
.fp-note i { font-size: 1rem; line-height: 1.2; }
.fp-note-info { background: #e0f2fe; color: #0369a1; }
.fp-note-warning { background: #fef3c7; color: #92400e; }

/* Modales (sin JS de Bootstrap: los controla Blazor) */
.fp-modal-backdrop {
    position: fixed; inset: 0; z-index: 1055;
    background: rgba(17, 24, 39, .45);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 5vh 1rem; overflow-y: auto;
    animation: fp-fade .12s ease-out;
}
.fp-modal {
    width: 100%; max-width: 680px;
    background: #fff; border-radius: 16px; overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .18);
    animation: fp-pop .15s ease-out;
}
.fp-modal-sm { max-width: 440px; }
.fp-modal-header {
    display: flex; gap: .75rem; align-items: flex-start;
    padding: 1.25rem 1.5rem 1rem; border-bottom: 1px solid var(--fp-border);
}
.fp-modal-title { font-size: 1.125rem; font-weight: 700; margin: 0; }
.fp-modal-subtitle { color: var(--fp-muted); font-size: .8125rem; margin: .125rem 0 0; }
.fp-modal-body { padding: 1.25rem 1.5rem; }
.fp-modal-footer {
    display: flex; justify-content: flex-end; gap: .625rem;
    padding: 1rem 1.5rem; background: var(--fp-bg); border-top: 1px solid var(--fp-border);
}

.fp-confirm { padding: 1.5rem 1.5rem 1.25rem; }
.fp-confirm-icon {
    width: 48px; height: 48px; border-radius: 50%;
    display: grid; place-items: center; font-size: 1.4rem; margin-bottom: 1rem;
}
.fp-confirm-warning { background: #fef3c7; color: #b45309; }
.fp-confirm-danger  { background: #fee2e2; color: #b91c1c; }
.fp-confirm-success { background: #dcfce7; color: #15803d; }
.fp-confirm-text { color: var(--fp-muted); font-size: .9rem; line-height: 1.45; margin: .375rem 0 1rem; }
.fp-confirm-detail { background: var(--fp-bg); border-radius: 8px; padding: .625rem .75rem; font-size: .85rem; margin-bottom: 1rem; }
.fp-confirm-actions { display: flex; gap: .625rem; }
.fp-confirm-actions .btn { flex: 1; }

@keyframes fp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fp-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* Notificaciones */
.toast-stack {
    position: fixed; right: 24px; bottom: 24px; z-index: 1100;
    display: flex; flex-direction: column; gap: .75rem;
    width: min(360px, calc(100vw - 32px));
}
.fp-toast {
    display: flex; gap: .75rem; align-items: flex-start;
    background: #fff; border: 1px solid var(--fp-border); border-left-width: 4px;
    border-radius: 12px; padding: .875rem 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
    animation: fp-pop .18s ease-out;
}
.fp-toast-icon { font-size: 1.15rem; line-height: 1.2; }
.fp-toast-title { font-weight: 600; font-size: .9rem; }
.fp-toast-text { color: var(--fp-muted); font-size: .8125rem; }
.fp-toast-close { border: 0; background: transparent; color: var(--fp-muted); padding: 0; line-height: 1; }
.fp-toast-success { border-left-color: #15803d; } .fp-toast-success .fp-toast-icon { color: #15803d; }
.fp-toast-error   { border-left-color: #b91c1c; } .fp-toast-error   .fp-toast-icon { color: #b91c1c; }
.fp-toast-warning { border-left-color: #b45309; } .fp-toast-warning .fp-toast-icon { color: #b45309; }
.fp-toast-info    { border-left-color: #0369a1; } .fp-toast-info    .fp-toast-icon { color: #0369a1; }

/* Categorías: formulario lateral */
.side-form { width: 100%; }
@media (min-width: 992px) { .side-form { width: 360px; } }


/* =========================================================
   Fase 3 · Inventario por lotes
   ========================================================= */

.fp-modal-md { max-width: 560px; }
.fp-modal-xl { max-width: 760px; }
.fp-modal-body .modal-table { margin: -1.25rem -1.5rem; }
.fp-modal-body .modal-table .fp-table thead th:first-child,
.fp-modal-body .modal-table .fp-table tbody td:first-child { padding-left: 1.5rem; }

.min-w-0 { min-width: 0; }
.fw-medium { font-weight: 500; }

/* Contador en el menú lateral */
.nav-item-link .nav-badge {
    margin-left: auto;
    min-width: 1.4rem; padding: .05rem .45rem;
    border-radius: 999px; background: #b91c1c; color: #fff;
    font-size: .7rem; font-weight: 700; text-align: center; line-height: 1.4;
}

/* Aviso destacado */
.alert-banner { display: flex; gap: .875rem; align-items: center; padding: .75rem 1rem; border-radius: 10px; }
.alert-banner > i { font-size: 1.25rem; }
.alert-banner-danger { background: #fee2e2; color: #b91c1c; }
.alert-banner-warning { background: #fef3c7; color: #92400e; }

/* Indicadores */
.mini-stat-hint { font-size: .75rem; color: var(--fp-muted); }
.mini-stat-btn { width: 100%; text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.mini-stat-btn:hover { border-color: #cbd5e1; }
.mini-stat-btn.active { border-color: var(--fp-primary); box-shadow: 0 0 0 .2rem rgba(13, 148, 136, .15); }

/* Control segmentado */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 10px; background: var(--fp-hover); }
.segmented button {
    display: inline-flex; align-items: center; gap: .4rem;
    border: 0; background: transparent; border-radius: 8px;
    padding: .4rem .75rem; font-size: .8125rem; font-weight: 500; color: var(--fp-muted);
}
.segmented button:hover { color: var(--fp-text); }
.segmented button.active { background: #fff; color: var(--fp-text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.segmented .count { background: var(--fp-border); color: var(--fp-muted); border-radius: 999px; padding: 0 .4rem; font-size: .7rem; font-weight: 700; }
.segmented .count.danger { background: #fee2e2; color: #b91c1c; }

.filter-chip {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .35rem .5rem .35rem .75rem; border-radius: 999px;
    background: var(--fp-primary-soft); color: var(--fp-primary-dark);
    font-size: .8125rem; font-weight: 600;
}
.filter-chip button { border: 0; background: transparent; color: inherit; padding: 0 .15rem; line-height: 1; }

.date-expired { text-decoration: line-through; color: var(--fp-muted); }
.qty-in { color: #15803d; font-weight: 600; }
.qty-out { color: #b91c1c; font-weight: 600; }

/* Resumen dentro de formularios */
.summary-box { display: flex; gap: 1rem; padding: .75rem .875rem; border-radius: 10px; background: var(--fp-bg); }
.summary-box .label { font-size: .75rem; color: var(--fp-muted); }
.summary-box .value { font-size: .95rem; font-weight: 700; }

/* Tarjetas de opción (tipo de ajuste) */
.option-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.option-card {
    display: flex; gap: .625rem; align-items: center; text-align: left;
    padding: .625rem .75rem; border: 1px solid var(--fp-border); border-radius: 10px; background: #fff;
}
.option-card:disabled { opacity: .45; cursor: not-allowed; }
.option-card i { font-size: 1.1rem; color: var(--fp-muted); }
.option-card .title { font-size: .875rem; font-weight: 600; }
.option-card .sub { font-size: .75rem; color: var(--fp-muted); }
.option-card.active-out { border-color: #b91c1c; background: #fee2e2; box-shadow: inset 0 0 0 .5px #b91c1c; }
.option-card.active-out i, .option-card.active-out .title { color: #b91c1c; }
.option-card.active-in { border-color: var(--fp-primary); background: var(--fp-primary-soft); box-shadow: inset 0 0 0 .5px var(--fp-primary); }
.option-card.active-in i, .option-card.active-in .title { color: var(--fp-primary-dark); }

/* Selector de productos */
.product-picker { position: relative; }
.picker-results {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
    max-height: 300px; overflow-y: auto; padding: .25rem;
    background: #fff; border: 1px solid var(--fp-border); border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
}
.picker-item {
    display: flex; gap: .75rem; align-items: center; width: 100%; text-align: left;
    padding: .5rem .625rem; border: 0; border-radius: 8px; background: transparent;
}
.picker-item.active, .picker-item:hover { background: var(--fp-primary-soft); }
.picker-item-title { font-size: .875rem; font-weight: 600; }
.picker-item-sub { font-size: .75rem; color: var(--fp-muted); }
.picker-empty { padding: .75rem; text-align: center; font-size: .875rem; color: var(--fp-muted); }
.picker-selected {
    display: flex; gap: .75rem; align-items: center;
    padding: .625rem .75rem; border: 1px solid var(--fp-primary); border-radius: 10px; background: var(--fp-primary-soft);
}
.picker-icon {
    flex: 0 0 36px; width: 36px; height: 36px; border-radius: 8px;
    display: grid; place-items: center; background: #fff; color: var(--fp-primary); font-size: 1.1rem;
}
.fp-modal:has(.picker-results) { overflow: visible; }


/* =========================================================
   Fase 4 · Punto de venta
   ========================================================= */

.pos-layout {
    display: grid;
    grid-template-columns: minmax(0, 65fr) minmax(340px, 35fr);
    gap: 1.25rem;
    align-items: start;
}
@media (max-width: 991.98px) { .pos-layout { grid-template-columns: minmax(0, 1fr); } }

/* Buscador grande */
.pos-search {
    display: flex; align-items: center; gap: .625rem;
    height: 52px; padding: 0 1rem;
    background: #fff; border: 2px solid var(--fp-primary); border-radius: 12px;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, .15);
}
.pos-search > i { font-size: 1.35rem; color: var(--fp-primary); }
.pos-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 1rem; }
.kbd {
    padding: .15rem .5rem; border: 1px solid var(--fp-border); border-radius: 6px;
    background: var(--fp-hover); color: var(--fp-muted); font-size: .72rem; font-weight: 600; white-space: nowrap;
}

/* Categorías */
.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
    padding: .35rem .875rem; border: 1px solid var(--fp-border); border-radius: 999px;
    background: #fff; color: #374151; font-size: .8125rem; font-weight: 500;
}
.chip:hover { border-color: #cbd5e1; }
.chip.active { background: var(--fp-primary); border-color: var(--fp-primary); color: #fff; font-weight: 600; }

/* Catálogo */
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; }
.pos-card {
    display: flex; flex-direction: column; gap: .25rem; min-height: 148px; padding: .75rem .875rem;
    text-align: left; background: #fff; border: 1px solid var(--fp-border); border-radius: 12px;
    transition: border-color .15s, box-shadow .15s, transform .05s;
}
.pos-card:hover:not(:disabled) { border-color: var(--fp-primary); box-shadow: 0 4px 12px rgba(13, 148, 136, .12); }
.pos-card:active:not(:disabled) { transform: scale(.98); }
.pos-card:disabled { opacity: .55; cursor: not-allowed; }
.pos-card.in-cart { border-color: var(--fp-primary); box-shadow: inset 0 0 0 .5px var(--fp-primary); }
.pos-card-cat { font-size: .66rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--fp-muted); }
.pos-card-name { font-size: .92rem; font-weight: 600; }
.pos-card-gen {
    font-size: .75rem; color: var(--fp-muted);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pos-card-foot { display: flex; align-items: center; gap: .375rem; margin-top: auto; padding-top: .375rem; }
.pos-card-price { margin-right: auto; font-size: 1.05rem; font-weight: 700; color: var(--fp-primary-dark); }
.pos-card-add {
    flex: 0 0 28px; width: 28px; height: 28px; border-radius: 8px;
    display: grid; place-items: center; background: var(--fp-primary); color: #fff;
}
.pos-card:disabled .pos-card-add { background: var(--fp-border); }

/* Carrito */
.pos-cart {
    position: sticky; top: calc(var(--fp-topbar-height) + 1rem);
    display: flex; flex-direction: column;
    max-height: calc(100vh - var(--fp-topbar-height) - 2.5rem);
    background: #fff; border: 1px solid var(--fp-border); border-radius: 14px; overflow: hidden;
    box-shadow: 0 4px 12px rgba(16, 24, 40, .06);
}
.pos-cart-header {
    display: flex; align-items: center; gap: .5rem;
    padding: .875rem 1.25rem; border-bottom: 1px solid var(--fp-border);
}
.count-pill { padding: 0 .5rem; border-radius: 999px; background: var(--fp-primary-soft); color: var(--fp-primary-dark); font-size: .75rem; font-weight: 700; }
.pos-cart-lines { flex: 1 1 auto; min-height: 140px; overflow-y: auto; padding: 0 1.25rem; }
.pos-cart-footer { padding: .875rem 1.25rem 1.25rem; background: var(--fp-bg); border-top: 1px solid var(--fp-border); }

.cart-empty { padding: 2.5rem 1rem; text-align: center; color: var(--fp-muted); font-size: .875rem; }
.cart-empty i { display: block; margin-bottom: .5rem; font-size: 2.25rem; color: #cbd5e1; }
.cart-line { padding: .75rem 0; border-bottom: 1px solid var(--fp-border); }
.cart-line:last-child { border-bottom: 0; }
.cart-line-name { font-size: .9rem; font-weight: 600; }
.cart-line-lot { font-size: .75rem; color: var(--fp-muted); }
.cart-line-lot.warn { color: #b45309; font-weight: 600; }
.cart-line-remove { border: 0; background: transparent; color: #9ca3af; padding: 0; }
.cart-line-remove:hover { color: #b91c1c; }

.stepper { display: inline-flex; align-items: center; background: #fff; border: 1px solid var(--fp-border); border-radius: 8px; }
.stepper button { width: 30px; height: 30px; border: 0; background: transparent; color: var(--fp-muted); }
.stepper button:hover:not(:disabled) { color: var(--fp-text); }
.stepper button:disabled { opacity: .35; }
.stepper input { width: 44px; height: 30px; border: 0; text-align: center; font-weight: 600; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.cart-total-row { display: flex; justify-content: space-between; font-size: .85rem; color: var(--fp-muted); }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; margin: .25rem 0 .75rem; }
.cart-total .amount { font-size: 1.65rem; font-weight: 700; color: var(--fp-primary-dark); }

.pay-options .option-card { justify-content: center; padding: .55rem .75rem; }
.option-card.active-pay { border-color: var(--fp-primary); background: var(--fp-primary-soft); box-shadow: inset 0 0 0 .5px var(--fp-primary); }
.option-card.active-pay i, .option-card.active-pay .title { color: var(--fp-primary-dark); }

.quick-amounts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .375rem; }
.quick-amounts button {
    padding: .3rem 0; border: 1px solid var(--fp-border); border-radius: 8px; background: #fff;
    font-size: .8rem; font-weight: 600; color: #374151;
}
.quick-amounts button.active { border-color: var(--fp-primary); background: var(--fp-primary-soft); color: var(--fp-primary-dark); }
.quick-amounts button:disabled { opacity: .5; }

.change-box { display: flex; justify-content: space-between; align-items: center; padding: .625rem .875rem; border-radius: 10px; font-weight: 600; }
.change-box.ok { background: #dcfce7; color: #15803d; }
.change-box.missing { background: #fee2e2; color: #b91c1c; }
.change-box .amount { font-size: 1.15rem; font-weight: 700; }

.btn-charge { width: 100%; height: 52px; font-size: 1.05rem; }

/* Venta registrada + ticket */
.fp-modal-receipt { max-width: 460px; }
.success-head { padding: 1.5rem 1.5rem .75rem; text-align: center; }
.success-icon {
    width: 56px; height: 56px; margin: 0 auto .5rem; border-radius: 50%;
    display: grid; place-items: center; background: #dcfce7; color: #15803d; font-size: 1.75rem;
}
.receipt-area { padding: .25rem 1.5rem 1.25rem; max-height: 55vh; overflow-y: auto; }

.ticket {
    width: 300px; margin: 0 auto; padding: 1rem 1.125rem;
    background: #fff; border: 1px solid var(--fp-border); border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
    font-size: .75rem; color: #111827; line-height: 1.45;
}
.ticket hr { margin: .5rem 0; border: 0; border-top: 1px dashed #9ca3af; opacity: 1; }
.ticket-center { text-align: center; }
.ticket-title { font-size: .85rem; font-weight: 700; }
.ticket-muted { color: var(--fp-muted); font-size: .7rem; }
.ticket-row { display: flex; justify-content: space-between; gap: .5rem; }
.ticket-total { font-size: .875rem; font-weight: 700; }
.ticket-legal { color: var(--fp-muted); font-size: .66rem; }

/* Impresión: solo el ticket, en papel de 80 mm */
@media print {
    @page { size: 80mm auto; margin: 3mm; }
    body * { visibility: hidden !important; }
    .print-area, .print-area * { visibility: visible !important; }
    .print-area {
        position: fixed !important; left: 0; top: 0;
        width: 74mm !important; margin: 0 !important; padding: 0 !important;
        border: 0 !important; box-shadow: none !important; font-size: 9pt;
    }
}


/* =========================================================
   Fase 5 · Ventas
   ========================================================= */

.date-input { width: 160px; }
.text-strike { text-decoration: line-through; color: var(--fp-muted) !important; }
.link-number { color: var(--fp-primary-dark); }
.link-number:hover { color: var(--fp-primary-darker); }

.info-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .625rem; }
@media (max-width: 575.98px) { .info-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.info-tile { padding: .625rem .75rem; border-radius: 10px; background: var(--fp-bg); }
.info-tile .label { font-size: .75rem; color: var(--fp-muted); }
.info-tile .value { font-size: .95rem; font-weight: 700; }

.bordered-table { border: 1px solid var(--fp-border); border-radius: 10px; overflow: hidden; }
.fp-table-compact thead th { padding: .6rem .875rem; }
.fp-table-compact tbody td { padding: .6rem .875rem; font-size: .85rem; }

.totals-block {
    display: grid; grid-template-columns: auto auto; justify-content: end;
    column-gap: 1.5rem; row-gap: .2rem; text-align: right; font-size: .875rem; align-items: baseline;
}
.totals-block .total-amount { font-size: 1.35rem; font-weight: 700; color: var(--fp-primary-dark); }

.return-list { padding: .75rem .875rem; border-radius: 10px; background: var(--fp-bg); font-size: .85rem; }
.return-title { font-size: .75rem; font-weight: 600; color: var(--fp-muted); margin-bottom: .375rem; }
.return-row { display: flex; align-items: center; gap: .5rem; padding: .15rem 0; }


/* =========================================================
   Responsive · tablet y móvil
   ========================================================= */

/* Bloquea el scroll del fondo cuando hay un panel abierto */
body:has(.sidebar-open), body:has(.fp-modal-backdrop), body:has(.pos-cart.open) { overflow: hidden; }

.topbar-brand { font-size: 1.1rem; font-weight: 800; letter-spacing: .02em; }

/* ---- 992–1279 px (laptop pequeña / tablet horizontal): menú de íconos ---- */
@media (min-width: 992px) and (max-width: 1279.98px) {
    :root { --fp-sidebar-width: 76px; }
    .sidebar-brand { justify-content: center; padding: 0; }
    .brand-text, .nav-section, .sidebar-footer { display: none; }
    .sidebar-nav { padding: .75rem .5rem; }
    .nav-item-link { position: relative; justify-content: center; padding: .65rem 0; }
    .nav-item-link > span:not(.nav-badge) { display: none; }
    .nav-item-link i { font-size: 1.2rem; }
    .nav-item-link .nav-badge {
        position: absolute; top: 3px; right: 6px; margin: 0;
        min-width: 1.1rem; padding: 0 .3rem; font-size: .62rem;
    }
    .app-content { padding: 1.25rem; }
}

/* ---- < 992 px: POS con carrito en hoja inferior ---- */
.pos-cart-backdrop { display: none; }
.pos-cart-bar {
    position: fixed; left: .75rem; right: .75rem; bottom: .75rem; z-index: 1040;
    display: flex; align-items: center; gap: .875rem;
    height: 62px; padding: 0 1rem; border: 0; border-radius: 14px;
    background: var(--fp-primary); color: #fff;
    box-shadow: 0 8px 20px rgba(13, 148, 136, .35);
}
.pos-cart-bar-icon { position: relative; font-size: 1.4rem; line-height: 1; }
.pos-cart-bar-icon .badge-count {
    position: absolute; top: -8px; right: -12px; padding: 0 .35rem; border-radius: 999px;
    background: #fff; color: var(--fp-primary-dark); font-size: .65rem; font-weight: 700;
}

@media (max-width: 991.98px) {
    .pos-catalog { padding-bottom: 88px; }
    .pos-cart {
        position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 1050;
        max-height: 90vh; border-bottom: 0; border-radius: 18px 18px 0 0;
        transform: translateY(105%); transition: transform .22s ease;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, .18);
    }
    .pos-cart.open { transform: none; }
    .pos-cart-backdrop.show { display: block; position: fixed; inset: 0; z-index: 1045; background: rgba(17, 24, 39, .4); }
    .pos-cart-header { position: relative; padding-top: 1.1rem; }
    .pos-cart-header::before {
        content: ""; position: absolute; left: 50%; top: 6px; width: 40px; height: 4px;
        margin-left: -20px; border-radius: 2px; background: #d1d5db;
    }

    .chip-row, .segmented { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
    .chip-row::-webkit-scrollbar, .segmented::-webkit-scrollbar { display: none; }
    .chip, .segmented button { flex: 0 0 auto; white-space: nowrap; }
}

/* ---- < 768 px: tablas como tarjetas apiladas ---- */
@media (max-width: 767.98px) {
    .fp-table-stack thead { display: none; }
    .fp-table-stack, .fp-table-stack tbody, .fp-table-stack tr, .fp-table-stack td { display: block; width: 100%; }
    .fp-table-stack tbody tr { padding: .75rem 1rem; border-bottom: 1px solid var(--fp-border); }
    .fp-table-stack tbody tr:last-child { border-bottom: 0; }
    .fp-table-stack tbody tr > * { --bs-table-bg: transparent; }
    .fp-table-stack tbody tr.row-selected { background: var(--fp-primary-soft); }
    .fp-table-stack tbody td {
        display: flex; align-items: center; justify-content: space-between; gap: 1rem;
        padding: .2rem 0 !important; border: 0 !important; text-align: right !important; font-size: .875rem;
    }
    .fp-table-stack tbody td::before {
        content: attr(data-label); flex-shrink: 0; text-align: left;
        font-size: .7rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fp-muted);
    }
    .fp-table-stack tbody td[data-label=""]::before { content: none; }
    .fp-table-stack tbody td:first-child { display: block; padding-bottom: .4rem !important; text-align: left !important; font-size: .95rem; }
    .fp-table-stack tbody td:last-child { justify-content: flex-end; padding-top: .5rem !important; }
    .fp-table-stack tbody td.table-empty { display: block; text-align: center !important; }
    .fp-table-stack .cell-sub { max-width: none; }
    .fp-table-footer { justify-content: center; text-align: center; }
}

/* ---- < 576 px: móvil ---- */
@media (max-width: 575.98px) {
    .app-content { padding: .875rem; }
    .page-title { font-size: 1.3rem; }
    .page-header { margin-bottom: 1rem; }
    .page-header > .d-flex { width: 100%; }
    .page-header > .d-flex > .btn { flex: 1 1 auto; }

    .mini-stat { padding: .625rem .75rem; }
    .mini-stat-label { font-size: .75rem; }
    .mini-stat-value { font-size: 1.15rem; }

    .date-range { width: 100%; }
    .date-range .date-input { flex: 1 1 0; min-width: 0; width: auto; }

    /* Modales como hoja inferior */
    .fp-modal-backdrop { padding: 0; align-items: flex-end; }
    .fp-modal {
        max-width: 100% !important; max-height: 92vh; overflow-y: auto;
        border-radius: 18px 18px 0 0; animation: fp-sheet .2s ease-out;
    }
    .fp-modal:has(.picker-results) { overflow-y: auto; }
    .fp-modal-header, .fp-modal-body, .fp-confirm { padding-left: 1rem; padding-right: 1rem; }
    .fp-modal-footer { position: sticky; bottom: 0; z-index: 2; flex-wrap: wrap; padding: .75rem 1rem; }
    .fp-modal-footer .btn { flex: 1 1 auto; }
    .fp-modal-body .modal-table { margin: -1.25rem -1rem; }
    .picker-results { position: static; margin-top: .25rem; box-shadow: none; }
    .receipt-area { max-height: none; padding-left: 1rem; padding-right: 1rem; }
    .ticket { width: 100%; max-width: 300px; }

    /* POS */
    .pos-search { height: 48px; }
    .pos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
    .pos-card { min-height: 136px; padding: .625rem .7rem; }
    .pos-card-price { font-size: .95rem; }
    .pos-card-foot { flex-wrap: wrap; row-gap: .25rem; }

    /* Avisos arriba para no tapar la barra del carrito */
    .toast-stack { top: 68px; bottom: auto; left: .75rem; right: .75rem; width: auto; }
}

/* Rango de fechas (Ventas) */
.date-range { display: flex; align-items: center; gap: .5rem; }

@keyframes fp-sheet { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }


/* ---- Red de seguridad contra desbordes horizontales ----
   Ningún elemento debe hacer la página más ancha que la pantalla: en móvil eso
   agranda el área visible y saca de la vista los elementos fijos (barra del carrito). */
.app-main { min-width: 0; overflow-x: clip; }
.app-content, .pos-catalog, .pos-cart { min-width: 0; }


/* =========================================================
   Fase 6 · Proveedores y Compras
   ========================================================= */

.back-link { display: inline-flex; align-items: center; gap: .25rem; margin-bottom: .5rem; font-size: .8125rem; font-weight: 600; color: var(--fp-primary-dark); text-decoration: none; }
.back-link:hover { color: var(--fp-primary-darker); }
.cell-sub-wide { max-width: 240px; }

.purchase-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; align-items: start; }
.purchase-lines-card { min-width: 0; }
.purchase-summary { position: sticky; top: calc(var(--fp-topbar-height) + 1rem); }
.summary-row { display: flex; justify-content: space-between; gap: 1rem; padding: .2rem 0; font-size: .875rem; color: var(--fp-muted); }
.summary-row > span:last-child { color: var(--fp-text); }
.summary-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: .5rem; padding-top: .625rem; border-top: 1px solid var(--fp-border); font-weight: 700; }
.summary-total .amount { font-size: 1.5rem; color: var(--fp-primary-dark); }
.btn-lg-tall { height: 48px; }

.purchase-head, .purchase-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 130px 150px 80px 104px 96px 28px;
    gap: .625rem; align-items: center; padding: .625rem 1rem;
}
.purchase-head {
    padding-top: .5rem; padding-bottom: .5rem; background: var(--fp-bg); border-bottom: 1px solid var(--fp-border);
    font-size: .7rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fp-muted);
}
.purchase-line { position: relative; border-bottom: 1px solid var(--fp-border); }
.purchase-line:last-child { border-bottom: 0; }
.purchase-line.has-error { background: #fef2f2; }
.purchase-line .form-control { min-height: 36px; padding: .3rem .6rem; font-size: .875rem; }
.pl-label { display: none; }
.pl-subtotal { text-align: right; font-weight: 700; white-space: nowrap; }
.pl-remove { border: 0; background: transparent; color: #9ca3af; padding: 0; }
.pl-remove:hover { color: #b91c1c; }
.pl-error { grid-column: 1 / -1; display: flex; gap: .375rem; align-items: flex-start; color: #b91c1c; font-size: .8rem; }

.purchase-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040;
    display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem;
    background: #fff; border-top: 1px solid var(--fp-border); box-shadow: 0 -6px 20px rgba(0, 0, 0, .06);
}

@media (max-width: 1199.98px) {
    .purchase-head, .purchase-line { grid-template-columns: minmax(0, 1fr) 110px 140px 70px 92px 88px 24px; }
}
@media (max-width: 991.98px) {
    .purchase-layout { grid-template-columns: minmax(0, 1fr); }
    .purchase-summary { position: static; }
    .purchase-page { padding-bottom: 88px; }
}
@media (max-width: 767.98px) {
    .purchase-line { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .875rem 1rem; }
    .pl-product { grid-column: 1 / -1; padding-right: 2rem; }
    .pl-remove { position: absolute; top: .875rem; right: 1rem; }
    .pl-label { display: block; margin-bottom: .2rem; font-size: .72rem; font-weight: 600; color: #374151; }
    .pl-subtotal { grid-column: 1 / -1; display: flex; justify-content: space-between; }
    .pl-subtotal::before { content: "Subtotal"; font-weight: 400; color: var(--fp-muted); }
}

/* =========================================================
   Fase 7 · Dashboard y Reportes
   ========================================================= */
.stat-card { height: 100%; }

/* Banner de alertas de vencimiento */
.dash-alert {
    display: flex; align-items: center; gap: .875rem;
    padding: .875rem 1.125rem; border-radius: var(--fp-radius); border: 1px solid;
}
.dash-alert.danger  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.dash-alert.warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.dash-alert-icon { font-size: 1.375rem; flex-shrink: 0; }

/* Tarjetas del dashboard y de reportes */
.dash-card { padding: 1.125rem 1.25rem; display: flex; flex-direction: column; min-width: 0; }
.dash-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .875rem; }
.dash-card-title { font-size: 1rem; font-weight: 600; margin: 0; }
.dash-card-sub { font-size: .8125rem; color: var(--fp-muted); margin-top: .125rem; }
.dash-empty { flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; padding: 2rem 1rem; color: var(--fp-muted); text-align: center; font-size: .875rem; }
.dash-empty i { font-size: 1.75rem; }

.chart-box { position: relative; height: var(--chart-h, 280px); width: 100%; min-width: 0; }

/* Listas (vencimientos, últimas ventas, resumen) */
.dash-list { list-style: none; margin: 0; padding: 0; }
.dash-list li {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .7rem 0; border-top: 1px solid var(--fp-border);
}
.dash-list li:first-child { border-top: 0; padding-top: 0; }
.dash-list-title { font-weight: 600; font-size: .9rem; color: var(--fp-text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.dash-list-title:hover { color: var(--fp-primary-dark); }
.dash-list-sub { font-size: .78rem; color: var(--fp-muted); margin-top: .1rem; }
.dash-list-time { font-weight: 400; color: var(--fp-muted); font-size: .8rem; }

/* Más vendidos con barras horizontales */
.top-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .875rem; }
.top-list-row { display: flex; justify-content: space-between; gap: .75rem; font-size: .875rem; }
.top-list-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.top-list-value { font-weight: 700; color: var(--fp-primary-dark); flex-shrink: 0; }
.top-list-bar { height: 8px; border-radius: 999px; background: var(--fp-primary-soft); margin-top: .35rem; overflow: hidden; }
.top-list-bar span { display: block; height: 100%; border-radius: inherit; background: var(--fp-primary); min-width: 4px; }
.top-list-sub { font-size: .75rem; color: var(--fp-muted); margin-top: .2rem; }

/* Pestañas subrayadas de reportes */
.report-tabs {
    display: flex; gap: .25rem; border-bottom: 1px solid var(--fp-border);
    overflow-x: auto; scrollbar-width: none;
}
.report-tabs::-webkit-scrollbar { display: none; }
.report-tab {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: .45rem;
    padding: .7rem 1rem; border: 0; background: none; white-space: nowrap;
    color: var(--fp-muted); font-weight: 500; font-size: .9rem;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.report-tab:hover { color: var(--fp-text); }
.report-tab.active { color: var(--fp-primary-dark); border-bottom-color: var(--fp-primary); font-weight: 600; }

.report-note {
    display: flex; align-items: center; padding: .7rem 1rem; border-radius: 10px;
    background: var(--fp-primary-soft); color: var(--fp-primary-darker); font-size: .875rem;
}
.report-loading { opacity: .55; pointer-events: none; transition: opacity .15s; }

.rank-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.6rem; height: 1.6rem; padding: 0 .35rem; border-radius: 999px;
    background: var(--fp-primary-soft); color: var(--fp-primary-darker); font-size: .75rem; font-weight: 700;
}
.fp-table tr.row-muted td { color: var(--fp-muted); }
.fp-table tr.row-total td { background: #f8fafc; border-top: 2px solid var(--fp-border); }

@media (max-width: 767.98px) {
    .dash-card { padding: 1rem; }
    .dash-alert { flex-wrap: wrap; }
    .dash-alert .btn { width: 100%; }
    .chart-box { height: calc(var(--chart-h, 280px) * .8); }
    .report-tab { padding: .6rem .75rem; font-size: .85rem; }
    .fp-table-stack tbody tr.row-total { background: #f8fafc; }
    .fp-table-stack tbody tr.row-total td { background: transparent; border-top: 0; }
}

@media (max-width: 575.98px) {
    .stat-card .stat-hint { white-space: normal; }
    .dash-card-head { flex-wrap: wrap; gap: .5rem; }
}

/* =========================================================
   Fase 8 · Usuarios y acceso
   ========================================================= */

/* Menú de usuario en la barra superior */
.user-menu { position: relative; }
button.user-chip {
    border: 0; background: transparent; padding: .3rem .5rem; border-radius: 10px;
    color: inherit; transition: background .15s;
}
button.user-chip:hover, button.user-chip[aria-expanded="true"] { background: var(--fp-hover); }
.user-menu-backdrop { position: fixed; inset: 0; z-index: 1015; }
.user-menu-panel {
    position: absolute; right: 0; top: calc(100% + 8px); width: 250px; z-index: 1031;
    background: #fff; border: 1px solid var(--fp-border); border-radius: 12px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, .12); padding: 6px 0;
}
.user-menu-head { padding: .5rem .875rem .65rem; border-bottom: 1px solid var(--fp-border); margin-bottom: 4px; }
.user-menu-item {
    display: flex; align-items: center; gap: .625rem; width: 100%;
    padding: .55rem .875rem; border: 0; background: none; text-align: left;
    font-size: .9rem; font-weight: 500; color: var(--fp-text);
}
.user-menu-item:hover { background: var(--fp-hover); }
.user-menu-item.danger { color: #b91c1c; }

/* Login */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 620px) minmax(0, 1fr); background: #fff; }
.auth-brand {
    background: linear-gradient(135deg, #0d9488 0%, #115e59 100%); color: #fff;
    padding: 3.5rem 4rem; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
}
.auth-logo { display: flex; align-items: center; gap: .625rem; font-size: 1.6rem; font-weight: 700; }
.auth-logo-mark {
    width: 44px; height: 44px; border-radius: 12px; background: #fff; color: var(--fp-primary-dark);
    display: grid; place-items: center; font-size: 1.4rem;
}
.auth-logo-plus { color: #99f6e4; }
.auth-headline { font-size: 2.35rem; font-weight: 700; line-height: 1.18; margin: 0 0 1rem; }
.auth-lead { font-size: 1.05rem; color: #ccfbf1; line-height: 1.45; margin-bottom: 1.5rem; max-width: 30rem; }
.auth-benefits { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .875rem; }
.auth-benefits li { display: flex; align-items: center; gap: .75rem; font-weight: 500; }
.auth-benefits i {
    width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, .16);
    display: grid; place-items: center; flex-shrink: 0;
}
.auth-footer { font-size: .8125rem; color: #99f6e4; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; }

.login-form { width: 100%; max-width: 400px; }
.login-title { font-size: 1.75rem; font-weight: 700; margin: 0 0 .375rem; }
.login-subtitle { color: var(--fp-muted); margin-bottom: 1.5rem; }
.login-alert {
    display: flex; gap: .625rem; align-items: flex-start; padding: .7rem .875rem; border-radius: 10px;
    background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; font-size: .875rem; font-weight: 500; margin-bottom: 1.25rem;
}
.login-alert.info { background: var(--fp-primary-soft); border-color: #99d5cf; color: var(--fp-primary-darker); }
.input-icon-lg > i { left: 14px; font-size: 1.05rem; }
.input-icon-lg > .form-control { padding-left: 42px; }
.password-input { padding-right: 46px !important; }
.password-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    border: 0; background: none; width: 36px; height: 36px; border-radius: 8px;
    color: var(--fp-muted); display: grid; place-items: center;
}
.password-toggle:hover { background: var(--fp-hover); color: var(--fp-text); }
.login-help { font-size: .8125rem; color: var(--fp-muted); margin: 1.25rem 0 0; }
.login-demo {
    margin-top: 1rem; display: flex; gap: .5rem; align-items: center; padding: .6rem .8rem; border-radius: 10px;
    border: 1px dashed #99d5cf; background: var(--fp-primary-soft); color: var(--fp-primary-darker); font-size: .8125rem;
}

/* Usuarios */
.user-cell { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.user-cell .user-avatar { flex-shrink: 0; }

.role-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.role-option {
    display: flex; align-items: flex-start; gap: .625rem; padding: .75rem .875rem; margin: 0;
    border: 1px solid var(--fp-border); border-radius: 10px; background: #fff; cursor: pointer;
    transition: border-color .15s, background .15s;
}
.role-option:hover { border-color: #cbd5e1; }
.role-option.selected { border-color: var(--fp-primary); background: var(--fp-primary-soft); box-shadow: inset 0 0 0 1px var(--fp-primary); }
.role-option.disabled { cursor: not-allowed; opacity: .65; }
.role-option:focus-within { outline: 2px solid rgba(13, 148, 136, .35); outline-offset: 2px; }
.role-option-icon { font-size: 1.1rem; color: var(--fp-muted); margin-top: 1px; }
.role-option.selected .role-option-icon { color: var(--fp-primary); }
.role-option-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.role-option-title { font-weight: 600; font-size: .9rem; }
.role-option-desc { font-size: .75rem; color: var(--fp-muted); }
.role-option-check { color: var(--fp-primary); visibility: hidden; }
.role-option.selected .role-option-check { visibility: visible; }

.role-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.role-legend-item { display: flex; gap: .75rem; align-items: flex-start; }
.role-legend-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.role-legend-icon.admin { background: #e0f2fe; color: #0369a1; }
.role-legend-icon.cashier { background: var(--fp-primary-soft); color: var(--fp-primary); }

@media (max-width: 991.98px) {
    .auth-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
    .auth-brand { padding: 2.25rem 1.5rem 1.75rem; gap: 1rem; }
    .auth-headline { font-size: 1.4rem; margin: 0; }
    .auth-lead, .auth-benefits, .auth-footer { display: none; }
    .auth-logo { font-size: 1.3rem; }
    .auth-logo-mark { width: 36px; height: 36px; font-size: 1.15rem; }
    .auth-main { align-items: flex-start; padding: 1.75rem 1.5rem 2.5rem; }
    .login-title { font-size: 1.4rem; }
}

@media (max-width: 767.98px) {
    .role-legend { grid-template-columns: minmax(0, 1fr); }
    .fp-table-stack .user-cell { width: 100%; }
}

@media (max-width: 575.98px) {
    .role-options { grid-template-columns: minmax(0, 1fr); }
    .user-menu-panel { right: -8px; width: min(260px, calc(100vw - 24px)); }
}
.user-menu-panel[hidden] { display: none; }

/* =========================================================
   Fase 9A · Cliente y comprobante en el POS
   ========================================================= */
.pos-customer {
    padding: .875rem 1.25rem; border-top: 1px solid var(--fp-border); background: #fff;
    display: flex; flex-direction: column; gap: .6rem;
}
.pos-customer-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.pos-customer-title { font-weight: 600; font-size: .875rem; }
.segmented-sm button { padding: .25rem .875rem; font-size: .8125rem; }
.pos-customer-row { display: flex; gap: .5rem; }
.pos-customer-input { flex: 1 1 auto; min-width: 0; }
.pos-customer-input > .form-control { padding-right: 36px; font-weight: 500; letter-spacing: .02em; }
.pos-customer-clear {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 30px; height: 30px; border: 0; background: none; border-radius: 6px;
    color: var(--fp-muted); display: grid; place-items: center;
}
.pos-customer-clear:hover { background: var(--fp-hover); color: var(--fp-text); }
.pos-customer-search { display: inline-flex; align-items: center; gap: .375rem; white-space: nowrap; font-weight: 600; }
.pos-customer-card {
    display: flex; gap: .625rem; align-items: flex-start; padding: .625rem .75rem;
    border: 1px solid var(--fp-border); border-radius: 10px; background: #f8fafc;
}
.pos-customer-avatar {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
    background: var(--fp-primary-soft); color: var(--fp-primary-dark); font-weight: 700; font-size: .78rem;
}
.pos-customer-name { font-weight: 600; font-size: .875rem; line-height: 1.3; }
.pos-customer-sub { font-size: .75rem; color: var(--fp-muted); line-height: 1.35; }
.pos-customer-alert {
    display: flex; gap: .5rem; align-items: flex-start; padding: .55rem .7rem; border-radius: 9px;
    font-size: .78rem; font-weight: 500; line-height: 1.4; border: 1px solid;
}
.pos-customer-alert i { font-size: .95rem; line-height: 1.2; }
.pos-customer-alert.warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.pos-customer-alert.danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.pos-customer-hint { font-size: .75rem; color: var(--fp-muted); }

.sale-customer {
    display: flex; gap: .75rem; align-items: center; padding: .75rem .875rem;
    border: 1px solid var(--fp-border); border-radius: 10px; background: #f8fafc;
}
.sale-customer-icon {
    width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
    background: var(--fp-primary-soft); color: var(--fp-primary-dark);
}

@media (max-width: 991.98px) {
    .pos-customer { padding: .75rem 1rem; }
}
/* Con el bloque de cliente el carrito es más alto: si la pantalla es baja, todo el carrito
   se desplaza en vez de esconder el botón Cobrar. Las líneas siguen con su propio scroll. */
.pos-cart { overflow-y: auto; overscroll-behavior: contain; }
.pos-cart-lines { min-height: 110px; }
.pos-customer, .pos-cart-footer, .pos-cart-header { flex-shrink: 0; }

/* =========================================================
   Fase 9B · Comprobante electrónico (Lucode)
   ========================================================= */
.ticket-hash { word-break: break-all; font-size: .7rem; }
.ticket-qr { display: flex; justify-content: center; margin: .5rem 0; }
.ticket-qr svg { width: 110px; height: 110px; }
.ticket-sandbox {
    margin-top: .5rem; padding: .25rem; text-align: center; font-weight: 700; font-size: .68rem;
    background: #fef3c7; color: #92400e; border-radius: 4px;
}
@media print {
    .ticket-sandbox { background: none; border: 1px dashed #000; color: #000; }
}

.sunat-pill {
    display: inline-flex; align-items: center; gap: .375rem; margin-top: .6rem;
    padding: .3rem .75rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
    max-width: 100%; text-align: left;
}

.sunat-banner {
    display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-radius: 12px;
    background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
}
.sunat-banner > i { font-size: 1.25rem; }
.sunat-banner-btn { background: #fff; border: 1px solid #fcd34d; color: #92400e; font-weight: 600; white-space: nowrap; }
.sunat-banner-btn:hover { background: #fef3c7; color: #78350f; }

.edoc-list { display: flex; flex-direction: column; gap: .5rem; }
.edoc {
    display: flex; align-items: center; gap: .75rem; padding: .7rem .875rem; border-radius: 10px; border: 1px solid;
}
.edoc.ok { background: #f0fdf4; border-color: #bbf7d0; }
.edoc.info { background: #f0f9ff; border-color: #bae6fd; }
.edoc.warning { background: #fffbeb; border-color: #fde68a; }
.edoc.danger { background: #fef2f2; border-color: #fecaca; }
.edoc-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: rgba(255, 255, 255, .7); font-size: 1.1rem; }
.edoc.ok .edoc-icon { color: #15803d; }
.edoc.info .edoc-icon { color: #0369a1; }
.edoc.warning .edoc-icon { color: #b45309; }
.edoc.danger .edoc-icon { color: #b91c1c; }
.edoc-title { font-weight: 600; font-size: .875rem; }
.edoc-sub { font-size: .75rem; color: var(--fp-muted); overflow-wrap: anywhere; }
.edoc-actions { display: flex; flex-wrap: wrap; gap: .375rem; justify-content: flex-end; }
.edoc-link {
    display: inline-flex; align-items: center; gap: .25rem; padding: .25rem .6rem; border-radius: 8px;
    background: #fff; border: 1px solid var(--fp-border); font-size: .75rem; font-weight: 600;
    color: var(--fp-text); text-decoration: none;
}
.edoc-link:hover { border-color: #cbd5e1; color: var(--fp-primary-dark); }

@media (max-width: 575.98px) {
    .edoc { flex-wrap: wrap; }
    .edoc-actions { width: 100%; justify-content: flex-start; padding-left: calc(36px + .75rem); }
    .sunat-banner { flex-wrap: wrap; }
    .sunat-banner-btn { width: 100%; }
}


/* =========================================================
   Fase 9C · Catálogo DIGEMID
   ========================================================= */

.text-success-dark { color: #15803d !important; }
.fp-note-danger { background: #fee2e2; color: #991b1b; }

/* Página Catálogo DIGEMID */
.digemid-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.digemid-stat {
    display: flex; flex-direction: column; gap: .125rem;
    padding: .75rem .875rem; border: 1px solid var(--fp-border); border-radius: 10px; background: #fafbfc;
}
.digemid-stat-label { font-size: .75rem; color: var(--fp-muted); font-weight: 500; }
.digemid-stat-value { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }

.digemid-drop {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem;
    min-height: 140px; padding: 1.25rem; text-align: center;
    border: 1.5px dashed #b8c2d0; border-radius: var(--fp-radius); background: #fafbfc;
    transition: border-color .15s, background-color .15s;
}
.digemid-drop:hover, .digemid-drop:focus-within { border-color: var(--fp-primary); background: var(--fp-primary-soft); }
/* El input cubre toda la zona: así funciona arrastrar y soltar, y también el clic. */
.digemid-drop input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.digemid-drop-icon { font-size: 1.75rem; color: var(--fp-primary); margin-bottom: .25rem; }
.digemid-drop.busy { border-style: solid; border-color: var(--fp-primary); background: var(--fp-primary-soft); align-items: stretch; }
.digemid-drop-busy { display: flex; gap: .75rem; align-items: flex-start; text-align: left; width: 100%; }
.digemid-progress { height: 8px; border-radius: 999px; background: var(--fp-border); }
.digemid-progress .progress-bar { background: var(--fp-primary); border-radius: 999px; }

.digemid-table td { font-size: .875rem; }
.digemid-table .cell-sub.text-body { max-width: 260px; }

/* Bloque del formulario de producto */
.digemid-lookup {
    margin-bottom: 1rem; padding: .875rem 1rem;
    border: 1px solid var(--fp-border); border-radius: var(--fp-radius); background: #fafbfc;
}
.digemid-lookup-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.digemid-lookup-title { font-size: .875rem; font-weight: 600; display: inline-flex; gap: .4rem; align-items: center; }
.digemid-lookup-title i { color: var(--fp-primary); }
.digemid-lookup-optional { font-size: .7rem; font-weight: 600; color: var(--fp-muted); background: #eef0f4; border-radius: 999px; padding: .1rem .5rem; }
.digemid-lookup-hint { font-size: .75rem; color: var(--fp-muted); margin-top: .375rem; }
.digemid-results { max-height: 320px; }
.digemid-item-sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.digemid-lookup:has(.digemid-linked) { padding: 0; border: 0; background: transparent; }
.digemid-linked {
    display: flex; gap: .75rem; align-items: center;
    padding: .625rem .75rem; border: 1px solid #86efac; border-radius: 10px; background: #f0fdf4;
}
.digemid-linked-icon {
    flex: 0 0 34px; width: 34px; height: 34px; border-radius: 8px;
    display: grid; place-items: center; background: #dcfce7; color: #15803d; font-size: 1.05rem;
}
.digemid-linked-title { font-size: .875rem; font-weight: 600; color: #166534; }
.digemid-linked-sub { font-size: .75rem; color: #15803d; overflow-wrap: anywhere; }

@media (max-width: 575.98px) {
    .digemid-stats { grid-template-columns: 1fr 1fr; }
    .digemid-stat:last-child { grid-column: 1 / -1; }
    .digemid-stat-value { font-size: 1.1rem; }
    .digemid-lookup-head { flex-wrap: wrap; }
    .digemid-linked { flex-wrap: wrap; }
    .digemid-linked .btn-link { margin-left: auto; }
}


/* =========================================================
   Fase 9D · Compras SUNAT
   ========================================================= */

.sunat-actions { display: flex; align-items: flex-end; gap: .5rem; flex-wrap: wrap; }
.sunat-actions input[type=month] { min-width: 180px; }
.sunat-search { width: 100%; max-width: 340px; }
.segmented .count.warning { background: #fef3c7; color: #b45309; }

/* Revisión */
.sunat-back { display: inline-flex; align-items: center; gap: .25rem; font-size: .8125rem; font-weight: 600; text-decoration: none; margin-bottom: .5rem; }
.sunat-title { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.sunat-head { display: flex; align-items: center; gap: 1.5rem; padding: 1rem 1.25rem; flex-wrap: wrap; }
.sunat-head-supplier { display: flex; gap: .75rem; align-items: center; flex: 1 1 320px; min-width: 0; }
.sunat-head-icon {
    flex: 0 0 40px; width: 40px; height: 40px; border-radius: 10px;
    display: grid; place-items: center; background: var(--fp-primary-soft); color: var(--fp-primary-dark); font-size: 1.15rem;
}
.sunat-head-data { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.sunat-head-data > div { display: flex; flex-direction: column; gap: .05rem; }
.sunat-head-data span { font-size: .75rem; color: var(--fp-muted); font-weight: 500; }
.sunat-head-data strong { font-size: .95rem; }
.sunat-head-data small { font-size: .75rem; color: var(--fp-muted); }

.sunat-progress { display: flex; align-items: center; gap: .75rem; margin: 1rem 0; font-size: .875rem; }
.sunat-progress .progress { min-width: 120px; }

.sunat-line { padding: 1rem 1.125rem; margin-bottom: .75rem; overflow: visible; }
.sunat-line.has-error { border-color: #fca5a5; box-shadow: 0 0 0 1px #fca5a5; }
.sunat-line.omitted { background: #fafbfc; }
.sunat-line.omitted .sunat-line-desc { color: var(--fp-muted); }
.sunat-line-map { display: grid; grid-template-columns: minmax(0, 5fr) auto minmax(0, 7fr); gap: 1rem; align-items: start; }
.sunat-label { font-size: .6875rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fp-muted); }
.sunat-line-desc { font-size: .875rem; font-weight: 600; margin: .125rem 0; overflow-wrap: anywhere; }
.sunat-line-arrow { color: #9ca3af; font-size: 1.1rem; align-self: center; }
.sunat-line-farma { display: flex; flex-direction: column; gap: .375rem; min-width: 0; }
.sunat-line-farma-head { display: flex; align-items: center; gap: .5rem; }
.sunat-omitted { display: flex; gap: .5rem; align-items: center; padding: .55rem .75rem; border-radius: 8px; background: var(--fp-hover); color: var(--fp-muted); font-size: .8125rem; }
.sunat-line-fields { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; margin-top: .875rem; }
.sunat-line-fields .form-label { font-size: .8125rem; margin-bottom: .25rem; }
.sunat-hint { font-size: .72rem; color: var(--fp-muted); margin-top: .2rem; }
.sunat-line-error { margin-top: .625rem; font-size: .8125rem; font-weight: 500; color: #b91c1c; }

.sunat-bar {
    position: sticky; bottom: 0; z-index: 20;
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: .875rem 1.25rem; margin-top: 1rem; box-shadow: 0 -6px 18px rgba(16, 24, 40, .06);
}
.sunat-bar-total { display: flex; flex-direction: column; align-items: flex-end; margin-left: auto; }
.sunat-bar-total strong { font-size: 1.15rem; }
.sunat-bar-actions { display: flex; gap: .5rem; align-items: center; }

@media (max-width: 991.98px) {
    .sunat-line-map { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
    .sunat-line-arrow { display: none; }
    .sunat-line-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sunat-line-fields > div:nth-child(3) { grid-column: 1 / -1; }
}

@media (max-width: 575.98px) {
    .sunat-actions { width: 100%; }
    .sunat-actions > div { flex: 0 0 auto; }
    .sunat-actions .btn { flex: 1 1 auto; }
    .sunat-search { max-width: none; }
    .sunat-head-data { gap: 1rem; }
    .sunat-bar { margin-left: -.5rem; margin-right: -.5rem; border-radius: 12px 12px 0 0; }
    .sunat-bar-total { margin-left: 0; align-items: flex-start; flex: 1 1 auto; }
    .sunat-bar-actions { width: 100%; flex-direction: column-reverse; align-items: stretch; }
}
