/* ============================================================================
 * Ad Builder — modern design system rebuild
 *
 * Naming convention: every class is prefixed `abx-` so the rebuild can sit
 * alongside the legacy `.ab-*` rules during transition without collision
 * (legacy rules removed once nothing depends on them).
 *
 * Design tokens (declared once at the top of the page scope so they only
 * apply inside Ad Builder views — keeps the rest of the app untouched).
 * ============================================================================ */

.abx-page {
    /* Tokens */
    --abx-bg:           #f7f8fb;
    --abx-surface:      #ffffff;
    --abx-surface-soft: #fafbfc;
    --abx-text:         #0f172a;
    --abx-text-muted:   #6b7280;
    --abx-text-soft:    #4b5563;
    --abx-border:       rgba(15, 23, 42, 0.08);
    --abx-border-soft:  rgba(15, 23, 42, 0.05);
    --abx-accent:       #5B53E8;
    --abx-accent-soft:  rgba(99, 102, 241, 0.08);
    --abx-accent-ring:  rgba(99, 102, 241, 0.16);
    --abx-ok:           #15803d;
    --abx-ok-soft:      #dcfce7;
    --abx-warn:         #b45309;
    --abx-warn-soft:    #fef3c7;
    --abx-danger:       #b91c1c;
    --abx-danger-soft:  #fee2e2;
    --abx-info-soft:    #dbeafe;
    --abx-info-text:    #1d4ed8;

    --abx-shadow-1: 0 1px 2px rgba(15, 23, 42, 0.04);
    --abx-shadow-2: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.06);
    --abx-shadow-3: 0 4px 16px rgba(15, 23, 42, 0.06);
    --abx-shadow-pop: 0 12px 40px rgba(15, 23, 42, 0.16);

    --abx-radius-sm: 8px;
    --abx-radius:    12px;
    --abx-radius-lg: 16px;

    /* Page chrome */
    max-width: 1320px;
    margin: 28px auto 120px;
    padding: 0 28px;
    color: var(--abx-text);
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

/* ============================================================================
 * Page header
 * ============================================================================ */
.abx-page-header { margin-bottom: 24px; }
.abx-crumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--abx-text-muted);
    margin-bottom: 8px;
}
.abx-crumb { color: var(--abx-accent); text-decoration: none; }
.abx-crumb:hover { text-decoration: underline; }
.abx-crumb.is-current { color: var(--abx-text-muted); }
.abx-crumb-sep { color: rgba(15, 23, 42, 0.20); }

.abx-page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}
.abx-page-title-wrap { flex: 1; min-width: 0; }
.abx-page-title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--abx-text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.abx-page-subtitle {
    margin: 6px 0 0;
    font-size: 13.5px;
    color: var(--abx-text-muted);
    line-height: 1.55;
    max-width: 720px;
}
.abx-page-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ============================================================================
 * Stepper
 * ============================================================================ */
.abx-stepper-host {
    margin: 18px 0 24px;
    background: var(--abx-surface);
    border: 1px solid var(--abx-border);
    border-radius: var(--abx-radius);
    padding: 14px 20px;
    box-shadow: var(--abx-shadow-1);
}
.abx-stepper {
    display: flex;
    align-items: center;
    gap: 4px;
}
.abx-step {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.abx-step-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #e5e7eb;
    color: var(--abx-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.abx-step-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--abx-text-muted);
    transition: color 0.2s;
    white-space: nowrap;
}
.abx-step.is-current .abx-step-dot {
    background: var(--abx-accent);
    color: #fff;
    box-shadow: 0 0 0 4px var(--abx-accent-ring);
}
.abx-step.is-current .abx-step-label {
    color: var(--abx-text);
    font-weight: 600;
}
.abx-step.is-done .abx-step-dot {
    background: var(--abx-ok);
    color: #fff;
}
.abx-step.is-done .abx-step-label {
    color: var(--abx-ok);
}
.abx-step-bar {
    flex: 1;
    height: 1.5px;
    background: rgba(15, 23, 42, 0.08);
    border-radius: 1px;
    min-width: 24px;
}
/* Phones: four labelled steps are ~470px wide and were clipped by the card. Keep every
   dot, but show only the current step's label. */
@media (max-width: 640px) {
    .abx-step:not(.is-current) .abx-step-label { display: none; }
    .abx-step-bar { min-width: 12px; }
}

/* ============================================================================
 * Section card (the primary content container)
 * ============================================================================ */
.abx-form-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.abx-card {
    background: var(--abx-surface);
    border: 1px solid var(--abx-border);
    border-radius: var(--abx-radius-lg);
    overflow: hidden;
    box-shadow: var(--abx-shadow-2);
}
/* Stacked cards on the page (How it works → Recent briefs) touched edge to edge. */
.abx-card + .abx-card { margin-top: 16px; }
.abx-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--abx-border-soft);
}
.abx-card.is-dense .abx-card-head { padding: 14px 18px 10px; }
.abx-card-title-wrap { flex: 1; min-width: 0; }
.abx-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--abx-text);
    letter-spacing: -0.005em;
}
.abx-card-subtitle {
    margin: 4px 0 0;
    font-size: 12.5px;
    color: var(--abx-text-muted);
    line-height: 1.5;
}
.abx-card-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.abx-card-body {
    padding: 18px 22px 22px;
}
.abx-card.is-dense .abx-card-body { padding: 14px 18px; }

/* ============================================================================
 * Buttons
 * ============================================================================ */
.abx-btn {
    appearance: none;
    border: 1.5px solid var(--abx-border);
    background: var(--abx-surface);
    color: var(--abx-text);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.12s, border-color 0.12s, transform 0.05s, box-shadow 0.12s;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}
.abx-btn:hover:not(:disabled) {
    background: #f9fafb;
    border-color: rgba(15, 23, 42, 0.16);
}
.abx-btn:active:not(:disabled) { transform: translateY(1px); }
.abx-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.abx-btn.is-primary {
    background: var(--abx-accent);
    border-color: var(--abx-accent);
    color: #fff;
}
.abx-btn.is-primary:hover:not(:disabled) {
    background: #4f46e5;
    border-color: #4f46e5;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}
.abx-btn.is-danger {
    background: var(--abx-danger);
    border-color: var(--abx-danger);
    color: #fff;
}
.abx-btn.is-danger:hover:not(:disabled) {
    background: #991b1b;
    border-color: #991b1b;
}
.abx-btn.is-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--abx-text-muted);
}
.abx-btn.is-ghost:hover:not(:disabled) {
    background: #f3f4f6;
    color: var(--abx-text);
}
.abx-btn.is-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.abx-btn.is-lg { padding: 11px 20px; font-size: 14px; border-radius: 11px; font-weight: 600; }
.abx-btn-icon { display: inline-flex; align-items: center; flex-shrink: 0; }

/* Icon-only button (e.g. delete) */
.abx-icon-btn {
    appearance: none;
    border: 1.5px solid transparent;
    background: transparent;
    color: var(--abx-text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.abx-icon-btn:hover { background: #f3f4f6; color: var(--abx-text); }
.abx-icon-btn-danger:hover { background: var(--abx-danger-soft); color: var(--abx-danger); }
.abx-icon-btn:disabled { opacity: 0.35; cursor: default; }
.abx-icon-btn:disabled:hover { background: transparent; color: var(--abx-text-muted); }

/* ============================================================================
 * Status pill
 * ============================================================================ */
.abx-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    background: #f3f4f6;
    color: var(--abx-text-soft);
    line-height: 1;
}
.abx-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.abx-status.is-ok      { background: var(--abx-ok-soft);     color: var(--abx-ok); }
.abx-status.is-warn    { background: var(--abx-warn-soft);   color: var(--abx-warn); }
.abx-status.is-danger  { background: var(--abx-danger-soft); color: var(--abx-danger); }
.abx-status.is-info    { background: var(--abx-info-soft);   color: var(--abx-info-text); }
.abx-status.is-pending { background: rgba(99, 102, 241, 0.10); color: var(--abx-accent); }
.abx-status.is-pending .abx-status-dot { animation: abx-pulse 1.4s ease-in-out infinite; }
@keyframes abx-pulse {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 1; }
}

/* ============================================================================
 * Inputs / textareas
 * ============================================================================ */
.abx-input,
.abx-textarea {
    appearance: none;
    width: 100%;
    border: 1.5px solid #d1d5db;
    background: var(--abx-surface);
    color: var(--abx-text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.55;
    padding: 11px 14px;
    border-radius: 10px;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.abx-textarea { resize: vertical; min-height: 90px; }
.abx-input:focus,
.abx-textarea:focus {
    outline: none;
    border-color: var(--abx-accent);
    box-shadow: 0 0 0 3px var(--abx-accent-ring);
}
.abx-hint {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--abx-text-muted);
    line-height: 1.5;
}

/* ============================================================================
 * Segmented tabs (source: product / URL)
 * ============================================================================ */
.abx-segment {
    display: inline-flex;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 3px;
    margin-bottom: 14px;
    gap: 2px;
}
.abx-segment-tab {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--abx-text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}
.abx-segment-tab.is-active {
    background: var(--abx-surface);
    color: var(--abx-text);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

/* ============================================================================
 * Dropzone
 * ============================================================================ */
.abx-dropzone {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border: 1.5px dashed #d1d5db;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: var(--abx-surface-soft);
    color: var(--abx-text-muted);
}
.abx-dropzone:hover { border-color: var(--abx-accent); color: var(--abx-text); }
.abx-dropzone.is-drag {
    border-color: var(--abx-accent);
    background: var(--abx-accent-soft);
    color: var(--abx-accent);
}
.abx-dropzone svg { flex-shrink: 0; }
.abx-dropzone-text { display: flex; flex-direction: column; gap: 2px; }
.abx-dropzone-primary {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--abx-text);
}
.abx-dropzone-secondary { font-size: 12px; color: var(--abx-text-muted); }

.abx-thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.abx-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--abx-border);
}
.abx-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.abx-thumb-remove {
    position: absolute;
    top: 4px; right: 4px;
    appearance: none;
    border: 0;
    background: rgba(17, 24, 39, 0.78);
    color: #fff;
    width: 22px; height: 22px;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    backdrop-filter: blur(2px);
}
.abx-thumb-remove:hover { background: var(--abx-danger); }

/* ============================================================================
 * Action bar (sticky bottom of step views)
 * ============================================================================ */
.abx-actionbar {
    position: sticky;
    bottom: 18px;
    margin-top: 24px;
    background: var(--abx-surface);
    border: 1px solid var(--abx-border);
    border-radius: var(--abx-radius);
    padding: 12px 18px;
    box-shadow: var(--abx-shadow-3);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 10;
}
.abx-actionbar-summary {
    flex: 1;
    font-size: 13px;
    color: var(--abx-text-soft);
    font-variant-numeric: tabular-nums;
    min-width: 0;
}
.abx-actionbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Inline variations slider in the action bar */
.abx-variations-inline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 6px;
}
.abx-variations-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--abx-text-muted);
}
.abx-variations-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--abx-text);
    min-width: 22px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.abx-slider {
    width: 110px;
    appearance: none;
    height: 4px;
    background: #e5e7eb;
    border-radius: 999px;
    outline: none;
}
.abx-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--abx-accent);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
}

/* ============================================================================
 * Briefs gallery (landing view)
 * ============================================================================ */
.abx-briefs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: 12px;
}
.abx-brief-tile {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    background: var(--abx-surface);
    border: 1px solid var(--abx-border);
    border-radius: var(--abx-radius);
    padding: 16px 18px;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    box-shadow: var(--abx-shadow-1);
}
.abx-brief-tile:hover {
    border-color: var(--abx-accent);
    transform: translateY(-2px);
    box-shadow: var(--abx-shadow-3);
}
.abx-brief-tile-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--abx-text);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}
.abx-brief-tile-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.abx-brief-tile-head .abx-brief-tile-title { flex: 1; min-width: 0; }
.abx-brief-tile-thumb {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 10px;
    object-fit: cover;
    background: #f1f5f9;
    border: 1px solid var(--abx-border);
}
.abx-brief-tile-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--abx-text-muted);
}
.abx-dot-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.18);
    display: inline-block;
}
.abx-brief-tile-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}

/* ============================================================================
 * Skeleton loader
 * ============================================================================ */
.abx-skeleton-wrap { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.abx-skeleton-line {
    height: 14px;
    background: linear-gradient(110deg, #f1f5f9 30%, #e5e7eb 50%, #f1f5f9 70%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: abx-skel 1.4s linear infinite;
}
.abx-skeleton-line.is-tall { height: 22px; width: 60%; }
@keyframes abx-skel {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* ============================================================================
 * Empty state
 * ============================================================================ */
.abx-empty {
    padding: 36px 24px;
    text-align: center;
    border: 1px dashed rgba(15, 23, 42, 0.12);
    border-radius: var(--abx-radius);
    background: var(--abx-surface-soft);
    color: var(--abx-text-soft);
}
.abx-empty-icon {
    color: rgba(15, 23, 42, 0.32);
    margin-bottom: 12px;
    display: inline-flex;
}
.abx-empty-title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 600;
    color: var(--abx-text);
}
.abx-empty-body {
    margin: 0 auto;
    max-width: 460px;
    font-size: 12.5px;
    color: var(--abx-text-muted);
    line-height: 1.55;
}
.abx-empty-action { margin-top: 16px; }

/* ============================================================================
 * Platform picker (destination card on brief form)
 * ============================================================================ */
.abx-platform-host {}
.abx-platform-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.abx-platform-card {
    appearance: none;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    background: var(--abx-surface);
    border: 1.5px solid var(--abx-border);
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
.abx-platform-card:hover:not(.is-disabled) {
    border-color: var(--abx-accent);
    background: var(--abx-accent-soft);
}
.abx-platform-card.is-selected {
    border-color: var(--abx-accent);
    background: var(--abx-accent-soft);
    box-shadow: 0 0 0 3px var(--abx-accent-ring);
}
.abx-platform-card.is-disabled {
    opacity: 0.78;
    cursor: not-allowed;
    background: var(--abx-surface-soft);
}

/* Custom radio inside platform card / pick card */
.abx-radio {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    background: var(--abx-surface);
    transition: border-color 0.12s, background 0.12s;
    position: relative;
}
.abx-platform-card.is-selected .abx-radio {
    border-color: var(--abx-accent);
    background: var(--abx-accent);
}
.abx-platform-card.is-selected .abx-radio::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: #fff;
}

.abx-platform-logo {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: rgba(8, 102, 255, 0.10);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.abx-platform-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.abx-platform-title-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}
.abx-platform-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--abx-text);
}
.abx-platform-email {
    font-size: 11.5px;
    color: var(--abx-text-muted);
}

.abx-platform-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.abx-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    background: #f3f4f6;
    color: var(--abx-text-soft);
}
.abx-tag-label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-size: 10px;
    opacity: 0.7;
}
.abx-tag-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 280px;
}
.abx-tag.is-account { background: rgba(99, 102, 241, 0.10); color: #4f46e5; }
.abx-tag.is-pixel   { background: rgba(34, 197, 94, 0.10);  color: var(--abx-ok); }
.abx-tag.is-catalog { background: rgba(245, 158, 11, 0.12); color: var(--abx-warn); }

.abx-platform-warn {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--abx-warn);
    flex-wrap: wrap;
}
.abx-link {
    color: var(--abx-accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 12.5px;
}
.abx-link:hover { text-decoration: underline; }
.abx-platform-manage {
    margin-top: 12px;
    text-align: right;
}

/* ============================================================================
 * Plan editor — angle cards
 * ============================================================================ */
.abx-plan-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
}
.abx-summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.abx-summary-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    color: var(--abx-text-muted);
}
.abx-summary-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--abx-text);
}

.abx-angles-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.abx-angle-card {
    background: var(--abx-surface);
    border: 1px solid var(--abx-border);
    border-radius: var(--abx-radius);
    padding: 16px 18px;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.abx-angle-card:hover {
    border-color: rgba(15, 23, 42, 0.16);
    box-shadow: var(--abx-shadow-2);
}

.abx-angle-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.abx-angle-num {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    color: var(--abx-accent);
    background: var(--abx-accent-soft);
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.3px;
}
.abx-angle-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.abx-angle-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px dashed var(--abx-border-soft);
}
@media (max-width: 540px) {
    .abx-angle-bottom { grid-template-columns: 1fr; }
}
.abx-field-group { display: flex; flex-direction: column; gap: 4px; }
.abx-field-group-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    color: var(--abx-text-muted);
}

/* Inline-edit field (click to edit) */
.abx-inline-edit {
    position: relative;
}
.abx-inline-edit-display {
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: text;
    line-height: 1.5;
    font-size: 13px;
    color: var(--abx-text);
    transition: background 0.12s, border-color 0.12s;
    word-break: break-word;
}
.abx-inline-edit-display:hover { background: rgba(15, 23, 42, 0.03); }
.abx-inline-edit-display:focus {
    outline: none;
    background: rgba(15, 23, 42, 0.03);
    border-color: var(--abx-border);
}
.abx-inline-edit-display.is-empty {
    color: rgba(15, 23, 42, 0.32);
    font-style: italic;
}
.abx-inline-edit-input {
    width: 100%;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1.5px solid var(--abx-accent);
    background: var(--abx-surface);
    color: var(--abx-text);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 0 0 3px var(--abx-accent-ring);
    outline: none;
    resize: vertical;
}

/* Specific scaling per field */
.abx-angle-label .abx-inline-edit-display,
.abx-angle-label .abx-inline-edit-input {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}
.abx-angle-label { flex: 1; min-width: 0; }
.abx-angle-hook .abx-inline-edit-display,
.abx-angle-hook .abx-inline-edit-input {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--abx-text);
    letter-spacing: -0.01em;
    padding: 10px 12px;
}
.abx-angle-hook .abx-inline-edit-display {
    background: var(--abx-surface-soft);
    border-radius: 8px;
    margin-top: 4px;
}
.abx-angle-hook .abx-inline-edit-display:hover {
    background: rgba(99, 102, 241, 0.04);
    border-color: var(--abx-accent-soft);
}

/* Add-angle button (bottom of list) */
.abx-angle-add {
    appearance: none;
    border: 1.5px dashed rgba(15, 23, 42, 0.18);
    background: transparent;
    color: var(--abx-text-muted);
    padding: 14px 18px;
    border-radius: var(--abx-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.abx-angle-add:hover:not(:disabled) {
    border-color: var(--abx-accent);
    color: var(--abx-accent);
    background: var(--abx-accent-soft);
}

/* Blocker overlay during re-plan */
.abx-blocker {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 20;
    backdrop-filter: blur(2px);
}

/* ============================================================================
 * Counter strip (top of review grid)
 * ============================================================================ */
.abx-counter-strip {
    display: flex;
    align-items: center;
    gap: 24px;
    background: var(--abx-surface);
    border: 1px solid var(--abx-border);
    border-radius: var(--abx-radius);
    padding: 16px 20px;
    margin-bottom: 14px;
    box-shadow: var(--abx-shadow-1);
    flex-wrap: wrap;
}
.abx-counter-big {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-shrink: 0;
}
.abx-counter-big-num {
    font-size: 28px;
    font-weight: 800;
    color: var(--abx-ok);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.abx-counter-big-label {
    font-size: 12px;
    color: var(--abx-text-muted);
    font-weight: 500;
}
.abx-progress {
    flex: 1;
    height: 6px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
    min-width: 120px;
}
.abx-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--abx-accent), #8b5cf6);
    border-radius: 999px;
    transition: width 0.5s ease;
}
.abx-counter-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.abx-mini-stat {
    display: flex;
    align-items: baseline;
    gap: 5px;
}
.abx-mini-stat-num {
    font-size: 16px;
    font-weight: 700;
    color: var(--abx-text);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.abx-mini-stat-label {
    font-size: 11px;
    color: var(--abx-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}
.abx-mini-stat.is-pending .abx-mini-stat-num { color: var(--abx-accent); }
.abx-mini-stat.is-danger .abx-mini-stat-num  { color: var(--abx-danger); }

/* ============================================================================
 * Filter chips
 * ============================================================================ */
.abx-filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.abx-filter-host { min-width: 0; }
.abx-sort {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--abx-text-muted);
}
.abx-sort-label { font-weight: 600; }
.abx-sort-select {
    font-family: inherit;
    font-size: 13px;
    padding: 6px 10px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    background: var(--abx-surface);
    color: var(--abx-text);
    cursor: pointer;
}
.abx-sort-select:focus { outline: none; border-color: var(--abx-accent); box-shadow: 0 0 0 3px var(--abx-accent-ring); }
.abx-filter-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.abx-search {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 11px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    background: var(--abx-surface);
    color: var(--abx-text-muted);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.abx-search:focus-within {
    border-color: var(--abx-accent);
    box-shadow: 0 0 0 4px var(--abx-accent-ring);
    color: var(--abx-accent);
}
.abx-search svg { flex: none; }
.abx-search-input {
    border: 0;
    outline: 0;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    color: var(--abx-text);
    width: 150px;
    padding: 0;
}
.abx-search-input::placeholder { color: var(--abx-text-muted); }
.abx-search-count {
    flex: none;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--abx-text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    padding-left: 2px;
}
.abx-search-count[hidden] { display: none; }
/* Visually hidden but exposed to assistive tech (e.g. the aria-live status region). */
.abx-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.abx-briefs-search { margin-bottom: 16px; }
.abx-briefs-search .abx-search-input { width: 260px; max-width: 60vw; }

/* Bulk-selection bar — appears between the filter row and the grid when ≥1 card
   is checked. */
.abx-selbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 16px;
    padding: 10px 14px;
    border: 1.5px solid var(--abx-accent);
    border-radius: var(--abx-radius-lg, 12px);
    background: var(--abx-accent-soft);
}
.abx-selbar[hidden] { display: none; }
.abx-selbar-count { font-size: 13.5px; font-weight: 700; color: var(--abx-accent); }
.abx-selbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.abx-group-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    background: var(--abx-surface);
    color: var(--abx-text-muted);
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.abx-group-btn:hover { border-color: var(--abx-accent); color: var(--abx-text); }
.abx-group-btn.is-active { border-color: var(--abx-accent); color: var(--abx-accent); background: var(--abx-accent-ring, rgba(91, 83, 232, 0.12)); }
.abx-selectall-btn {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    background: var(--abx-surface);
    color: var(--abx-text-muted);
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s;
}
.abx-selectall-btn:hover { border-color: var(--abx-accent); color: var(--abx-accent); }
.abx-kbd-hint {
    margin-left: auto;   /* push to the far right of the tools row */
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border: 1.5px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--abx-text-muted);
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.abx-kbd-hint:hover { border-color: var(--abx-border); color: var(--abx-text); background: var(--abx-surface); }
.abx-kbd-hint kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    line-height: 1;
    padding: 2px 5px;
    border: 1px solid var(--abx-border);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: var(--abx-surface);
    color: var(--abx-text-muted);
}
.abx-grid-grouped { display: flex; flex-direction: column; gap: 24px; }
.abx-angle-group { display: flex; flex-direction: column; gap: 12px; }
.abx-angle-group-head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 0 0 6px;
    border: 0;
    border-bottom: 1px solid var(--abx-border);
    background: transparent;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}
.abx-angle-group-head:hover .abx-angle-group-title { color: var(--abx-accent); }
.abx-angle-caret { display: inline-flex; color: var(--abx-text-muted); transition: transform 0.15s; }
.abx-angle-caret svg { display: block; }
.abx-angle-group.is-collapsed .abx-angle-caret { transform: rotate(-90deg); }
.abx-angle-group-title { font-size: 14px; font-weight: 700; color: var(--abx-text); }
.abx-angle-group-count { font-size: 12px; color: var(--abx-text-muted); margin-left: auto; }
.abx-groups-bar { display: flex; justify-content: flex-end; margin-bottom: -12px; }
.abx-groups-toggle-all {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--abx-accent);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 4px;
}
.abx-groups-toggle-all:hover { text-decoration: underline; }
.abx-filter-chips {
    display: inline-flex;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 4px;
    gap: 2px;
    flex-wrap: wrap;
}
.abx-filter-chip {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--abx-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background 0.12s, color 0.12s;
    font-family: inherit;
}
.abx-filter-chip:hover { color: var(--abx-text); }
.abx-filter-chip.is-active {
    background: var(--abx-surface);
    color: var(--abx-text);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    font-weight: 600;
}
.abx-filter-chip-count {
    background: rgba(15, 23, 42, 0.08);
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    color: inherit;
    min-width: 16px;
    text-align: center;
}
.abx-filter-chip.is-active .abx-filter-chip-count {
    background: var(--abx-accent-soft);
    color: var(--abx-accent);
}

/* ============================================================================
 * Ad grid + cards
 * ============================================================================ */
.abx-grid-wrap { margin-bottom: 12px; }
.abx-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 640px) {
    .abx-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
    .abx-grid { grid-template-columns: repeat(3, 1fr); }
}

.abx-ad-card {
    background: var(--abx-surface);
    border: 1.5px solid var(--abx-border);
    border-radius: var(--abx-radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.abx-ad-card:hover { box-shadow: var(--abx-shadow-3); }
.abx-ad-card.is-approved {
    border-color: var(--abx-ok);
    background: linear-gradient(180deg, rgba(22, 163, 74, 0.04) 0%, var(--abx-surface) 30%);
}
.abx-ad-card.is-rejected { opacity: 0.55; }
.abx-ad-card.is-failed   { border-color: rgba(220, 38, 38, 0.4); }
.abx-ad-card.is-generating { border-style: dashed; }

.abx-ad-card-status {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    backdrop-filter: blur(4px);
    background: rgba(255, 255, 255, 0.85);
}

/* Bulk-select checkbox — top-right chip, above the hover overlay. */
.abx-ad-select {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(4px);
    cursor: pointer;
}
.abx-ad-select input { width: 16px; height: 16px; margin: 0; cursor: pointer; accent-color: var(--abx-accent); }
.abx-ad-card.is-selected {
    border-color: var(--abx-accent);
    box-shadow: 0 0 0 3px var(--abx-accent-ring);
}

.abx-ad-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f3f4f6;
    overflow: hidden;
    position: relative;
}
.abx-ad-img img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.abx-ad-card:hover .abx-ad-img img { transform: scale(1.03); }

.abx-ad-img-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0);
    transition: background 0.15s;
    pointer-events: none;
}
.abx-ad-card:hover .abx-ad-img-overlay {
    background: rgba(15, 23, 42, 0.32);
    pointer-events: auto;
}
.abx-ad-img-action {
    appearance: none;
    border: 0;
    background: rgba(255, 255, 255, 0.95);
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--abx-text);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.15s, transform 0.15s;
}
.abx-ad-card:hover .abx-ad-img-action {
    opacity: 1;
    transform: scale(1);
}

/* Per-field copy button in the detail drawer (hover-revealed) */
.abx-drawer-field-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.abx-copy-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--abx-text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    opacity: 0;
    transition: opacity 0.12s, color 0.12s, background 0.12s;
}
.abx-drawer-field:hover .abx-copy-btn,
.abx-copy-btn:focus-visible { opacity: 1; }
.abx-copy-btn:hover { color: var(--abx-accent); background: var(--abx-accent-ring, rgba(91, 83, 232, 0.12)); }
.abx-copy-btn.is-done { color: #16a34a; opacity: 1; }

.abx-ad-skel {
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(110deg, #f1f5f9 30%, #e5e7eb 50%, #f1f5f9 70%);
    background-size: 200% 100%;
    animation: abx-skel 1.4s linear infinite;
}
.abx-ad-skel-label { font-size: 12px; color: var(--abx-text-muted); }
.abx-ad-failed {
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--abx-danger);
}
.abx-ad-failed span { font-size: 12.5px; font-weight: 500; }

.abx-ad-body { padding: 14px 16px 12px; flex: 1; }
.abx-ad-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.abx-ad-cta {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--abx-accent);
    background: var(--abx-accent-soft);
    padding: 3px 8px;
    border-radius: 6px;
}
.abx-ad-dup {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--abx-text-muted);
    background: #f1f5f9;
    border-radius: 999px;
}
.abx-ad-dup svg { width: 11px; height: 11px; }
.abx-ad-headline {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    color: var(--abx-text);
    line-height: 1.35;
    letter-spacing: -0.01em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}
.abx-ad-primary {
    margin: 0 0 8px;
    font-size: 12.5px;
    color: var(--abx-text-soft);
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}
.abx-ad-audience {
    font-size: 11.5px;
    color: var(--abx-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.abx-ad-error {
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--abx-danger);
    line-height: 1.5;
}

.abx-ad-actions {
    display: flex;
    gap: 6px;
    padding: 10px 16px 14px;
    border-top: 1px solid var(--abx-border-soft);
}
.abx-vote {
    appearance: none;
    flex: 1;
    border: 1.5px solid var(--abx-border);
    background: var(--abx-surface);
    color: var(--abx-text-soft);
    padding: 8px 10px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.abx-vote-approve:hover { background: rgba(22, 163, 74, 0.08); color: var(--abx-ok); border-color: rgba(22, 163, 74, 0.3); }
.abx-vote-approve.is-active {
    background: var(--abx-ok);
    border-color: var(--abx-ok);
    color: #fff;
}
.abx-vote-reject:hover { background: rgba(220, 38, 38, 0.08); color: var(--abx-danger); border-color: rgba(220, 38, 38, 0.3); }
.abx-vote-reject.is-active {
    background: var(--abx-danger);
    border-color: var(--abx-danger);
    color: #fff;
}

/* ============================================================================
 * Detail drawer (click an ad image → fullscreen drawer)
 * ============================================================================ */
.abx-drawer-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    z-index: 1000;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    backdrop-filter: blur(4px);
}
/* Full-res image zoom overlay — above the drawer (z 1000). Click / Esc closes. */
.abx-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.85);
    cursor: zoom-out;
    opacity: 0;
    transition: opacity 0.15s;
}
.abx-lightbox.is-open { opacity: 1; }
.abx-lightbox-img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
/* Keyboard-shortcuts help (opened with '?') — above the drawer (z 1000). */
.abx-shortcuts {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.6);
    opacity: 0;
    transition: opacity 0.15s;
}
.abx-shortcuts.is-open { opacity: 1; }
.abx-shortcuts-panel {
    width: 100%;
    max-width: 380px;
    background: var(--abx-surface);
    border-radius: var(--abx-radius);
    box-shadow: var(--abx-shadow-pop);
    padding: 20px 22px;
}
.abx-shortcuts-title { margin: 0 0 14px; font-size: 15px; font-weight: 700; color: var(--abx-text); }
.abx-shortcuts-group { margin-bottom: 14px; }
.abx-shortcuts-group:last-of-type { margin-bottom: 0; }
.abx-shortcuts-h {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    color: var(--abx-text-muted);
    margin-bottom: 8px;
}
.abx-shortcuts-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
    font-size: 13px;
    color: var(--abx-text);
}
.abx-shortcuts-row > span:first-child { flex: 0 0 72px; }
.abx-shortcuts kbd {
    display: inline-block;
    min-width: 20px;
    padding: 2px 6px;
    font: 600 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
    text-align: center;
    color: var(--abx-text);
    background: #f1f5f9;
    border: 1px solid var(--abx-border);
    border-radius: 5px;
}
.abx-shortcuts-hint {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--abx-border);
    font-size: 11.5px;
    color: var(--abx-text-muted);
}
.abx-drawer {
    width: 520px;
    max-width: 96vw;
    height: 100%;
    background: var(--abx-surface);
    display: flex;
    flex-direction: column;
    box-shadow: var(--abx-shadow-pop);
    transform: translateX(20px);
    opacity: 0;
    transition: transform 0.22s ease-out, opacity 0.22s ease-out;
}
.abx-drawer.is-open { transform: translateX(0); opacity: 1; }
.abx-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--abx-border);
}
.abx-drawer-titlegroup {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;   /* let the title ellipsize instead of shoving the close button off */
}
.abx-drawer-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--abx-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.abx-drawer-pos {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--abx-text-muted);
}

.abx-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 22px 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.abx-drawer-img {
    position: relative;
    width: 100%;
    border-radius: var(--abx-radius);
    overflow: hidden;
    background: #f3f4f6;
}
.abx-drawer-img img {
    width: 100%;
    display: block;
}
.abx-drawer-img-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
}
.abx-drawer-img-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--abx-text);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.22);
    transition: background 0.12s, transform 0.12s;
}
.abx-drawer-img-btn:hover { background: #fff; transform: translateY(-1px); }
.abx-drawer-img-btn:disabled { opacity: 0.6; cursor: default; transform: none; }

.abx-drawer-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.abx-drawer-lineage {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--abx-text-muted);
    padding: 8px 10px;
    background: #f1f5f9;
    border-radius: 8px;
}
.abx-drawer-lineage svg { width: 13px; height: 13px; flex-shrink: 0; }
.abx-drawer-lineage-link {
    margin-left: auto;
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--abx-accent);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}
.abx-drawer-lineage-link:hover { text-decoration: underline; }
.abx-drawer-copyall-row { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.abx-drawer-copyall {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    padding: 5px 10px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    background: var(--abx-surface);
    color: var(--abx-text-muted);
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s;
}
.abx-drawer-copyall:hover { border-color: var(--abx-accent); color: var(--abx-accent); }
.abx-drawer-copyall svg { width: 14px; height: 14px; flex-shrink: 0; }
.abx-drawer-copyall.is-done { border-color: #16a34a; color: #16a34a; }
.abx-drawer-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.abx-drawer-field-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    color: var(--abx-text-muted);
}
.abx-drawer-field-value {
    margin: 0;
    font-size: 13.5px;
    color: var(--abx-text);
    line-height: 1.55;
}
.abx-drawer-field-value.is-empty {
    color: rgba(15, 23, 42, 0.32);
    font-style: italic;
}
.abx-drawer-kbd {
    margin-top: 6px;
    font-size: 11.5px;
    line-height: 1.9;
    color: var(--abx-text-muted);
}
.abx-drawer-kbd kbd {
    display: inline-block;
    padding: 1px 6px;
    font: 600 10.5px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--abx-text);
    background: #f1f5f9;
    border: 1px solid var(--abx-border);
    border-radius: 5px;
    vertical-align: middle;
}

.abx-drawer-footer {
    padding: 12px 22px;
    border-top: 1px solid var(--abx-border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ----------------------------------------------------------------------------
 * Ad heat bar — Meta performance overlay on each card.
 * Fed by /api/users/meta/insights.php (worker-driven).
 * --------------------------------------------------------------------------*/
.abx-ad-heat {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
    padding: 6px 10px;
    border-top: 1px solid var(--abx-border-faint, #f1f5f9);
    font-size: 11px;
    line-height: 1.3;
    cursor: help;
}
.abx-ad-heat-tag {
    font-weight: 600;
    white-space: nowrap;
}
.abx-ad-heat-metrics {
    color: var(--abx-text-muted, #64748b);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.abx-ad-heat.is-winner {
    background: linear-gradient(90deg, rgba(16,185,129,0.12), rgba(16,185,129,0.02));
    color: #047857;
}
.abx-ad-heat.is-winner .abx-ad-heat-metrics { color: #065f46; }
.abx-ad-heat.is-loser {
    background: linear-gradient(90deg, rgba(220,38,38,0.10), rgba(220,38,38,0.02));
    color: #b91c1c;
}
.abx-ad-heat.is-loser .abx-ad-heat-metrics { color: #991b1b; }
.abx-ad-heat.is-baseline {
    background: var(--abx-bg-subtle, #f8fafc);
    color: var(--abx-text, #334155);
}
.abx-ad-heat.is-pending {
    background: var(--abx-bg-subtle, #f8fafc);
    color: var(--abx-text-muted, #94a3b8);
    font-style: italic;
}

/* ----------------------------------------------------------------------------
 * Business type segmented control — sits above the brief textarea.
 * Three options: Ecommerce / Service / Lead-gen. Active state has accent
 * border + tinted background so the picked option reads at a glance.
 * --------------------------------------------------------------------------*/
.abx-biz-type-wrap {
    margin-bottom: 14px;
}
.abx-biz-type-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--abx-text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}
.abx-biz-type-seg {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}
.abx-biz-type-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 12px;
    background: var(--abx-bg, #ffffff);
    border: 1px solid var(--abx-border, #e2e8f0);
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: var(--abx-text, #1e293b);
    transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
.abx-biz-type-btn:hover {
    border-color: var(--abx-border-strong, #cbd5e1);
    background: var(--abx-bg-subtle, #f8fafc);
}
.abx-biz-type-btn.is-active {
    border-color: var(--abx-accent, #5B53E8);
    background: var(--abx-accent-soft, rgba(99, 102, 241, 0.08));
    box-shadow: 0 0 0 1px var(--abx-accent, #5B53E8) inset;
}
.abx-biz-type-btn.is-active .abx-biz-type-name { color: var(--abx-accent, #5B53E8); }
.abx-biz-type-icon {
    display: inline-flex;
    align-items: center;
    color: var(--abx-text-muted, #64748b);
}
.abx-biz-type-btn.is-active .abx-biz-type-icon { color: var(--abx-accent, #5B53E8); }
.abx-biz-type-name {
    font-size: 13px;
    font-weight: 600;
}
.abx-biz-type-sub {
    font-size: 11px;
    color: var(--abx-text-muted, #64748b);
}

/* Brief tile: delete control (two-step, never follows the tile link). */
.abx-brief-tile-del { margin-left: auto; font: inherit; font-size: 11.5px; font-weight: 600; color: #6b7280; background: none; border: 1px solid #e5e7eb; border-radius: 7px; padding: 3px 8px; cursor: pointer; }
.abx-brief-tile-del:hover { color: #B3261E; border-color: #F1B8B4; }
.abx-brief-tile-del.is-armed { color: #fff; background: #B3261E; border-color: #B3261E; }
.abx-brief-tile-del:disabled { opacity: .5; cursor: default; }
