/* ==========================================================================
   AdPlify design system
   Layer on top of Bootstrap 4.3 (css/bootstrap.min.css). All colours come from
   the tokens below so every component follows the light / dark theme.
   Theme is selected by <html data-theme="light|dark"> (set before first paint).
   ========================================================================== */

:root {
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --sidebar-w: 260px;
    --sidebar-w-collapsed: 76px;
    --topbar-h: 64px;
    --ease: cubic-bezier(.2, .8, .2, 1);

    /* light */
    --bg: #f5f6fb;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --surface-3: #eef0f7;
    --border: #e4e7f0;
    --border-strong: #d3d8e6;
    --text: #151a2d;
    --text-2: #3b4258;
    --text-muted: #6b7289;
    --text-faint: #9aa0b4;

    --primary: #6246ea;
    --primary-hover: #5236d6;
    --primary-soft: #efebff;
    --primary-contrast: #ffffff;
    --success: #12a17a;
    --success-soft: #e3f6ef;
    --danger: #e0455b;
    --danger-soft: #fdecee;
    --warning: #d98a06;
    --warning-soft: #fff4dd;
    --info: #2f7cf6;
    --info-soft: #e7f0ff;

    --sidebar-bg: #121527;
    --sidebar-text: #b6bbd2;
    --sidebar-text-strong: #ffffff;
    --sidebar-muted: #6e7491;
    --sidebar-hover: rgba(255, 255, 255, .06);
    --sidebar-active: rgba(124, 99, 255, .18);

    --shadow-sm: 0 1px 2px rgba(18, 22, 43, .06);
    --shadow: 0 1px 3px rgba(18, 22, 43, .06), 0 6px 16px rgba(18, 22, 43, .06);
    --shadow-lg: 0 18px 48px rgba(18, 22, 43, .18);
    --focus-ring: 0 0 0 3px rgba(98, 70, 234, .25);

    --chart-1: #6246ea;
    --chart-2: #12a17a;
    --chart-3: #2f7cf6;
    --chart-4: #d98a06;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0d1020;
    --surface: #151a2e;
    --surface-2: #1a2036;
    --surface-3: #222941;
    --border: #262d47;
    --border-strong: #333b5a;
    --text: #e8eaf4;
    --text-2: #c3c8dc;
    --text-muted: #8f96b2;
    --text-faint: #646b88;

    --primary: #8b74ff;
    --primary-hover: #9d89ff;
    --primary-soft: rgba(139, 116, 255, .16);
    --primary-contrast: #ffffff;
    --success: #2fc796;
    --success-soft: rgba(47, 199, 150, .14);
    --danger: #ff6b80;
    --danger-soft: rgba(255, 107, 128, .14);
    --warning: #f5b33d;
    --warning-soft: rgba(245, 179, 61, .14);
    --info: #5c9bff;
    --info-soft: rgba(92, 155, 255, .14);

    --sidebar-bg: #0a0d1a;
    --sidebar-hover: rgba(255, 255, 255, .05);
    --sidebar-active: rgba(139, 116, 255, .2);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 3px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 20px 56px rgba(0, 0, 0, .55);
    --focus-ring: 0 0 0 3px rgba(139, 116, 255, .35);

    --chart-1: #8b74ff;
    --chart-2: #2fc796;
    --chart-3: #5c9bff;
    --chart-4: #f5b33d;
    color-scheme: dark;
}

/* No-JS fallback: follow the OS until the inline theme script sets data-theme. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg: #0d1020; --surface: #151a2e; --surface-2: #1a2036; --surface-3: #222941;
        --border: #262d47; --border-strong: #333b5a; --text: #e8eaf4; --text-2: #c3c8dc;
        --text-muted: #8f96b2; --text-faint: #646b88; --primary: #8b74ff; --primary-hover: #9d89ff;
        --primary-soft: rgba(139, 116, 255, .16); color-scheme: dark;
    }
}

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color .2s var(--ease), color .2s var(--ease);
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--text); font-weight: 650; letter-spacing: -.01em; }
h1, .h1 { font-size: 1.6rem; }
h2, .h2 { font-size: 1.35rem; }
h3, .h3 { font-size: 1.15rem; }
h4, .h4 { font-size: 1.05rem; }
h5, .h5 { font-size: .95rem; }
p { color: var(--text-2); }
a { color: var(--primary); }
a:hover { color: var(--primary-hover); text-decoration: none; }
hr { border-color: var(--border); }
code, kbd, pre, samp { font-family: var(--font-mono); }
::selection { background: var(--primary-soft); color: var(--text); }
.text-muted { color: var(--text-muted) !important; }
.text-faint { color: var(--text-faint) !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.bg-white, .bg-light { background-color: var(--surface) !important; }
.border, .border-top, .border-bottom { border-color: var(--border) !important; }
.hidden, [hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
img { max-width: 100%; }
.mono { font-family: var(--font-mono); font-size: .85em; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 1040;
    width: var(--sidebar-w);
    display: flex; flex-direction: column;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    transition: width .22s var(--ease), transform .22s var(--ease);
}
.sidebar-brand {
    height: var(--topbar-h); flex: 0 0 auto;
    display: flex; align-items: center; gap: 10px; padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-brand a { display: flex; align-items: center; gap: 10px; color: var(--sidebar-text-strong); font-weight: 700; font-size: 1.1rem; letter-spacing: -.02em; }
.brand-logo-wrap { display: block; flex: 0 0 auto; overflow: hidden; }
.brand-logo { display: block; height: 42px; width: auto; max-width: none; }
.brand-logo-white, :root[data-theme="dark"] .brand-logo-auto { filter: brightness(0) invert(1); }
.sidebar-brand .brand-name { white-space: nowrap; }
.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: 14px 12px 20px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
.sidebar-section-title {
    font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600;
    color: var(--sidebar-muted); padding: 14px 12px 6px; white-space: nowrap;
}
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; }
.nav-link-item {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 9px 12px; margin: 2px 0; border-radius: 8px; border: 0; background: none;
    color: var(--sidebar-text); font-size: 15px; font-weight: 500; text-align: left;
    transition: background-color .15s, color .15s;
}
.nav-link-item:hover, .nav-link-item:focus { background: var(--sidebar-hover); color: var(--sidebar-text-strong); text-decoration: none; }
.nav-link-item .nav-icon { width: 20px; flex: 0 0 20px; text-align: center; font-size: 16px; opacity: .9; }
.nav-link-item .nav-label { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-link-item .nav-caret { font-size: 13px; transition: transform .2s var(--ease); opacity: .7; }
.nav-group.open > .nav-link-item .nav-caret { transform: rotate(90deg); }
.nav-group.active > .nav-link-item, .nav-link-item.active { background: var(--sidebar-active); color: var(--sidebar-text-strong); }
.nav-group.active > .nav-link-item .nav-icon { color: #b3a6ff; opacity: 1; }
.nav-children { display: none; padding: 2px 0 6px 32px !important; position: relative; }
.nav-children::before { content: ""; position: absolute; left: 21px; top: 4px; bottom: 8px; width: 1px; background: rgba(255,255,255,.08); }
.nav-group.open > .nav-children { display: block; }
.nav-children a {
    display: block; padding: 7px 12px; border-radius: 7px; margin: 1px 0;
    color: var(--sidebar-text); font-size: 14.5px; white-space: nowrap;
}
.nav-children a:hover { color: var(--sidebar-text-strong); background: var(--sidebar-hover); }
.nav-children a.active { color: var(--sidebar-text-strong); background: rgba(255,255,255,.06); font-weight: 600; }
.sidebar-footer { flex: 0 0 auto; padding: 12px; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-credit { display: flex; justify-content: center; }
.sidebar-credit img { display: block; width: 140px; height: auto; }
.sidebar-social { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 8px; }
.sidebar-social a { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: var(--sidebar-text); font-size: 16px; }
.sidebar-social a:hover { background: rgba(255,255,255,.08); color: var(--sidebar-text-strong); }

.app-main { flex: 1 1 auto; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; transition: margin-left .22s var(--ease); }

.app-topbar {
    position: sticky; top: 0; z-index: 1030;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 12px;
    padding: 0 24px;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(10px);
    backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--border);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) { .app-topbar { background: var(--surface); } }
.topbar-heading { min-width: 0; }
.topbar-title { font-weight: 650; font-size: 1.15rem; line-height: 1.25; margin: 0; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar-heading .crumbs { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; font-size: 13px; margin-top: 2px; }
.topbar-spacer { flex: 1 1 auto; }
.icon-btn {
    position: relative; display: inline-grid; place-items: center;
    width: 40px; height: 40px; border-radius: 10px; border: 1px solid transparent;
    background: transparent; color: var(--text-muted); font-size: 17px; cursor: pointer;
    transition: background-color .15s, color .15s, border-color .15s;
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--text); }
.icon-btn .count:empty { display: none; }
.icon-btn .count {
    position: absolute; top: 5px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700;
    line-height: 18px; text-align: center; border: 2px solid var(--surface);
}
.theme-toggle .fa-sun-o { display: none; }
:root[data-theme="dark"] .theme-toggle .fa-sun-o { display: inline-block; }
:root[data-theme="dark"] .theme-toggle .fa-moon-o { display: none; }

.plan-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 600;
    background: var(--primary-soft); color: var(--primary); white-space: nowrap;
}
.plan-badge.plan-warning { background: var(--warning-soft); color: var(--warning); }
.plan-badge.plan-danger { background: var(--danger-soft); color: var(--danger); }
.upgrade-link { font-weight: 600; font-size: 14px; white-space: nowrap; }

.user-menu-btn {
    display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px;
    border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
    cursor: pointer; transition: border-color .15s, background-color .15s;
}
.user-menu-btn:hover { border-color: var(--border-strong); }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px;
    display: grid; place-items: center; font-size: 14px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, #7c63ff, #4f8bff);
}
.user-menu-btn .user-name { font-weight: 600; font-size: 14.5px; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu-btn .fa-angle-down { color: var(--text-muted); }

.app-content { flex: 1 1 auto; padding: 28px 32px 40px; width: 100%; margin: 0 auto; font-size: 16px; }
.app-content .btn { font-size: 15.5px; }
.app-content .btn-sm { font-size: 14.5px; }
.app-content label, .app-content .form-label, .app-content .card-subtitle, .app-content .dataTables_wrapper, .app-content .table .cell-muted { font-size: 15px; }
.app-content .form-control, .app-content .custom-select, .app-content .page-header .page-subtitle { font-size: 16px; }
.app-content .form-hint, .app-content .field-error, .app-content .field-success, .app-content .stat-label, .app-content .tool-tile .tile-desc { font-size: 14.5px; }
.app-content .tool-tile .tile-title { font-size: 16.5px; }
.app-content .alert, .app-content .link-card { font-size: 15.5px; }
.app-footer {
    display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between;
    padding: 18px 32px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 14px;
}
.app-footer a { color: var(--text-muted); }
.app-footer a:hover { color: var(--text); }
.app-footer nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }

/* collapsed sidebar (desktop) */
@media (min-width: 992px) {
    :root[data-sidebar="collapsed"] .app-sidebar { width: var(--sidebar-w-collapsed); }
    :root[data-sidebar="collapsed"] .app-main { margin-left: var(--sidebar-w-collapsed); }
    :root[data-sidebar="collapsed"] .brand-name,
    :root[data-sidebar="collapsed"] .sidebar-section-title,
    :root[data-sidebar="collapsed"] .nav-label,
    :root[data-sidebar="collapsed"] .nav-caret,
    :root[data-sidebar="collapsed"] .nav-children { display: none !important; }
    :root[data-sidebar="collapsed"] .sidebar-brand { justify-content: center; padding: 0; }
    :root[data-sidebar="collapsed"] .sidebar-social { flex-direction: column; gap: 4px; margin-top: 0; }
    :root[data-sidebar="collapsed"] .sidebar-credit { display: none; }
    :root[data-sidebar="collapsed"] .brand-logo-wrap { width: 42px; } /* crops the wordmark, leaving the icon */
    :root[data-sidebar="collapsed"] .nav-link-item { justify-content: center; padding: 11px 0; }
    :root[data-sidebar="collapsed"] .nav-link-item .nav-icon { font-size: 18px; }
    :root[data-sidebar="collapsed"] .sidebar-section-title { display: block !important; height: 1px; padding: 0; margin: 10px 14px; background: rgba(255,255,255,.08); font-size: 0; }
}

/* off-canvas sidebar (tablet / phone) */
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); width: min(86vw, var(--sidebar-w)); box-shadow: var(--shadow-lg); }
    .app-main { margin-left: 0; }
    :root.sidebar-open .app-sidebar { transform: none; }
    :root.sidebar-open .sidebar-backdrop {
        display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(8, 10, 22, .5);
        animation: fade-in .2s var(--ease);
    }
    :root.sidebar-open body { overflow: hidden; }
    .app-topbar { padding: 0 16px; }
    .app-content { padding: 20px 16px 32px; }
    .app-footer { padding: 16px; }
}
@media (max-width: 575.98px) {
    .user-menu-btn .user-name, .user-menu-btn .fa-angle-down, .plan-badge, .upgrade-link { display: none !important; }
    .user-menu-btn { padding: 3px; border: 0; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Page header & breadcrumbs ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-header .page-title { font-size: 1.55rem; font-weight: 700; margin: 2px 0 0; letter-spacing: -.02em; }
.page-header .page-subtitle { margin: 6px 0 0; color: var(--text-muted); font-size: 15px; max-width: 760px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 13.5px; color: var(--text-muted); }
.crumbs li + li::before { content: "\f105"; font-family: FontAwesome; margin-right: 6px; color: var(--text-faint); }
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--primary); }
.crumbs [aria-current] { color: var(--text-2); font-weight: 500; }
@media (max-width: 575.98px) {
    .page-header .page-title { font-size: 1.3rem; }
    .page-actions { width: 100%; }
    .page-actions > .btn { flex: 1 1 auto; }
}

/* ---------- Cards & panels ---------- */
.card {
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card-header, .card-footer { background: transparent; border-color: var(--border); padding: 16px 20px; }
.card-header:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.card-body { padding: 20px; }
.card-title { font-size: 1rem; font-weight: 650; color: var(--text); margin-bottom: 4px; }
.card-subtitle { color: var(--text-muted); font-size: 14px; }
.card-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-toolbar .card-title { margin: 0; }
.section-gap > * + * { margin-top: 20px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1199.98px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767.98px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 479.98px) { .grid-4 { grid-template-columns: minmax(0, 1fr); } }

/* tool tiles (dashboard) */
.tool-tile {
    position: relative; display: flex; align-items: center; gap: 14px;
    padding: 16px 18px; border-radius: var(--radius-lg);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    color: var(--text); transition: transform .15s var(--ease), box-shadow .15s, border-color .15s;
}
.tool-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); color: var(--text); }
.tool-tile .tile-icon { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; }
.tool-tile .tile-title { font-weight: 650; font-size: 15.5px; }
.tool-tile .tile-desc { font-size: 13.5px; color: var(--text-muted); margin: 2px 0 0; }
.tone-primary { background: var(--primary-soft); color: var(--primary); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }

/* welcome hero */
.hero {
    position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px;
    padding: 20px 56px 20px 24px; border-radius: var(--radius-lg);
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-sm);
}
.hero-text { flex: 1 1 320px; min-width: 0; }
.hero h2 { font-size: 1.2rem; margin: 0 0 4px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (max-width: 575.98px) {
    .hero { padding: 18px 16px; }
    .hero h2 { padding-right: 32px; }
    .hero-text { flex-basis: 100%; }
    .hero-actions { width: 100%; }
    .hero-actions > .btn { flex: 1 1 auto; }
}
.grid-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1199.98px) { .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .grid-stats { gap: 12px; } .grid-stats .card-body { padding: 14px; } .grid-stats .stat-value { font-size: 1.35rem; } }
.hero p { color: var(--text-muted); margin: 0; max-width: 560px; }
.hero-close { position: absolute; top: 10px; right: 10px; z-index: 1; color: var(--text-muted); background: transparent; border: 0; font-size: 16px; width: 32px; height: 32px; border-radius: 8px; }
.hero-close:hover { background: var(--surface-3); color: var(--text); }

/* stat */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13.5px; color: var(--text-muted); font-weight: 500; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-weight: 600; font-size: 14.5px; line-height: 1.3;
    padding: 8px 14px; border-radius: var(--radius-sm); border-width: 1px;
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus, .btn.focus { box-shadow: var(--focus-ring) !important; }
.btn-sm { padding: 5px 10px; font-size: 13.5px; gap: 6px; }
.btn-lg { padding: 11px 20px; font-size: 15px; }
.btn-block { display: flex; width: 100%; }
.btn .fa { font-size: 1.05em; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.btn-primary:hover, .btn-primary:focus, .btn-primary:not(:disabled):not(.disabled):active { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-contrast); }
.btn-secondary, .btn-default, .btn-light, .btn-outline-secondary {
    background: var(--surface); border-color: var(--border-strong); color: var(--text);
}
.btn-secondary:hover, .btn-default:hover, .btn-light:hover, .btn-outline-secondary:hover,
.btn-secondary:not(:disabled):not(.disabled):active { background: var(--surface-3); border-color: var(--border-strong); color: var(--text); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.06); background: var(--success); border-color: var(--success); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.06); background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); background: transparent; }
.btn-outline-primary:hover { background: var(--primary); color: var(--primary-contrast); }
.btn-outline-info { color: var(--info); border-color: var(--border-strong); background: var(--surface); }
.btn-outline-info:hover { background: var(--info-soft); color: var(--info); border-color: var(--info); }
.btn-info { background: var(--info); border-color: var(--info); color: #fff; }
.btn-soft { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.btn-soft:hover { background: var(--primary); color: var(--primary-contrast); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-ghost-danger { background: transparent; border-color: transparent; color: var(--danger); }
.btn-ghost-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-icon-only { width: 34px; height: 34px; padding: 0; }
.btn-icon-only.btn-sm { width: 30px; height: 30px; }
.btn.is-loading { pointer-events: none; opacity: .75; }
.btn .spinner { width: 14px; height: 14px; border-width: 2px; }
.btn-group-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.btn:disabled, .btn.disabled { opacity: .55; }

/* ---------- Forms ---------- */
label, .form-label { font-weight: 600; font-size: 14px; color: var(--text-2); margin-bottom: 6px; }
.form-hint { font-size: 13.5px; color: var(--text-muted); margin-top: 6px; }
.form-control, .custom-select, select.form-control {
    height: auto; min-height: 40px; padding: 9px 12px; font-size: 15px;
    color: var(--text); background-color: var(--surface);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
textarea.form-control { min-height: 96px; line-height: 1.55; }
.form-control::placeholder { color: var(--text-faint); }
.form-control:focus, .custom-select:focus { color: var(--text); background-color: var(--surface); border-color: var(--primary); box-shadow: var(--focus-ring); }
.form-control:disabled, .form-control[readonly] { background: var(--surface-2); color: var(--text-muted); }
select.form-control { appearance: none; -webkit-appearance: none; padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238f96b2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; }
select.form-control[multiple] { background-image: none; padding-right: 12px; }
.input-group-text { background: var(--surface-2); border-color: var(--border-strong); color: var(--text-muted); border-radius: var(--radius-sm); }
.input-icon { position: relative; }
.input-icon > .fa { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.input-icon > .form-control { padding-left: 38px; }
.form-group { margin-bottom: 16px; }
.form-row-inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-row-inline > .grow { flex: 1 1 260px; min-width: 0; }
.custom-control-label { font-weight: 500; }
.field-error, label.error, .error-class { color: var(--danger); font-size: 13.5px; font-weight: 500; margin-top: 6px; display: block; }
.field-success { color: var(--success); font-size: 13.5px; font-weight: 600; margin-top: 6px; display: block; }

/* switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; margin: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 40px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background-color .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .18s var(--ease); }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: var(--focus-ring); }

/* checkbox used inside tables */
.check { display: inline-flex; position: relative; width: 18px; height: 18px; margin: 0; cursor: pointer; vertical-align: middle; }
.check input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.check span { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-strong); background: var(--surface); transition: all .12s; }
.check input:checked + span { background: var(--primary); border-color: var(--primary); }
.check input:checked + span::after { content: ""; position: absolute; left: 6px; top: 2.5px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* ---------- Tables ---------- */
.table { color: var(--text); margin-bottom: 0; }
.table thead th {
    border-top: 0; border-bottom: 1px solid var(--border);
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 650;
    color: var(--text-muted); background: var(--surface-2); white-space: nowrap; padding: 11px 14px; vertical-align: middle;
}
.table td, .table th { border-top: 1px solid var(--border); padding: 12px 14px; vertical-align: middle; }
.table tbody tr:first-child td, .table tbody tr:first-child th { border-top: 0; }
.table-striped tbody tr:nth-of-type(odd) { background: transparent; }
.table-hover tbody tr:hover, .table tbody tr:hover { background: var(--surface-2); color: var(--text); }
.table-bordered, .table-bordered td, .table-bordered th { border-color: var(--border); }
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.table-responsive { border-radius: var(--radius); }
.table .cell-strong { font-weight: 600; color: var(--text); }
.table .cell-muted { color: var(--text-muted); font-size: 14px; }
.table .cell-actions { text-align: right; white-space: nowrap; }
.table .logo-cell img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #fff; padding: 3px; border: 1px solid var(--border); }
.table a { font-weight: 500; }
.text-break-anywhere { overflow-wrap: anywhere; word-break: break-word; }

/* DataTables */
.dataTables_wrapper { color: var(--text-muted); font-size: 14px; }
.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter { margin-bottom: 12px; }
.dataTables_wrapper .dataTables_length label, .dataTables_wrapper .dataTables_filter label { font-weight: 500; color: var(--text-muted); display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.dataTables_wrapper .dataTables_filter input, .dataTables_wrapper .dataTables_length select {
    background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    padding: 6px 10px; min-height: 34px; margin: 0 !important;
}
.dataTables_wrapper .dataTables_filter input { width: 220px; max-width: 100%; }
.dataTables_wrapper .dataTables_filter input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.dataTables_wrapper .dataTables_info { padding-top: 14px !important; color: var(--text-muted) !important; }
.dataTables_wrapper .dataTables_paginate { padding-top: 10px !important; border: 0 !important; border-radius: 0 !important; margin-top: 0 !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button:active { box-shadow: none !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border: 1px solid transparent !important; border-radius: 7px !important; background: transparent !important;
    color: var(--text-2) !important; padding: 5px 11px !important; margin: 0 2px !important; min-width: 32px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover { background: var(--surface-3) !important; color: var(--text) !important; border-color: transparent !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover { background: var(--primary) !important; color: #fff !important; border-color: var(--primary) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover { color: var(--text-faint) !important; background: transparent !important; }
table.dataTable { border-collapse: separate !important; border-spacing: 0; width: 100% !important; }
table.dataTable thead th, table.dataTable thead td { border-bottom: 1px solid var(--border) !important; }
table.dataTable.no-footer { border-bottom: 0 !important; }
table.dataTable thead .sorting, table.dataTable thead .sorting_asc, table.dataTable thead .sorting_desc { background-color: var(--surface-2) !important; }
table.dataTable tbody tr { background-color: transparent !important; }
table.dataTable td.dataTables_empty { padding: 36px 14px !important; color: var(--text-muted); }
.dt-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.dt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 575.98px) {
    .dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter { float: none !important; text-align: left !important; }
    .dataTables_wrapper .dataTables_filter input { width: 100%; }
    .dataTables_wrapper .dataTables_filter label { display: flex; }
    .dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_paginate { float: none !important; text-align: center !important; }
}

/* ---------- Pagination ---------- */
.pagination { gap: 4px; }
.page-link { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 7px !important; min-width: 34px; text-align: center; padding: 6px 10px; }
.page-link:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-item.disabled .page-link { background: transparent; color: var(--text-faint); border-color: var(--border); }

/* ---------- Badges / chips ---------- */
.badge { font-weight: 600; font-size: 11.5px; padding: 4px 9px; border-radius: 999px; letter-spacing: .01em; }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-secondary, .badge-light { background: var(--surface-3); color: var(--text-2); }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chip-list li { padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 13px; }
.pre-line { white-space: pre-line; }

/* ---------- Alerts / empty states ---------- */
.alert { border-radius: var(--radius); border: 1px solid transparent; font-size: 14.5px; }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert a { font-weight: 600; color: inherit; text-decoration: underline; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .empty-icon { width: 56px; height: 56px; border-radius: 16px; display: inline-grid; place-items: center; font-size: 24px; margin-bottom: 14px; background: var(--primary-soft); color: var(--primary); }
.empty-state h3 { font-size: 1.05rem; margin-bottom: 6px; }
.empty-state p { margin: 0 auto 16px; max-width: 420px; color: var(--text-muted); }

/* callout list (links on ad watcher etc.) */
.link-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.link-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14.5px; transition: border-color .15s, background-color .15s; }
.link-card:hover { border-color: var(--primary); color: var(--text); background: var(--surface-2); }
.link-card .fa { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: 0 0 34px; }

/* ---------- Dropdowns / modals / popovers ---------- */
.dropdown-menu {
    background: var(--surface); color: var(--text); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; font-size: 14.5px; min-width: 200px;
}
.dropdown-item { color: var(--text-2); border-radius: 7px; padding: 8px 12px; display: flex; align-items: center; gap: 10px; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-3); color: var(--text); }
.dropdown-item.active, .dropdown-item:active { background: var(--primary-soft); color: var(--primary); }
.dropdown-item .fa { width: 16px; text-align: center; color: var(--text-muted); }
.dropdown-divider { border-color: var(--border); margin: 6px 0; }
.dropdown-header { color: var(--text-muted); font-size: 13px; padding: 8px 12px; }
.modal-content { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border-color: var(--border); padding: 16px 20px; }
.modal-body { padding: 20px; }
.modal-title { font-weight: 650; font-size: 1.05rem; }
.modal-backdrop.show { opacity: .55; }
.close { color: var(--text); text-shadow: none; opacity: .5; }
.close:hover { color: var(--text); opacity: .9; }
.collapse-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.collapse-card + .collapse-card { margin-top: 8px; }
.collapse-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 12px 16px; background: var(--surface); border: 0; color: var(--text); font-weight: 600; text-align: left; }
.collapse-toggle:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.collapse-toggle .fa { transition: transform .2s var(--ease); color: var(--text-muted); }
.collapse-toggle[aria-expanded="true"] .fa { transform: rotate(180deg); }

/* notifications dropdown */
.notif-menu { width: min(380px, calc(100vw - 24px)); padding: 0; overflow: hidden; }
.notif-menu .notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 650; }
.notif-list { max-height: 380px; overflow-y: auto; margin: 0; padding: 6px; list-style: none; }
.notif-item { display: flex; gap: 12px; padding: 10px; border-radius: 9px; }
.notif-item:hover { background: var(--surface-2); }
.notif-item .notif-icon { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; display: grid; place-items: center; }
.notif-item .notif-title { font-weight: 600; color: var(--text); display: block; overflow-wrap: anywhere; }
.notif-item .notif-meta { font-size: 13px; color: var(--text-muted); }
.notif-empty { padding: 28px 16px; text-align: center; color: var(--text-muted); }
.notif-foot { display: block; text-align: center; padding: 10px; border-top: 1px solid var(--border); font-weight: 600; font-size: 14px; }

/* upgrade (free-plan limit) dialog */
.upgrade-dialog { text-align: center; }
.upgrade-dialog .upgrade-icon { width: 64px; height: 64px; border-radius: 18px; display: inline-grid; place-items: center; font-size: 28px; background: var(--warning-soft); color: var(--warning); margin-bottom: 14px; }
.upgrade-dialog h3 { font-size: 1.15rem; }

/* ---------- Loading ---------- */
.spinner { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 48px 16px; color: var(--text-muted); font-weight: 500; }
.loading-block .spinner { width: 24px; height: 24px; color: var(--primary); }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Charts ---------- */
.chart { height: 320px; width: 100%; }
@media (max-width: 575.98px) { .chart { height: 260px; } }
.scroll-panel { max-height: 360px; overflow: auto; }

/* ---------- Plugins ---------- */
/* toastr */
#toast-container > div { border-radius: var(--radius) !important; box-shadow: var(--shadow-lg) !important; opacity: 1 !important; padding: 14px 16px 14px 48px !important; font-size: 14.5px; font-family: var(--font-sans); background-position: 16px center !important; }
#toast-container > .toast-success { background-color: #10835f !important; }
#toast-container > .toast-error { background-color: #c8364b !important; }
#toast-container > .toast-info { background-color: #2c6ad1 !important; }
#toast-container > .toast-warning { background-color: #b5720a !important; }
#toast-container.toast-top-full-width > div, #toast-container.toast-bottom-full-width > div { width: min(560px, 96%) !important; margin: 8px auto !important; }
/* sweetalert2 (v5) */
.swal2-modal { background: var(--surface) !important; border-radius: var(--radius-lg) !important; font-family: var(--font-sans) !important; box-shadow: var(--shadow-lg); }
.swal2-modal .swal2-title { color: var(--text) !important; font-size: 1.3rem !important; font-weight: 650 !important; }
.swal2-modal .swal2-content { color: var(--text-muted) !important; font-size: 15.5px !important; }
.swal2-modal .swal2-buttonswrapper { margin-top: 20px !important; display: flex; justify-content: center; gap: 10px; }
.swal2-modal .btn { margin: 0 !important; min-width: 110px; }
.swal2-overlay { background-color: rgba(8, 10, 22, .55) !important; }
/* select2 */
.select2-container--default .select2-selection--multiple, .select2-container--default .select2-selection--single {
    background: var(--surface) !important; border: 1px solid var(--border-strong) !important; border-radius: var(--radius-sm) !important; min-height: 40px;
}
.select2-container--default.select2-container--focus .select2-selection--multiple { border-color: var(--primary) !important; box-shadow: var(--focus-ring); }
.select2-container--default .select2-selection--multiple .select2-selection__choice { background: var(--primary-soft) !important; border: 0 !important; color: var(--primary) !important; border-radius: 6px !important; padding: 2px 8px !important; font-weight: 600; font-size: 13.5px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove { color: var(--primary) !important; margin-right: 4px; }
.select2-container--default .select2-search--inline .select2-search__field { color: var(--text); }
.select2-dropdown { background: var(--surface) !important; border-color: var(--border) !important; color: var(--text); border-radius: var(--radius-sm) !important; box-shadow: var(--shadow); }
.select2-container--default .select2-results__option[aria-selected=true] { background: var(--surface-3) !important; color: var(--text); }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--primary) !important; color: #fff !important; }
.select2-container { width: 100% !important; }
/* noUiSlider */
.noUi-target { background: var(--surface-3) !important; border: 0 !important; box-shadow: none !important; border-radius: 999px !important; height: 8px !important; }
.noUi-connect { background: var(--primary) !important; }
.noUi-horizontal .noUi-handle { width: 22px !important; height: 22px !important; top: -7px !important; right: -11px !important; border-radius: 50% !important; border: 3px solid var(--primary) !important; background: var(--surface) !important; box-shadow: var(--shadow-sm) !important; cursor: grab; }
.noUi-handle::before, .noUi-handle::after { display: none !important; }
.noUi-tooltip { background: var(--text) !important; color: var(--surface) !important; border: 0 !important; border-radius: 6px !important; font-size: 13px !important; font-weight: 600; padding: 3px 8px !important; }
/* intro.js */
.introjs-tooltip { background: var(--surface) !important; color: var(--text) !important; border-radius: var(--radius) !important; box-shadow: var(--shadow-lg) !important; }
.introjs-tooltip-title { color: var(--text) !important; }
.introjs-button { border-radius: var(--radius-sm) !important; text-shadow: none !important; font-family: var(--font-sans) !important; }
.introjs-arrow.top { border-bottom-color: var(--surface) !important; }
.introjs-arrow.left { border-right-color: var(--surface) !important; }
.introjs-arrow.right { border-left-color: var(--surface) !important; }
.introjs-arrow.bottom { border-top-color: var(--surface) !important; }

/* ---------- Auth pages ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bg); }
.auth-aside {
    position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
    padding: 48px; color: #fff;
    background: radial-gradient(1200px 600px at -10% -20%, rgba(124, 99, 255, .9), transparent 60%),
                radial-gradient(900px 500px at 120% 120%, rgba(79, 139, 255, .8), transparent 60%), #1a1446;
}
.auth-aside h1 { color: #fff; font-size: 2.1rem; line-height: 1.2; max-width: 460px; }
.auth-aside p { color: rgba(255,255,255,.8); max-width: 440px; font-size: 15px; }
.auth-aside .auth-points { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.auth-aside .auth-points li { display: flex; gap: 12px; align-items: center; color: rgba(255,255,255,.9); }
.auth-aside .auth-points .fa { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.14); }
.auth-aside .auth-art { max-width: 420px; margin: 24px 0; filter: drop-shadow(0 24px 40px rgba(0,0,0,.35)); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.2rem; color: var(--text); margin-bottom: 28px; }.auth-card h2 { font-size: 1.5rem; margin-bottom: 6px; }
.auth-card .auth-sub { color: var(--text-muted); margin-bottom: 24px; }
.auth-foot { margin-top: 20px; text-align: center; color: var(--text-muted); font-size: 14.5px; }
.auth-theme { position: fixed; top: 16px; right: 16px; z-index: 5; }
@media (max-width: 991.98px) { .auth-shell { grid-template-columns: minmax(0, 1fr); } .auth-aside { display: none; } }

/* ---------- Ad Decorator ---------- */
.mode-group { display: flex; flex-wrap: wrap; gap: 6px; }
.mode-group .btn { flex: 1 1 auto; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 4px; }
.emoji-grid .emj {
    display: grid; place-items: center; aspect-ratio: 1 / 1; font-size: 22px; line-height: 1;
    border-radius: 9px; cursor: pointer; user-select: none; color: var(--text);
    transition: background-color .12s, transform .12s;
}
.emoji-grid .emj:hover { background: var(--surface-3); transform: scale(1.12); text-decoration: none; }
.emoji-grid .emj:active { transform: scale(.95); }
.emoji-section { content-visibility: auto; contain-intrinsic-size: 0 220px; }
#sr:empty { display: none; }
#sr { padding: 10px; border: 1px dashed var(--border-strong); border-radius: var(--radius); margin-top: 10px; }

/* ---------- RoI ---------- */
.roi-step { display: flex; gap: 14px; padding: 18px 0; border-top: 1px solid var(--border); }
.roi-step:first-of-type { border-top: 0; padding-top: 4px; }
.roi-step .step-num { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--primary-soft); color: var(--primary); }
.roi-step h4 { margin: 2px 0 4px; font-size: 15.5px; }
.roi-step p { font-size: 14px; color: var(--text-muted); margin-bottom: 30px; }
.roi-step .slider-default { margin: 40px 6px 4px; }
.roi-result { text-align: center; padding: 8px 0 20px; }
.roi-result .roi-headline { font-size: 1.45rem; font-weight: 700; margin: 8px 0 0; }
.roi-result .roi-amount { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; color: var(--text); font-variant-numeric: tabular-nums; }
.roi-result .roi-icon { width: 72px; height: 72px; border-radius: 20px; display: inline-grid; place-items: center; font-size: 30px; }
#result.is-profit td { background: var(--success-soft); color: var(--success); font-weight: 700; }
#result.is-loss td { background: var(--danger-soft); color: var(--danger); font-weight: 700; }

/* ---------- Ad previews (Ad Watcher) ---------- */
.ad-grid { display: grid; gap: 16px; align-items: start; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.ad-card {
    display: flex; flex-direction: column; position: relative; background: #fff; color: #1c1e21; font: 13px/1.45 var(--font-sans);
    border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; overflow-wrap: anywhere;
}
.ad-card:hover { box-shadow: var(--shadow); }
.ad-card-body { padding: 14px; max-height: 720px; overflow: auto; }
.ad-card-foot { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid #e4e6eb; font-weight: 600; font-size: 14px; color: #1b74e4 !important; background: #f7f8fa; }
.ad-card-foot:hover { background: #eef2ff; text-decoration: none; }
.ad-card ._99s5 { width: 100% !important; flex-basis: auto !important; margin: 0 !important; }
/* The stored markup uses Facebook's atomic classes (not shipped in fbadstyle.css), so keep it within the card. */
.ad-card * { max-width: 100% !important; box-sizing: border-box; }
.ad-card img { height: auto; border-radius: 6px; }
.ad-card video { width: 100%; height: auto; max-height: 420px; background: #000; border-radius: 8px; }
.ad-card .ad-media-missing { display: none !important; }
.ad-card a { color: #1b74e4; }

/* ---------- Video list (Help / downloads) ---------- */
.video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-list { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.video-item h3 { font-size: 15.5px; margin: 12px 0 0; }

/* misc */
.code-box { font-family: var(--font-mono); font-size: 14px; background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.secret-field { font-family: var(--font-mono); letter-spacing: .02em; }
.prose p, .prose li { color: var(--text-2); }
.prose h3 { margin-top: 24px; font-size: 1rem; }
.prose .bold { font-weight: 650; color: var(--text); margin-top: 18px; }
.w-min-0 { min-width: 0; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.d-grid { display: grid; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media print { .app-sidebar, .app-topbar, .app-footer, .page-actions { display: none !important; } .app-main { margin: 0 !important; } }
