/* ── Stats Dashboard Styles ─────────────────────────────────────────────── */

.sd-wrap { max-width: 1200px; }

.sd-page-title {
    font-size: 22px;
    font-weight: 600;
    color: #1d2327;
    margin: 16px 0 20px;
    display: flex;
    align-items: center;
}

/* Filter Bar */
.sd-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 20px;
}

.sd-filter-group { display: flex; flex-direction: column; gap: 5px; }

.sd-label {
    font-size: 12px;
    font-weight: 500;
    color: #50575e;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.sd-mode-toggle {
    display: flex;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    overflow: hidden;
}

.sd-mode-btn {
    background: #fff;
    border: none;
    padding: 6px 16px;
    font-size: 13px;
    cursor: pointer;
    color: #50575e;
    transition: background .15s, color .15s;
    height: 34px;
    line-height: 1;
}

.sd-mode-btn.active {
    background: #2271b1;
    color: #fff;
    font-weight: 500;
}

.sd-mode-btn:not(.active):hover { background: #f0f0f1; }

.sd-filter-group input[type="date"] {
    height: 34px;
    padding: 0 10px;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    font-size: 13px;
    color: #1d2327;
    background: #fff;
    outline: none;
    transition: border-color .15s;
}

.sd-filter-group input[type="date"]:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34,113,177,.2);
}

.sd-apply-btn {
    height: 34px;
    padding: 0 20px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
    align-self: flex-end;
}

.sd-apply-btn:hover { background: #135e96; }

/* Period label */
.sd-period-label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #8c8f94;
    margin-bottom: 14px;
}

/* Loading / Error */
.sd-loading {
    padding: 14px 18px;
    background: #e7f3fe;
    border-left: 4px solid #2271b1;
    border-radius: 4px;
    font-size: 13px;
    color: #135e96;
    margin-bottom: 16px;
}

.sd-error {
    padding: 14px 18px;
    background: #fcf0f1;
    border-left: 4px solid #d63638;
    border-radius: 4px;
    font-size: 13px;
    color: #d63638;
    margin-bottom: 16px;
}

/* Metric Cards */
.sd-metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.sd-metric {
    background: #f6f7f7;
    border-radius: 8px;
    padding: 16px 18px;
}

.sd-metric-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #8c8f94;
    margin-bottom: 8px;
}

.sd-metric-value {
    font-size: 30px;
    font-weight: 600;
    color: #1d2327;
    line-height: 1;
    margin-bottom: 5px;
}

.sd-metric-sub {
    font-size: 11px;
    color: #8c8f94;
    margin-bottom: 8px;
}

.sd-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 9px;
    border-radius: 20px;
}

.sd-badge-blue   { background: #dce9f7; color: #0c457a; }
.sd-badge-teal   { background: #d9f0e8; color: #085041; }
.sd-badge-amber  { background: #faeeda; color: #633806; }
.sd-badge-coral  { background: #faeae7; color: #712b13; }

/* Chart Cards */
.sd-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

@media (max-width: 900px) {
    .sd-charts-row { grid-template-columns: 1fr; }
}

.sd-chart-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 18px;
}

.sd-stacked-card { margin-bottom: 14px; }

.sd-chart-title {
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 3px;
}

.sd-chart-sub {
    font-size: 12px;
    color: #8c8f94;
    margin-bottom: 12px;
}

.sd-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 10px;
}

.sd-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #50575e;
}

.sd-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.sd-canvas-wrap {
    position: relative;
    width: 100%;
}

/* Table */
.sd-table-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.sd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.sd-table thead th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #8c8f94;
    padding: 0 12px 10px 0;
    border-bottom: 1px solid #dcdcde;
    text-align: left;
}

.sd-table tbody td {
    padding: 9px 12px 9px 0;
    border-bottom: 1px solid #f0f0f1;
    color: #1d2327;
    vertical-align: middle;
}

.sd-table tbody tr:last-child td { border-bottom: none; }
.sd-table tbody tr:hover td { background: #f9f9f9; }

.sd-pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}
