/* Controls Page — Global Config + Decision Tree tabs */

/* ===== Global Config — Settings Page ===== */
.gc-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

/* Section with colored left accent */
.gc-section {
    padding: 14px 18px 10px;
    border-bottom: 1px solid var(--border-color);
    border-left: 3px solid transparent;
}

.gc-section-last { border-bottom: none; }

.gc-s-strategy  { border-left-color: #8b5cf6; }
.gc-s-accuracy  { border-left-color: #3b82f6; }
.gc-s-budget    { border-left-color: #f59e0b; }
.gc-s-kickstart { border-left-color: #22c55e; }
.gc-s-cap       { border-left-color: #a855f7; }
.gc-s-cooldown  { border-left-color: #ef4444; }

.gc-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-primary);
    margin-bottom: 10px;
}

/* Colored dot indicator */
.gc-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Single-input rows */
.gc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
}

/* Dual-input rows (budget table) */
.gc-row-dual {
    display: grid;
    grid-template-columns: 1fr 60px 60px;
    gap: 10px;
    align-items: center;
    padding: 5px 0;
}

/* Strategy preset rows (5 value columns) */
.gc-row-quad {
    display: grid;
    grid-template-columns: 1fr 60px 60px 60px 60px 60px;
    gap: 10px;
    align-items: center;
    padding: 5px 0;
}

/* Header row — shared by dual and quad grids */
.gc-row-header {
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2px;
}

.gc-col-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
}

.gc-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* Inputs */
#page-controls .gc-input {
    width: 64px;
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 11px;
    font-family: 'SF Mono', Monaco, monospace;
    font-variant-numeric: tabular-nums;
    text-align: right;
    transition: border-color 0.18s ease-out, background 0.18s ease-out, box-shadow 0.18s ease-out;
    -moz-appearance: textfield;
    line-height: 1.3;
}

#page-controls .gc-input::-webkit-outer-spin-button,
#page-controls .gc-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#page-controls .gc-input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.06);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

.gc-input-sm {
    width: 100%;
    text-align: center;
}

/* Footer with action buttons */
.gc-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 18px;
    border-top: 1px solid var(--border-color);
}

.gc-btn-reset {
    padding: 6px 14px;
    font-size: 0.72rem;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.18s ease-out;
}

.gc-btn-reset:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.gc-btn-save {
    padding: 6px 16px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    color: #fff;
    cursor: pointer;
    transition: all 0.18s ease-out;
}

.gc-btn-save:hover {
    opacity: 0.88;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.25);
}

/* ===== Decision Tree Tab ===== */

/* Toolbar (Save/Reset) */
.dt-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.dt-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dt-toolbar-right {
    display: flex;
    gap: 8px;
}

/* Level 1 Nav — Campaign Types */
.dt-nav {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 10px;
    overflow-x: auto;
}

.dt-nav-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.dt-nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dt-nav-btn.active {
    background: var(--bg-dark, #0f0f1a);
    color: #8b5cf6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-weight: 600;
}

/* Level 2 Nav — Media Sources */
.dt-sub-nav {
    display: flex;
    gap: 3px;
    padding: 3px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 14px;
}

.dt-sub-nav-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.dt-sub-nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dt-sub-nav-btn.active {
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
    font-weight: 600;
}

/* Explanation Banner */
.dt-explanation {
    border-left: 3px solid #8b5cf6;
    background: rgba(139, 92, 246, 0.04);
    border-radius: 0 8px 8px 0;
    padding: 12px 16px;
    margin-bottom: 14px;
}

.dt-explanation-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #a78bfa;
    margin-bottom: 4px;
}

.dt-explanation-desc {
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 6px;
}

.dt-explanation-bullets {
    margin: 0;
    padding-left: 18px;
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.dt-explanation-bullets li {
    margin-bottom: 2px;
}

.dt-explanation-bullets b {
    color: var(--text-secondary);
}

/* Phase Container (Country-Campaign) */
.dt-phase {
    position: relative;
    border-left: 3px solid rgba(139, 92, 246, 0.25);
    padding-left: 16px;
    margin-bottom: 24px;
}

.dt-phase-marker {
    position: absolute;
    left: -3px;
    top: 0;
    background: #8b5cf6;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 10px;
    border-radius: 0 6px 6px 0;
}

.dt-phase .dt-explanation {
    margin-top: 28px;
}

/* Tier tabs */
.dt-tier-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    padding: 3px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.dt-tier-tab {
    flex: 1;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: 'SF Mono', Monaco, monospace;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.18s ease-out;
    border-radius: 5px;
    text-align: center;
}

.dt-tier-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.dt-tier-tab.active {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    font-weight: 600;
}

/* ── Matrix Table (Algorithm page style) ── */

.dt-table-wrap {
    overflow-x: auto;
    margin-bottom: 16px;
}

.dt-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: visible;
}

.dt-table thead th {
    padding: 10px 14px;
    text-align: center;
    font-weight: 600;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--bg-dark);
    border-bottom: 2px solid var(--border-color);
}

.dt-table thead th:first-child {
    text-align: left;
    border-top-left-radius: 8px;
}

.dt-table thead th:last-child {
    border-top-right-radius: 8px;
}

.dt-row-label {
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    padding: 11px 14px !important;
}

.dt-table tbody td {
    padding: 11px 14px;
    text-align: center;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.dt-table tbody tr:last-child td {
    border-bottom: none;
}

.dt-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

.dt-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}

.dt-table tbody tr:hover td {
    background: var(--bg-hover, rgba(255, 255, 255, 0.03));
}

/* On-target row */
.dt-on-target-row td {
    background: rgba(34, 197, 94, 0.05);
}

/* Row color indicators — left border accent per off-target level */
.dt-row-too_positive .dt-row-label { border-left: 3px solid #8b5cf6; padding-left: 11px !important; }
.dt-row-positive .dt-row-label { border-left: 3px solid #3b82f6; padding-left: 11px !important; }
.dt-on-target-row .dt-row-label { border-left: 3px solid #22c55e; padding-left: 11px !important; }
.dt-row-negative .dt-row-label { border-left: 3px solid #f97316; padding-left: 11px !important; }
.dt-row-too_negative .dt-row-label { border-left: 3px solid #dc2626; padding-left: 11px !important; }

/* ── Clickable Matrix Cells ── */

.dt-matrix-cell {
    position: relative;
    cursor: pointer;
    transition: background 0.15s;
}

.dt-matrix-cell:hover {
    background: rgba(139, 92, 246, 0.06) !important;
}

.dt-matrix-cell.editing {
    background: rgba(139, 92, 246, 0.1) !important;
}

.dt-cell-content {
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dt-cell-pills {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
}

/* ── Pills (Algorithm page style) ── */

.dt-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}

.dt-pill-increase {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.dt-pill-decrease {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.dt-pill-bid-up {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.dt-pill-bid-down {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.dt-pill-special {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.dt-pill-blacklist {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.dt-pill-neutral {
    background: rgba(107, 114, 128, 0.15);
    color: #9ca3af;
}

/* ── Edit Popover ── */

.dt-edit-popover {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    background: var(--bg-card, #1a1a2e);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
    min-width: 220px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: dtFadeIn 0.15s ease;
}

@keyframes dtFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.dt-edit-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.dt-edit-row label {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 64px;
    text-align: right;
}

.dt-edit-input,
.dt-edit-select {
    flex: 1;
    padding: 6px 10px;
    background: var(--bg-dark, #0f0f1a);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.78rem;
    outline: none;
    transition: border-color 0.15s;
    -moz-appearance: textfield;
}

.dt-edit-input::-webkit-outer-spin-button,
.dt-edit-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.dt-edit-input:focus,
.dt-edit-select:focus {
    border-color: #8b5cf6;
}

.dt-edit-input:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.dt-edit-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 4px;
}

.dt-edit-cancel {
    padding: 5px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.74rem;
    cursor: pointer;
    transition: all 0.15s;
}

.dt-edit-cancel:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dt-edit-save {
    padding: 5px 12px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 6px;
    color: #a78bfa;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.dt-edit-save:hover {
    background: rgba(139, 92, 246, 0.25);
}

/* ── Features & Settings ── */

.dt-features {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 18px;
    margin-top: 16px;
}

.dt-features-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.dt-features-grid {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.dt-feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dt-feature-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.dt-toggle {
    padding: 4px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease-out;
}

.dt-toggle.on {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.dt-feature-input-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dt-feat-input {
    width: 48px !important;
    text-align: center !important;
}

.dt-unit {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Tier boundaries */
.dt-boundaries {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.dt-boundary-inputs {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dt-boundary-input {
    width: 72px !important;
    text-align: center !important;
}

.dt-boundary-sep {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.dt-boundary-preview {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'SF Mono', Monaco, monospace;
}

/* ===== V2 Parameters Budget Table ===== */
.v2p-budget-table {
    width: 100%;
    max-width: 340px;
    border-collapse: collapse;
    font-size: 0.78rem;
    margin-top: 6px;
}

.v2p-budget-table th {
    text-align: center;
    color: var(--text-muted);
    font-weight: 500;
    padding: 4px 6px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.v2p-budget-table th:first-child {
    text-align: left;
}

.v2p-budget-table td {
    padding: 3px 4px;
    color: var(--text-secondary);
}

.v2p-budget-table td:first-child {
    font-size: 0.76rem;
    white-space: nowrap;
}

.v2p-budget-table .gc-input-sm {
    width: 64px !important;
    text-align: center !important;
}

/* ==========================================================================
   V3 Decision Tree Styles
   ========================================================================== */

/* Version toggle */
.dt-version-toggle {
    display: flex;
    gap: 2px;
    padding: 2px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.dt-ver-btn {
    padding: 6px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.dt-ver-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dt-ver-btn.active {
    background: #8b5cf6;
    color: #fff;
}

/* V3 Info Banner */
.v3-info-banner {
    margin-bottom: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    border-left: 3px solid #8b5cf6;
}
.v3-info-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.v3-info-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.v3-info-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.v3-info-desc code {
    background: rgba(139, 92, 246, 0.12);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.76rem;
    color: #a78bfa;
}
.v3-info-note {
    margin-top: 8px;
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.5;
    padding: 6px 10px;
    background: rgba(139, 92, 246, 0.05);
    border-radius: 6px;
}
.v3-info-note strong {
    color: var(--text-secondary);
}

/* V3 Section Cards */
.v3-section-card {
    margin-bottom: 16px;
    padding: 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.v3-section-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}

.v3-section-icon {
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--text-muted);
}

.v3-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.v3-section-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 1px;
}

/* V3 General Section Grid */
.v3-general-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.v3-general-card {
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.v3-general-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.v3-general-card-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 8px;
}

/* V3 Example Box */
.v3-example-box {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(139, 92, 246, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(139, 92, 246, 0.12);
}

.v3-example-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 6px;
}

.v3-example-row {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-family: 'SF Mono', Monaco, monospace;
    padding: 2px 0;
}

.v3-ex-label {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-right: 6px;
    min-width: 64px;
    text-align: center;
}

.v3-ex-neg { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.v3-ex-on { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.v3-ex-pos { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }

/* V3 Strategy Effect Column */
.v3-strategy-effect {
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.4;
    max-width: 320px;
}

/* V3 Use Cases */
.v3-use-cases {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.v3-use-case {
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    border-left: 3px solid #8b5cf6;
}

.v3-uc-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.v3-uc-desc {
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.v3-uc-desc strong {
    color: var(--text-secondary);
}

/* V3 Bid Section Layout — matrix + params side by side */
.v3-bid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.v3-bid-matrix-col,
.v3-bid-params-col,
.v3-ab-matrix-col,
.v3-ab-info-col {
    min-width: 0;
}

.v3-col-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.v3-col-note {
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 12px;
}

/* V3 Bid Params (inside bid section) */
.v3-bid-params {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

/* V3 AB Section Layout */
.v3-ab-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.v3-ab-explain {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.v3-ab-explain p {
    margin: 0 0 10px;
}

.v3-ab-explain strong {
    color: var(--text-secondary);
}

.v3-ab-note {
    padding: 8px 10px;
    background: rgba(249, 115, 22, 0.06);
    border-radius: 6px;
    font-size: 0.74rem;
}

.v3-ab-explain code {
    background: rgba(139, 92, 246, 0.12);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.72rem;
    color: #a78bfa;
}

/* V3 Matrix Table */
.v3-matrix-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    position: relative;
}

.v3-matrix-table th {
    padding: 12px 20px;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.v3-th-corner {
    text-align: left !important;
    width: 130px;
}

.v3-row-label {
    padding: 14px 18px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.v3-cell {
    padding: 14px 16px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
    cursor: pointer;
    position: relative;
    overflow: visible;
    transition: background 0.15s;
}

.v3-cell:hover {
    background: rgba(139, 92, 246, 0.06);
}
.v3-cell.editing {
    background: rgba(139, 92, 246, 0.1);
    z-index: 200;
}

/* V3 Edit Popover Enhancements */
.v3-edit-input-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}
.v3-edit-unit {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}
.v3-edit-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding: 0 2px;
}

/* V3 Parameters Section (legacy, kept for compat) */
.v3-params-section {
    position: relative;
    margin-top: 20px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.v3-params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.v3-param {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.v3-param label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
}

.v3-param-input {
    display: flex;
    align-items: center;
    gap: 4px;
}

.v3-param-input input {
    width: 80px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.v3-param-unit {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
}

.v3-param-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* V3 Budget Days */
.v3-budget-days {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.v3-day-check {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.78rem;
    color: var(--text-muted);
    cursor: pointer;
}

.v3-day-check input {
    accent-color: #8b5cf6;
}

/* V3 Strategy Table */
.v3-strategy-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.v3-strategy-table th {
    padding: 8px 12px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.v3-strategy-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
}

.v3-strategy-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
}

.v3-strat-input {
    width: 70px;
    padding: 5px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.82rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .gc-row-header,
    .gc-row-dual {
        grid-template-columns: 1fr 50px 50px;
    }

    .gc-row-quad {
        grid-template-columns: 1fr 50px 50px 50px 50px 50px;
    }
    .gc-row-dual {
        grid-template-columns: 1fr 50px 50px;
    }
}

/* ========================================================
   LIGHT THEME — Global Config + Decision Tree
   ======================================================== */

/* ── Global Config ── */
html[data-theme="light"] .gc-container { box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04); }
html[data-theme="light"] .gc-section { border-bottom-color: #ebe4d8; }
html[data-theme="light"] .gc-row-header { border-bottom-color: #ebe4d8; }
html[data-theme="light"] .gc-footer { border-top-color: #ebe4d8; }
html[data-theme="light"] .gc-input { background: rgba(0, 0, 0, 0.03); border-color: #d9d0c3; }
html[data-theme="light"] .gc-input:focus { background: rgba(139, 92, 246, 0.04); border-color: #8b5cf6; }
html[data-theme="light"] .gc-btn-reset { border-color: #d9d0c3; color: #4b5563; }
html[data-theme="light"] .gc-btn-reset:hover { background: rgba(0, 0, 0, 0.03); }
html[data-theme="light"] .gc-btn-save { color: #fff; }

/* ── Strategy Presets ── */

/* ── Decision Tree ── */
html[data-theme="light"] .dt-nav { background: #f8f4ee; border-color: #d9d0c3; }
html[data-theme="light"] .dt-nav-btn { color: #6b7280; }
html[data-theme="light"] .dt-nav-btn:hover { background: rgba(0, 0, 0, 0.05); }
html[data-theme="light"] .dt-nav-btn.active { background: #ffffff; color: #7c3aed; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .dt-sub-nav { background: #f8f4ee; border-color: #d9d0c3; }
html[data-theme="light"] .dt-sub-nav-btn { color: #6b7280; }
html[data-theme="light"] .dt-sub-nav-btn:hover { background: rgba(0, 0, 0, 0.04); }
html[data-theme="light"] .dt-sub-nav-btn.active { background: rgba(139, 92, 246, 0.1); color: #7c3aed; }
html[data-theme="light"] .dt-explanation { background: rgba(139, 92, 246, 0.03); border-left-color: #8b5cf6; }
html[data-theme="light"] .dt-explanation-title { color: #7c3aed; }
html[data-theme="light"] .dt-phase { border-left-color: rgba(139, 92, 246, 0.2); }
html[data-theme="light"] .dt-tier-tabs { background: #ffffff; border-color: #d9d0c3; }
html[data-theme="light"] .dt-tier-tab:hover:not(.active) { background: rgba(0, 0, 0, 0.04); }
html[data-theme="light"] .dt-tier-tab.active { background: rgba(139, 92, 246, 0.1); }
html[data-theme="light"] .dt-table { border-color: #d9d0c3; }
html[data-theme="light"] .dt-table thead th { background: #f2ece2; border-bottom-color: #d9d0c3; }
html[data-theme="light"] .dt-table tbody td { border-bottom-color: #ebe4d8; }
html[data-theme="light"] .dt-table tbody tr:hover td { background: #f5f0e8; }
html[data-theme="light"] .dt-on-target-row td { background: rgba(34, 197, 94, 0.06); }
html[data-theme="light"] .dt-matrix-cell:hover { background: rgba(139, 92, 246, 0.04) !important; }
html[data-theme="light"] .dt-matrix-cell.editing { background: rgba(139, 92, 246, 0.08) !important; }
html[data-theme="light"] .dt-edit-popover { background: #ffffff; border-color: #d9d0c3; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12); }
html[data-theme="light"] .dt-edit-input, html[data-theme="light"] .dt-edit-select { background: #f8f4ee; border-color: #d9d0c3; }
html[data-theme="light"] .dt-edit-cancel { border-color: #d9d0c3; color: #4b5563; }
html[data-theme="light"] .dt-edit-cancel:hover { background: #f2ece2; }
html[data-theme="light"] .dt-pill-increase { color: #15803d; background: rgba(22, 163, 74, 0.1); }
html[data-theme="light"] .dt-pill-decrease { color: #dc2626; background: rgba(220, 38, 38, 0.08); }
html[data-theme="light"] .dt-pill-bid-up { color: #dc2626; background: rgba(220, 38, 38, 0.08); }
html[data-theme="light"] .dt-pill-bid-down { color: #15803d; background: rgba(22, 163, 74, 0.1); }
html[data-theme="light"] .dt-pill-special { color: #1d4ed8; background: rgba(29, 78, 216, 0.08); }
html[data-theme="light"] .dt-pill-blacklist { color: #b45309; background: rgba(180, 83, 9, 0.1); }
html[data-theme="light"] .dt-features { border-color: #d9d0c3; }
html[data-theme="light"] .dt-toggle { background: rgba(0, 0, 0, 0.05); border-color: #d9d0c3; }
html[data-theme="light"] .dt-boundaries { border-top-color: #ebe4d8; }

/* ── V3 Light theme overrides ── */
html[data-theme="light"] .dt-ver-btn.active { background: #7c3aed; }
html[data-theme="light"] .v3-section-card { border-color: #d9d0c3; background: #fdfcfa; }
html[data-theme="light"] .v3-general-card { border-color: #d9d0c3; background: #f8f5f0; }
html[data-theme="light"] .v3-use-case { border-color: #d9d0c3; background: #f8f5f0; }
html[data-theme="light"] .v3-bid-params { border-color: #d9d0c3; background: #f8f5f0; }
html[data-theme="light"] .v3-example-box { background: rgba(124, 58, 237, 0.04); border-color: rgba(124, 58, 237, 0.1); }
html[data-theme="light"] .v3-info-banner { border-color: #d9d0c3; background: #fdfcfa; }
html[data-theme="light"] .v3-info-desc code,
html[data-theme="light"] .v3-ab-explain code { background: rgba(124, 58, 237, 0.1); color: #7c3aed; }
html[data-theme="light"] .v3-info-note { background: rgba(124, 58, 237, 0.04); }
html[data-theme="light"] .v3-ab-note { background: rgba(249, 115, 22, 0.06); }
html[data-theme="light"] .v3-matrix-table { border-color: #d9d0c3; }
html[data-theme="light"] .v3-matrix-table th { background: #f8f5f0; border-color: #d9d0c3; }
html[data-theme="light"] .v3-row-label { border-color: #d9d0c3; }
html[data-theme="light"] .v3-cell { border-color: #d9d0c3; }
html[data-theme="light"] .v3-cell:hover { background: rgba(124, 58, 237, 0.05); }
html[data-theme="light"] .v3-cell.editing { background: rgba(124, 58, 237, 0.08); }
html[data-theme="light"] .v3-params-section { border-color: #d9d0c3; }
html[data-theme="light"] .v3-strategy-table th,
html[data-theme="light"] .v3-strategy-table td { border-color: #d9d0c3; }
