/* Auto-Pilot Monitor Page */

/* ===== Page-Scoped Custom Properties ===== */
#page-auto-pilot {
    --ap-green: #5a8a5e;
    --ap-red: #b85c5c;
    --ap-orange: #c4853a;
    --ap-yellow: #b89a3e;
    --ap-purple: #8b7aad;
    --ap-green-bg: rgba(90, 138, 94, 0.10);
    --ap-red-bg: rgba(184, 92, 92, 0.10);
}

/* ===== Loading transition ===== */
#page-auto-pilot > div,
#ap-banner-metrics,
#ap-kpi-row1,
#ap-kpi-row2,
#ap-alerts-container {
    transition: opacity 0.2s ease;
}

/* ===== 1. Controls Bar ===== */
.ap-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 18px;
    margin-bottom: 20px;
}

.ap-controls-left {
    display: flex;
    gap: 12px;
}

.ap-game-select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 7px 14px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23a1a1aa' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.ap-game-select:hover {
    border-color: var(--text-muted);
}

.ap-game-select:focus {
    border-color: var(--text-secondary);
}

.ap-period-selector {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.04);
    padding: 3px;
    border-radius: 8px;
}

.ap-period-btn {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.ap-period-btn:hover {
    color: var(--text-primary);
}

.ap-period-btn.active {
    background: var(--bg-hover);
    color: var(--text-primary);
    font-weight: 600;
}

/* ===== 2. Filter Bar ===== */
.ap-filter-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

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

.ap-filter-row:last-child {
    margin-bottom: 0;
}

.ap-filter-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 70px;
    flex-shrink: 0;
}

.ap-filter-btn {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--bg-dark);
    color: var(--text-primary);
    transition: all 0.15s ease;
}

.ap-filter-btn:hover {
    border-color: var(--text-muted);
}

.ap-filter-btn.active {
    background: var(--text-secondary);
    color: #ffffff;
    border-color: var(--text-secondary);
}

.ap-filter-btn .ap-spend-hint {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: 4px;
}

.ap-filter-btn.active .ap-spend-hint {
    color: rgba(255, 255, 255, 0.7);
}

.ap-filter-current {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: auto;
}

.ap-filter-current strong {
    color: var(--text-primary);
}

/* ===== 3. Health Score Banner ===== */
.ap-health-banner {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-dark) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px 32px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.ap-health-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.ap-health-score {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    flex-shrink: 0;
}

.ap-health-score.good {
    background: rgba(90, 138, 94, 0.10);
    border: 3px solid var(--ap-green);
    color: var(--ap-green);
}


.ap-health-score.warning {
    background: rgba(196, 133, 58, 0.10);
    border: 3px solid var(--ap-orange);
    color: var(--ap-orange);
}

.ap-health-score.danger {
    background: rgba(184, 92, 92, 0.10);
    border: 3px solid var(--ap-red);
    color: var(--ap-red);
}

.ap-health-info h2 {
    font-size: 18px;
    margin: 0 0 4px 0;
    color: var(--text-primary);
}

.ap-health-info p {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0;
}

.ap-health-tags {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.ap-health-tag {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.ap-health-tag.up {
    background: rgba(90, 138, 94, 0.12);
    color: var(--ap-green);
}

.ap-health-tag.down {
    background: rgba(184, 92, 92, 0.12);
    color: var(--ap-red);
}

.ap-health-tag.neutral {
    background: rgba(113, 113, 122, 0.12);
    color: var(--text-secondary);
}

.ap-health-right {
    text-align: right;
}

.ap-health-metric {
    display: inline-block;
    margin-left: 24px;
    vertical-align: top;
}

.ap-health-metric:first-child {
    margin-left: 0;
}

.ap-big-num {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

.ap-metric-label {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
    margin-top: 2px;
}

/* ===== 4. KPI Grid ===== */
.ap-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

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

.ap-kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    position: relative;
    transition: border-color 0.15s ease;
}

.ap-kpi-card .ap-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.ap-kpi-card .ap-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.ap-kpi-card .ap-trend {
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ap-kpi-card .ap-trend.up {
    color: var(--ap-green);
}

.ap-kpi-card .ap-trend.down {
    color: var(--ap-red);
}

.ap-kpi-card .ap-trend.neutral {
    color: var(--text-secondary);
}

.ap-kpi-card .ap-sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.ap-kpi-card .ap-mini-chart {
    height: 36px;
    margin-top: 6px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
}

.ap-kpi-card .ap-mini-chart .ap-bar {
    flex: 1;
    background: var(--text-secondary);
    border-radius: 2px 2px 0 0;
    opacity: 0.3;
    min-width: 0;
}

/* Card highlights for better/worse */
.ap-kpi-card.ap-better {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(90, 138, 94, 0.05) 100%);
    border-color: rgba(90, 138, 94, 0.30);
}

.ap-kpi-card.ap-worse {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(184, 92, 92, 0.05) 100%);
    border-color: rgba(184, 92, 92, 0.30);
}

/* Info button */
.ap-info-btn {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    font-style: italic;
    font-family: Georgia, serif;
    cursor: help;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
    transition: opacity 0.15s;
    padding: 0;
    line-height: 1;
}

.ap-info-btn:hover {
    opacity: 1;
}

.ap-info-tooltip {
    display: none;
    position: absolute;
    top: 30px;
    right: 4px;
    background: #1a1a1a;
    color: #ccc;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 11px;
    line-height: 1.5;
    z-index: 20;
    width: 240px;
    white-space: normal;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.ap-info-btn:hover + .ap-info-tooltip {
    display: block;
}

/* Previous period tooltip on hover */
.ap-prev-tooltip {
    display: none;
    position: absolute;
    top: -8px;
    right: 12px;
    background: #1a1a1a;
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.ap-prev-tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    right: 16px;
    width: 8px;
    height: 8px;
    background: #1a1a1a;
    transform: rotate(45deg);
}

.ap-kpi-card:hover .ap-prev-tooltip {
    display: block;
}

/* ===== 5. Retention Grid ===== */
.ap-retention-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.ap-ret-item {
    text-align: center;
    padding: 8px 4px;
    background: var(--bg-dark);
    border-radius: 6px;
}

.ap-ret-item .ap-ret-label {
    font-size: 10px;
    color: var(--text-secondary);
}

.ap-ret-item .ap-ret-val {
    font-size: 16px;
    font-weight: 700;
    margin-top: 2px;
    color: var(--text-primary);
}

/* ===== 6. Multiplier Grid (spans 2 cols) ===== */
.ap-kpi-card.ap-span-2 {
    grid-column: span 2;
}

.ap-mult-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.ap-mult-item {
    text-align: center;
    padding: 10px 8px 6px;
    border-radius: 6px;
    position: relative;
    cursor: pointer;
    transition: transform 0.1s;
}

.ap-mult-item.ap-better-bg {
    background: var(--ap-green-bg);
}

.ap-mult-item.ap-worse-bg {
    background: var(--ap-red-bg);
}

.ap-mult-item.ap-same-bg {
    background: var(--bg-dark);
}

.ap-mult-item .ap-mult-label {
    font-size: 10px;
    color: var(--text-secondary);
}

.ap-mult-item .ap-mult-val {
    font-size: 15px;
    font-weight: 700;
    margin-top: 2px;
    color: var(--text-primary);
}

.ap-mult-item .ap-mult-prev {
    display: none;
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.ap-mult-item:hover .ap-mult-prev {
    display: block;
}

/* Multiplier Sparkline */
.ap-sparkline-wrap {
    margin-top: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}

.ap-sparkline-wrap:hover {
    background: rgba(140, 129, 119, 0.08);
}

.ap-mult-item:hover {
    transform: scale(1.03);
}

/* ===== 6b. Expanded Chart Overlay ===== */
.ap-chart-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.ap-chart-overlay.active {
    display: flex;
}

.ap-chart-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 780px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.ap-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.ap-chart-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.ap-chart-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.ap-chart-close:hover {
    color: var(--text-primary);
}

.ap-chart-body {
    padding: 20px 24px 24px;
}

.ap-chart-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.ap-chart-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--bg-dark);
    border-radius: 8px;
}

.ap-chart-stats strong {
    color: var(--text-primary);
}

.ap-expanded-chart {
    width: 100%;
    height: auto;
    display: block;
}

/* ===== 7. Section Cards ===== */
.ap-two-col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.ap-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.ap-section-scroll {
    max-height: 600px;
    overflow-y: auto;
}

.ap-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.ap-section-header h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.ap-section-header .ap-badge {
    background: var(--text-secondary);
    color: #ffffff;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

/* ===== 8. Auto Marketing Decisions ===== */
.ap-decision-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.ap-decision-stat {
    text-align: center;
    padding: 10px;
    background: var(--bg-dark);
    border-radius: 8px;
    cursor: pointer;
    transition: outline 0.15s, transform 0.1s;
    border: 2px solid transparent;
}

.ap-decision-stat:hover {
    transform: scale(1.03);
}

.ap-decision-stat.active {
    border-color: var(--text-secondary);
}

.ap-decision-stat .ap-num {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.ap-decision-stat .ap-lbl {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 3px;
}

.ap-decision-timeline {
    max-height: 240px;
    overflow-y: auto;
}

.ap-decision-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-color);
}

.ap-decision-item:last-child {
    border-bottom: none;
}

.ap-decision-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ap-decision-dot.ap-increase {
    background: var(--ap-green);
}

.ap-decision-dot.ap-decrease {
    background: var(--ap-red);
}

.ap-decision-dot.ap-pause {
    background: var(--ap-yellow);
}

.ap-decision-dot.ap-bid {
    background: var(--ap-orange);
}

.ap-decision-dot.ap-new {
    background: var(--ap-purple);
}

.ap-decision-item .ap-desc {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 0;
}

.ap-decision-item .ap-desc strong {
    color: var(--text-primary);
}

/* ===== 8b. Network Breakdown ===== */
.ap-network-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
    padding: 8px 10px;
    background: var(--bg-dark);
    border-radius: 6px;
}

.ap-network-pill {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 0.15s;
}

.ap-network-pill:hover {
    border-color: var(--text-secondary);
}

.ap-network-pill.active {
    background: var(--text-secondary);
    color: #fff;
    border-color: var(--text-secondary);
}

.ap-network-pill.active strong {
    color: #fff;
}

.ap-filter-active-label {
    font-size: 10px;
    margin-left: 6px;
    cursor: pointer;
    opacity: 0.8;
}

.ap-filter-active-label:hover {
    opacity: 1;
}

.ap-network-pill strong {
    color: var(--text-primary);
    margin-left: 3px;
}

/* ===== 8c. Timeline Date Groups ===== */
.ap-timeline-group {
    margin-bottom: 4px;
}

.ap-timeline-group:last-child {
    margin-bottom: 0;
}

.ap-timeline-date-header {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 0 2px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2px;
}

/* ===== 8d. Decision Item Enhancements ===== */
.ap-decision-row1 {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ap-decision-row2 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.ap-decision-campaign {
    font-size: 12px;
    color: var(--text-secondary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-decision-cid {
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.8;
}

.ap-network-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    white-space: nowrap;
}

.ap-decision-country {
    font-size: 11px;
    color: var(--text-muted);
}

.ap-decision-detail {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-dark);
    padding: 1px 7px;
    border-radius: 4px;
    white-space: nowrap;
}

.ap-change-pct {
    font-size: 10px;
    font-weight: 700;
}

.ap-change-pct.up {
    color: var(--ap-green);
}

.ap-change-pct.down {
    color: var(--ap-red);
}

/* ===== 9. Today's Actions ===== */
.ap-action-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ap-action-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.ap-action-item:last-child {
    border-bottom: none;
}

.ap-action-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.ap-action-icon.ap-budget-up {
    background: rgba(90, 138, 94, 0.12);
    color: var(--ap-green);
}

.ap-action-icon.ap-budget-down {
    background: rgba(184, 92, 92, 0.12);
    color: var(--ap-red);
}

.ap-action-icon.ap-bid-change {
    background: rgba(196, 133, 58, 0.12);
    color: var(--ap-orange);
}

.ap-action-icon.ap-paused {
    background: rgba(184, 154, 62, 0.12);
    color: var(--ap-yellow);
}

.ap-action-text {
    font-size: 13px;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

.ap-action-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 3px;
}

.ap-action-campaign {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.ap-action-detail {
    font-size: 12px;
    color: var(--text-secondary);
}

.ap-action-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
}

.ap-action-text .ap-reason {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 3px;
    display: block;
}

/* ===== 9b. Platform Pill ===== */
.ap-platform-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 8px;
    background: var(--bg-dark);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ap-platform-pill.ap-platform-ios {
    color: #6e9cda;
    border-color: rgba(110, 156, 218, 0.3);
    background: rgba(110, 156, 218, 0.08);
}

.ap-platform-pill.ap-platform-android {
    color: #7cb87e;
    border-color: rgba(124, 184, 126, 0.3);
    background: rgba(124, 184, 126, 0.08);
}

/* ===== 9c. Status Badge ===== */
.ap-status-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: var(--bg-dark);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.ap-status-badge.ap-status-executed {
    color: var(--ap-green);
    border-color: rgba(90, 138, 94, 0.3);
    background: rgba(90, 138, 94, 0.08);
}

.ap-status-badge.ap-status-pending {
    color: var(--ap-yellow);
    border-color: rgba(184, 154, 62, 0.3);
    background: rgba(184, 154, 62, 0.08);
}

.ap-status-badge.ap-status-approved {
    color: #6e9cda;
    border-color: rgba(110, 156, 218, 0.3);
    background: rgba(110, 156, 218, 0.08);
}

.ap-status-badge.ap-status-failed {
    color: var(--ap-red);
    border-color: rgba(184, 92, 92, 0.3);
    background: rgba(184, 92, 92, 0.08);
}

/* ===== 9d. Empty State ===== */
.ap-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    text-align: center;
}

.ap-empty-icon {
    font-size: 28px;
    margin-bottom: 8px;
    opacity: 0.4;
}

.ap-empty-text {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== 10. Alert Boxes ===== */
.ap-alert-box {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.ap-alert-box:last-child {
    margin-bottom: 0;
}

.ap-alert-box.ap-warning {
    background: rgba(184, 154, 62, 0.08);
    border: 1px solid rgba(184, 154, 62, 0.25);
}

.ap-alert-box.ap-danger {
    background: rgba(184, 92, 92, 0.08);
    border: 1px solid rgba(184, 92, 92, 0.25);
}

.ap-alert-box.ap-info {
    background: rgba(113, 113, 122, 0.06);
    border: 1px solid rgba(113, 113, 122, 0.20);
}

.ap-alert-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.ap-alert-content {
    font-size: 13px;
    color: var(--text-secondary);
}

.ap-alert-content strong {
    display: block;
    margin-bottom: 2px;
    color: var(--text-primary);
}

/* ===== 11. Prediction Parentheses ===== */
.ap-pred-wrap {
    color: var(--ap-orange);
}

.ap-pred-wrap::before {
    content: '(';
}

.ap-pred-wrap::after {
    content: ')';
}

/* ===== 12. Skeleton Loading ===== */
.ap-skeleton {
    animation: ap-pulse 1.5s ease-in-out infinite;
    background: var(--bg-hover);
    border-radius: 8px;
}

@keyframes ap-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

.ap-skel-banner {
    height: 110px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.ap-skel-filter {
    height: 70px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.ap-skel-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.ap-skel-card {
    height: 120px;
    border-radius: 10px;
}

.ap-skel-section {
    height: 250px;
    border-radius: 10px;
}

/* ===== Creative Table ===== */
.ap-cr-table-wrap {
    max-height: 500px;
    overflow-y: auto;
}

.ap-cr-table {
    width: 100%;
    border-collapse: collapse;
}

.ap-cr-table th {
    text-align: left;
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 2;
}

.ap-cr-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-primary);
}

.ap-cr-table tr:hover {
    background: var(--bg-hover);
}

.ap-cr-rank {
    color: var(--text-muted);
    font-size: 12px;
    width: 30px;
}

.ap-cr-name {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.ap-cr-type {
    font-size: 11px;
    color: var(--text-secondary);
}

.ap-cr-cost {
    font-weight: 600;
}

.ap-cr-sov {
    color: var(--text-secondary);
}

.ap-cr-age {
    color: var(--text-muted);
    font-size: 12px;
}

.ap-cr-spark {
    width: 60px;
}

/* ===== 13. Responsive ===== */
@media (max-width: 1200px) {
    .ap-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .ap-kpi-row2-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .ap-two-col {
        grid-template-columns: 1fr;
    }

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

    .ap-health-banner {
        flex-direction: column;
        gap: 16px;
        padding: 20px;
    }

    .ap-health-right {
        text-align: left;
    }

    .ap-controls {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

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

/* ===== 14. Scrollbar (scoped) ===== */
#page-auto-pilot ::-webkit-scrollbar {
    width: 6px;
}

#page-auto-pilot ::-webkit-scrollbar-track {
    background: transparent;
}

#page-auto-pilot ::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}
