/* ==========================================================================
   Game of Ads — Offer Wall design system
   Mirrors the new admin panel: CSS-variable tokens, dual theme, BEM-light.
   ========================================================================== */

/* --- Tokens (shared) ---------------------------------------------------- */
:root {
    --accent-cyan:   #22d3ee;
    --accent-violet: #a855f7;
    --accent-lime:   #84ffad;
    --accent-pink:   #e879f9;

    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 16px;
    --r-xl: 24px;

    --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    --gradient-brand: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-violet) 100%);
    --gradient-brand-text: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-violet) 100%);

    --danger:  #f87171;
    --success: #4ade80;

    --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
    --transition: 180ms var(--ease-out);
}

/* --- Tokens (light, default) ------------------------------------------- */
:root,
[data-theme="light"] {
    color-scheme: light;

    --bg-page:        #f4f6fb;
    --surface-0:      #ffffff;
    --surface-1:      #f4f6fb;
    --surface-2:      #eef1f7;
    --surface-3:      #e3e8f1;

    --border-1: rgba(11, 14, 21, 0.06);
    --border-2: rgba(11, 14, 21, 0.10);
    --border-3: rgba(11, 14, 21, 0.18);

    --text-1: #0b0e15;
    --text-2: #3b4254;
    --text-3: #5d667a;
    --text-4: #8a93a7;

    --card-bg:        #ffffff;
    --panel-bg:       #ffffff;
    --input-bg:       #ffffff;
    --hover-bg:       rgba(11, 14, 21, 0.04);
    --row-hover-bg:   rgba(34, 211, 238, 0.06);

    --sidebar-bg:     #ffffff;
    --topbar-bg:      rgba(255, 255, 255, 0.85);
    --main-header-bg: rgba(244, 246, 251, 0.85);

    --shadow-card:  0 8px 28px rgba(11, 14, 21, 0.08), 0 1px 0 rgba(11, 14, 21, 0.04) inset;
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.6);
    --glow-cyan:    0 0 60px rgba(34, 211, 238, 0.20);
    --glow-violet:  0 0 60px rgba(168, 85, 247, 0.18);

    --text-positive: #16a34a;
    --text-accent:   #0891b2;

    --row-negative-bg: rgba(248, 113, 113, 0.10);
    --row-paused-bg:   rgba(11, 14, 21, 0.03);
}

/* --- Tokens (dark) ----------------------------------------------------- */
[data-theme="dark"] {
    color-scheme: dark;

    --bg-page:        #05070c;
    --surface-0:      #0a0d15;
    --surface-1:      #0f131c;
    --surface-2:      #161b27;
    --surface-3:      #1d2333;

    --border-1: rgba(255, 255, 255, 0.10);
    --border-2: rgba(255, 255, 255, 0.16);
    --border-3: rgba(255, 255, 255, 0.24);

    --text-1: #eef1f6;
    --text-2: #b9c1cf;
    --text-3: #7a8499;
    --text-4: #4d566b;

    --card-bg:        #161b27;
    --panel-bg:       #1d2333;
    --input-bg:       #0a0d15;
    --hover-bg:       rgba(255, 255, 255, 0.04);
    --row-hover-bg:   rgba(255, 255, 255, 0.03);

    --sidebar-bg:     rgba(8, 11, 18, 0.92);
    --topbar-bg:      rgba(10, 13, 21, 0.75);
    --main-header-bg: rgba(10, 13, 21, 0.65);

    --shadow-card:  0 12px 40px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    --glow-cyan:    0 0 60px rgba(34, 211, 238, 0.35);
    --glow-violet:  0 0 60px rgba(168, 85, 247, 0.30);

    --text-positive: var(--accent-lime);
    --text-accent:   var(--accent-cyan);

    --row-negative-bg: rgba(248, 113, 113, 0.08);
    --row-paused-bg:   rgba(255, 255, 255, 0.03);
}

/* --- Reset / base ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-1);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--text-accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-cyan); }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; border-radius: var(--r-sm); }

h1, h2, h3, h4, h5 { margin: 0; line-height: 1.2; color: var(--text-1); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0; }

::selection { background: var(--accent-cyan); color: #05070c; }

/* --- Layout shell ------------------------------------------------------ */
.layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
[data-sidebar="collapsed"] .layout { grid-template-columns: 0 1fr; }

.layout__main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-page);
}
.layout__content {
    flex: 1;
    padding: 28px clamp(16px, 3vw, 40px);
    max-width: 100%;
}

.main-header {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 16px;
    padding: 14px clamp(16px, 3vw, 32px);
    background: var(--main-header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-1);
}
.main-header__title { font-size: 20px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main-header__actions { display: flex; align-items: center; gap: 8px; }
.main-header__toggle {
    background: transparent; border: 0; padding: 6px;
    display: inline-flex; flex-direction: column; gap: 4px;
}
.main-header__toggle span {
    display: block; width: 20px; height: 2px; background: var(--text-2); border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}

/* --- Sidebar ----------------------------------------------------------- */
.sidebar {
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
    background: var(--sidebar-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-1);
    z-index: 30;
    overflow: hidden;
    transition: transform var(--transition);
}
[data-sidebar="collapsed"] .sidebar { transform: translateX(-100%); }
.sidebar__overlay {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 25;
}

.sidebar__brand {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-1);
}
.sidebar__brand-link { display: flex; align-items: center; min-width: 0; flex: 1; color: var(--text-1); font-weight: 700; }
.sidebar__brand-logo { width: auto; height: 36px; max-width: 100%; object-fit: contain; }
[data-theme="dark"] .sidebar__brand-logo,
[data-theme="dark"] .auth-card__brand img,
[data-theme="dark"] .lp-nav__logo { filter: invert(1) hue-rotate(180deg); }
.sidebar__close { display: none; background: transparent; border: 0; color: var(--text-2); font-size: 28px; line-height: 1; padding: 0 4px; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 16px 12px; }
.sidebar__group { margin-bottom: 18px; }
.sidebar__group-title {
    font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--text-3); padding: 6px 12px; margin-bottom: 6px;
}
.sidebar__item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--r-md);
    color: var(--text-2); font-weight: 500;
    transition: background var(--transition), color var(--transition);
}
.sidebar__item:hover { background: var(--hover-bg); color: var(--text-1); }
.sidebar__item--current {
    background: linear-gradient(90deg, rgba(34,211,238,0.14), rgba(168,85,247,0.10));
    color: var(--text-1);
    box-shadow: var(--shadow-inset);
}
.sidebar__item-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--text-4);
    flex-shrink: 0;
}
.sidebar__item--current .sidebar__item-dot,
.sidebar__item:hover .sidebar__item-dot { background: var(--accent-cyan); box-shadow: 0 0 8px var(--accent-cyan); }

.sidebar__item--disabled {
    cursor: not-allowed; opacity: 0.6;
}
.sidebar__item--disabled:hover {
    background: transparent; color: var(--text-2);
}
.sidebar__item--disabled:hover .sidebar__item-dot {
    background: var(--text-4); box-shadow: none;
}
.sidebar__item-badge {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
    text-transform: uppercase;
    background: var(--surface-2); color: var(--text-3);
    border: 1px solid var(--border-1);
}

.sidebar__footer {
    border-top: 1px solid var(--border-1);
    padding: 14px 16px;
    display: flex; flex-direction: column; gap: 10px;
}
.sidebar__user { display: flex; align-items: center; gap: 10px; }
.sidebar__user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--gradient-brand); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
}
.sidebar__user-meta { min-width: 0; flex: 1; }
.sidebar__user-name { font-size: 13px; font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-email { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__logout {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 12px; border-radius: var(--r-md);
    background: var(--surface-2); color: var(--text-2); font-size: 13px; font-weight: 600;
    transition: background var(--transition), color var(--transition);
}
.sidebar__logout:hover { background: var(--surface-3); color: var(--text-1); }

/* --- Theme toggle ------------------------------------------------------ */
.theme-toggle {
    position: relative; width: 36px; height: 36px;
    background: var(--surface-2); border: 1px solid var(--border-1);
    border-radius: var(--r-md); color: var(--text-2);
    display: inline-flex; align-items: center; justify-content: center;
    transition: background var(--transition), color var(--transition);
}
.theme-toggle:hover { background: var(--surface-3); color: var(--text-1); }
.theme-toggle__icon { font-size: 16px; line-height: 1; transition: opacity var(--transition); }
.theme-toggle__icon--moon { display: none; }
.theme-toggle__icon--sun  { display: inline-block; }
[data-theme="dark"] .theme-toggle__icon--moon { display: inline-block; }
[data-theme="dark"] .theme-toggle__icon--sun  { display: none; }

.theme-toggle--auth {
    position: absolute;
    top: 18px; right: 18px;
    z-index: 5;
}

/* --- Page toolbar ------------------------------------------------------ */
.page-toolbar {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 16px; flex-wrap: wrap;
}
.page-toolbar__title { font-size: 18px; font-weight: 700; }
.page-toolbar__spacer { flex: 1; }

/* --- Cards ------------------------------------------------------------- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-1);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-card);
    /* No backdrop-filter — it'd create a stacking context that would
       trap absolutely-positioned children (e.g. macro-picker menu)
       behind the next card. The card bg is solid so the blur was
       invisible anyway. .auth-card still keeps its own blur.
       No overflow:hidden either: lets the menu spill past the edges. */
}
.card__body { padding: 22px; }
.card__title { font-size: 15px; font-weight: 700; color: var(--text-1); margin-bottom: 14px; }
.card__subtitle { font-size: 13px; color: var(--text-3); margin-top: -8px; margin-bottom: 14px; }

/* --- Buttons ----------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 18px;
    background: var(--surface-2); color: var(--text-1);
    border: 1px solid var(--border-2); border-radius: var(--r-md);
    font-family: inherit; font-size: 13px; font-weight: 600;
    transition: background var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
    text-decoration: none;
    position: relative;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.btn--primary {
    background: var(--gradient-brand);
    color: #05070c;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(34, 211, 238, 0.30);
}
.btn--primary:hover { color: #05070c; box-shadow: 0 6px 20px rgba(34, 211, 238, 0.40); }
.btn--danger { background: rgba(248, 113, 113, 0.15); color: var(--danger); border-color: rgba(248, 113, 113, 0.35); }
.btn--danger:hover { background: rgba(248, 113, 113, 0.25); }
.btn--success { background: rgba(74, 222, 128, 0.15); color: var(--success); border-color: rgba(74, 222, 128, 0.35); }
.btn--ghost { background: transparent; }
.btn--block { display: flex; width: 100%; }
.btn--lg { height: 44px; font-size: 14px; padding: 0 22px; }
.btn--sm { height: 32px; font-size: 12px; padding: 0 12px; }

.btn.is-loading { color: transparent; pointer-events: none; }
.btn.is-loading::after {
    content: ''; position: absolute; width: 16px; height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff;
    border-radius: 50%; animation: btnspin 0.7s linear infinite;
}
@keyframes btnspin { to { transform: rotate(360deg); } }

.btn-inline {
    display: inline-flex; align-items: center; justify-content: center;
    height: 28px; padding: 0 10px;
    background: var(--surface-2); color: var(--text-2);
    border: 1px solid var(--border-1); border-radius: var(--r-sm);
    font-size: 12px; font-weight: 600;
    transition: background var(--transition), color var(--transition);
}
.btn-inline:hover { background: var(--surface-3); color: var(--text-1); }
.btn-inline--danger { color: var(--danger); border-color: rgba(248,113,113,0.35); }
.btn-inline--on { color: var(--success); }
.btn-inline--off { color: var(--text-4); }

/* --- Forms ------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
    font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
    color: var(--text-2); text-transform: uppercase;
}
.field__hint { font-size: 12px; color: var(--text-3); }
.field__error { font-size: 12px; color: var(--danger); }

.input, .select, .textarea {
    width: 100%; height: 40px; padding: 0 14px;
    background: var(--input-bg); color: var(--text-1);
    border: 1px solid var(--border-2); border-radius: var(--r-md);
    font-family: inherit; font-size: 13px;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.textarea { height: auto; padding: 12px 14px; min-height: 100px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}
.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237a8499' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}
.input--error,
.input.is-invalid,
.select.is-invalid,
.textarea.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.18);
}

/* Password input with show/hide eye toggle. */
.password-input { position: relative; }
.password-input .input { padding-right: 44px; }
.password-input__toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px; height: 32px;
    background: transparent; border: 0;
    border-radius: var(--r-sm);
    color: var(--text-3);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition), background var(--transition);
}
.password-input__toggle:hover { color: var(--text-1); background: var(--hover-bg); }
.password-input__toggle .password-input__eye-off { display: none; }
.password-input__toggle.is-visible .password-input__eye { display: none; }
.password-input__toggle.is-visible .password-input__eye-off { display: inline-block; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.checkbox input { accent-color: var(--accent-cyan); }

/* --- Filters ----------------------------------------------------------- */
.filters {
    background: var(--card-bg);
    border: 1px solid var(--border-1);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-card);
    padding: 18px 22px;
    margin-bottom: 18px;
}
.filters__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}
.filters__field { display: flex; flex-direction: column; gap: 6px; }
.filters__actions {
    display: flex; gap: 10px; justify-content: flex-end;
    margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-1);
}

/* --- Tables ------------------------------------------------------------ */
.data-wrap {
    background: var(--card-bg);
    border: 1px solid var(--border-1);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.data-scroll { overflow-x: auto; }
.data-table { width: 100%; min-width: 900px; border-collapse: separate; border-spacing: 0; }
.data-table th, .data-table td {
    padding: 12px 16px; text-align: left; vertical-align: middle;
    font-size: 13px; color: var(--text-2);
    border-bottom: 1px solid var(--border-1);
}
.data-table th {
    font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-3); background: var(--surface-1);
    position: sticky; top: 0; z-index: 1;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--row-hover-bg); }
.data-table .row-negative { background: var(--row-negative-bg); }
.data-table .row-paused   { background: var(--row-paused-bg); }
/* State rows keep their colour family on hover so we don't get a green
   sheen on a red "Paused" row, which reads as confusing. */
.data-table tbody tr.row-negative:hover { background: rgba(248, 113, 113, 0.16); }
.data-table tbody tr.row-paused:hover   { background: rgba(128, 128, 128, 0.08); }
.data-table__empty {
    padding: 36px 20px; text-align: center; color: var(--text-3); font-size: 13px;
}

/* --- Badge ------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    height: 22px; padding: 0 8px;
    border-radius: 999px; font-size: 11px; font-weight: 600;
    background: var(--surface-2); color: var(--text-2);
    border: 1px solid var(--border-1);
}
.badge--pending  { color: #fbbf24; background: rgba(251, 191, 36, 0.10); border-color: rgba(251,191,36,0.3); }
.badge--approved { color: var(--success); background: rgba(74, 222, 128, 0.10); border-color: rgba(74,222,128,0.3); }
.badge--rejected { color: var(--danger); background: rgba(248, 113, 113, 0.10); border-color: rgba(248,113,113,0.3); }
.badge--paused   { color: var(--text-3); }
.badge--info     { color: var(--accent-cyan); background: rgba(34, 211, 238, 0.10); border-color: rgba(34, 211, 238, 0.3); }

/* --- Flash messages ---------------------------------------------------- */
.flash {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: var(--r-md);
    background: var(--surface-2); color: var(--text-1);
    border: 1px solid var(--border-2);
    margin-bottom: 18px;
    font-size: 13px;
}
.flash--ok    { background: rgba(74, 222, 128, 0.10); border-color: rgba(74, 222, 128, 0.35); color: var(--success); }
.flash--error { background: rgba(248, 113, 113, 0.10); border-color: rgba(248, 113, 113, 0.35); color: var(--danger); }

/* --- Modal ------------------------------------------------------------- */
.modal {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.modal[hidden] { display: none !important; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(4px); }
.modal__panel {
    position: relative; z-index: 1;
    width: 100%; max-width: 520px;
    background: var(--panel-bg);
    border: 1px solid var(--border-2); border-radius: var(--r-lg);
    box-shadow: 0 20px 80px rgba(0,0,0,0.6);
    display: flex; flex-direction: column;
    max-height: calc(100vh - 32px);
}
.modal__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border-1);
}
.modal__title { font-size: 16px; font-weight: 700; }
.modal__close { background: transparent; border: 0; color: var(--text-3); font-size: 22px; line-height: 1; padding: 4px 8px; }
.modal__close:hover { color: var(--text-1); }
.modal__body { padding: 18px 20px; overflow-y: auto; font-size: 13px; color: var(--text-2); }
.modal__body p { margin: 0 0 10px; }
.modal__body code { font-family: var(--font-mono); font-size: 12px; padding: 1px 6px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--text-accent); }
.modal__actions {
    display: flex; gap: 8px; justify-content: flex-end;
    padding: 14px 20px; border-top: 1px solid var(--border-1);
}

/* --- Pagination -------------------------------------------------------- */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.pagination__link {
    min-width: 36px; height: 36px; padding: 0 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-2); color: var(--text-2);
    border: 1px solid var(--border-1); border-radius: var(--r-md);
    font-size: 13px; font-weight: 600;
}
.pagination__link:hover { background: var(--surface-3); color: var(--text-1); }
.pagination__link--current {
    background: var(--gradient-brand); color: #05070c; border-color: transparent;
}
.pagination__gap { padding: 0 6px; color: var(--text-4); align-self: center; }

/* --- Macro picker (postback URL helper) ------------------------------- */
.macro-picker { position: relative; display: inline-block; z-index: 50; }
.macro-picker__toggle {
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: 0.04em;
}
.macro-picker__menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--panel-bg);
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-card);
    z-index: 50;
    width: max-content;
    min-width: 320px;
    max-width: min(520px, 95vw);
    max-height: 360px;
    overflow-y: auto;
    padding: 6px 0;
}
.macro-picker__menu[hidden] { display: none; }
.macro-picker__item {
    display: flex; flex-direction: column;
    width: 100%; padding: 8px 14px;
    background: transparent; border: 0;
    text-align: left; cursor: pointer;
    color: var(--text-1);
}
.macro-picker__item:hover { background: var(--hover-bg); }
.macro-picker__item code {
    font-family: var(--font-mono);
    font-size: 12px; color: var(--text-accent);
    background: transparent; padding: 0;
}
.macro-picker__item-label { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* --- Country flag icon (served from flagcdn) -------------------------- */
.flag-icon {
    display: inline-block;
    width: 16px; height: 12px;
    vertical-align: -2px;
    margin-right: 4px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px var(--border-1);
}

/* --- Chip -------------------------------------------------------------- */
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    height: 24px; padding: 0 10px;
    background: var(--surface-2); color: var(--text-2);
    border: 1px solid var(--border-1); border-radius: 999px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
}
.chip__remove { background: transparent; border: 0; color: var(--text-3); font-size: 14px; padding: 0; }
.chip__remove:hover { color: var(--text-1); }

.chip-row {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.chip--restriction {
    height: auto; min-height: 24px;
    padding: 4px 10px;
    background: color-mix(in srgb, var(--danger, #d33) 12%, var(--surface-2));
    border-color: color-mix(in srgb, var(--danger, #d33) 35%, var(--border-1));
    color: var(--text-1);
    white-space: normal; text-align: left;
    letter-spacing: 0;
}

/* --- Offer card (variant of .card) ------------------------------------ */
.offer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

/* Denser variant for "related offers" strips and similar — gives 3-4
   cols on desktop and forces 2 cols on phones so the user doesn't get
   one-card-per-screen. */
.offer-grid--compact {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.offer-card {
    background: var(--card-bg);
    border: 1px solid var(--border-1);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
    display: flex; flex-direction: column;
    text-decoration: none;
}
.offer-card:hover {
    transform: translateY(-2px);
    border-color: rgba(34, 211, 238, 0.40);
    box-shadow: var(--shadow-card), 0 0 0 1px rgba(34, 211, 238, 0.20), 0 12px 30px rgba(34, 211, 238, 0.12);
}
.offer-card__media {
    position: relative; aspect-ratio: 1 / 1; overflow: hidden;
    background: var(--card-bg);
    display: flex; align-items: center; justify-content: center;
}
.offer-card__media img { width: 100%; height: 100%; object-fit: cover; }
.offer-card__media--blurred img { filter: blur(18px) saturate(0.7); transform: scale(1.1); }
/* "PREVIEW" badge anchored top-right of every offer image (both the
   grid cards and the detail hero). Solid dark pill keeps it legible
   over any background. Sits below the adult overlay (z-index 3) and
   ignores pointer events. */
.offer-card__media::after,
.detail-hero__media::after {
    content: "PREVIEW";
    position: absolute; top: 8px; right: 8px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    border-radius: 999px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    z-index: 2;
    user-select: none;
}
/* Detail hero has 10px of inner padding around the image, so push the
   badge in by that much so it hugs the image, not the outer frame. */
.detail-hero__media::after { top: 18px; right: 18px; }
.offer-card__adult {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.45);
    color: #fff; font-weight: 700; letter-spacing: 0.1em;
    cursor: pointer;
    transition: background var(--transition);
    z-index: 3;
}
.offer-card__adult:hover { background: rgba(0,0,0,0.55); }
.offer-card__adult-pill {
    background: var(--gradient-brand); color: #05070c;
    padding: 8px 16px; border-radius: 999px; font-size: 12px;
}
.offer-card__body { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.offer-card__title {
    font-size: 14px; font-weight: 700; color: var(--text-1);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.offer-card__payout {
    font-size: 18px; font-weight: 800; color: var(--text-positive);
    font-family: var(--font-mono);
}
.offer-card__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.offer-card__rows { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.offer-card__row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-3); }
.offer-card__row strong { color: var(--text-2); font-weight: 600; }
.offer-card__row span    { text-align: right; word-break: break-word; }

/* Wrapper that turns just the media+body into the link, leaving the
   footer (with action buttons) outside so buttons aren't nested in
   an <a>. */
.offer-card__link {
    display: flex; flex-direction: column;
    color: inherit; text-decoration: none;
}
.offer-card__footer {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border-1);
    padding-top: 12px;
    margin-top: auto;
}

/* --- Detail page ------------------------------------------------------- */
.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}
.detail-hero { position: sticky; top: 96px; }
.detail-hero__media {
    position: relative; overflow: hidden;
    border-radius: var(--r-lg); background: var(--card-bg);
    border: 1px solid var(--border-1); box-shadow: var(--shadow-card);
    padding: 10px;
    max-width: 360px; margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
}
.detail-hero__media img {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    width: auto; height: auto;
    border-radius: calc(var(--r-lg) - 6px);
}
.detail-hero__media--blurred img { filter: blur(20px) saturate(0.5); transform: scale(1.12); }

.detail-aside { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.detail-header { display: flex; flex-direction: column; gap: 8px; }
.detail-header__title { font-size: 30px; font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; }
.detail-header__subtitle { color: var(--text-3); font-size: 13px; }
.detail-header__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.detail-payout {
    background: var(--card-bg); border: 1px solid var(--border-1); border-radius: var(--r-lg);
    box-shadow: var(--shadow-card);
    padding: 22px; text-align: center;
}
.detail-payout__label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.detail-payout__value {
    font-size: 38px; font-weight: 800; font-family: var(--font-mono);
    background: var(--gradient-brand-text);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em; line-height: 1.1;
    margin-top: 4px;
}
.detail-payout__currency { font-size: 16px; color: var(--text-3); margin-left: 4px; font-family: var(--font-sans); font-weight: 600; }

.detail-meta-list { display: flex; flex-direction: column; }
.detail-meta-list__row {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid var(--border-1);
}
.detail-meta-list__row:last-child { border-bottom: 0; }
.detail-meta-list__label { color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; flex-shrink: 0; }
.detail-meta-list__value { color: var(--text-1); font-size: 13px; text-align: right; word-break: break-word; }

/* --- Auth shell -------------------------------------------------------- */
.auth-shell {
    position: relative; min-height: 100vh; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.auth-shell__main {
    position: relative; z-index: 2; width: 100%; max-width: 460px;
}
.auth-grid-bg {
    position: absolute; inset: 0; z-index: 0;
    background-image:
        linear-gradient(var(--border-1) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-1) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse at center, black 35%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 35%, transparent 75%);
    opacity: 0.6;
}
.auth-glow {
    position: absolute; z-index: 1;
    width: 480px; height: 480px; border-radius: 50%;
    filter: blur(120px); opacity: 0.45;
    pointer-events: none;
}
.auth-glow--cyan   { left: -120px; top: -120px;  background: var(--accent-cyan); }
.auth-glow--violet { right: -120px; bottom: -120px; background: var(--accent-violet); }

.auth-card {
    background: var(--card-bg); border: 1px solid var(--border-2);
    border-radius: var(--r-xl); box-shadow: var(--shadow-card);
    padding: 32px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.auth-card__brand {
    display: flex; flex-direction: column; align-items: center;
    gap: 14px; margin-bottom: 28px;
    text-align: center;
}
.auth-card__brand img {
    width: auto; height: 64px; max-width: 260px;
    object-fit: contain;
}
.auth-card__brand-product {
    font-size: 28px; font-weight: 800; letter-spacing: -0.01em;
    line-height: 1.1;
    background: var(--gradient-brand-text);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.auth-card__title { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.auth-card__subtitle { font-size: 13px; color: var(--text-3); margin-bottom: 22px; }
.auth-card__form { display: flex; flex-direction: column; gap: 14px; }
.auth-card__footer { margin-top: 18px; font-size: 13px; color: var(--text-3); text-align: center; }
.auth-card__footer a { color: var(--accent-cyan); font-weight: 600; }

/* --- Empty / loading states ------------------------------------------- */
.empty-state {
    background: var(--card-bg); border: 1px dashed var(--border-2);
    border-radius: var(--r-lg);
    padding: 48px 22px; text-align: center;
    color: var(--text-3);
}
.empty-state__title { color: var(--text-1); font-size: 16px; font-weight: 700; margin-bottom: 6px; }

.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
    background-size: 200% 100%;
    animation: skel 1.4s linear infinite;
    border-radius: var(--r-md);
}
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* --- Stack utility ----------------------------------------------------- */
.stack { display: flex; flex-direction: column; }
.stack--gap-sm { gap: 8px; }
.stack--gap   { gap: 14px; }
.stack--gap-lg { gap: 22px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row--end { justify-content: flex-end; }
.text-right { text-align: right; }
.text-mono { font-family: var(--font-mono); }
.muted { color: var(--text-3); }
.separator { height: 1px; background: var(--border-1); margin: 14px 0; }

/* --- Responsive -------------------------------------------------------- */
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    [data-sidebar="collapsed"] .layout { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; top: 0; left: 0; height: 100vh; width: 280px;
        transform: translateX(-100%);
        transition: transform var(--transition);
    }
    [data-sidebar="open"] .sidebar { transform: translateX(0); }
    [data-sidebar="open"] .sidebar__overlay { display: block; }
    .sidebar__close { display: inline-flex; }
    .layout__content { padding: 20px 16px; }
    .detail-grid { grid-template-columns: 1fr; gap: 18px; }
    .detail-hero { position: static; }
    .detail-hero__media { max-width: 240px; }
    .detail-hero__media img { max-height: 50vh; }
    .filters__actions { justify-content: stretch; }
    .filters__actions .btn { flex: 1; }
    .page-toolbar { flex-direction: row; }
}
@media (max-width: 700px) {
    .modal { padding: 0; }
    .modal__panel { max-height: 100vh; height: 100vh; max-width: 100vw; border-radius: 0; }
    .offer-grid          { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
    .offer-grid--compact { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
    h1 { font-size: 24px; } h2 { font-size: 19px; }
    .detail-header__title { font-size: 22px; }
    .detail-payout__value { font-size: 32px; }
}
@media (max-width: 520px) {
    .layout__content { padding: 16px 12px; }
    .auth-card { padding: 22px; border-radius: var(--r-lg); }
    .filters { padding: 14px 16px; }
    .data-table th, .data-table td { padding: 10px 12px; }
    .offer-grid          { grid-template-columns: 1fr 1fr; }
    .offer-grid--compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .offer-card__body    { padding: 12px 14px; }
    .offer-card__title   { font-size: 13px; }
    .offer-card__payout  { font-size: 16px; }
    .offer-card__rows    { font-size: 11px; }
    .offer-card__footer  { padding: 10px 14px 14px; }
    .detail-hero__media  { max-width: 200px; }
    .detail-hero__media img { max-height: 45vh; }
}
@media (max-width: 420px) {
    .offer-grid          { grid-template-columns: 1fr 1fr; }
    .offer-grid--compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .main-header { padding: 12px 14px; }
    .main-header__title { font-size: 17px; }
    .auth-card__title { font-size: 20px; }
    .detail-payout__value { font-size: 28px; }
}

/* --- Landing page ----------------------------------------------------- */
.auth-shell--landing {
    align-items: flex-start;
    padding: 0;
}
/* Landing has its own toggle inside .lp-nav__actions — hide the
   absolutely-positioned auth toggle so the two don't fight for space
   (it was overlapping "Create account" on mobile). */
.auth-shell--landing > .theme-toggle--auth { display: none; }
.auth-shell__main--landing {
    max-width: 1120px;
    padding: 24px 24px 64px;
}

.lp-nav {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
    padding: 8px 0 40px;
}
.lp-nav__brand {
    display: inline-flex; align-items: center; gap: 12px;
    color: var(--text-1); text-decoration: none; min-width: 0;
}
.lp-nav__logo { height: 36px; width: auto; object-fit: contain; }
.lp-nav__product {
    font-weight: 700; font-size: 14px; letter-spacing: 0.02em;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet));
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.lp-nav__actions { display: inline-flex; gap: 8px; flex-shrink: 0; }

.lp-hero {
    padding: 32px 0 56px;
    max-width: 880px;
}
.lp-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    height: 26px; padding: 0 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent-cyan) 12%, var(--surface-2));
    border: 1px solid color-mix(in srgb, var(--accent-cyan) 35%, var(--border-1));
    color: var(--text-1);
    font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    margin-bottom: 24px;
}
.lp-hero__title {
    margin: 0 0 18px;
    font-size: clamp(34px, 6vw, 60px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    font-weight: 800;
    color: var(--text-1);
}
.lp-grad {
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet));
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.lp-hero__lead {
    margin: 0 0 32px;
    font-size: clamp(15px, 1.6vw, 18px);
    line-height: 1.6;
    color: var(--text-2);
    max-width: 720px;
}
.lp-hero__cta {
    display: flex; flex-wrap: wrap; gap: 12px;
    margin-bottom: 28px;
}
.lp-hero__meta {
    display: flex; align-items: center; flex-wrap: wrap;
    gap: 12px;
    color: var(--text-3); font-size: 13px;
}
.lp-hero__meta strong { color: var(--text-1); font-weight: 700; }
.lp-dot {
    display: inline-block; width: 4px; height: 4px; border-radius: 50%;
    background: var(--border-2);
}

.lp-section { padding: 56px 0; border-top: 1px solid var(--border-1); }
.lp-section__head { max-width: 720px; margin: 0 0 36px; }
.lp-section__kicker {
    display: inline-block;
    font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--accent-cyan);
    margin-bottom: 10px;
}
.lp-section__title {
    margin: 0;
    font-size: clamp(22px, 3vw, 30px);
    line-height: 1.2; letter-spacing: -0.01em;
    color: var(--text-1); font-weight: 700;
}

.lp-feature-grid {
    display: grid; gap: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.lp-feature {
    padding: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border-2);
    border-radius: var(--r-xl);
    transition: border-color .15s ease, transform .15s ease;
}
.lp-feature:hover {
    border-color: color-mix(in srgb, var(--accent-cyan) 50%, var(--border-2));
    transform: translateY(-2px);
}
.lp-feature__icon {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: color-mix(in srgb, var(--accent-cyan) 14%, var(--surface-2));
    color: var(--accent-cyan);
    margin-bottom: 16px;
}
.lp-feature__icon svg { width: 20px; height: 20px; }
.lp-feature__title {
    margin: 0 0 8px; color: var(--text-1);
    font-size: 16px; font-weight: 700; letter-spacing: -0.005em;
}
.lp-feature__body { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.55; }

.lp-steps {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    counter-reset: lp-step;
}
.lp-step {
    position: relative;
    padding: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border-2);
    border-radius: var(--r-xl);
}
.lp-step__num {
    display: inline-block; font-family: var(--font-mono);
    font-size: 12px; font-weight: 600;
    color: var(--accent-violet);
    margin-bottom: 16px;
    letter-spacing: 0.04em;
}
.lp-step__title {
    margin: 0 0 8px; color: var(--text-1);
    font-size: 16px; font-weight: 700;
}
.lp-step__body { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.55; }

.lp-verticals { display: flex; flex-wrap: wrap; gap: 10px; }
.lp-vertical {
    display: inline-flex; align-items: center;
    padding: 8px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border-1);
    border-radius: 999px;
    color: var(--text-1);
    font-size: 13px; font-weight: 600;
}

.lp-cta {
    margin-top: 56px;
    padding: 56px 32px;
    border-radius: var(--r-xl);
    border: 1px solid var(--border-2);
    background:
        radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--accent-cyan) 24%, transparent), transparent 55%),
        radial-gradient(circle at 100% 100%, color-mix(in srgb, var(--accent-violet) 24%, transparent), transparent 55%),
        var(--card-bg);
    text-align: center;
}
.lp-cta__title {
    margin: 0 0 12px;
    font-size: clamp(22px, 3vw, 32px);
    font-weight: 800; letter-spacing: -0.01em;
    color: var(--text-1);
}
.lp-cta__lead {
    margin: 0 auto 24px; max-width: 600px;
    color: var(--text-2); font-size: 15px; line-height: 1.6;
}
.lp-cta__actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

.lp-footer {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 12px;
    margin-top: 56px; padding: 24px 0 0;
    border-top: 1px solid var(--border-1);
    color: var(--text-3); font-size: 13px;
}
.lp-footer a { color: var(--text-2); text-decoration: none; }
.lp-footer a:hover { color: var(--text-1); }
.lp-footer__right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

@media (max-width: 900px) {
    .lp-feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lp-steps        { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .auth-shell__main--landing { padding: 16px 16px 48px; }
    .lp-nav { padding-bottom: 24px; }
    .lp-nav__product { display: none; }
    .lp-hero { padding: 16px 0 32px; }
    .lp-section { padding: 40px 0; }
    .lp-feature-grid { grid-template-columns: 1fr; }
    .lp-cta { padding: 36px 18px; }
    .lp-footer { flex-direction: column; align-items: flex-start; }
}
