/* Delivery Routes page — table, legend, expanded rows, footer */

.ls-route-table thead th {
    background: var(--gray-50);
    font-size: 0.74rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--gray-600);
    font-weight: 600;
    vertical-align: middle;
}

.ls-route-main-row td {
    vertical-align: top;
}

.ls-route-main-row:hover {
    background: #fafcff;
}

.ls-route-name-text {
    font-weight: 600;
    color: var(--gray-900);
}

.ls-route-description {
    font-size: 0.76rem;
    color: var(--gray-500);
    margin-top: 2px;
    line-height: 1.25;
}

.ls-route-other-items-chip,
.ls-route-other-items-chip-small {
    font-size: 0.68rem;
    font-weight: 600;
    border-color: #e9d5ff;
    color: #7c3aed;
    background: #faf5ff;
}

.ls-route-bottles-summary-chip {
    font-size: 0.68rem;
    font-weight: 600;
    border-color: #bfdbfe;
    color: #1d4ed8;
    background: #eff6ff;
}

.ls-route-customers-header {
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-200);
    padding: 7px 12px;
}

.ls-route-customers-header-text {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ls-route-customer-row td {
    background: #fcfcfd;
}

.ls-route-customer-info {
    padding: 2px 0;
}

.ls-route-customer-card-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: start;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    padding: 10px 12px;
}

.ls-route-customer-product-line {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 2px;
    line-height: 1.35;
}

    .ls-route-customer-product-line .fw-semibold {
        color: #374151;
    }

.ls-route-customer-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ls-route-customer-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
}

@media (max-width: 1100px) {
    .ls-route-customer-card-row {
        grid-template-columns: 1fr;
    }

    .ls-route-customer-card-meta {
        justify-content: flex-start;
    }
}

.ls-route-totals-row td {
    background: #f8fafc;
    border-top: 1px solid var(--gray-200);
}

.dr-table-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e5eaf0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dr-table-scroll {
    height: calc(-297px + 100vh);
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    scrollbar-gutter: stable;
}

/* Adjust table scroll height based on whether the app footer is shown. */
.ls-footer-visible {
    --ls-global-footer-height: 70px;
}

.ls-footer-hidden {
    --ls-global-footer-height: 16px;
}

.ls-footer-visible .dr-table-scroll {
    height: calc(-245px + 100vh - var(--ls-global-footer-height));
}

.ls-footer-hidden .dr-table-scroll {
    height: calc(-250px + 100vh - var(--ls-global-footer-height));
}

.ls-data-grid-scroll.ls-routes-scroll {
    overflow: hidden !important;
}

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

    .dr-table thead th {
        padding: 9px 12px;
        font-size: 10.5px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: .06em;
        color: #6b7280;
        background: #f8fafc;
        border-bottom: 1px solid #e5eaf0;
        text-align: left;
        white-space: nowrap;
        position: sticky;
        top: 0;
        z-index: 3;
    }

    .dr-table td {
        padding: 10px 12px;
        vertical-align: middle;
        border-bottom: 1px solid #edf1f7;
        white-space: nowrap;
    }

.dr-data-row:hover > td {
    background: #fafbfd;
}

.dr-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px solid #e5eaf0;
    border-radius: 5px;
    background: #fff;
    color: #6b7280;
}

    .dr-expand-btn.open {
        background: #3b82f6;
        color: #fff;
        border-color: #3b82f6;
    }

        .dr-expand-btn.open .mud-icon-root {
            transform: rotate(90deg);
        }

.dr-route-name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.dr-route-desc {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
}

.dr-person {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dr-avatar {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.dr-person-name {
    font-size: 12px;
    font-weight: 500;
    color: #111827;
}

.dr-empty {
    color: #9ca3af;
    font-size: 11px;
}

.dr-sub-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
}

.dr-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

    .dr-badge.morning {
        background: #fffbeb;
        color: #b45309;
    }

    .dr-badge.evening {
        background: #dbeafe;
        color: #1d4ed8;
    }

.dr-cbreak {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dr-cgroup {
    display: flex;
    align-items: center;
    gap: 6px;
    border-right: 1px solid #edf1f7;
    padding-right: 9px;
}

    .dr-cgroup.dr-cgroup-last {
        border-right: none;
        padding-right: 0;
    }

.dr-cicon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: inline-block;
}

    .dr-cicon.glass {
        background: #e0f2fe;
    }

    .dr-cicon.bottle {
        background: #d1fae5;
    }

    .dr-cicon.bag {
        background: #ede9fe;
    }

.dr-cgroup-sizes {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.dr-sz {
    display: inline-flex;
    align-items: baseline;
    gap: 1px;
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.dr-sz-val {
    font-size: 10px;
    font-weight: 500;
    opacity: .75;
}

.dr-sz.glass {
    color: #0ea5e9;
}

.dr-sz.bottle {
    color: #059669;
}

.dr-sz.bag {
    color: #8b5cf6;
}

.dr-sz-zero {
    opacity: .35;
}

.dr-toggle {
    position: relative;
    display: inline-flex;
    width: 34px;
    height: 19px;
}

    .dr-toggle input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.dr-toggle-track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #d1d5db;
    cursor: pointer;
    transition: background .2s;
}

    .dr-toggle-track::after {
        content: '';
        position: absolute;
        width: 13px;
        height: 13px;
        top: 3px;
        left: 3px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
        transition: transform .2s;
    }

.dr-toggle input:checked + .dr-toggle-track {
    background: #10b981;
}

    .dr-toggle input:checked + .dr-toggle-track::after {
        transform: translateX(15px);
    }

.dr-expanded-row .dr-expanded-cell {
    background: #f9fafb;
    padding: 0;
}

.dr-expanded-inner {
    padding: 14px 18px 16px;
}

.dr-expanded-title {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #6b7280;
    margin-bottom: 10px;
}

.dr-loading {
    display: flex;
    justify-content: center;
    padding: 16px;
}

.dr-sub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px;
}

.dr-sub-card {
    background: #fff;
    border: 1px solid #e5eaf0;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
}

.dr-sub-card-top {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 8px;
}

.dr-sub-card-header {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 0%;
}

.dr-sub-card-name {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dr-sub-card-addr {
    font-size: 11px;
    color: #9ca3af;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dr-sub-card-items {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.dr-sub-item {
    flex: 1 1 calc(50% - 3px);
    min-width: 80px;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

    .dr-sub-item.buffalo {
        border-color: #bfdbfe;
        background: #eff6ff;
    }

    .dr-sub-item.cow {
        border-color: #bbf7d0;
        background: #f0fdf4;
    }

.dr-sub-item-top {
    font-size: 10.5px;
    color: #64748b;
    margin-bottom: 2px;
}

.dr-sub-item-qty {
    font-weight: 700;
    color: #111827;
}

.dr-sub-item-bottom {
    font-size: 10px;
    color: #9ca3af;
    border-top: 1px solid rgba(0, 0, 0, .04);
    padding-top: 2px;
}

.dr-sub-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.dr-sub-actions-top {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

.dr-btn-switch-small {
    min-width: auto;
    padding-inline: 8px;
    font-size: 0.72rem;
}

/* Footer — sticky under table, section accents match legend */
.dr-footer-sticky {
    position: relative;
    z-index: 2;
    box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.06);
    flex-shrink: 0;
    overflow-x: hidden;
}

.dr-footer-bar {
    display: flex;
    align-items: stretch;
    padding: 0.2rem;
    gap: 8px 2px;
    flex-wrap: wrap;
}

.dr-footer-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    padding: 7px 7px 7px 7px;
    border-right: 1px solid #e2e8f0;
    min-height: 44px;
    border-radius: 8px;
}

    .dr-footer-section:last-child {
        border-right: none;
    }

.dr-footer-section-head {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dr-footer-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

    .dr-footer-dot.glass {
        background: #38bdf8;
    }

    .dr-footer-dot.bottle {
        background: #34d399;
    }

    .dr-footer-dot.bag {
        background: #a78bfa;
    }

    .dr-footer-dot.routes {
        background: #94a3b8;
    }

    .dr-footer-dot.milk {
        background: #f59e0b;
    }

.dr-footer-section--routes {
    border-left: 3px solid #64748b;
}

.dr-footer-section--milk {
    border-left: 3px solid #f59e0b;
}

.dr-footer-section--glass {
    border-left: 3px solid #0ea5e9;
}

.dr-footer-section--bottle {
    border-left: 3px solid #10b981;
}

.dr-footer-section--bag {
    border-left: 3px solid #8b5cf6;
}

.dr-footer-label {
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: .08em;
    white-space: nowrap;
}

.dr-footer-section--routes .dr-footer-label {
    color: #475569;
}

.dr-footer-section--milk .dr-footer-label {
    color: #b45309;
}

.dr-footer-section--glass .dr-footer-label {
    color: #0369a1;
}

.dr-footer-section--bottle .dr-footer-label {
    color: #047857;
}

.dr-footer-section--bag .dr-footer-label {
    color: #6d28d9;
}

.dr-footer-value {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
    white-space: normal;
    line-height: 1.35;
}

.dr-footer-value-main {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.dr-footer-value-sub {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: lowercase;
}

.dr-footer-kpi-sep {
    color: #cbd5e1;
    font-weight: 700;
    user-select: none;
    padding: 0 1px;
}

.dr-footer-icon-muted {
    color: #94a3b8 !important;
    opacity: 0.95;
}

.dr-badge-value--muted {
    color: #94a3b8;
    font-weight: 600;
}

.dr-footer-total {
    font-size: 11px;
    font-weight: 800;
    color: #334155;
    padding-left: 8px;
    margin-left: 4px;
    border-left: 2px solid #cbd5e1;
}

.dr-footer-total-prefix {
    font-weight: 600;
    color: #64748b;
    margin-right: 2px;
}

.dr-badge-value {
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    line-height: 1.35;
}

    .dr-badge-value strong {
        font-weight: 800;
        color: #0f172a;
    }

.dr-footer-grand {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    border-right: none;
    flex-shrink: 0;
    padding: 8px 14px;
    min-width: 5.5rem;
    background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.dr-footer-grand-num {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.dr-footer-grand-label {
    font-size: 9.5px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-bottom: 4px;
}

@media (max-width: 1280px) {
    .dr-footer-section {
        border-right: none;
        padding-right: 10px;
    }

    .dr-footer-grand {
        margin-left: auto;
        padding-left: 12px;
    }
}
