* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    background: #f3f5f7;
    color: #1b2733;
}

body {
    font-size: 14px;
}

a {
    color: inherit;
}

.layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 240px 1fr;
}

.sidebar {
    background: #18232d;
    color: #fff;
    min-height: 100vh;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
}

.brand {
    padding: 4px 10px 25px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.brand strong {
    display: block;
    font-size: 18px;
}

.brand span {
    display: block;
    font-size: 12px;
    color: #aeb8c1;
    margin-top: 5px;
}

.sidebar nav {
    padding-top: 22px;
}

.sidebar nav a {
    text-decoration: none;
    display: block;
    padding: 11px 12px;
    border-radius: 5px;
    color: #c9d1d8;
    margin-bottom: 3px;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: rgba(255,255,255,.09);
    color: #fff;
}

.sidebar-user {
    margin-top: auto;
    padding: 18px 10px 0;
    border-top: 1px solid rgba(255,255,255,.1);
}

.sidebar-user span {
    display: block;
    font-size: 13px;
    margin-bottom: 8px;
}

.sidebar-user a {
    font-size: 12px;
    color: #b8c4ce;
}

.content {
    padding: 28px;
    min-width: 0;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    margin: 0;
    font-size: 27px;
}

.page-header p {
    margin: 5px 0 0;
    color: #6c7884;
}

.updated {
    color: #75818c;
    font-size: 12px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0,1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.kpi {
    background: #fff;
    border: 1px solid #dde3e8;
    border-radius: 7px;
    padding: 20px;
}

.kpi.warning {
    border-left: 4px solid #bf7a00;
}

.kpi span {
    color: #697682;
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
}

.kpi strong {
    display: block;
    font-size: 25px;
    line-height: 1.2;
}

.kpi small {
    display: block;
    margin-top: 9px;
    color: #84909a;
}

.positive {
    color: #14743b !important;
}

.negative {
    color: #a13535 !important;
}

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

.span-2 {
    grid-column: span 2;
}

.panel {
    background: #fff;
    border: 1px solid #dde3e8;
    border-radius: 7px;
    padding: 20px;
    min-width: 0;
}

.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 17px;
}

.panel-title h2 {
    font-size: 17px;
    margin: 0;
}

.panel-title span {
    color: #87919a;
    font-size: 12px;
}

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

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

th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #78838d;
    padding: 10px 8px;
    border-bottom: 1px solid #dfe4e8;
}

td {
    padding: 11px 8px;
    border-bottom: 1px solid #edf0f2;
    vertical-align: middle;
}

td small {
    display: block;
    color: #89939b;
    margin-top: 3px;
}

.number {
    text-align: right;
    white-space: nowrap;
}

.status {
    display: inline-block;
    background: #edf1f4;
    padding: 4px 7px;
    border-radius: 4px;
    font-size: 11px;
}

.metric-row,
.rank-row,
.opportunity {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 11px 0;
    border-bottom: 1px solid #edf0f2;
}

.metric-row:last-child,
.rank-row:last-child,
.opportunity:last-child {
    border-bottom: 0;
}

.metric-row strong,
.rank-row strong,
.opportunity strong {
    display: block;
    font-size: 13px;
}

.metric-row span,
.rank-row span,
.opportunity span,
.opportunity small {
    display: block;
    color: #85909a;
    font-size: 11px;
    margin-top: 4px;
}

.percentage {
    font-size: 17px;
    font-weight: bold;
}

.rank-row b,
.opportunity b {
    white-space: nowrap;
}

.alert-panel {
    border-top: 3px solid #bf7a00;
}

.login-body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: #18232d;
}

.login-box {
    width: 100%;
    max-width: 390px;
    background: #fff;
    padding: 32px;
    border-radius: 8px;
}

.login-brand {
    margin-bottom: 25px;
}

.login-brand h1 {
    font-size: 22px;
    margin: 0;
}

.login-brand p {
    margin: 5px 0 0;
    color: #77838d;
}

.login-box label {
    display: block;
    font-weight: bold;
    margin-bottom: 17px;
}

.login-box input {
    width: 100%;
    padding: 11px;
    margin-top: 7px;
    border: 1px solid #cdd5dc;
    border-radius: 4px;
    font-size: 15px;
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: #18232d;
    color: white;
    border: 0;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.alert {
    padding: 11px;
    margin-bottom: 18px;
    border-radius: 4px;
}

.alert-danger {
    background: #f8e4e4;
    color: #8a2929;
}

@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(3,1fr);
    }
}

@media (max-width: 900px) {
    .layout {
        display: block;
    }

    .sidebar {
        min-height: auto;
    }

    .sidebar nav {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .sidebar nav a {
        display: inline-block;
    }

    .sidebar-user {
        margin-top: 20px;
    }

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

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

    .span-2 {
        grid-column: span 1;
    }
}

@media (max-width: 600px) {
    .content {
        padding: 15px;
    }

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

    .page-header {
        display: block;
    }

    .updated {
        margin-top: 8px;
    }
}

.filterbar {
    background: #fff;
    border: 1px solid #dde3e8;
    border-radius: 7px;
    padding: 12px 16px;
    margin-bottom: 18px;
}

.filterbar label {
    font-weight: bold;
    font-size: 13px;
}

.filterbar select {
    margin-left: 8px;
    padding: 7px 10px;
    border: 1px solid #cbd3da;
    border-radius: 4px;
    background: #fff;
}

.chart-box {
    position: relative;
    height: 330px;
    width: 100%;
}

.chart-large {
    height: 390px;
}

.panel-gap {
    margin-top: 20px;
}

.bi-link {
    color: #245a85;
    text-decoration: none;
    font-weight: 600;
}

.bi-link:hover {
    text-decoration: underline;
}

.breadcrumb {
    margin-bottom: 18px;
    color: #7b8791;
    font-size: 12px;
}

.breadcrumb a {
    color: #245a85;
    text-decoration: none;
}

.breadcrumb span {
    padding: 0 8px;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.detail-header h2 {
    margin: 0;
    font-size: 23px;
}

.detail-subtitle {
    display: block;
    margin-top: 5px;
    color: #77838d;
}

.intelligence-list > div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 13px 0;
    border-bottom: 1px solid #edf0f2;
}

.intelligence-list > div:last-child {
    border-bottom: 0;
}

.intelligence-list span {
    color: #75818c;
}

.intelligence-list strong {
    text-align: right;
}

.data-note {
    background: #eef2f5;
    border: 1px solid #dce2e7;
    border-radius: 5px;
    padding: 12px 15px;
    margin-top: 20px;
    color: #66727c;
    font-size: 12px;
}

@media (max-width: 700px) {
    .chart-box,
    .chart-large {
        height: 280px;
    }

    .intelligence-list > div {
        display: block;
    }

    .intelligence-list strong {
        display: block;
        text-align: left;
        margin-top: 5px;
    }
}

.segment {
    display: inline-block;
    padding: 5px 8px;
    border: 1px solid #d8dfe5;
    border-radius: 4px;
    background: #f3f5f7;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.segment-champion,
.segment-high-value {
    border-color: #9bbfa8;
    background: #edf6ef;
}

.segment-at-risk {
    border-color: #d8b77d;
    background: #fbf5e8;
}

.segment-dormant,
.segment-lost {
    border-color: #d6a5a5;
    background: #f9eded;
}

.kpi-date {
    font-size: 16px !important;
}

table td small {
    display: block;
    margin-top: 4px;
    color: #85909a;
}

.cohort-table {
    font-size: 12px;
}

.cohort-cell {
    background:
        linear-gradient(
            90deg,
            rgba(36,90,133,.16) var(--cohort-strength),
            transparent var(--cohort-strength)
        );
    min-width: 62px;
}

@media (max-width: 900px) {
    .cohort-table {
        min-width: 1100px;
    }
}
