/* ========================================
   Campaigns Page  Facebook Ads Manager Parity
   Flat, compact, clean design matching Meta Ads Manager
   ======================================== */

/* Top Header Bar */
.ads-manager-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    min-height: 48px;
    background: var(--bg-secondary);
    border-bottom: none;
    gap: 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left .page-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-left .page-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0;
    display: none;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Header icons - FB style: borderless */
.ads-manager-header .btn-icon {
    background: transparent;
    border: none;
    width: 30px;
    height: 30px;
    color: var(--text-secondary);
}

.ads-manager-header .btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ========================================
   Summary Stats Cards
   ======================================== */
.campaign-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 8px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: border-color 0.15s ease;
}



.stat-card:hover {
    border-color: color-mix(in srgb, var(--border-color) 60%, var(--accent-primary) 40%);
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.blue { background: rgba(59, 130, 246, 0.10); color: #3b82f6; }
.stat-icon.green { background: rgba(34, 197, 94, 0.10); color: #22c55e; }
.stat-icon.purple { background: rgba(147, 51, 234, 0.10); color: #9333ea; }
.stat-icon.amber { background: rgba(245, 158, 11, 0.10); color: #f59e0b; }

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

.stat-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    margin-bottom: 1px;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.stat-change {
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 2px;
}

.stat-change.positive { color: #22c55e; }
.stat-change.negative { color: #ef4444; }
.stat-change.neutral { color: var(--text-muted); }

/* Account Badge */
.account-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
    height: 32px;
}

.account-badge:hover {
    background: var(--bg-hover);
}

.badge-icon {
    width: 22px;
    height: 22px;
    background: var(--accent-primary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.7rem;
}

.badge-text {
    display: flex;
    flex-direction: column;
}

.badge-text .account-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.badge-text .account-id {
    font-size: 0.68rem;
    color: var(--text-muted);
    line-height: 1.2;
}

/* Opportunity Score */
.opportunity-score {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    height: 32px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.opportunity-score:hover {
    background: var(--bg-hover);
}

.score-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--success);
}

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

/* ========================================
   Filter Tabs Bar (below header)
   Facebook-style rounded pill tabs
   ======================================== */

.filter-tabs-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 4px 20px 6px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    gap: 6px;
}

.filter-tabs-top {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.filter-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
}

.filter-tab {
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    border: none;
    background: transparent;
    line-height: 1.3;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.filter-tab svg {
    width: 14px;
    height: 14px;
}

.filter-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.filter-tab.active {
    background: var(--accent-primary);
    color: #fff;
}

.filter-tabs-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ========================================
   Search Bar - FB Ads Manager Style
   ======================================== */

/* search-bar-row removed — search is inside filter-tabs-bar */

.search-bar-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 320px;
    height: 30px;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0 6px;
    gap: 6px;
    transition: background 0.15s;
}

.search-bar-wrapper:focus-within {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.search-bar-icon {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-bar-wrapper input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
    color: var(--text-primary);
    font-size: 0.8rem;
    line-height: 30px;
    padding: 0 !important;
    border-radius: 0 !important;
    min-width: 60px;
    width: 80px;
}

.search-bar-wrapper input:focus {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.search-bar-wrapper input::placeholder {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Search Dropdown */
.search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 340px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 100;
    padding: 8px 0;
    max-height: 400px;
    overflow-y: auto;
}

.search-bar-wrapper:focus-within .search-dropdown {
    display: block;
}

.search-dropdown-section {
    padding: 0;
}

.search-dropdown-title {
    padding: 8px 16px 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.search-dropdown-item {
    padding: 8px 16px;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s;
}

.search-dropdown-item:hover {
    background: var(--bg-hover);
}

.search-dropdown-item .dot-active {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    margin-right: 2px;
    vertical-align: middle;
}

.search-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}

/* ========================================
   Level Tabs (Campaigns / Ad sets / Ads)
   Underline style  no background, no rounded pill
   ======================================== */

.level-tabs-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
    flex-wrap: nowrap;
    min-height: 38px;
}

.level-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}

.level-tabs-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 1;
    min-width: 0;
}

.level-tab {
    position: relative;
    padding: 9px 16px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s ease;
    white-space: nowrap;
    border: none;
    background: transparent;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.level-tab:hover {
    color: var(--text-primary);
}

.level-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.level-tab .tab-count {
    margin-left: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 2px 7px;
    color: var(--text-muted);
}

.level-tab.active .tab-count {
    background: rgba(var(--accent-primary-rgb, 59, 130, 246), 0.15);
    color: var(--accent-primary);
}

/* Date Range Picker */
.date-range-picker {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 8px;
    height: 28px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.76rem;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    white-space: nowrap;
}

.date-range-picker:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.date-range-picker svg {
    width: 13px;
    height: 13px;
}

/* ========================================
   Action Buttons Row
   Compact 32px height, flat Facebook style
   ======================================== */

.action-buttons-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 6px;
}

.action-buttons-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Vertical divider between action groups */
.action-buttons-left::after {
    content: '';
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin-left: 4px;
}

.action-buttons-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 12px;
    height: 32px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1;
}

.btn:hover {
    background: var(--bg-hover);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.btn svg {
    width: 14px;
    height: 14px;
}

.btn-primary {
    background: #42b72a;
    border-color: #42b72a;
    color: #fff;
    box-shadow: 0 1px 3px rgba(66, 183, 42, 0.25);
}

.btn-primary:hover {
    background: #36a420;
    border-color: #36a420;
    box-shadow: 0 2px 6px rgba(66, 183, 42, 0.35);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.btn-success:hover {
    opacity: 0.9;
}

.btn-danger {
    color: var(--danger);
    border-color: var(--danger);
    background: transparent;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-icon {
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.btn-icon svg {
    width: 16px;
    height: 16px;
}

.btn-with-dropdown {
    position: relative;
}

/* Dropdowns */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.15s ease;
    overflow: hidden;
}

.dropdown-menu.show,
.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu.align-right {
    left: auto;
    right: 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.12s ease;
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

.dropdown-item svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.dropdown-item.danger {
    color: var(--danger);
}

.dropdown-item.danger svg {
    color: var(--danger);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* ========================================
   DATA TABLE
   Clean, compact, Facebook-style table
   ======================================== */

.ads-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: none;
}

.ads-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

/* Table Head */
.ads-table thead {
    background: var(--bg-secondary);
}

.ads-table th {
    padding: 8px 10px;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    position: relative;
    user-select: none;
}

/* Right-align numeric column headers */
.ads-table th.col-results,
.ads-table th.col-cost,
.ads-table th.col-budget,
.ads-table th.col-spent,
.ads-table th.col-impressions,
.ads-table th.col-reach {
    text-align: right;
}

.ads-table th.sortable {
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.ads-table th.sortable:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.sort-icon,
.sort-icons {
    display: inline-flex;
    margin-left: 4px;
    opacity: 0.3;
    transition: opacity 0.15s ease;
    vertical-align: middle;
}

.ads-table th.sortable:hover .sort-icon,
.ads-table th.sortable:hover .sort-icons {
    opacity: 0.6;
}

.ads-table th.sorted .sort-icon,
.ads-table th.sorted .sort-icons {
    opacity: 1;
    color: var(--accent-primary);
}

/* Column Dividers (thin border between th cells) */
.ads-table th:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background: var(--border-color);
}

/* Column Filter Button */
.column-filter-btn,
.filter-col-btn {
    width: 20px;
    height: 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 4px;
}

.column-filter-btn:hover,
.filter-col-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Schedule column */
.schedule-column .schedule-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.schedule-column .schedule-date {
    font-size: 0.8rem;
    color: var(--text-primary);
}

.schedule-column .schedule-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Settings button in header */
.settings-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

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

/* Table Body */
.ads-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s ease;
}

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

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

.ads-table tbody tr.selected {
    background: rgba(var(--accent-primary-rgb, 59, 130, 246), 0.08);
}

.ads-table td {
    padding: 8px 10px;
    font-size: 0.82rem;
    color: var(--text-primary);
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Column Widths - matches FB Ads Manager column order */
.col-checkbox { width: 36px; }
.col-toggle { width: 48px; }
.col-name { width: 20%; }
.col-delivery { width: 7%; }
.col-bid-strategy { width: 7%; }
.col-budget { width: 7%; text-align: right; }
.col-attribution { width: 7%; }
.col-results { width: 7%; text-align: right; }
.col-reach { width: 7%; text-align: right; }
.col-impressions { width: 7%; text-align: right; }
.col-cost { width: 7%; text-align: right; }
.col-spent { width: 7%; text-align: right; }
.col-ends { width: 6%; }
.col-schedule { width: 8%; }

/* Right-align numeric columns in body */
.ads-table td.col-results,
.ads-table td.col-cost,
.ads-table td.col-budget,
.ads-table td.col-spent,
.ads-table td.col-impressions,
.ads-table td.col-reach {
    text-align: right;
}

/* Checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

/* Table Toggle Switch (standalone div - Facebook Ads Manager style) */
.ads-table .toggle-switch {
    width: 36px;
    height: 20px;
    background: #8a8d91;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: background 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.ads-table .toggle-switch::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 2px;
    left: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.ads-table .toggle-switch.active {
    background: #0ea5e9;
}

.ads-table .toggle-switch.active::after {
    transform: translateX(16px);
}

.ads-table .toggle-switch:hover {
    opacity: 0.85;
}

/* Campaign Name Cell */
.campaign-name-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.campaign-name-cell .name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: color 0.15s ease;
    line-height: 1.3;
}

.campaign-name-cell .name:hover {
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.campaign-name-cell .campaign-id {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Right-align numeric cell contents */
.result-cell, .cost-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
    align-items: flex-end;
}

.budget-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
    align-items: flex-end;
}

.result-number, .cost-number, .budget-number {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.result-label, .result-type, .cost-per, .cost-type, .budget-type {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* Delivery Status - Facebook Ads Manager style (dot + text, no pill) */
.delivery-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 0;
    white-space: nowrap;
}

.delivery-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.delivery-status.active .delivery-dot {
    background: #31a24c;
    box-shadow: 0 0 0 2px rgba(49, 162, 76, 0.15);
}

.delivery-status.active {
    color: #31a24c;
}

.delivery-status.paused .delivery-dot {
    background: #8a8d91;
}

.delivery-status.paused {
    color: var(--text-secondary);
}

.delivery-status.off .delivery-dot {
    background: #8a8d91;
}

.delivery-status.off {
    color: var(--text-muted);
}

.delivery-status.error .delivery-dot {
    background: #e4002b;
}

.delivery-status.error {
    color: #e4002b;
}

.delivery-status.learning .delivery-dot {
    background: var(--accent-primary);
    animation: pulse 2s ease-in-out infinite;
}

.delivery-status.learning {
    color: var(--accent-primary);
}

.delivery-status.completed .delivery-dot {
    background: #8a8d91;
}

.delivery-status.completed {
    color: var(--text-muted);
}

/* Row Actions - FB style hover overlay on name cell */
.row-actions {
    display: none;
    align-items: center;
    gap: 2px;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    z-index: 5;
}

.ads-table tbody tr:hover .row-actions {
    display: flex;
}

.campaign-name-cell {
    position: relative;
}

.row-action-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.12s ease;
}

.row-action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Bid strategy & attribution text styles */
.col-bid-strategy,
.col-attribution,
.col-ends {
    font-size: 12px;
    color: var(--text-secondary);
}

.bid-strategy-text,
.attribution-text,
.ends-text {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Numeric Values */
.numeric-value {
    font-variant-numeric: tabular-nums;
}

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

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

.numeric-value.na {
    color: var(--text-tertiary);
}

/* ========================================
   TABLE FOOTER & PAGINATION
   ======================================== */

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    min-height: 40px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.results-count {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.info-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
}

.info-btn:hover {
    color: var(--text-secondary);
}

.footer-right {
    display: flex;
    align-items: center;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 0 8px;
}

/* ========================================
   BULK ACTIONS BAR
   ======================================== */

.bulk-actions-bar {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.2);
    z-index: 100;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.bulk-actions-bar.visible {
    transform: translateY(0);
}

.bulk-actions-content {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.bulk-actions-content .selected-count {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.bulk-actions-content .bulk-buttons {
    display: flex;
    gap: 6px;
    flex: 1;
}

.close-bulk {
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-bulk:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ========================================
   EMPTY & LOADING STATES
   ======================================== */

.empty-state {
    text-align: center;
    padding: 70px 24px;
}

/* Override table-layout:fixed for empty state rows */
.ads-table tbody tr:has(.empty-state) td {
    width: auto !important;
    overflow: visible;
}

.ads-table tbody tr:has(.empty-state) {
    display: table-row;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-tertiary);
    margin-bottom: 18px;
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.empty-state p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0 0 28px;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.loading-row td {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

/* Schedule helper spans */
.schedule-ongoing {
    color: var(--text-muted);
    font-style: italic;
}

.schedule-days {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.schedule-days.today {
    color: var(--accent-primary);
    font-weight: 600;
}

/* Account switcher active item */
.active-account-item {
    background: rgba(var(--accent-primary-rgb, 59, 130, 246), 0.08);
    font-weight: 600;
}

/* Page switching transition */
.page-switching {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

@media (max-width: 1400px) {
    .action-buttons-right {
        display: none;
    }
    .campaign-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1200px) {
    .ads-manager-header {
        padding: 10px 16px;
    }

    .filter-tabs-bar {
        padding: 8px 16px;
    }

    .ads-manager-content {
        padding: 14px 16px;
    }

    .level-tabs-container {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .date-range-picker {
        align-self: flex-start;
    }
}

@media (max-width: 1024px) {
    .ads-table-container {
        overflow-x: auto;
    }

    .ads-table {
        min-width: 1000px;
    }
}

@media (max-width: 768px) {
    .ads-manager-header .header-center {
        display: none;
    }

    .filter-tabs {
        overflow-x: auto;
        padding-bottom: 6px;
    }

    .filter-tabs-right {
        display: none;
    }

    .level-tabs {
        width: 100%;
        overflow-x: auto;
    }

    .action-buttons-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .action-buttons-left {
        width: 100%;
        justify-content: flex-start;
    }

    .bulk-actions-bar {
        left: 0;
    }

    .bulk-actions-content {
        flex-wrap: wrap;
        padding: 10px 16px;
    }

    .bulk-actions-content .bulk-buttons {
        flex-wrap: wrap;
    }

    .campaign-stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .ads-manager-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .account-badge {
        order: 3;
        width: 100%;
    }

    .badge-text {
        flex: 1;
    }

    .level-tab {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .campaign-stats-row {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   ADS MANAGER PARITY BODY CLASS
   Kills glass/backdrop effects,
   maximizes Facebook flatness
   ======================================== */

.ads-manager-parity {
    font-family: "Segoe UI", Inter, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Remove any glass/blur effects for parity mode */
.ads-manager-parity .ads-table-container,
.ads-manager-parity .ads-manager-header,
.ads-manager-parity .filter-tabs-bar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.ads-manager-parity .ads-manager-content {
    padding: 10px 20px;
}

/* Inline Budget Editing */
.budget-cell.editable {
    cursor: pointer;
    position: relative;
}

.budget-cell.editable:hover .budget-number {
    color: var(--accent-primary);
    text-decoration: underline;
    text-decoration-style: dashed;
    text-underline-offset: 3px;
}

.budget-cell.editable .budget-edit-icon {
    display: none;
    width: 12px;
    height: 12px;
    color: var(--accent-primary);
    margin-left: 4px;
}

.budget-cell.editable:hover .budget-edit-icon {
    display: inline;
}

.budget-inline-editor {
    display: flex;
    align-items: center;
    gap: 4px;
}

.budget-inline-editor input {
    width: 80px;
    padding: 3px 6px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid var(--accent-primary);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-primary);
    outline: none;
    font-variant-numeric: tabular-nums;
}

.budget-inline-editor .budget-save-btn,
.budget-inline-editor .budget-cancel-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.budget-inline-editor .budget-save-btn {
    background: var(--accent-primary);
    color: #fff;
}

.budget-inline-editor .budget-cancel-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Row hover quick-info tooltip */
.campaign-name-cell .campaign-objective {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 1px;
}

/* ========================================
   LIGHT MODE OVERRIDES  FACEBOOK STYLE
   Facebook light mode colors:
   bg: #f0f2f5  card: #ffffff
   border: #dddfe2  text: #1c1e21
   muted: #65676b   hover: #e4e6eb
   ======================================== */

[data-theme="light"] .ads-manager-header {
    background: #ffffff;
    border-bottom: none;
}

[data-theme="light"] .filter-tabs-bar {
    background: #ffffff;
    border-bottom-color: #dddfe2;
}

[data-theme="light"] .filter-tab {
    color: #65676b;
}

[data-theme="light"] .filter-tab:hover {
    background: #e4e6eb;
    color: #1c1e21;
}

[data-theme="light"] .filter-tab.active {
    background: var(--accent-primary);
    color: #fff;
}

[data-theme="light"] .level-tabs-container {
    border-bottom-color: #dddfe2;
}

[data-theme="light"] .level-tab {
    color: #65676b;
}

[data-theme="light"] .level-tab:hover {
    color: #1c1e21;
}

[data-theme="light"] .level-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

[data-theme="light"] .account-badge,
[data-theme="light"] .opportunity-score,
[data-theme="light"] .btn,
[data-theme="light"] .btn-icon,
[data-theme="light"] .date-range-picker,
[data-theme="light"] .settings-btn {
    background: #ffffff;
    border-color: #dddfe2;
    color: #1c1e21;
}

[data-theme="light"] .account-badge:hover,
[data-theme="light"] .opportunity-score:hover,
[data-theme="light"] .btn:hover,
[data-theme="light"] .btn-icon:hover,
[data-theme="light"] .date-range-picker:hover,
[data-theme="light"] .settings-btn:hover {
    background: #f0f2f5;
}

[data-theme="light"] .btn-primary {
    background: #42b72a;
    border-color: #42b72a;
    color: #fff;
}

[data-theme="light"] .btn-primary:hover {
    background: #36a420;
    border-color: #36a420;
}

[data-theme="light"] .search-bar-wrapper {
    background: transparent;
}

[data-theme="light"] .search-bar-wrapper:focus-within {
    background: transparent;
    box-shadow: none;
}

[data-theme="light"] .search-bar-wrapper input {
    color: #1c1e21;
}

[data-theme="light"] .search-bar-wrapper input::placeholder {
    color: #65676b;
}

[data-theme="light"] .search-dropdown {
    background: #ffffff;
    border-color: #dddfe2;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
}

[data-theme="light"] .search-dropdown-item:hover {
    background: #f0f2f5;
}

[data-theme="light"] .ads-table-container {
    background: #ffffff;
    border-color: #dddfe2;
}

[data-theme="light"] .ads-table thead {
    background: #f0f2f5;
}

[data-theme="light"] .ads-table th {
    color: #65676b;
    border-bottom-color: #dddfe2;
}

[data-theme="light"] .ads-table th:not(:last-child)::after {
    background: #dddfe2;
}

[data-theme="light"] .ads-table th.sortable:hover {
    background: #e4e6eb;
    color: #1c1e21;
}

[data-theme="light"] .ads-table tbody tr {
    border-bottom-color: #e4e6eb;
}

[data-theme="light"] .ads-table tbody tr:hover {
    background: #f0f2f5;
}

[data-theme="light"] .ads-table td {
    color: #1c1e21;
}

[data-theme="light"] .campaign-name-cell .name {
    color: #1c1e21;
}

[data-theme="light"] .campaign-name-cell .campaign-id {
    color: #65676b;
}

[data-theme="light"] .result-number,
[data-theme="light"] .cost-number,
[data-theme="light"] .budget-number {
    color: #1c1e21;
}

[data-theme="light"] .result-label,
[data-theme="light"] .cost-per,
[data-theme="light"] .budget-type {
    color: #65676b;
}

[data-theme="light"] .delivery-status {
    color: #65676b;
}

[data-theme="light"] .delivery-status.active {
    color: #31a24c;
}

[data-theme="light"] .delivery-status.paused {
    color: #65676b;
}

[data-theme="light"] .delivery-status.off {
    color: #8a8d91;
}

[data-theme="light"] .delivery-status.error {
    color: #e4002b;
}

[data-theme="light"] .delivery-status.learning {
    color: var(--accent-primary);
}

[data-theme="light"] .table-footer {
    background: #f0f2f5;
    border-top-color: #dddfe2;
}

[data-theme="light"] .results-count,
[data-theme="light"] .page-info {
    color: #65676b;
}

[data-theme="light"] .pagination-btn {
    background: #ffffff;
    border-color: #dddfe2;
    color: #65676b;
}

[data-theme="light"] .pagination-btn:hover:not(:disabled) {
    background: #e4e6eb;
    color: #1c1e21;
}

[data-theme="light"] .bulk-actions-bar {
    background: #ffffff;
    border-top-color: #dddfe2;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .ads-table .toggle-switch {
    background: #bec3c9;
}

[data-theme="light"] .ads-table .toggle-switch.active {
    background: #0ea5e9;
}

[data-theme="light"] .dropdown-menu {
    background: #ffffff;
    border-color: #dddfe2;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .dropdown-item {
    color: #1c1e21;
}

[data-theme="light"] .dropdown-item:hover {
    background: #f0f2f5;
}

[data-theme="light"] .dropdown-item svg {
    color: #65676b;
}

[data-theme="light"] .row-action-btn {
    color: #65676b;
}

[data-theme="light"] .row-action-btn:hover {
    background: #e4e6eb;
    color: #1c1e21;
}

[data-theme="light"] .badge-text .account-name {
    color: #1c1e21;
}

[data-theme="light"] .badge-text .account-id {
    color: #65676b;
}

[data-theme="light"] .score-text {
    color: #65676b;
}

[data-theme="light"] .level-tab .tab-count {
    background: #e4e6eb;
    color: #65676b;
}

[data-theme="light"] .level-tab.active .tab-count {
    background: rgba(var(--accent-primary-rgb, 59, 130, 246), 0.15);
    color: var(--accent-primary);
}

[data-theme="light"] .numeric-value.na {
    color: #bec3c9;
}

[data-theme="light"] .column-filter-btn {
    color: #bec3c9;
}

[data-theme="light"] .column-filter-btn:hover {
    color: #1c1e21;
    background: #e4e6eb;
}

/* Stats cards - light mode */
[data-theme="light"] .stat-card {
    background: #ffffff;
    border-color: #e4e6eb;
}

[data-theme="light"] .stat-card:hover {
    border-color: #bec3c9;
}

[data-theme="light"] .stat-value {
    color: #1c1e21;
}

[data-theme="light"] .stat-label {
    color: #65676b;
}

/* Light mode: header icons borderless */
[data-theme="light"] .ads-manager-header .btn-icon {
    background: transparent;
    border: none;
    color: #65676b;
}

[data-theme="light"] .ads-manager-header .btn-icon:hover {
    background: #e4e6eb;
    color: #1c1e21;
}

/* Light mode: action divider */
[data-theme="light"] .action-buttons-left::after {
    background: #dddfe2;
}

/* Light mode: delivery completed */
[data-theme="light"] .delivery-status.completed {
    color: #8a8d91;
}

[data-theme="light"] .ads-table-container {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* ========================================
   ADDITIONAL REFINEMENTS
   ======================================== */

/* Refresh spin animation */
#refreshBtn.spin svg {
    animation: spin 0.8s linear infinite;
}

/* Last update text */
.last-update {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Active filter tab count */
.filter-tab .filter-count {
    font-size: 0.68rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
    font-weight: 700;
}

.filter-tab.active .filter-count {
    background: rgba(255, 255, 255, 0.25);
}

/* Toggle switch compact */
.ads-table .toggle-switch {
    width: 34px;
    height: 18px;
}

.ads-table .toggle-switch::after {
    width: 14px;
    height: 14px;
    top: 2px;
    left: 2px;
}

.ads-table .toggle-switch.active::after {
    transform: translateX(14px);
}

/* Row actions: show on row hover, hide normally */
.row-action-btn {
    width: 24px;
    height: 24px;
}

/* Content area spacing */
.ads-manager-content {
    padding: 10px 20px;
}

/* Search bar compact */
.search-filter-row {
    margin-bottom: 8px;
}

/* Level tabs compact */
.level-tabs-container {
    margin-bottom: 8px;
}

/* Action buttons compact */
.action-buttons-row {
    margin-bottom: 8px;
}

/* Table container refined */
.ads-table-container {
    border-radius: 6px;
}

/* Review and publish button */
#reviewPublishBtn {
    font-size: 0.78rem;
    height: 30px;
    padding: 4px 12px;
}

[data-theme="light"] .last-update {
    color: #65676b;
}

[data-theme="light"] .budget-inline-editor input {
    background: #ffffff;
    border-color: var(--accent-primary);
    color: #1c1e21;
}

[data-theme="light"] .budget-cell.editable:hover .budget-number {
    color: var(--accent-primary);
}

/* ===================== */
/* Totals Summary Row    */
/* ===================== */
.totals-row {
    position: sticky;
    bottom: 0;
    background: color-mix(in srgb, var(--bg-primary) 97%, var(--accent-primary) 3%);
    border-top: 2px solid var(--border-color);
    font-weight: 600;
    z-index: 2;
}

.totals-row td {
    padding: 10px 12px;
    font-size: 0.82rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.totals-row td:first-child {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===================== */
/* Campaign Name Row     */
/* ===================== */
.campaign-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.campaign-link {
    color: #1877f2 !important;
    cursor: pointer;
}

.campaign-link:hover {
    text-decoration: underline;
}

/* ===================== */
/* Table Density Modes   */
/* ===================== */
.ads-table.density-compact td { padding: 4px 10px; font-size: 0.78rem; }
.ads-table.density-compact th { padding: 5px 10px; }

/* ===================== */
/* Feature #1: Objective Icon */
/* ===================== */
.objective-icon {
    font-size: 0.85rem;
    margin-right: 6px;
    flex-shrink: 0;
}

/* ===================== */
/* Feature #2: Delivery Insights Tooltip */
/* ===================== */
.delivery-insights-trigger {
    position: relative;
}
.delivery-insights-popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 12px;
    min-width: 220px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-size: 0.8rem;
}
.delivery-insights-trigger:hover .delivery-insights-popup {
    display: block;
}
.di-title {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.03em;
}
.di-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}
.di-label {
    color: var(--text-muted);
}
.di-value {
    font-weight: 500;
    color: var(--text-primary);
}
.di-learning {
    margin-top: 8px;
    padding: 6px 8px;
    background: rgba(255, 193, 7, 0.1);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--warning);
}

/* ===================== */
/* Feature #3: Frequency Column */
/* ===================== */
.col-frequency {
    min-width: 80px;
    text-align: right;
}
th.col-frequency {
    white-space: nowrap;
}

/* ===================== */
/* Feature #4: Audience Size Indicator */
/* ===================== */
.audience-gauge {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}
.audience-bar {
    width: 60px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}
.audience-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}
.audience-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ===================== */
/* Feature #5: Placement Summary */
/* ===================== */
.placement-summary {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* ===================== */
/* Feature #6: Ad Preview Tabs */
/* ===================== */
.preview-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-primary);
    padding: 0 20px;
}
.preview-tab {
    padding: 10px 16px;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.preview-tab:hover {
    color: var(--text-primary);
}
.preview-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.preview-media {
    max-width: 100%;
    max-height: 350px;
    border-radius: 4px;
    object-fit: contain;
    background: #000;
}
.preview-no-media {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 8px;
    color: var(--text-muted);
}

/* Facebook preview */
.fb-preview-card {
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    overflow: hidden;
}
.fb-preview-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
}
.fb-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
}
.fb-page-name {
    font-weight: 600;
    font-size: 0.85rem;
}
.fb-sponsored {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.fb-body {
    padding: 0 12px 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.fb-media {
    text-align: center;
    background: #000;
}
.fb-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-tertiary);
}
.fb-headline {
    font-weight: 600;
    font-size: 0.85rem;
}
.fb-cta {
    padding: 6px 16px;
    border-radius: 4px;
    background: var(--bg-hover);
    border: 1px solid var(--border-primary);
    font-size: 0.8rem;
    cursor: default;
    color: var(--text-primary);
}

/* Instagram preview */
.ig-preview-card {
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    overflow: hidden;
}
.ig-preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
}
.ig-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}
.ig-username {
    font-weight: 600;
    font-size: 0.82rem;
    flex: 1;
}
.ig-dot {
    color: var(--text-muted);
}
.ig-media {
    text-align: center;
    background: #000;
}
.ig-media .preview-media {
    border-radius: 0;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}
.ig-actions {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
}
.ig-actions svg {
    color: var(--text-primary);
    cursor: default;
}
.ig-caption {
    padding: 0 12px 10px;
    font-size: 0.82rem;
}

/* Stories preview */
.stories-preview-card {
    position: relative;
    width: 240px;
    height: 420px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    margin: 0 auto;
}
.stories-media {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.stories-media .preview-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}
.stories-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px;
    pointer-events: none;
}
.stories-header {
    display: flex;
    align-items: center;
    gap: 8px;
}
.stories-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
}
.stories-name {
    color: white;
    font-size: 0.82rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.stories-cta {
    text-align: center;
}
.stories-cta-btn {
    padding: 8px 20px;
    border-radius: 20px;
    background: white;
    color: #000;
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    cursor: default;
}

/* ===================== */
/* Feature #7: Comparison Toggle */
/* ===================== */
.date-compare-toggle {
    margin-bottom: 8px;
}
.compare-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    cursor: pointer;
    color: var(--text-secondary);
}
.compare-label input {
    cursor: pointer;
}
.date-action-btns {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.delta-indicator {
    display: inline;
    white-space: nowrap;
}

/* ===================== */
/* Feature #8: Campaign Tags */
/* ===================== */
.campaign-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
    align-items: center;
}
.campaign-tag-pill {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.68rem;
    color: white;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}
.campaign-tag-add {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px dashed var(--text-muted);
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}
.campaign-tag-add:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.campaign-tag-add-empty {
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}
.campaign-name-cell:hover .campaign-tag-add-empty {
    opacity: 0.5;
}
.campaign-tag-add-empty:hover {
    opacity: 1 !important;
}
.tag-color-opt {
    display: inline-block;
    transition: transform 0.15s;
}
.tag-color-opt:hover {
    transform: scale(1.2);
}
.tag-color-opt.selected {
    box-shadow: 0 0 0 2px var(--bg-primary);
}

/* ===================== */
/* Feature #9: Activity History */
/* ===================== */
.history-timeline {
    position: relative;
    padding-left: 20px;
}
.history-timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--border-primary);
}
.history-entry {
    position: relative;
    padding-bottom: 16px;
}
.history-dot {
    position: absolute;
    left: -20px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg-secondary);
}
.history-action {
    font-weight: 500;
    font-size: 0.85rem;
}
.history-detail {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.history-time {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* ===================== */
/* Feature #10: Rules styling */
/* ===================== */
.rule-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    margin-bottom: 8px;
}
.rule-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.rule-item-name {
    font-weight: 500;
    font-size: 0.85rem;
}
.rule-item-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.ads-table.density-comfortable td { padding: 12px 10px; }
.ads-table.density-comfortable th { padding: 10px 10px; }

/* ===================== */
/* Status Badges         */
/* ===================== */
.campaign-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.5;
    white-space: nowrap;
}

.badge-review {
    background: color-mix(in srgb, #f0ad4e 15%, transparent);
    color: #f0ad4e;
}

.badge-error {
    background: color-mix(in srgb, #e4002b 15%, transparent);
    color: #e4002b;
}

.badge-draft {
    background: color-mix(in srgb, var(--text-muted) 15%, transparent);
    color: var(--text-muted);
}

/* ===================== */
/* Objective Icon        */
/* ===================== */
.obj-icon {
    font-size: 0.9rem;
    margin-right: 2px;
    vertical-align: middle;
    opacity: 0.85;
}

/* ===================== */
/* Copy Campaign ID      */
/* ===================== */
.campaign-id {
    cursor: pointer;
    transition: color 0.15s;
}

.campaign-id:hover {
    color: var(--accent-primary);
    text-decoration: underline;
}

/* ===================== */
/* Delivery Status Extras */
/* ===================== */
.delivery-status.learning-limited .delivery-dot {
    background: #f0ad4e;
    animation: pulse 2s ease-in-out infinite;
}

.delivery-status.learning-limited {
    color: #f0ad4e;
}

.delivery-status.in-review .delivery-dot {
    background: #f0ad4e;
}

.delivery-status.in-review {
    color: #f0ad4e;
}

.delivery-status.archived .delivery-dot {
    background: var(--text-muted);
}

.delivery-status.archived {
    color: var(--text-muted);
}

/* ===================== */
/* Notification Badge    */
/* ===================== */
.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #e4002b;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ===================== */
/* Automated Rules       */
/* ===================== */
.rule-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background 0.15s;
}

.rule-item:hover {
    background: color-mix(in srgb, var(--bg-secondary) 90%, var(--accent-primary) 10%);
}

.rule-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.rule-item-info {
    flex: 1;
    min-width: 0;
}

.rule-item-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.rule-item-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Toggle switch for rules */
.toggle-switch {
    width: 36px;
    height: 20px;
    background: var(--border-color);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}

.toggle-switch.active {
    background: var(--accent-primary);
}

.toggle-switch.active::after {
    transform: translateX(16px);
}

/* ===================== */
/* Light theme overrides */
/* ===================== */
[data-theme="light"] .totals-row {
    background: color-mix(in srgb, #ffffff 97%, var(--accent-primary) 3%);
}

[data-theme="light"] .delivery-status.learning-limited {
    color: #e68900;
}

[data-theme="light"] .delivery-status.in-review {
    color: #e68900;
}

[data-theme="light"] .rule-item {
    background: #f5f6f7;
    border-color: #dddfe2;
}

[data-theme="light"] .rule-item:hover {
    background: #eef0f2;
}

[data-theme="light"] .toggle-switch {
    background: #dddfe2;
}

/* =====================
   Inline Name Editor
   ===================== */
.inline-name-input {
    width: 100%;
    padding: 2px 6px;
    border: 1px solid var(--primary);
    border-radius: 4px;
    font-size: inherit;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.2);
}

/* =====================
   Budget Inline Editor
   ===================== */
.budget-inline-editor {
    display: flex;
    align-items: center;
    gap: 4px;
}

.budget-inline-editor input {
    width: 80px;
    padding: 3px 6px;
    border: 1px solid var(--primary);
    border-radius: 4px;
    font-size: 0.82rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.2);
}

.budget-inline-editor input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.budget-save-btn,
.budget-cancel-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    line-height: 1;
}

.budget-save-btn {
    background: var(--primary);
    color: white;
}

.budget-save-btn:hover {
    background: var(--primary-hover);
}

.budget-cancel-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

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

/* Editable budget cell cursor */
td.editable {
    cursor: pointer;
}

td.editable:hover {
    background: rgba(24, 119, 242, 0.06);
}

/* =====================
   Ad Relevance Rankings
   ===================== */
.ranking-above {
    color: #31a24c;
}

.ranking-average {
    color: var(--text-primary);
}

.ranking-below {
    color: #e4002b;
}

.ranking-unknown {
    color: var(--text-muted);
}

/* =====================
   Column Drag Reorder
   ===================== */
th[draggable="true"] {
    cursor: grab;
    user-select: none;
    transition: opacity 0.15s;
}

th[draggable="true"]:active {
    cursor: grabbing;
}

th.drag-over-left {
    box-shadow: inset 3px 0 0 0 var(--primary);
}

th.drag-over-right {
    box-shadow: inset -3px 0 0 0 var(--primary);
}

/* =====================
   Targeting Tooltip
   ===================== */
.targeting-tooltip {
    position: absolute;
    z-index: 1000;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    max-width: 280px;
    white-space: normal;
    pointer-events: none;
}

.targeting-tooltip strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* =====================
   Breakdown Sub-rows
   ===================== */
.breakdown-subrow td {
    padding-top: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.breakdown-subrow:hover td {
    background: rgba(24, 119, 242, 0.04);
}

/* =====================
   A/B Test Variable Options
   ===================== */
.ab-variable-option {
    transition: border-color 0.15s, background 0.15s;
}

.ab-variable-option:hover {
    background: var(--bg-tertiary);
}

.ab-variable-option input[type="radio"] {
    accent-color: var(--primary);
}
