:root {
    --sidebar-width: 280px;
    --brand: #1f5eff;
    --brand-dark: #1748c7;
    --body-bg: #f4f7fb;
    --card-border: #e8edf5;
    --soft-text: #6c757d;
    --success-soft: #e8fff2;
    --warning-soft: #fff8e5;
    --danger-soft: #fff0f0;
    --info-soft: #eaf6ff;
}

body {
    min-height: 100vh;
    background: var(--body-bg);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1f2937;
}

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

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #101828 0%, #172033 100%);
    color: #fff;
}

.sidebar .brand-box {
    padding: 1.3rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 14px 30px rgba(31, 94, 255, .25);
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, .72);
    border-radius: 14px;
    padding: .75rem .95rem;
    margin-bottom: .25rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    font-weight: 500;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, .11);
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .65);
    font-size: .875rem;
}

.main-content {
    flex: 1;
    min-width: 0;
}

.topbar {
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.page-card,
.stat-card,
.filter-card,
.info-card-admin {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 22px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, .04);
}

.stat-card {
    padding: 1.15rem;
    transition: .2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 35px rgba(16, 24, 40, .08);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
}

.bg-success-soft { background: var(--success-soft); color: #128047; }
.bg-warning-soft { background: var(--warning-soft); color: #946200; }
.bg-danger-soft { background: var(--danger-soft); color: #c03434; }
.bg-info-soft { background: var(--info-soft); color: #1769aa; }

.custom-search {
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e7edf5;
    padding-left: 1rem;
}

.custom-search:focus,
.form-select:focus,
.form-control:focus {
    border-color: rgba(31, 94, 255, .45);
    box-shadow: 0 0 0 .22rem rgba(31, 94, 255, .12);
}

.btn-brand {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    border-radius: 999px;
    padding-inline: 1.1rem;
    font-weight: 600;
}

.btn-brand:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}

.btn-soft {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #334155;
    border-radius: 999px;
    font-weight: 600;
}

.section-kicker {
    color: #64748b;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 700;
}

.customer-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #eaf0ff;
    color: var(--brand);
    font-weight: 800;
    flex: 0 0 auto;
}

.badge-soft {
    border-radius: 999px;
    padding: .45rem .7rem;
    font-weight: 700;
    font-size: .73rem;
}

.badge-pending { background: #fff8e5; color: #946200; }
.badge-paid { background: #e8fff2; color: #128047; }
.badge-factory { background: #eaf6ff; color: #1769aa; }
.badge-delivery { background: #f2efff; color: #6246b3; }
.badge-cancelled { background: #fff0f0; color: #c03434; }

.table thead th {
    color: #64748b;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .045em;
    border-bottom: 1px solid #eef2f7;
    background: #fbfdff;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
    color: #334155;
}

.timeline-admin {
    position: relative;
    padding-left: 1.4rem;
}

.timeline-admin::before {
    content: "";
    position: absolute;
    left: .45rem;
    top: .25rem;
    bottom: .25rem;
    width: 2px;
    background: #e5eaf1;
}

.timeline-item-admin {
    position: relative;
    padding-bottom: 1rem;
}

.timeline-item-admin::before {
    content: "";
    position: absolute;
    left: -1.17rem;
    top: .2rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--brand);
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px rgba(31, 94, 255, .18);
}

.timeline-item-admin.is-muted::before {
    background: #cbd5e1;
    box-shadow: 0 0 0 2px rgba(203, 213, 225, .35);
}

.empty-note {
    display: none;
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--soft-text);
}

.metric-number {
    font-size: 1.9rem;
    line-height: 1;
}

.info-card-admin {
    padding: 1.25rem;
    height: 100%;
}

.info-card-admin strong {
    display: block;
    margin-bottom: .65rem;
    color: #0f172a;
}

.info-card-admin p {
    margin-bottom: .35rem;
    color: #475569;
}

.delivery-date-requested-admin,
.delivery-date-proposed-admin {
    padding: .45rem .6rem;
    border-radius: .4rem;
    font-weight: 700;
}

.delivery-date-requested-admin {
    color: #8a4b00 !important;
    background: #fff3cd;
    border-left: 4px solid #f0a000;
}

.delivery-date-proposed-admin {
    color: #8b1e1e !important;
    background: #fff0f0;
    border-left: 4px solid #d83a3a;
}

.delivery-date-alert-admin {
    margin: .75rem 0;
    padding: .75rem;
    color: #842029;
    background: #fff0f0;
    border: 1px solid #f3b9b9;
    border-left: 5px solid #d83a3a;
    border-radius: .45rem;
    font-size: .875rem;
}

.order-actions-grid,
.product-update-form {
    display: grid;
    gap: 1rem;
}

.product-tile {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 22px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(16, 24, 40, .04);
    height: 100%;
}

.product-type-card {
    border: 1px solid #edf2f7;
    border-radius: 18px;
    padding: 1rem;
    background: #fbfdff;
}

.price-history {
    font-size: .84rem;
    color: #64748b;
}

.admin-auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
    background:
        radial-gradient(circle at top left, rgba(31, 94, 255, .2), transparent 28%),
        linear-gradient(180deg, #f5f8ff 0%, #eef3fb 100%);
}

.admin-auth-card {
    width: min(100%, 460px);
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(16, 24, 40, .1);
    overflow: hidden;
}

.admin-auth-head {
    padding: 1.6rem;
    background: linear-gradient(180deg, #101828 0%, #172033 100%);
    color: #fff;
}

.admin-auth-body {
    padding: 1.6rem;
}

.topbar-title small {
    display: block;
}

.analytics-card {
    overflow: hidden;
}

.chart-wrap {
    position: relative;
    min-height: 310px;
}

.chart-wrap-wide {
    min-height: 340px;
}

.chart-wrap-district {
    min-height: max(320px, calc(var(--district-count) * 44px));
    max-height: 720px;
}

.empty-chart-state {
    min-height: 220px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: .75rem;
    color: #64748b;
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
    background: #f8fafc;
}

.empty-chart-state i {
    font-size: 2rem;
}

@media (min-width: 992px) {
    .sidebar-desktop {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 1030;
    }

    .main-content {
        margin-left: var(--sidebar-width);
    }
}

@media (max-width: 575.98px) {
    .content-wrap {
        padding-inline: .85rem !important;
    }

    .page-card,
    .stat-card,
    .filter-card,
    .info-card-admin,
    .product-tile {
        border-radius: 18px;
    }

    .topbar-title small {
        display: none;
    }

    .table td,
    .table th {
        font-size: .86rem;
    }
}
