:root {

    /* --- Layout Dimensions --- */
    --header-height: 2.7rem;

    /* --- Theme Variables --- */
    --primary-color: #2c93d6;
    --bg-light: #f5f7fb;
    --text-muted: #6c757d;
    --border-color: #e9ecef;
    --header-bg: white;
    --text-color: #212529;

    /* --- Login brand panel gradient (brand cloud blues) --- */
    --login-panel-from: #5cb8e8;
    --login-panel-mid: #2f9bd8;
    --login-panel-to: #1f6fa8;

    /* --- Backgrounds --- */
    --bg-header: #ffffff;
    --bg-body: var(--bg-light);
    --bg-surface: #ffffff;

    /* --- Sidebar --- */
    --sidebar-bg: #f8f9fa;
    --sidebar-text: #495057;
    --sidebar-active-bg: #e8f0fe;
    --sidebar-active-color: #2c93d6;
    --sidebar-hover-bg: #e9ecef;
}

/* Bootstrap compiles .btn-primary against its own colors, not --primary-color.
   Bridge the button variables to the brand blue so primary actions match the palette. */
.btn-primary {
    --bs-btn-bg: var(--primary-color);
    --bs-btn-border-color: var(--primary-color);
    --bs-btn-hover-bg: color-mix(in srgb, var(--primary-color) 88%, #000);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--primary-color) 85%, #000);
    --bs-btn-active-bg: color-mix(in srgb, var(--primary-color) 80%, #000);
    --bs-btn-active-border-color: color-mix(in srgb, var(--primary-color) 78%, #000);
    --bs-btn-disabled-bg: var(--primary-color);
    --bs-btn-disabled-border-color: var(--primary-color);
}

/* Login submit button: a little taller, slightly heavier text, and pushed down a bit
   from the "forgot password" link for breathing room. */
.login-form-bg button[type="submit"] {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    margin-top: 0.75rem;
    font-weight: 600;
}

/* Login form links (forgot password, request access) use the brand blue per the
   mockups, overriding the package's muted default. Scoped to the login form area. */
.login-form-bg a {
    color: var(--primary-color) !important;
    text-decoration: none;
}

.login-form-bg a:hover {
    color: color-mix(in srgb, var(--primary-color) 85%, #000) !important;
    text-decoration: underline;
}

/* Outline-primary links/buttons (e.g. tenant picker) follow the brand blue too. */
.btn-outline-primary {
    --bs-btn-color: var(--primary-color);
    --bs-btn-border-color: var(--primary-color);
    --bs-btn-hover-bg: var(--primary-color);
    --bs-btn-hover-border-color: var(--primary-color);
    --bs-btn-active-bg: var(--primary-color);
    --bs-btn-active-border-color: var(--primary-color);
}

.theme-dark {
    /* Deep-navy palette extracted from the ProntoNube dark mockups. */
    --primary-color: #2f97da;
    --bg-light: #1b3047;
    --header-bg: #14273c;
    --border-color: #294056;
    --text-color: #e9eef5;
    --text-muted: #93a4ba;
    /* Fill of a disabled field: flatter and lighter than --bg-light so it reads as locked.
       No opacity on the field itself — it would dim the input but not its floating label,
       and the label strip would show as a darker chip over the faded fill. */
    --bg-disabled: #223a52;
    --bg-body: #0c1a2b;
    --bg-header: #14273c;
    --bg-surface: #14273c;

    /* --- Login brand panel gradient (darker brand blues) --- */
    --login-panel-from: #2b6ea3;
    --login-panel-mid: #184b76;
    --login-panel-to: #0f3457;

    /* --- Sidebar --- */
    --sidebar-bg: #0f2236;
    --sidebar-text: #93a4ba;
    --sidebar-active-bg: rgba(47, 151, 218, 0.14);
    --sidebar-active-color: #6fc0f0;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.06);

    /* Bootstrap .text-muted uses --bs-secondary-color; bridge it to our theme variable */
    --bs-secondary-color: var(--text-muted);
    /* Bootstrap .form-control-plaintext uses --bs-body-color; bridge it to our theme variable */
    --bs-body-color: var(--text-color);

}

/* --- Dark Mode Overrides --- */

/* Bootstrap sets --bs-dropdown-* directly on .dropdown-menu, so inheritance from .theme-dark is overridden.
   Target the element directly to win specificity. */
.theme-dark .dropdown-menu {
    --bs-dropdown-bg: var(--bg-surface);
    --bs-dropdown-color: var(--text-color);
    --bs-dropdown-link-color: var(--text-color);
    --bs-dropdown-link-hover-color: var(--text-color);
    --bs-dropdown-link-hover-bg: var(--sidebar-hover-bg);
    --bs-dropdown-border-color: var(--border-color);
    --bs-dropdown-divider-bg: var(--border-color);
    --bs-dropdown-header-color: var(--text-muted);
}

/* Bootstrap sets --bs-modal-* directly on .modal-content, so inheritance from .theme-dark is overridden.
   Target the element directly to win specificity. */
.theme-dark .modal-content {
    --bs-modal-bg: var(--bg-surface);
    --bs-modal-color: var(--text-color);
    --bs-modal-border-color: var(--border-color);
    --bs-modal-header-border-color: var(--border-color);
    --bs-modal-footer-border-color: var(--border-color);
}

/* Bootstrap's close glyph is a dark SVG that only inverts under [data-bs-theme=dark]; this theme uses
   .theme-dark instead, so the X stays dark-on-dark in modal headers. Invert it (Bootstrap's own filter). */
.theme-dark .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Progress track (BatchProgress and any .progress): Bootstrap paints it with --bs-secondary-bg, which only
   turns dark under [data-bs-theme=dark]; under .theme-dark it stays a near-white strip. */
.theme-dark .progress {
    --bs-progress-bg: var(--border-color);
}

.theme-dark .card {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-color);
}

/* Ignito media components (IgnitoImagePicker / IgnitoImageGallery) style their tool buttons, ramps,
   swatches and tiles with the standard Bootstrap contract: background var(--bs-body-bg) + color
   var(--bs-body-color) + border var(--bs-border-color). This theme bridges --bs-body-color/-secondary-color
   but deliberately NOT --bs-body-bg globally (see the floating-label strip note above). That left the
   picker's icons light on a still-light button background — no contrast. Bridge --bs-body-bg and
   --bs-border-color SCOPED to the media roots so those components adapt without touching form switches. */
.theme-dark .imgpick,
.theme-dark .imggallery {
    --bs-body-bg: var(--bg-surface);
    --bs-border-color: var(--border-color);
}

/* Bootstrap 5.3 colors .text-warning-emphasis through --bs-warning-text-emphasis, whose dark variant only
   exists under [data-bs-theme=dark]; this app uses .theme-dark, so the light-theme brown stays on dark
   surfaces and is barely readable. Bridge it to a light amber. */
.theme-dark {
    --bs-warning-text-emphasis: #ffda6a;
    /* .alert-warning (and .bg-warning-subtle) paint their fill and border with the subtle tokens, whose dark
       values also only exist under [data-bs-theme=dark]: with the light amber text above, the light fill left
       the alert unreadable. Use Bootstrap's own dark values. */
    --bs-warning-bg-subtle: #332701;
    --bs-warning-border-subtle: #997404;
}

/* Bootstrap's .table paints every cell with --bs-table-bg (#fff) and --bs-table-color (black), which
   ignore .theme-dark: bridge them here so any table (price breakdown, fiscal breakdown…) sits on its
   dark card instead of showing a white block. */
.theme-dark .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-color);
    --bs-table-border-color: var(--border-color);
    color: var(--text-color);
    border-color: var(--border-color);
}

.theme-dark .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
}

/* Excel import wizard — layout table (step 1). Bootstrap's .table paints each cell with
   --bs-table-bg (#fff) and --bs-table-color (black), which ignore .theme-dark and leave a
   white block inside the dark modal. Bridge the cell vars to the theme so the table matches
   its dark surface and its labels stay legible. */
.theme-dark .import-layout-table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-color);
    --bs-table-border-color: var(--border-color);
    color: var(--text-color);
    border-color: var(--border-color);
}

.theme-dark .text-gray-800 {
    color: var(--text-color) !important;
}

.theme-dark .bg-light {
    background-color: var(--border-color) !important;
}

.theme-dark .form-control,
.theme-dark .form-select {
    background-color: var(--bg-light);
    border-color: var(--border-color);
    color: var(--text-color);
}

/* Bootstrap only swaps the select chevron to its light stroke under [data-bs-theme=dark]; bridge it so
   native selects (e.g. the DataGrid "Filas por página" selector) keep a visible arrow. */
.theme-dark .form-select {
    --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23dee2e6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.theme-dark .form-control:focus,
.theme-dark .form-select:focus {
    background-color: var(--bg-light);
    color: var(--text-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(47, 151, 218, 0.25);
}

.theme-dark .form-control::placeholder {
    color: var(--text-muted);
}

/* Dark mode: Bootstrap paints the file input's built-in "Choose File" button with --bs-secondary-bg
   (near-white) while the surrounding .form-control rule above already switched the text to the light
   theme color — leaving white text on a white button. Bootstrap's own dark treatment is keyed to
   [data-bs-theme=dark], which this app never sets, so it has to be bridged here. Keyed to
   .form-control (not a component class) so every file input in the app is covered. */
.theme-dark .form-control::file-selector-button {
    background-color: var(--bg-surface);
    color: var(--text-color);
    border-color: var(--border-color);
}

.theme-dark .form-control:hover:not(:disabled):not([readonly])::file-selector-button {
    background-color: var(--border-color);
    color: var(--text-color);
}

/* Dark mode: the native date/datetime picker glyph is a dark icon that nearly disappears on the
   dark field. Invert it to a light glyph. Keyed to the element (every date/datetime input), not a
   component class, so all IgnitoInput Type="Date"/Type="DateTime" fields are covered by this rule. */
.theme-dark .form-control[type="date"]::-webkit-calendar-picker-indicator,
.theme-dark .form-control[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* Specific styling for DataGrid/DataList if it uses .modern-grid */
.theme-dark .modern-grid {
    background-color: var(--bg-surface);
    color: var(--text-color);
}

.theme-dark .modern-grid .grid-header {
    background-color: var(--bg-light);
    color: var(--text-color);
}

.theme-dark .modern-grid .grid-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Bootstrap sets --bs-list-group-bg / --bs-list-group-color directly on .list-group-item, overriding
   the parent .card colour. The ancestor switch (.theme-dark on <html>) must be handled in global CSS
   because Blazor scoped CSS cannot reach an ancestor element. */
.theme-dark .list-group-item {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-color);
}

/* --- IgnitoInput field ---
   Themed here (not in IgnitoInput.razor.css) because these rules must react to the
   .theme-dark class on <html> — an ancestor of the component. Blazor scoped CSS can
   only target descendants (::deep) and does not support :global(), so an ancestor
   theme switch can only be handled by global CSS. */
.ignito-input-hint {
    color: var(--text-muted);
}

.ignito-input-count {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Placeholder text should read as a hint, not as a value. Bootstrap tints the placeholder
   with --bs-secondary-color (body color at 0.75 opacity) — too close to the entered value in
   light theme. Key it to --text-muted so it matches the hint, counter, and floating label in
   BOTH themes. Theme-agnostic (var(--text-muted) is redefined under .theme-dark), so this one
   rule covers light and dark; opacity:1 keeps Firefox from dimming it further. */
.ignito-input .form-floating>label {
    color: var(--text-muted);
    opacity: 1;
}


/* InputBase marks a touched + invalid control with `modified invalid`; give it the
   same red affordance as Bootstrap's .is-invalid, without the icon background image. */
.ignito-input .form-control.modified.invalid {
    border-color: #dc3545;
}

.ignito-input .form-control.modified.invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.2);
}

/* Floating textarea needs an explicit height for the label transform to work. */
.ignito-input .form-floating > textarea.form-control {
    height: auto;
    min-height: calc(3.5rem + 2px);
    /* Keeps a classic scrollbar narrower than the right padding, so the band below never covers it. */
    scrollbar-width: thin;
}

/* Floating textarea: once the label floats, scrolled text must not run under it. The top
   padding that holds the label scrolls with the text, and Bootstrap's label::after strip only
   spans the (scaled) label, so lines show beside and over it. Mask the whole band from the
   container instead: above the textarea (z-index 1), below the label (z-index 2), and short of
   the right padding so the scrollbar stays visible. The text never reaches that padding.
   Mirrors the Ignito template's app.css. */
.ignito-input .form-floating:has(> textarea.form-control:focus)::before,
.ignito-input .form-floating:has(> textarea.form-control:not(:placeholder-shown))::before {
    content: "";
    position: absolute;
    top: var(--bs-border-width);
    left: var(--bs-border-width);
    right: calc(0.75rem + var(--bs-border-width));
    height: 1.625rem;
    z-index: 1;
    pointer-events: none;
    background-color: var(--bs-body-bg);
    border-top-left-radius: calc(var(--bs-border-radius) - var(--bs-border-width));
}

.ignito-input .form-floating:has(> textarea.form-control:disabled)::before {
    background-color: var(--bs-secondary-bg);
}

/* Dark mode — floating label.
   When a field is FILLED or FOCUSED, Bootstrap paints the strip behind the shrunk label
   (::after) with --bs-body-bg (white) and colors the label with --bs-body-color-rgb — both via
   its filled/focused selectors at specificity (0,3,2). A plain `.theme-dark .form-floating >
   label` (0,2,x) loses to those, so the white strip survives the moment the field has text or
   focus (the reported bug). We therefore MIRROR Bootstrap's exact selector list, prefixed with
   `.theme-dark` (→ 0,4,2) so it wins outright.
   Kept GLOBAL — keyed to `.form-floating`, not a component class — so IgnitoInput,
   IgnitoAutocomplete, IgnitoAddressAutocomplete, and any future floating-label field are all
   covered by this one block. (Patching it per component is what kept reintroducing the bug.)
   The strip must match the INPUT background — var(--bg-light), which in this theme is lighter
   than the page background — so bridging --bs-body-bg would not line up; target the strip. */
.theme-dark .form-floating > .form-control:focus ~ label::after,
.theme-dark .form-floating > .form-control:not(:placeholder-shown) ~ label::after,
.theme-dark .form-floating > .form-control-plaintext ~ label::after,
.theme-dark .form-floating > .form-select ~ label::after,
.theme-dark .ignito-input .form-floating:has(> textarea.form-control:focus)::before,
.theme-dark .ignito-input .form-floating:has(> textarea.form-control:not(:placeholder-shown))::before {
    background-color: var(--bg-light);
}

/* A disabled field is filled, so the rule above paints its label strip with the ENABLED
   background and the label shows as a lighter chip over the darker disabled fill. Same
   specificity (0,4,2), declared after, so it wins for disabled fields only. */
.theme-dark .form-floating > .form-control:disabled ~ label::after,
.theme-dark .form-floating > .form-select:disabled ~ label::after,
.theme-dark .ignito-input .form-floating:has(> textarea.form-control:disabled)::before {
    background-color: var(--bg-disabled);
}

.theme-dark .form-floating > .form-control:focus ~ label,
.theme-dark .form-floating > .form-control:not(:placeholder-shown) ~ label,
.theme-dark .form-floating > .form-control-plaintext ~ label,
.theme-dark .form-floating > .form-select ~ label {
    color: var(--text-muted);
}

/* Dark mode: the `.theme-dark .list-group-item` rule above also flattens the hover/active
   highlight inside the address suggestions menu (equal specificity, later in the cascade).
   Restore a visible selection cue. The active rule comes last so it wins when the highlighted
   item is also hovered. */
.theme-dark .ignito-address-menu .list-group-item-action:hover,
.theme-dark .ignito-address-menu .list-group-item-action:focus {
    /* Keep the item opaque: a bare rgba() wash would let the hint and the form
       fields behind the dropdown bleed through the hovered row. Layer the 6% white
       highlight on top of the solid surface instead. */
    background-color: var(--bg-surface);
    background-image: linear-gradient(rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.06));
    color: var(--text-color);
}

.theme-dark .ignito-address-menu .list-group-item.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.theme-dark .ignito-address-menu .list-group-item.active .text-muted {
    color: rgba(255, 255, 255, 0.75) !important;
}

/* Dark mode: prefix/suffix caps need a darker fill with light text for contrast. */
.theme-dark .ignito-input .input-group-text {
    background-color: var(--border-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

/* Dark mode: the clear (X) and show-password buttons are Bootstrap outline-secondary, whose
   #6c757d icon falls under 3:1 against the navy surface. Give them the field's own fill and
   border and the muted text color, so the add-on reads as part of the input (tarjeta 074). */
.theme-dark .ignito-input .ignito-input-btn {
    background-color: var(--bg-light);
    border-color: var(--border-color);
    color: var(--text-muted);
}

.theme-dark .ignito-input .ignito-input-btn:hover,
.theme-dark .ignito-input .ignito-input-btn:active {
    background-color: var(--border-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

/* Clear (X) button of every search/text box (tarjeta 074): a small round gray badge drawn inside
   the field, over the input's right padding, instead of a bordered add-on next to it. It is the
   .ignito-input-btn button holding a bi-x-lg icon, rendered by IgnitoInput, by the DataGrid search
   boxes and, in the pages that still own a plain <input>, by the page itself inside an
   .ignito-clearable wrapper. Keyed to the X icon so the show-password toggle (same class) keeps
   its own look. The badge uses the muted text color with the surface color for the glyph, so it
   keeps its contrast in Light and Dark without per-theme rules. Absolutely positioned inside a
   position: relative container, so the input keeps the full width and its own corners whether
   or not it sits in a floating label or after an icon add-on. */
.ignito-clearable {
    position: relative;
}

/* A type="search" input draws the browser's own X; ours replaces it. */
.ignito-clearable > input[type="search"]::-webkit-search-cancel-button {
    display: none;
    -webkit-appearance: none;
}

:is(.input-group, .ignito-clearable):has(> .ignito-input-btn .bi-x-lg) .form-control {
    padding-right: 2.25rem;
    border-top-right-radius: var(--bs-border-radius) !important;
    border-bottom-right-radius: var(--bs-border-radius) !important;
}

:is(.input-group, .ignito-clearable) > .btn.ignito-input-btn:has(.bi-x-lg) {
    position: absolute;
    top: 50%;
    right: 0.6rem;
    z-index: 6;
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
    transform: translateY(-50%);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    /* Bootstrap squares the left corners of a button inside an input group. */
    border-radius: 50% !important;
    background-color: var(--text-muted);
    color: var(--bg-surface);
    font-size: 0.55rem;
    opacity: 0.75;
    transition: opacity 0.15s ease-in-out;
}

:is(.input-group, .ignito-clearable) > .btn.ignito-input-btn:has(.bi-x-lg):hover,
:is(.input-group, .ignito-clearable) > .btn.ignito-input-btn:has(.bi-x-lg):active,
:is(.input-group, .ignito-clearable) > .btn.ignito-input-btn:has(.bi-x-lg):focus-visible {
    background-color: var(--text-muted);
    color: var(--bg-surface);
    opacity: 1;
}

/* Dark mode: the global .theme-dark .form-control rule above overrides Bootstrap's
   disabled background, so a disabled field looks enabled. Restore the disabled cue.
   Keyed to the field itself, not to .ignito-input, so every component that renders a
   disabled form control is covered (IgnitoSelect's Estado/Municipio when the postal
   code decides them, and anything added later). */
.theme-dark .form-control:disabled,
.theme-dark .form-select:disabled {
    background-color: var(--bg-disabled);
    border-color: var(--bg-disabled);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* --- Update / detail form container --- */
/* The 640px minimum keeps forms comfortable on desktop, but it must only apply on wider screens: a
   min-width below the viewport forces the wrapper (and its content) wider than the screen on mobile,
   which is what produced the horizontal scroll on backoffice/admin pages. Below 768px it fills the
   available width and its content wraps — matching the Platform area's fit-to-viewport behaviour. */
.update-form {
    max-width: 1024px;
    margin-bottom: 10px;
}

@media (min-width: 768px) {
    .update-form {
        min-width: 640px;
    }
}

@media (min-width: 1200px) {
    .update-form {
        margin-left: auto;
        margin-right: auto;
    }
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

h1:focus {
    outline: none;
}

.page-header {
    margin: 0 -2rem 0 -2rem; /* Negate the side padding of .content-area */
    padding: 2rem;
}

@media (max-width: 991.98px) {
    .page-header {
        margin: 0 -1rem 0 -1rem; /* Match mobile side padding of .content-area */
        padding: 1rem;
    }
}


.scrollable-content {
    flex: 1;
    overflow-y: auto;
}

.page-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background-color: var(--bg-header);
    border-top: 1px solid var(--border-color);
    margin-top: auto; /* Pushes the footer to the bottom of the flex container */
    margin-left: -2rem;
    margin-right: -2rem;
    font-size: 0.8rem;
}

@media (max-width: 991.98px) {
    .page-footer {
        margin-left: -1rem;
        margin-right: -1rem;
        padding: 1rem;
    }
}

@media (min-width: 992px) {
    .page-footer {
        flex-direction: row;
        justify-content: space-between;
    }

    .page-footer > div {
        flex: 1;
    }

    .page-footer > div:nth-child(2) {
        text-align: center;
    }

    .page-footer > div:nth-child(3) {
        text-align: right;
    }
}

/* --- Login page: mobile brand banner ---
   On mobile the SplitLeft panel is hidden (d-none d-md-flex), so the brand renders
   as a full-bleed blue banner pinned to the top of the form column. These overrides
   target the Ignito package's .login-form-bg column (scoped CSS cannot reach it):
   pin content to the top and let the brand wrapper span full width. */
@media (max-width: 767.98px) {
    /* Pin content to the top edge and remove the column's horizontal padding so the
       banner and form span the full viewport width. Bootstrap's .justify-content-center
       and .px-4 utilities use !important, so these overrides must too. */
    .login-form-bg {
        justify-content: flex-start !important;
        padding-top: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* The package wraps the mobile BrandSlot in a centered, max-width:420px div.
       Release that cap so the banner can fill the full column width. */
    .login-form-bg > .d-md-none {
        max-width: 100% !important;
        margin-bottom: 0 !important;
    }

    /* The form wrapper (the other direct .w-100 child) becomes a full-width sheet that
       overlaps the bottom of the banner with rounded top corners, like the mockup.
       It provides its own side padding since the column padding is now zero. */
    .login-form-bg > .w-100:not(.d-md-none) {
        max-width: 100% !important;
        margin: -1.25rem 0 0;
        padding: 1.75rem 1.5rem 0;
        background: var(--bg-body);
        border-radius: 1.25rem 1.25rem 0 0;
        position: relative;
        z-index: 2;
    }
}

/* Barra de filtros reutilizable (botón «Filtros» con panel emergente + fichas activas).
   Patrón compartido entre listados del backoffice (Productos, Categorías) para mantener una
   experiencia de filtrado consistente entre páginas y entidades: fuente única de estos estilos. */
.filters-wrap {
    position: relative;
}

.filters-toggle {
    height: 40px;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.filters-count {
    position: absolute;
    top: -0.4rem;
    right: -0.4rem;
    font-size: 0.65rem;
}

.filters-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: transparent;
}

.filters-panel {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 0.375rem;
    z-index: 1041;
    width: 20rem;
    max-width: calc(100vw - 2rem);
    padding: 0.75rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Variante flotante: el panel se posiciona con position:fixed vía JS (wwwroot/js/filtersPanel.js)
   para escapar de cualquier contenedor con overflow (p. ej. la barra de búsqueda del DataGrid, cuyo
   contenedor recorta en las esquinas redondeadas). Nace oculto y el script lo revela ya posicionado,
   para que no se vea un primer frame recortado dentro del grid. */
.filters-panel--floating {
    visibility: hidden;
}

.filters-group + .filters-group {
    margin-top: 0.75rem;
}

.filters-group-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bs-secondary-color, #6c757d);
    margin-bottom: 0.25rem;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 999px;
    background-color: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

.filter-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    padding: 0;
    line-height: 1;
    color: var(--bs-secondary-color, #6c757d);
}

.filter-chip-remove:hover,
.filter-chip-remove:focus {
    color: var(--bs-body-color, #212529);
}

.filter-chips-clear {
    font-size: 0.8rem;
    text-decoration: none;
    color: var(--primary-color);
}

/* En el tema oscuro (activado con .theme-dark en <html>) las variables --bs-* de Bootstrap no se
   redefinen, así que la ficha usa una veladura clara translúcida para leerse sobre la superficie oscura. */
.theme-dark .filter-chip {
    background-color: rgba(255, 255, 255, 0.07);
}

/* En móvil el panel ocupa el ancho de la pantalla menos el margen lateral. Se expresa respecto al
   viewport (no con width:100%, que resuelve contra el contenedor .filters-wrap —del ancho del botón—
   y dejaba el panel angosto con sus opciones desbordadas). */
@media (max-width: 575.98px) {
    .filters-panel {
        width: calc(100vw - 2rem);
    }
}

/* Insignia de estado interactiva (publicar/despublicar con un clic), compartida entre las listas de
   Categorías y Productos: un <button> con aspecto de badge de Bootstrap. Los colores los aporta la
   clase text-bg-* de cada estado (ya validada en ambos temas). */
.status-badge-toggle {
    border: none;
    cursor: pointer;
}

.status-badge-toggle:disabled {
    cursor: default;
    opacity: 0.7;
}

.status-badge-toggle:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}

/* Pulso de resaltado del editor de la tienda (vínculo bidireccional wireframe<->panel). Global
   porque lo usan dos componentes con CSS aislado (StoreSettingsPage y StorefrontWireframe); las
   keyframes de un .razor.css no serían visibles desde el otro. */
@keyframes pn-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(44, 147, 214, 0); }
    30%  { box-shadow: 0 0 0 4px rgba(44, 147, 214, 0.45); }
    100% { box-shadow: 0 0 0 0 rgba(44, 147, 214, 0); }
}

/* Reparto de lo que paga el cliente (tarjeta 001, «¿Cómo se calcula tu precio de venta?»): lo usan
   SplitBar y la leyenda de PriceExplainerDialog, por eso vive aquí y no en CSS aislado. */
.split-bar { display: flex; gap: 2px; height: 36px; border-radius: 6px; overflow: hidden; }
.split-bar.split-bar-sm { height: 12px; border-radius: 4px; margin-block: 0.25rem 0.5rem; }
.split-bar > span { display: block; height: 100%; min-width: 3px; }
.seg-you { background: var(--bs-success); }
.seg-tax { background: #6c7a96; }
.seg-gateway { background: var(--bs-warning); }
.seg-platform { background: var(--primary-color); }
.theme-dark .seg-tax { background: #8c9dc2; }

/* ============================================================================================
   Surtido y empaque (tarjeta 038). Global, no aislado: la tarjeta de partida, las píldoras de
   estado, la barra de caja, la etiqueta y la lista de empaque se pintan igual en la cola, el
   surtido por pedido, el modo guiado, el surtido por producto, el empaque y el detalle del pedido,
   y viven en componentes distintos (memoria «Scoped CSS vs shared markup»).
   Los tonos son los del prototipo (docs/specs/038-surtido-pedidos-prototipo.html), con su versión
   oscura bajo .theme-dark. Prefijo ff- (fulfillment).
   ============================================================================================ */
:root {
    --ff-surface-2: #f8f9fa;
    --ff-border-strong: #dee2e6;
    --ff-primary-soft: #e8f0fe;
    --ff-primary-text: #1f6fa8;
    --ff-ok: #198754;
    --ff-ok-soft: #d1e7dd;
    --ff-ok-text: #0f5132;
    --ff-warn: #ffc107;
    --ff-warn-soft: #fff3cd;
    --ff-warn-text: #664d03;
    --ff-bad: #dc3545;
    --ff-bad-soft: #f8d7da;
    --ff-bad-text: #842029;
    --ff-info: #0dcaf0;
    --ff-info-soft: #cff4fc;
    --ff-info-text: #055160;
    --ff-violet: #6f42c1;
    --ff-violet-soft: #e9e1f7;
    --ff-violet-text: #4b2a86;
    --ff-gray-soft: #eceff2;
    --ff-gray-text: #495057;
    --ff-note-bg: #fff8e1;
    --ff-note-text: #6b5300;
    --ff-note-border: #f3d97a;
}

.theme-dark {
    --ff-surface-2: #18304a;
    --ff-border-strong: #355069;
    --ff-primary-soft: rgba(47, 151, 218, 0.16);
    --ff-primary-text: #6fc0f0;
    --ff-ok-soft: rgba(25, 135, 84, 0.24);
    --ff-ok-text: #75b798;
    --ff-warn-soft: rgba(255, 193, 7, 0.16);
    --ff-warn-text: #ffda6a;
    --ff-bad-soft: rgba(220, 53, 69, 0.22);
    --ff-bad-text: #ea868f;
    --ff-info-soft: rgba(13, 202, 240, 0.16);
    --ff-info-text: #6edff6;
    --ff-violet-soft: rgba(111, 66, 193, 0.3);
    --ff-violet-text: #c7a8fb;
    --ff-gray-soft: rgba(147, 164, 186, 0.16);
    --ff-gray-text: #b8c5d6;
    --ff-note-bg: rgba(255, 193, 7, 0.1);
    --ff-note-text: #ffda6a;
    --ff-note-border: rgba(255, 193, 7, 0.35);
}

/* Columna de trabajo: a todo el ancho en el teléfono; en escritorio más ancha, sin llegar a renglones
   eternos. width: 100% porque el contenedor del layout es flex: sin él la columna se encogía al contenido
   y cambiaba de ancho entre partidas (p. ej. un nombre largo la ensanchaba en el modo guiado). */
.ff-page { width: 100%; max-width: 64rem; margin-inline: auto; display: grid; gap: .75rem; padding-bottom: 1rem; }
.ff-num { font-variant-numeric: tabular-nums; }
.ff-muted { color: var(--text-muted); }
.ff-sub { font-size: .82rem; color: var(--text-muted); }
.ff-empty { padding: 1.5rem 1rem; text-align: center; color: var(--text-muted); font-size: .9rem; border: 1px dashed var(--ff-border-strong); border-radius: .5rem; }

/* Selector Por pedido / Por producto */
.ff-seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--ff-surface-2); border: 1px solid var(--border-color); border-radius: .5rem; padding: .2rem; gap: .2rem; }
.ff-seg button { border: 0; background: transparent; border-radius: .375rem; padding: .45rem .5rem; font-weight: 600; font-size: .9rem; color: var(--text-muted); display: flex; align-items: center; justify-content: center; gap: .35rem; }
.ff-seg button[aria-pressed="true"] { background: var(--bg-surface); color: var(--text-color); box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075); }

/* Chips de filtro: mismo trazo que las píldoras de la lista de pedidos (badge-filter-btn), con contador. */
.ff-chips { display: flex; gap: .375rem; overflow-x: auto; scrollbar-width: none; padding-bottom: .1rem; }
.ff-chip { flex: none; padding: .2rem .8rem; border-radius: 1rem; font-size: .78rem; font-weight: 600; line-height: 1.5; border: 1.5px solid var(--border-color); background: transparent; color: var(--text-muted); display: inline-flex; gap: .3rem; align-items: center; }
.ff-chip:hover { border-color: var(--primary-color); color: var(--primary-color); }
.ff-chip .ff-c { font-weight: 700; opacity: .85; }
.ff-chip[aria-pressed="true"] { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.ff-chip:disabled { opacity: .55; cursor: not-allowed; border-style: dashed; pointer-events: none; }

.ff-group-h { font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); margin: .35rem .1rem -.25rem; }

/* Avance */
.ff-bar { height: .42rem; background: var(--ff-gray-soft); border-radius: 999px; overflow: hidden; }
.ff-bar > span { display: block; height: 100%; background: var(--primary-color); border-radius: 999px; transition: width .25s; }
.ff-bar.ff-bar--done > span { background: var(--ff-ok); }

/* Responsable del pedido */
.ff-who { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--text-muted); }
.ff-who i { font-style: normal; width: 1.25rem; height: 1.25rem; border-radius: 50%; display: grid; place-items: center; font-size: .62rem; font-weight: 700; background: var(--ff-violet-soft); color: var(--ff-violet-text); }
.ff-who.ff-who--me i { background: var(--ff-primary-soft); color: var(--ff-primary-text); }

/* Píldoras de estado de la partida */
.ff-pill { display: inline-flex; align-items: center; gap: .25rem; border-radius: 999px; font-size: .72rem; font-weight: 600; padding: .18rem .55rem; white-space: nowrap; border: 1px solid transparent; background: transparent; line-height: 1.3; }
button.ff-pill { cursor: pointer; }
.ff-pill--pending { border-color: var(--ff-border-strong); color: var(--text-muted); }
.ff-pill--partial { background: var(--ff-warn-soft); color: var(--ff-warn-text); }
.ff-pill--complete { background: var(--ff-ok-soft); color: var(--ff-ok-text); }
.ff-pill--missing { background: var(--ff-bad-soft); color: var(--ff-bad-text); }
.ff-pill--over { background: var(--ff-violet-soft); color: var(--ff-violet-text); }
.ff-pill--change { background: var(--ff-info-soft); color: var(--ff-info-text); }

/* Ubicación y notas */
.ff-loc { font-weight: 700; font-size: .7rem; letter-spacing: .03em; background: var(--ff-gray-soft); color: var(--ff-gray-text); border-radius: .25rem; padding: .08rem .35rem; }
.ff-note { background: var(--ff-note-bg); border: 1px solid var(--ff-note-border); color: var(--ff-note-text); border-radius: .375rem; padding: .45rem .6rem; font-size: .84rem; display: flex; gap: .4rem; align-items: flex-start; white-space: pre-line; }
.ff-line-note { font-size: .78rem; color: var(--ff-note-text); background: var(--ff-note-bg); border-radius: .25rem; padding: .15rem .4rem; justify-self: start; white-space: pre-line; }

/* Avisos */
.ff-banner { border-radius: .5rem; padding: .65rem .75rem; display: grid; gap: .45rem; font-size: .86rem; }
.ff-banner b { font-size: .92rem; }
.ff-banner ul { margin: 0; padding-left: 1.1rem; }
.ff-banner .ff-acts { display: flex; gap: .4rem; flex-wrap: wrap; }
.ff-banner--info { background: var(--ff-info-soft); color: var(--ff-info-text); }
.ff-banner--violet { background: var(--ff-violet-soft); color: var(--ff-violet-text); }
.ff-banner--ok { background: var(--ff-ok-soft); color: var(--ff-ok-text); }
.ff-banner--warn { background: var(--ff-warn-soft); color: var(--ff-warn-text); }

/* Encabezado del pedido */
.ff-head { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: .5rem; padding: .75rem .85rem; display: grid; gap: .5rem; }
.ff-head-top { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; }
.ff-head h4 { margin: 0; font-size: 1.15rem; }
.ff-facts { display: flex; flex-wrap: wrap; gap: .2rem .9rem; font-size: .82rem; color: var(--text-muted); }
.ff-facts b { color: var(--text-color); font-weight: 600; }

/* Miniatura */
.ff-thumb { width: 2.9rem; height: 2.9rem; border-radius: .375rem; overflow: hidden; flex: none; }
.ff-thumb img, .ff-thumb > * { width: 100%; height: 100%; object-fit: cover; }

/* Tarjeta de partida (mismo componente en por pedido, por producto y empaque) */
.ff-line { background: var(--bg-surface); border: 1px solid var(--border-color); border-left: 4px solid var(--ff-border-strong); border-radius: .5rem; padding: .8rem .85rem; display: grid; gap: .8rem; }
.ff-line.ff-st--partial, .ff-line-done.ff-st--partial { border-left-color: var(--ff-warn); }
.ff-line.ff-st--complete, .ff-line-done.ff-st--complete { border-left-color: var(--ff-ok); }
.ff-line.ff-st--missing, .ff-line-done.ff-st--missing { border-left-color: var(--ff-bad); }
.ff-line.ff-st--over, .ff-line-done.ff-st--over { border-left-color: var(--ff-violet); }
.ff-line.ff-line--flagged { box-shadow: 0 0 0 2px var(--ff-info) inset; }
.ff-line.ff-line--editing { border-color: var(--primary-color); border-left-color: var(--primary-color); box-shadow: 0 0 0 2px var(--ff-primary-soft); }
.ff-line-top { display: grid; grid-template-columns: 4.75rem 1fr auto; gap: .75rem; align-items: start; }
.ff-line-top .ff-thumb { width: 4.75rem; height: 4.75rem; border-radius: .5rem; }
.ff-line-txt { min-width: 0; display: grid; gap: .2rem; }
.ff-line-name { font-weight: 600; font-size: .95rem; line-height: 1.25; overflow-wrap: anywhere; }
.ff-line-top > .ff-pill, .ff-line-top > .ff-missbtn { white-space: normal; text-align: center; max-width: 8.5rem; }
/* El estado de la partida («Faltan N», «Completo»...) es lo primero que el operador busca: mayor que la pill de listas, sin cambiar la rejilla. */
.ff-line-top > .ff-pill { font-size: .88rem; font-weight: 700; padding: .32rem .8rem; border-color: currentColor; }
.ff-line-meta { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; font-size: .76rem; color: var(--text-muted); }
.ff-line-act { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: center; }
.ff-req { display: grid; line-height: 1.1; min-width: 4.2rem; }
.ff-req span { font-size: .68rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.ff-req b { font-size: 1.15rem; }
.ff-req small { font-size: .68rem; color: var(--text-muted); font-weight: 600; }
.ff-missbtn { border: 1px solid rgba(220, 53, 69, .5); color: var(--ff-bad-text); background: transparent; border-radius: 999px; font-size: .74rem; font-weight: 600; padding: .22rem .65rem; white-space: nowrap; }
.ff-missbtn:hover { background: var(--ff-bad); color: #fff; }
.ff-ro-val { justify-self: center; font-weight: 700; font-size: 1.05rem; }
.ff-boxinfo { display: flex; gap: .3rem; flex-wrap: wrap; font-size: .74rem; color: var(--text-muted); align-items: center; }
.ff-bx { display: inline-flex; align-items: center; gap: .25rem; border: 1px solid var(--ff-border-strong); border-radius: .25rem; padding: .05rem .4rem; font-weight: 600; color: var(--text-color); background: transparent; font-size: .74rem; }
/* Tarjeta 077: la caja abierta (la actual) con borde punteado; las cerradas, sólido. */
.ff-bx--open { border-style: dashed; }
button.ff-bx { cursor: pointer; background: var(--ff-primary-soft); border-color: var(--primary-color); color: var(--ff-primary-text); }

/* − / cantidad / + y ✓: 48 px de alto; el ✓ queda separado del + por 20 px y una línea, para no
   confirmar por error al subir la cantidad. */
.ff-stepper { display: grid; grid-template-columns: 3rem minmax(3rem, 1fr) 3rem; border: 1px solid var(--ff-border-strong); border-radius: .5rem; overflow: hidden; height: 3rem; max-width: 11rem; justify-self: center; width: 100%; }
.ff-stepper button { border: 0; background: var(--ff-surface-2); display: grid; place-items: center; color: var(--text-color); font-size: 1.15rem; }
.ff-stepper button:active { background: var(--border-color); }
.ff-stepper button:disabled { opacity: .35; }
.ff-stepper input { border: 0; border-inline: 1px solid var(--ff-border-strong); text-align: center; font-weight: 700; font-size: 1.1rem; background: var(--bg-surface); color: var(--text-color); width: 100%; min-width: 0; font-variant-numeric: tabular-nums; }
.ff-stepper input::placeholder { color: var(--text-muted); font-weight: 400; }
.ff-okbtn { width: 3.25rem; height: 3rem; border-radius: .5rem; border: 1.5px solid var(--ff-ok); background: transparent; color: var(--ff-ok-text); display: grid; place-items: center; font-size: 1.5rem; margin-left: .85rem; position: relative; }
.ff-okbtn::before { content: ""; position: absolute; left: -.6rem; top: .35rem; bottom: .35rem; border-left: 1px solid var(--border-color); }
.ff-okbtn:hover, .ff-okbtn:active { background: var(--ff-ok); color: #fff; }
.ff-okbtn.ff-okbtn--ready { background: var(--ff-ok); color: #fff; box-shadow: 0 0 0 3px var(--ff-ok-soft); }
/* Tarjetas 097 y 077: cantidad escrita que no es número (097) o que pasa de lo pendiente de la caja actual (077).
   El stepper se marca en rojo y el aviso queda debajo; lo guardado no cambia y la caja no se cierra hasta corregirla. */
.ff-stepper.ff-stepper--invalid { border-color: var(--ff-bad); box-shadow: 0 0 0 3px var(--ff-bad-soft); }
.ff-stepper.ff-stepper--invalid input { color: var(--ff-bad-text); }
.ff-qty-error { display: flex; gap: .4rem; align-items: flex-start; font-size: .82rem; font-weight: 600; color: var(--ff-bad-text); background: var(--ff-bad-soft); border-radius: .375rem; padding: .4rem .6rem; text-align: left; }
.ff-qty-error .bi { flex: none; margin-top: .1rem; }

/* Partida confirmada: se compacta en un renglón sin desaparecer */
.ff-line-done { display: grid; grid-template-columns: 2.6rem 1fr auto auto; gap: .5rem; align-items: center; background: var(--bg-surface); border: 1px solid var(--border-color); border-left: 4px solid var(--ff-border-strong); border-radius: .5rem; padding: .4rem .55rem; animation: ff-settle .35s ease; }
.ff-line-done .ff-thumb { width: 2.6rem; height: 2.6rem; }
.ff-line-done .ff-line-name { font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ff-line-done .ff-edit { border: 0; background: transparent; color: var(--ff-primary-text); font-size: .8rem; font-weight: 600; padding: .3rem .2rem; }
@keyframes ff-settle { from { background: var(--ff-ok-soft); } to { background: var(--bg-surface); } }

/* Barra inferior fija */
.ff-dock { position: sticky; bottom: 0; z-index: 5; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: .5rem .5rem 0 0; padding: .6rem .75rem .7rem; display: grid; gap: .5rem; box-shadow: 0 -.25rem .75rem rgba(0, 0, 0, .06); }
.ff-dock-row { display: flex; align-items: center; gap: .6rem; }
.ff-dock-prog { flex: 1; display: grid; gap: .25rem; min-width: 0; }
.ff-keepbar { display: flex; align-items: center; gap: .5rem; font-size: .78rem; color: var(--text-muted); }
.ff-keepbar span { flex: 1; min-width: 0; }
.ff-keepbar button { border: 0; background: transparent; color: var(--ff-primary-text); font-weight: 700; font-size: .8rem; padding: .1rem .2rem; }
.ff-boxbar { display: flex; align-items: center; gap: .5rem; background: var(--ff-primary-soft); border-radius: .375rem; padding: .4rem .55rem; font-size: .82rem; color: var(--ff-primary-text); }
.ff-boxbar .ff-t { flex: 1; min-width: 0; }
.ff-boxbar .ff-t b { color: var(--text-color); }
/* Cajas cerradas de la barra (tarjeta 076): renglón propio debajo de «Cerrar caja», con desplazamiento
   horizontal si son muchas, para que la barra no crezca ni empuje la lista. */
.ff-boxbar { flex-wrap: wrap; }
.ff-boxbar-closed { flex-basis: 100%; min-width: 0; display: flex; align-items: center; gap: .375rem; overflow-x: auto; scrollbar-width: none; padding-bottom: .1rem; }
/* Tarjeta 038 (QA): las columnas de la página y de la barra inferior no crecen con el contenido. Sin esto, el
   renglón de cajas cerradas ensanchaba la columna (auto) al ancho de todas sus cajas y en celular la barra
   —con «Cerrar caja» y «Terminar»— y las tarjetas de partida quedaban cortadas a la derecha. */
.ff-page, .ff-dock, .ff-guide { grid-template-columns: minmax(0, 1fr); }
/* Tarjeta 038 (verificación): en celular la barra inferior ocupa todo el ancho y llega al borde inferior de la
   pantalla. Cancela el relleno lateral (1rem) y el inferior (1rem) del área de contenido: la página se vuelve
   columna de al menos la altura del área, la barra se baja con margin-top:auto y su offset sticky negativo
   compensa el relleno inferior que el navegador descuenta al fijarla. */
@media (max-width: 767.98px) {
    .ff-page { display: flex; flex-direction: column; padding-bottom: 0; margin-bottom: -1rem; min-height: calc(100% + 1rem); }
    /* Tarjeta 106: el área de contenido también es columna flexible, así que con listas largas encogía la página
       a ese min-height y el encogimiento se lo comían los renglones de chips (overflow-x: auto les quita el alto
       mínimo): quedaban en una raya. La página crece con su contenido y el área de contenido se desplaza. */
    .ff-page { flex-shrink: 0; }
    .ff-dock { bottom: -1rem; margin-top: auto; margin-inline: -1rem; border-radius: 0; border-inline: 0; border-bottom: 0; padding-bottom: calc(.7rem + env(safe-area-inset-bottom)); }
}
.ff-boxbar-closed::-webkit-scrollbar { display: none; }
.ff-boxbar-lbl { flex: none; font-size: .75rem; font-weight: 600; }
.ff-boxbar-closed .ff-boxchip { flex: none; border-radius: 1rem; min-height: 2rem; padding-inline: .7rem; background: var(--bg-surface); font-weight: 600; }
.ff-boxbar-closed .ff-boxchip:hover, .ff-boxbar-closed .ff-boxchip:focus-visible { background: var(--primary-color); color: #fff; }

/* Aviso flotante */
.ff-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 11.5rem; width: min(30rem, calc(100vw - 1.5rem)); background: var(--text-color); color: var(--bg-surface); border-radius: .5rem; padding: .55rem .75rem; display: flex; align-items: center; gap: .6rem; font-size: .86rem; z-index: 1060; box-shadow: 0 .75rem 2rem rgba(16, 40, 70, .25); }
.ff-toast span { flex: 1; min-width: 0; }

/* Modo guiado */
.ff-guide { display: grid; gap: .8rem; }
.ff-guide-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.ff-guide-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: .5rem; padding: 1.1rem 1rem; display: grid; gap: .75rem; justify-items: center; text-align: center; box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075); }
.ff-guide-card .ff-thumb { width: 7rem; height: 7rem; border-radius: .5rem; }
.ff-guide-loc { font-size: 1.6rem; font-weight: 800; letter-spacing: .04em; background: var(--ff-gray-soft); color: var(--ff-gray-text); border-radius: .375rem; padding: .1rem .7rem; }
.ff-guide-name { font-size: 1.15rem; font-weight: 700; margin: 0; line-height: 1.4rem; height: 2.8rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; align-content: center; }
/* Nota de la partida: alto fijo de dos renglones, exista o no, para que el stepper y los botones no se
   muevan al pasar de una partida a otra. Si no cabe, se toca y se lee completa en un globo flotante. */
.ff-guide-notewrap { position: relative; width: 100%; max-width: 30rem; height: 2.9rem; }
.ff-guide-note { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; width: 100%; height: 100%; text-align: left; font-size: .84rem; line-height: 1.25rem; color: var(--ff-note-text); background: var(--ff-note-bg); border: 1px solid var(--ff-note-border); border-radius: .375rem; padding: .2rem .5rem; white-space: pre-line; cursor: pointer; }
.ff-guide-note i { margin-right: .3rem; }
.ff-guide-pop { position: absolute; top: calc(100% + .35rem); left: 0; right: 0; z-index: 20; text-align: left; font-size: .9rem; line-height: 1.4; white-space: pre-line; color: var(--text-color); background: var(--bg-surface); border: 1px solid var(--ff-note-border); border-radius: .5rem; padding: .6rem .75rem; box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .2); max-height: 50vh; overflow-y: auto; }
.ff-guide-req { font-size: .86rem; color: var(--text-muted); }
.ff-guide-req b { font-size: 2rem; color: var(--text-color); display: block; line-height: 1.1; }
.ff-guide-card .ff-stepper { height: 3.4rem; max-width: 15rem; grid-template-columns: 3.4rem 1fr 3.4rem; }
.ff-guide-card .ff-stepper input { font-size: 1.5rem; }
.ff-guide-acts { display: grid; grid-template-columns: 1fr 2fr; gap: .5rem; }
.ff-guide-acts .btn { min-height: 3.25rem; font-weight: 600; font-size: 1.05rem; }
.ff-guide-nav { display: flex; justify-content: space-between; }
.ff-guide-nav .btn { color: var(--text-muted); text-decoration: none; }

/* Tarjetas de la cola */
.ff-ocard { display: grid; gap: .45rem; width: 100%; text-align: left; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: .5rem; padding: .8rem .85rem; color: var(--text-color); box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .05); }
.ff-ocard:hover { border-color: var(--ff-border-strong); }
.ff-oc-top { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.ff-oc-top strong { font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ff-oc-top .badge { margin-left: auto; }
.ff-folio { font-weight: 700; color: var(--text-muted); font-size: .86rem; }
.ff-oc-meta { display: flex; justify-content: space-between; gap: .5rem; font-size: .8rem; color: var(--text-muted); }
.ff-oc-cta { display: flex; align-items: center; justify-content: space-between; font-size: .86rem; font-weight: 600; color: var(--ff-primary-text); }
/* La tarjeta se abre con un botón que la cubre (ff-oc-hit); la nota general (tarjeta 075) queda por encima
   para que «Ver más» y tocar la nota no abran el pedido. */
.ff-ocard { position: relative; }
.ff-oc-hit { position: absolute; inset: 0; z-index: 1; width: 100%; padding: 0; background: transparent; border: 0; border-radius: inherit; cursor: pointer; }
.ff-oc-hit:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
.ff-oc-note { position: relative; z-index: 2; cursor: auto; }
.ff-oc-note-body { flex: 1; min-width: 0; display: grid; justify-items: start; white-space: normal; }
.ff-oc-note-text { white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; max-width: 100%; }
.ff-oc-note--open .ff-oc-note-text { display: block; -webkit-line-clamp: unset; line-clamp: none; overflow: visible; }
/* «Ver más» sólo cuando el texto no cabe (data-clamped, js/fulfillment.js) o ya está desplegada. */
.ff-oc-note .ff-oc-more { display: none; padding: .3rem .1rem .1rem; margin: 0; min-height: 2rem; font-size: .8rem; white-space: nowrap; font-weight: 600; color: var(--ff-primary-text); text-decoration: underline; text-underline-offset: 2px; }
.ff-oc-note[data-clamped] .ff-oc-more, .ff-oc-note--open .ff-oc-more { display: inline-block; }
.ff-pcard { display: grid; grid-template-columns: 2.9rem 1fr auto; gap: .6rem; align-items: center; width: 100%; text-align: left; background: var(--bg-surface); border: 1px solid var(--border-color); border-left: 4px solid var(--ff-border-strong); border-radius: .5rem; padding: .65rem .7rem; color: var(--text-color); }
.ff-pcard.ff-st--complete { border-left-color: var(--ff-ok); }
.ff-pcard.ff-st--partial { border-left-color: var(--ff-warn); }
.ff-pc-nums { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .25rem; }

/* Surtir por producto */
.ff-phead { display: grid; grid-template-columns: 3.6rem 1fr; gap: .7rem; align-items: center; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: .5rem; padding: .75rem; }
.ff-phead .ff-thumb { width: 3.6rem; height: 3.6rem; }
.ff-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.ff-kpi { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: .375rem; padding: .45rem .5rem; display: grid; }
.ff-kpi span { font-size: .68rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.ff-kpi b { font-size: 1.1rem; }
.ff-kpi.ff-kpi--warn b { color: var(--ff-warn-text); }
.ff-kpi.ff-kpi--ok b { color: var(--ff-ok-text); }
.ff-split { background: var(--bg-surface); border: 1.5px solid var(--primary-color); border-radius: .5rem; padding: .75rem; display: grid; gap: .6rem; }
.ff-split h5 { margin: 0; font-size: .95rem; }

/* Empaque por separado */
.ff-pack-act { display: grid; grid-template-columns: minmax(0, 10rem) 1fr; gap: .5rem; align-items: center; }
.ff-pack-act .ff-stepper { justify-self: stretch; }

/* Resumen de cierre */
.ff-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .45rem; }
.ff-stat { border-radius: .375rem; padding: .5rem .6rem; display: grid; gap: .05rem; }
.ff-stat b { font-size: 1.35rem; line-height: 1.1; }
.ff-stat span { font-size: .76rem; font-weight: 600; }
.ff-stat--ok { background: var(--ff-ok-soft); color: var(--ff-ok-text); }
.ff-stat--warn { background: var(--ff-warn-soft); color: var(--ff-warn-text); }
.ff-stat--bad { background: var(--ff-bad-soft); color: var(--ff-bad-text); }
.ff-stat--gray { background: var(--ff-gray-soft); color: var(--ff-gray-text); }
.ff-diffl { display: grid; gap: .3rem; font-size: .84rem; margin: 0; padding: 0; list-style: none; }
.ff-diffl li { display: flex; justify-content: space-between; gap: .5rem; border-bottom: 1px solid var(--border-color); padding-bottom: .3rem; }

/* Cajas (lista de empaque, detalle del pedido) */
.ff-boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .7rem; }
.ff-boxc { border: 1px solid var(--border-color); border-radius: .375rem; padding: .6rem .7rem; display: grid; gap: .3rem; font-size: .84rem; align-content: start; }
.ff-boxc h6 { margin: 0; font-size: .88rem; display: flex; align-items: center; gap: .35rem; }
.ff-boxc h6 .bi { color: var(--ff-primary-text); }
.ff-boxc .ff-row { display: flex; justify-content: space-between; gap: .5rem; }

/* Etiqueta de caja: papel blanco en ambos temas, a propósito (es lo que sale impreso). */
.ff-label { background: #fff; color: #111; border: 1px solid #cfd4da; border-radius: .3rem; padding: .8rem .9rem; display: grid; gap: .35rem; max-width: 24rem; margin-inline: auto; }
.ff-label .ff-lb-top { display: flex; justify-content: space-between; gap: .5rem; font-size: .76rem; border-bottom: 1.5px solid #111; padding-bottom: .3rem; }
.ff-label .ff-lb-box { font-size: 2rem; font-weight: 800; letter-spacing: .02em; line-height: 1; }
.ff-label .ff-lb-big { font-size: 1.1rem; font-weight: 700; }
.ff-label .ff-lb-sm { font-size: .82rem; }
.ff-label .ff-lb-items { border-top: 1px dashed #cfd4da; padding-top: .35rem; font-size: .8rem; display: grid; gap: .1rem; }
.ff-label .ff-lb-items div { display: flex; justify-content: space-between; gap: .5rem; }
.ff-label .ff-lb-code { width: 100%; height: 3rem; margin-top: .2rem; }
.ff-label .ff-lb-code-text { text-align: center; font-size: .72rem; letter-spacing: .1em; }

/* Configuración › Surtido */
.ff-opt { display: grid; grid-template-columns: auto 1fr; gap: .6rem; align-items: start; border: 1px solid var(--border-color); border-radius: .375rem; padding: .65rem .75rem; cursor: pointer; margin: 0; }
.ff-opt input { margin-top: .3rem; }
.ff-opt b { display: block; font-size: .92rem; }
.ff-opt span { display: block; font-size: .82rem; color: var(--text-muted); }
.ff-opt.ff-opt--off { opacity: .6; cursor: not-allowed; border-style: dashed; }
.ff-opt:has(input:checked) { border-color: var(--primary-color); background: var(--ff-primary-soft); }
.ff-soon { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ff-violet-text); background: var(--ff-violet-soft); border-radius: .25rem; padding: .05rem .35rem; margin-left: .3rem; }

/* Columna «Surtido» de la lista de pedidos */
.ff-progress-cell { display: grid; gap: .2rem; min-width: 9rem; }
.ff-progress-cell .ff-bar { height: .35rem; }
.ff-progress-cell small { font-size: .76rem; color: var(--text-muted); display: flex; gap: .35rem; align-items: center; white-space: nowrap; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
    .ff-line-done { animation: none; }
    .ff-bar > span { transition: none; }
}

/* Ventana sobre ventana (StaticModal): Bootstrap da el mismo z-index a todas, así que una ventana abierta desde
   otra (la etiqueta de caja desde la lista de empaque, tarjeta 038) se pinta en el orden del documento. La que
   viene después del fondo de otra ventana abierta sube un nivel, y su fondo oscurece a la de abajo. La página
   tiene que poner la ventana hija después de la que la abre. */
.modal-backdrop.show ~ .modal.show { z-index: 1065; }
.modal-backdrop.show ~ .modal-backdrop.show { z-index: 1060; }

/* Impresión (etiqueta y lista de empaque). pnPrintArea (js/fulfillment.js) copia el elemento a
   #pn-print-root, directo en <body>, y fija el tamaño de página; al imprimir sólo esa copia existe: el resto
   del body sale del flujo (display: none) y la hoja ya no depende de la ventana modal ni de su scroll
   (tarjeta 096). Papel blanco y texto oscuro en los dos temas. La lista va en una sola columna, al ancho de la
   hoja, y pagina hacia abajo sin partir una caja (ni un renglón) cuando cabe en la página. */
#pn-print-root { display: none; }
@media print {
    html:has(body.pn-printing), body.pn-printing {
        background: #fff !important; height: auto !important; min-height: 0 !important;
        overflow: visible !important; margin: 0 !important; padding: 0 !important;
    }
    body.pn-printing > :not(#pn-print-root) { display: none !important; }
    body.pn-printing #pn-print-root {
        display: block !important; position: static; width: 100%; background: #fff; color: #212529;
        --text-color: #212529; --text-muted: #495057; --border-color: #adb5bd; --ff-border-strong: #adb5bd; --ff-primary-text: #1f6fa8;
        /* Tema oscuro: la copia heredaría fondos y textos claros; el papel es blanco (tarjeta 038). */
        --bg-surface: #fff; --primary-color: #2c93d6; --bs-body-color: #212529; --bs-secondary-color: #6c757d;
        --ff-surface-2: #f8f9fa; --ff-bad-text: #842029; --ff-warn-text: #664d03; --ff-ok-text: #0f5132; --ff-gray-text: #495057;
    }
    body.pn-printing .pn-print-target svg { max-width: 100%; }
    body.pn-printing .pn-print-target { position: static; width: 100%; margin: 0; border: 0; box-shadow: none; max-width: none; }
    body.pn-printing .pn-print-target .ff-noprint { display: none !important; }
    body.pn-printing .pn-print-target .ff-boxes { display: block; }
    body.pn-printing .pn-print-target .ff-boxc { display: block; margin-bottom: .5rem; break-inside: avoid; page-break-inside: avoid; }
    body.pn-printing .pn-print-target .ff-boxc h6 { margin-bottom: .3rem; break-after: avoid; page-break-after: avoid; }
    body.pn-printing .pn-print-target .ff-boxc .ff-row { padding: .1rem 0; break-inside: avoid; page-break-inside: avoid; }
}

/* ============================================================================================
   Envíos (tarjeta 041). Mismo sistema ff- que el surtido.
   «Enviado» es el único estatus en violeta (text-bg-violet: Bootstrap no trae esa insignia); texto blanco
   sobre #6f42c1 tiene contraste suficiente en los dos temas. La modalidad de entrega es una pastilla
   suave —ámbar para recoger, azul claro para domicilio— para que no se confunda con el estatus.
   ============================================================================================ */
.text-bg-violet { background-color: var(--ff-violet) !important; color: #fff !important; }
.ff-method { display: inline-flex; align-items: center; gap: .3rem; }
.ff-method .bi { font-size: .8rem; }
.ff-method--pickup { background: var(--ff-warn-soft); color: var(--ff-warn-text); }
.ff-method--home { background: var(--ff-info-soft); color: var(--ff-info-text); }

/* Datos del envío (pares etiqueta / valor) */
.ff-kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .9rem; margin: 0; font-size: .86rem; }
.ff-kv dt { color: var(--text-muted); font-weight: 600; }
.ff-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ff-guide-no { font-family: var(--bs-font-monospace); font-size: .84rem; }
.ff-pending { color: var(--ff-warn-text); font-weight: 600; }

/* Tarjeta de la pantalla Envíos */
.ff-ship-top { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: start; }
.ff-ship-pills { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.ff-ship-big { font-size: 1.15rem; font-weight: 700; line-height: 1.1; }
.ff-ship-lbl { font-size: .68rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.ff-ship-cell { display: grid; justify-items: end; text-align: right; }

/* Diálogo Enviar: guías por caja */
.ff-ship-boxes { display: grid; gap: .5rem; }
.ff-ship-box { display: grid; grid-template-columns: minmax(0, 1fr) minmax(9rem, 14rem); gap: .6rem; align-items: start; border: 1px solid var(--border-color); border-radius: .375rem; padding: .55rem .65rem; }
.ff-ship-box--single { grid-template-columns: minmax(0, 1fr); }
.ff-ship-box .ff-boxc-items { font-size: .8rem; color: var(--text-muted); display: grid; gap: .05rem; }
@media (max-width: 575.98px) {
    .ff-ship-box { grid-template-columns: minmax(0, 1fr); }
}

/* Historial del pedido (línea de tiempo) */
.ff-timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.ff-timeline li { display: grid; grid-template-columns: 1.1rem 1fr; gap: .6rem; position: relative; padding-bottom: .75rem; }
.ff-timeline li::before { content: ""; position: absolute; left: .5rem; top: 1.1rem; bottom: 0; width: 2px; background: var(--border-color); }
.ff-timeline li:last-child { padding-bottom: 0; }
.ff-timeline li:last-child::before { display: none; }
.ff-timeline .ff-dot { width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--ff-primary-soft); border: 2px solid var(--primary-color); margin-top: .15rem; }
.ff-timeline .ff-dot--done { border-color: var(--ff-ok); background: var(--ff-ok-soft); }
.ff-timeline .ff-dot--canceled { border-color: var(--ff-bad); background: var(--ff-bad-soft); }
.ff-timeline b { font-size: .88rem; display: block; }
.ff-timeline span { display: block; font-size: .78rem; color: var(--text-muted); }
.ff-seg.ff-seg--3 { grid-template-columns: repeat(3, 1fr); }
.ff-seg button:disabled { opacity: .6; cursor: not-allowed; }
@media (max-width: 575.98px) { .ff-seg.ff-seg--3 { grid-template-columns: 1fr; } }
.ff-ship-head { display: grid; gap: .3rem; min-width: 0; }

/* ============================================================================================
   Entregas y pagos (tarjeta 042). Mismo sistema ff- que el surtido y los envíos.
   «Entregado» va en gris oscuro (text-bg-dark de Bootstrap) en tema claro; en tema oscuro ese gris se
   perdería sobre el fondo, así que se aclara (gris claro con texto oscuro): sigue siendo el único estatus
   en ese tono y no se confunde con el gris medio de «Nuevo». El estado de cobro es una pastilla suave
   —rojo por cobrar, ámbar pago parcial, verde pagado— para no confundirse con el estatus.
   ============================================================================================ */
.theme-dark .text-bg-dark { background-color: #ced4da !important; color: #212529 !important; }
.ff-pay .bi { font-size: .78rem; }
.ff-pay--due { background: var(--ff-bad-soft); color: var(--ff-bad-text); }
.ff-pay--partial { background: var(--ff-warn-soft); color: var(--ff-warn-text); }
.ff-pay--paid { background: var(--ff-ok-soft); color: var(--ff-ok-text); }
.ff-timeline .ff-dot--pay { border-color: var(--ff-warn); background: var(--ff-warn-soft); }

/* Captura de pagos (entregar y, en la tarjeta 043, registrar cobro) */
.ff-paycap { display: grid; gap: .5rem; }
.ff-paylines { display: grid; gap: .5rem; }
.ff-payline { display: grid; grid-template-columns: minmax(9rem, 1.2fr) minmax(8rem, 1fr) minmax(8rem, .8fr) auto; gap: .5rem; align-items: center; }
.ff-payline-amount input { text-align: right; }

/* Por debajo de 992 px la ventana (modal-lg) mide 500 px: las tres columnas no caben y la referencia se encimaba
   con el «$» del monto (tableta, tarjeta 043). La línea se apila igual que en el teléfono. */
@media (max-width: 991.98px) {
    .ff-payline { grid-template-columns: minmax(0, 1fr) auto; border: 1px solid var(--border-color); border-radius: .375rem; padding: .5rem; }
    .ff-payline > :nth-child(1) { grid-column: 1 / -1; }
    .ff-payline > :nth-child(2) { grid-column: 1 / -1; }
}

/* Resumen de montos: total, pagos y saldo */
.ff-paysum { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; font-size: .9rem; border: 1px solid var(--border-color); border-radius: .5rem; padding: .6rem .75rem; background: var(--ff-surface-2); }
.ff-paysum dt { font-weight: 400; color: var(--text-muted); }
.ff-paysum dd { margin: 0; text-align: right; }
.ff-paysum .ff-paysum-t { font-weight: 700; color: var(--text-color); }
.ff-due { color: var(--ff-bad-text) !important; }
.ff-zero { color: var(--ff-ok-text) !important; }

/* Datos del envío desplegables en la tarjeta de Entregas */
.ff-shipdata { display: grid; gap: .35rem; }
.ff-shipdata-toggle { justify-self: start; font-weight: 600; }
.ff-shipdata-body { border-left: 2px solid var(--border-color); padding-left: .75rem; }
.order-payments td, .order-payments th { white-space: nowrap; }

/* Cuentas por cobrar (tarjeta 043): los días desde la entrega en ámbar con más de 60 y en rojo con más de 90,
   con los mismos tonos de aviso y error del sistema ff- (claro y oscuro). */
.ff-age--60 { color: var(--ff-warn-text); font-weight: 700; }
.ff-age--90 { color: var(--ff-bad-text); font-weight: 700; }
