:root {
    --bg: #f6f3f2;
    --ink: #261716;
    --muted: #838383;
    --panel: #fffafa;
    --line: #e0d4d3;
    --accent: #a21a16;
    --accent-strong: #4c2826;
    --accent-soft: #b16868;
    --danger: #a21a16;
    --success-bg: #f5eeee;
    --error-bg: #fff0ef;
}

.predespacho-qr-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px max-content;
    gap: 20px;
    align-items: center;
    padding: 18px;
    border: 1px solid rgba(24, 112, 95, 0.24);
    border-radius: 8px;
    background: #f2faf6;
}

.predespacho-qr-panel h2,
.predespacho-qr-panel p {
    margin: 4px 0 0;
}

.predespacho-qr-link {
    display: block;
    width: 180px;
    height: 180px;
    border: 8px solid #ffffff;
    background: #ffffff;
    box-shadow: 0 4px 14px rgba(31, 31, 31, 0.12);
}

.predespacho-qr-link canvas,
.predespacho-qr-link img {
    display: block;
    width: 164px !important;
    height: 164px !important;
}

.dispatch-report {
    display: none !important;
}

.dispatch-confirmation {
    width: min(760px, 100%);
    margin: 32px auto;
    padding: 28px;
    border: 1px solid var(--line);
    border-top: 6px solid #18705f;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 18px 45px rgba(54, 37, 31, 0.12);
}

.dispatch-confirmation__header {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.dispatch-confirmation__header h1,
.dispatch-confirmation__header p {
    margin: 4px 0 0;
}

.dispatch-confirmation__header h1 {
    font-size: 3.2rem;
    line-height: 1.02;
}

.dispatch-confirmation__code {
    color: var(--accent-strong);
    font-size: 1.35rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.dispatch-confirmation__summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.dispatch-confirmation__summary div {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #faf8f5;
}

.dispatch-confirmation__summary dt {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.dispatch-confirmation__summary dd {
    margin: 5px 0 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.dispatch-confirmation__items h2 {
    font-size: 1.2rem;
}

.dispatch-confirmation__action {
    display: grid;
    gap: 14px;
    margin-top: 22px;
    padding: 18px;
    border: 1px solid #e6c36a;
    border-radius: 8px;
    background: #fff9e8;
}

.dispatch-confirmation__action p {
    margin: 0;
    font-weight: 700;
}

@media (max-width: 720px) {
    .predespacho-qr-panel {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .predespacho-qr-panel .button-link,
    .dispatch-confirmation__action .button-link {
        width: 100%;
    }

    .dispatch-confirmation {
        margin: 10px auto;
        padding: 18px 12px;
        border-radius: 6px;
    }

    .dispatch-confirmation__header h1 {
        font-size: 2.4rem;
    }

    .dispatch-confirmation__summary {
        grid-template-columns: 1fr;
    }
}

@media print {
    body > .auth-topbar,
    body > .brand-logo,
    .page-shell > :not(.dispatch-report) {
        display: none !important;
    }

    .page-shell {
        display: block !important;
        width: 100% !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .page-shell > .dispatch-report,
    .page-shell > .dispatch-report[hidden] {
        display: block !important;
        position: static !important;
        width: 100% !important;
        margin: 0 !important;
        color: #171717;
        font-family: Georgia, 'Times New Roman', serif;
    }

    .dispatch-report__header {
        display: grid;
        grid-template-columns: 110px minmax(0, 1fr) 180px;
        gap: 20px;
        align-items: center;
        padding-bottom: 16px;
        border-bottom: 3px solid #7a1c2e;
    }

    .dispatch-report__header img {
        width: 100px;
        max-height: 72px;
        object-fit: contain;
    }

    .dispatch-report__header p,
    .dispatch-report__header h1 {
        margin: 0 0 4px;
    }

    .dispatch-report__header h1 {
        font-size: 24pt;
        letter-spacing: 0;
    }

    .dispatch-report__header [data-print-qr],
    .dispatch-report__header [data-print-qr] canvas,
    .dispatch-report__header [data-print-qr] img {
        width: 180px !important;
        height: 180px !important;
    }

    .dispatch-report__summary {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 20px;
        margin: 20px 0;
    }

    .dispatch-report__summary div {
        padding: 8px 0;
        border-bottom: 1px solid #c9c2b9;
    }

    .dispatch-report__summary dt {
        font-size: 8pt;
        font-weight: 700;
        text-transform: uppercase;
    }

    .dispatch-report__summary dd {
        margin: 4px 0 0;
        font-size: 11pt;
        font-weight: 700;
    }

    .dispatch-report__wide {
        grid-column: 1 / -1;
    }

    .dispatch-report__items h2 {
        margin: 18px 0 8px;
        font-size: 14pt;
    }

    .dispatch-report__items table {
        width: 100%;
        border-collapse: collapse;
    }

    .dispatch-report__items th,
    .dispatch-report__items td {
        padding: 8px 10px;
        border: 1px solid #aaa29a;
        text-align: left;
    }

    .dispatch-report__items th:last-child,
    .dispatch-report__items td:last-child {
        width: 34%;
        text-align: right;
    }

    .dispatch-report__footer {
        display: flex;
        justify-content: space-between;
        gap: 20px;
        margin-top: 24px;
        padding-top: 10px;
        border-top: 1px solid #aaa29a;
        font-size: 8pt;
    }
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Trebuchet MS', Verdana, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 10%, rgba(162, 26, 22, 0.18), transparent 26%),
        radial-gradient(circle at 88% 8%, rgba(177, 104, 104, 0.24), transparent 30%),
        linear-gradient(135deg, rgba(76, 40, 38, 0.08), transparent 44%),
        var(--bg);
}

.brand-logo {
    position: fixed;
    top: clamp(14px, 2.2vw, 28px);
    left: clamp(14px, 2.2vw, 28px);
    z-index: 20;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(78px, 7vw, 96px);
    min-height: 44px;
    padding: 7px 8px;
    border-radius: 8px;
    background: rgba(255, 250, 240, 0.84);
    border: 1px solid rgba(216, 205, 185, 0.78);
    box-shadow: 0 12px 30px rgba(25, 35, 31, 0.10);
    backdrop-filter: blur(8px);
}

.brand-logo img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 48px;
    object-fit: contain;
}

.page-shell {
    width: min(920px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    place-items: center;
    padding: 48px 0;
}

.page-shell:has(.form-panel),
.page-shell:has(.report-panel),
.page-shell:has(.executive-panel) {
    width: min(80vw, calc(100% - 32px));
    place-items: start center;
    padding: clamp(12px, 1.8vw, 22px) 0 32px;
}

.panel {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: clamp(28px, 6vw, 56px);
    background: rgba(255, 250, 240, 0.88);
    box-shadow: 0 24px 70px rgba(25, 35, 31, 0.14);
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--accent-strong);
    font-family: Verdana, sans-serif;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(2.4rem, 8vw, 5rem);
    line-height: 0.95;
}

.intro {
    max-width: 620px;
    margin: 18px 0 32px;
    color: var(--muted);
    font-family: Verdana, sans-serif;
    font-size: 1rem;
    line-height: 1.7;
}

.status-card {
    display: grid;
    gap: 8px;
    padding: 18px;
    border-left: 5px solid var(--accent);
    border-radius: 6px;
    background: #ffffff;
    font-family: Verdana, sans-serif;
}

.status-card span {
    color: var(--muted);
    font-size: 0.82rem;
}

.status-card strong {
    color: var(--accent-strong);
}

.status-card--success {
    border-left-color: #18705f;
}

.status-card--error {
    border-left-color: #9b332c;
}

.status-card small {
    color: #9b332c;
    overflow-wrap: anywhere;
}

.connection-list {
    display: grid;
    gap: 10px;
    margin: 22px 0;
    font-family: Verdana, sans-serif;
}

.connection-list div {
    display: grid;
    grid-template-columns: minmax(120px, 180px) 1fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.connection-list dt {
    color: var(--muted);
    font-size: 0.85rem;
}

.connection-list dd {
    margin: 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-top: 22px;
    padding: 0 18px;
    border-radius: 6px;
    background: var(--accent);
    color: #ffffff;
    font-family: Verdana, sans-serif;
    font-weight: 700;
    text-decoration: none;
}

.button-link:hover {
    background: var(--accent-strong);
}

.main-menu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 28px;
}

.main-menu--operational {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
}

.menu-section {
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.74);
}

.menu-section--wide {
    grid-column: 1 / -1;
}

.menu-section > span {
    color: var(--muted);
    font-family: Verdana, sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.menu-section h2 {
    margin: 0;
    color: var(--accent-strong);
    font-size: 1.45rem;
}

.menu-section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.menu-section-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.menu-card {
    display: grid;
    gap: 8px;
    min-height: 128px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font-family: Verdana, sans-serif;
    text-decoration: none;
}

.menu-card:hover {
    border-color: var(--accent);
}

.menu-card span {
    color: var(--muted);
    font-size: 0.92rem;
}

.menu-card strong {
    color: var(--accent-strong);
    font-size: 1.35rem;
    line-height: 1.25;
}

.form-panel,
.report-panel {
    max-width: none;
    padding: clamp(22px, 3vw, 36px);
}

.form-panel h1,
.report-panel h1 {
    font-size: clamp(2rem, 4vw, 3.6rem);
    line-height: 1;
    white-space: nowrap;
}

.form-panel .intro,
.report-panel .intro {
    margin: 12px 0 18px;
}

.entry-form {
    display: grid;
    gap: 18px;
    margin-top: 18px;
    font-family: Verdana, sans-serif;
    min-width: 0;
}

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

.entry-form--three-columns {
    grid-template-columns: minmax(240px, 1.2fr) minmax(220px, 1fr) minmax(220px, 1fr);
}

.report-filter.entry-form--three-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
}

.entry-form--two-columns .form-actions--full,
.entry-form--three-columns .form-actions--full {
    grid-column: 1 / -1;
}

.form-field-message {
    grid-column: 1 / -1;
}

.form-field {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.form-field label {
    color: var(--ink);
    font-size: 1.12rem;
    font-weight: 700;
}

.form-field-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.field-add-button {
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #18705f;
    color: #ffffff;
    font: inherit;
    font-size: 1.3rem;
    font-weight: 800;
    cursor: pointer;
}

.field-add-button:hover,
.field-add-button:focus-visible {
    background: #125747;
    outline: 3px solid rgba(24, 112, 95, 0.16);
}

.provider-quick-card {
    width: min(680px, 100%);
}

.provider-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.provider-quick-grid label {
    display: grid;
    gap: 7px;
    color: #4c2826;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.provider-quick-grid input,
.provider-quick-grid textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid rgba(122, 28, 46, 0.25);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    text-transform: none;
}

.provider-quick-wide,
.provider-modal-wide {
    grid-column: 1 / -1;
}

.provider-admin-modal {
    width: min(900px, 100%);
}

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

@media (max-width: 720px) {
    .field-add-button {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
    }

    .provider-quick-grid,
    .provider-modal-grid {
        grid-template-columns: 1fr;
    }

    .provider-quick-wide,
    .provider-modal-wide {
        grid-column: auto;
    }

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

    .provider-admin-page .provider-table,
    .provider-admin-page .provider-table tbody {
        display: grid;
        gap: 12px;
        width: 100%;
    }

    .provider-admin-page .provider-table thead {
        display: none;
    }

    .provider-admin-page .provider-table tr {
        display: grid;
        padding: 14px;
        border: 1px solid rgba(122, 28, 46, 0.18);
        border-top: 4px solid #7a1c2e;
        border-radius: 8px;
        background: #ffffff;
        box-shadow: 0 8px 22px rgba(76, 40, 38, 0.08);
    }

    .provider-admin-page .provider-table td {
        display: grid;
        grid-template-columns: minmax(90px, 34%) minmax(0, 1fr);
        gap: 10px;
        align-items: center;
        padding: 9px 0;
        border-bottom: 1px solid #f0dfdf;
        overflow-wrap: anywhere;
    }

    .provider-admin-page .provider-table td::before {
        content: attr(data-label);
        color: #7a1c2e;
        font-size: 0.72rem;
        font-weight: 800;
        text-transform: uppercase;
    }

    .provider-admin-page .provider-table td:last-child {
        grid-template-columns: 1fr 1fr;
        border-bottom: 0;
    }

    .provider-admin-page .provider-table td:last-child::before {
        grid-column: 1 / -1;
    }

    .provider-admin-page .provider-table .table-actions button {
        width: 100%;
        min-height: 44px;
    }
}

.form-field select,
.form-field input {
    width: 100%;
    min-height: 58px;
    padding: 0 16px;
    border: 2px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    font-size: 1.08rem;
}

.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.searchable-select-input {
    width: 100%;
    min-height: 58px;
    padding: 0 44px 0 16px;
    border: 2px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    font-size: 1.08rem;
}

.searchable-select::after {
    content: "⌕";
    position: absolute;
    top: 17px;
    right: 16px;
    color: #7a1c2e;
    font-size: 1.2rem;
    pointer-events: none;
}

.searchable-select-input:focus {
    outline: none;
    border-color: #7a1c2e;
    box-shadow: 0 0 0 4px rgba(122, 28, 46, 0.12);
}

.searchable-select-list {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 120;
    display: none;
    max-height: 320px;
    overflow-y: auto;
    min-width: 100%;
    max-width: min(92vw, 640px);
    border: 1px solid rgba(122, 28, 46, 0.2);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 20px 42px rgba(76, 40, 38, 0.18);
}

.searchable-select.is-open .searchable-select-list {
    display: grid;
}

.searchable-select-option,
.searchable-select-empty {
    width: 100%;
    min-height: 42px;
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid #f1dddd;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
}

.searchable-select-option {
    cursor: pointer;
}

.searchable-select-option:hover,
.searchable-select-option.is-active {
    background: #fff2f2;
    color: #7a1c2e;
}

.searchable-select-option[aria-selected="true"] {
    background: #7a1c2e;
    color: #ffffff;
}

.searchable-select-empty {
    color: var(--muted);
}

.searchable-select-status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.searchable-select.is-disabled {
    opacity: 0.65;
}

.date-picker-field {
    position: relative;
    display: block;
}

.date-picker-field input[type="text"] {
    min-width: 0;
    padding-right: 62px;
}

.date-picker-button {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    cursor: pointer;
    display: inline-grid;
    place-items: center;
}

.date-picker-button:hover {
    background: var(--accent-strong);
}

.date-picker-button:focus-visible {
    outline: 3px solid rgba(24, 112, 95, 0.24);
    outline-offset: 2px;
}

.date-picker-icon {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.native-date-input {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 1px;
    height: 1px;
    min-height: 1px !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 980px) {
    .report-filter.entry-form--three-columns {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-filter .form-field:first-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .report-filter.entry-form--three-columns {
        grid-template-columns: 1fr;
    }
}

.form-field select:focus,
.form-field input:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(24, 112, 95, 0.18);
}

.form-field select:disabled,
.form-field input:disabled {
    color: var(--muted);
    background: #f3f0e8;
    cursor: not-allowed;
}

.field-help {
    color: var(--muted);
    font-size: 0.92rem;
}

.field-error {
    color: var(--danger);
    font-size: 0.98rem;
    font-weight: 700;
}

.field-warning {
    color: var(--danger);
    font-size: 1rem;
    font-weight: 700;
}

.entry-progress {
    display: grid;
    gap: 10px;
    margin: 18px 0 4px;
    padding: 14px 16px;
    border: 1px solid #e0bd70;
    border-left: 5px solid #c9861a;
    border-radius: 8px;
    background: #fffaf0;
    font-family: Verdana, sans-serif;
}

.entry-progress.is-complete {
    border-color: #9bcbb4;
    border-left-color: #18705f;
    background: #f1f9f5;
}

.entry-progress-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #70470c;
}

.entry-progress.is-complete .entry-progress-heading {
    color: #125747;
}

.entry-progress-heading span {
    flex: 0 0 auto;
    font-size: 0.84rem;
    font-weight: 800;
}

.entry-progress-track {
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #eadfca;
}

.entry-progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #c9861a;
    transition: width 180ms ease;
}

.entry-progress.is-complete .entry-progress-track span {
    background: #18705f;
}

.entry-progress p {
    margin: 0;
    color: #665b59;
    font-size: 0.88rem;
}

.entry-progress ul {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.entry-progress li button {
    min-height: 34px;
    padding: 5px 10px;
    border: 1px solid #e0bd70;
    border-radius: 999px;
    background: #ffffff;
    color: #70470c;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
}

.form-field.is-field-pending select,
.form-field.is-field-pending input,
.form-field.is-field-pending .searchable-select-input {
    border-color: #d2a243;
    background: #fffdf7;
}

.form-field.is-field-invalid select,
.form-field.is-field-invalid input,
.form-field.is-field-invalid .searchable-select-input {
    border-color: #b3261e;
    background: #fff7f6;
}

.form-field.is-field-complete select,
.form-field.is-field-complete input,
.form-field.is-field-complete .searchable-select-input {
    border-color: #65a886;
    background: #f8fcfa;
}

.field-live-status {
    color: #a26a12;
    font-size: 0.78rem;
    font-weight: 800;
}

.is-field-invalid .field-live-status {
    color: #b3261e;
}

.is-field-complete .field-live-status {
    color: #18705f;
}

@media (max-width: 720px) {
    .entry-progress {
        position: sticky;
        top: 8px;
        z-index: 30;
        padding: 12px;
        box-shadow: 0 8px 22px rgba(76, 40, 38, 0.12);
    }

    .entry-progress ul {
        max-height: 82px;
        overflow-y: auto;
    }
}

.message {
    margin: 22px 0;
    padding: 16px 18px;
    border-radius: 8px;
    font-family: Verdana, sans-serif;
    font-size: 1rem;
    font-weight: 700;
}

.message--success {
    border: 1px solid #9bcbb4;
    background: var(--success-bg);
    color: var(--accent-strong);
}

.message--error {
    border: 1px solid #d7a39a;
    background: var(--error-bg);
    color: var(--danger);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.button-link--submit {
    border: 0;
    cursor: pointer;
    font-size: 1rem;
}

.button-link--submit:disabled {
    background: #aab1aa;
    cursor: not-allowed;
    opacity: 0.85;
}

.button-link--secondary {
    background: #ffffff;
    color: var(--accent-strong);
    border: 1px solid var(--line);
}

.button-link--secondary:hover {
    background: #f7f4ec;
}

.report-filter {
    margin-bottom: 24px;
}

.report-export-actions {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 14px;
}

.report-export-actions .button-link,
.report-export-button {
    margin-top: 0;
}

.inventory-report {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    font-family: Verdana, sans-serif;
}

.report-heading {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 1.05rem;
}

.report-heading div {
    min-height: 42px;
    padding: 10px 12px;
    border: 2px solid var(--ink);
    background: #f8f6ef;
}

.report-heading span {
    color: var(--ink);
    font-weight: 700;
    text-transform: uppercase;
}

.report-table-wrap {
    overflow-x: auto;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

.report-table th,
.report-table td {
    padding: 12px;
    border: 2px solid var(--ink);
    text-align: left;
    vertical-align: top;
}

.report-table th {
    background: #e9e4d8;
    color: var(--ink);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.report-table td:nth-child(3),
.report-table td:nth-child(4),
.report-table td:nth-child(5),
.report-table td:nth-child(6) {
    text-align: right;
    font-weight: 700;
}

.report-table tbody .report-row--entrada {
    background: #edf8ef;
}

.report-table tbody .report-row--predespacho {
    background: #fff9e6;
}

.report-table tbody .report-row--salida {
    background: #fff0f0;
}

.report-table tbody .report-row--summary {
    background: #e8f3ff;
    font-weight: 700;
}

.report-export-button--excel {
    background: #18794e;
}

.lot-balance-filter {
    display: grid;
    gap: 16px;
    margin: 22px 0 24px;
}

.lot-product-picker {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.lot-product-picker__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    background: #f8f6ef;
}

.lot-product-picker__header div {
    display: grid;
    gap: 3px;
}

.lot-product-picker__header label {
    font-weight: 800;
}

.lot-product-picker__header span {
    color: var(--muted);
    font-size: 0.86rem;
}

.lot-picker-clear {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--accent-strong);
    background: #fff;
    cursor: pointer;
    font-weight: 700;
}

.lot-product-search {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 2px solid var(--line);
    border-radius: 6px;
}

.lot-product-combobox {
    position: relative;
    margin: 12px;
}

.lot-product-results {
    position: absolute;
    z-index: 20;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 14px 30px rgba(76, 40, 38, 0.16);
}

.lot-product-result {
    display: block;
    width: 100%;
    padding: 11px 12px;
    border: 0;
    border-bottom: 1px solid #ece8df;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
}

.lot-product-result:hover,
.lot-product-result:focus {
    background: #f5faf7;
    outline: none;
}

.lot-product-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 18px;
    max-height: 138px;
    padding: 0 12px 12px;
    overflow-y: auto;
}

.lot-product-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    padding: 7px 8px 7px 10px;
    border: 1px solid #9dc9b2;
    border-radius: 6px;
    background: #eef8f2;
    color: #135c3d;
    font-size: 0.86rem;
    font-weight: 700;
}

.lot-product-chip > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lot-product-chip button {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #135c3d;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}

.lot-product-chip button:hover {
    background: #dcefe4;
}

.lot-product-empty {
    margin: 0;
    padding: 14px;
    text-align: center;
    color: var(--muted);
}

.entry-silo-allocation {
    grid-column: 1 / -1;
    padding: 18px;
    border: 2px solid #18794e;
    border-radius: 8px;
    background: #f3f8f5;
}

.entry-silo-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 8px;
}

.entry-silo-heading span,
.silo-assignment-summary span {
    color: #18794e;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.entry-silo-heading h2 {
    margin: 3px 0 0;
    font-size: 1.25rem;
}

.entry-silo-allocation > p {
    color: var(--muted);
}

.silo-assignment-rows {
    display: grid;
    gap: 9px;
    margin: 14px 0;
}

.silo-assignment-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.35fr) 42px;
    gap: 9px;
}

.silo-assignment-row select,
.silo-assignment-row input {
    width: 100%;
    min-height: 44px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.silo-assignment-row button {
    border: 1px solid #d9a4a4;
    border-radius: 6px;
    background: #fff;
    color: #9f2424;
    cursor: pointer;
    font-size: 1.35rem;
}

.silo-entry-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    margin-top: 12px;
    font-size: 0.9rem;
}

.silo-entry-totals [data-silo-status] {
    color: #a35b00;
    font-weight: 800;
}

.silo-entry-totals [data-silo-status].is-complete {
    color: #18794e;
}

.silo-level {
    display: block;
    width: 120px;
    height: 6px;
    margin-top: 6px;
    overflow: hidden;
    border-radius: 3px;
    background: #e6e1d8;
}

.silo-level i {
    display: block;
    height: 100%;
    background: #18794e;
}

.silo-visual-report {
    margin: 24px 0 28px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8f6ef;
}

.silo-visual-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.silo-visual-heading h2 {
    margin: 4px 0 0;
    color: var(--ink);
    font-size: 1.45rem;
}

.silo-visual-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 14px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.silo-visual-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.silo-visual-legend i {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.silo-visual-legend .is-available,
.silo-vessel.is-available .silo-vessel-fill {
    background: #23855b;
}

.silo-visual-legend .is-warning,
.silo-vessel.is-warning .silo-vessel-fill {
    background: #d48b18;
}

.silo-visual-legend .is-critical,
.silo-vessel.is-critical .silo-vessel-fill {
    background: #b43a32;
}

.silo-visual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}

.silo-visual-card {
    display: grid;
    grid-template-rows: auto 230px auto auto;
    gap: 12px;
    min-width: 0;
    padding: 16px;
    border: 1px solid #d9d2c4;
    border-radius: 8px;
    background: #fff;
}

.silo-visual-card.is-inactive {
    opacity: 0.58;
}

.silo-visual-code {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.silo-visual-code span {
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.silo-visual-code strong {
    color: var(--accent-strong);
    font-size: 1.15rem;
}

.silo-vessel {
    position: relative;
    width: 112px;
    height: 218px;
    margin: 0 auto;
}

.silo-vessel-cap {
    position: absolute;
    z-index: 3;
    top: 0;
    left: 8px;
    width: 96px;
    height: 25px;
    border: 4px solid #596069;
    border-radius: 50%;
    background: #eef0f1;
}

.silo-vessel-body {
    position: absolute;
    z-index: 2;
    top: 12px;
    left: 8px;
    width: 96px;
    height: 150px;
    overflow: hidden;
    border: 4px solid #596069;
    border-top: 0;
    background: #eef0f1;
}

.silo-vessel-fill {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    min-height: 0;
    opacity: 0.9;
}

.silo-vessel.is-empty .silo-vessel-fill {
    background: #cbd0d3;
}

.silo-vessel-percent,
.silo-vessel-quantity {
    position: absolute;
    z-index: 4;
    right: 5px;
    left: 5px;
    text-align: center;
    text-shadow: 0 1px 2px #fff;
}

.silo-vessel-percent {
    top: 42px;
    color: #26323a;
    font-size: 1.28rem;
    font-weight: 900;
}

.silo-vessel-quantity {
    bottom: 13px;
    padding: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.84);
    color: #26323a;
    font-size: 0.72rem;
    font-weight: 800;
}

.silo-vessel-hopper {
    position: absolute;
    z-index: 1;
    top: 160px;
    left: 18px;
    width: 76px;
    height: 36px;
    background: #596069;
    clip-path: polygon(0 0, 100% 0, 62% 100%, 38% 100%);
}

.silo-vessel-legs {
    position: absolute;
    right: 24px;
    bottom: 0;
    left: 24px;
    display: flex;
    justify-content: space-between;
}

.silo-vessel-legs i {
    width: 7px;
    height: 30px;
    background: #596069;
}

.silo-visual-product {
    display: grid;
    gap: 4px;
    min-height: 54px;
    text-align: center;
}

.silo-visual-product span,
.silo-visual-values dt {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.silo-visual-product strong {
    overflow-wrap: anywhere;
    color: var(--ink);
    line-height: 1.3;
}

.silo-visual-values {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}

.silo-visual-values div {
    min-width: 0;
    padding: 8px;
    border-top: 1px solid var(--line);
}

.silo-visual-values dd {
    margin: 3px 0 0;
    overflow-wrap: anywhere;
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 800;
}

.silo-pending-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.silo-pending-section h2 {
    margin: 4px 0 14px;
}

.silo-pending-list {
    display: grid;
    gap: 10px;
}

.silo-pending-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 18px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.silo-pending-item > div {
    display: grid;
    gap: 3px;
}

.silo-pending-item span {
    color: var(--muted);
    font-size: 0.82rem;
}

.silo-assignment-summary {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    border-left: 4px solid #18794e;
    background: #f3f8f5;
}

@media (max-width: 760px) {
    .silo-visual-report {
        padding: 14px;
    }

    .silo-visual-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .silo-visual-legend {
        justify-content: flex-start;
    }

    .silo-visual-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .silo-visual-card {
        grid-template-rows: auto 205px auto auto;
        padding: 11px;
    }

    .silo-vessel {
        transform: scale(0.9);
        transform-origin: top center;
    }

    .silo-visual-code {
        align-items: flex-start;
        flex-direction: column-reverse;
    }

    .silo-visual-values {
        grid-template-columns: 1fr;
    }

    .entry-silo-heading,
    .silo-pending-item {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .entry-silo-heading {
        display: grid;
    }

    .silo-assignment-row {
        grid-template-columns: minmax(0, 1fr) 42px;
    }

    .silo-assignment-row select {
        grid-column: 1 / -1;
    }

    .silo-table td {
        overflow-wrap: anywhere;
    }
}

.lot-balance-actions {
    margin: 0;
}

.lot-balance-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.lot-balance-summary div {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border-left: 4px solid #18794e;
    background: #f3f8f5;
}

.lot-balance-summary span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.lot-balance-summary strong {
    color: var(--ink);
    font-size: 1.35rem;
}

.lot-balance-table {
    min-width: 1320px;
}

.lot-balance-table td:nth-child(n + 6) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.lot-balance-table td small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

@media (max-width: 760px) {
    .lot-balance-panel h1 {
        font-size: 2rem;
        white-space: normal;
    }

    .lot-product-picker__header {
        align-items: flex-start;
    }

    .lot-product-chip {
        width: 100%;
        justify-content: space-between;
    }

    .lot-balance-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lot-balance-table {
        min-width: 0;
    }

    .lot-balance-table thead {
        display: none;
    }

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

    .lot-balance-table tr {
        margin-bottom: 12px;
        border: 1px solid var(--line);
        border-radius: 6px;
        overflow: hidden;
    }

    .lot-balance-table td,
    .lot-balance-table td:nth-child(n + 6) {
        display: grid;
        grid-template-columns: minmax(105px, 0.75fr) minmax(0, 1.25fr);
        gap: 12px;
        padding: 9px 11px;
        border: 0;
        border-bottom: 1px solid #ece8df;
        text-align: right;
    }

    .lot-balance-table td::before {
        content: attr(data-label);
        color: var(--muted);
        text-align: left;
        font-size: 0.78rem;
        font-weight: 700;
        text-transform: uppercase;
    }

    .lot-balance-report .report-pagination-toolbar,
    .lot-balance-report .report-pagination {
        align-items: stretch;
        flex-direction: column;
    }

    .lot-balance-report .report-per-page-form {
        justify-content: space-between;
    }

    .lot-balance-report .report-pagination-pages {
        justify-content: center;
        flex-wrap: wrap;
    }
}

.report-pagination-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.report-pagination-summary {
    color: var(--muted);
    font-weight: 600;
}

.report-per-page-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-per-page-form label {
    color: var(--muted);
    font-weight: 600;
}

.report-per-page-form select {
    min-height: 40px;
    padding: 0 10px;
    border: 2px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.report-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
}

.report-pagination-pages {
    display: flex;
    align-items: center;
    gap: 6px;
}

.report-page-link {
    min-width: 34px;
    height: 34px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
    text-align: center;
    font-weight: 700;
    background: #fff;
}

.report-page-link.is-active {
    border-color: #7a1c2e;
    background: #7a1c2e;
    color: #fff;
}

.report-page-dots {
    color: var(--muted);
    font-weight: 700;
    padding: 0 6px;
}

.button-link.is-disabled {
    pointer-events: none;
    opacity: 0.5;
}

.report-print-header,
.report-print-footer {
    display: none;
}

.report-print-header {
    border: 1px solid #d8d2c6;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    background: #faf8f2;
}

.report-print-header .print-brand {
    font-size: 1rem;
    font-weight: 800;
    color: #3b2b25;
}

.report-print-header .print-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-top: 3px;
    color: #1f1f1f;
}

.report-print-header .print-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 12px;
    margin-top: 8px;
    color: #40352f;
    font-size: 0.92rem;
}

.report-print-footer {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #d8d2c6;
    color: #5f5751;
    font-size: 0.84rem;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 12mm;
    }

    body {
        background: #ffffff !important;
        color: #000000;
    }

    body:has(.auth-topbar) {
        padding-top: 0 !important;
    }

    .brand-logo,
    .auth-topbar,
    .report-panel .eyebrow,
    .report-panel .intro,
    .report-filter,
    .report-pagination-toolbar,
    .report-pagination,
    .report-export-actions,
    .message,
    .button-link {
        display: none !important;
    }

    .report-print-header,
    .report-print-footer {
        display: block !important;
    }

    .report-print-footer {
        display: flex !important;
        page-break-inside: avoid;
    }

    .page-shell,
    .page-shell:has(.report-panel) {
        width: 100% !important;
        min-height: 0;
        display: block;
        padding: 0;
        margin: 0;
    }

    .panel,
    .report-panel {
        width: 100%;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: #ffffff !important;
        box-shadow: none;
    }

    .report-panel h1 {
        margin-bottom: 8px;
        color: #000000;
        font-size: 18pt;
        white-space: normal;
    }

    .inventory-report {
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: #ffffff;
        color: #000000;
        box-shadow: none;
    }

    .report-heading {
        grid-template-columns: 1.4fr 1fr;
        gap: 6px;
        margin-bottom: 10px;
        font-size: 10pt;
    }

    .report-heading div {
        min-height: 0;
        padding: 7px 8px;
        border: 1px solid #000000;
        background: #ffffff !important;
    }

    .report-table-wrap {
        overflow: visible;
    }

    .report-table {
        min-width: 0;
        width: 100%;
        page-break-inside: auto;
    }

    .report-table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    .report-table tbody .report-row--entrada,
    .report-table tbody .report-row--predespacho,
    .report-table tbody .report-row--salida,
    .report-table tbody .report-row--summary {
        background: inherit !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .report-table tbody .report-row--entrada {
        background: #edf8ef !important;
    }

    .report-table tbody .report-row--predespacho {
        background: #fff9e6 !important;
    }

    .report-table tbody .report-row--salida {
        background: #fff0f0 !important;
    }

    .report-table tbody .report-row--summary {
        background: #e8f3ff !important;
    }

    .report-table th,
    .report-table td {
        padding: 7px 8px;
        border: 1px solid #000000;
        color: #000000;
        font-size: 9pt;
    }

    .report-table th {
        background: #e9e4d8 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

.executive-panel {
    background: rgba(255, 250, 240, 0.94);
}

.executive-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 24px 0 16px;
}

.metric-card,
.insight-band,
.chart-card,
.risk-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    font-family: Verdana, sans-serif;
    box-shadow: 0 12px 34px rgba(25, 35, 31, 0.08);
}

.metric-card {
    display: grid;
    gap: 8px;
    min-height: 154px;
    padding: 18px;
}

.metric-card--primary {
    background: #e8f5ee;
    border-color: #9bcbb4;
}

.metric-card span,
.insight-band span {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
    text-transform: uppercase;
}

.metric-card strong,
.insight-band strong {
    color: var(--accent-strong);
    font-size: clamp(1.7rem, 3vw, 2.5rem);
    line-height: 1;
}

.metric-card small,
.insight-band small {
    color: var(--muted);
    line-height: 1.45;
}

.insight-band {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    overflow: hidden;
}

.insight-band div {
    display: grid;
    gap: 8px;
    padding: 18px;
    border-right: 1px solid var(--line);
}

.insight-band div:last-child {
    border-right: 0;
}

.chart-card {
    margin-top: 16px;
    padding: 20px;
    min-width: 0;
    overflow: hidden;
}

.chart-title {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    margin-bottom: 14px;
}

.chart-title h2,
.risk-panel h2 {
    margin: 0;
    font-size: 1.25rem;
}

.chart-title p,
.quiet-text {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.bar-chart {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(34px, 1fr);
    gap: 10px;
    align-items: end;
    min-height: 220px;
    padding: 18px 6px 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, #fbfaf5, #f3f0e8);
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
}

.bar-day {
    display: grid;
    gap: 8px;
    justify-items: center;
    align-items: end;
}

.bar-pair {
    display: flex;
    gap: 4px;
    align-items: end;
    height: 160px;
}

.bar {
    display: block;
    width: 12px;
    min-height: 4px;
    border-radius: 4px 4px 0 0;
}

.bar--entrada {
    background: #18705f;
}

.bar--salida {
    background: #c35f34;
}

.bar-day small {
    color: var(--muted);
    font-size: 0.72rem;
}

.chart-legend {
    display: flex;
    gap: 18px;
    margin-top: 12px;
    color: var(--muted);
    font-family: Verdana, sans-serif;
    font-weight: 700;
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 6px;
    border-radius: 50%;
}

.legend-dot--entrada {
    background: #18705f;
}

.legend-dot--salida {
    background: #c35f34;
}

.risk-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.risk-panel {
    padding: 20px;
}

.risk-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.risk-item {
    display: grid;
    gap: 6px;
    padding: 14px;
    border-left: 5px solid #c35f34;
    border-radius: 6px;
    background: #fff7f1;
}

.risk-item strong {
    color: var(--ink);
}

.risk-item span {
    color: var(--danger);
    font-weight: 700;
}

.risk-item small {
    color: var(--muted);
}

.lot-analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 24px 0 16px;
}

.lot-analytics-grid--inside-group {
    margin: 0;
}

.lot-analytics-card {
    display: grid;
    gap: 14px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    font-family: Verdana, sans-serif;
    box-shadow: 0 12px 34px rgba(25, 35, 31, 0.08);
}

.lot-analytics-card--risk {
    border-color: #d7a39a;
    background: #fff7f1;
}

.lot-analytics-card > span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.lot-analytics-card h2 {
    margin: 0;
    color: var(--accent-strong);
    font-size: 1.55rem;
}

.lot-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.lot-metrics div {
    display: grid;
    gap: 6px;
    min-height: 96px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfaf5;
}

.lot-metrics small,
.lot-analytics-card > small {
    color: var(--muted);
}

.lot-metrics strong {
    color: var(--ink);
    font-size: 1.25rem;
    line-height: 1.1;
}

.lot-analytics-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.product-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.product-summary-grid--inside-group {
    margin-top: 0;
}

.product-lot-groups {
    display: grid;
    gap: 18px;
    margin-top: 20px;
}

.product-lot-group {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 12px 34px rgba(25, 35, 31, 0.06);
}

.product-lot-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
    font-family: Verdana, sans-serif;
}

.product-lot-header span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.product-lot-header h2 {
    margin: 4px 0 0;
    color: var(--accent-strong);
    font-size: clamp(1.45rem, 3vw, 2.2rem);
    line-height: 1.1;
}

.product-detail-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}

.product-detail-link:hover {
    color: var(--accent);
}

.product-detail-link i {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #e8f5ee;
    color: #18705f;
    font-family: Verdana, sans-serif;
    font-size: 1rem;
    font-style: normal;
    line-height: 1;
}

.product-detail-link:hover i {
    background: #18705f;
    color: #ffffff;
}

.product-lot-header strong {
    min-width: max-content;
    padding: 10px 12px;
    border-radius: 999px;
    background: #e8f5ee;
    color: var(--accent-strong);
    font-size: 0.92rem;
}

.product-summary-card {
    display: grid;
    gap: 14px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    font-family: Verdana, sans-serif;
    box-shadow: 0 12px 34px rgba(25, 35, 31, 0.08);
}

.product-summary-card--risk {
    border-color: #d7a39a;
    background: #fff7f1;
}

.product-summary-card > span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.product-summary-card h2 {
    margin: 0;
    color: var(--accent-strong);
    font-size: 1.35rem;
    line-height: 1.2;
}

.product-summary-card dl {
    display: grid;
    gap: 10px;
    margin: 0;
}

.product-summary-card dl div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.product-summary-card dt {
    color: var(--muted);
}

.product-summary-card dd {
    margin: 0;
    color: var(--ink);
    font-weight: 700;
    text-align: right;
}

.correction-panel .intro {
    max-width: 780px;
}

.correction-actions {
    margin: 18px 0 22px;
}

.correction-list {
    display: grid;
    gap: 18px;
}

.entry-form-fieldset {
    display: contents;
}

.correction-card {
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid rgba(177, 104, 104, 0.28);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 16px 38px rgba(76, 40, 38, 0.10);
    font-family: Verdana, sans-serif;
}

.correction-card-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.correction-card-header div {
    display: grid;
    gap: 5px;
}

.correction-card-header span,
.correction-card-header small,
.correction-summary dt {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.correction-card-header strong {
    color: var(--accent-strong);
    font-size: 1.25rem;
}

.correction-grid {
    display: grid;
    gap: 14px;
}

.correction-grid--entrada {
    grid-template-columns: 1.4fr 1fr 1fr 1fr 0.8fr;
}

.correction-grid--salida {
    grid-template-columns: 1.7fr 1fr 0.8fr;
}

.correction-grid label {
    display: grid;
    gap: 8px;
    min-width: 0;
    color: var(--accent-strong);
    font-size: 0.9rem;
    font-weight: 700;
}

.correction-grid input,
.correction-grid select {
    width: 100%;
    min-height: 48px;
    padding: 0 12px;
    border: 1px solid rgba(177, 104, 104, 0.38);
    border-radius: 10px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
}

.correction-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.correction-summary div {
    display: grid;
    gap: 4px;
    padding: 12px;
    border-radius: 10px;
    background: #fff6f6;
}

.correction-table-page {
    position: relative;
    overflow: visible;
}

.correction-table-page .correction-server-message {
    display: none;
}

.filter-toggle {
    display: none;
    width: 100%;
    min-height: 46px;
    margin: 10px 0 14px;
    border: 1px solid rgba(122, 28, 46, 0.28);
    border-radius: 12px;
    background: #fff8f8;
    color: #7a1c2e;
    font-weight: 800;
}

.correction-filters {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(145px, 1fr)) auto auto;
    gap: 12px;
    align-items: end;
    padding: 16px;
    border: 1px solid rgba(122, 28, 46, 0.14);
    border-radius: 16px;
    background: #fffafa;
    box-shadow: 0 12px 32px rgba(76, 40, 38, 0.08);
}

.correction-filters label,
.correction-modal-grid label {
    display: grid;
    gap: 7px;
    min-width: 0;
    color: #4c2826;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.correction-filters input,
.correction-filters select,
.correction-modal-grid input,
.correction-modal-grid select,
.correction-modal-grid textarea {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid rgba(122, 28, 46, 0.25);
    border-radius: 10px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.correction-filters input:focus,
.correction-filters select:focus,
.correction-modal-grid input:focus,
.correction-modal-grid select:focus,
.correction-modal-grid textarea:focus {
    outline: none;
    border-color: #7a1c2e;
    box-shadow: 0 0 0 3px rgba(122, 28, 46, 0.12);
}

.correction-modal-grid .is-invalid {
    border-color: #b3261e;
    background: #fff4f2;
}

.filter-clear {
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid rgba(122, 28, 46, 0.25);
    border-radius: 10px;
    background: #ffffff;
    color: #7a1c2e;
    font-weight: 800;
    cursor: pointer;
}

.filter-count {
    align-self: center;
    color: #7a1c2e;
    white-space: nowrap;
}

.correction-table-shell {
    width: 100%;
    margin-top: 18px;
    overflow-x: auto;
    border: 1px solid rgba(122, 28, 46, 0.14);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 16px 42px rgba(76, 40, 38, 0.10);
}

.correction-table {
    width: 100%;
    min-width: 1040px;
    border-collapse: separate;
    border-spacing: 0;
    font-family: Verdana, sans-serif;
}

.correction-table th,
.correction-table td {
    padding: 13px 12px;
    border-bottom: 1px solid #f0dddd;
    color: var(--ink);
    font-size: 0.88rem;
    text-align: left;
    vertical-align: middle;
}

.correction-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #7a1c2e;
    color: #ffffff;
}

.correction-table th button {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.correction-table tbody tr {
    transition: background 160ms ease, transform 160ms ease;
}

.correction-table tbody tr:hover {
    background: #fff6f6;
}

.correction-table tbody tr.is-risk-row {
    background: #fff0ef;
}

.correction-table tbody tr.is-risk-row:hover {
    background: #ffe6e3;
}

.correction-table td strong {
    color: #4c2826;
}

.actions-column {
    position: sticky;
    right: 0;
    z-index: 3;
    min-width: 142px;
    background: inherit;
    box-shadow: -8px 0 14px rgba(76, 40, 38, 0.06);
    text-align: center !important;
}

th.actions-column {
    background: #7a1c2e;
}

.icon-action {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    margin: 0 2px;
    border: 0;
    border-radius: 10px;
    color: #ffffff;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.icon-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(76, 40, 38, 0.18);
}

.icon-action--edit {
    background: #2563eb;
}

.icon-action--email {
    background: #17643a;
    font-size: 1.15rem;
}

.icon-action--delete {
    background: #b3261e;
}

.table-actions .is-disabled-action,
.table-actions .is-disabled-action:hover {
    background: #ece7e8;
    color: #8b8083;
    cursor: not-allowed;
    opacity: 0.65;
    transform: none;
}

.stock-pill {
    display: inline-flex;
    min-width: 74px;
    justify-content: center;
    padding: 6px 9px;
    border-radius: 999px;
    background: #eef8f2;
    color: #17613f;
    font-weight: 800;
}

.stock-pill--risk {
    background: #ffe1df;
    color: #9d1c16;
}

.correction-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-top: 16px;
    color: #4c2826;
    font-weight: 700;
}

.correction-pagination label {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.correction-pagination select {
    min-height: 38px;
    border: 1px solid rgba(122, 28, 46, 0.25);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
}

.pagination-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pagination-button,
.pagination-dots {
    min-height: 36px;
    min-width: 36px;
    padding: 0 10px;
    border: 1px solid rgba(122, 28, 46, 0.22);
    border-radius: 9px;
    background: #ffffff;
    color: #7a1c2e;
    font-weight: 800;
}

.pagination-button:not(:disabled) {
    cursor: pointer;
}

.pagination-button.is-active {
    background: #7a1c2e;
    color: #ffffff;
}

.pagination-button:disabled {
    opacity: 0.45;
}

.correction-modal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9999;
    display: grid !important;
    place-items: center;
    padding: 22px;
    background: rgba(30, 14, 20, 0.52);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
}

.correction-modal[hidden] {
    display: none !important;
}

.correction-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.correction-modal-card {
    display: grid;
    gap: 18px;
    width: min(760px, 100%);
    max-height: min(86vh, 820px);
    overflow-y: auto;
    padding: clamp(18px, 3vw, 28px);
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 28px 80px rgba(30, 14, 20, 0.34);
    transform: translateY(18px) scale(0.98);
    transition: transform 180ms ease;
}

body.modal-is-open {
    overflow: hidden;
}

.correction-modal.is-open .correction-modal-card {
    transform: translateY(0) scale(1);
}

.correction-modal-card header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    padding-bottom: 12px;
    border-bottom: 1px solid #efdada;
}

.correction-modal-card h2 {
    margin: 0;
    color: #7a1c2e;
    font-size: clamp(1.4rem, 3vw, 2rem);
}

.correction-modal-card p {
    margin: 6px 0 0;
    color: var(--muted);
    font-weight: 700;
}

.modal-close {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: #f7eeee;
    color: #7a1c2e;
    font-size: 1.5rem;
    cursor: pointer;
}

.correction-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.correction-modal-grid .correction-field--full {
    grid-column: 1 / -1;
}

.correction-modal-grid textarea {
    min-height: 88px;
    padding: 10px 12px;
    resize: vertical;
}

.correction-modal-grid label > small {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: none;
}

.document-fields {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding-top: 4px;
}

.document-fields > small {
    grid-column: 1 / -1;
    color: var(--muted);
}

.document-current {
    min-height: 20px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: none;
}

.document-current a {
    color: #7a1c2e;
    overflow-wrap: anywhere;
}

@media (max-width: 760px) {
    .document-fields {
        grid-template-columns: 1fr;
    }
}

.form-field input[type="file"],
.correction-modal-grid input[type="file"] {
    height: auto;
    padding: 10px 12px;
}

.modal-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.modal-summary div {
    padding: 14px;
    border-radius: 12px;
    background: #fff6f6;
}

.modal-summary dt {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.modal-summary dd {
    margin: 5px 0 0;
    color: #7a1c2e;
    font-size: 1.3rem;
    font-weight: 900;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.button-link--danger {
    background: #b3261e;
    color: #ffffff;
}

.button-link.is-loading,
.button-link--danger.is-loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.button-link.is-loading::after,
.button-link--danger.is-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 18px;
    height: 18px;
    margin: auto;
    border: 3px solid rgba(255, 255, 255, 0.45);
    border-top-color: #ffffff;
    border-radius: 999px;
    animation: spin 700ms linear infinite;
}

.correction-confirm-card {
    width: min(460px, 100%);
    text-align: center;
}

.warning-icon {
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    margin: 0 auto;
    border-radius: 999px;
    background: #fff1d6;
    color: #c9861a;
    font-size: 2rem;
}

.correction-toast-host {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 130;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100vw - 28px));
}

.correction-toast {
    padding: 14px 16px;
    border-radius: 12px;
    background: #17613f;
    color: #ffffff;
    box-shadow: 0 18px 36px rgba(30, 14, 20, 0.2);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.correction-toast--error {
    background: #b3261e;
}

.correction-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 980px) {
    .correction-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-count {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .filter-toggle {
        display: block;
    }

    .correction-filters {
        display: none;
        grid-template-columns: 1fr;
    }

    .correction-filters.is-open {
        display: grid;
    }

    .correction-table-shell {
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .correction-table,
    .correction-table thead,
    .correction-table tbody,
    .correction-table tr,
    .correction-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .correction-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .correction-table tbody {
        display: grid;
        gap: 10px;
    }

    .correction-table tbody tr {
        display: grid;
        grid-template-columns: 54px 1fr auto;
        gap: 4px 10px;
        align-items: center;
        padding: 12px;
        border: 1px solid rgba(122, 28, 46, 0.14);
        border-radius: 14px;
        background: #ffffff;
        box-shadow: 0 10px 26px rgba(76, 40, 38, 0.08);
    }

    .correction-table tbody tr.is-risk-row {
        background: #fff0ef;
    }

    .correction-table td {
        padding: 0;
        border: 0;
        font-size: 0.84rem;
    }

    .correction-table td::before {
        content: attr(data-label) ": ";
        color: var(--muted);
        font-weight: 800;
    }

    .correction-table td:nth-child(1) {
        grid-row: 1 / 3;
        display: grid;
        place-items: center;
        width: 46px;
        height: 46px;
        border-radius: 12px;
        background: #7a1c2e;
        color: #ffffff;
        font-weight: 900;
    }

    .correction-table td:nth-child(1)::before,
    .correction-table td:nth-child(3)::before,
    .correction-table .actions-column::before {
        display: none;
    }

    .correction-table td:nth-child(2),
    .correction-table td:nth-child(4),
    .correction-table td:nth-child(5),
    .correction-table td:nth-child(6),
    .correction-table td:nth-child(7),
    .correction-table td:nth-child(8),
    .correction-table td:nth-child(9) {
        grid-column: 2 / 4;
        display: none;
    }

    .correction-table td:nth-child(3) {
        grid-column: 2 / 3;
        min-width: 0;
    }

    .correction-table td:nth-child(3) strong {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .correction-table .actions-column {
        position: static;
        grid-column: 3 / 4;
        grid-row: 1 / 3;
        min-width: 88px;
        box-shadow: none;
        text-align: right !important;
    }

    .icon-action {
        width: 36px;
        height: 36px;
        margin: 0 0 0 4px;
    }

    .correction-pagination {
        align-items: stretch;
    }

    .correction-pagination label,
    .correction-pagination > span,
    .pagination-buttons {
        width: 100%;
    }

    .pagination-buttons {
        justify-content: center;
    }

    .correction-modal {
        padding: 12px;
        place-items: center;
    }

    .correction-modal-card {
        max-height: 92vh;
        border-radius: 18px;
    }

    .correction-modal-grid,
    .modal-summary {
        grid-template-columns: 1fr;
    }

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

.correction-summary dd {
    margin: 0;
    color: var(--accent-strong);
    font-weight: 700;
}

.correction-card-actions {
    justify-content: flex-end;
}

@media screen {
    .brand-logo {
        background: rgba(255, 255, 255, 0.9);
        border-color: rgba(177, 104, 104, 0.36);
        box-shadow: 0 18px 42px rgba(76, 40, 38, 0.18);
    }

    .panel:not(.salida-panel) {
        position: relative;
        overflow: hidden;
        border: 1px solid rgba(177, 104, 104, 0.28);
        border-radius: 18px;
        background:
            linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 248, 248, 0.88)),
            radial-gradient(circle at top right, rgba(162, 26, 22, 0.14), transparent 34%);
        box-shadow: 0 30px 80px rgba(76, 40, 38, 0.18);
    }

    .panel.report-panel:not(.salida-panel) {
        overflow: visible;
    }

    .report-panel .form-field,
    .report-panel .searchable-select {
        overflow: visible;
    }

    .report-panel .searchable-select {
        z-index: 10;
    }

    .report-panel .searchable-select.is-open {
        z-index: 250;
    }

    .panel:not(.salida-panel)::before {
        content: "";
        position: absolute;
        inset: 0 0 auto;
        height: 7px;
        background: linear-gradient(90deg, #4c2826, #a21a16 48%, #b16868);
    }

    .panel:not(.salida-panel) > * {
        position: relative;
        z-index: 1;
    }

    .eyebrow {
        display: inline-flex;
        align-items: center;
        width: fit-content;
        padding: 7px 11px;
        border: 1px solid rgba(162, 26, 22, 0.18);
        border-radius: 999px;
        background: rgba(162, 26, 22, 0.08);
        color: var(--accent);
        font-size: 0.72rem;
    }

    .panel:not(.salida-panel) h1 {
        color: var(--accent-strong);
        letter-spacing: 0;
        text-wrap: balance;
    }

    .intro {
        color: #665b59;
    }

    .main-menu {
        grid-template-columns: repeat(2, minmax(230px, 1fr));
        gap: 18px;
    }

    .menu-card {
        position: relative;
        overflow: hidden;
        min-height: 154px;
        padding: 24px;
        border: 1px solid rgba(177, 104, 104, 0.30);
        border-radius: 16px;
        background:
            linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(255, 245, 244, 0.9)),
            radial-gradient(circle at top right, rgba(162, 26, 22, 0.18), transparent 38%);
        box-shadow: 0 18px 42px rgba(76, 40, 38, 0.12);
        transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
    }

    .menu-card::after {
        content: "";
        position: absolute;
        right: 18px;
        bottom: 18px;
        width: 34px;
        height: 34px;
        border-right: 3px solid var(--accent);
        border-bottom: 3px solid var(--accent);
        opacity: 0.32;
        transform: rotate(-45deg);
    }

    .menu-card:hover {
        transform: translateY(-4px);
        border-color: rgba(162, 26, 22, 0.48);
        box-shadow: 0 26px 60px rgba(76, 40, 38, 0.18);
    }

    .menu-card span,
    .metric-card span,
    .insight-band span,
    .lot-analytics-card > span,
    .product-summary-card > span,
    .product-lot-header span {
        color: var(--muted);
        letter-spacing: 0.02em;
    }

    .menu-card strong {
        color: var(--accent-strong);
        font-size: clamp(1.35rem, 2.6vw, 1.85rem);
    }

    .status-card,
    .inventory-report,
    .metric-card,
    .insight-band,
    .chart-card,
    .risk-panel,
    .lot-analytics-card,
    .product-summary-card,
    .product-lot-group {
        border-color: rgba(177, 104, 104, 0.28);
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.88);
        box-shadow: 0 18px 44px rgba(76, 40, 38, 0.10);
    }

    .form-panel:not(.salida-panel) .entry-form,
    .report-filter {
        padding: 18px;
        border: 1px solid rgba(177, 104, 104, 0.24);
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.68);
    }

    .form-field label {
        color: var(--accent-strong);
        font-size: 0.98rem;
    }

    .form-field select,
    .form-field input {
        border: 1px solid rgba(177, 104, 104, 0.38);
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }

    .form-field select:focus,
    .form-field input:focus {
        border-color: var(--accent);
        outline: 4px solid rgba(162, 26, 22, 0.14);
    }

    .button-link {
        min-height: 48px;
        margin-top: 0;
        padding: 0 22px;
        border: 1px solid transparent;
        border-radius: 12px;
        background: linear-gradient(135deg, var(--accent), #7f1512);
        box-shadow: 0 14px 28px rgba(162, 26, 22, 0.20);
        transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
    }

    .button-link:hover {
        transform: translateY(-1px);
        background: linear-gradient(135deg, #b51f1a, var(--accent-strong));
        box-shadow: 0 18px 36px rgba(76, 40, 38, 0.24);
    }

    .button-link--secondary {
        background: rgba(255, 255, 255, 0.9);
        color: var(--accent-strong);
        border-color: rgba(177, 104, 104, 0.35);
        box-shadow: none;
    }

    .button-link--secondary:hover {
        background: #fff4f4;
    }

    .form-actions {
        align-items: center;
        gap: 12px;
    }

    .form-actions .button-link,
    .form-actions button {
        margin-top: 0;
        min-width: 184px;
    }

    .report-heading div {
        border: 1px solid rgba(76, 40, 38, 0.36);
        border-radius: 12px;
        background: #fff6f6;
    }

    .report-table th,
    .report-table td {
        border: 1px solid rgba(76, 40, 38, 0.26);
    }

    .report-table th {
        background: linear-gradient(135deg, #4c2826, #a21a16);
        color: #ffffff;
    }

    .executive-panel {
        background:
            linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 246, 246, 0.9)),
            radial-gradient(circle at 85% 4%, rgba(162, 26, 22, 0.18), transparent 32%);
    }

    .metric-card--primary,
    .product-lot-header strong {
        background: #fff0f0;
        border-color: rgba(162, 26, 22, 0.22);
        color: var(--accent-strong);
    }

    .bar-chart {
        border-color: rgba(177, 104, 104, 0.28);
        background: linear-gradient(180deg, #fffafa, #f3eeee);
    }

    .bar--entrada,
    .legend-dot--entrada {
        background: #838383;
    }

    .bar--salida,
    .legend-dot--salida {
        background: #a21a16;
    }

    .salida-panel {
        border-radius: 8px;
        background: rgba(255, 250, 240, 0.88);
        box-shadow: 0 24px 70px rgba(25, 35, 31, 0.14);
    }

    .salida-panel .eyebrow {
        display: block;
        width: auto;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        color: var(--accent-strong);
    }

    .salida-panel .entry-form {
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .salida-panel .form-field select,
    .salida-panel .form-field input {
        border: 2px solid var(--line);
        border-radius: 8px;
        background: #ffffff;
        box-shadow: none;
    }

    .salida-panel .button-link {
        min-height: 44px;
        min-width: 0;
        padding: 0 18px;
        border-radius: 6px;
        background: var(--accent);
        box-shadow: none;
        transform: none;
    }

    .salida-panel .button-link:hover {
        background: var(--accent-strong);
        box-shadow: none;
        transform: none;
    }

    .salida-panel .button-link--secondary {
        background: #ffffff;
    }
}

.brand-logo--dashboard-hidden {
    display: none;
}

.page-shell--dashboard {
    width: min(1320px, calc(100% - 28px));
    place-items: start center;
    min-height: calc(100vh - 82px);
    padding-top: clamp(10px, 1.6vw, 18px);
    padding-bottom: 14px;
}

.dashboard-home {
    width: 100%;
    max-width: none;
    padding: clamp(16px, 2vw, 24px);
}

.dashboard-topbar {
    position: fixed;
    top: 14px;
    left: 50%;
    z-index: 40;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    width: min(1180px, calc(100% - 28px));
    min-height: 64px;
    padding: 10px 14px;
    border: 1px solid rgba(177, 104, 104, 0.28);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 18px 46px rgba(74, 21, 48, 0.14);
    transform: translateX(-50%);
    backdrop-filter: blur(14px);
}

.dashboard-brand,
.dashboard-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.dashboard-brand img {
    width: 70px;
    max-height: 42px;
    object-fit: contain;
}

.dashboard-brand strong {
    color: #4a1530;
    font-size: clamp(1rem, 2.4vw, 1.35rem);
    line-height: 1.1;
}

.dashboard-user {
    justify-content: end;
    padding: 8px 12px;
    border-radius: 14px;
    background: #f7eeee;
    color: #4a1530;
}

.dashboard-user span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.dashboard-user strong {
    font-size: 0.98rem;
}

.dashboard-hero {
    max-width: 100%;
    margin-bottom: 12px;
}

.dashboard-hero h1 {
    font-size: clamp(2.6rem, 5.2vw, 4.25rem);
    line-height: 0.95;
}

.dashboard-home .status-card {
    max-width: 520px;
    margin-bottom: 24px;
}

.dashboard-home .main-menu--operational {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 12px;
}

.dashboard-home .menu-section {
    --section-color: #4a1530;
    align-content: start;
    gap: 10px;
    padding: clamp(12px, 1.4vw, 16px);
    border: 1px solid color-mix(in srgb, var(--section-color) 24%, #ffffff);
    border-top: 5px solid var(--section-color);
    border-radius: 14px;
    background:
        linear-gradient(145deg, color-mix(in srgb, var(--section-color) 10%, #ffffff), rgba(255, 255, 255, 0.88) 48%),
        #ffffff;
    box-shadow: 0 18px 44px color-mix(in srgb, var(--section-color) 14%, transparent);
}

.dashboard-home .menu-section--movimientos {
    --section-color: #18705f;
}

.dashboard-home .menu-section--correcciones {
    --section-color: #c9861a;
}

.dashboard-home .menu-section--reportes {
    --section-color: #2d6fa3;
}

.dashboard-home .menu-section--directiva {
    --section-color: #60438f;
}

.dashboard-home .menu-section--admin {
    --section-color: #7a1c2e;
}

.dashboard-home .menu-section--security {
    --section-color: #355c7d;
}

.dashboard-home .administration-sections {
    display: grid;
    grid-template-columns: 1fr;
    grid-column: 1 / -1;
    gap: 12px;
}

.dashboard-home .menu-section > span {
    width: fit-content;
    padding: 5px 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--section-color) 12%, #ffffff);
    color: color-mix(in srgb, var(--section-color) 78%, #2f1621);
    font-size: 0.68rem;
    letter-spacing: 0;
}

.dashboard-home .menu-section h2 {
    color: color-mix(in srgb, var(--section-color) 54%, #2f1621);
    font-size: clamp(1.02rem, 1.7vw, 1.28rem);
    line-height: 1.1;
}

.dashboard-home .menu-section-grid,
.dashboard-home .menu-section-grid--three {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.dashboard-home .menu-card {
    position: relative;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 34px;
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 3px;
    align-items: center;
    min-height: 82px;
    min-width: 0;
    padding: 13px;
    overflow: hidden;
    border: 1px solid rgba(74, 21, 48, 0.12);
    border-radius: 12px;
    background: #ffffff;
    color: #2f1621;
    text-decoration: none;
    box-shadow: 0 14px 34px rgba(74, 21, 48, 0.08);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.dashboard-home .menu-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, color-mix(in srgb, var(--card-color) 14%, transparent), transparent 58%);
    opacity: 0.9;
}

.dashboard-home .menu-card::after {
    display: none;
}

.dashboard-home .menu-card > * {
    position: relative;
    z-index: 1;
}

.dashboard-home .menu-card:hover {
    border-color: color-mix(in srgb, var(--card-color) 54%, #ffffff);
    box-shadow: 0 14px 30px rgba(74, 21, 48, 0.12);
    transform: translateY(-2px);
}

.dashboard-home .menu-card-icon {
    grid-row: 1 / 3;
    display: inline-grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--card-color) 14%, #ffffff);
    color: var(--card-color);
}

.dashboard-home .menu-card-icon svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dashboard-home .menu-card span:not(.menu-card-icon) {
    grid-column: 2;
    color: #6f6265;
    font-size: 0.76rem;
    line-height: 1.25;
}

.dashboard-home .menu-card strong {
    grid-column: 2;
    align-self: start;
    max-width: 100%;
    color: #2f1621;
    font-size: clamp(1rem, 1.25vw, 1.18rem);
    line-height: 1.12;
    overflow-wrap: anywhere;
}

.dashboard-home .menu-card i {
    grid-column: 3;
    grid-row: 1 / 3;
    justify-self: end;
    align-self: center;
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--card-color);
    color: #ffffff;
    font-size: 1.4rem;
    font-style: normal;
    line-height: 1;
}

.dashboard-home .menu-card--entrada {
    --card-color: #21855b;
}

.dashboard-home .menu-card--predespacho {
    --card-color: #2d6fa3;
}

.dashboard-home .menu-card--salida {
    --card-color: #a21a16;
}

.dashboard-home .menu-card--correccion {
    --card-color: #c9861a;
}

.dashboard-home .menu-card--reporte {
    --card-color: #2d6fa3;
}

.dashboard-home .menu-card--directiva {
    --card-color: #60438f;
}

.dashboard-home .menu-card--directiva-ia {
    --card-color: #21855b;
}

.dashboard-home .menu-card--directiva-cotizacion {
    --card-color: #60438f;
}

.dashboard-home .menu-card--directiva-silos {
    --card-color: #a21a16;
}

.dashboard-home .menu-card--conexion {
    --card-color: #747474;
}

@media (min-width: 720px) {
    .dashboard-home .administration-sections {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-home .menu-section-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-home .menu-section-grid--three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1040px) {
    .dashboard-home .main-menu--operational {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .dashboard-home .menu-section--wide {
        grid-column: auto;
    }

    .dashboard-home .administration-sections {
        grid-column: 1 / -1;
    }

    .dashboard-home .menu-section-grid,
    .dashboard-home .menu-section-grid--three {
        grid-template-columns: 1fr;
    }

    .dashboard-home .menu-card {
        min-height: 84px;
        padding: 13px;
    }

    .dashboard-home .menu-card strong {
        font-size: clamp(0.98rem, 1vw, 1.15rem);
        overflow-wrap: break-word;
    }
}

@media (max-width: 560px) {
    .brand-logo {
        position: relative;
        top: auto;
        left: auto;
        width: 118px;
        margin: 14px 0 0 12px;
    }

    .page-shell:has(.form-panel),
    .page-shell:has(.report-panel),
    .page-shell:has(.executive-panel) {
        width: min(100% - 24px, 100%);
    }

    .form-panel h1,
    .report-panel h1 {
        white-space: normal;
    }

    .report-heading {
        grid-template-columns: 1fr;
    }

    .connection-list div {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .main-menu {
        grid-template-columns: 1fr;
    }

    .main-menu--operational,
    .menu-section-grid,
    .menu-section-grid--three,
    .correction-grid--entrada,
    .correction-grid--salida,
    .correction-summary {
        grid-template-columns: 1fr;
    }

    .correction-card-header {
        display: grid;
    }

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

    .entry-form--three-columns,
    .executive-grid,
    .insight-band,
    .risk-grid,
    .product-summary-grid,
    .lot-analytics-grid {
        grid-template-columns: 1fr;
    }

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

    .insight-band div {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .chart-title {
        display: grid;
    }

    .product-lot-header {
        display: grid;
        align-items: start;
    }

    .product-lot-header strong {
        min-width: 0;
        width: fit-content;
    }

    .button-link,
    .form-actions {
        width: 100%;
    }

}

body:has(.auth-topbar) {
    padding-top: 82px;
}

.auth-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 72px;
    padding: 10px clamp(16px, 3vw, 34px);
    border-bottom: 1px solid rgba(122, 28, 46, 0.18);
    background: rgba(255, 250, 250, 0.94);
    box-shadow: 0 12px 28px rgba(76, 40, 38, 0.12);
    backdrop-filter: blur(10px);
}

.auth-brand,
.auth-session {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-brand {
    color: var(--accent-strong);
    font-family: Verdana, sans-serif;
    text-decoration: none;
}

.auth-brand img {
    width: 72px;
    height: 42px;
    object-fit: contain;
}

.auth-greeting {
    color: var(--ink);
    font-family: Verdana, sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: #777;
    color: #ffffff;
    font-family: Verdana, sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
}

.role-badge--administrador {
    background: #7a1c2e;
}

.role-badge--supervisor {
    background: #2366a8;
}

.role-badge--operador {
    background: #18705f;
}

.role-badge--solo-lectura {
    background: #6f7378;
}

.logout-button {
    min-height: 38px;
    padding: 0 14px;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

.logout-button:hover {
    background: var(--accent-strong);
}

.dashboard-home .menu-card--disabled,
.menu-card--disabled {
    background: #e9e9e9;
    color: #757575;
    cursor: not-allowed;
    filter: grayscale(1);
    opacity: 0.72;
}

.dashboard-home .menu-card--disabled:hover,
.menu-card--disabled:hover {
    border-color: var(--line);
    box-shadow: none;
    transform: none;
}

.dashboard-home .menu-card--disabled i,
.menu-card--disabled i {
    display: none;
}

.login-body {
    min-height: 100vh;
}

.login-shell {
    width: min(460px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    place-content: center;
    gap: 24px;
}

.login-brand {
    display: grid;
    justify-items: center;
    gap: 10px;
    color: var(--accent-strong);
    font-size: 1.25rem;
    font-weight: 800;
}

.login-brand img {
    width: 140px;
    height: auto;
}

.login-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 34px;
    background: rgba(255, 250, 250, 0.94);
    box-shadow: 0 24px 70px rgba(76, 40, 38, 0.18);
}

.login-card h1 {
    font-size: 2.5rem;
}

.login-form,
.icon-field {
    display: grid;
    gap: 12px;
}

.login-form {
    margin-top: 22px;
    font-family: Verdana, sans-serif;
}

.icon-field > span {
    font-weight: 700;
}

.icon-field > div {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    align-items: center;
    min-height: 56px;
    border: 2px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.icon-field i {
    text-align: center;
}

.icon-field input {
    min-width: 0;
    height: 52px;
    border: 0;
    font: inherit;
    outline: 0;
}

.password-toggle {
    margin-right: 6px;
    min-height: 38px;
    border: 0;
    border-radius: 6px;
    background: #f5eeee;
    color: var(--accent-strong);
    font-weight: 700;
    cursor: pointer;
}

.salida-auth-page {
    min-height: 70vh;
}

.delivery-auth-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.24);
    backdrop-filter: blur(4px);
}

.delivery-auth-card {
    width: min(360px, 100%);
    padding: 24px;
    border: 1px solid #b9b0ad;
    border-radius: 4px;
    background: #ffffff;
    box-shadow: 0 4px 14px rgba(52, 35, 32, 0.24);
}

.delivery-auth-form,
.delivery-auth-form label {
    display: grid;
    gap: 8px;
}

.delivery-auth-form {
    gap: 16px;
    font-family: Verdana, sans-serif;
}

.delivery-auth-form label {
    color: var(--accent-strong);
    font-size: 0.95rem;
    font-weight: 700;
}

.delivery-auth-form input {
    width: 100%;
    min-width: 0;
    height: 46px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
}

.delivery-password-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    overflow: hidden;
}

.delivery-password-field input {
    border: 0;
    border-radius: 0;
    outline: 0;
}

.delivery-password-field .password-toggle {
    margin: 0 6px 0 0;
}

.delivery-auth-form > .button-link {
    width: 100%;
    min-height: 44px;
    margin-top: 2px;
}

.checkbox-line,
.switch-line {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.login-submit {
    width: 100%;
    margin-top: 10px;
}

.public-access-link {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 4px 12px;
    align-items: center;
    margin-top: 18px;
    padding: 14px;
    border: 1px solid rgba(24, 112, 95, 0.22);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(24, 112, 95, 0.09), #ffffff 62%);
    color: var(--accent-strong);
    font-family: Verdana, sans-serif;
    text-decoration: none;
}

.public-access-link:hover {
    border-color: #18705f;
    box-shadow: 0 12px 28px rgba(24, 112, 95, 0.12);
}

.public-access-link span {
    grid-row: 1 / 3;
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #e8f5ee;
    color: #18705f;
    font-size: 1.4rem;
    font-weight: 800;
}

.public-access-link strong {
    color: var(--accent-strong);
    font-size: 0.98rem;
}

.public-access-link small {
    color: var(--muted);
    line-height: 1.35;
}

.forbidden-panel {
    text-align: center;
}

.admin-page {
    display: grid;
    gap: 18px;
}

.admin-heading {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: start;
}

.admin-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

.admin-filters input,
.admin-filters select,
.admin-modal-card input,
.admin-modal-card select,
.admin-modal-card textarea,
.admin-modal-card label > input,
.admin-modal-card label > select,
.admin-modal-card label > textarea {
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    font: inherit;
}

.admin-modal-card textarea,
.admin-modal-card label > textarea {
    min-height: 118px;
    padding: 12px;
    resize: vertical;
}

.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-family: Verdana, sans-serif;
}

.admin-table th,
.admin-table td {
    padding: 13px 14px;
    border-bottom: 1px solid #f0dfdf;
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    background: #f7eeee;
    color: var(--accent-strong);
    font-size: 0.82rem;
    text-transform: uppercase;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.table-actions button {
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: var(--accent-strong);
    font-weight: 700;
    cursor: pointer;
}

.table-actions a {
    display: inline-grid;
    min-width: 34px;
    min-height: 34px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: var(--accent-strong);
    font-weight: 700;
    text-decoration: none;
}

.clientes-cotizaciones-page .admin-table {
    min-width: 860px;
}

.clientes-cotizaciones-page .admin-table tbody tr.is-client-inactive {
    background: #fff8f7;
    color: #7a6a68;
}

.client-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.client-status-badge--active {
    background: #e8f6ee;
    color: #17643a;
}

.client-status-badge--inactive {
    background: #fff0ef;
    color: #a21a16;
}

.client-code {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.72rem;
}

.clientes-cotizaciones-filters {
    grid-template-columns: minmax(220px, 1fr) minmax(170px, 220px) auto auto;
}

.clientes-cotizaciones-page .client-active-field {
    display: flex;
    grid-template-rows: none;
    align-items: center;
    gap: 9px;
    text-transform: none;
}

.clientes-cotizaciones-page .client-active-field input[type="checkbox"] {
    width: 18px;
    min-height: 18px;
    accent-color: var(--accent);
}

.admin-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    color: var(--accent-strong);
    font-size: 0.86rem;
    font-weight: 700;
}

.admin-pagination .button-link {
    min-height: 38px;
}

.predespacho-header-actions {
    flex-wrap: nowrap;
    align-items: center;
}

.table-actions .predespacho-header-action {
    display: inline-grid;
    place-items: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    border-color: rgba(96, 67, 143, 0.22);
    background: #f4f0f8;
    color: #3e285f;
}

.predespacho-header-action svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.table-actions .predespacho-header-action--view {
    border-color: rgba(45, 111, 163, 0.24);
    background: #eaf3fa;
    color: #245d89;
}

.table-actions .predespacho-header-action--sap {
    flex-basis: auto;
    width: auto;
    min-width: 68px;
    padding: 0 9px;
    border-color: rgba(24, 112, 95, 0.24);
    background: #eaf6f2;
    color: #125747;
    font-size: 0.72rem;
}

.table-actions .predespacho-header-action--delete {
    border-color: rgba(157, 28, 22, 0.22);
    background: #fbe8e7;
    color: #9d1c16;
    font-size: 1.2rem;
}

.status-pill {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.status-pill.is-active {
    background: #e8f5ef;
    color: #18705f;
}

.status-pill.is-pending {
    background: #fff6d8;
    color: #8a5d00;
}

.status-pill.is-inactive,
.log-row--fail {
    background: #fff0ef;
    color: var(--danger);
}

.status-pill.is-closed {
    background: #eeeeee;
    color: #666666;
}

.predespacho-filters {
    grid-template-columns: minmax(260px, 1fr) minmax(160px, 220px) auto;
}

.predespacho-client-field {
    grid-column: 1 / -1;
}

.predespacho-inline-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 8px;
}

.predespacho-add-button {
    width: 48px;
    min-height: 46px;
    margin-top: 0;
    padding: 0;
    font-size: 1.35rem;
}

.predespacho-detail-card {
    width: min(980px, 100%);
}

.predespacho-back-link {
    position: sticky;
    top: 14px;
    z-index: 20;
    align-self: start;
    box-shadow: 0 10px 24px rgba(74, 42, 42, 0.12);
}

.predespacho-summary-card {
    gap: 16px;
}

.predespacho-summary-card > strong {
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1;
}

.predespacho-summary-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.predespacho-summary-wide {
    grid-column: 1 / -1;
}

.predespacho-inline-form {
    display: grid;
    grid-template-columns: max-content auto;
    gap: 12px;
    align-items: end;
    justify-content: start;
}

.predespacho-inline-form label {
    display: grid;
    gap: 8px;
    font-weight: 700;
}

.predespacho-inline-form input,
.predespacho-inline-number {
    width: 100%;
    min-height: 42px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    font: inherit;
}

.predespacho-sap-input {
    width: 18ch !important;
    max-width: 100%;
}

.predespacho-sap-button {
    min-height: 42px;
    margin-top: 0;
    padding: 0 14px;
    font-size: 0.9rem;
}

.predespacho-inline-number {
    max-width: 130px;
}

.predespacho-search-grid {
    position: relative;
    margin-bottom: 16px;
}

.predespacho-search-field {
    position: relative;
}

.predespacho-search-field--product::after {
    content: "⌕";
    position: absolute;
    right: 16px;
    bottom: 17px;
    color: #7a1c2e;
    font-size: 1.2rem;
    pointer-events: none;
}

.predespacho-product-input {
    padding-right: 44px;
}

.predespacho-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 120;
    display: grid;
    max-height: 280px;
    overflow: hidden;
    overflow-y: auto;
    border: 1px solid rgba(122, 28, 46, 0.2);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 20px 42px rgba(76, 40, 38, 0.18);
}

.predespacho-results[hidden] {
    display: none;
}

.predespacho-results button,
.predespacho-result-empty {
    min-height: 42px;
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid #f1dddd;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    text-align: left;
}

.predespacho-results button {
    cursor: pointer;
}

.predespacho-results button:hover,
.predespacho-results button:focus {
    background: #fff2f2;
    color: #7a1c2e;
}

.predespacho-lotes-wrap {
    margin: 16px 0;
}

.predespacho-step-title {
    margin: 0 0 10px;
    color: var(--ink);
    font-weight: 700;
}

.sector-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.sector-select-card {
    width: 100%;
    margin: 0;
    border: 1px solid var(--line);
    text-align: left;
    cursor: pointer;
}

.sector-select-card:hover {
    border-color: var(--accent);
    box-shadow: 0 16px 42px rgba(76, 40, 38, 0.12);
}

.sector-click-row {
    cursor: pointer;
}

.sector-click-row:hover {
    background: #fff6f6;
}

.predespacho-sector-filter {
    grid-template-columns: minmax(260px, 420px) auto;
    align-items: end;
}

.predespacho-delivery-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 20px;
    align-items: start;
}

.predespacho-products-panel {
    min-width: 0;
}

.predespacho-delivery-card {
    display: grid;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffafa;
}

.predespacho-delivery-card h2 {
    margin: 0 0 2px;
    font-size: 1.05rem;
    color: #7a1c2e;
}

.predespacho-delivery-card .quiet-text {
    font-size: 0.8rem;
    margin: 0;
}

.predespacho-delivery-card .form-field {
    gap: 4px;
}

.predespacho-delivery-card .form-field label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ink);
}

.predespacho-delivery-card .form-field input {
    min-height: 36px;
    padding: 0 10px;
    font-size: 0.875rem;
    border-radius: 6px;
}

/* Lote + Disponible side by side */
.delivery-card-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.predespacho-delivery-card .form-actions {
    margin-top: 4px;
}

.predespacho-delivery-card .button-link--submit {
    width: 100%;
    min-height: 40px;
    font-size: 0.9rem;
    padding: 0 12px;
    justify-content: center;
}

/* delivery table: tighter cells so 9 columns fit without horizontal scroll */
.predespacho-products-panel .admin-table th,
.predespacho-products-panel .admin-table td {
    padding: 7px 8px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.predespacho-selected-observation {
    max-width: 760px;
    margin: 10px 0 0;
    padding: 10px 12px;
    border-left: 4px solid #c9861a;
    border-radius: 6px;
    background: #fff8e8;
    color: #5f430f;
    font-size: 0.9rem;
    line-height: 1.45;
}

.predespacho-selected-observation strong {
    color: #4c3208;
}

/* Producto column may wrap; give it the most room */
.predespacho-products-panel .admin-table th:first-child,
.predespacho-products-panel .admin-table td:first-child {
    white-space: normal;
    min-width: 130px;
}

/* numeric columns right-aligned */
.predespacho-products-panel .admin-table th:nth-child(n+5):nth-child(-n+8),
.predespacho-products-panel .admin-table td:nth-child(n+5):nth-child(-n+8) {
    text-align: right;
}

.predespacho-product-row {
    cursor: pointer;
}

.predespacho-product-row:hover,
.is-selected-row {
    background: #fff2f2;
    box-shadow: inset 4px 0 0 #7a1c2e;
}

.delivery-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 8px;
    border-radius: 999px;
    background: #d8d8d8;
    vertical-align: middle;
}

.delivery-dot.is-complete {
    background: #21855b;
}

.delivery-dot.is-partial {
    background: #c79814;
}

.delivery-check {
    display: inline-grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 999px;
    background: #e8f5ef;
    color: #21855b;
    font-weight: 800;
}

.admin-table tbody tr.is-dispatched {
    background: #e8f5ef;
}

.admin-table tbody tr.is-partial {
    background: #fff6d8;
}

@media (max-width: 900px) {
    .predespacho-summary-list,
    .predespacho-inline-form {
        grid-template-columns: 1fr;
    }

    .sector-card-grid {
        grid-template-columns: 1fr;
    }

    .predespacho-sector-filter,
    .predespacho-delivery-grid {
        grid-template-columns: 1fr;
    }
}

.admin-modal-card {
    max-width: 760px;
}

.admin-modal-card label {
    display: grid;
    gap: 8px;
    font-weight: 700;
}

.strength-meter {
    width: 100%;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #eee1df;
}

.strength-meter span {
    display: block;
    width: 8%;
    height: 100%;
    transition: width 0.18s ease;
}

.strength-meter .is-weak {
    background: #a21a16;
}

.strength-meter .is-medium {
    background: #d9911b;
}

.strength-meter .is-strong {
    background: #18705f;
}

@media (max-width: 900px) {
    .auth-topbar,
    .auth-session,
    .admin-heading {
        align-items: stretch;
        flex-direction: column;
    }

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

@media (max-width: 720px) {
    body:has(.auth-topbar) {
        padding-top: 94px;
    }

    .auth-topbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 6px 10px;
        align-items: center;
        min-height: 0;
        padding: 7px 10px 8px;
        box-shadow: 0 8px 20px rgba(76, 40, 38, 0.10);
    }

    .auth-brand {
        min-width: 0;
        gap: 8px;
    }

    .auth-brand img {
        width: 48px;
        height: 34px;
    }

    .auth-brand strong {
        overflow: hidden;
        color: var(--accent-strong);
        font-size: 1.04rem;
        line-height: 1.1;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .auth-session {
        display: contents;
    }

    .auth-greeting {
        grid-column: 1 / 2;
        min-width: 0;
        overflow: hidden;
        font-size: 0.88rem;
        line-height: 1.15;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .role-badge {
        grid-column: 2 / 3;
        min-height: 28px;
        max-width: 132px;
        padding: 0 9px;
        border-radius: 8px;
        font-size: 0.74rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .auth-session form {
        grid-column: 2 / 3;
        grid-row: 1 / 2;
        margin: 0;
    }

    .logout-button {
        min-height: 36px;
        padding: 0 12px;
        border-radius: 8px;
        font-size: 0.78rem;
        white-space: nowrap;
    }

    .page-shell:has(.admin-page) {
        width: min(100% - 18px, 100%);
        padding-top: 6px;
    }

    .admin-page {
        padding: 16px 10px;
        border-radius: 6px;
    }

    .admin-page[data-predespacho-detalle] {
        gap: 14px;
    }

    .admin-page[data-predespacho-detalle] .intro {
        margin-bottom: 0;
    }

    .admin-heading h1 {
        white-space: normal;
        font-size: clamp(2rem, 12vw, 2.8rem);
    }

    .admin-heading .form-actions,
    .admin-heading .button-link,
    .admin-heading button {
        width: 100%;
    }

    .predespacho-filters {
        gap: 10px;
    }

    .predespacho-back-link {
        position: static;
        box-shadow: none;
    }

    .predespacho-summary-card {
        gap: 12px;
        padding: 14px;
    }

    .predespacho-summary-card > strong {
        font-size: clamp(1.65rem, 10vw, 2.35rem);
        overflow-wrap: anywhere;
    }

    .predespacho-summary-list {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .predespacho-summary-list div {
        padding: 10px;
    }

    .predespacho-summary-list dd {
        font-size: 1rem;
        overflow-wrap: anywhere;
    }

    .predespacho-inline-form {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .predespacho-sap-input {
        width: 100% !important;
    }

    .inventory-report {
        padding: 12px;
    }

    .inventory-report .chart-title {
        gap: 10px;
    }

    .admin-page[data-predespacho-page] .admin-table-wrap,
    .admin-page[data-predespacho-detalle] .admin-table-wrap,
    .predespacho-detail-card .admin-table-wrap {
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .admin-page[data-predespacho-page] .admin-table,
    .admin-page[data-predespacho-page] .admin-table tbody,
    .admin-page[data-predespacho-detalle] .admin-table,
    .admin-page[data-predespacho-detalle] .admin-table tbody,
    .predespacho-detail-card .admin-table,
    .predespacho-detail-card .admin-table tbody {
        display: grid;
        gap: 12px;
        width: 100%;
    }

    .admin-page[data-predespacho-page] .admin-table thead,
    .admin-page[data-predespacho-detalle] .admin-table thead,
    .predespacho-detail-card .admin-table thead {
        display: none;
    }

    .admin-page[data-predespacho-page] .admin-table tr,
    .admin-page[data-predespacho-detalle] .admin-table tr,
    .predespacho-detail-card .admin-table tr {
        display: grid;
        gap: 0;
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: #ffffff;
        box-shadow: 0 10px 26px rgba(76, 40, 38, 0.08);
    }

    .admin-page[data-predespacho-page] .admin-table td,
    .admin-page[data-predespacho-detalle] .admin-table td,
    .predespacho-detail-card .admin-table td {
        display: grid;
        grid-template-columns: minmax(110px, 42%) minmax(0, 1fr);
        gap: 10px;
        align-items: center;
        min-width: 0;
        padding: 10px 0;
        border-bottom: 1px solid #f0dfdf;
        font-size: 0.92rem;
        overflow-wrap: anywhere;
    }

    .admin-page[data-predespacho-page] .admin-table td:last-child,
    .admin-page[data-predespacho-detalle] .admin-table td:last-child,
    .predespacho-detail-card .admin-table td:last-child {
        border-bottom: 0;
    }

    .admin-page[data-predespacho-page] .admin-table td::before,
    .admin-page[data-predespacho-detalle] .admin-table td::before,
    .predespacho-detail-card .admin-table td::before {
        content: attr(data-label);
        color: var(--accent-strong);
        font-size: 0.76rem;
        font-weight: 800;
        text-transform: uppercase;
    }

    .admin-page[data-predespacho-page] .admin-table td[colspan],
    .admin-page[data-predespacho-detalle] .admin-table td[colspan],
    .predespacho-detail-card .admin-table td[colspan] {
        display: block;
        text-align: center;
    }

    .admin-page[data-predespacho-page] .admin-table td[colspan]::before,
    .admin-page[data-predespacho-detalle] .admin-table td[colspan]::before,
    .predespacho-detail-card .admin-table td[colspan]::before {
        content: none;
    }

    .admin-page[data-predespacho-page] .table-actions,
    .admin-page[data-predespacho-detalle] .table-actions,
    .predespacho-detail-card .table-actions {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .admin-page[data-predespacho-page] .table-actions button,
    .admin-page[data-predespacho-detalle] .table-actions button,
    .predespacho-detail-card .table-actions button {
        width: 100%;
        min-height: 42px;
    }

    .clientes-cotizaciones-page .admin-table-wrap {
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .clientes-cotizaciones-page .admin-table,
    .clientes-cotizaciones-page .admin-table tbody {
        display: grid;
        gap: 12px;
        width: 100%;
        min-width: 0;
    }

    .clientes-cotizaciones-page .admin-table thead {
        display: none;
    }

    .clientes-cotizaciones-page .admin-table tr {
        display: grid;
        gap: 0;
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: #ffffff;
        box-shadow: 0 10px 26px rgba(76, 40, 38, 0.08);
    }

    .clientes-cotizaciones-page .admin-table tr.is-client-inactive {
        background: #fff8f7;
    }

    .clientes-cotizaciones-page .admin-table td {
        display: grid;
        grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
        gap: 10px;
        align-items: center;
        min-width: 0;
        padding: 10px 0;
        border-bottom: 1px solid #f0dfdf;
        font-size: 0.92rem;
        overflow-wrap: anywhere;
    }

    .clientes-cotizaciones-page .admin-table td::before {
        content: attr(data-label);
        color: var(--accent-strong);
        font-size: 0.76rem;
        font-weight: 800;
        text-transform: uppercase;
    }

    .clientes-cotizaciones-page .admin-table td:last-child {
        border-bottom: 0;
    }

    .clientes-cotizaciones-page .admin-table td[colspan] {
        display: block;
        text-align: center;
    }

    .clientes-cotizaciones-page .admin-table td[colspan]::before {
        content: none;
    }

    .clientes-cotizaciones-page .table-actions {
        justify-content: flex-start;
    }

    .clientes-cotizaciones-page .table-actions button {
        min-width: 44px;
        min-height: 42px;
    }

    .clientes-cotizaciones-filters {
        grid-template-columns: 1fr;
    }

    .clientes-cotizaciones-filters .button-link {
        width: 100%;
    }

    .correction-modal {
        place-items: start center;
        padding: 10px;
        overflow-y: auto;
    }

    .correction-modal-card,
    .admin-modal-card,
    .predespacho-detail-card {
        width: 100%;
        max-width: 100%;
        max-height: none;
        padding: 16px;
        border-radius: 14px;
    }

    .correction-modal-card header {
        gap: 10px;
    }

    .correction-modal-card h2 {
        font-size: 1.35rem;
    }

    .correction-modal-grid {
        grid-template-columns: 1fr;
    }

    .predespacho-inline-control {
        grid-template-columns: minmax(0, 1fr) 48px;
    }

    .modal-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .modal-actions .button-link,
    .modal-actions button {
        width: 100%;
        margin-top: 0;
    }

    .correction-panel[data-page-type="entrada"] {
        padding: 16px 10px;
        border-radius: 6px;
    }

    .correction-panel[data-page-type="entrada"] h1 {
        font-size: clamp(2rem, 12vw, 2.8rem);
        line-height: 1;
        white-space: normal;
    }

    .correction-panel[data-page-type="entrada"] .intro {
        margin-bottom: 12px;
    }

    .correction-panel[data-page-type="entrada"] .correction-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .correction-panel[data-page-type="entrada"] .correction-actions .button-link {
        width: 100%;
    }

    .correction-panel[data-page-type="entrada"] .correction-table-shell {
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .correction-panel[data-page-type="entrada"] .correction-table,
    .correction-panel[data-page-type="entrada"] .correction-table tbody {
        display: grid;
        gap: 12px;
        width: 100%;
        min-width: 0;
    }

    .correction-panel[data-page-type="entrada"] .correction-table thead {
        display: none;
    }

    .correction-panel[data-page-type="entrada"] .correction-table tbody tr {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0;
        padding: 12px;
        border: 1px solid rgba(122, 28, 46, 0.14);
        border-radius: 14px;
        background: #ffffff;
        box-shadow: 0 10px 26px rgba(76, 40, 38, 0.08);
    }

    .correction-panel[data-page-type="entrada"] .correction-table tbody tr:hover {
        background: #ffffff;
        transform: none;
    }

    .correction-panel[data-page-type="entrada"] .correction-table tbody tr.is-risk-row {
        background: #fff0ef;
    }

    .correction-panel[data-page-type="entrada"] .correction-table td,
    .correction-panel[data-page-type="entrada"] .correction-table td:nth-child(1),
    .correction-panel[data-page-type="entrada"] .correction-table td:nth-child(2),
    .correction-panel[data-page-type="entrada"] .correction-table td:nth-child(3),
    .correction-panel[data-page-type="entrada"] .correction-table td:nth-child(4),
    .correction-panel[data-page-type="entrada"] .correction-table td:nth-child(5),
    .correction-panel[data-page-type="entrada"] .correction-table td:nth-child(6),
    .correction-panel[data-page-type="entrada"] .correction-table td:nth-child(7),
    .correction-panel[data-page-type="entrada"] .correction-table td:nth-child(8),
    .correction-panel[data-page-type="entrada"] .correction-table td:nth-child(9) {
        display: grid;
        grid-column: auto;
        grid-row: auto;
        grid-template-columns: minmax(106px, 40%) minmax(0, 1fr);
        gap: 10px;
        align-items: center;
        width: 100%;
        height: auto;
        min-width: 0;
        padding: 10px 0;
        border-bottom: 1px solid #f0dfdf;
        border-radius: 0;
        background: transparent;
        color: var(--ink);
        font-size: 0.9rem;
        overflow-wrap: anywhere;
    }

    .correction-panel[data-page-type="entrada"] .correction-table td:nth-child(3) {
        grid-template-columns: 1fr;
        padding: 0 0 12px;
        border-bottom: 1px solid rgba(122, 28, 46, 0.18);
    }

    .correction-panel[data-page-type="entrada"] .correction-table td:nth-child(3) strong {
        display: block;
        color: var(--accent-strong);
        font-size: 1.05rem;
        line-height: 1.25;
    }

    .correction-panel[data-page-type="entrada"] .correction-table td:last-child {
        border-bottom: 0;
    }

    .correction-panel[data-page-type="entrada"] .correction-table td::before,
    .correction-panel[data-page-type="entrada"] .correction-table td:nth-child(1)::before,
    .correction-panel[data-page-type="entrada"] .correction-table td:nth-child(3)::before,
    .correction-panel[data-page-type="entrada"] .correction-table .actions-column::before {
        display: block;
        content: attr(data-label);
        color: var(--accent-strong);
        font-size: 0.76rem;
        font-weight: 800;
        text-transform: uppercase;
    }

    .correction-panel[data-page-type="entrada"] .correction-table td:nth-child(3) strong {
        white-space: normal;
    }

    .correction-panel[data-page-type="entrada"] .correction-table .actions-column {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        min-width: 0;
        margin-top: 4px;
        padding-top: 12px;
        box-shadow: none;
        text-align: left !important;
    }

    .correction-panel[data-page-type="entrada"] .correction-table .actions-column::before {
        grid-column: 1 / -1;
    }

    .correction-panel[data-page-type="entrada"] .correction-table .actions-column .icon-action {
        width: 100%;
        height: 42px;
        margin: 0;
        border-radius: 10px;
    }
}

/* Cotizaciones */
.cotizacion-page {
    max-width: 1320px;
}

.cotizacion-heading,
.cotizacion-products > header,
.cotizacion-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.cotizacion-heading {
    margin-bottom: 22px;
}

.cotizacion-heading h1,
.cotizacion-products h2 {
    margin: 0;
}

.cotizacion-form {
    display: grid;
    gap: 24px;
}

.cotizacion-client-picker {
    display: flex;
    align-items: end;
    gap: 12px;
    max-width: 760px;
}

.cotizacion-client-picker .cotizacion-field--client {
    flex: 1 1 auto;
}

.cotizacion-new-client {
    flex: 0 0 auto;
    min-height: 44px;
    white-space: nowrap;
}

.cotizacion-client-card {
    width: min(680px, calc(100vw - 32px));
}

.cotizacion-dependent-fields {
    display: grid;
    gap: 24px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    transition: opacity 160ms ease;
}

.cotizacion-dependent-fields:disabled {
    opacity: 0.48;
}

.cotizacion-fields {
    display: grid;
    grid-template-columns: 170px 110px 170px minmax(280px, 340px);
    gap: 16px;
    align-items: end;
}

.cotizacion-field--client {
    width: min(100%, 620px);
}

.cotizacion-field--days,
.cotizacion-field--days input {
    width: 8ch;
}

.cotizacion-field--payment,
.cotizacion-field--payment select {
    width: min(100%, 30ch);
}

.cotizacion-field,
.cotizacion-email-card > label {
    display: grid;
    grid-template-rows: minmax(2.1em, auto) auto;
    gap: 7px;
    min-width: 0;
    color: #4c2826;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.cotizacion-date-value {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid rgba(96, 67, 143, 0.18);
    border-radius: 8px;
    background: #f5f3f7;
    color: #3e285f;
    font-size: 0.95rem;
    font-weight: 800;
    text-transform: none;
}

.cotizacion-field input,
.cotizacion-field select,
.cotizacion-field textarea,
.cotizacion-table input,
.cotizacion-table select,
.cotizacion-email-card input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid rgba(96, 67, 143, 0.28);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
}

.cotizacion-field input:focus,
.cotizacion-field select:focus,
.cotizacion-field textarea:focus,
.cotizacion-table input:focus,
.cotizacion-table select:focus,
.cotizacion-email-card input:focus {
    border-color: #60438f;
    outline: 3px solid rgba(96, 67, 143, 0.14);
}

.cotizacion-field textarea {
    min-height: 112px;
    resize: vertical;
}

.cotizacion-products {
    display: grid;
    gap: 14px;
}

.cotizacion-add-product,
.cotizacion-add-product:hover {
    min-height: 38px;
    padding: 0 14px;
    border-color: #18705f;
    background: #18705f;
    color: #ffffff;
    font-size: 0.86rem;
    box-shadow: 0 8px 18px rgba(24, 112, 95, 0.2);
}

.cotizacion-add-product:hover {
    background: #125747;
}

.cotizacion-table-wrap {
    width: 100%;
    overflow: visible;
    border: 1px solid rgba(96, 67, 143, 0.18);
    border-radius: 8px;
    background: #ffffff;
}

.cotizacion-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

.cotizacion-table th,
.cotizacion-table td {
    padding: 12px;
    border-bottom: 1px solid #e8e2ef;
    text-align: left;
    vertical-align: top;
}

.cotizacion-table thead th {
    background: #60438f;
    color: #ffffff;
    font-size: 0.8rem;
}

.cotizacion-table th:first-child {
    border-top-left-radius: 7px;
}

.cotizacion-table th:last-child {
    border-top-right-radius: 7px;
}

.cotizacion-table td:nth-child(1) {
    width: 34%;
}

.cotizacion-table td:nth-child(2) {
    width: 22%;
}

.cotizacion-table td:nth-child(3),
.cotizacion-table td:nth-child(4) {
    width: 14%;
}

.cotizacion-table td:nth-child(5) {
    width: 12%;
}

.cotizacion-table tfoot th,
.cotizacion-table tfoot td {
    border-bottom: 0;
    background: #f4f0f8;
    color: #3e285f;
    font-size: 1.05rem;
    font-weight: 800;
    text-align: right;
}

.cotizacion-row-subtotal {
    color: #3e285f;
    font-weight: 800;
    text-align: right !important;
    white-space: nowrap;
}

.cotizacion-remove-row {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 8px;
    background: #fbe8e7;
    color: #9d1c16;
    font-size: 1.45rem;
    cursor: pointer;
}

.cotizacion-product-cell .searchable-select {
    min-width: 250px;
}

.cotizacion-table .searchable-select-list {
    z-index: 20;
}

.cotizacion-products-empty {
    padding: 22px 16px;
    border: 1px dashed rgba(96, 67, 143, 0.32);
    border-radius: 8px;
    background: #faf9fc;
    color: #675a73;
    text-align: center;
}

.cotizacion-products-empty[hidden] {
    display: none;
}

.cotizacion-product-list {
    display: grid;
    gap: 10px;
}

.cotizacion-product-item {
    display: grid;
    grid-template-columns: minmax(240px, 1.6fr) minmax(340px, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid rgba(96, 67, 143, 0.18);
    border-left: 4px solid #60438f;
    border-radius: 8px;
    background: #ffffff;
}

.cotizacion-product-summary {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.cotizacion-product-summary > span,
.cotizacion-product-values dt,
.cotizacion-product-preview span {
    color: #675a73;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.cotizacion-product-summary strong {
    overflow-wrap: anywhere;
    color: #3e285f;
}

.cotizacion-product-summary small {
    color: #675a73;
    font-size: 0.84rem;
}

.cotizacion-product-values {
    display: grid;
    grid-template-columns: repeat(3, minmax(90px, 1fr));
    gap: 10px;
    margin: 0;
}

.cotizacion-product-values div {
    display: grid;
    gap: 3px;
}

.cotizacion-product-values dd {
    margin: 0;
    color: #2f2534;
    font-weight: 800;
}

.cotizacion-product-actions {
    display: flex;
    gap: 8px;
}

.cotizacion-product-actions button {
    display: grid;
    place-items: center;
    width: 42px;
    min-height: 40px;
    padding: 0;
    border: 1px solid rgba(96, 67, 143, 0.24);
    border-radius: 8px;
    background: #f4f0f8;
    color: #3e285f;
    font: inherit;
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
}

.cotizacion-product-actions [data-remove-detail] {
    border-color: rgba(157, 28, 22, 0.22);
    background: #fbe8e7;
    color: #9d1c16;
}

.cotizacion-total-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 14px 16px;
    border-radius: 8px;
    background: #3e285f;
    color: #ffffff;
    font-weight: 800;
}

.cotizacion-total-bar dl {
    display: grid;
    gap: 5px;
    width: min(100%, 300px);
    margin: 0;
}

.cotizacion-total-bar dl div {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 22px;
}

.cotizacion-total-bar dt,
.cotizacion-total-bar dd {
    margin: 0;
}

.cotizacion-total-bar dd {
    min-width: 100px;
    text-align: right;
}

.cotizacion-total-bar dl div:last-child {
    padding-top: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.35);
    font-size: 1.2rem;
}

.cotizacion-product-card {
    width: min(680px, 100%);
}

.cotizacion-product-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.cotizacion-product-form-field {
    display: grid;
    gap: 7px;
    min-width: 0;
    color: #4c2826;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.cotizacion-product-form-field--wide {
    grid-column: 1 / -1;
}

.cotizacion-product-form-field input,
.cotizacion-product-form-field select,
.cotizacion-product-form-field .searchable-select-input {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid rgba(96, 67, 143, 0.28);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
}

.cotizacion-product-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 15px;
    border-radius: 8px;
    background: #f4f0f8;
}

.cotizacion-product-preview strong {
    color: #3e285f;
    font-size: 1.25rem;
}

.cotizacion-generation-card {
    width: min(720px, 100%);
}

.cotizacion-generation-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.cotizacion-generation-options > button {
    display: grid;
    grid-template-rows: 42px auto 1fr;
    gap: 8px;
    min-height: 176px;
    padding: 16px;
    border: 1px solid rgba(96, 67, 143, 0.24);
    border-radius: 8px;
    background: #ffffff;
    color: #2f2534;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.cotizacion-generation-options > button:hover,
.cotizacion-generation-options > button:focus-visible {
    border-color: #60438f;
    background: #f7f4fa;
    outline: 3px solid rgba(96, 67, 143, 0.12);
}

.cotizacion-generation-options > button:disabled {
    cursor: wait;
    opacity: 0.55;
}

.cotizacion-generation-icon {
    color: #60438f;
    font-size: 1.8rem;
    line-height: 1;
}

.cotizacion-generation-options strong {
    color: #3e285f;
    line-height: 1.25;
}

.cotizacion-generation-options small {
    color: #675a73;
    line-height: 1.4;
}

.cotizacion-heading-actions,
.cotizacion-history-heading,
.cotizacion-history-heading-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cotizacion-history {
    max-width: 1320px;
}

.cotizacion-history-heading {
    justify-content: space-between;
    margin-bottom: 22px;
}

.cotizacion-history-heading h1 {
    margin-bottom: 6px;
}

.cotizacion-history-search {
    display: grid;
    gap: 7px;
    width: min(100%, 480px);
    margin-bottom: 18px;
    color: #4c2826;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.cotizacion-history-search input {
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    border: 1px solid rgba(96, 67, 143, 0.28);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    text-transform: none;
}

.cotizacion-history-search input:focus {
    border-color: #60438f;
    outline: 3px solid rgba(96, 67, 143, 0.14);
}

.cotizacion-history-list {
    display: grid;
    gap: 12px;
}

.cotizacion-history-item {
    display: grid;
    grid-template-columns: minmax(230px, 1.35fr) minmax(410px, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 16px;
    border: 1px solid rgba(96, 67, 143, 0.18);
    border-left: 5px solid #60438f;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 10px 26px rgba(62, 40, 95, 0.08);
}

.cotizacion-history-item[hidden] {
    display: none;
}

.cotizacion-history-main {
    min-width: 0;
}

.cotizacion-history-number {
    display: block;
    margin-bottom: 4px;
    color: #801d35;
    font-size: 0.78rem;
    font-weight: 800;
}

.cotizacion-history-main h2 {
    margin: 0;
    color: #2f2534;
    font-size: 1rem;
    overflow-wrap: anywhere;
}

.cotizacion-history-main p {
    margin: 4px 0 0;
    color: #675a73;
    font-size: 0.82rem;
}

.cotizacion-history-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(80px, 1fr));
    gap: 12px;
    margin: 0;
}

.cotizacion-history-meta div {
    display: grid;
    gap: 3px;
}

.cotizacion-history-meta dt {
    color: #675a73;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.cotizacion-history-meta dd {
    margin: 0;
    color: #2f2534;
    font-size: 0.86rem;
    font-weight: 800;
}

.cotizacion-history-meta dd.is-expired {
    color: #a21a16;
}

.cotizacion-history-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(100px, 1fr));
    gap: 8px;
}

.cotizacion-history-actions a,
.cotizacion-history-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 11px;
    border: 1px solid rgba(96, 67, 143, 0.24);
    border-radius: 8px;
    background: #f4f0f8;
    color: #3e285f;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.cotizacion-history-actions a:first-child {
    border-color: #18705f;
    background: #18705f;
    color: #ffffff;
}

.cotizacion-history-actions .is-danger {
    border-color: rgba(157, 28, 22, 0.22);
    background: #fbe8e7;
    color: #9d1c16;
}

.cotizacion-history-actions button:disabled {
    cursor: wait;
    opacity: 0.55;
}

.cotizacion-history-empty {
    padding: 28px 16px;
    border: 1px dashed rgba(96, 67, 143, 0.32);
    border-radius: 8px;
    color: #675a73;
    text-align: center;
}

.cotizacion-history-empty[hidden] {
    display: none;
}

@media (max-width: 1120px) {
    .cotizacion-history-item {
        grid-template-columns: 1fr;
    }

    .cotizacion-history-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.cotizacion-observation {
    max-width: 780px;
}

.cotizacion-actions {
    justify-content: flex-end;
}

.cotizacion-email-card {
    width: min(520px, 100%);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 980px) {
    .cotizacion-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cotizacion-table-wrap {
        overflow-x: auto;
    }

    .cotizacion-product-item {
        grid-template-columns: 1fr;
    }

    .cotizacion-product-actions {
        justify-content: flex-end;
    }
}

@media (max-width: 720px) {
    body.cotizacion-creation-mode {
        padding-top: 58px;
    }

    .cotizacion-creation-mode .auth-topbar {
        grid-template-columns: minmax(0, 1fr) auto;
        min-height: 52px;
        padding: 5px 10px;
    }

    .cotizacion-creation-mode .auth-brand img {
        width: 42px;
        height: 30px;
    }

    .cotizacion-creation-mode .auth-brand strong {
        font-size: 0.9rem;
    }

    .cotizacion-creation-mode .auth-greeting,
    .cotizacion-creation-mode .role-badge {
        display: none;
    }

    .cotizacion-creation-mode .auth-session form {
        grid-column: 2 / 3;
        grid-row: 1;
    }

    .cotizacion-creation-mode .logout-button {
        min-height: 38px;
    }

    .page-shell:has(.cotizacion-page) {
        width: 100%;
        padding: 0;
    }

    .cotizacion-page {
        padding: 16px 14px 28px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .cotizacion-heading,
    .cotizacion-products > header,
    .cotizacion-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .cotizacion-heading-actions,
    .cotizacion-history-heading,
    .cotizacion-history-heading-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .cotizacion-heading-actions .button-link,
    .cotizacion-history-heading-actions .button-link {
        width: 100%;
    }

    .cotizacion-history {
        padding: 16px 12px;
    }

    .cotizacion-history-item {
        gap: 14px;
        padding: 14px;
        border-left-width: 1px;
        border-top: 4px solid #60438f;
    }

    .cotizacion-history-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 12px;
        border-radius: 8px;
        background: #f7f4fa;
    }

    .cotizacion-history-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cotizacion-history-actions a,
    .cotizacion-history-actions button {
        min-height: 46px;
    }

    .cotizacion-fields {
        grid-template-columns: 1fr;
    }

    .cotizacion-heading {
        gap: 12px;
        margin-bottom: 18px;
        padding-bottom: 14px;
        border-bottom: 1px solid rgba(96, 67, 143, 0.18);
    }

    .cotizacion-heading h1 {
        font-size: 1.55rem;
    }

    .cotizacion-heading .eyebrow {
        margin-bottom: 5px;
    }

    .cotizacion-heading .button-link {
        width: 100%;
        min-height: 44px;
    }

    .cotizacion-heading-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .cotizacion-heading-actions .button-link {
        padding: 0 8px;
        font-size: 0.78rem;
    }

    .cotizacion-form,
    .cotizacion-dependent-fields {
        gap: 18px;
    }

    .cotizacion-client-picker {
        display: grid;
        gap: 10px;
        max-width: none;
    }

    .cotizacion-new-client {
        width: 100%;
        min-height: 46px;
    }

    .cotizacion-field,
    .cotizacion-email-card > label {
        grid-template-rows: auto auto;
    }

    .cotizacion-field--days,
    .cotizacion-field--days input,
    .cotizacion-field--payment,
    .cotizacion-field--payment select {
        width: 100%;
    }

    .cotizacion-products > header .button-link,
    .cotizacion-actions .button-link {
        width: 100%;
    }

    .cotizacion-add-product,
    .cotizacion-add-product:hover {
        min-height: 44px;
    }

    .cotizacion-products-empty {
        padding: 18px 12px;
    }

    .cotizacion-product-item {
        gap: 14px;
        padding: 14px;
        border-left-width: 1px;
        border-top: 4px solid #60438f;
    }

    .cotizacion-product-values {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cotizacion-product-values div:last-child {
        grid-column: 1 / -1;
        padding: 10px 12px;
        border-radius: 8px;
        background: #f4f0f8;
    }

    .cotizacion-product-actions {
        display: flex;
        justify-content: stretch;
    }

    .cotizacion-product-actions button {
        flex: 1 1 0;
        width: auto;
        min-height: 46px;
    }

    .cotizacion-total-bar {
        position: sticky;
        bottom: 8px;
        z-index: 10;
        justify-content: space-between;
        padding: 12px 14px;
        box-shadow: 0 10px 28px rgba(62, 40, 95, 0.26);
    }

    .cotizacion-total-bar dl {
        width: 100%;
    }

    .cotizacion-observation {
        max-width: none;
    }

    .cotizacion-actions .button-link {
        min-height: 50px;
        font-size: 1rem;
    }

    .cotizacion-product-form-grid {
        grid-template-columns: 1fr;
    }

    .cotizacion-product-form-field--wide {
        grid-column: auto;
    }

    .cotizacion-product-card .modal-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .cotizacion-product-card .modal-actions .button-link {
        width: 100%;
        min-height: 46px;
    }

    .cotizacion-product-card .searchable-select-list {
        max-height: min(34vh, 240px);
    }

    .cotizacion-product-modal,
    .cotizacion-client-modal,
    .cotizacion-generation-modal,
    .cotizacion-email-modal {
        align-items: end;
        padding: 0;
    }

    .cotizacion-product-card,
    .cotizacion-client-card,
    .cotizacion-generation-card,
    .cotizacion-email-card {
        width: 100%;
        max-height: calc(100dvh - 18px);
        padding: 18px 14px;
        overflow-y: auto;
        border-radius: 8px 8px 0 0;
    }

    .cotizacion-generation-options {
        grid-template-columns: 1fr;
    }

    .cotizacion-generation-options > button {
        grid-template-columns: 56px minmax(0, 1fr);
        grid-template-rows: auto auto;
        min-height: 0;
        padding: 14px;
    }

    .cotizacion-generation-icon {
        grid-row: 1 / 3;
        align-self: center;
        font-size: 1.45rem;
        white-space: nowrap;
    }

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

    .cotizacion-table {
        display: block;
        min-width: 0;
    }

    .cotizacion-table thead {
        display: none;
    }

    .cotizacion-table tbody {
        display: grid;
        gap: 14px;
        counter-reset: cotizacion-product;
    }

    .cotizacion-table tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 14px 10px;
        padding: 14px;
        border: 1px solid rgba(96, 67, 143, 0.2);
        border-top: 4px solid #60438f;
        border-radius: 8px;
        background: #ffffff;
        box-shadow: 0 8px 22px rgba(62, 40, 95, 0.08);
        counter-increment: cotizacion-product;
    }

    .cotizacion-table tbody tr::before {
        grid-column: 1 / -1;
        content: "Producto " counter(cotizacion-product);
        color: #60438f;
        font-size: 0.85rem;
        font-weight: 800;
        text-transform: uppercase;
    }

    .cotizacion-table tbody td {
        display: grid;
        gap: 6px;
        width: auto !important;
        padding: 0;
        border: 0;
    }

    .cotizacion-table tbody td::before {
        content: attr(data-label);
        color: #4c2826;
        font-size: 0.74rem;
        font-weight: 800;
        text-transform: uppercase;
    }

    .cotizacion-table .cotizacion-product-cell,
    .cotizacion-table tbody td:nth-child(2) {
        grid-column: 1 / -1;
    }

    .cotizacion-product-cell .searchable-select {
        min-width: 0;
    }

    .cotizacion-table input,
    .cotizacion-table select,
    .cotizacion-table .searchable-select-input {
        min-height: 48px;
        font-size: 16px;
    }

    .cotizacion-row-subtotal {
        align-content: center;
        min-height: 48px;
        padding: 8px 12px !important;
        border-radius: 8px !important;
        background: #f4f0f8;
        text-align: left !important;
    }

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

    .cotizacion-remove-row {
        width: 48px;
        height: 48px;
    }

    .cotizacion-table tfoot,
    .cotizacion-table tfoot tr {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        margin-top: 14px;
        padding: 14px;
        border-radius: 8px;
        background: #3e285f;
    }

    .cotizacion-table tfoot th,
    .cotizacion-table tfoot td {
        display: none;
        padding: 0;
        background: transparent;
        color: #ffffff;
    }

    .cotizacion-table tfoot th:first-child,
    .cotizacion-table tfoot td[data-grand-total] {
        display: block;
    }

    .cotizacion-table tfoot th:first-child {
        grid-column: 1;
        text-align: left;
    }

    .cotizacion-table tfoot td[data-grand-total] {
        grid-column: 2;
        font-size: 1.2rem;
        text-align: right;
    }

    .cotizacion-observation {
        max-width: none;
    }
}
