/* ============================================================
   CostsWidget — Admin cost dashboard (US-18)
   Prefix: cw-
   ============================================================ */

.cw-section {
    font-family: inherit;
    color: #c9d1d9;
}

/* Header */
.cw-header { margin-bottom: 14px; }
.cw-header h2 {
    margin: 0; font-size: 1.15rem; color: #e6edf3; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
}
.cw-header h2 i { color: #d2a436; }

/* Filters bar */
.cw-filters {
    display: flex; align-items: center; gap: 18px;
    margin-bottom: 18px; flex-wrap: wrap;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 10px;
    padding: 10px 14px;
}
.cw-filter-group { display: flex; align-items: center; gap: 8px; }
.cw-filter-label {
    color: #8b949e; font-size: 0.72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.4px;
}
.cw-filter-spacer { flex: 1; }

/* Button groups */
.cw-btn-group { display: flex; gap: 2px; }
.cw-btn {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    color: #8b949e;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.cw-btn:hover { color: #c9d1d9; border-color: rgba(99,102,241,0.25); }
.cw-btn-active {
    background: rgba(99,102,241,0.15);
    color: #a5b4fc;
    border-color: rgba(99,102,241,0.35);
}
.cw-btn-refresh { padding: 5px 10px; }

/* Tabs (inside breakdown card) */
.cw-tabs {
    display: flex; gap: 2px;
    margin: -4px -6px 12px; padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.cw-tab {
    background: none; border: none; color: #8b949e;
    padding: 6px 12px; cursor: pointer; font-size: 0.78rem; font-family: inherit;
    display: inline-flex; align-items: center; gap: 6px;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.cw-tab:hover { color: #c9d1d9; }
.cw-tab-active { color: #a5b4fc; border-bottom-color: #a5b4fc; }
.cw-view { display: none; }
.cw-view-active { display: block; }

/* KPI cards */
.cw-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.cw-kpi {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex; align-items: center; gap: 12px;
}
.cw-kpi-icon {
    width: 36px; height: 36px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(165,180,252,0.1); color: #a5b4fc;
    font-size: 0.95rem; flex-shrink: 0;
}
.cw-icon-user { color: #8b949e; margin-right: 4px; font-size: 0.72rem; }
.cw-kpi-value {
    font-size: 1.6rem;
    font-weight: 600;
    color: #e6edf3;
    line-height: 1.2;
}
.cw-kpi-label {
    font-size: 0.75rem;
    color: #8b949e;
    margin-top: 4px;
}

/* Cards (chart + tables) */
.cw-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
}
.cw-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #c9d1d9;
    margin-bottom: 12px;
}
.cw-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 900px) {
    .cw-grid { grid-template-columns: 1fr; }
}

/* Chart */
.cw-chart-wrap {
    position: relative;
    height: 240px;
}

/* Table scroll container */
.cw-users-body, .cw-sessions-body {
    max-height: 320px;
    overflow-y: auto;
    overflow-x: auto;
}
.cw-users-body::-webkit-scrollbar,
.cw-sessions-body::-webkit-scrollbar { width: 6px; height: 6px; }
.cw-users-body::-webkit-scrollbar-track,
.cw-sessions-body::-webkit-scrollbar-track { background: transparent; }
.cw-users-body::-webkit-scrollbar-thumb,
.cw-sessions-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12); border-radius: 3px;
}
.cw-users-body::-webkit-scrollbar-thumb:hover,
.cw-sessions-body::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

/* Tables */
.cw-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}
.cw-table thead th {
    position: sticky;
    top: 0;
    background: #0d1117;
    z-index: 1;
}
.cw-table th {
    text-align: left;
    color: #8b949e;
    font-weight: 600;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.cw-table td {
    padding: 7px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.cw-table tbody tr:hover {
    background: rgba(255,255,255,0.02);
}
.cw-num { text-align: right; }
.cw-cost { color: #3fb950; font-weight: 600; }
.cw-rank {
    color: #6e7681;
    font-weight: 600;
    width: 24px;
}
.cw-mono {
    font-family: "Consolas", monospace;
    font-size: 0.72rem;
    color: #a5b4fc;
    background: rgba(165,180,252,0.08);
    padding: 1px 5px;
    border-radius: 3px;
}

/* States */
.cw-loading, .cw-empty, .cw-error {
    text-align: center;
    padding: 20px;
    color: #8b949e;
    font-size: 0.85rem;
}
.cw-error { color: #f85149; }
