/* ============================================================
   Aura Design Tokens
   ============================================================ */
:root {
    /* Primary */
    --color-primary: #3C61F3;
    --color-primary-hover: #2550FA;
    --color-primary-light: #5B7CFF;
    --color-primary-tint: #e0e7ff;
    --color-primary-ring: rgba(60, 97, 243, 0.18);
    --color-primary-glow: rgba(60, 97, 243, 0.4);

    /* Semantic */
    --color-error: #D32F2F;
    --color-error-bg: #fdf0ef;
    --color-warning: #FBC02D;
    --color-success: #138500;
    --color-info: #4D26BD;

    /* Neutrals (zinc-based) */
    --color-foreground: #27272a;
    --color-muted-foreground: #52525b;
    --color-disabled: #a1a1aa;
    --color-border: #d4d4d8;
    --color-input-border: #d4d4d8;
    --color-divider: #e4e4e7;
    --color-muted: #e4e4e7;
    --color-hover-bg: #f4f4f5;
    --color-background: #fafafa;
    --color-card: #ffffff;
    --color-white: #ffffff;
    --color-overlay-backdrop: rgba(0, 0, 0, 0.4);
    --color-overlay-surface: rgba(255, 255, 255, 0.9);

    /* Status badges */
    --color-active-bg: #dcfce7;
    --color-active-text: #166534;
    --color-draft-bg: #e4e4e7;
    --color-draft-text: #52525b;
    --color-archived-bg: #fecdd3;
    --color-archived-text: #9f1239;
    --color-paused-bg: #fef9c3;
    --color-paused-text: #854d0e;
    --color-warning-muted: #b7791f;
    --color-error-strong: #b91c1c;
    --color-archived-border: #fda4af;

    /* Chat and AI affordances */
    --color-change-summary-bg: #fff8e1;
    --color-change-summary-border: #f1cf7a;
    --color-change-summary-text: #8a5b00;
    --color-ai-high: #fdcb6e;
    --color-ai-low: #fd7e14;
    --color-ai-high-ring: rgba(253, 203, 110, 0.7);
    --color-ai-high-ring-fade: rgba(253, 203, 110, 0);
    --color-ai-low-ring: rgba(253, 126, 20, 0.7);
    --color-ai-low-ring-fade: rgba(253, 126, 20, 0);

    /* Navbar */
    --color-navbar-bg: var(--color-card);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 12px 36px rgba(0, 0, 0, 0.14), 0 6px 12px rgba(0, 0, 0, 0.06);

    /* Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.625rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;

    /* Font */
    --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    font-feature-settings: "rlig" 1, "calt" 1;
    background: var(--color-background);
    color: var(--color-foreground);
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background: var(--color-navbar-bg);
    color: var(--color-foreground);
    padding: 0 2rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border);
}

.nav-brand a {
    color: var(--color-foreground);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.nav-brand .kera-logo {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.25em;
    color: var(--color-foreground);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.nav-links span {
    color: var(--color-muted-foreground);
}

.nav-links a {
    color: var(--color-primary);
    text-decoration: none;
}

.nav-links a:hover {
    text-decoration: underline;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.back-link {
    display: inline-block;
    color: var(--color-muted-foreground);
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.back-link:hover {
    color: var(--color-primary);
}

/* Card */
.card {
    background: var(--color-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: visible;
}

.card > .table thead th:first-child {
    border-top-left-radius: var(--radius-md);
}
.card > .table thead th:last-child {
    border-top-right-radius: var(--radius-md);
}

.form-card {
    padding: 2rem;
    max-width: 600px;
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table thead {
    background: var(--color-hover-bg);
}

.table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--color-muted-foreground);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--color-muted);
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-divider);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--color-hover-bg);
}

.table code {
    background: var(--color-divider);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85em;
}

.loading, .empty {
    text-align: center;
    color: var(--color-disabled);
    padding: 2rem !important;
}

/* Group link in table */
.group-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.group-link:hover {
    text-decoration: underline;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-active, .badge-draft {
    background: var(--color-draft-bg);
    color: var(--color-draft-text);
}

.badge-active {
    background: var(--color-active-bg);
    color: var(--color-active-text);
}

.badge-archived, .badge-inactive {
    background: var(--color-archived-bg);
    color: var(--color-archived-text);
}

.badge-paused {
    background: var(--color-paused-bg);
    color: var(--color-paused-text);
}

.badge-processing {
    background: var(--color-muted);
    color: var(--color-foreground);
    font-weight: 500;
}

/* Sync status dot indicator (green=synced, yellow=out-of-sync) */
.sync-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
}
.sync-dot::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.sync-synced { color: var(--color-active-text); background: var(--color-active-bg); }
.sync-synced::before { background: var(--color-success); }
.sync-unsynced { color: var(--color-paused-text); background: var(--color-paused-bg); }
.sync-unsynced::before { background: var(--color-warning); }
.sync-unknown { color: var(--color-muted-foreground); background: var(--color-hover-bg); }
.sync-unknown::before { background: var(--color-disabled); }

.badge-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--color-muted);
    border-top-color: var(--color-foreground);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
}

/* Type label */
.type-label {
    font-size: 0.8rem;
    color: var(--color-muted-foreground);
    text-transform: capitalize;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--color-border);
    background: var(--color-card);
    color: var(--color-foreground);
    cursor: pointer;
    transition: all 0.15s;
}

.btn:hover {
    background: var(--color-hover-bg);
    border-color: var(--color-disabled);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.btn-primary:disabled {
    background: var(--color-primary-light);
    border-color: var(--color-primary-light);
}

.btn-danger {
    color: var(--color-error);
    border-color: var(--color-error);
}

.btn-danger:hover {
    background: var(--color-error);
    color: var(--color-white);
}

.btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
}

.btn-full {
    width: 100%;
}

/* Search bar */
.search-bar {
    flex: 0 1 300px;
}

.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

.select-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    background: var(--color-card);
}

.btn-small {
    padding: 0.25rem 0.6rem;
    font-size: 0.78rem;
}

/* Direct link banner (search by ID) */
.direct-link-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-primary-tint);
    border: 1px solid var(--color-primary-light);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--color-primary-hover);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding: 0.5rem 0;
}

.page-info {
    color: var(--color-muted-foreground);
    font-size: 0.85rem;
}

.page-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--color-foreground);
}

.required {
    color: var(--color-error);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

.form-group input:disabled,
.form-group select:disabled {
    background: var(--color-divider);
    color: var(--color-disabled);
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.flex-1 {
    flex: 1;
}

.checkbox-group {
    display: flex;
    align-items: center;
    padding-bottom: 0.5rem;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400 !important;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-muted);
}

/* Actions cell */
.actions-cell {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.status-select {
    padding: 0.2rem 0.4rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    background: var(--color-card);
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 56px);
}

.login-card {
    background: var(--color-card);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
}

.login-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--color-muted-foreground);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.login-hint {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-muted);
    font-size: 0.8rem;
    color: var(--color-muted-foreground);
}

.login-hint code {
    background: var(--color-divider);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.85em;
}

.login-hint p {
    margin-bottom: 0.3rem;
}

/* Token textarea (login page) */
.token-textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-family: monospace;
    resize: vertical;
}

.token-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

/* Error */
.error-message {
    color: var(--color-error);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--color-error-bg);
    border-radius: var(--radius-sm);
}

/* ============================================================
   Create Deal -- Multi-section layout
   ============================================================ */

.create-deal-layout {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 1.5rem;
    align-items: start;
}

.form-main {
    min-width: 0;
}

/* Form sections */
.form-section {
    background: var(--color-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-divider);
    color: var(--color-foreground);
}

/* Deal type toggle buttons */
.type-toggles {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
}

.type-btn {
    padding: 0.75rem 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-card);
    color: var(--color-muted-foreground);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.type-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-tint);
}

.type-btn.active {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: var(--color-white);
}

/* Sidebar */
.form-sidebar {
    position: sticky;
    top: 1.5rem;
}

.sidebar-card {
    background: var(--color-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
}

.sidebar-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-foreground);
}

.completion-list {
    list-style: none;
}

.completion-list li {
    padding: 0.4rem 0;
    font-size: 0.85rem;
    color: var(--color-disabled);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.completion-list li.complete {
    color: var(--color-success);
}

.check-icon {
    font-size: 0.7rem;
}

/* Brand suggestions dropdown */
.suggestions-dropdown {
    position: absolute;
    z-index: 100;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
}

.suggestion-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
}

.suggestion-item:hover {
    background: var(--color-primary-tint);
}

/* Make form-group with suggestions relative */
.form-group {
    position: relative;
}

/* Inventory type checkboxes */
.inventory-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    margin-top: 0.25rem;
}

.inventory-checkboxes .checkbox-label {
    font-size: 0.85rem;
}

/* Toggle group (Off/On buttons) */
.toggle-group {
    display: inline-flex;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.toggle-btn {
    padding: 0.4rem 1rem;
    border: none;
    background: var(--color-card);
    color: var(--color-muted-foreground);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.toggle-btn + .toggle-btn {
    border-left: 1px solid var(--color-border);
}

.toggle-btn:hover {
    background: var(--color-primary-tint);
    color: var(--color-primary);
}

.toggle-btn.active {
    background: var(--color-primary);
    color: var(--color-white);
}

/* Section footer (bulk apply buttons) */
.section-footer {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-divider);
}

.bulk-apply-btn {
    background: var(--color-hover-bg);
    color: var(--color-muted-foreground);
    border: 1px dashed var(--color-disabled);
}

.bulk-apply-btn:hover {
    background: var(--color-primary-tint);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* Custom targeting rows */
.targeting-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.targeting-row input[type="text"] {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
}

.targeting-row select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    background: var(--color-card);
}

.targeting-row input[type="text"]:focus,
.targeting-row select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

.remove-targeting-row {
    padding: 0.25rem 0.5rem !important;
    line-height: 1;
    flex-shrink: 0;
}

/* Geo targeting */
.geo-country-block {
    background: var(--color-hover-bg);
    border: 1px solid var(--color-muted);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.geo-country-block + .geo-connector-and + .geo-country-block,
.geo-country-block + .geo-country-block {
    margin-top: 0.5rem;
}

.geo-zip-section {
    margin-top: 0.75rem;
}

.geo-zip-section .form-row {
    align-items: center;
}

.geo-zip-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.geo-zip-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--color-primary-tint);
    color: var(--color-primary-hover);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.geo-zip-tag .remove-zip {
    cursor: pointer;
    font-weight: 700;
    color: var(--color-muted-foreground);
    margin-left: 0.15rem;
}

.geo-zip-tag .remove-zip:hover {
    color: var(--color-error);
}

.geo-connector-and {
    text-align: center;
    color: var(--color-muted-foreground);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.geo-import-csv-label {
    cursor: pointer;
    white-space: nowrap;
}

/* ============================================================
   Tag Input Component -- reusable autocomplete + tag pills
   ============================================================ */

.tag-input-container {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    min-height: 38px;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-card);
    cursor: text;
    transition: border-color 0.15s;
}

.tag-input-container:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

.tag-input-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.tag-input {
    flex: 1;
    min-width: 120px;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0.25rem 0.25rem !important;
    font-size: 0.85rem;
    background: transparent;
}

.tag-input:disabled {
    cursor: not-allowed;
    background: transparent !important;
    color: var(--color-disabled) !important;
}

.tag-input-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 220px;
    overflow-y: auto;
    margin-top: -1px;
}

/* Tag pills */
.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--color-primary-tint);
    color: var(--color-primary-hover);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag-pill-meta {
    color: var(--color-muted-foreground);
    font-size: 0.72rem;
    font-weight: 500;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag-remove {
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-muted-foreground);
    line-height: 1;
    padding: 0 0.1rem;
    flex-shrink: 0;
}

.tag-remove:hover {
    color: var(--color-error);
}

/* Dropdown items */
.tag-dropdown-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--color-hover-bg);
    transition: background 0.1s;
}

.tag-dropdown-main {
    color: var(--color-foreground);
    line-height: 1.3;
}

.tag-dropdown-meta {
    margin-top: 0.1rem;
    color: var(--color-muted-foreground);
    font-size: 0.74rem;
    line-height: 1.25;
}

.tag-dropdown-item:last-child {
    border-bottom: none;
}

.tag-dropdown-item:hover {
    background: var(--color-primary-tint);
    color: var(--color-primary);
}

/* ============================================================
   Targeting Subsections -- shared layout for Include/Exclude
   ============================================================ */

.targeting-subsection {
    margin-bottom: 1rem;
}

.targeting-subsection:last-of-type {
    margin-bottom: 0;
}

.targeting-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

/* Key-value rows (vendor select + tag input) */
.targeting-kv-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.targeting-kv-row select {
    flex-shrink: 0;
    width: 140px;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    background: var(--color-card);
}

.targeting-kv-row select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

.targeting-kv-row .tag-input-container {
    flex: 1;
}

/* ============================================================
   Brand Safety Targeting
   ============================================================ */

.bs-vendor-select {
    flex-shrink: 0;
    width: 140px;
}

/* ============================================================
   Custom Targeting -- groups with AND/OR logic
   ============================================================ */

.custom-targeting-group {
    background: var(--color-hover-bg);
    border: 1px solid var(--color-muted);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0;
}

.ct-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.ct-group-header select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    background: var(--color-card);
}

.ct-group-header select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

.ct-keys {
    margin-bottom: 0.5rem;
}

.ct-key-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.ct-key-row:last-child {
    margin-bottom: 0;
}

.ct-key-row select {
    flex-shrink: 0;
    width: 140px;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    background: var(--color-card);
}

.ct-key-row select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

.ct-key-row .tag-input-container {
    flex: 1;
}

/* OR connector between custom targeting groups */
.targeting-or-connector {
    text-align: center;
    color: var(--color-primary);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================================
   Technographic Targeting -- mode selects + tag inputs
   ============================================================ */

.techno-mode-select {
    flex-shrink: 0;
    width: 120px;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    background: var(--color-card);
}

.techno-mode-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

/* ============================================================
   Zip Code Targeting Groups
   ============================================================ */

.zip-code-group {
    background: var(--color-hover-bg);
    border: 1px solid var(--color-muted);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.zip-code-group .form-row {
    margin-bottom: 0.5rem;
}

.zip-code-group .form-row:last-of-type {
    margin-bottom: 0;
}

.zip-csv-label {
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.8rem;
}

.zip-code-input {
    flex: 1;
}

/* Upload status messages */
.domain-upload-status,
.zip-upload-status {
    font-size: 0.8rem;
    margin-top: 0.4rem;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-sm);
    display: none;
}

.domain-upload-status:not(:empty),
.zip-upload-status:not(:empty) {
    display: block;
}

.status-success {
    background: var(--color-active-bg);
    color: var(--color-active-text);
}

.status-warn {
    background: var(--color-paused-bg);
    color: var(--color-paused-text);
}

.status-error {
    background: var(--color-archived-bg);
    color: var(--color-archived-text);
}

.status-info {
    background: var(--color-primary-tint);
    color: var(--color-primary-hover);
}

/* ============================================================
   Domain Targeting -- input row + tags
   ============================================================ */

.domain-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.4rem;
}

.domain-text-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
}

.domain-text-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

.domain-csv-label {
    cursor: pointer;
    white-space: nowrap;
}

.domain-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.35rem;
    max-height: 200px;
    overflow-y: auto;
}

.domain-count {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-muted-foreground);
    background: var(--color-divider);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    margin-right: 0.25rem;
    align-self: center;
}

/* ============================================================
   Section HR separators within form sections
   ============================================================ */

.form-section hr {
    border: none;
    border-top: 1px solid var(--color-divider);
    margin: 1rem 0;
}

/* ============================================================
   Info Tooltips -- hover "?" icons with help text
   ============================================================ */

.info-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-primary-light);
    color: var(--color-white);
    font-size: 0.65rem;
    font-weight: 700;
    font-style: normal;
    cursor: help;
    position: relative;
    vertical-align: middle;
    margin-left: 0.35rem;
    flex-shrink: 0;
    line-height: 1;
}

.info-tip:hover {
    background: var(--color-primary);
}

.info-tip .tip-text {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    padding: 0.65rem 0.75rem;
    background: var(--color-foreground);
    color: var(--color-white);
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.5;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 500;
    pointer-events: none;
    text-align: left;
    white-space: normal;
}

.info-tip .tip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--color-foreground);
}

.info-tip:hover .tip-text {
    display: block;
}

/* Final tooltip style wins in cascade (avoids legacy override left-aligning '?'). */
.info-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* When tooltip would overflow left side, anchor to left */
.info-tip.tip-left .tip-text {
    left: 0;
    transform: none;
}

.info-tip.tip-left .tip-text::after {
    left: 8px;
    transform: none;
}

/* ============================================================
   Action Dropdown -- per-row actions menu
   ============================================================ */

.action-dropdown {
    position: relative;
    display: inline-block;
}

.action-toggle {
    background: var(--color-hover-bg);
    border: 1px solid var(--color-border);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.25rem 0.5rem;
    letter-spacing: 2px;
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.action-toggle:hover {
    background: var(--color-muted);
}

.action-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 300;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    overflow: hidden;
}

.action-menu.open {
    display: block;
}

.action-menu.open-up {
    top: auto;
    bottom: calc(100% + 4px);
}

.action-item {
    display: block;
    width: 100%;
    padding: 0.55rem 0.85rem;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.85rem;
    color: var(--color-foreground);
    cursor: pointer;
    transition: background 0.1s;
}

.action-item:hover {
    background: var(--color-primary-tint);
    color: var(--color-primary);
}

.action-item.action-sync {
    font-weight: 500;
}

.action-item.action-sync:hover {
    background: var(--color-active-bg);
    color: var(--color-success);
}

.action-item.action-danger {
    color: var(--color-error);
}

.action-item.action-danger:hover {
    background: var(--color-error-bg);
    color: var(--color-error-strong);
}

a.action-item {
    text-decoration: none;
    color: var(--color-foreground);
}

.action-item + .action-item,
.action-item + a.action-item,
a.action-item + .action-item {
    border-top: 1px solid var(--color-divider);
}

/* ============================================================
   Confirmation Modal
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-overlay-backdrop);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-card {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 1.75rem;
    width: 100%;
    max-width: 440px;
    margin: 1rem;
}

.modal-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-foreground);
}

.modal-card p {
    font-size: 0.9rem;
    color: var(--color-muted-foreground);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.modal-text-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.modal-text-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

.modal-status {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ============================================================
   Loading Overlay -- full-page loading indicator
   ============================================================ */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-overlay-surface);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--color-muted);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    font-size: 1rem;
    color: var(--color-muted-foreground);
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .create-deal-layout {
        grid-template-columns: 1fr;
    }

    .form-sidebar {
        position: static;
    }

    .type-toggles {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
    }
}

/* ============================================================
   AI Chat Panel
   ============================================================ */

/* Floating action button */
.chat-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-white);
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    user-select: none;
    transition: background 0.15s, transform 0.15s;
}
.chat-fab:hover {
    background: var(--color-primary-hover);
    transform: scale(1.06);
}

/* Chat panel */
.chat-panel {
    position: fixed;
    bottom: 96px;
    right: 28px;
    width: 420px;
    max-height: 600px;
    background: var(--color-card);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}
.chat-panel.hidden {
    display: none;
}

/* Header -- white with bottom border */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--color-card);
    color: var(--color-foreground);
    border-bottom: 1px solid var(--color-divider);
    font-weight: 600;
    font-size: 0.95rem;
}
.chat-header button {
    background: none;
    border: none;
    color: var(--color-muted-foreground);
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.7;
    padding: 0 4px;
    transition: opacity 0.15s;
}
.chat-header button:hover { opacity: 1; }

/* Messages area -- white background, breathing room */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--color-card);
}

/* Bubbles */
.chat-bubble {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 0.875rem;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
}
.chat-bubble.user {
    align-self: flex-end;
    background: var(--color-card);
    color: var(--color-foreground);
    border: 1px solid var(--color-divider);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
    align-self: flex-start;
    background: transparent;
    color: var(--color-foreground);
    border: none;
    padding-left: 4px;
    border-bottom-left-radius: 4px;
}

/* Input row -- pill-shaped input */
.chat-input-row {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--color-divider);
    background: var(--color-card);
    align-items: center;
}
.chat-input-row input {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 0.875rem;
    outline: none;
}
.chat-input-row input:focus { border-color: var(--color-primary); }
.chat-input-row #chat-send {
    padding: 7px 14px;
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.chat-input-row #chat-send:hover:not(:disabled) { background: var(--color-primary-hover); }
.chat-input-row #chat-send:disabled,
.chat-input-row input:disabled { opacity: 0.55; cursor: not-allowed; }

/* Edit proposal card */
.chat-edit-proposal {
    background: var(--color-primary-tint);
    border: 1px solid var(--color-primary-light);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin: 8px 0;
    font-size: 13px;
}
.chat-edit-proposal-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-primary-hover);
}
.chat-edit-proposal-fields {
    list-style: none;
    padding: 0;
    margin: 0 0 10px 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.chat-edit-proposal-btn {
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}
.chat-edit-proposal-btn:hover { background: var(--color-primary-hover); }

/* Applied change summary card */
.chat-change-summary {
    background: var(--color-change-summary-bg);
    border: 1px solid var(--color-change-summary-border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin: 8px 0;
    font-size: 13px;
    color: var(--color-foreground);
}
.chat-change-summary-title {
    font-weight: 700;
    color: var(--color-change-summary-text);
    margin-bottom: 6px;
}
.chat-change-summary-list {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.chat-change-summary-note {
    margin-top: 8px;
    font-size: 12px;
    color: var(--color-muted-foreground);
}

/* Chat navigation links */
.chat-link {
    color: var(--color-primary);
    text-decoration: underline;
    word-break: break-all;
}
.chat-link:hover { color: var(--color-primary-hover); }

/* AI-filled field highlights */
@keyframes pulse-high {
    0%, 100% { box-shadow: 0 0 0 0 var(--color-ai-high-ring); }
    50% { box-shadow: 0 0 0 5px var(--color-ai-high-ring-fade); }
}
@keyframes pulse-low {
    0%, 100% { box-shadow: 0 0 0 0 var(--color-ai-low-ring); }
    50% { box-shadow: 0 0 0 5px var(--color-ai-low-ring-fade); }
}
.ai-fill-high {
    border-color: var(--color-ai-high) !important;
    animation: pulse-high 1.2s ease 2;
}
.ai-fill-low {
    border-color: var(--color-ai-low) !important;
    animation: pulse-low 1.2s ease 2;
}

/* AI evidence tooltip indicator */
.ai-evidence-tip {
    cursor: help;
    font-size: 0.75rem;
    color: var(--color-muted-foreground);
    font-weight: 600;
    margin-left: 2px;
}
.ai-evidence-tip:hover {
    color: var(--color-primary);
}

/* Chat file attach button */
.chat-attach-btn {
    padding: 0;
    width: 34px;
    height: 34px;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    font-size: 1.25rem;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    color: var(--color-muted-foreground);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.chat-attach-btn:hover:not(:disabled) {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-tint);
}
.chat-attach-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Chat file preview pill -- neutral colors */
.chat-file-preview {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    margin: 0 16px;
    background: var(--color-hover-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--color-foreground);
}
.chat-file-preview.hidden {
    display: none;
}
.chat-file-preview .file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 240px;
}
.chat-file-preview .file-remove {
    cursor: pointer;
    font-weight: 700;
    color: var(--color-muted-foreground);
    font-size: 0.85rem;
    flex-shrink: 0;
}
.chat-file-preview .file-remove:hover {
    color: var(--color-error);
}
.chat-file-preview.uploading {
    opacity: 0.7;
    animation: pulse-upload 1.2s ease-in-out infinite;
}
@keyframes pulse-upload {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.4; }
}

/* Responsive -- collapse panel on small screens */
@media (max-width: 480px) {
    .chat-panel {
        right: 0;
        bottom: 0;
        width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 70vh;
    }
    .chat-fab {
        bottom: 16px;
        right: 16px;
    }
}

/* -- Deal Status Bar (deal_group_detail) -- */
.deal-status-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 16px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.status-count-block {
    text-align: center;
    min-width: 48px;
}

.status-count {
    font-size: 1.4rem;
    font-weight: 700;
    display: block;
    color: var(--color-foreground);
}

.status-label {
    font-size: 0.75rem;
    color: var(--color-muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.push-all-status {
    font-size: 0.82rem;
    color: var(--color-muted-foreground);
}

.push-all-status.info {
    color: var(--color-muted-foreground);
}

.push-all-status.success {
    color: var(--color-success);
}

.push-all-status.warn {
    color: var(--color-warning-muted);
}

.push-all-status.error {
    color: var(--color-error);
}

/* -- Deal Info sidebar card (create_deal edit mode) -- */
.deal-id-row,
.deal-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.sidebar-label {
    font-size: 0.8rem;
    color: var(--color-muted-foreground);
}

.deal-status-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

/* -- Shared utilities -- */
.btn-secondary {
    background: var(--color-hover-bg);
    color: var(--color-foreground);
    border-color: var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-muted);
    border-color: var(--color-disabled);
}

/* -- Archived deal warning banner -- */
.archived-banner {
    background: var(--color-archived-bg);
    color: var(--color-archived-text);
    border: 1px solid var(--color-archived-border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ============================================================
   Audience Explorer
   ============================================================ */

.audience-steps {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.audience-step-tab {
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-card);
    color: var(--color-muted-foreground);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.audience-step-tab:hover {
    background: var(--color-hover-bg);
}

.audience-step-tab.active {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.audience-step-panel.hidden {
    display: none;
}

.hidden {
    display: none;
}

.page-subtitle {
    color: var(--color-muted-foreground);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.triggers-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.triggers-job-status {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-card);
    color: var(--color-foreground);
}

.triggers-job-status.info {
    background: var(--color-primary-tint);
    border-color: var(--color-primary-light);
    color: var(--color-primary-hover);
}

.triggers-job-status.warning {
    background: #fff8e1;
    border-color: #f1cf7a;
    color: #8a5b00;
}

.triggers-job-status.error {
    background: var(--color-error-bg);
    border-color: #ef9a9a;
    color: var(--color-error-strong);
}

.triggers-job-status.success {
    background: var(--color-active-bg);
    border-color: #86efac;
    color: var(--color-active-text);
}

.triggers-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.triggers-hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.triggers-hero-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    background: #eef5ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-size: 0.75rem;
    font-weight: 600;
}

.triggers-hero-copy {
    margin-top: 0.85rem;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--color-foreground);
    max-width: 760px;
}

.triggers-hero-card {
    margin-bottom: 1rem;
}

.triggers-stat-card {
    background: var(--color-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.1rem 1.25rem;
}

.triggers-stat-label {
    color: var(--color-muted-foreground);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.triggers-stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    margin-top: 0.5rem;
}

.triggers-stat-meta {
    color: var(--color-muted-foreground);
    font-size: 0.85rem;
    margin-top: 0.35rem;
}

.triggers-subsections {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.triggers-section-panel {
    margin-top: 1rem;
}

.triggers-overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 1rem;
}

.triggers-run-card {
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
}

.triggers-run-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.triggers-run-label {
    color: var(--color-muted-foreground);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.triggers-run-value {
    margin-top: 0.35rem;
    font-size: 0.95rem;
    font-weight: 500;
}

.triggers-run-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.triggers-run-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--color-divider);
}

.triggers-run-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.triggers-panel {
    margin-top: 1rem;
}

.triggers-inline-header {
    margin-bottom: 0.5rem;
}

.inventory-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-card);
    color: var(--color-muted-foreground);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.inventory-tab:hover {
    background: var(--color-hover-bg);
}

.inventory-tab.active {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.triggers-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.triggers-panel-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-foreground);
    margin-bottom: 0.25rem;
}

.table-subtitle {
    color: var(--color-muted-foreground);
    font-size: 0.78rem;
    margin-top: 0.2rem;
}

.section-desc {
    font-size: 0.88rem;
    color: var(--color-muted-foreground);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.table-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.table-link:hover {
    text-decoration: underline;
}

.triggers-form-page {
    max-width: 980px;
}

.triggers-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

.triggers-form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.triggers-empty-note {
    color: var(--color-muted-foreground);
    font-size: 0.85rem;
}

.triggers-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.triggers-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--color-primary-tint);
    color: var(--color-primary-hover);
    border-radius: var(--radius-full);
    padding: 0.38rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 500;
}

.triggers-chip button {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
}

.triggers-builder-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    background: var(--color-card);
}

.triggers-condition-card.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary-light);
}

.triggers-builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.triggers-builder-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-foreground);
}

.triggers-logic-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0;
    color: var(--color-muted-foreground);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.triggers-logic-divider::before,
.triggers-logic-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--color-divider);
}

.triggers-inline-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.triggers-picker-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
}

.triggers-picker-list {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-card);
    max-height: 260px;
    overflow-y: auto;
}

.triggers-picker-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--color-divider);
}

.triggers-picker-item:last-child {
    border-bottom: none;
}

.triggers-picker-item-title {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--color-foreground);
}

.triggers-picker-item-meta {
    font-size: 0.78rem;
    color: var(--color-muted-foreground);
}

.triggers-section-note {
    margin-top: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    background: var(--color-primary-tint);
    color: var(--color-primary-hover);
    border: 1px solid var(--color-primary-light);
    font-size: 0.86rem;
}

.triggers-demo-progress {
    margin-top: 0.9rem;
    padding: 0.95rem 1rem;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
}

.triggers-demo-progress-title {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #1d4ed8;
    margin-bottom: 0.65rem;
}

.triggers-demo-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.65rem;
}

.triggers-demo-step {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.7rem 0.8rem;
    background: var(--color-card);
}

.triggers-demo-step-label {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-muted-foreground);
}

.triggers-demo-step-value {
    margin-top: 0.28rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-foreground);
}

.triggers-demo-step-done {
    border-color: #86efac;
    background: #f0fdf4;
}

.triggers-demo-step-done .triggers-demo-step-value {
    color: #166534;
}

.triggers-source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.triggers-breaking-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
}

.triggers-breaking-filters .btn.active {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.triggers-source-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px auto;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.triggers-source-inspector-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.triggers-source-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-card);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

.triggers-source-card-recommended {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 1px #93c5fd;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.triggers-source-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.triggers-source-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--color-foreground);
}

.triggers-source-meta {
    color: var(--color-muted-foreground);
    font-size: 0.82rem;
    line-height: 1.45;
    margin-top: 0.45rem;
}

.triggers-source-reason {
    margin-top: 0.65rem;
    padding: 0.7rem 0.8rem;
    border-radius: var(--radius-md);
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    font-size: 0.8rem;
    line-height: 1.45;
}

.triggers-context-note {
    margin-top: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.65rem;
    border-radius: 999px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
    font-size: 0.76rem;
    font-weight: 600;
}

.triggers-market-context {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    margin-top: 0.8rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    background: var(--color-hover-bg);
    border: 1px solid var(--color-border);
}

.triggers-market-stat {
    display: grid;
    gap: 0.2rem;
}

.triggers-market-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-muted-foreground);
}

.triggers-market-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-foreground);
}

.triggers-market-story {
    margin-top: 0.7rem;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-md);
    background: #f8fbff;
    border: 1px solid #dbeafe;
    color: #1e3a8a;
    font-size: 0.82rem;
    line-height: 1.45;
    font-weight: 500;
}

.triggers-market-quality {
    margin-top: 0.7rem;
    display: grid;
    gap: 0.55rem;
}

.triggers-market-quality-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.triggers-market-quality-strong {
    background: #dcfce7;
    color: #166534;
}

.triggers-market-quality-good {
    background: #eff6ff;
    color: #1d4ed8;
}

.triggers-market-quality-warning {
    background: #fff7ed;
    color: #9a3412;
}

.triggers-market-quality-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: #fcfcfd;
    color: var(--color-muted-foreground);
    font-size: 0.78rem;
}

.triggers-source-footer {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.9rem;
    color: var(--color-muted-foreground);
    font-size: 0.78rem;
}

.triggers-run-button {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0;
    text-align: left;
    cursor: pointer;
}

.triggers-run-button:hover .triggers-run-row {
    background: var(--color-hover-bg);
}

.triggers-run-button:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-md);
}

.triggers-chat-card {
    padding: 1rem 1.25rem;
}

.triggers-chat-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
}

.triggers-chat-prompts {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--color-foreground);
    display: grid;
    gap: 0.55rem;
}

.triggers-demo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.9rem;
}

.triggers-demo-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-card);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    display: grid;
    gap: 0.7rem;
}

.triggers-demo-hero-card {
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.triggers-demo-card-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--color-foreground);
}

.triggers-demo-card-copy {
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--color-muted-foreground);
}

.triggers-demo-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.triggers-demo-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-hover-bg);
    color: var(--color-muted-foreground);
    font-size: 0.72rem;
}

.triggers-payoff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.75rem;
    margin-top: 0.8rem;
}

.triggers-payoff-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.85rem 0.95rem;
    background: var(--color-card);
}

.triggers-payoff-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-muted-foreground);
}

.triggers-payoff-value {
    margin-top: 0.25rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-foreground);
}

.triggers-payoff-meta {
    margin-top: 0.32rem;
    font-size: 0.78rem;
    color: var(--color-muted-foreground);
    line-height: 1.45;
}

.triggers-payoff-detail {
    margin-top: 0.75rem;
    padding: 0.8rem 0.95rem;
    border-radius: var(--radius-md);
    background: var(--color-hover-bg);
    border: 1px solid var(--color-border);
    font-size: 0.82rem;
    color: var(--color-foreground);
    line-height: 1.5;
}

.triggers-codearea {
    min-height: 240px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre;
}

@media (max-width: 860px) {
    .triggers-panel-header,
    .triggers-inline-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .triggers-overview-grid,
    .triggers-chat-grid,
    .triggers-picker-grid,
    .triggers-source-inspector-grid {
        grid-template-columns: 1fr;
    }

    .triggers-run-row,
    .triggers-source-footer {
        flex-direction: column;
    }

    .triggers-source-search {
        grid-template-columns: 1fr;
    }
}

.file-upload-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-name-label {
    font-size: 0.85rem;
    color: var(--color-muted-foreground);
}

/* Audience cards */
.audience-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.audience-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.audience-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.audience-card-num {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-primary);
}

.audience-card-id {
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--color-muted-foreground);
    font-family: monospace;
}

.audience-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Loading indicator (inline) */
.loading-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    color: var(--color-muted-foreground);
    font-size: 0.88rem;
}

.loading-spinner-sm {
    width: 20px;
    height: 20px;
    border: 3px solid var(--color-muted);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

/* Package summary in Step 3 */
.package-audience-summary {
    background: var(--color-hover-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.package-audience-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.package-audience-list li {
    font-size: 0.88rem;
}

/* Package result */
.package-result {
    margin-top: 1.25rem;
    background: var(--color-active-bg);
    border: 1px solid var(--color-success);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
}

.package-result h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-active-text);
    margin-bottom: 0.75rem;
}

.result-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.result-row label {
    font-weight: 500;
    font-size: 0.88rem;
    white-space: nowrap;
}

.copy-field {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.copy-field input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.85rem;
    background: var(--color-card);
}

/* KPI checkboxes */
.kpi-checkboxes {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.kpi-checkboxes .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.88rem;
    cursor: pointer;
}

/* Packages table */
.packages-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.packages-table th {
    text-align: left;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid var(--color-border);
    color: var(--color-muted-foreground);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.packages-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--color-divider);
}

.pkg-id-cell {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--color-muted-foreground);
}

.text-muted {
    color: var(--color-muted-foreground);
    font-size: 0.88rem;
}

/* ===========================================================================
   Nav Tabs (Direct / Curation / Audiences / Inventory)
   =========================================================================== */

.nav-tabs {
    display: flex;
    align-items: center;
    gap: 0;
}

.nav-tab {
    display: inline-flex;
    align-items: center;
    padding: 0 1rem;
    height: 56px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-muted-foreground);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.nav-tab:hover {
    color: var(--color-foreground);
    text-decoration: none;
}

.nav-tab-active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.nav-user span {
    color: var(--color-muted-foreground);
}

.nav-user a {
    color: var(--color-primary);
    text-decoration: none;
}

.nav-user a:hover {
    text-decoration: underline;
}

/* ===========================================================================
   Campaign Detail -- Nested Placement Tree
   =========================================================================== */

.campaign-info-bar {
    display: flex;
    gap: 2rem;
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.campaign-info-bar .info-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.campaign-info-bar .info-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted-foreground);
}

.campaign-info-bar .info-value {
    font-size: 0.9rem;
    color: var(--color-foreground);
}

.tree-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--color-divider);
}

.tree-section-header h2 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tree-section-header .count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--color-primary-tint);
    color: var(--color-primary);
}

.placement-row {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--color-divider);
    cursor: pointer;
    transition: background 0.1s;
    gap: 0.75rem;
}

.placement-row:hover {
    background: var(--color-hover-bg);
}

.placement-chevron {
    display: inline-block;
    font-size: 0.8rem;
    transition: transform 0.2s;
    color: var(--color-muted-foreground);
    width: 1rem;
    text-align: center;
    flex-shrink: 0;
}

.placement-row.expanded .placement-chevron {
    transform: rotate(90deg);
}

.placement-name {
    font-weight: 500;
    flex: 1;
    min-width: 0;
}

.placement-meta {
    font-size: 0.85rem;
    color: var(--color-muted-foreground);
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
}

.placement-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.placement-children {
    display: none;
    border-bottom: 1px solid var(--color-divider);
    background: var(--color-hover-bg);
}

.placement-row.expanded + .placement-children {
    display: block;
}

.nested-section {
    padding: 0.5rem 1.25rem 0.5rem 2.75rem;
}

.nested-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.nested-section-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.nested-row {
    display: flex;
    align-items: center;
    padding: 0.4rem 0;
    gap: 1rem;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--color-divider);
}

.nested-row:last-child {
    border-bottom: none;
}

.nested-row-field {
    color: var(--color-muted-foreground);
    font-size: 0.82rem;
}

.nested-row-name {
    flex: 1;
    min-width: 0;
    font-weight: 500;
}

.nested-row-actions {
    flex-shrink: 0;
}

/* Filter row for campaign list */
.filter-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-row select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: var(--font-family);
    background: var(--color-card);
    color: var(--color-foreground);
}

.filter-row select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-ring);
}

/* Form sections shared by campaign/placement/line-item/creative forms */
.form-section {
    margin-bottom: 1.5rem;
}

.form-section-title,
.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-divider);
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0;
}

.form-row .form-group {
    flex: 1;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    color: var(--color-foreground);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font-family);
    background: var(--color-card);
    color: var(--color-foreground);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-ring);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Loading overlay for edit pages */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-overlay-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--color-divider);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Checkbox groups in forms */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    cursor: pointer;
}

/* Info tooltips */
.info-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.info-tip .tip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 50%;
    background: var(--color-muted);
    color: var(--color-muted-foreground);
    cursor: help;
    margin-left: 0.3rem;
}

.info-tip .tip-icon + .tip-text {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.4rem 0.6rem;
    font-size: 0.78rem;
    background: var(--color-foreground);
    color: var(--color-card);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    z-index: 10;
    margin-bottom: 0.3rem;
}

.info-tip:hover .tip-icon + .tip-text {
    display: block;
}

/* Display Compatible Formats grid */
.display-formats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 1rem;
}
