/* AISoftware Web — Light theme. Bootstrap 5 base + custom design system. */

:root {
    --ai-bg:            #f4f6fb;
    --ai-bg-gradient:   linear-gradient(135deg, #eef2ff 0%, #f8fafc 50%, #eefaf3 100%);
    --ai-surface:       #ffffff;
    --ai-surface-2:     #f1f4fa;
    --ai-surface-3:     #e9edf7;
    --ai-border:        #e3e8f2;
    --ai-border-strong: #d1d8e6;
    --ai-text:          #1b2134;
    --ai-text-muted:    #64748b;
    --ai-text-soft:     #94a3b8;

    --ai-primary:       #4f46e5;
    --ai-primary-hover: #4338ca;
    --ai-primary-soft:  #eef2ff;
    --ai-success:       #10b981;
    --ai-success-soft:  #ecfdf5;
    --ai-danger:        #ef4444;
    --ai-danger-soft:   #fef2f2;
    --ai-warning:       #f59e0b;
    --ai-warning-soft:  #fffbeb;
    --ai-info:          #06b6d4;
    --ai-info-soft:     #ecfeff;

    --ai-radius:    14px;
    --ai-radius-sm: 10px;
    --ai-radius-lg: 20px;

    --ai-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --ai-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --ai-shadow:    0 4px 16px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
    --ai-shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.10), 0 4px 12px rgba(15, 23, 42, 0.05);
    --ai-shadow-xl: 0 24px 60px rgba(79, 70, 229, 0.14), 0 8px 20px rgba(15, 23, 42, 0.08);

    --ai-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --ai-sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body {
    background: var(--ai-bg);
    background-image: radial-gradient(circle at 20% 0%, rgba(99, 102, 241, 0.06) 0%, transparent 40%),
                      radial-gradient(circle at 85% 100%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--ai-text);
    font-family: var(--ai-font);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    margin: 0;
    min-height: 100vh;
}

a { color: var(--ai-primary); text-decoration: none; }
a:hover { color: var(--ai-primary-hover); }

/* ================= LAYOUT ================= */
.ai-shell { display: flex; min-height: 100vh; }

.ai-sidebar {
    width: var(--ai-sidebar-w);
    min-width: var(--ai-sidebar-w);
    background: var(--ai-surface);
    border-right: 1px solid var(--ai-border);
    padding: 22px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px 22px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--ai-border);
    color: var(--ai-text);
    text-decoration: none;
}
.ai-brand-logo {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    display: grid; place-items: center;
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}
/* When the brand slot holds an <img> (the real logo), drop the gradient box —
   the logo has its own transparent background and stand-alone shape. */
.ai-brand-logo-img {
    background: none !important;
    box-shadow: none !important;
    object-fit: contain;
    padding: 2px;
}
.ai-brand-text { line-height: 1.1; }
.ai-brand-name { font-weight: 800; font-size: 16px; letter-spacing: -0.02em; }
.ai-brand-sub  { font-size: 11px; color: var(--ai-text-muted); letter-spacing: 0.04em; text-transform: uppercase; }

.ai-nav-section {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ai-text-soft);
    padding: 14px 14px 6px;
}
.ai-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--ai-radius-sm);
    color: var(--ai-text-muted);
    font-weight: 500;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    text-decoration: none;
}
.ai-nav-link:hover {
    background: var(--ai-surface-2);
    color: var(--ai-text);
}
.ai-nav-link.active {
    background: var(--ai-primary-soft);
    color: var(--ai-primary);
    border-color: rgba(99, 102, 241, 0.15);
    font-weight: 600;
}
.ai-nav-link i { font-size: 16px; width: 18px; text-align: center; }

.ai-sidebar-foot { margin-top: auto; padding: 12px; }

.ai-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.ai-topbar {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--ai-border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.ai-topbar-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.ai-topbar-spacer { flex: 1; }

.ai-user-btn {
    background: transparent;
    border: 1px solid var(--ai-border);
    padding: 5px 12px 5px 5px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--ai-text);
    font-size: 13px;
    font-weight: 500;
}

/* Notification bell in the topbar */
.ai-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid var(--ai-border);
    background: var(--ai-surface);
    color: var(--ai-text);
    text-decoration: none;
    margin-right: 8px;
    transition: all 0.15s ease;
}
.ai-bell:hover { background: var(--ai-surface-2); color: var(--ai-text); box-shadow: var(--ai-shadow-sm); }
.ai-bell i { font-size: 16px; }
.ai-bell.has-unread i { color: var(--ai-primary); }
.ai-bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--ai-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border: 2px solid var(--ai-surface);
    box-sizing: content-box;
}

/* Mode switch (AI ↔ Ad library) — lives in the topbar, just before the user menu */
.ai-mode-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 6px;
    border-radius: 999px;
    border: 1px solid var(--ai-border);
    background: var(--ai-surface);
    color: var(--ai-text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    margin-right: 8px;
}
.ai-mode-switch:hover {
    background: var(--ai-surface-2);
    color: var(--ai-text);
    box-shadow: var(--ai-shadow-sm);
}
.ai-mode-switch i { font-size: 16px; color: var(--ai-primary); }
.ai-mode-switch-logo {
    width: 26px; height: 26px;
    border-radius: 999px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 0.02em;
}
.ai-mode-switch-logo-img {
    background: none !important;
    object-fit: contain;
    padding: 2px;
}
/* Ad mode subtle background accent on the whole page */
body.ai-mode-ad {
    background-image: radial-gradient(circle at 15% 0%, rgba(79, 70, 229, 0.07) 0%, transparent 45%),
                      radial-gradient(circle at 90% 100%, rgba(168, 85, 247, 0.06) 0%, transparent 50%);
}
.ai-user-btn:hover { background: var(--ai-surface-2); }
.ai-avatar {
    width: 30px; height: 30px;
    border-radius: 999px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 700;
    font-size: 13px;
}

.ai-content {
    padding: 28px 28px 60px;
    max-width: 1600px;
    width: 100%;
}
/* Opt-in full-bleed content (set ViewData["FullWidth"] = true in the view).
   For wide data grids that should fill the whole desktop screen. Mobile is
   unaffected — its viewport is already below the 1600px cap. */
.ai-content--full { max-width: none; }

.ai-page-head { margin-bottom: 24px; }
.ai-page-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.ai-page-sub { color: var(--ai-text-muted); margin: 4px 0 0; font-size: 14px; }

/* ================= CARDS ================= */
.ai-card {
    background: var(--ai-surface);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius);
    padding: 20px;
    box-shadow: var(--ai-shadow-sm);
}
.ai-card-tight { padding: 14px 16px; }
.ai-card-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-kpi {
    background: var(--ai-surface);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius);
    padding: 18px 20px 18px 24px;
    box-shadow: var(--ai-shadow-sm);
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}
.ai-kpi:hover { transform: translateY(-2px); box-shadow: var(--ai-shadow); }
.ai-kpi-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ai-text-muted);
    display: flex; align-items: center; gap: 6px;
}
.ai-kpi-label i { font-size: 14px; }
.ai-kpi-value {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-top: 6px;
    color: var(--ai-text);
}
.ai-kpi-sub  { font-size: 12px; color: var(--ai-text-muted); margin-top: 4px; }
.ai-kpi-accent-bar {
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--ai-primary), #a855f7);
}
.ai-kpi-accent-bar.success { background: linear-gradient(180deg, #10b981, #059669); }
.ai-kpi-accent-bar.info    { background: linear-gradient(180deg, #06b6d4, #0891b2); }
.ai-kpi-accent-bar.warning { background: linear-gradient(180deg, #f59e0b, #d97706); }
.ai-kpi-accent-bar.danger  { background: linear-gradient(180deg, #ef4444, #dc2626); }

/* ================= BUTTONS ================= */
.btn-ai-primary {
    background: linear-gradient(135deg, var(--ai-primary), #7c3aed);
    color: #fff !important;
    border: none;
    padding: 9px 18px;
    border-radius: var(--ai-radius-sm);
    font-weight: 600;
    font-size: 13px;
    display: inline-flex; align-items: center; gap: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.btn-ai-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    color: #fff !important;
}
.btn-ai-ghost {
    background: transparent;
    border: 1px solid var(--ai-border-strong);
    color: var(--ai-text);
    padding: 8px 16px;
    border-radius: var(--ai-radius-sm);
    font-weight: 500;
    font-size: 13px;
    display: inline-flex; align-items: center; gap: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-ai-ghost:hover { background: var(--ai-surface-2); }

/* ================= BADGES ================= */
.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.ai-badge-success { background: var(--ai-success-soft); color: var(--ai-success); }
.ai-badge-danger  { background: var(--ai-danger-soft); color: var(--ai-danger); }
.ai-badge-warning { background: var(--ai-warning-soft); color: var(--ai-warning); }
.ai-badge-info    { background: var(--ai-info-soft); color: var(--ai-info); }
.ai-badge-muted   { background: var(--ai-surface-3); color: var(--ai-text-muted); }
.ai-badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* AI report grades — same palette as the desktop Entity Report */
.ai-grade-excellent { background: #dcfce7 !important; color: #14532d !important; }
.ai-grade-good      { background: #dbeafe !important; color: #1e40af !important; }
.ai-grade-average   { background: #fef9c3 !important; color: #854d0e !important; }
.ai-grade-poor      { background: #fed7aa !important; color: #9a3412 !important; }
.ai-grade-critical  { background: #fee2e2 !important; color: #991b1b !important; }

/* Score chip (0-100 round badge). Inherits grade color class. */
.ai-score-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: -0.02em;
    line-height: 1;
}
.ai-score-chip::before { content: none; }

/* Recommendations modal list */
.ai-recs-list { margin: 0; padding-left: 20px; }
.ai-recs-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--ai-border);
    line-height: 1.5;
}
.ai-recs-list li:last-child { border-bottom: none; }

/* ================= TABLES ================= */
.ai-table-wrap {
    background: var(--ai-surface);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius);
    overflow: hidden;
    box-shadow: var(--ai-shadow-sm);
}
.ai-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.ai-table thead th {
    background: var(--ai-surface-2);
    color: var(--ai-text-muted);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--ai-border);
    white-space: nowrap;
}
.ai-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--ai-border);
    vertical-align: middle;
}
.ai-table tbody tr:hover { background: var(--ai-surface-2); }
.ai-table tbody tr:last-child td { border-bottom: none; }
.ai-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.ai-table .pos { color: var(--ai-success); font-weight: 600; }
.ai-table .neg { color: var(--ai-danger); font-weight: 600; }

/* Column filter row — a second header row with one input per column */
.ai-table thead tr.ai-col-filter-row th {
    background: var(--ai-surface);
    padding: 6px 8px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: normal;
    border-bottom: 1px solid var(--ai-border);
    position: static;
}
.ai-col-filter {
    width: 100%;
    padding: 5px 8px;
    font-size: 12px;
    border: 1px solid var(--ai-border);
    border-radius: 6px;
    background: var(--ai-surface-2);
    color: var(--ai-text);
    transition: all 0.15s;
}
.ai-col-filter::placeholder { color: var(--ai-text-soft); font-style: italic; }
.ai-col-filter:focus {
    outline: none;
    border-color: var(--ai-primary);
    background: var(--ai-surface);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}
.ai-col-filter-clear {
    background: transparent;
    border: none;
    color: var(--ai-text-soft);
    cursor: pointer;
    font-size: 11px;
    padding: 4px 6px;
}
.ai-col-filter-clear:hover { color: var(--ai-danger); }

.ai-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 18px;
}
.ai-period {
    display: inline-flex;
    background: var(--ai-surface);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius-sm);
    padding: 3px;
    box-shadow: var(--ai-shadow-xs);
}
.ai-period a {
    padding: 7px 14px;
    border-radius: 8px;
    color: var(--ai-text-muted);
    font-weight: 500;
    font-size: 12px;
    transition: all 0.15s;
}
.ai-period a:hover { color: var(--ai-text); }
.ai-period a.active {
    background: var(--ai-primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

/* ================= FORMS ================= */
.ai-form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ai-text);
    margin-bottom: 6px;
}
.ai-input, .ai-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--ai-border-strong);
    border-radius: var(--ai-radius-sm);
    background: var(--ai-surface);
    font-size: 14px;
    color: var(--ai-text);
    transition: all 0.15s;
}
.ai-input:focus, .ai-select:focus {
    outline: none;
    border-color: var(--ai-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* ================= LOGIN ================= */
.ai-auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 20px;
    background: var(--ai-bg-gradient);
}
.ai-auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--ai-surface);
    border-radius: var(--ai-radius-lg);
    padding: 40px;
    box-shadow: var(--ai-shadow-xl);
    border: 1px solid var(--ai-border);
}
.ai-auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    margin-bottom: 8px;
}
.ai-auth-brand .ai-brand-logo { width: 44px; height: 44px; font-size: 18px; }
/* Big centered logo on the Login card */
.ai-auth-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    display: block;
    margin: 0 auto 4px;
    filter: drop-shadow(0 6px 16px rgba(79, 70, 229, 0.25));
}
.ai-auth-title { font-size: 24px; font-weight: 800; margin: 20px 0 4px; text-align: center; letter-spacing: -0.02em; }
.ai-auth-sub { color: var(--ai-text-muted); text-align: center; margin-bottom: 28px; font-size: 14px; }
.ai-auth-error {
    background: var(--ai-danger-soft);
    color: var(--ai-danger);
    padding: 10px 14px;
    border-radius: var(--ai-radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}

.ai-toast {
    position: fixed;
    top: 20px; right: 20px;
    background: var(--ai-surface);
    border: 1px solid var(--ai-border);
    padding: 12px 16px;
    border-radius: var(--ai-radius-sm);
    box-shadow: var(--ai-shadow-lg);
    display: flex; align-items: center; gap: 10px;
    z-index: 9999;
    font-size: 13px;
    font-weight: 500;
    animation: slideIn 0.2s ease-out;
}
.ai-toast.success { border-left: 3px solid var(--ai-success); }
.ai-toast.error   { border-left: 3px solid var(--ai-danger); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.modal-content { border: 1px solid var(--ai-border); border-radius: var(--ai-radius); }

/* ── Mobile nav hamburger + drawer ──────────────────────────────────────── */
.ai-nav-toggle {
    display: none;   /* shown only below breakpoint */
    width: 40px;
    height: 40px;
    border: 1px solid var(--ai-border);
    border-radius: 10px;
    background: var(--ai-surface);
    color: var(--ai-text);
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}
.ai-nav-toggle:hover { background: var(--ai-surface-2); }

.ai-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.2s ease;
}

@media (max-width: 900px) {
    .ai-nav-toggle { display: inline-flex; }

    /* Sidebar becomes a slide-in drawer, hidden by default. */
    .ai-sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100vh;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: 0 12px 40px rgba(15, 23, 42, 0.3);
    }
    body.ai-nav-open .ai-sidebar { transform: translateX(0); }
    body.ai-nav-open .ai-sidebar-backdrop { display: block; opacity: 1; }
    body.ai-nav-open { overflow: hidden; }

    .ai-topbar { padding: 12px 16px; gap: 8px; }
    .ai-topbar-title { font-size: 16px; }
    .ai-content { padding: 20px 16px 40px; }

    /* Keep the bell + switch buttons compact */
    .ai-mode-switch { padding: 4px 10px 4px 4px; font-size: 12px; }
    .ai-user-btn { padding: 4px 6px 4px 4px; }

    /* Page head stacks nicely on narrow screens */
    .ai-page-title { font-size: 22px; }
    .ai-page-head { margin-bottom: 18px; }

    /* KPI and filter rows already use Bootstrap's responsive row — just ensure
       filter bars wrap with a bit of breathing room. */
    .ai-filters { gap: 8px; }
    .ai-filters > div { min-width: 0 !important; }

    /* Period pill row wraps without spilling off-screen. */
    .ai-period { flex-wrap: wrap; }
    .ai-period a { padding: 6px 10px; font-size: 11px; }
}

@media (max-width: 480px) {
    .ai-topbar-title { display: none; } /* reclaim space on tiny screens */
    .ai-content { padding: 16px 12px 40px; }
}

/* ================= AD LIBRARY (BannerCrawler) ================= */
.ai-adlib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.ai-adlib-card {
    display: flex;
    flex-direction: column;
    background: var(--ai-surface);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.18s ease;
    box-shadow: var(--ai-shadow-xs);
}
.ai-adlib-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--ai-shadow-lg);
    border-color: var(--ai-primary);
    color: inherit;
}
.ai-adlib-thumb {
    position: relative;
    background: var(--ai-surface-2);
    aspect-ratio: 16 / 10;
    overflow: hidden;
    display: grid;
    place-items: center;
}
.ai-adlib-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.ai-adlib-noimg, .ai-adlib-videobadge {
    color: var(--ai-text-soft);
    font-size: 24px;
    display: inline-flex; align-items: center; gap: 6px;
}
.ai-adlib-videobadge {
    background: rgba(99, 102, 241, 0.1);
    color: var(--ai-primary);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}
.ai-adlib-network {
    position: absolute;
    top: 8px; left: 8px;
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.ai-adlib-captures {
    position: absolute;
    top: 8px; right: 8px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}
.ai-adlib-captures i { font-size: 10px; }
.ai-adlib-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}
.ai-adlib-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--ai-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.7em;
}
.ai-adlib-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--ai-text-muted);
    gap: 8px;
}
.ai-adlib-brand {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.ai-adlib-date { white-space: nowrap; }
.ai-adlib-foot {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: auto;
}

/* =========================================================================
   Custom scrollbars — applied everywhere (WebKit + Firefox) so the generic
   chunky system scrollbar is replaced by a slim, theme-matched one. Ad mode
   overrides the accent below.
   ========================================================================= */

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--ai-border-strong) transparent;
}
*:hover {
    scrollbar-color: var(--ai-primary) transparent;
}

/* WebKit / Blink (Chrome, Edge, Safari) */
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
*::-webkit-scrollbar-track {
    background: transparent;
}
*::-webkit-scrollbar-thumb {
    background: var(--ai-border-strong);
    border-radius: 999px;
    /* transparent border becomes padding via background-clip so the thumb
       looks thinner and floats inside the track. */
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background-color .15s ease;
}
*::-webkit-scrollbar-thumb:hover {
    background: var(--ai-primary);
    background-clip: padding-box;
    border: 2px solid transparent;
}
*::-webkit-scrollbar-thumb:active {
    background: var(--ai-primary-hover);
    background-clip: padding-box;
    border: 2px solid transparent;
}
*::-webkit-scrollbar-corner {
    background: transparent;
}

/* Sidebar gets a softer, subtler thumb so it doesn't fight the nav chrome. */
.ai-sidebar {
    scrollbar-color: rgba(79, 70, 229, 0.35) transparent; /* --ai-primary @35% */
}
.ai-sidebar::-webkit-scrollbar {
    width: 8px;
}
.ai-sidebar::-webkit-scrollbar-thumb {
    background: rgba(79, 70, 229, 0.35);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.ai-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--ai-primary);
    background-clip: padding-box;
    border: 2px solid transparent;
}

/* Ad Library mode uses a different accent; keep the scrollbar on-theme. */
.ai-mode-ad .ai-sidebar {
    scrollbar-color: rgba(236, 72, 153, 0.4) transparent;
}
.ai-mode-ad .ai-sidebar::-webkit-scrollbar-thumb {
    background: rgba(236, 72, 153, 0.4);
    background-clip: padding-box;
    border: 2px solid transparent;
}
.ai-mode-ad .ai-sidebar::-webkit-scrollbar-thumb:hover {
    background: #db2777;
    background-clip: padding-box;
    border: 2px solid transparent;
}

/* Modal/table scroll containers feel nicer with a bit more breathing room. */
.table-responsive::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    height: 10px;
    width: 10px;
}

