:root {
    --ink: #18233a;
    --muted: #73809a;
    --line: #dfe5ef;
    --panel: #ffffff;
    --bg: #f6f8fc;
    --blue: #2268ff;
    --purple: #7042c9;
    --teal: #17bebb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    letter-spacing: 0;
}

.top-strip {
    align-items: center;
    background: #050505;
    color: #fff;
    display: flex;
    font-size: 14px;
    gap: 28px;
    height: 54px;
    justify-content: center;
    padding: 0 18px;
}

.app-shell {
    display: flex;
    min-height: calc(100vh - 54px);
}

.sidebar {
    background: #fff;
    border-right: 1px solid var(--line);
    flex: 0 0 248px;
    padding: 24px 18px;
}

.brand {
    align-items: center;
    color: var(--ink);
    display: flex;
    font-weight: 800;
    gap: 12px;
    margin-bottom: 34px;
    text-decoration: none;
}

.brand img {
    height: 40px;
    object-fit: contain;
    width: 86px;
}

.nav-link {
    align-items: center;
    border-radius: 6px;
    color: #42506a;
    display: flex;
    gap: 12px;
    min-height: 42px;
    padding: 10px 12px;
}

.nav-link i {
    color: #7e8aa3;
    width: 18px;
}

.nav-link.active,
.nav-link:hover {
    background: #eef3ff;
    color: var(--blue);
}

.nav-link.active i,
.nav-link:hover i {
    color: var(--blue);
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 34px 42px;
}

.page-header {
    align-items: center;
    display: flex;
    gap: 18px;
    justify-content: space-between;
    margin: 0 auto 28px;
    max-width: 1320px;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 800;
    margin: 0;
}

.eyebrow {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.header-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

.user-chip {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-flex;
    font-weight: 700;
    gap: 8px;
    min-height: 38px;
    padding: 7px 13px;
}

.btn {
    border-radius: 4px;
    font-weight: 700;
}

.btn-primary {
    background: var(--purple);
    border-color: var(--purple);
}

.btn-group form {
    display: inline-flex;
    margin: 0;
}

.dashboard-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(12, 1fr);
    margin: 0 auto;
    max-width: 1320px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 22px;
}

.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-6 { grid-column: span 6; }
.span-4 { grid-column: span 4; }

.metric-row {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.account-metric-row {
    align-items: stretch;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    width: 100%;
}

.account-card {
    border-left-color: var(--purple);
    min-height: 100%;
}

.account-card:nth-child(2n) {
    border-left-color: var(--teal);
}

.account-card:nth-child(3n) {
    border-left-color: #f59e0b;
}

.metric {
    border-left: 3px solid var(--blue);
    padding-left: 13px;
}

.metric:nth-child(2) { border-color: var(--teal); }
.metric:nth-child(3) { border-color: var(--purple); }
.metric:nth-child(4) { border-color: #f59e0b; }

.metric span {
    color: var(--muted);
    display: block;
    font-size: 13px;
    font-weight: 700;
}

.metric strong {
    display: block;
    font-size: 28px;
    line-height: 1.2;
}

.chart-canvas {
    height: 280px;
    margin-top: 18px;
    width: 100%;
}

.mini-chart {
    height: 168px;
    width: 100%;
}

.table {
    vertical-align: middle;
}

.table thead th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.product-pill {
    background: #eef3ff;
    border-radius: 999px;
    color: var(--blue);
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    margin: 2px;
    padding: 5px 9px;
}

.modal-content {
    border: 0;
    border-radius: 8px;
    box-shadow: 0 24px 80px rgba(16, 25, 40, .22);
}

.modal-header {
    background: #f7f9fd;
    border-bottom: 1px solid var(--line);
}

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

.location-search-wrap {
    position: relative;
    z-index: 20;
}

.location-results {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 14px 44px rgba(16, 25, 40, .12);
    display: block;
    max-height: 240px;
    overflow-y: auto;
    position: absolute;
    top: calc(100% + 6px);
    width: 100%;
    z-index: 1065;
}

.location-results[hidden],
.location-result-item[hidden],
.location-empty[hidden] {
    display: none;
}

.location-result-item {
    align-items: flex-start;
    background: #fff;
    border: 0;
    border-bottom: 1px solid #eef2f8;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    text-align: left;
    width: 100%;
}

.location-empty {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    padding: 14px 12px;
}

.location-result-item:hover,
.location-result-item:focus {
    background: #f6f8ff;
    outline: 0;
}

.location-result-item strong {
    color: #1f2a3d;
    font-size: 14px;
}

.location-result-item small {
    color: var(--muted);
    font-size: 12px;
}

.product-choice {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    gap: 12px;
    min-height: 64px;
    padding: 12px;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.product-choice input {
    accent-color: var(--purple);
    flex: 0 0 auto;
    height: 20px;
    width: 20px;
}

.product-choice .choice-copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.product-choice strong,
.product-choice small {
    overflow-wrap: anywhere;
}

.product-choice small {
    color: var(--muted);
    font-weight: 700;
}

.product-choice i {
    color: #fff;
    opacity: 0;
}

.product-choice:has(input:checked) {
    background: #f4efff;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(112, 66, 201, .1);
}

.product-choice:has(input:checked) i {
    color: var(--purple);
    opacity: 1;
}

.login-page {
    align-items: center;
    background: linear-gradient(135deg, #f7faff 0%, #eef2f9 100%);
    display: flex;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: auto;
    max-width: 420px;
    padding: 32px;
    width: 100%;
}

.login-card img {
    display: block;
    height: 48px;
    margin-bottom: 22px;
    object-fit: contain;
    width: 120px;
}

@media (max-width: 992px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        align-items: center;
        display: flex;
        gap: 18px;
        overflow-x: auto;
        padding: 14px 18px;
    }

    .brand {
        margin: 0;
        min-width: max-content;
    }

    .sidebar .nav {
        flex-direction: row !important;
        min-width: max-content;
    }

    .main-content {
        padding: 24px 18px;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .span-8,
    .span-6,
    .span-4 {
        grid-column: span 12;
    }

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

    .account-metric-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .top-strip {
        font-size: 12px;
        height: 46px;
    }

    .metric-row {
        grid-template-columns: 1fr;
    }

    .account-metric-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .panel {
        padding: 16px;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .btn,
    .user-chip {
        justify-content: center;
        width: 100%;
    }

    .modal-dialog {
        margin: 10px;
    }

    .modal-body {
        max-height: calc(100vh - 170px);
        overflow-y: auto;
        padding: 18px !important;
    }

    .modal-footer {
        display: grid;
        gap: 10px;
        grid-template-columns: 1fr;
    }

    .modal-footer .btn {
        margin: 0;
        min-height: 46px;
        width: 100%;
    }

    .product-choice-grid {
        grid-template-columns: 1fr;
    }
}
