:root {
    --blue: #155dfc;
    --blue-dark: #122f8f;
    --red: #ff2d55;
    --green: #16a34a;
    --bg: #f3f6fb;
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --text: #172033;
    --muted: #64748b;
    --line: #d8e0ee;
    --shadow: 0 14px 34px rgba(15, 47, 143, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

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

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--blue-dark), var(--blue), var(--red));
}

.login-card {
    width: min(420px, calc(100vw - 32px));
    background: var(--surface);
    padding: 34px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--red);
    color: #ffffff;
    font-weight: 900;
    font-size: 22px;
}

.login-card h1 {
    margin: 18px 0 4px;
    font-size: 32px;
}

.login-card p {
    margin: 0 0 24px;
    color: var(--muted);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 265px 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    width: 100%;
    height: 100vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: linear-gradient(180deg, var(--blue-dark), #173aa8);
    color: #ffffff;
    padding: 22px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.sidebar-brand span {
    display: block;
    margin-top: 3px;
    color: #dbeafe;
    font-size: 13px;
}

.menu {
    display: grid;
    gap: 9px;
    margin-top: 24px;
}

.menu a {
    padding: 13px 14px;
    border-radius: 8px;
    color: #dbeafe;
    font-weight: 800;
}

.menu a.active,
.menu a:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.content {
    min-width: 0;
    padding: 28px;
    background: var(--bg);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
}

.topbar h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.15;
}

.topbar p {
    margin: 5px 0 0;
    color: var(--muted);
}

.user-box {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 8px 18px rgba(15, 47, 143, 0.05);
}

.user-box a {
    color: var(--red);
    font-weight: 900;
}

.hero-panel,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.hero-panel {
    padding: 30px;
    margin-bottom: 22px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--blue), var(--blue-dark));
}

.hero-panel h2 {
    margin: 0 0 8px;
    font-size: 34px;
    line-height: 1.15;
}

.hero-panel p {
    margin: 0;
    max-width: 760px;
    color: #dbeafe;
    font-size: 17px;
}

.panel {
    padding: 22px;
}

.table-panel,
.panel + .panel {
    margin-top: 20px;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
    margin: 4px 0 0;
    font-size: 25px;
    line-height: 1.2;
}

.eyebrow,
.eyebrow.dark {
    display: inline-block;
    color: var(--red);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.8fr);
    gap: 18px;
    align-items: start;
}

.form-stack,
.form-grid,
.stack-form {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid #d3ddea;
    border-radius: 8px;
    background: #eef3f9;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
}

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

label {
    display: grid;
    gap: 6px;
    color: #172033;
    font-size: 14px;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 2px solid #aebdd0;
    border-radius: 8px;
    padding: 10px 12px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
    font-size: 15px;
    box-shadow: 0 1px 2px rgba(23, 32, 51, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

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

input:hover,
select:hover,
textarea:hover {
    border-color: #7f93ad;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(21, 93, 252, 0.18);
}

input::placeholder,
textarea::placeholder {
    color: #7b8799;
}

input[type="color"] {
    min-height: 44px;
    padding: 5px;
    cursor: pointer;
}

input:focus,
select:focus {
    outline: 3px solid rgba(21, 93, 252, 0.18);
    border-color: var(--blue);
}

button {
    width: fit-content;
    min-width: 220px;
    min-height: 52px;
    border: 0;
    border-radius: 8px;
    padding: 14px 18px;
    background: var(--blue);
    color: #ffffff;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
}

button:hover {
    background: #0f4ee8;
}

.alert-error {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    background: #fee2e2;
    color: #991b1b;
    font-weight: 800;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 16px;
}

.module-card {
    min-height: 180px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 5px solid var(--red);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow);
}

.module-card.enabled {
    border-top-color: var(--green);
}

.module-card span {
    color: var(--muted);
    text-transform: uppercase;
    font-weight: 900;
    font-size: 12px;
}

.module-card h3 {
    margin: 8px 0;
    font-size: 22px;
}

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

.module-card strong {
    margin-top: 18px;
    color: var(--blue-dark);
}

.accent-panel {
    background: var(--surface-soft);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.tag-list span {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 10px;
    border: 2px solid var(--blue);
    border-radius: 8px;
    background: #ffffff;
    font-weight: 900;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

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

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

th {
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

tbody tr:hover {
    background: var(--surface-soft);
}

td > span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 12px;
    font-weight: 900;
}

.empty-state {
    padding: 28px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    text-align: center;
    font-weight: 800;
}

.text-red {
    color: var(--red);
}

.text-green {
    color: var(--green);
}

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

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

    button {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        overscroll-behavior: auto;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }
}
.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.summary-card {
    background: #ffffff;
    border: 1px solid var(--line);
    border-left: 5px solid var(--blue);
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.summary-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.summary-card strong {
    display: block;
    margin-top: 8px;
    font-size: 28px;
}

.summary-card.danger {
    border-left-color: var(--red);
}

.toolbar-form {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 180px 150px;
    gap: 12px;
    margin-bottom: 16px;
}

.mini-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--blue);
    border-radius: 8px;
    color: var(--blue);
    background: #ffffff;
    font-weight: 900;
}

.danger-pill {
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 900px) {
    .content {
        padding: 18px;
    }

    .sidebar {
        padding: 16px;
    }

    .summary-grid,
    .toolbar-form {
        grid-template-columns: 1fr;
    }

    .topbar h1 {
        font-size: 26px;
    }

    input,
    select {
        min-height: 44px;
    }
}

/*
 * Puesto compacto Por Su Pollo (24-09-2026)
 * Se carga desde el app.css existente. Conserva colores y permisos;
 * reduce el espacio muerto sin cambiar el flujo de los formularios.
 * Las reglas de Ventas llevan "body" para prevalecer sobre sus estilos
 * de pagina, incluidos los @media que imprimen los archivos PHP.
 */
body {
    font-size: 13px;
}

body .app-shell {
    grid-template-columns: 162px minmax(0, 1fr);
}

body .sidebar {
    padding: 10px 8px;
}

body .sidebar-brand {
    gap: 7px;
    padding-bottom: 9px;
}

body .sidebar-brand .brand-mark {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    font-size: 17px;
}

body .sidebar-brand strong {
    font-size: 13px;
}

body .sidebar-brand span {
    margin-top: 1px;
    font-size: 10px;
}

body .menu {
    gap: 2px;
    margin-top: 9px;
}

body .menu a {
    padding: 7px 9px;
    border-radius: 3px;
    font-size: 12px;
    line-height: 1.2;
}

body .content {
    min-width: 0;
    padding: 9px 11px 16px;
}

body .topbar {
    min-height: 39px;
    margin-bottom: 8px;
    gap: 8px;
}

body .topbar h1 {
    font-size: 18px;
    line-height: 1.1;
}

body .topbar p {
    margin: 1px 0 0;
    font-size: 11px;
}

body .user-box {
    gap: 7px;
    padding: 5px 8px;
    border-radius: 3px;
    box-shadow: none;
    font-size: 11px;
}

body .hero-panel,
body .panel,
body .summary-card,
body .module-card {
    border-radius: 3px;
    box-shadow: none;
}

body .hero-panel {
    margin-bottom: 8px;
    padding: 12px;
}

body .hero-panel h2 {
    font-size: 22px;
}

body .panel {
    min-width: 0;
    padding: 9px 10px;
}

body .table-panel,
body .panel + .panel {
    margin-top: 8px;
}

body .panel-heading {
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    padding-bottom: 6px;
}

body .panel-heading h2,
body .section-heading h2 {
    margin: 1px 0 0;
    font-size: 17px;
    line-height: 1.15;
}

body .panel-heading h3,
body .section-heading h3 {
    font-size: 15px;
}

body .section-heading {
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

body .section-heading p {
    margin: 2px 0 0;
    font-size: 11px;
    line-height: 1.25;
}

body .section-heading > div > .eyebrow {
    display: none;
}

body .eyebrow {
    font-size: 10px;
}

body .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 8px;
}

body .summary-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    gap: 6px;
    padding: 7px 9px;
    border-left-width: 3px;
}

body .summary-card span {
    font-size: 10px;
    line-height: 1.15;
}

body .summary-card strong {
    margin: 0;
    font-size: 20px;
    line-height: 1;
    white-space: nowrap;
}

body label {
    gap: 3px;
    min-width: 0;
    font-size: 11px;
}

body input:not([type="checkbox"]):not([type="radio"]),
body select,
body textarea {
    min-width: 0;
    min-height: 34px;
    padding: 5px 8px;
    border-width: 1px;
    border-radius: 3px;
    font-size: 13px;
}

body textarea {
    min-height: 56px;
}

body button,
body .primary-button,
body .secondary-button,
body .mini-button,
body button.mini-button {
    width: auto;
    min-width: 0;
    min-height: 35px;
    padding: 6px 10px;
    border-radius: 3px;
    font-size: 12px;
    line-height: 1.2;
}

body .row-actions,
body .filter-actions {
    gap: 5px;
}

body .form-stack,
body .form-grid,
body .stack-form {
    min-width: 0;
    gap: 8px;
    padding: 9px;
    border-radius: 3px;
}

body .management-layout {
    grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
    gap: 9px;
}

body .management-layout.is-read-only {
    grid-template-columns: minmax(0, 1fr);
}

body .toolbar-form {
    grid-template-columns: minmax(0, 1fr) minmax(135px, 190px) 86px;
    gap: 6px;
    margin-bottom: 0;
}

body .toolbar-form > button {
    width: 100%;
}

body .inventory-filter-form {
    gap: 7px;
}

body .table-wrap {
    min-width: 0;
    max-width: 100%;
    max-height: calc(100dvh - 260px);
    overflow: auto;
    border-radius: 3px;
}

body .table-wrap table {
    width: 100%;
    min-width: 0;
}

body .table-wrap th,
body .table-wrap td {
    padding: 6px 7px;
    font-size: 11px;
    line-height: 1.25;
}

body .table-wrap td:first-child {
    white-space: normal;
}

body .table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #eef3fb;
}

body .table-wrap td > span {
    margin-top: 2px;
    font-size: 10px;
}

body .status-pill {
    min-height: 22px;
    padding: 3px 7px;
    font-size: 10px;
}

body .actions-column {
    min-width: 0;
}

body .empty-state {
    padding: 13px;
    border-radius: 3px;
}

/* Informes: fechas, bodega, categoria y producto caben en una banda. */
body .report-filter-panel,
body .report-kpi-grid,
body .report-main-grid,
body .report-secondary-grid,
body .report-alert-panel,
body .report-detail-grid {
    margin-bottom: 8px;
}

body .report-filter-form {
    grid-template-columns: minmax(230px, 1.45fr) repeat(3, minmax(115px, 1fr));
    gap: 7px;
    padding: 8px;
}

body .report-filter-form input,
body .report-filter-form select {
    min-height: 34px;
    padding: 5px 7px;
}

body .report-date-filter legend {
    margin-bottom: 2px;
}

body .report-date-range {
    gap: 5px;
}

body .report-filter-footer {
    gap: 8px;
    padding-top: 0;
}

body .report-filter-actions {
    gap: 6px;
}

body .report-filter-actions .primary-button,
body .report-filter-actions .secondary-button {
    min-width: 0;
    min-height: 34px;
    padding: 5px 9px;
}

body .report-kpi-grid {
    gap: 6px;
}

body .report-kpi {
    min-height: 73px;
    padding: 9px;
    border-radius: 3px;
    box-shadow: none;
}

body .report-kpi > strong,
body .report-kpi > strong.report-kpi-date {
    margin-top: 3px;
    font-size: 18px;
}

body .report-kpi small {
    margin-top: 3px;
    font-size: 10px;
}

/* Caja y Delivery: productos y pedido quedan lado a lado. */
body .sales-pos .pos-lead,
body .sales-catalog .catalog-lead,
body .sales-history .history-lead {
    display: none;
}

body .sales-pos .pos-heading-actions {
    gap: 5px;
}

body .sales-pos .pos-heading-actions a {
    min-width: 0;
}

body .sales-pos .channel-switch {
    gap: 4px;
    margin-bottom: 8px;
    padding: 4px;
    border-radius: 3px;
}

body .sales-pos .channel-switch a {
    min-height: 40px;
    padding: 6px 8px;
    border-width: 1px;
    border-radius: 3px;
    font-size: 13px;
    box-shadow: none;
}

body .sales-pos .channel-switch small {
    font-size: 10px;
}

body .sales-pos .pos-layout {
    grid-template-columns: minmax(0, 1.5fr) minmax(300px, .9fr);
    gap: 8px;
}

body .sales-pos .catalog-panel,
body .sales-pos .cart-panel {
    padding: 9px;
    border-radius: 3px;
    box-shadow: none;
}

body .sales-pos .cart-panel {
    position: sticky;
    top: 7px;
    max-height: calc(100dvh - 152px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

body .sales-pos .catalog-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px;
    margin-bottom: 6px;
}

body .sales-pos .search-box input {
    min-height: 37px;
    padding: 6px 8px 6px 31px;
    border-width: 1px;
}

body .sales-pos .search-box span {
    left: 9px;
    font-size: 14px;
}

body .sales-pos .category-tabs {
    gap: 4px;
    margin-bottom: 7px;
    padding-bottom: 3px;
}

body .sales-pos .category-tab {
    min-height: 35px;
    padding: 5px 9px;
    border-width: 1px;
    border-radius: 3px;
    font-size: 11px;
}

body .sales-pos .category-tab::before {
    width: 7px;
    height: 7px;
    margin-right: 4px;
}

body .sales-pos .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-content: start;
    gap: 5px;
    max-height: calc(100dvh - 254px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
}

body .sales-pos .product-button {
    min-height: 69px;
    padding: 6px 7px;
    border-width: 1px;
    border-top: 4px solid var(--item-color, var(--pos-blue));
    border-radius: 3px;
    box-shadow: none;
}

body .sales-pos .product-button strong {
    min-height: 0;
    font-size: 12px;
    line-height: 1.16;
}

body .sales-pos .product-button small {
    margin-top: 2px;
    font-size: 10px;
}

body .sales-pos .product-button span {
    margin-top: 3px;
    font-size: 14px;
}

body .sales-pos .empty-catalog {
    min-height: 130px;
    padding: 12px;
}

body .sales-pos .cart-heading {
    margin-bottom: 5px;
    padding-bottom: 5px;
}

body .sales-pos .cart-heading h2 {
    font-size: 16px;
}

body .sales-pos .cart-count {
    min-width: 27px;
    height: 27px;
}

body .sales-pos .cart-empty {
    padding: 9px 6px;
    border-width: 1px;
}

body .sales-pos .cart-lines {
    gap: 5px;
    max-height: 140px;
}

body .sales-pos .cart-line {
    padding: 6px;
    border-radius: 3px;
}

body .sales-pos .order-fields {
    gap: 6px;
    margin-top: 7px;
    padding-top: 7px;
}

body .sales-pos .order-fields label {
    gap: 2px;
    font-size: 11px;
}

body .sales-pos .order-fields input,
body .sales-pos .order-fields select,
body .sales-pos .order-fields textarea {
    min-height: 35px;
    padding: 5px 7px;
    border-width: 1px;
    border-radius: 3px;
    font-size: 12px;
}

body .sales-pos .order-fields textarea {
    min-height: 41px;
}

body .sales-pos .order-fields .span-all:has(#delivery-customer-select),
body .sales-pos .order-fields .span-all:has(#delivery-customer-alias) {
    grid-column: auto;
}

body .sales-pos .totals {
    position: sticky;
    bottom: 41px;
    z-index: 2;
    gap: 3px;
    margin-top: 7px;
    padding: 5px 0;
    background: #ffffff;
}

body .sales-pos .total-row.grand-total {
    font-size: 18px;
}

body .sales-pos .cart-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    gap: 5px;
    margin-top: 0;
    padding-top: 4px;
    background: #ffffff;
}

body .sales-pos .clear-cart,
body .sales-pos .confirm-order {
    min-height: 42px;
    padding: 6px 8px;
    border-radius: 3px;
    font-size: 12px;
}

body .sales-pos .keyboard-hint {
    margin: 4px 0 0;
    font-size: 10px;
}

/* Carta: una linea de categorias y tabla con desplazamiento interior. */
body .sales-catalog .catalog-summary {
    gap: 6px;
    margin-bottom: 8px;
}

body .sales-catalog .catalog-summary article {
    min-height: 47px;
    padding: 6px 8px;
    border-left-width: 3px;
    border-radius: 3px;
    box-shadow: none;
}

body .sales-catalog .catalog-summary strong {
    margin-top: 2px;
    font-size: 18px;
}

body .sales-catalog .catalog-summary span {
    font-size: 10px;
}

body .sales-catalog .catalog-form-grid {
    gap: 7px;
}

body .sales-catalog .check-grid {
    gap: 6px;
}

body .sales-catalog .check-card {
    min-height: 42px;
    gap: 7px;
    padding: 6px;
    border-width: 1px;
    border-radius: 3px;
}

body .sales-catalog .recipe-box {
    padding: 8px;
    border-width: 1px;
    border-radius: 3px;
}

body .sales-catalog .recipe-heading {
    align-items: center;
    gap: 7px;
    margin-bottom: 5px;
}

body .sales-catalog .recipe-heading h3 {
    font-size: 14px;
}

body .sales-catalog .recipe-heading p {
    margin-top: 1px;
    font-size: 11px;
}

body .sales-catalog .recipe-row {
    grid-template-columns: minmax(0, 1fr) 85px 56px 35px;
    gap: 5px;
    margin-top: 5px;
}

body .sales-catalog .recipe-unit,
body .sales-catalog .remove-component {
    min-height: 35px;
    border-radius: 3px;
}

body .sales-catalog .category-strip {
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 3px;
}

body .sales-catalog .category-chip {
    flex: 0 0 auto;
    min-height: 29px;
    padding: 4px 7px;
    border-radius: 3px;
    font-size: 11px;
}

body .sales-catalog .table-wrap {
    max-height: calc(100dvh - 260px);
}

/* Configuracion: cuatro estados en una fila y formularios tipo planilla. */
body .sales-settings .settings-lead {
    display: none;
}

body .sales-settings .health-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 8px;
}

body .sales-settings .health-card {
    min-height: 47px;
    padding: 6px 8px;
    border-left-width: 3px;
    border-radius: 3px;
    box-shadow: none;
}

body .sales-settings .health-card strong {
    font-size: 14px;
}

body .sales-settings .health-card small {
    margin-top: 1px;
    font-size: 10px;
}

body .sales-settings .settings-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 8px;
    padding: 4px;
    border-radius: 3px;
}

body .sales-settings .settings-tabs a {
    min-height: 34px;
    padding: 5px 7px;
    border-radius: 3px;
    font-size: 11px;
}

body .sales-settings .settings-form-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
}

body .sales-settings .check-card {
    min-height: 43px;
    padding: 6px;
    border-width: 1px;
    border-radius: 3px;
}

body .sales-settings .split-layout {
    grid-template-columns: minmax(215px, .8fr) minmax(0, 1.6fr);
    gap: 8px;
}

body .sales-settings .route-grid {
    gap: 6px;
}

body .sales-settings .route-card {
    padding: 8px;
    border-width: 1px;
    border-radius: 3px;
}

body .sales-settings .route-fields {
    gap: 5px;
}

body .sales-settings .setup-note {
    padding: 8px;
    border-radius: 3px;
    font-size: 12px;
}

/* Historial y Cocina: cuadriculas densas, KDS aun legible a distancia. */
body .sales-history .history-filters {
    margin-bottom: 8px;
    padding: 8px;
    border-radius: 3px;
    box-shadow: none;
}

body .sales-history .filter-grid {
    grid-template-columns: repeat(2, minmax(95px, 1fr))
        minmax(82px, .8fr) minmax(90px, .8fr)
        minmax(120px, 1.3fr) auto;
    gap: 5px;
}

body .sales-history .filter-actions {
    gap: 4px;
}

body .sales-history .filter-actions .primary-button,
body .sales-history .filter-actions .secondary-button {
    min-height: 34px;
    padding: 5px 7px;
}

body .sales-history .summary-grid {
    gap: 5px;
    margin-bottom: 8px;
}

body .sales-history .summary-card {
    min-height: 45px;
    padding: 6px 8px;
    border-left-width: 3px;
    box-shadow: none;
}

body .sales-history .summary-card strong {
    margin-top: 0;
    font-size: 18px;
}

body .sales-history .history-layout {
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, .8fr);
    gap: 8px;
}

body .sales-history .history-panel,
body .sales-history .detail-panel {
    border-radius: 3px;
    box-shadow: none;
}

body .sales-history .panel-heading,
body .sales-history .detail-heading {
    padding: 8px;
}

body .sales-history .order-table-wrap {
    max-height: calc(100dvh - 275px);
    overflow: auto;
}

body .sales-history .order-table th,
body .sales-history .order-table td {
    padding: 6px 7px;
}

body .sales-kds .kds-toolbar {
    gap: 7px;
    margin-bottom: 7px;
    padding: 7px 9px;
    border-radius: 3px;
    box-shadow: none;
}

body .sales-kds .kds-filter-bar {
    gap: 4px;
    margin-bottom: 7px;
    padding: 4px;
    border-radius: 3px;
}

body .sales-kds .kds-filter-bar a {
    min-height: 38px;
    border-radius: 3px;
    font-size: 12px;
}

body .sales-kds .kds-summary {
    gap: 6px;
    margin-bottom: 7px;
}

body .sales-kds .kds-summary article {
    min-height: 42px;
    padding: 5px 8px;
    border-radius: 3px;
}

body .sales-kds .kds-summary strong {
    margin-top: 0;
    font-size: 18px;
}

body .sales-kds .kds-board {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 7px;
}

body .sales-kds .kds-empty {
    min-height: 150px;
    padding: 16px;
}

body .sales-kds .ready-button {
    min-height: 46px;
}

@media (max-width: 1380px) {
    body .sales-pos .product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body .sales-pos .pos-layout {
        grid-template-columns: minmax(0, 1.45fr) minmax(290px, .9fr);
    }
}

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

    body .sidebar {
        padding: 7px 5px;
    }

    body .menu a {
        padding: 7px 6px;
        font-size: 11px;
    }

    body .sales-pos .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body .sales-pos .pos-layout {
        grid-template-columns: minmax(0, 1fr) minmax(278px, .8fr);
    }

    body .report-kpi-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    body .management-layout {
        grid-template-columns: minmax(185px, 230px) minmax(0, 1fr);
    }

    body .management-layout.is-read-only {
        grid-template-columns: minmax(0, 1fr);
    }

    body .sales-settings .settings-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    body .topbar {
        flex-direction: row;
        align-items: center;
    }

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

    body .toolbar-form {
        grid-template-columns: minmax(0, 1fr) minmax(115px, 150px) 74px;
    }

    body .inventory-filter-form {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body .report-filter-form {
        grid-template-columns: minmax(200px, 1.3fr) repeat(3, minmax(100px, 1fr));
    }

    body .sales-history .summary-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    body .sales-settings .split-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 760px) {
    body .app-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    body .sidebar {
        position: static;
        height: auto;
        overflow: visible;
        padding: 5px 8px;
    }

    body .sidebar-brand {
        display: none;
    }

    body .menu {
        display: flex;
        gap: 4px;
        margin: 0;
        overflow-x: auto;
        white-space: nowrap;
    }

    body .menu a {
        flex: 0 0 auto;
    }

    body .content {
        padding: 7px;
    }

    body .management-layout,
    body .sales-pos .pos-layout,
    body .sales-history .history-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    body .sales-pos .cart-panel {
        position: static;
        max-height: none;
        overflow: visible;
    }

    body .sales-pos .totals,
    body .sales-pos .cart-actions {
        position: static;
    }

    body .sales-pos .product-grid {
        max-height: 48dvh;
    }

    body .sales-pos .order-fields,
    body .sales-pos .channel-switch,
    body .sales-pos .catalog-toolbar,
    body .sales-pos .cart-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body .sales-pos .order-fields .span-all,
    body .sales-catalog .span-all {
        grid-column: 1 / -1;
    }

    body .report-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body .report-date-filter {
        grid-column: 1 / -1;
    }

    body .report-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body .sales-settings .health-grid,
    body .sales-settings .settings-tabs,
    body .sales-settings .settings-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body .sales-history .filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body .sales-history .filter-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 520px) {
    body .user-box span,
    body .report-filter-note {
        display: none;
    }

    body .summary-grid,
    body .sales-catalog .catalog-summary,
    body .sales-history .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body .inventory-filter-form {
        grid-template-columns: minmax(0, 1fr);
    }

    body .inventory-filter-form .full {
        grid-column: auto;
    }

    body .toolbar-form {
        grid-template-columns: minmax(0, 1fr) 95px;
    }

    body .toolbar-form > button {
        grid-column: 1 / -1;
    }

    body .sales-pos .pos-heading-actions {
        display: none;
    }

    body .sales-catalog .recipe-row {
        grid-template-columns: minmax(0, 1fr) 72px 35px;
    }

    body .sales-catalog .recipe-unit {
        display: none;
    }
}

/* Inicio: accesos de trabajo en lugar de estados de m¨®dulos antiguos. */
body .dashboard-home .section-heading {
    margin-bottom: 10px;
}

body .dashboard-home .section-heading h2 {
    margin: 0;
    font-size: 18px;
}

body .dashboard-home .section-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

body .dashboard-home .shortcut-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}

body .dashboard-home .shortcut-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-content: center;
    gap: 3px 8px;
    min-height: 70px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--blue);
    background: #ffffff;
}

body .dashboard-home .shortcut-card strong {
    font-size: 14px;
}

body .dashboard-home .shortcut-card span {
    grid-row: 2;
    font-size: 11px;
    color: var(--muted);
}

body .dashboard-home .shortcut-card b {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
    color: var(--blue);
    font-size: 22px;
}

body .dashboard-home .shortcut-card:hover,
body .dashboard-home .shortcut-card:focus-visible {
    border-color: var(--blue);
    background: #f3f7ff;
}

/* El historial inicia con la tabla; los campos aparecen al tocar Filtros. */
body .movement-filter-panel {
    margin-bottom: 8px;
}

body .movement-filter-panel > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 35px;
    cursor: pointer;
    list-style: none;
}

body .movement-filter-panel > summary::-webkit-details-marker {
    display: none;
}

body .movement-filter-panel > summary strong {
    font-size: 13px;
}

body .movement-filter-panel > summary span {
    color: var(--muted);
    font-size: 11px;
}

body .movement-filter-panel > summary::after {
    content: 'Mostrar';
    margin-left: auto;
    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
}

body .movement-filter-panel[open] > summary::after {
    content: 'Ocultar';
}

body .movement-filter-panel[open] .movements-filter-form {
    margin-top: 6px;
}

/* La ficha de Delivery desplaza los campos sin taparlos con el total. */
body .sales-pos .cart-panel {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 215px);
    min-height: 340px;
    max-height: calc(100dvh - 215px);
    overflow: hidden;
}

body .sales-pos .cart-heading,
body .sales-pos .totals,
body .sales-pos .cart-actions,
body .sales-pos .keyboard-hint {
    flex: none;
}

body .sales-pos .cart-content-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 3px;
}

body .sales-pos .cart-panel .totals,
body .sales-pos .cart-panel .cart-actions {
    position: static;
    bottom: auto;
    z-index: auto;
}

body .sales-pos .cart-panel .cart-lines {
    max-height: none;
}

/* Todas las categor¨ªas a la vista; cada una abre su edici¨®n. */
body .sales-catalog .category-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 4px;
    overflow: visible;
    padding: 0;
}

body .sales-catalog .category-chip {
    min-width: 0;
    min-height: 37px;
    width: 100%;
    white-space: normal;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

body .sales-catalog .category-chip i {
    flex: none;
}

@media (max-width: 1100px) {
    body .sales-pos .cart-panel {
        height: auto;
        max-height: none;
        min-height: 0;
        overflow: visible;
    }

    body .sales-pos .cart-content-scroll {
        overflow: visible;
    }
}

@media (max-width: 750px) {
    body .dashboard-home .shortcut-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body .sales-catalog .category-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Seleccion directa de categorias en la carta y caja de alta rotacion. */
body .sales-catalog .category-strip {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

body .sales-catalog .category-choice {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px;
    min-width: 0;
}

body .sales-catalog .category-chip {
    display: flex;
    min-width: 0;
    min-height: 43px;
    align-items: center;
    padding: 5px 7px;
    border-width: 2px;
}

body .sales-catalog .category-chip span {
    min-width: 0;
    flex: 1;
}

body .sales-catalog .category-chip small {
    margin-left: auto;
    color: #475569;
    font-size: 10px;
}

body .sales-catalog .category-chip.selected {
    border-color: #155dfc;
    background: #eaf1ff;
    color: #12328b;
}

body .sales-catalog .category-edit {
    display: grid;
    min-height: 43px;
    place-items: center;
    padding: 4px 5px;
    border: 1px solid #b9c7dc;
    border-radius: 3px;
    background: #fff;
    color: #155dfc;
    font-size: 10px;
    font-weight: 800;
}

body .sales-catalog #catalog-items {
    scroll-margin-top: 12px;
}

body .sales-catalog .catalog-result-count {
    color: #475569;
    font-size: 11px;
}

body .sales-pos .category-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 5px;
    overflow: visible;
    padding: 0;
}

body .sales-pos .category-tab {
    display: grid;
    min-width: 0;
    min-height: 46px;
    place-items: center;
    padding: 4px 6px;
    border: 1px solid #b9c7dc;
    border-left: 4px solid var(--category-color, #155dfc);
    border-radius: 3px;
    font-size: 11px;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
}

body .sales-pos .category-tab::before {
    display: none;
}

body .sales-pos .category-tab.active,
body .sales-pos .category-tab:focus-visible {
    outline: 2px solid #155dfc;
    outline-offset: 0;
    background: #eaf1ff;
    color: #12328b;
}

body .sales-pos .product-grid {
    max-height: max(180px, calc(100dvh - 338px));
}

@media (max-width: 750px) {
    body .sales-catalog .category-strip,
    body .sales-pos .category-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
