/* =========================================
   CBA Pivot Table — WordPress Plugin Styles
   ========================================= */

.cba-pivot-wrap * {
    box-sizing: border-box;
}

.cba-pivot-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: #1a1a1a;
    padding: 1rem 0;
}

/* Tabs */
.cba-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.cba-tab {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid #d0d0d0;
    background: transparent;
    color: #666;
    transition: all 0.15s;
}

.cba-tab:hover {
    background: #f5f5f5;
    color: #333;
}

.cba-tab.active {
    background: #f0f0f0;
    color: #111;
    font-weight: 500;
    border-color: #aaa;
}

/* KPI cards */
.cba-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 1.5rem;
}

.cba-kpi {
    background: #f7f7f7;
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.cba-kpi-label {
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
}

.cba-kpi-value {
    font-size: 18px;
    font-weight: 500;
    color: #111;
}

/* Controls */
.cba-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 1.25rem;
    align-items: flex-end;
}

.cba-ctrl-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cba-ctrl-group label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cba-ctrl-group select {
    min-width: 180px;
    padding: 6px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: #333;
}

/* Table */
.cba-table-wrap {
    overflow-x: auto;
}

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

.cba-table thead tr th {
    background: #f5f5f5;
    font-weight: 500;
    font-size: 11px;
    color: #888;
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cba-table thead tr th:not(:first-child) {
    text-align: right;
}

.cba-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.1s;
}

.cba-table tbody tr:hover {
    background: #fafafa;
}

.cba-table tbody tr.cba-group-header td {
    font-size: 11px;
    color: #888;
    padding: 14px 12px 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    background: transparent;
}

.cba-table tbody tr.cba-total {
    background: #f5f5f5;
    font-weight: 500;
    border-top: 2px solid #ddd;
}

.cba-table td {
    padding: 8px 12px;
    vertical-align: middle;
    color: #333;
}

.cba-table td:not(:first-child) {
    text-align: right;
    white-space: nowrap;
}

.cba-dim {
    color: #999;
}

.cba-tag {
    font-size: 11px;
    color: #aaa;
}

/* Badges */
.cba-badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 500;
    line-height: 1.6;
}

.cba-badge-cost    { background: #fde8e8; color: #9b2626; }
.cba-badge-benefit { background: #e8f5e2; color: #2e6b10; }
.cba-badge-neg     { background: #fde8e8; color: #9b2626; }
.cba-badge-pos     { background: #e8f5e2; color: #2e6b10; }

/* Color helpers */
.cba-neg { color: #c0392b; }
.cba-pos { color: #27ae60; }
.cba-muted { color: #bbb; }

/* Empty state */
.cba-empty {
    text-align: center;
    color: #aaa;
    padding: 2rem;
}

/* Responsive */
@media (max-width: 600px) {
    .cba-kpi-row {
        grid-template-columns: 1fr 1fr;
    }
    .cba-ctrl-group select {
        min-width: 140px;
    }
}
