/* Marketing Overview Page Styles */

/* ===== Realtime Spend Section ===== */
.realtime-section {
    margin-bottom: 20px;
}

.realtime-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.realtime-content {
    padding: 16px;
}

.realtime-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.realtime-card {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: all 0.2s ease;
}

.realtime-card:hover {
    border-color: var(--text-muted);
}

.realtime-card.primary {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.05);
}

.realtime-card.highlight {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.realtime-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--warning);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.realtime-card-icon svg {
    width: 18px;
    height: 18px;
}

.realtime-card.highlight .realtime-card-icon {
    background: var(--primary);
}

.realtime-card-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.realtime-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.realtime-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'SF Mono', Monaco, monospace;
}

.realtime-value.comparison {
    font-size: 1.1rem;
}

.realtime-value.comparison.positive {
    color: var(--success);
}

.realtime-value.comparison.negative {
    color: var(--danger);
}

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

/* Realtime Table */
.realtime-content {
    padding: 0;
}

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

.realtime-table th {
    padding: 10px 12px;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.realtime-table th.col-hero {
    color: var(--primary);
}

.realtime-table td {
    padding: 10px 12px;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

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

/* Metric cell: value + comparison pills stacked */
.rt-metric {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rt-metric-value {
    font-family: 'SF Mono', Monaco, monospace;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.rt-metric.hero .rt-metric-value {
    color: var(--primary);
    font-size: 0.9rem;
}

.rt-comparisons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.rt-cmp {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, monospace;
    white-space: nowrap;
}

.rt-cmp-label {
    font-weight: 500;
    opacity: 0.7;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.rt-cmp.positive {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.rt-cmp.negative {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.rt-cmp.neutral {
    background: rgba(156, 163, 175, 0.1);
    color: var(--text-muted);
}

.platform-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
}

/* Realtime Expandable Rows */
.realtime-app-row {
    cursor: pointer;
    transition: background 0.2s ease;
}

.realtime-app-row:hover {
    background: var(--bg-hover);
}

.realtime-app-row.expanded {
    background: rgba(59, 130, 246, 0.05);
}

.expand-cell {
    width: 36px;
    padding-left: 12px !important;
}

.realtime-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: var(--bg-hover);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.realtime-expand-btn:hover {
    background: var(--primary);
    color: white;
}

.realtime-app-row.expanded .realtime-expand-btn {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary);
}

.realtime-platform-row {
    background: rgba(59, 130, 246, 0.03);
}

.realtime-platform-row td {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

.realtime-platform-row .rt-metric-value {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.realtime-platform-row .rt-cmp {
    font-size: 0.6rem;
    padding: 1px 4px;
}

.platform-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.platform-indent {
    width: 20px;
    height: 1px;
    background: var(--border-color);
    margin-right: 4px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section Hint */
.section-hint,
.trend-hint {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ===== Marketing Sections ===== */
.marketing-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.marketing-section-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(255,255,255,0.02) 0%, transparent 100%);
}

.section-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-icon svg {
    width: 18px;
    height: 18px;
}

.marketing-section-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.section-badge {
    margin-left: auto;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Header Toggle (in section header) */
.header-toggle {
    display: flex;
    margin-left: auto;
    background: var(--bg-dark);
    border-radius: 6px;
    padding: 2px;
    border: 1px solid var(--border-color);
}

/* ===== View Toggle ===== */
.view-toggle {
    display: flex;
    background: var(--bg-dark);
    border-radius: 6px;
    padding: 2px;
    border: 1px solid var(--border-color);
}

.view-toggle-btn {
    padding: 5px 12px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-toggle-btn:hover {
    color: var(--text-primary);
}

.view-toggle-btn.active {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary);
    font-weight: 600;
}

/* ===== Campaign Controls ===== */
.campaign-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-dark);
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.control-select {
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 0.75rem;
    cursor: pointer;
    outline: none;
    min-width: 120px;
}

.control-select:focus {
    border-color: var(--primary);
}


/* ===== App Performance Grid ===== */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 16px;
    padding: 16px;
}

.app-card {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    transition: all 0.3s ease;
    animation: cardAppear 0.5s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

/* Card status colors — tinted background + matching border */
.app-card.off_target_negative {
    --status-color: #ef4444;
    border-color: rgba(239, 68, 68, 0.35);
    border-left: 3px solid #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(239, 68, 68, 0.03) 100%);
}
.app-card.on_target {
    --status-color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.3);
    border-left: 3px solid #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.10) 0%, rgba(245, 158, 11, 0.02) 100%);
}
.app-card.off_target_positive {
    --status-color: #22c55e;
    border-color: rgba(34, 197, 94, 0.35);
    border-left: 3px solid #22c55e;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12) 0%, rgba(34, 197, 94, 0.03) 100%);
}

@keyframes cardAppear {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app-card:hover {
    border-color: var(--status-color, var(--app-color));
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 12px color-mix(in srgb, var(--status-color, var(--app-color)) 15%, transparent);
    transform: translateY(-2px);
}

.app-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.app-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

/* App icon in campaign table rows */
.app-icon-xs {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 4px;
}
.app-cell {
    white-space: nowrap;
}

/* App icon image (from App Store) */
.app-icon-img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
}

/* Large app icon in modal header */
.app-icon-lg {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    object-fit: cover;
}
.modal-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px !important;
}

.app-title {
    flex: 1;
    min-width: 0;
}

.app-name {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-campaigns {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.app-status {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Status color variants — shared by .app-status and .status-badge */
.app-status.off_target_negative,
.status-badge.off_target_negative {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}
.app-status.on_target,
.status-badge.on_target {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}
.app-status.off_target_positive,
.status-badge.off_target_positive {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
}

.app-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

.app-metric {
    text-align: center;
}

.app-metric .metric-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.app-metric .metric-value {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, monospace;
}

.app-metrics-roas {
    grid-template-columns: repeat(2, 1fr);
}

.app-metrics-spend {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 14px;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    margin-top: -4px;
}

.app-metrics-spend .metric-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.app-metrics-spend .metric-value {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, monospace;
}

.app-metrics-spend .app-metric {
    text-align: center;
}

.metric-delta {
    font-size: 0.62rem;
    font-weight: 600;
    margin-left: 4px;
    vertical-align: middle;
}

.metric-delta.up {
    color: #22c55e;
}

.metric-delta.down {
    color: #ef4444;
}

.app-progress {
    margin-bottom: 12px;
}

.progress-bar {
    position: relative;
    height: 6px;
    background: var(--bg-hover);
    border-radius: 3px;
    overflow: visible;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-target {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 12px;
    background: var(--text-muted);
    border-radius: 1px;
}

.app-platforms {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
}

.platform-tag {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.platform-tag.applovin_int {
    background: rgba(255, 107, 53, 0.15);
    color: #ff6b35;
}

.platform-tag.googleadwords_int {
    background: rgba(66, 133, 244, 0.15);
    color: #4285f4;
}

/* ===== Marketing Grid (Two Column) ===== */
.marketing-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 1024px) {
    .marketing-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Country Table ===== */
.country-table-wrapper {
    max-height: 400px;
    overflow-y: auto;
}

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

.country-table th {
    position: sticky;
    top: 0;
    padding: 12px 16px;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-color);
    z-index: 1;
}

.country-table td {
    padding: 12px 16px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.country-table tbody tr {
    transition: background 0.2s ease;
}

.country-table tbody tr:hover {
    background: var(--bg-hover);
}

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

.country-flag {
    margin-right: 8px;
    font-size: 1.1rem;
}

.app-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.spend-cell {
    font-family: 'SF Mono', Monaco, monospace;
    font-weight: 500;
}

.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.target-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 4px;
}

/* ===== Campaign Table ===== */
.campaign-content {
    overflow-y: visible;
}

.campaign-table-wrapper {
    overflow-y: visible;
}

.campaign-show-more {
    text-align: center;
    padding: 8px;
    border-top: 1px solid var(--border-color);
}
.show-more-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 4px 16px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}
.show-more-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

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

.campaign-table th {
    position: sticky;
    top: 0;
    padding: 10px 12px;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-color);
    z-index: 1;
}

.campaign-table td {
    padding: 10px 12px;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--border-color);
}

.campaign-table tbody tr {
    transition: background 0.2s ease;
}

.campaign-table tbody tr:hover {
    background: var(--bg-hover);
}

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

.campaign-name-cell {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.campaign-name {
    font-size: 0.8rem;
    font-weight: 500;
}

.platform-mini {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
}

/* ===== Impact View ===== */

.impact-view {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.impact-section {
    border-radius: 8px;
    overflow: hidden;
}

.impact-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.impact-negative .impact-section-header {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.impact-positive .impact-section-header {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.impact-count {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    background: currentColor;
    color: white;
    opacity: 0.9;
}

.impact-negative .impact-count {
    background: #ef4444;
}

.impact-positive .impact-count {
    background: #22c55e;
}

.impact-table {
    margin: 0;
    table-layout: fixed;
}

/* Fixed column widths for impact table alignment */
.impact-table th:nth-child(1),
.impact-table td:nth-child(1) { width: 30%; overflow: hidden; text-overflow: ellipsis; } /* Campaign */
.impact-table th:last-child,
.impact-table td:last-child { width: 14%; } /* Impact */

.impact-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, monospace;
}

.impact-empty {
    padding: 20px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ===== Trend Section ===== */
.charts-section {
    margin-bottom: 20px;
}

.trend-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.trend-controls .header-toggle {
    margin-left: 0;
}

.trend-roas-select {
    min-width: 120px;
    font-size: 0.78rem;
    padding: 5px 8px;
}

/* Legend chips */
.trend-legend {
    display: flex;
    gap: 8px;
    padding: 0 16px 8px 16px;
    flex-wrap: wrap;
}

.trend-legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1.5px solid var(--chip-color);
    background: color-mix(in srgb, var(--chip-color) 10%, transparent);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.trend-legend-chip:hover {
    background: color-mix(in srgb, var(--chip-color) 20%, transparent);
}

.trend-legend-chip.hidden {
    opacity: 0.35;
    border-color: var(--border-color);
    background: transparent;
}

.trend-legend-chip.hidden .trend-legend-dot {
    opacity: 0.3;
}

.trend-legend-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
}

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

.trend-legend-name {
    white-space: nowrap;
}

/* Chart grid */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 8px 16px 16px 16px;
}

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

.chart-wrapper {
    background: var(--bg-dark);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
}

.chart-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    text-align: center;
}

.chart-canvas-container {
    position: relative;
    height: 260px;
    width: 100%;
}

.chart-canvas-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

/* Old chart card (for modals) */
.chart-card {
    background: var(--bg-dark);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-height: 280px;
}

.chart-card canvas {
    width: 100% !important;
    height: 200px !important;
}

.chart-label {
    margin-top: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .app-grid {
        grid-template-columns: 1fr;
    }

    .app-metrics {
        grid-template-columns: repeat(3, 1fr);
    }
}


/* ===== Marketing Modal Styles ===== */

/* Override modal-lg size for marketing modals */
.modal-content.modal-lg {
    max-width: 1600px !important;
    width: 96% !important;
}

.modal-content.modal-lg .modal-body {
    padding: 24px !important;
    max-height: 85vh;
    overflow-y: auto;
}

.marketing-modal {
    padding: 0;
}

.modal-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    padding: 16px;
    background: var(--bg-dark);
    border-radius: 10px;
    margin-bottom: 24px;
}

@media (max-width: 600px) {
    .modal-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

.modal-stat {
    text-align: center;
    padding: 12px 8px;
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.modal-stat:hover {
    border-color: var(--stat-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.modal-stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--stat-color, var(--text-primary));
    font-family: 'SF Mono', Monaco, monospace;
    line-height: 1.2;
}

.modal-stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 6px;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 700px) {
    .modal-grid {
        grid-template-columns: 1fr;
    }
}

.modal-section {
    background: var(--bg-dark);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.modal-section.full-width {
    grid-column: 1 / -1;
}

.modal-section h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.modal-section h4 svg {
    color: var(--text-muted);
}

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

.modal-table th {
    padding: 12px 14px;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.modal-table td {
    padding: 12px 14px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

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

.modal-table tbody tr {
    transition: background 0.2s ease;
}

.modal-table tbody tr:hover {
    background: var(--bg-hover);
}

/* Platform Breakdown in Modal */
.platform-breakdown {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.platform-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    transition: all 0.2s ease;
}

.platform-item:hover {
    border-color: var(--platform-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.platform-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.platform-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--platform-color);
}

.platform-spend {
    font-weight: 700;
    font-size: 1.1rem;
    font-family: 'SF Mono', Monaco, monospace;
}

.platform-metrics {
    display: flex;
    gap: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.platform-metrics strong {
    font-family: 'SF Mono', Monaco, monospace;
}

.platform-bar {
    height: 6px;
    background: var(--bg-hover);
    border-radius: 3px;
    overflow: hidden;
}

.platform-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Modal Chart */
.modal-chart-container {
    height: 220px;
    width: 100%;
    padding: 10px 0;
}

.modal-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Modal Tabs */
/* Modal filter bar (country selector at top) */
.modal-filter-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: var(--bg-dark);
    border-radius: 10px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.modal-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-filter-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Toolbar above daily table (selector + toggle) */
.modal-table-toolbar {
    display: flex;
    align-items: center;
    padding: 6px 0;
    gap: 10px;
}

.modal-table-toolbar .view-toggle {
    margin-left: auto;
}

/* Campaign selector dropdown */
.campaign-selector {
    background: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    font-family: inherit;
    max-width: 480px;
    cursor: pointer;
}
.campaign-selector:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Clickable campaign rows */
.campaign-row {
    cursor: pointer;
    transition: background 0.15s;
}
.campaign-row:hover {
    background: rgba(255, 255, 255, 0.04);
}
.campaign-row.selected {
    background: rgba(59, 130, 246, 0.15);
    outline: 1px solid rgba(59, 130, 246, 0.5);
    box-shadow: inset 3px 0 0 #3b82f6;
}
.campaign-row.selected td {
    color: var(--text-primary);
}
.campaign-row.selected td:first-child {
    font-weight: 600;
}

/* Scrollable Table Wrapper */
.modal-table-scroll {
    max-height: 340px;
    overflow-y: auto;
    overflow-x: auto;
}

.modal-table-scroll::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.modal-table-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.modal-table-scroll::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

.modal-table-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

/* Sticky header in scrollable table */
.modal-table-scroll .modal-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-card);
}

/* Monospace cells */
.modal-table td.mono {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.8rem;
}

/* Compact modal table (many columns) */
.modal-table-compact th,
.modal-table-compact td {
    padding: 8px 6px;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Campaign name column in modal — wider for readability */
#campaigns-summary-table .campaign-name-cell {
    max-width: 420px;
    min-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-table-compact td.mono {
    font-size: 0.72rem;
}

/* ROAS heatmap cells */
.roas-cell {
    text-align: center;
    font-weight: 600;
    border-radius: 0;
}

.roas-cell.roas-na {
    color: var(--text-muted) !important;
    background: transparent !important;
    opacity: 0.4;
}

/* Small Status Badge */
.status-badge-sm {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* ===== Skeleton Loading ===== */

/* Override skeleton shimmer with brighter glow sweep */
.marketing-section .skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 0%,
        rgba(255, 255, 255, 0.03) 25%,
        rgba(255, 255, 255, 0.08) 45%,
        rgba(255, 255, 255, 0.14) 50%,
        rgba(255, 255, 255, 0.08) 55%,
        rgba(255, 255, 255, 0.03) 75%,
        rgba(255, 255, 255, 0.03) 100%
    );
    background-size: 200% 100%;
    animation: skel-glow 1.8s ease-in-out infinite;
}

@keyframes skel-glow {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Subtle pulse on skeleton cards */
.skel-app-card {
    animation: cardAppear 0.5s ease forwards, skel-card-pulse 2s ease-in-out 0.5s infinite;
}

@keyframes skel-card-pulse {
    0%, 100% { border-color: var(--border-color); }
    50%      { border-color: rgba(255, 255, 255, 0.1); }
}

.skel-section-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.skel-header-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
}

.skel-header-title {
    width: 120px;
    height: 16px;
}

.skel-header-toggle {
    width: 140px;
    height: 28px;
    border-radius: 6px;
    margin-left: auto;
}

/* Skeleton App Card */
.skel-app-card {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
}

.skel-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.skel-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
}

.skel-card-title {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skel-line-md {
    width: 60%;
    height: 14px;
}

.skel-line-sm {
    width: 35%;
    height: 10px;
}

.skel-badge {
    width: 56px;
    height: 20px;
    border-radius: 10px;
}

.skel-card-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.skel-card-metrics.three {
    grid-template-columns: 1fr 1fr 1fr;
}

.skel-metric {
    height: 36px;
    border-radius: 6px;
}

.skel-card-tags {
    display: flex;
    gap: 8px;
}

.skel-tag {
    width: 64px;
    height: 22px;
    border-radius: 4px;
}

/* Skeleton Chart */
.skel-chart {
    background: var(--bg-dark);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skel-chart-title {
    width: 100px;
    height: 12px;
}

.skel-chart-area {
    width: 100%;
    height: 180px;
    border-radius: 8px;
}
