/* ============================================================================
   صفحة الحملات الإعلانية — مطابقة تامة لصفحة الطلبات (orders-cards.css)
   البادئة .ac-* معزولة (Ac = Advertising Campaign) عن .oc-* (Orders Cards).
   لون «الهوية» لكل بطاقة هو المنصة (--ac-band) بدل حالة الطلب. بقية التوكنز
   والبنية والشريط (.ot-*) مطابقة لصفحة الطلبات كي تبدو الصفحتان منتجاً واحداً.
   ============================================================================ */

/* ===== الشبكة: مطابقة لـ .oc-grid ===== */
.ac-grid {
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 14px;
}

/* ===== البطاقة (مرآة .oc-card) ===== */
.ac-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface-solid);
    border: none;
    --ac-r-big: 40px;
    --ac-r: 16px;
    border-start-end-radius: var(--ac-r-big);
    border-start-start-radius: var(--ac-r);
    border-end-start-radius: var(--ac-r);
    border-end-end-radius: var(--ac-r);
    padding: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: box-shadow 0.22s ease;
}
.ac-card:hover {
    box-shadow:
        var(--shadow-lg),
        0 0 0 1px color-mix(in srgb, var(--ac-band, var(--primary)) 32%, transparent),
        0 18px 40px -14px color-mix(in srgb, var(--ac-band, var(--primary)) 48%, transparent);
}
.clickable-ac-card {
    cursor: pointer;
    user-select: none;
}
.clickable-ac-card:hover {
    box-shadow:
        var(--shadow-lg),
        0 0 0 1px color-mix(in srgb, var(--ac-band, var(--primary)) 32%, transparent),
        0 18px 40px -14px color-mix(in srgb, var(--ac-band, var(--primary)) 48%, transparent);
    transform: none;
}
.clickable-ac-card:active {
    transform: none;
}

/* هوية المنصة: chip المنصة وهالة hover تستخدمان --ac-band. ألوان مشبعة قابلة
   للقراءة فوق --surface-solid، ومرافقة خفيفة --ac-band-bg للرقاقة. */
.ac-card[data-platform='Facebook'] {
    --ac-band: #1877f2;
    --ac-band-bg: var(--platform-facebook-bg);
}
.ac-card[data-platform='Instagram'] {
    --ac-band: #e1306c;
    --ac-band-bg: var(--platform-instagram-bg);
}
.ac-card[data-platform='Website'] {
    --ac-band: #16a34a;
    --ac-band-bg: var(--platform-website-bg);
}
.ac-card[data-platform='Tiktok'] {
    --ac-band: #6d28d9;
    --ac-band-bg: var(--platform-tiktok-bg);
}
.ac-card[data-platform='Other'] {
    --ac-band: #4f46e5;
    --ac-band-bg: var(--platform-other-bg);
}

/* ===== الرأس: اسم الحملة + تاريخ + chip المنصة ===== */
.ac-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-inline-start: 10px;
}
.ac-id {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-title);
    letter-spacing: -0.01em;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ac-id-meta {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
}
.ac-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-inline-start: auto;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 999px;
    color: var(--text-title);
    background: color-mix(in srgb, var(--ac-band, var(--primary)) 24%, var(--surface-solid));
    white-space: nowrap;
}
.ac-chip::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ac-band, var(--primary));
}
.ac-top .ac-chip {
    padding: 4px 9px;
    font-size: 11px;
    gap: 5px;
}
.ac-top .ac-chip::before {
    width: 5px;
    height: 5px;
}
/* modifiers المنصة للرقاقة (خارج سياق البطاقة، مثل الجدول) */
.ac-chip.s-Facebook {
    --ac-band: #1877f2;
}
.ac-chip.s-Instagram {
    --ac-band: #e1306c;
}
.ac-chip.s-Website {
    --ac-band: #16a34a;
}
.ac-chip.s-Tiktok {
    --ac-band: #6d28d9;
}
.ac-chip.s-Other {
    --ac-band: #4f46e5;
}

/* ===== سطر الربحية (مرآة .oc-name) ===== */
.ac-name {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 10px;
    padding-inline-start: 10px;
}
.ac-profit-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: 11.5px;
    font-weight: 700;
    border-radius: 999px;
    line-height: 1;
}
.ac-profit-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.ac-profit-badge.is-profit {
    color: var(--ready-text, var(--success));
    background: var(--ready-bg, var(--success-bg));
}
.ac-profit-badge.is-profit::before {
    background: var(--ready-text, var(--success));
}
.ac-profit-badge.is-loss {
    color: var(--danger);
    background: var(--danger-bg);
}
.ac-profit-badge.is-loss::before {
    background: var(--danger);
}

/* ===== صفوف المعلومات (مرآة .oc-rows / .oc-row) ===== */
.ac-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
    padding-inline-start: 10px;
}
.ac-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-main);
    min-width: 0;
}
.ac-row .ico {
    width: 14px;
    flex-shrink: 0;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}
.ac-row .ico svg {
    width: 14px;
    height: 14px;
}
.ac-row .value {
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ac-row .value.num {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.ac-row .value.muted {
    color: var(--text-secondary);
}
.ac-row .cur {
    color: var(--text-muted);
    font-size: 10px;
    margin-inline-start: 1px;
}
.ac-sep {
    color: var(--text-muted);
    margin: 0 1px;
    font-size: 10px;
}
.ac-date-range {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* ===== الملاحظات (مرآة .oc-notes) ===== */
.ac-notes {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: 8px 0 2px 10px;
    padding: 8px 10px;
    background: var(--surface-hover);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 11.5px;
    color: var(--text-main);
    line-height: 1.5;
}
.ac-notes .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 5px;
    flex-shrink: 0;
}

/* ===== التذييل: صافي الربح + زر التعديل (مرآة .oc-foot) ===== */
.ac-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-main);
}
.ac-total-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ac-total-label {
    font-size: 10.5px;
    color: var(--text-muted);
    font-weight: 600;
}
.ac-total-val {
    font-family: var(--app-font-family);
    font-size: 24px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
    line-height: 1;
}
.ac-total-val.is-profit {
    color: var(--ready-text, var(--success));
}
.ac-total-val.is-loss {
    color: var(--danger);
}
.ac-total-val .cur {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    margin-inline-start: 2px;
}
.ac-actions {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

/* ============================================================================
   عرض القائمة (الجدول) — مطابق لصفحة الطلبات: شريط منصة بارز + رأس مكتوب
   بأحرف متباعدة + فواصل رفيعة + أرقام tabular + hover ناعم. محصور بـ #advertisingPage.
   ============================================================================ */
#advertisingPage .ads-list {
    border-radius: var(--pane-radius);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    background: var(--surface-solid);
}
#advertisingPage .ads-list table {
    table-layout: fixed;
    width: 100%;
    min-width: 640px;
}
#advertisingPage .ads-list thead th {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-title);
    background: var(--table-header-bg);
    padding: var(--table-header-padding);
    border-bottom: 1px solid var(--table-header-border);
}
#advertisingPage .ads-list tbody td {
    padding: var(--table-cell-padding);
    font-size: 13.5px;
    border-bottom: 1px solid var(--table-row-border);
    color: var(--table-row-text, var(--text-main));
    vertical-align: middle;
}
#advertisingPage .ads-list tbody tr {
    border-bottom: none;
}
#advertisingPage .ads-list tbody tr:nth-child(even) {
    background: var(--table-row-alt-bg, transparent);
}
#advertisingPage .ads-list tbody tr:hover {
    background: var(--table-row-hover-bg);
}

/* خلية اسم الحملة */
#advertisingPage .ads-list .ac-name-cell {
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    color: var(--text-title);
    padding-inline-start: 16px;
}
#advertisingPage .ads-list .ac-id-wrap {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}
#advertisingPage .ads-list .ac-id-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
/* شريط المنصة المدمج بجوار اسم الحملة (مرآة .oc-band) */
.ac-band {
    display: inline-block;
    width: 4px;
    height: 18px;
    border-radius: 2px;
    flex-shrink: 0;
    background: var(--primary);
}
.ac-band.s-Facebook {
    background: #1877f2;
}
.ac-band.s-Instagram {
    background: #e1306c;
}
.ac-band.s-Website {
    background: #16a34a;
}
.ac-band.s-Tiktok {
    background: #6d28d9;
}
.ac-band.s-Other {
    background: #4f46e5;
}

/* خلية المنصة */
#advertisingPage .ads-list .platform-cell {
    white-space: nowrap;
}
#advertisingPage .ads-list .platform-cell .ac-chip {
    margin-inline-start: 0;
    font-weight: 700;
    font-size: 11px;
    gap: 5px;
    padding: 4px 9px;
    background: color-mix(in srgb, var(--ac-band, var(--primary)) 28%, var(--surface-solid));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ac-band, var(--primary)) 32%, transparent);
}
#advertisingPage .ads-list .platform-cell .ac-chip::before {
    width: 5px;
    height: 5px;
}

/* خلايا الأرقام */
#advertisingPage .ads-list .price-cell,
#advertisingPage .ads-list .profit-cell {
    font-weight: 700;
    color: var(--text-title);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
#advertisingPage .ads-list .profit-cell.is-profit {
    color: var(--ready-text, var(--success));
}
#advertisingPage .ads-list .profit-cell.is-loss {
    color: var(--danger);
}
#advertisingPage .ads-list .num-cell {
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    white-space: nowrap;
}
#advertisingPage .ads-list .notes-cell {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 12px;
}

/* ===== الصفوف القابلة للتوسيع (design-5، مرآة .ot-main / .ot-detail) ===== */
#advertisingPage .ads-list .ac-main {
    cursor: pointer;
}
#advertisingPage .ads-list .ot-toggle-th[aria-label='توسيع'] {
    width: 48px;
}
.ot-toggle-cell {
    width: 48px;
}
.ot-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        transform 0.2s ease,
        color 0.15s ease;
}
.ot-toggle:hover {
    background: var(--surface-hover);
    color: var(--text-title);
}
.ot-toggle.is-open {
    transform: rotate(90deg);
    color: var(--primary);
}
.ot-detail {
    display: none;
}
.ot-detail.is-open {
    display: table-row;
}
.ot-detail > td {
    padding: 0 !important;
    border-bottom: 1px solid var(--table-row-border) !important;
}
.ac-detail-inner {
    padding: 16px 18px;
    background: var(--table-row-alt-bg, var(--surface-hover));
}
.ac-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px 18px;
    margin-bottom: 14px;
}
.ac-dt-item {
    min-width: 0;
}
.ac-dt-lbl {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}
.ac-dt-val {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-title);
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.ac-dt-val .cur {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}
.ac-dt-val.is-profit {
    color: var(--ready-text, var(--success));
}
.ac-dt-val.is-loss {
    color: var(--danger);
}
.ac-dt-sub {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}
.ac-dt-item--note {
    grid-column: 1 / -1;
}
.ac-dt-item--note .ac-dt-val {
    font-weight: 500;
    color: var(--text-main);
    line-height: 1.6;
    padding: 8px 10px;
    background: var(--surface-hover);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}
.ac-detail-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

/* ============================================================================
   شريط الأدوات v2 — مطابق لصفحة الطلبات. القواعد العامة (.ot-view-menu /
   .ot-view-item / ...) غير مقيّدة بصفحة في orders-cards.css فتعمل هنا مباشرة؛
   نعيد تقييد عناصر الزناد تحت #advertisingPage فقط.
   ============================================================================ */
#advertisingPage .ads-toolbar-v2 {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
}
#advertisingPage .ot-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* --- حقل البحث الذكي (Dock) --- */
#advertisingPage .ot-search {
    flex: 1 1 320px;
    min-width: 280px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 42px;
    padding: 0 12px 0 14px;
    background: color-mix(in srgb, var(--bg-main) 70%, var(--surface-solid));
    border: 1px solid var(--border-main);
    border-radius: 10px;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background-color 0.15s ease;
}
#advertisingPage .ot-search:hover,
#advertisingPage .ot-search:focus-within {
    background: color-mix(in srgb, var(--bg-main) 70%, var(--surface-solid));
    border-color: var(--border-main);
}
#advertisingPage .ot-search-icon {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    flex: 0 0 18px;
}
#advertisingPage .ot-search input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 14px;
    color: var(--text-title);
    padding: 0;
}
#advertisingPage .ot-search input::placeholder {
    color: var(--text-secondary);
}

/* Dock مطوي/موسّع — مطابق لصفحة الطلبات */
#advertisingPage .ot-search[data-collapsed='true'] {
    flex: 0 0 42px;
    min-width: 42px;
    width: 42px;
    padding: 0;
    gap: 0;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    border-radius: 999px;
    transition:
        flex-basis 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        min-width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        padding 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        border-radius 0.25s ease,
        background-color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}
#advertisingPage .ot-search[data-collapsed='true']:hover {
    background: color-mix(in srgb, var(--bg-main) 70%, var(--surface-solid));
    border-color: var(--border-main);
    color: var(--text-title);
}
#advertisingPage .ot-search .ot-search-trigger {
    appearance: none;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: inherit;
    border-radius: 6px;
    transition: opacity 0.2s ease;
}
#advertisingPage .ot-search[data-collapsed='false'] .ot-search-trigger {
    pointer-events: none;
}
#advertisingPage .ot-search[data-collapsed='true'] #adsSearchInput {
    width: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
}
#advertisingPage .ot-search[data-collapsed='false'] {
    flex: 0 0 300px;
    min-width: 260px;
    max-width: 360px;
    width: auto;
    padding: 0 16px 0 18px;
    justify-content: flex-start;
    cursor: text;
    border-radius: 999px;
    transition:
        flex-basis 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        min-width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        padding 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
        border-radius 0.25s ease,
        background-color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}
#advertisingPage .ot-search[data-collapsed='false'] #adsSearchInput {
    width: auto;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.25s ease 0.1s;
}
#advertisingPage .ot-search .ot-search-icon {
    transition: transform 0.25s ease;
}
#advertisingPage .ot-search .ot-search-clear {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    width: 26px;
    height: 26px;
    border-radius: 999px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 26px;
    padding: 0;
    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}
#advertisingPage .ot-search .ot-search-clear svg {
    width: 14px;
    height: 14px;
}
#advertisingPage .ot-search .ot-search-clear:hover {
    background: color-mix(in srgb, var(--text-title) 8%, transparent);
    color: var(--text-title);
}
#advertisingPage .ot-search .ot-search-clear:active {
    transform: scale(0.92);
}
#advertisingPage .ot-search[data-collapsed='false'] .ot-search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
}
#advertisingPage .ot-search[data-collapsed='false'] .ot-search-clear.is-visible {
    display: inline-flex;
}
@media (prefers-reduced-motion: reduce) {
    #advertisingPage .ot-search,
    #advertisingPage .ot-search[data-collapsed='true'],
    #advertisingPage .ot-search[data-collapsed='false'],
    #advertisingPage .ot-search .ot-search-icon,
    #advertisingPage .ot-search #adsSearchInput {
        transition: none !important;
    }
}

/* --- زر الفلاتر + الزر العام --- */
#advertisingPage .ot-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--border-main);
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-main) 70%, var(--surface-solid));
    color: var(--text-title);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease;
    white-space: nowrap;
}
#advertisingPage .ot-btn:hover {
    background: var(--surface-hover);
    border-color: color-mix(in srgb, var(--primary) 38%, var(--border-main));
}
#advertisingPage .ot-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
#advertisingPage .ot-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    flex: 0 0 16px;
}
#advertisingPage .ot-btn[aria-expanded='true'] {
    background: color-mix(in srgb, var(--primary) 10%, var(--surface-main));
    border-color: color-mix(in srgb, var(--primary) 38%, var(--border-main));
    color: var(--primary);
}
#advertisingPage .ot-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    font-family: var(--app-mono-family);
}
#advertisingPage .ot-btn-filter {
    width: 42px;
    padding: 0;
    flex: 0 0 42px;
    justify-content: center;
    border-radius: 999px;
    position: relative;
}
#advertisingPage .ot-btn-filter:hover {
    background: color-mix(in srgb, var(--bg-main) 70%, var(--surface-solid));
    border-color: var(--border-main);
    color: var(--text-title);
}
#advertisingPage .ot-btn-filter .ot-badge {
    position: absolute;
    top: -5px;
    inset-inline-start: -5px;
}

/* --- قائمة العرض (Dropdown trigger) --- */
#advertisingPage .ot-view-wrap {
    position: relative;
}
#advertisingPage .ot-view-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 42px;
    padding: 0 12px;
    min-width: 168px;
    background: color-mix(in srgb, var(--bg-main) 70%, var(--surface-solid));
    border: 1px solid var(--border-main);
    border-radius: 999px;
    color: var(--text-title);
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}
#advertisingPage .ot-view-trigger:hover {
    border-color: color-mix(in srgb, var(--primary) 38%, var(--border-main));
}
#advertisingPage .ot-view-trigger[aria-expanded='true'] {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
#advertisingPage .ot-view-trigger:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
#advertisingPage .ot-view-left {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
#advertisingPage .ot-view-left svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    stroke-width: 2;
    flex: 0 0 16px;
}
/* زر طريقة العرض الأيقوني فقط (#adsViewTrigger) */
#advertisingPage #adsViewTrigger {
    justify-content: center;
    gap: 0;
    width: 42px;
    min-width: 0;
    padding: 0;
    flex: 0 0 42px;
    border-radius: 999px;
}
#advertisingPage #adsViewTrigger .ot-view-left {
    justify-content: center;
    gap: 0;
}
#advertisingPage #adsViewTrigger .ot-view-left svg {
    color: inherit;
}
#advertisingPage #adsViewTrigger:hover {
    background: var(--surface-hover);
}
#advertisingPage #adsViewTrigger[aria-expanded='true'] {
    background: color-mix(in srgb, var(--primary) 10%, var(--surface-main));
    border-color: color-mix(in srgb, var(--primary) 38%, var(--border-main));
    color: var(--primary);
    box-shadow: none;
}

/* --- قائمة الأعمدة (إظهار/إخفاء) --- */
#advertisingPage .ot-col-wrap {
    position: relative;
}
#advertisingPage .ot-col-menu .ot-col-item {
    gap: 9px;
}
#advertisingPage .ot-col-menu .ot-col-box {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 1.5px solid var(--border-main, #d4d4d4);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-solid, #fff);
    color: #fff;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}
#advertisingPage .ot-col-menu .ot-col-item.active .ot-col-box {
    background: var(--primary, #6b5dd3);
    border-color: var(--primary, #6b5dd3);
}
#advertisingPage .ot-col-menu .ot-col-box svg {
    width: 12px;
    height: 12px;
}
#advertisingPage .ot-col-menu .ot-col-label {
    flex: 1 1 auto;
}

/* --- الفلاتر النشطة كـ chips --- */
#advertisingPage .ot-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
#advertisingPage .ot-chips[hidden] {
    display: none;
}
.ot-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px 5px 10px;
    background: var(--surface-solid);
    border: 1px solid var(--border-main);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-title);
    box-shadow: var(--shadow-xs, 0 1px 2px rgba(0, 0, 0, 0.04));
}
.ot-chip-ico {
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
    flex: 0 0 14px;
}
.ot-chip-label {
    color: var(--text-secondary);
    font-weight: 600;
}
.ot-chip-op {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--surface-hover);
    color: var(--text-secondary);
    font-size: 10.5px;
    font-weight: 700;
    cursor: pointer;
}
.ot-chip-op svg {
    width: 10px;
    height: 10px;
}
.ot-chip-val {
    font-weight: 700;
    color: var(--text-title);
}
.ot-chip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}
.ot-chip-x:hover {
    background: var(--danger-bg);
    color: var(--danger);
}
.ot-chip-x svg {
    width: 12px;
    height: 12px;
}

/* --- الكثافة --- */
#advertisingPage .ads-grid.ot-density-compact .ac-card {
    padding: 11px 14px 10px;
}
#advertisingPage .ads-list.ot-density-compact tbody td {
    padding: 8px 14px;
}
#advertisingPage .ads-list.ot-density-compact thead th {
    padding: 8px 14px;
}

/* ============================================================================
   popover الفلاتر (نمط shadcn) — قائمة أوامر قابلة للبحث + منظر قيم.
   مشابه لـ .otf-popover في صفحة الطلبات لكن ببادئة .acf- مستقلة.
   ============================================================================ */
.acf-popover {
    position: fixed;
    width: 320px;
    max-width: calc(100vw - 16px);
    max-height: 420px;
    display: flex;
    flex-direction: column;
    background: var(--surface-solid, #fff);
    border: 1px solid var(--border-main);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: var(--z-popover);
    overflow: hidden;
    animation: acf-in 0.12s ease-out;
}
.acf-popover[hidden] {
    display: none;
}
@keyframes acf-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.acf-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
}
.acf-search svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    flex: 0 0 16px;
}
.acf-search input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 13.5px;
    color: var(--text-title);
    padding: 0;
}
.acf-search input::placeholder {
    color: var(--text-secondary);
}
.acf-list {
    overflow-y: auto;
    padding: 6px;
    flex: 1;
}
.acf-group-label {
    padding: 8px 10px 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.acf-cmd {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--text-title);
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-align: start;
    transition: background-color 0.12s ease;
}
.acf-cmd:hover {
    background: var(--surface-hover);
}
.acf-cmd-ico {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    flex: 0 0 16px;
}
.acf-cmd-label {
    flex: 1;
}
.acf-cmd-chev {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}
.acf-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}
.acf-back:hover {
    color: var(--text-title);
}
.acf-value-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px 10px;
    border-bottom: 1px solid var(--border-light);
}
.acf-value-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-title);
}
.acf-options {
    padding: 6px;
    overflow-y: auto;
    flex: 1;
}
.acf-opt {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--text-title);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    text-align: start;
    transition: background-color 0.12s ease;
}
.acf-opt:hover {
    background: var(--surface-hover);
}
.acf-opt-box {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 1.5px solid var(--border-main, #d4d4d4);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-solid, #fff);
    color: #fff;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}
.acf-opt.active .acf-opt-box {
    background: var(--primary, #6b5dd3);
    border-color: var(--primary, #6b5dd3);
}
.acf-opt-box svg {
    width: 12px;
    height: 12px;
}
.acf-opt-label {
    flex: 1;
}
.acf-range {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.acf-range-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.acf-range-row label {
    font-size: 12px;
    color: var(--text-secondary);
    width: 36px;
    flex-shrink: 0;
}
.acf-range-row input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border-main);
    border-radius: 8px;
    background: var(--surface-solid);
    color: var(--text-title);
    font: inherit;
    font-size: 13px;
    outline: none;
}
.acf-range-row input:focus {
    border-color: var(--primary);
}
.acf-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--border-light);
}
.acf-reset {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
}
.acf-reset:hover {
    background: var(--surface-hover);
    color: var(--text-title);
}
.acf-done {
    border: none;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    padding: 7px 16px;
    border-radius: 999px;
}
.acf-done:hover {
    background: var(--primary-hover);
}

/* ============================================================================
   الجوال — مطابق لصفحة الطلبات
   ============================================================================ */
@media (max-width: 768px) {
    .ac-grid {
        gap: 10px;
    }
    .ac-card {
        padding: 12px;
        --ac-r-big: 30px;
        --ac-r: 14px;
    }
    .ac-id {
        font-size: 13px;
    }
    .ac-foot {
        flex-wrap: nowrap;
        gap: 10px;
        margin-top: 10px;
        padding-top: 10px;
    }
    .ac-total-block {
        min-width: 0;
        flex: 1 1 auto;
    }
    .ac-total-val {
        white-space: nowrap;
    }
    .ac-actions {
        flex: 0 0 auto;
    }
    #advertisingPage .ads-toolbar-v2 {
        gap: 8px;
    }
    /* إخفاء أعمدة ثانوية على الجوال */
    #advertisingPage .ads-list .col-startDate,
    #advertisingPage .ads-list .col-endDate,
    #advertisingPage .ads-list .col-notes,
    #advertisingPage .ads-list .col-actions {
        display: none;
    }
}
@media (max-width: 420px) {
    .ac-card {
        padding: 10px;
        --ac-r-big: 24px;
        --ac-r: 12px;
    }
    #advertisingPage .ads-list .col-orders {
        display: none;
    }
}
