/* ============================================
   Web Generator — Futuristic Dark UI
   ============================================ */

:root {
    /* ── Core palette (dark) ── */
    --color-bg:            #0d1625;
    --color-bg-2:          #111c30;
    --color-surface:       rgba(255,255,255,.07);
    --color-surface-alt:   rgba(255,255,255,.04);
    --color-surface-raised:rgba(255,255,255,.10);
    --color-border:        rgba(255,255,255,.11);
    --color-border-strong: rgba(255,255,255,.18);

    --color-text:          #dde6f0;
    --color-text-muted:    #8da4be;
    --color-text-subtle:   #4e6680;

    --color-primary:       #3b82f6;
    --color-primary-hover: #60a5fa;
    --color-primary-soft:  rgba(59,130,246,.12);
    --color-primary-glow:  rgba(59,130,246,.25);

    --color-accent:        #8b5cf6;
    --color-accent-soft:   rgba(139,92,246,.12);
    --color-cyan:          #22d3ee;
    --color-cyan-soft:     rgba(34,211,238,.1);

    --color-success:       #10b981;
    --color-success-soft:  rgba(16,185,129,.12);
    --color-warn:          #f59e0b;
    --color-warn-soft:     rgba(245,158,11,.12);
    --color-error:         #ef4444;
    --color-error-soft:    rgba(239,68,68,.12);

    /* Soft "text-on-dark" semantic shades. Views previously hardcoded these as
       hex (#6ee7b7, #fca5a5, …) which broke light mode — always use the token. */
    --color-success-text:  #6ee7b7;
    --color-warn-text:     #fcd34d;
    --color-error-text:    #fca5a5;
    --color-primary-text:  #93c5fd;

    /* ── Sidebar ── */
    --color-sidebar-bg:        rgba(4,8,18,.92);
    --color-sidebar-border:    rgba(255,255,255,.06);
    --color-sidebar-text:      rgba(255,255,255,.7);
    --color-sidebar-text-active: #ffffff;
    --color-sidebar-accent:    #3b82f6;
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 64px;

    /* ── Spacing ── */
    --space-1: 4px;   --space-2: 8px;   --space-3: 12px;
    --space-4: 16px;  --space-5: 24px;  --space-6: 32px;
    --space-7: 48px;  --space-8: 64px;

    /* ── Typography ── */
    --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
                 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas,
                 "Courier New", monospace;
    --font-display: var(--font-sans);

    /* ── Radius ── */
    --radius-sm: 5px;   --radius-md: 10px;
    --radius-lg: 14px;  --radius-xl: 20px;

    /* ── Shadows ── */
    --shadow-sm:  0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
    --shadow-md:  0 4px 16px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.3);
    --shadow-lg:  0 20px 50px rgba(0,0,0,.6), 0 8px 20px rgba(0,0,0,.4);
    --glow-blue:  0 0 20px rgba(59,130,246,.2), 0 0 40px rgba(59,130,246,.08);
    --glow-cyan:  0 0 20px rgba(34,211,238,.15);

    --content-max: 1120px;
    --transition: 160ms ease;
    --blur: blur(16px);
}

[data-theme="light"] {
    --color-bg:            #f0f4f8;
    --color-bg-2:          #e8edf3;
    --color-surface:       rgba(255,255,255,.85);
    --color-surface-alt:   rgba(0,0,0,.03);
    --color-surface-raised: #ffffff;
    --color-border:        rgba(0,0,0,.09);
    --color-border-strong: rgba(0,0,0,.15);

    --color-text:          #1a202c;
    --color-text-muted:    #4a5568;
    --color-text-subtle:   #a0aec0;

    --color-primary:       #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-soft:  rgba(37,99,235,.08);
    --color-primary-glow:  rgba(37,99,235,.15);

    --color-accent:        #7c3aed;
    --color-accent-soft:   rgba(124,58,237,.08);
    --color-cyan:          #0891b2;
    --color-cyan-soft:     rgba(8,145,178,.08);

    --color-success:       #059669;
    --color-success-soft:  rgba(5,150,105,.1);
    --color-warn:          #d97706;
    --color-warn-soft:     rgba(217,119,6,.1);
    --color-error:         #dc2626;
    --color-error-soft:    rgba(220,38,38,.1);

    /* Soft semantic text — darker variants for light backgrounds. */
    --color-success-text:  #047857;
    --color-warn-text:     #b45309;
    --color-error-text:    #b91c1c;
    --color-primary-text:  #1d4ed8;

    --color-sidebar-bg:        #ffffff;
    --color-sidebar-border:    rgba(0,0,0,.08);
    --color-sidebar-text:      rgba(0,0,0,.65);
    --color-sidebar-text-active: #1a202c;
    --color-sidebar-accent:    #2563eb;

    --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:  0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
    --shadow-lg:  0 10px 40px rgba(0,0,0,.1), 0 4px 12px rgba(0,0,0,.06);
    --glow-blue:  0 0 16px rgba(37,99,235,.12);
    --glow-cyan:  0 0 16px rgba(8,145,178,.1);

    /* ── Remap hardcoded rgba(255,255,255,*) backgrounds → dark-on-light ── */
    --white-overlay-01: rgba(0,0,0,.03);
    --white-overlay-02: rgba(0,0,0,.04);
    --white-overlay-03: rgba(0,0,0,.05);
    --white-overlay-04: rgba(0,0,0,.06);
    --white-overlay-06: rgba(0,0,0,.08);
    --white-overlay-08: rgba(0,0,0,.10);
    --white-overlay-10: rgba(0,0,0,.12);
    --white-overlay-12: rgba(0,0,0,.14);
    --white-overlay-14: rgba(0,0,0,.18);

    /* Badge / flash colors → darker for light bg */
    --color-text-badge-draft: #64748b;
    --color-text-badge-archived: #475569;
    --color-text-badge-soft: #4a5568;
    --color-text-flash-success: #065f46;
    --color-text-flash-error: #991b1b;
    --color-text-flash-warn: #92400e;
    --color-text-flash-info: #1e40af;
}

[data-theme="light"] {
    /* ── Form inputs ── */
    .form-input, .field-input,
    .feed-composer-input,
    .rte-select,
    .logo-upload-row input[type="file"],
    select.field-input { background: #fff; border-color: rgba(0,0,0,.15); }

    /* ── Buttons in light mode ── */
    /* default ghost / neutral button */
    .btn:not(.btn-primary):not(.btn-danger) { background: rgba(0,0,0,.04); }
    .btn:not(.btn-primary):not(.btn-danger):hover { background: rgba(0,0,0,.08); }
    /* btn-ghost is always a transparent style */
    .btn-ghost { background: transparent; border-color: rgba(0,0,0,.12); }
    .btn-ghost:hover { background: rgba(0,0,0,.04); }
    /* btn-primary keeps its gradient */
    .btn-primary {
        background: linear-gradient(135deg, #2563eb 0%, #6366f1 100%);
        color: #fff;
        border-color: rgba(99,102,241,.4);
        box-shadow: 0 2px 8px rgba(37,99,235,.25), 0 0 0 1px rgba(37,99,235,.15);
    }
    .btn-primary:hover {
        background: linear-gradient(135deg, #3b82f6 0%, #818cf8 100%);
        color: #fff;
        transform: translateY(-1px);
        box-shadow: 0 6px 20px rgba(37,99,235,.35), 0 0 0 1px rgba(99,102,241,.3);
    }

    /* ── Sidebar brand text ── */
    .sidebar-brand { color: #1a202c; }
    .sidebar-brand:hover { color: #1a202c; }
    .sidebar-brand-text {
        background: linear-gradient(135deg, #1a202c 30%, #2563eb 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    .sidebar-link:hover { background: rgba(0,0,0,.04); }
    .sidebar-user:hover { background: rgba(0,0,0,.03); }
    .sidebar-tool-btn { border-color: rgba(0,0,0,.1); }
    .sidebar-tool-btn:hover { background: rgba(0,0,0,.04); }

    /* ── Tables ── */
    .project-table thead th,
    .data-table thead th { background: rgba(0,0,0,.03); }
    .project-table tbody tr:hover,
    .data-table tbody tr:hover,
    .reporting-table tbody tr:hover { background: rgba(0,0,0,.025); }

    /* ── Badges ── */
    .badge-status-draft {
        background: rgba(0,0,0,.05);
        color: var(--color-text-badge-draft);
        border-color: rgba(0,0,0,.1);
    }
    .badge-status-archived {
        background: rgba(0,0,0,.04);
        color: var(--color-text-badge-archived);
        border-color: rgba(0,0,0,.08);
    }
    .badge-soft {
        background: rgba(0,0,0,.05);
        color: var(--color-text-badge-soft);
        border-color: rgba(0,0,0,.1);
    }

    /* ── Background overlays (rgba(255,255,255,x) → rgba(0,0,0,x)) ── */
    .auth-card { background: #fff; }
    .tf-mode-group { background: rgba(0,0,0,.03); }
    .tf-mode-btn { background: rgba(0,0,0,.03); }
    .tf-mode-btn:hover { background: rgba(0,0,0,.06); }
    .tf-mode-group .tf-mode-btn:hover { background: rgba(0,0,0,.06); }
    .mode-card-inner { background: rgba(0,0,0,.03); }
    .font-pairing-inner { background: #fff; }
    .repeater-row { background: rgba(0,0,0,.025); }
    .gen-result-summary { background: rgba(0,0,0,.03); }
    .page-preview-head { background: rgba(0,0,0,.03); }
    .section-card-foot { background: rgba(0,0,0,.02); }
    .provider-card-head { background: rgba(0,0,0,.02); }
    .provider-card-foot { background: rgba(0,0,0,.02); }
    .website-mini-row { background: rgba(0,0,0,.03); }
    .seo-page-item { background: rgba(0,0,0,.03); }
    .seo-live-score { background: rgba(0,0,0,.03); }
    .radio-option { background: rgba(0,0,0,.03); }
    .sections-filter { background: rgba(0,0,0,.03); }
    .sections-filter-pill:hover { background: rgba(0,0,0,.05); }
    .rte-toolbar { background: rgba(0,0,0,.03); }
    .rte-btn:hover:not(:disabled) { background: rgba(0,0,0,.06); }
    .rte-editor blockquote { background: rgba(0,0,0,.03); }
    .rte-editor code { background: rgba(0,0,0,.06); }
    .tab-nav { background: rgba(0,0,0,.02); }
    .tab-nav-link:hover { background: rgba(0,0,0,.04); }
    .wizard-step-num { background: rgba(0,0,0,.05); }
    .step-nav-item:hover { background: rgba(0,0,0,.04); }
    .step-nav-num { background: rgba(0,0,0,.06); }
    .sections-progress-bar { background: rgba(0,0,0,.06); }
    .gen-dot-num { background: rgba(0,0,0,.05); }
    .gen-dot-line { background: rgba(0,0,0,.08); }
    .gen-dot-skipped .gen-dot-num { background: rgba(0,0,0,.03); }
    .gen-progress-bar { background: rgba(0,0,0,.06); }
    .feed-composer-input { background: rgba(0,0,0,.04); }
    .feed-composer-input:focus { background: #fff; }
    .feed-composer-input::placeholder { color: rgba(0,0,0,.35); }
    .feed-media-btn:hover { background: rgba(0,0,0,.05); }
    .feed-action-btn:hover { background: rgba(0,0,0,.04); }
    .seo-bar-wrap { background: rgba(0,0,0,.06); }
    .seo-score-bar-wrap { background: rgba(0,0,0,.06); }

    /* ── Flash messages (dark text on soft bg) ── */
    .flash-success { color: var(--color-text-flash-success); }
    .flash-error { color: var(--color-text-flash-error); }
    .flash-warning, .flash-warn { color: var(--color-text-flash-warn); }
    .flash-info { color: var(--color-text-flash-info); }

    /* ── All badge statuses / variants ── */
    .badge-mode,
    .badge-primary { background: rgba(37,99,235,.12); color: #1d4ed8; border-color: rgba(37,99,235,.25); }
    .badge-status-brief_complete,
    .badge-page-status-brief_complete { background: rgba(37,99,235,.12); color: #1d4ed8; border-color: rgba(37,99,235,.25); }
    .badge-status-generating,
    .badge-status-reviewing,
    .badge-status-deploying,
    .badge-page-status-generating,
    .badge-page-status-generated { background: rgba(217,119,6,.12); color: #b45309; border-color: rgba(217,119,6,.25); }
    .badge-status-generated,
    .badge-status-approved,
    .badge-status-deployed,
    .badge-type,
    .badge-success,
    .badge-page-status-validated,
    .badge-page-status-approved { background: rgba(5,150,105,.12); color: #059669; border-color: rgba(5,150,105,.25); }
    .badge-status-failed,
    .badge-page-status-rejected,
    .badge-page-status-failed { background: rgba(220,38,38,.12); color: #dc2626; border-color: rgba(220,38,38,.25); }
    .badge-warn,
    .badge-warning { background: rgba(217,119,6,.12); color: #b45309; border-color: rgba(217,119,6,.25); }
    .badge-site-options { background: rgba(124,58,237,.12); color: #7c3aed; border-color: rgba(124,58,237,.25); }
    .badge-status-archived,
    .badge-disabled { background: rgba(0,0,0,.04); color: #64748b; border-color: rgba(0,0,0,.08); }

    /* ── TF badges ── */
    .tf-badge.badge-success { background: rgba(5,150,105,.12); color: #059669; border-color: rgba(5,150,105,.25); }
    .tf-badge.badge-warning { background: rgba(217,119,6,.12); color: #b45309; border-color: rgba(217,119,6,.25); }
    .tf-badge.badge-danger  { background: rgba(220,38,38,.12); color: #dc2626; border-color: rgba(220,38,38,.25); }
    .tf-badge.badge-soft    { background: rgba(0,0,0,.04); color: #64748b; border-color: rgba(0,0,0,.08); }

    /* ── Pages note ── */
    .pages-note { background: rgba(37,99,235,.08); color: #1d4ed8; border-color: rgba(37,99,235,.2); }

    /* ── Misc hardcoded bgs ── */
    .modal-dialog { background: #fff; }
    .gen-progress-card {
        background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    }
    .rte-wrap { background: #fff; }
    .form-input option, .field-input option { background: #fff; }
    .feed-post-actions { border-top-color: rgba(0,0,0,.08); }
    .logo-upload-row input[type="file"]::file-selector-button {
        background: rgba(0,0,0,.06);
    }
    .logo-upload-row input[type="file"]::file-selector-button:hover {
        background: rgba(0,0,0,.10);
    }
    .body-auth { background: #f0f4f8; }
    .field-color { background: #fff; }

    /* ── Second .btn-danger (overrides gradient) ── */
    .btn-danger {
        background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
        color: #fff;
        box-shadow: 0 2px 8px rgba(239,68,68,.25);
        border-color: transparent;
    }
    .btn-danger:hover {
        background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
        color: #fff;
        border-color: transparent;
    }
    .badge-warning {
        background: rgba(217,119,6,.12);
        color: #b45309;
        border: 1px solid rgba(217,119,6,.25);
    }

    /* ── Section badges ── */
    .section-badge-built {
        background: rgba(5,150,105,.12);
        color: #059669;
        border-color: rgba(5,150,105,.25);
    }
    .section-badge-stub { background: rgba(0,0,0,.04); color: #64748b; border-color: rgba(0,0,0,.08); }

    /* ── Provider type badges ── */
    .provider-type-anthropic { background: rgba(124,58,237,.12); color: #7c3aed; border-color: rgba(124,58,237,.25); }
    .provider-type-ollama    { background: rgba(5,150,105,.12); color: #059669; border-color: rgba(5,150,105,.25); }
    .provider-type-openai_compatible { background: rgba(13,148,136,.1); color: #0f766e; border-color: rgba(13,148,136,.2); }
    .provider-enabled-badge  { background: rgba(5,150,105,.12); color: #059669; border-color: rgba(5,150,105,.25); }
    .provider-disabled-badge { background: rgba(0,0,0,.04); color: #64748b; border-color: rgba(0,0,0,.08); }

    /* ── Chip category ── */
    .chip-category { color: #059669; background: rgba(5,150,105,.12); }

    /* ── Body dot grid ── */
    body {
        background-image:
            radial-gradient(ellipse 80% 50% at 50% -10%, rgba(59,130,246,.1) 0%, transparent 65%),
            radial-gradient(circle at 1px 1px, rgba(0,0,0,.055) 1px, transparent 0);
    }
}

/* ─── Reset ─────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* subtle dot-grid background */
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(59,130,246,.16) 0%, transparent 65%),
        radial-gradient(circle at 1px 1px, rgba(255,255,255,.055) 1px, transparent 0);
    background-size: 100% 100%, 28px 28px;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 var(--space-4);
    font-weight: 700;
    line-height: 1.22;
    color: var(--color-text);
    letter-spacing: -0.025em;
}

h1 { font-size: 30px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

p { margin: 0 0 var(--space-4); }

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover { color: var(--color-primary-hover); text-decoration: none; }

code {
    font-family: var(--font-mono);
    font-size: 12.5px;
    background: rgba(59,130,246,.1);
    border: 1px solid rgba(59,130,246,.2);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--color-cyan);
}

/* ─── Layout — Sidebar ───────────────────────── */

body { padding-left: var(--sidebar-width); transition: padding-left .25s ease; }
body.sidebar-collapsed { padding-left: var(--sidebar-collapsed-width); }

.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--color-sidebar-bg);
    border-right: 1px solid var(--color-sidebar-border);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: width .25s ease;
    overflow: hidden;
}
.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); }

/* Brand in sidebar */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: var(--space-4) var(--space-4);
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    min-height: 58px;
}
.sidebar-logo-img {
    width: 100%;
    height: auto;
    max-height: 90px;
    object-fit: contain;
    display: block;
}
.sidebar-collapsed .sidebar-logo-img { max-height: 28px; }
.sidebar-collapsed .sidebar-brand { justify-content: center; padding: var(--space-4) 0; }
.sidebar-brand:hover { color: #fff; opacity: .9; text-decoration: none; }

.sidebar-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: #fff;
    border-radius: 8px;
    font-size: 17px;
    flex-shrink: 0;
    box-shadow: 0 0 14px rgba(59,130,246,.4);
}

.sidebar-brand-text {
    background: linear-gradient(135deg, #fff 30%, #93c5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-collapsed .sidebar-brand-text { display: none; }

/* Nav links */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2) var(--space-3);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    color: var(--color-sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-link:hover {
    color: var(--color-sidebar-text-active);
    background: rgba(255,255,255,.06);
    text-decoration: none;
}
.sidebar-link-active {
    color: var(--color-sidebar-text-active) !important;
    background: rgba(59,130,246,.18);
    box-shadow: inset 0 0 0 1px rgba(59,130,246,.25);
}
[data-theme="light"] .sidebar-link-active {
    background: rgba(37,99,235,.1);
    box-shadow: inset 0 0 0 1px rgba(37,99,235,.2);
}

.sidebar-icon {
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    font-size: 16px;
}
.sidebar-label { flex: 1; }
.sidebar-collapsed .sidebar-label { display: none; }
.sidebar-collapsed .sidebar-link { justify-content: center; padding: var(--space-2) 0; }

/* Sidebar divider */
.sidebar-divider {
    height: 1px;
    background: var(--color-sidebar-border);
    margin: var(--space-2) var(--space-3);
}

/* Sidebar footer (profile + theme toggle) */
.sidebar-footer {
    border-top: 1px solid var(--color-sidebar-border);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2);
    color: var(--color-sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    overflow: hidden;
}
.sidebar-user:hover { color: var(--color-sidebar-text-active); text-decoration: none; background: rgba(255,255,255,.04); }
.sidebar-user-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
}
.sidebar-user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.sidebar-collapsed .sidebar-user-name { display: none; }

/* Theme toggle + collapse toggle row */
.sidebar-toolbar {
    display: flex;
    gap: var(--space-1);
}
.sidebar-collapsed .sidebar-toolbar { justify-content: center; }

.sidebar-tool-btn {
    flex: 1;
    background: none;
    border: 1px solid var(--color-sidebar-border);
    color: var(--color-sidebar-text);
    padding: 6px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.sidebar-tool-btn:hover { color: var(--color-sidebar-text-active); background: rgba(255,255,255,.05); }
.sidebar-tool-label { font-size: 12px; }
.sidebar-collapsed .sidebar-tool-label { display: none; }

/* Logout button in sidebar */
.sidebar-logout {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2);
    color: var(--color-sidebar-text);
    background: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    transition: all var(--transition);
    width: 100%;
}
.sidebar-logout:hover { color: var(--color-error); background: rgba(239,68,68,.08); }
.sidebar-collapsed .sidebar-logout { justify-content: center; }
.sidebar-logout-form { margin: 0; }

/* Main content */
.main-wrap {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--space-6) var(--space-5) var(--space-8);
    width: 100%;
    flex: 1;
}

.site-footer {
    background: var(--color-sidebar-bg);
    border-top: 1px solid var(--color-sidebar-border);
    padding: var(--space-4) var(--space-5);
    margin-top: auto;
    backdrop-filter: var(--blur);
}

.site-footer-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--color-text-subtle);
}

/* Mobile hamburger */
.sidebar-toggle-mobile {
    display: none;
    background: none;
    border: none;
    color: var(--color-text);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
}

/* ─── Buttons ─────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 13.5px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    color: var(--color-text);
    background: rgba(255,255,255,.08);
    gap: var(--space-2);
    white-space: nowrap;
    font-family: inherit;
    letter-spacing: -0.01em;
}
.btn:hover { text-decoration: none; color: var(--color-text); background: rgba(255,255,255,.12); }

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: #fff;
    border-color: rgba(99,102,241,.4);
    box-shadow: 0 2px 8px rgba(59,130,246,.3), 0 0 0 1px rgba(59,130,246,.2);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #818cf8 100%);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59,130,246,.4), 0 0 0 1px rgba(99,102,241,.4);
}
.btn-primary:active { transform: none; box-shadow: none; }

.btn-ghost {
    background: rgba(255,255,255,.05);
    color: var(--color-text);
    border-color: var(--color-border-strong);
}
.btn-ghost:hover {
    background: rgba(255,255,255,.08);
    border-color: rgba(59,130,246,.4);
    color: var(--color-primary-hover);
    box-shadow: 0 0 0 1px rgba(59,130,246,.2);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239,68,68,.25);
}
.btn-danger:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239,68,68,.35);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-block { width: 100%; padding: 12px 18px; font-size: 15px; }

.btn-accent {
    background: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
    color: #fff;
    border: none;
}
.btn-accent:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #0891b2 100%);
    box-shadow: 0 0 16px rgba(124,58,237,.35);
    color: #fff;
}

.tf-mode-btn {
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all .15s;
}
.tf-mode-btn:hover {
    background: rgba(255,255,255,.1);
    color: var(--color-text);
}
.tf-mode-btn.active {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-alt, #7c3aed));
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

/* ─── Flash messages ─────────────────────────────── */

.flash-container {
    max-width: var(--content-max);
    margin: var(--space-4) auto 0;
    padding: 0 var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.flash {
    padding: 11px var(--space-4);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    backdrop-filter: var(--blur);
}

.flash-success {
    background: var(--color-success-soft);
    color: #6ee7b7;
    border-color: rgba(16,185,129,.25);
}
.flash-error {
    background: var(--color-error-soft);
    color: #fca5a5;
    border-color: rgba(239,68,68,.25);
}
.flash-warning, .flash-warn {
    background: var(--color-warn-soft);
    color: #fcd34d;
    border-color: rgba(245,158,11,.25);
}
.flash-info {
    background: var(--color-primary-soft);
    color: #93c5fd;
    border-color: rgba(59,130,246,.2);
}

/* ─── Home page ─────────────────────────────── */

.page-home { display: flex; flex-direction: column; gap: var(--space-7); }
.page-new-project { display: flex; flex-direction: column; gap: var(--space-5); }
.page-projects { display: flex; flex-direction: column; gap: var(--space-5); }
.page-intake { display: flex; flex-direction: column; gap: var(--space-5); }
.page-deployment-show { display: flex; flex-direction: column; gap: var(--space-5); }
.page-pages-index { display: flex; flex-direction: column; gap: var(--space-5); }
.page-page-show { display: flex; flex-direction: column; gap: var(--space-5); }
.page-provider-edit { display: flex; flex-direction: column; gap: var(--space-5); }

.hero-card {
    background: linear-gradient(135deg, rgba(59,130,246,.08) 0%, rgba(139,92,246,.05) 100%);
    border: 1px solid rgba(59,130,246,.2);
    border-radius: var(--radius-xl);
    padding: var(--space-7);
    box-shadow: var(--glow-blue);
    position: relative;
    overflow: hidden;
}
.hero-card::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(59,130,246,.12) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-badge {
    display: inline-block;
    background: rgba(59,130,246,.15);
    color: #93c5fd;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: var(--space-4);
    border: 1px solid rgba(59,130,246,.25);
}

.hero-card h1 { font-size: 38px; margin-bottom: var(--space-3); }

.hero-lead {
    font-size: 17px;
    color: var(--color-text-muted);
    max-width: 640px;
    margin-bottom: var(--space-5);
}

.hero-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
}

.status-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    backdrop-filter: var(--blur);
}

.status-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-subtle);
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.status-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    font-family: var(--font-mono);
}

.status-note { margin-top: var(--space-2); font-size: 12px; }
.status-warn { color: var(--color-warn); }
.status-ok   { color: var(--color-success); }

.next-steps, .tech-note {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    backdrop-filter: var(--blur);
}
.next-steps h2, .tech-note h3 { margin-top: 0; }
.next-steps ol {
    margin: 0; padding-left: var(--space-5);
    display: flex; flex-direction: column; gap: var(--space-2);
}
.tech-list {
    margin: 0; padding-left: var(--space-5);
    display: flex; flex-direction: column; gap: var(--space-1);
    color: var(--color-text-muted);
}

/* Error page */
.error-page { text-align: center; padding: var(--space-8) var(--space-5); }
.error-code {
    font-size: 96px;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}
.error-page h1 { margin-top: var(--space-4); font-size: 28px; }
.error-page p { color: var(--color-text-muted); margin-bottom: var(--space-5); }

/* Responsive */
@media (max-width: 640px) {
    .main-wrap { padding: var(--space-5) var(--space-4); }
    .topnav-inner { padding: var(--space-3) var(--space-4); }
    .brand-text { display: none; }
    h1 { font-size: 24px; }
    .hero-card { padding: var(--space-5); }
    .hero-card h1 { font-size: 28px; }
    .site-footer-inner { flex-direction: column; gap: var(--space-2); text-align: center; }
}


/* ============================================
   Phase 2 — Auth, Dashboard, Projects, Wizard
   ============================================ */

/* ─── Auth ─────────────────────────────────── */

.body-auth {
    background: #040810;
    background-image:
        radial-gradient(ellipse 60% 60% at 50% 0%, rgba(59,130,246,.18) 0%, transparent 70%),
        radial-gradient(ellipse 40% 40% at 80% 80%, rgba(139,92,246,.1) 0%, transparent 60%),
        radial-gradient(circle at 1px 1px, rgba(255,255,255,.035) 1px, transparent 0);
    background-size: 100%, 100%, 28px 28px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-5);
}

.auth-wrap {
    width: 100%;
    max-width: 420px;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-5);
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-weight: 700;
    font-size: 18px;
    color: #fff;
}

.auth-card {
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(59,130,246,.2);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-lg), var(--glow-blue);
    backdrop-filter: var(--blur);
}

.auth-heading { margin: 0 0 var(--space-2); font-size: 24px; }
.auth-sub { color: var(--color-text-muted); margin-bottom: var(--space-5); font-size: 14px; }

.auth-foot-note {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
    font-size: 13px;
    color: var(--color-text-muted);
    text-align: center;
}

.auth-footer {
    text-align: center;
    font-size: 12px;
    color: rgba(255,255,255,.2);
}

.flash-container-auth { max-width: 420px; width: 100%; padding: 0; margin: 0; }

/* ─── Forms ─────────────────────────────────── */

.form-stack { display: flex; flex-direction: column; gap: var(--space-4); }

.form-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    max-width: 720px;
    backdrop-filter: var(--blur);
}

/* Universal glass surface card — used everywhere a content box/panel is needed */
.glass-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    backdrop-filter: var(--blur);
}
.glass-card > h2:first-child,
.glass-card > h3:first-child,
.glass-card > h4:first-child { margin-top: 0; }

.form-section {
    padding-bottom: var(--space-5);
    margin-bottom: var(--space-5);
    border-bottom: 1px solid var(--color-border);
}
.form-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.form-section-title { font-size: 15px; margin-bottom: var(--space-2); }

.form-section-desc {
    color: var(--color-text-muted);
    font-size: 13px;
    margin-bottom: var(--space-4);
}

.form-section-info {
    background: var(--color-primary-soft);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    border: 1px solid rgba(59,130,246,.2);
}
.form-section-info .form-section-title { color: var(--color-primary-hover); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); }
.field:last-child { margin-bottom: 0; }

.field-label { font-size: 13px; font-weight: 600; color: var(--color-text); }
.field-required { color: var(--color-error); margin-left: 2px; }
.field-optional { color: var(--color-text-subtle); font-weight: 400; font-size: 12px; }

.form-input, .field-input {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 13.5px;
    background: rgba(255,255,255,.06);
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input::placeholder, .field-input::placeholder { color: var(--color-text-subtle); }
.form-input:focus, .field-input:focus {
    outline: none;
    border-color: rgba(59,130,246,.5);
    background: rgba(59,130,246,.06);
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.form-input:disabled, .field-input:disabled {
    background: rgba(255,255,255,.02);
    color: var(--color-text-subtle);
    cursor: not-allowed;
}
.form-input option, .field-input option { background: #0f1b2d; color: var(--color-text); }

.field-textarea { resize: vertical; font-family: inherit; }
.form-select, .field-select { cursor: pointer; }
.field-help { font-size: 12px; color: var(--color-text-muted); }

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
    gap: var(--space-3);
}

.inline-form { display: inline; margin: 0; }
.inline-link { color: var(--color-primary); text-decoration: underline; }

/* Universal form / filter helpers */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); }
.form-group:last-child { margin-bottom: 0; }

.form-label { font-size: 13px; font-weight: 600; color: var(--color-text); }
.form-label .required { color: var(--color-error); margin-left: 2px; }

.form-actions { display: flex; gap: var(--space-3); align-items: center; margin-top: var(--space-4); }

.form-hint { font-size: 12px; color: var(--color-text-muted); margin: 2px 0 0; }


.filter-bar {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--space-2);
    align-items: center;
}
.filter-bar .form-input { width: auto; min-width: 0; flex: 1; }
.filter-bar .filter-grow { flex: 2; }
.filter-bar .btn { flex-shrink: 0; white-space: nowrap; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: 12px; font-weight: 600; color: var(--color-text); text-transform: uppercase; letter-spacing: 0.04em; }
.filter-grow { flex: 1; min-width: 0; }
.filter-actions { display: flex; gap: var(--space-2); align-items: center; }

.char-count { font-size: 11px; color: var(--color-text-muted); text-align: right; margin-top: 2px; }

/* ─── Page headers ─────────────────────────── */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}
.page-header h1 { margin-bottom: var(--space-1); }

.page-sub { color: var(--color-text-muted); font-size: 14px; margin: 0; }
.page-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ─── Dashboard ─────────────────────────────── */

.page-dashboard,
.page-reporting-dashboard { display: flex; flex-direction: column; gap: var(--space-5); }

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-5) var(--space-5);
    backdrop-filter: var(--blur);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    opacity: 0;
    transition: opacity var(--transition);
}
.stat-card:hover {
    border-color: rgba(59,130,246,.3);
    box-shadow: var(--glow-blue);
    transform: translateY(-2px);
}
.stat-card:hover::before { opacity: 1; }

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-text-subtle);
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.stat-number {
    font-size: 40px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-text) 0%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    letter-spacing: -0.03em;
}

.stat-sub { font-size: 12px; color: var(--color-text-muted); margin-top: var(--space-2); }

.dashboard-section { }

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}
.section-head h2 { margin: 0; }

.section-head-link { font-size: 13px; color: var(--color-text-muted); }
.section-head-link:hover { color: var(--color-primary); }

/* ─── Empty state ─────────────────────────── */

.empty-state {
    background: var(--color-surface);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-lg);
    padding: var(--space-7);
    text-align: center;
}
.empty-state h3 { margin-bottom: var(--space-2); }
.empty-state p { color: var(--color-text-muted); margin-bottom: var(--space-5); }

/* ─── Project grid ─────────────────────────── */

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
}

.project-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    text-decoration: none;
    color: var(--color-text);
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    backdrop-filter: var(--blur);
    position: relative;
    overflow: hidden;
}
.project-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(59,130,246,.0);
    transition: border-color var(--transition);
}
.project-card:hover {
    border-color: rgba(59,130,246,.25);
    box-shadow: var(--shadow-md), var(--glow-blue);
    text-decoration: none;
    transform: translateY(-3px);
}
.project-card:hover::after { border-color: rgba(59,130,246,.15); }

.project-card-head { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.project-card-title { font-size: 16px; font-weight: 700; margin: 0; }
.project-card-sub { font-size: 13px; color: var(--color-text-muted); }
.project-card-meta { font-size: 12px; color: var(--color-text-subtle); margin-top: auto; }
.project-card-inactive { opacity: .65; border-style: dashed; }

/* ─── Badges ─────────────────────────────── */

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.badge-mode {
    background: rgba(59,130,246,.15);
    color: #93c5fd;
    border: 1px solid rgba(59,130,246,.25);
}

.badge-status { text-transform: capitalize; }
.badge-status-draft          { background: rgba(255,255,255,.06); color: #94a3b8; border: 1px solid rgba(255,255,255,.1); }
.badge-status-brief_complete { background: rgba(59,130,246,.15); color: #93c5fd; border: 1px solid rgba(59,130,246,.25); }
.badge-status-generating     { background: rgba(245,158,11,.15); color: #fcd34d; border: 1px solid rgba(245,158,11,.25); }
.badge-status-generated      { background: rgba(16,185,129,.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,.25); }
.badge-status-reviewing      { background: rgba(245,158,11,.15); color: #fcd34d; border: 1px solid rgba(245,158,11,.25); }
.badge-status-approved       { background: rgba(16,185,129,.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,.25); }
.badge-status-deploying      { background: rgba(245,158,11,.15); color: #fcd34d; border: 1px solid rgba(245,158,11,.25); }
.badge-status-deployed       { background: rgba(16,185,129,.25); color: #6ee7b7; border: 1px solid rgba(16,185,129,.4); }
.badge-status-archived       { background: rgba(255,255,255,.05); color: #64748b; border: 1px solid rgba(255,255,255,.08); }
.badge-status-failed         { background: rgba(239,68,68,.15); color: #fca5a5; border: 1px solid rgba(239,68,68,.25); }

/* ── Badge variants used in Template Library and elsewhere ── */
.badge-soft         { background: rgba(255,255,255,.07);  color: #8da4be; border: 1px solid rgba(255,255,255,.1); }
.badge-type         { background: rgba(16,185,129,.15);   color: #34d399; border: 1px solid rgba(16,185,129,.25); }
.badge-success      { background: rgba(16,185,129,.15);   color: #6ee7b7; border: 1px solid rgba(16,185,129,.25); }
.badge-warn         { background: rgba(245,158,11,.15);   color: #fcd34d; border: 1px solid rgba(245,158,11,.25); }
.badge-danger       { background: rgba(239,68,68,.15);    color: #fca5a5; border: 1px solid rgba(239,68,68,.25); }
.badge-warning      { background: rgba(245,158,11,.15);   color: #fcd34d; border: 1px solid rgba(245,158,11,.25); }
.badge-site-options { background: rgba(168,85,247,.2);    color: #c084fc; border: 1px solid rgba(168,85,247,.3); }
.badge-primary      { background: rgba(59,130,246,.15);   color: #93c5fd; border: 1px solid rgba(59,130,246,.25); }

/* TrustFrame compliance score badges */
.tf-badge { font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 4px; font-size: 0.78rem; }
.tf-badge.badge-success { background: rgba(16,185,129,.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,.3); }
.tf-badge.badge-warning { background: rgba(245,158,11,.15); color: #fcd34d; border: 1px solid rgba(245,158,11,.3); }
.tf-badge.badge-danger  { background: rgba(239,68,68,.15);  color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.tf-badge.badge-soft    { background: rgba(255,255,255,.05); color: #8da4be; border: 1px solid rgba(255,255,255,.08); }

/* ─── Project table (list view) ─────────────── */

.project-table-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    overflow-x: auto;
    backdrop-filter: var(--blur);
}

.project-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.project-table thead th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    background: rgba(255,255,255,.03);
    color: var(--color-text-subtle);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--color-border);
}

.project-table tbody td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.project-table tbody tr:last-child td { border-bottom: none; }
.project-table tbody tr:hover { background: rgba(255,255,255,.025); }

/* data-table (generic reusable table) */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    background: rgba(255,255,255,.03);
    color: var(--color-text-subtle);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--color-border);
}
.data-table tbody td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,.025); }

.col-right { text-align: right; }

.row-link { font-weight: 600; color: var(--color-text); text-decoration: none; }
.row-link:hover { color: var(--color-primary-hover); text-decoration: none; }

.row-sub { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.muted { color: var(--color-text-subtle); font-style: italic; }

.row-actions { display: inline-flex; gap: var(--space-3); align-items: center; }

.row-action { font-size: 13px; color: var(--color-primary); font-weight: 500; }
.row-action:hover { color: var(--color-primary-hover); }

.row-action-btn {
    background: none; border: none;
    color: var(--color-text-muted);
    font-size: 13px; cursor: pointer;
    padding: 0; font-family: inherit;
}
.row-action-btn:hover { color: var(--color-error); text-decoration: underline; }

/* ─── Wizard steps ─────────────────────────── */

.wizard-steps {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-text-subtle);
}

.wizard-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,.05);
    color: var(--color-text-muted);
    font-weight: 700;
    font-size: 12px;
    border: 1px solid var(--color-border);
}

.wizard-step-label { font-size: 13px; font-weight: 500; }

.wizard-step-active .wizard-step-num {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 12px rgba(59,130,246,.4);
}
.wizard-step-active { color: var(--color-text); }
.wizard-step-active .wizard-step-label { font-weight: 700; }

.wizard-step-done .wizard-step-num {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 10px rgba(16,185,129,.3);
}
.wizard-step-done { color: var(--color-text-muted); }

.wizard-step-sep {
    flex: 1; min-width: 20px;
    height: 1px;
    background: var(--color-border);
    max-width: 60px;
}
.wizard-step-sep-done {
    background: linear-gradient(90deg, #10b981, rgba(16,185,129,.2));
}

/* ─── Mode selector cards ─────────────────── */

.mode-form {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    backdrop-filter: var(--blur);
}

.mode-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.mode-card { cursor: pointer; display: block; position: relative; }
.mode-card-input { position: absolute; opacity: 0; pointer-events: none; }

.mode-card-inner {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: all var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    background: rgba(255,255,255,.03);
    backdrop-filter: var(--blur);
}
.mode-card:hover .mode-card-inner {
    border-color: rgba(59,130,246,.35);
    background: rgba(59,130,246,.05);
    box-shadow: 0 0 16px rgba(59,130,246,.12);
    transform: translateY(-2px);
}
.mode-card-input:checked ~ .mode-card-inner,
.mode-card-input:checked + .mode-card-inner {
    border-color: rgba(59,130,246,.5);
    background: rgba(59,130,246,.08);
    box-shadow: 0 0 24px rgba(59,130,246,.18), inset 0 0 0 1px rgba(59,130,246,.2);
}

.mode-card-icon { font-size: 32px; margin-bottom: var(--space-1); }

.mode-card-title { font-size: 16px; font-weight: 700; color: var(--color-text); }

.mode-card-desc { font-size: 13px; color: var(--color-text-muted); line-height: 1.55; flex: 1; }

.mode-card-tag {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-primary-hover);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: var(--space-2);
}

/* ─── Project detail ─────────────────────── */

.page-project-show,
.page-project-media { display: flex; flex-direction: column; gap: var(--space-5); }

.project-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.project-detail-breadcrumb {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: var(--space-2);
}
.project-detail-breadcrumb a { color: var(--color-text-muted); text-decoration: none; }
.project-detail-breadcrumb a:hover { color: var(--color-primary); }

.crumb-sep { margin: 0 var(--space-2); color: var(--color-text-subtle); }

.project-detail-title { margin: 0 0 var(--space-2); }

.project-detail-meta {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    flex-wrap: wrap;
}

.project-detail-firm { font-size: 14px; color: var(--color-text-muted); }
.project-detail-actions { display: flex; gap: var(--space-2); }

/* ─── Tab nav ─────────────────────────────── */

.tab-nav {
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 5px;
    backdrop-filter: var(--blur);
    margin-top: var(--space-5);
}
.tab-nav-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
    align-items: center;
}
.tab-nav-links {
    display: flex;
    gap: 4px;
}

.tab-nav-link {
    padding: 7px 18px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 13.5px;
    border-radius: var(--radius-md);
    transition: all var(--transition);
    letter-spacing: -0.01em;
}
.tab-nav-link:hover {
    color: var(--color-text);
    background: rgba(255,255,255,.05);
    text-decoration: none;
}
.tab-nav-link-active {
    color: #fff;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(59,130,246,.25);
}
[data-theme="light"] .tab-nav-link-active {
    color: #fff;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    box-shadow: 0 2px 8px rgba(37,99,235,.2);
}

.tab-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: var(--space-6);
    min-height: 300px;
    backdrop-filter: var(--blur);
}

.tab-placeholder {
    text-align: center;
    padding: var(--space-7) var(--space-5);
    max-width: 640px;
    margin: 0 auto;
}
.tab-placeholder-icon { font-size: 48px; margin-bottom: var(--space-3); }
.tab-placeholder h2 { margin-bottom: var(--space-3); }
.tab-placeholder p { color: var(--color-text-muted); margin-bottom: var(--space-4); }
.tab-placeholder-list {
    text-align: left;
    max-width: 500px;
    margin: 0 auto var(--space-4);
    color: var(--color-text-muted);
    line-height: 1.8;
    padding-left: var(--space-5);
}
.tab-placeholder-footnote {
    padding: var(--space-3);
    background: var(--color-primary-soft);
    border: 1px solid rgba(59,130,246,.2);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: #93c5fd;
    margin-top: var(--space-4);
}

.project-sidebar-note {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}
.project-sidebar-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-subtle);
    font-weight: 700;
    margin-bottom: var(--space-2);
}

/* ─── Responsive (Phase 2) ─────────────────── */

@media (max-width: 720px) {
    .topnav-links { display: none; }
    .topnav-inner { gap: var(--space-3); }
    .project-table thead { display: none; }
    .project-table, .project-table tbody, .project-table tr, .project-table td {
        display: block; width: 100%;
    }
    .project-table tr { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border); }
    .project-table td { padding: var(--space-1) 0; border: none; }
    .col-right { text-align: left; }
    .form-footer { flex-direction: column-reverse; align-items: stretch; }
    .form-footer .btn { width: 100%; }
    .wizard-steps { justify-content: center; }
    .wizard-step-label { display: none; }
    .wizard-step-sep { max-width: 30px; }
}


/* ============================================
   Phase 3 — Brief Wizard
   ============================================ */

.page-brief-wizard { display: flex; flex-direction: column; gap: var(--space-5); }

.brief-sub { color: var(--color-text-muted); margin: 0; }

.brief-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: var(--space-6);
    align-items: flex-start;
}

.brief-sidebar {
    position: sticky;
    top: calc(58px + var(--space-4));
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.brief-main {
    min-height: 500px;
}

/* Completeness card */
.brief-completeness-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    backdrop-filter: var(--blur);
}

.brief-completeness-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-2);
}

.brief-completeness-bar {
    height: 6px;
    background: var(--color-surface-alt);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: var(--space-2);
}
.brief-completeness-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    box-shadow: 0 0 8px var(--color-primary-glow);
    transition: width 0.5s ease;
    border-radius: 3px;
}

.brief-completeness-score {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-text) 0%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    letter-spacing: -0.03em;
}

.brief-completeness-tier {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--color-text-muted);
    padding: 2px 8px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 999px;
}

.brief-completeness-hint { font-size: 12px; color: var(--color-text-muted); line-height: 1.5; }

/* Step nav sidebar */
.brief-step-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2);
    backdrop-filter: var(--blur);
}

.step-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-md);
    font-family: inherit;
    text-align: left;
    width: 100%;
    transition: all var(--transition);
}
.step-nav-item:hover { background: rgba(255,255,255,.05); }

.step-nav-item-active {
    background: rgba(59,130,246,.12);
    box-shadow: inset 0 0 0 1px rgba(59,130,246,.2);
}
.step-nav-item-active .step-nav-num {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    box-shadow: 0 0 8px rgba(59,130,246,.4);
}
.step-nav-item-active .step-nav-label { color: #93c5fd; font-weight: 700; }

.step-nav-item-done .step-nav-num {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.step-nav-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255,255,255,.06);
    color: var(--color-text-muted);
    font-weight: 700;
    font-size: 12px;
}

.step-nav-label { font-size: 13px; color: var(--color-text); font-weight: 500; }

.brief-sidebar-actions { display: flex; flex-direction: column; gap: var(--space-2); }

.btn-link-subtle {
    color: var(--color-text-muted);
    font-size: 13px;
    text-decoration: none;
    text-align: center;
}
.btn-link-subtle:hover { color: var(--color-primary); text-decoration: none; }

/* Steps */
.brief-step { display: none; }
.brief-step-active { display: block; }

.brief-step-head {
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}
.brief-step-head h2 { margin-bottom: var(--space-2); }
.brief-step-head p { margin: 0; color: var(--color-text-muted); }

.brief-section-head {
    margin: var(--space-6) 0 var(--space-3);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}
.brief-section-head:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.brief-section-head h3 { margin-bottom: var(--space-1); font-size: 15px; }
.brief-section-sub { font-size: 13px; color: var(--color-text-muted); margin: 0; }

.brief-step-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

/* Field rows */
.field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-4); }
.field-inline { display: flex; align-items: center; }
.checkbox-label {
    display: flex; align-items: center; gap: var(--space-2);
    font-size: 14px; cursor: pointer; user-select: none;
}
.field-checkbox { width: 16px; height: 16px; cursor: pointer; }

/* Color inputs */
.color-input-wrap { display: flex; gap: var(--space-2); align-items: stretch; }
.field-color {
    width: 48px; height: 40px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    cursor: pointer; padding: 2px;
    background: rgba(255,255,255,.08);
}
.field-color-text { font-family: var(--font-mono); font-size: 13px; }

/* Font pairings */
.font-pairing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.font-pairing { cursor: pointer; }
.font-pairing input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.font-pairing-inner {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    transition: all var(--transition);
    background: rgba(255,255,255,.03);
}
.font-pairing:hover .font-pairing-inner {
    border-color: rgba(59,130,246,.4);
    background: rgba(59,130,246,.05);
}
.font-pairing-selected .font-pairing-inner,
.font-pairing input:checked ~ .font-pairing-inner {
    border-color: rgba(59,130,246,.5);
    background: rgba(59,130,246,.08);
    box-shadow: 0 0 12px rgba(59,130,246,.12);
}
.font-pairing-heading { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.font-pairing-body { font-size: 13px; color: var(--color-text-muted); }

/* Range slider */
.field-range { width: 100%; }
.slider-value {
    float: right;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--color-text-muted);
    background: rgba(255,255,255,.06);
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}
.range-legend {
    display: flex; justify-content: space-between;
    font-size: 11px; color: var(--color-text-subtle);
    margin-top: 2px; text-transform: uppercase; letter-spacing: 0.05em;
}

/* Repeaters */
.repeater-list { display: flex; flex-direction: column; gap: var(--space-4); margin-bottom: var(--space-4); }

.repeater-row {
    background: rgba(255,255,255,.03);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}
.repeater-row-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--color-border);
}
.repeater-row-title {
    font-size: 13px; font-weight: 700; color: var(--color-text-muted);
    text-transform: uppercase; letter-spacing: 0.04em;
}
.repeater-remove {
    background: none;
    border: 1px solid var(--color-border-strong);
    color: var(--color-text-muted);
    width: 28px; height: 28px;
    border-radius: 50%; cursor: pointer;
    font-size: 12px; transition: all var(--transition);
}
.repeater-remove:hover {
    background: var(--color-error-soft);
    border-color: rgba(239,68,68,.4);
    color: var(--color-error);
}

/* State compliance */
.state-compliance-info {
    background: rgba(59,130,246,.08);
    border: 1px solid rgba(59,130,246,.2);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
}
.state-compliance-info h4 { margin: 0 0 var(--space-1); font-size: 13px; color: #93c5fd; }
.state-compliance-hint { font-size: 12px; color: #93c5fd; margin: 0; opacity: .8; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 1000; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); }
.modal-dialog {
    position: relative;
    max-width: 720px;
    margin: var(--space-6) auto;
    background: #14213a;
    border: 1px solid rgba(59,130,246,.2);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg), var(--glow-blue);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 96px);
    overflow: hidden;
}
.modal-dialog-sm { max-width: 480px; }

.modal-head {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-head h3 { margin: 0; }
.modal-close {
    background: none; border: none;
    font-size: 20px; cursor: pointer;
    color: var(--color-text-muted); padding: 0 var(--space-2);
}
.modal-close:hover { color: var(--color-error); }
.modal-body { padding: var(--space-5); overflow-y: auto; flex: 1; }
.modal-intro { font-size: 13px; color: var(--color-text-muted); margin-bottom: var(--space-3); }

.field-code {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    min-height: 400px;
}

.paste-errors { margin-top: var(--space-3); color: var(--color-error); font-size: 13px; }
.paste-errors:empty { display: none; }
.paste-errors:not(:empty) {
    background: var(--color-error-soft);
    border: 1px solid rgba(239,68,68,.3);
    border-radius: var(--radius-md);
    padding: var(--space-3);
}

.modal-foot {
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
}
.modal-foot > div { display: flex; gap: var(--space-2); }

/* Responsive Phase 3 */
@media (max-width: 900px) {
    .brief-layout { grid-template-columns: 1fr; }
    .brief-sidebar { position: static; }
    .field-row-2, .field-row-3 { grid-template-columns: 1fr; }
    .font-pairing-grid { grid-template-columns: 1fr; }
}


/* ============================================
   Phase 4 — Pages manifest, generation
   ============================================ */

.pages-gate { text-align: center; padding: var(--space-8) var(--space-5); }
.pages-gate-icon { font-size: 48px; margin-bottom: var(--space-3); opacity: 0.6; }

.pages-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}
.pages-toolbar h2 { margin-bottom: var(--space-1); }

.pages-list { display: flex; flex-direction: column; gap: var(--space-3); }

.page-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    transition: all var(--transition);
    backdrop-filter: var(--blur);
}
.page-row:hover {
    border-color: rgba(59,130,246,.3);
    box-shadow: 0 0 16px rgba(59,130,246,.1);
    transform: translateY(-1px);
}

.page-row-main { flex: 1; min-width: 0; }
.page-row-head { display: flex; gap: var(--space-2); margin-bottom: var(--space-2); flex-wrap: wrap; }
.page-row-title { margin: 0 0 var(--space-2); font-size: 17px; }
.page-row-meta {
    display: flex; gap: var(--space-4);
    font-size: 13px; color: var(--color-text-muted); flex-wrap: wrap;
}
.page-row-meta-empty { font-style: italic; color: var(--color-text-subtle); }
.page-meta-item strong { color: var(--color-text); }
.page-meta-h1 { max-width: 500px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-row-actions { display: flex; gap: var(--space-2); flex-shrink: 0; }

.badge-page-type {
    background: rgba(255,255,255,.06);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}
.badge-page-status-pending    { background: rgba(255,255,255,.05); color: #64748b; border: 1px solid rgba(255,255,255,.08); }
.badge-page-status-generating { background: rgba(245,158,11,.15); color: #fcd34d; border: 1px solid rgba(245,158,11,.25); }
.badge-page-status-generated  { background: rgba(245,158,11,.12); color: #fcd34d; border: 1px solid rgba(245,158,11,.2); }
.badge-page-status-validated  { background: rgba(16,185,129,.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,.25); }
.badge-page-status-approved   { background: rgba(16,185,129,.25); color: #6ee7b7; border: 1px solid rgba(16,185,129,.4); }
.badge-page-status-rejected   { background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.2); }
.badge-page-status-failed     { background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.2); }

.pages-note {
    margin-top: var(--space-5);
    padding: var(--space-3) var(--space-4);
    background: rgba(59,130,246,.08);
    border: 1px solid rgba(59,130,246,.2);
    border-radius: var(--radius-md);
    color: #93c5fd;
    font-size: 13px;
}
.pages-note p { margin: 0; }

/* Generation modal */
.generate-progress { text-align: center; padding: var(--space-5) var(--space-4); }

.spinner {
    display: inline-block;
    width: 40px; height: 40px;
    border: 3px solid rgba(59,130,246,.15);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-bottom: var(--space-3);
    box-shadow: 0 0 12px rgba(59,130,246,.3);
}
@keyframes spin { to { transform: rotate(360deg); } }

.generate-progress p { margin: 0 0 var(--space-1); }
.generate-sub { color: var(--color-text-muted); font-size: 12px; }

.gen-result-summary {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4);
    background: rgba(255,255,255,.03);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    align-items: center;
}
.gen-result-score { flex: 1; }
.gen-result-label { font-size: 12px; color: var(--color-text-muted); margin-bottom: var(--space-1); }
.gen-result-number {
    font-size: 36px; font-weight: 800;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.gen-result-details { display: flex; flex-direction: column; gap: var(--space-1); font-size: 13px; }
.gen-result-meta { font-size: 12px; color: var(--color-text-muted); text-align: center; }
.gen-result-error {
    padding: var(--space-3);
    background: var(--color-error-soft);
    border: 1px solid rgba(239,68,68,.3);
    color: #fca5a5;
    border-radius: var(--radius-md);
    font-size: 13px;
}

/* Page detail */
.page-show-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: var(--space-4);
    margin-top: var(--space-5);
}

.page-preview-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 700px;
}
.page-preview-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    background: rgba(255,255,255,.03);
}
.page-preview-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.page-preview-open { font-size: 13px; }
.page-preview-iframe { flex: 1; width: 100%; border: 0; background: #fff; min-height: 600px; }

.page-sidebar { display: flex; flex-direction: column; gap: var(--space-3); }

.page-metadata-card,
.page-validators-card,
.page-versions-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    backdrop-filter: var(--blur);
}


/* ============================================
   Phase 6 — Section library
   ============================================ */

.page-sections { display: flex; flex-direction: column; gap: var(--space-5); }

.section-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-4);
}

.section-type-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
    backdrop-filter: var(--blur);
}
.section-type-card:hover {
    border-color: rgba(59,130,246,.3);
    box-shadow: var(--glow-blue);
    transform: translateY(-2px);
}

.section-card-head {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.section-card-head h3 { margin: 0; font-size: 15px; }

.section-card-body { padding: var(--space-4) var(--space-5); }
.section-card-desc { font-size: 13px; color: var(--color-text-muted); margin: 0 0 var(--space-3); }

.section-card-meta {
    display: flex; gap: var(--space-3); flex-wrap: wrap;
    font-size: 12px; color: var(--color-text-subtle);
}

.section-card-foot {
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--color-border);
    background: rgba(255,255,255,.02);
    display: flex; justify-content: flex-end; gap: var(--space-2);
}

.section-preview-wrap {
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: 400px;
}

.section-detail-meta {
    display: flex; gap: var(--space-4);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
}
.section-meta-item { font-size: 13px; color: var(--color-text-muted); }
.section-meta-item strong { color: var(--color-text); }


/* ============================================
   Phase 7 — Output / Elementor export
   ============================================ */

.page-output { display: flex; flex-direction: column; gap: var(--space-5); }

.output-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}
.output-summary h2 { margin-bottom: var(--space-1); }

.output-deploy-section { display: flex; flex-direction: column; gap: var(--space-4); margin-top: 30px; }

.output-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--space-5);
}

.output-pages-list { display: flex; flex-direction: column; gap: var(--space-3); }

.output-page-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    backdrop-filter: var(--blur);
    transition: all var(--transition);
}
.output-page-row:hover { border-color: rgba(59,130,246,.3); }

.output-page-info { flex: 1; min-width: 0; }
.output-page-title { font-weight: 700; font-size: 15px; margin: 0 0 var(--space-1); }
.output-page-meta { font-size: 12px; color: var(--color-text-muted); }
.output-page-actions { display: flex; gap: var(--space-2); flex-shrink: 0; }

.output-sidebar { display: flex; flex-direction: column; gap: var(--space-4); }

.output-summary-card,
.output-deploy-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    backdrop-filter: var(--blur);
}
.output-summary-title,
.output-deploy-title {
    font-size: 13px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--color-text-subtle);
    margin-bottom: var(--space-4);
}

.output-stat { display: flex; justify-content: space-between; margin-bottom: var(--space-3); font-size: 13px; }
.output-stat-label { color: var(--color-text-muted); }
.output-stat-value { font-weight: 700; font-family: var(--font-mono); color: var(--color-text); }

@media (max-width: 960px) {
    .output-layout { grid-template-columns: 1fr; }
    .page-show-grid { grid-template-columns: 1fr; }
}


/* ============================================
   Phase 8 — Deployments
   ============================================ */

.deployment-targets { display: flex; flex-direction: column; gap: var(--space-3); }

.target-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    backdrop-filter: var(--blur);
    transition: all var(--transition);
}
.target-card:hover { border-color: rgba(59,130,246,.2); }
.target-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-2); }
.target-card-url { font-family: var(--font-mono); font-size: 13px; color: var(--color-text-muted); }
.target-card-actions { display: flex; gap: var(--space-2); }

.deployment-history { margin-top: var(--space-5); }

.deployment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}
.deployment-row:last-child { border-bottom: none; }
.deploy-time { color: var(--color-text-muted); font-family: var(--font-mono); font-size: 12px; }


/* ============================================
   Phase 9 — Intake
   ============================================ */

.intake-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: var(--space-5);
}

.intake-main {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    backdrop-filter: var(--blur);
}

.intake-sidebar { display: flex; flex-direction: column; gap: var(--space-4); }

.intake-info-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

@media (max-width: 900px) { .intake-layout { grid-template-columns: 1fr; } }


/* Toggle pill group (Simple/Advanced, Local/Hybrid/LLM) */
.tf-mode-group {
    display: inline-flex;
    gap: 0;
    background: rgba(255,255,255,.04);
    border-radius: 6px;
    padding: 3px;
}
.tf-mode-group .tf-mode-btn {
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}
.tf-mode-group .tf-mode-btn:hover {
    color: var(--color-text);
    background: rgba(255,255,255,.06);
}
.tf-mode-group .tf-mode-btn.active {
    background: rgba(255,255,255,.1);
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    font-weight: 600;
}

/* ============================================
   Admin — Providers
   ============================================ */

.page-providers { display: flex; flex-direction: column; gap: var(--space-5); }

.providers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-4);
}

.provider-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    backdrop-filter: var(--blur);
    transition: all var(--transition);
}
.provider-card:hover { border-color: rgba(59,130,246,.25); box-shadow: 0 0 16px rgba(59,130,246,.08); }

.provider-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    background: rgba(255,255,255,.02);
}
.provider-card-head h3 { margin: 0; font-size: 15px; }

.provider-card-body {
    padding: var(--space-4) var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.provider-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-2);
}
.provider-meta-row:last-child { border-bottom: none; padding-bottom: 0; }
.provider-meta-label { color: var(--color-text-muted); }
.provider-meta-value { font-family: var(--font-mono); color: var(--color-text); font-size: 12px; }

.provider-card-foot {
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: var(--space-2);
    background: rgba(255,255,255,.02);
}

.process-routing-section {
    background: var(--color-surface);
    border: 1px solid rgba(139,92,246,.2);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    backdrop-filter: var(--blur);
    box-shadow: 0 0 20px rgba(139,92,246,.06);
}

.routing-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.routing-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    align-items: center;
}

.routing-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.routing-select { cursor: pointer; }

.provider-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.provider-type-anthropic { background: rgba(139,92,246,.15); color: #c4b5fd; border: 1px solid rgba(139,92,246,.3); }
.provider-type-ollama    { background: rgba(16,185,129,.12); color: #6ee7b7; border: 1px solid rgba(16,185,129,.25); }
.provider-type-openai_compatible { background: rgba(34,211,238,.1); color: #67e8f9; border: 1px solid rgba(34,211,238,.2); }

.provider-enabled-badge  { background: rgba(16,185,129,.12); color: #6ee7b7; border: 1px solid rgba(16,185,129,.2); }
.provider-disabled-badge { background: rgba(255,255,255,.05); color: #64748b; border: 1px solid rgba(255,255,255,.08); }

.provider-new-card {
    background: rgba(59,130,246,.04);
    border: 1px dashed rgba(59,130,246,.25);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 160px;
    transition: all var(--transition);
    text-decoration: none;
    color: var(--color-text-muted);
}
.provider-new-card:hover {
    background: rgba(59,130,246,.08);
    border-color: rgba(59,130,246,.4);
    color: var(--color-primary-hover);
}

/* ── New project wizard (industry) ── */

.industry-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.mode-card-disabled {
    cursor: default;
    opacity: 0.55;
    pointer-events: none;
}
.mode-card-disabled .mode-card-inner:hover { border-color: var(--color-border); box-shadow: none; transform: none; }

.tag-active { color: var(--color-success); }
.tag-soon   { color: var(--color-text-subtle); }


/* ============================================
   /sections — section library page
   ============================================ */

.page-sections-index { display: flex; flex-direction: column; gap: var(--space-6); }

.sections-header { display: flex; flex-direction: column; gap: var(--space-4); margin-bottom: var(--space-2); }

.sections-progress {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    backdrop-filter: var(--blur);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    max-width: 520px;
}
.sections-progress-label { font-size: 13px; color: var(--color-text-muted); flex-shrink: 0; }
.sections-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,.06);
    border-radius: 999px;
    overflow: hidden;
}
.sections-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: width .4s ease;
    box-shadow: 0 0 8px rgba(59,130,246,.4);
}

.sections-filter {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-2);
    background: rgba(255,255,255,.03);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    backdrop-filter: var(--blur);
}
.sections-filter-pill {
    padding: 6px 14px;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition);
}
.sections-filter-pill:hover {
    color: var(--color-text);
    background: rgba(255,255,255,.06);
    text-decoration: none;
}
.sections-filter-pill-active {
    color: #fff;
    background: linear-gradient(135deg, rgba(59,130,246,.3) 0%, rgba(99,102,241,.25) 100%);
    box-shadow: inset 0 0 0 1px rgba(59,130,246,.3);
}

.sections-category { display: flex; flex-direction: column; gap: var(--space-4); }
.sections-category h2 {
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    font-weight: 700;
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--color-border);
    margin: 0;
}

.sections-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-4);
}

.section-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    backdrop-filter: var(--blur);
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.section-card:hover {
    border-color: rgba(59,130,246,.25);
    box-shadow: var(--glow-blue);
    transform: translateY(-2px);
}
.section-card-stub { opacity: 0.65; }

.section-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-2);
}
.section-card-head h3 { margin: 0; font-size: 15px; line-height: 1.35; }

.section-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}
.section-badge-built {
    background: rgba(16,185,129,.15);
    color: #6ee7b7;
    border: 1px solid rgba(16,185,129,.25);
}
.section-badge-stub {
    background: rgba(255,255,255,.05);
    color: var(--color-text-subtle);
    border: 1px solid rgba(255,255,255,.08);
}

.section-card-type {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--color-cyan);
    background: rgba(34,211,238,.08);
    border: 1px solid rgba(34,211,238,.15);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    align-self: flex-start;
}

.section-card-desc {
    font-size: 13px;
    color: var(--color-text-muted);
    margin: 0;
    flex: 1;
}

.section-card-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-border);
    margin-top: var(--space-2);
}
.section-card-pending {
    font-size: 12px;
    color: var(--color-text-subtle);
    font-style: italic;
}


/* ============================================
   Section show page (single-section preview)
   ============================================ */

.page-section-show {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.section-show-header h1 {
    margin-bottom: var(--space-3);
}

.section-show-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    margin-bottom: var(--space-3);
}

.section-show-desc {
    color: var(--color-text-muted);
    margin: 0;
    max-width: 760px;
}

/* Two-column layout: big iframe + narrower sidebar */
.section-show-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: var(--space-4);
    align-items: stretch;
}

.section-preview-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: var(--blur);
    display: flex;
    flex-direction: column;
    min-height: 700px;
}

.section-preview-card .page-preview-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    background: rgba(255,255,255,.03);
}

.section-preview-card .page-preview-head h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.section-preview-card .page-preview-open {
    font-size: 13px;
    color: var(--color-primary);
    text-decoration: none;
}
.section-preview-card .page-preview-open:hover { color: var(--color-primary-hover); }

.section-preview-iframe {
    flex: 1;
    width: 100%;
    border: 0;
    background: #fff;
    min-height: 700px;
    display: block;
}

.section-show-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.section-info-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    backdrop-filter: var(--blur);
}

.section-info-card h4 {
    margin: 0 0 var(--space-3);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-text-subtle);
    font-weight: 700;
}

.section-info-tags {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}
.section-info-tags li code {
    background: rgba(34,211,238,.08);
    color: var(--color-cyan);
    border: 1px solid rgba(34,211,238,.15);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.section-var-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    font-size: 13px;
    color: var(--color-text);
}
.section-var-list li code {
    font-family: var(--font-mono);
    font-size: 12px;
    background: transparent;
    color: var(--color-text);
    padding: 0;
    border: 0;
}

.section-filepath {
    display: block;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--color-border);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--color-text);
    word-break: break-all;
}

.section-source-details {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-5);
    backdrop-filter: var(--blur);
}
.section-source-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--color-text);
    padding: var(--space-2) 0;
    list-style: none;
    user-select: none;
}
.section-source-details summary::-webkit-details-marker { display: none; }
.section-source-details summary::before {
    content: '▸ ';
    color: var(--color-text-muted);
    transition: transform .15s;
    display: inline-block;
}
.section-source-details[open] summary::before { content: '▾ '; }

.section-source-pre {
    background: rgba(0,0,0,.35);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.55;
    color: var(--color-text);
    overflow-x: auto;
    max-height: 560px;
    overflow-y: auto;
    margin: var(--space-3) 0 var(--space-2);
    white-space: pre;
}

@media (max-width: 900px) {
    .section-show-grid { grid-template-columns: 1fr; }
    .section-preview-card { min-height: 540px; }
    .section-preview-iframe { min-height: 540px; }
}
/* Output format picker (boxed radios + spacing) */
.output-format-picker { margin-bottom: var(--space-6); }
.output-format-picker h3 { margin-bottom: var(--space-2); }
.format-options { display: flex; flex-direction: column; gap: var(--space-4); }
.format-option { cursor: pointer; border-radius: var(--radius-lg); overflow: hidden; transition: all var(--transition); position: relative; }
.format-option input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.format-option-inner { 
  padding: var(--space-5); border: 1px solid var(--color-border); border-radius: var(--radius-lg); 
  background: var(--color-surface-alt); display: flex; flex-direction: column; gap: var(--space-2);
}
.format-option:hover .format-option-inner { 
  border-color: var(--color-primary-soft); box-shadow: var(--glow-blue); transform: translateY(-1px);
}
.format-option-selected .format-option-inner { 
  border-color: var(--color-primary); background: var(--color-primary-soft); box-shadow: var(--glow-blue);
}
.format-option-title { font-weight: 600; margin-bottom: var(--space-2); display: flex; gap: var(--space-2); align-items: center; }
.format-option-desc { color: var(--color-text-muted); line-height: 1.55; }

/* ============================================
   Websites (Multi Website Manager)
   ============================================ */

.page-websites { display: flex; flex-direction: column; gap: var(--space-5); }
.page-websites-new { display: flex; flex-direction: column; gap: var(--space-5); }
.page-website-show { display: flex; flex-direction: column; gap: var(--space-5); }

.website-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-4);
}

.website-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    backdrop-filter: var(--blur);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}
.website-card:hover {
    border-color: rgba(59,130,246,.25);
    box-shadow: var(--shadow-md), var(--glow-blue);
    transform: translateY(-2px);
}
.website-card-inactive {
    opacity: .65;
    border-style: dashed;
}

.website-card-head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}
.website-card-status {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.website-card-status-up      { background: var(--color-success); box-shadow: 0 0 8px rgba(16,185,129,.4); }
.website-card-status-down    { background: var(--color-error); box-shadow: 0 0 8px rgba(239,68,68,.4); }
.website-card-status-error   { background: var(--color-warn); box-shadow: 0 0 8px rgba(245,158,11,.4); }
.website-card-status-unknown { background: var(--color-text-subtle); }

.website-card-title { margin: 0; font-size: 17px; font-weight: 700; }
.website-card-url { font-size: 13px; color: var(--color-text-muted); word-break: break-all; }
.website-card-meta { font-size: 12px; color: var(--color-text-subtle); display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.website-card-ping { font-size: 12px; color: var(--color-text-muted); }
.website-card-ping-ms { font-family: var(--font-mono); }

/* Mini website list shown on project output page */
.website-mini-list { display: flex; flex-direction: column; gap: 8px; margin-top: 0.5rem; }
.website-mini-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px 12px;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}
.website-mini-status { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.website-mini-status-up      { background: var(--color-success); box-shadow: 0 0 6px rgba(16,185,129,.4); }
.website-mini-status-down    { background: var(--color-error);   box-shadow: 0 0 6px rgba(239,68,68,.4); }
.website-mini-status-error   { background: var(--color-warn);    box-shadow: 0 0 6px rgba(245,158,11,.4); }
.website-mini-status-unknown { background: var(--color-text-subtle); }
.website-mini-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.website-mini-info strong { font-size: 13px; color: var(--color-text); }
.website-mini-url  { font-size: 12px; color: var(--color-text-muted); word-break: break-all; }
.website-mini-meta { font-size: 11px; color: var(--color-text-subtle); margin-top: 2px; }
.website-mini-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }

/* Website dashboard */
.website-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--space-4);
    align-items: flex-start;
}

.website-dashboard-main { min-width: 0; }
.website-dashboard-sidebar { display: flex; flex-direction: column; gap: var(--space-4); }

.card-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    backdrop-filter: var(--blur);
}
.card-panel h2, .card-panel h3 { margin-top: 0; margin-bottom: var(--space-4); }

.website-pages-list { display: flex; flex-direction: column; gap: var(--space-3); }
.website-page-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border);
}
.website-page-row:last-child { border-bottom: none; }
.website-page-info { flex: 1 1 auto; min-width: 0; }
.website-page-title { font-weight: 600; font-size: 15px; line-height: 1.4; word-break: break-word; }
.website-page-slug { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.website-page-meta { display: flex; flex-direction: column; gap: var(--space-2); align-items: flex-end; flex-shrink: 0; }

.website-detail-list { display: flex; flex-direction: column; gap: var(--space-3); }
.website-detail-item { display: flex; flex-direction: column; gap: 2px; }
.website-detail-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-subtle); font-weight: 700; }
.website-detail-value { font-size: 13px; color: var(--color-text); }

.website-actions-list { display: flex; flex-direction: column; gap: var(--space-3); }
.website-actions-list .btn { width: 100%; }

@media (max-width: 900px) {
    .website-dashboard-grid { grid-template-columns: 1fr; }
    .website-grid { grid-template-columns: 1fr; }
}

/* Tools landing grid (global so it applies on /tools, which returns before the
   page's inline <style> block is emitted). Mirrors the .website-grid layout. */
.tools-page { max-width: 1100px; margin: 0 auto; padding: var(--space-4); }
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-4);
}
.tools-card {
    display: flex; gap: 16px; align-items: flex-start;
    padding: 28px; border-radius: 16px;
    background: var(--color-surface); border: 1px solid var(--color-border);
    text-decoration: none; color: inherit;
    transition: all .2s;
    backdrop-filter: var(--blur);
    position: relative; overflow: hidden;
}
.tools-card::after {
    content: ''; position: absolute; inset: 0; border-radius: 16px;
    border: 1px solid rgba(59,130,246,.0);
    transition: border-color .2s;
}
.tools-card:hover {
    border-color: rgba(59,130,246,.25);
    box-shadow: 0 0 24px rgba(59,130,246,.1);
    transform: translateY(-2px);
    text-decoration: none; color: inherit;
}
.tools-card:hover::after { border-color: rgba(59,130,246,.15); }
.tools-card-icon { font-size: 32px; flex-shrink: 0; margin-top: 0; line-height: 1; }
.tools-card-body { min-width: 0; }
.tools-card-title { display: block; font-size: 16px; font-weight: 700; margin-bottom: 6px; color: var(--color-text); }
.tools-card-desc { font-size: 13px; color: var(--color-text-muted); line-height: 1.5; margin: 0; }
/* (removed .tools-back-link — the tools switcher tab-nav replaced the back link) */
@media (max-width: 640px) {
    .tools-grid { grid-template-columns: 1fr; }
}

/* SEO Audit */
.page-seo-audit { display: flex; flex-direction: column; gap: var(--space-5); }

.seo-pages-list { display: flex; flex-direction: column; gap: var(--space-4); }
.seo-page-item {
    background: rgba(255,255,255,.03);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}
.seo-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.seo-page-title-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}
.seo-page-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
}
.seo-page-title { font-weight: 600; font-size: 14px; }
.seo-page-url { font-size: 12px; color: var(--color-text-muted); word-break: break-all; }

.seo-page-issues { display: flex; flex-direction: column; gap: var(--space-2); }
.seo-issue {
    font-size: 13px;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    display: flex;
    gap: var(--space-2);
    align-items: center;
}
.seo-issue-critical { background: var(--color-error-soft); color: #fca5a5; border: 1px solid rgba(239,68,68,.2); }
.seo-issue-warning { background: var(--color-warn-soft); color: #fcd34d; border: 1px solid rgba(245,158,11,.2); }
.seo-issue-opportunity { background: var(--color-primary-soft); color: #93c5fd; border: 1px solid rgba(59,130,246,.2); }
.seo-issue-severity {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: .8;
}

.text-success { color: var(--color-success); }
.text-warn { color: var(--color-warn); }
.text-error { color: var(--color-error); }

/* ============================================
   Template Library
   ============================================ */

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-5);
}

.template-card {
    transition: transform var(--transition), box-shadow var(--transition);
}
.template-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md), var(--glow-blue);
    border-color: rgba(59,130,246,.3);
}

.template-header {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
}

.template-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 var(--space-1);
    color: var(--color-text);
}

.template-desc {
    font-size: 13px;
    color: var(--color-text-muted);
    margin: 0 0 var(--space-3);
    line-height: 1.5;
}

.template-meta {
    display: flex;
    gap: var(--space-4);
    font-size: 12px;
    color: var(--color-text-muted);
    flex-wrap: wrap;
}

.template-actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-top: var(--space-4);
}

/* Template show page */
.detail-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.detail-table td { padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); vertical-align: top; }
.detail-table tr:last-child td { border-bottom: none; }
.detail-table td:first-child { color: var(--color-text-muted); width: 35%; font-weight: 500; }

.code-preview {
    background: rgba(0,0,0,.35);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.55;
    color: #a5b4fc;
    max-height: 500px;
    overflow: auto;
    white-space: pre;
}

/* ============================================
   Output page — deploy UI
   ============================================ */

.output-deploy-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.output-bulk-actions { display: flex; gap: var(--space-2); }

.output-page-head {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    flex-wrap: wrap;
    align-items: center;
}

.output-page-main { flex: 1; min-width: 0; }

/* Deploy targets list */
.deploy-targets-list { display: flex; flex-direction: column; gap: var(--space-3); }

.deploy-target-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    backdrop-filter: var(--blur);
    transition: all var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}
.deploy-target-card:hover { border-color: rgba(59,130,246,.25); }

.deploy-target-main { flex: 1; min-width: 0; }

.deploy-target-head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-1);
    flex-wrap: wrap;
}

.deploy-target-url {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: var(--space-1);
}

.deploy-target-meta { font-size: 12px; color: var(--color-text-subtle); }
.deploy-target-error { font-size: 12px; color: var(--color-error); margin-top: var(--space-1); }

.deploy-target-status { font-size: 12px; font-weight: 600; }
.deploy-target-status-success { color: var(--color-success); }
.deploy-target-status-failed  { color: var(--color-error); }
.deploy-target-status-unknown { color: var(--color-text-subtle); }

.deploy-target-actions { display: flex; gap: var(--space-2); align-items: center; flex-shrink: 0; }

/* Icon-only button (✕ delete) */
.btn-icon {
    background: none;
    border: none;
    color: var(--color-text-subtle);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
    line-height: 1;
}
.btn-icon:hover { color: var(--color-error); background: var(--color-error-soft); }

/* Deploy history */
.deploy-history { margin-top: var(--space-5); }
.deploy-history h4 { margin-bottom: var(--space-3); font-size: 14px; }
.deploy-history-list { display: flex; flex-direction: column; gap: var(--space-2); }

.deploy-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 13px;
    text-decoration: none;
    color: var(--color-text);
    transition: all var(--transition);
}
.deploy-history-item:hover { border-color: rgba(59,130,246,.3); text-decoration: none; }
.deploy-history-item-success { border-left: 3px solid var(--color-success); }
.deploy-history-item-failed  { border-left: 3px solid var(--color-error); }
.deploy-history-item-in_progress { border-left: 3px solid var(--color-warn); }

.deploy-history-main { display: flex; align-items: center; gap: var(--space-2); }
.deploy-history-status { font-weight: 700; font-size: 15px; }
.deploy-history-name { font-weight: 600; }
.deploy-history-meta { font-size: 12px; color: var(--color-text-muted); flex-shrink: 0; }

/* Empty state for deploy */
.deploy-empty {
    padding: var(--space-5);
    color: var(--color-text-muted);
    font-size: 14px;
}
.deploy-empty details {
    margin-top: var(--space-4);
    font-size: 13px;
}
.deploy-empty summary { cursor: pointer; font-weight: 600; color: var(--color-text); margin-bottom: var(--space-2); }
.deploy-empty ol { padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-1); }

/* Deploy result panels */
.deploy-success, .deploy-failed {
    text-align: center;
    padding: var(--space-5) var(--space-4);
}
.deploy-success-icon { font-size: 40px; color: var(--color-success); margin-bottom: var(--space-3); }
.deploy-failed-icon  { font-size: 40px; color: var(--color-error);   margin-bottom: var(--space-3); }

/* Deploy modal — radio options */
.radio-group { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-1); }
.radio-option {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    cursor: pointer;
    font-size: 13.5px;
    line-height: 1.5;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(255,255,255,.03);
    transition: all var(--transition);
    user-select: none;
}
.radio-option:hover { border-color: rgba(59,130,246,.35); background: rgba(59,130,246,.05); }
.radio-option input[type="radio"] { margin-top: 3px; flex-shrink: 0; accent-color: var(--color-primary); }
.radio-option:has(input:checked) {
    border-color: rgba(59,130,246,.5);
    background: rgba(59,130,246,.08);
    box-shadow: 0 0 0 1px rgba(59,130,246,.15);
}

/* Template composer (pages/index template selector) */
.template-chosen-list { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.template-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    background: rgba(255,255,255,.07);
    border: 1px solid var(--color-border);
    padding: 4px 10px;
    border-radius: var(--radius-md);
    font-size: 13px;
}
.template-chip-placeholder {
    color: var(--color-text-muted);
    background: transparent;
    border-style: dashed;
}
.chip-category {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #34d399;
    background: rgba(16,185,129,.12);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-weight: 700;
}
.chip-name { color: var(--color-text); font-weight: 500; }
.chip-remove {
    background: none; border: none;
    color: var(--color-text-muted);
    cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px;
}
.chip-remove:hover { color: var(--color-error); }



/* ─── Content generation progress modal (focused single-stage) ────── */
.gen-progress-card {
    max-width: 560px;
    background: linear-gradient(180deg, rgba(17,28,49,0.95) 0%, rgba(13,22,37,0.98) 100%);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
    padding: 0;
    overflow: hidden;
    animation: gen-card-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes gen-card-in {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.gen-progress-head {
    padding: 1.5rem 1.75rem 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.gen-progress-step-pill {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.3rem 0.7rem;
    background: rgba(96,165,250,0.12);
    color: #93c5fd;
    border-radius: 100px;
    border: 1px solid rgba(96,165,250,0.25);
    margin-bottom: 0.6rem;
}
.gen-progress-head h3 {
    margin: 0.1rem 0 0.15rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-text);
}
.gen-progress-subtitle {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 0.2rem;
}

/* Step dots indicator */
.gen-progress-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 1.25rem 1.75rem 0.5rem;
    flex-wrap: nowrap;
}
.gen-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    position: relative;
    flex: 0 0 auto;
    z-index: 1;
}
.gen-dot-num {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    color: var(--color-text-muted);
    font-weight: 700;
    font-size: 0.85rem;
    border: 2px solid rgba(255,255,255,0.08);
    transition: all 0.35s ease;
}
.gen-dot-label {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    font-weight: 500;
    transition: color 0.3s ease;
}
.gen-dot-line {
    flex: 1 1 auto;
    height: 2px;
    background: rgba(255,255,255,0.08);
    margin-top: -16px; /* align with dot centers */
    margin-left: -8px;
    margin-right: -8px;
    min-width: 24px;
    position: relative;
    z-index: 0;
    transition: background 0.5s ease;
}
.gen-dot-line-done {
    background: linear-gradient(90deg, #16a34a 0%, #6ee7b7 100%);
    box-shadow: 0 0 8px rgba(16,185,129,0.4);
}

/* Dot states */
.gen-dot-active .gen-dot-num {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    color: #fff;
    border-color: rgba(96,165,250,0.5);
    box-shadow: 0 0 0 4px rgba(96,165,250,0.18), 0 4px 14px rgba(59,130,246,0.4);
    animation: gen-dot-pulse 1.8s ease-in-out infinite;
    transform: scale(1.1);
}
.gen-dot-active .gen-dot-label {
    color: #93c5fd;
    font-weight: 600;
}
@keyframes gen-dot-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(96,165,250,0.18), 0 4px 14px rgba(59,130,246,0.4); }
    50%      { box-shadow: 0 0 0 8px rgba(96,165,250,0.05), 0 4px 14px rgba(59,130,246,0.4); }
}
.gen-dot-done .gen-dot-num {
    background: linear-gradient(135deg, #34d399 0%, #16a34a 100%);
    color: transparent;
    border-color: rgba(52,211,153,0.5);
    box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
    position: relative;
}
.gen-dot-done .gen-dot-num::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
}
.gen-dot-done .gen-dot-label {
    color: #6ee7b7;
}
.gen-dot-failed .gen-dot-num {
    background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
    color: transparent;
    border-color: rgba(239,68,68,0.5);
    position: relative;
}
.gen-dot-failed .gen-dot-num::after {
    content: '✗';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
}
.gen-dot-skipped {
    opacity: 0.5;
}
.gen-dot-skipped .gen-dot-num {
    background: rgba(255,255,255,0.04);
    color: #8da4be;
}

/* Current stage focus area */
.gen-current-stage {
    padding: 1.5rem 2rem 1.25rem;
    text-align: center;
    transition: opacity 0.35s ease, transform 0.35s ease;
}
.gen-current-stage.gen-stage-transitioning {
    opacity: 0.4;
    transform: translateY(6px);
}
.gen-current-icon {
    --stage-color: #60a5fa;
    width: 88px;
    height: 88px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(96,165,250,0.18) 0%, rgba(96,165,250,0.04) 70%);
    position: relative;
    border: 2px solid rgba(96,165,250,0.25);
    transition: all 0.4s ease;
}
.gen-current-icon::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 2px solid var(--stage-color);
    opacity: 0.35;
}
.gen-current-emoji {
    font-size: 2.4rem;
    line-height: 1;
    animation: gen-emoji-float 2.4s ease-in-out infinite;
}
@keyframes gen-emoji-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}

.gen-pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--stage-color, #60a5fa);
    opacity: 0;
    animation: gen-pulse-ring 2s ease-out infinite;
    pointer-events: none;
}
@keyframes gen-pulse-ring {
    0%   { opacity: 0.65; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.4); }
}

.gen-current-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.4rem;
}
.gen-current-desc {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    max-width: 380px;
    margin: 0 auto;
}
.gen-current-meta {
    font-size: 0.8rem;
    color: #6ee7b7;
    font-weight: 600;
    margin-top: 0.6rem;
    min-height: 1.2rem;
}

/* Animated progress bar at the bottom */
.gen-progress-bar {
    margin: 1.25rem 0 0;
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}
.gen-progress-bar-inner {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #60a5fa 0%, #3b82f6 100%);
    border-radius: 100px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1), background 0.4s ease;
    position: relative;
}
.gen-progress-bar-inner::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 30%;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
    animation: gen-shimmer 1.6s linear infinite;
}
@keyframes gen-shimmer {
    0%   { transform: translateX(-200%); }
    100% { transform: translateX(400%); }
}

/* Success & failed state for current stage */
.gen-current-success .gen-current-icon {
    background: radial-gradient(circle, rgba(16,185,129,0.2) 0%, rgba(16,185,129,0.04) 70%);
    border-color: rgba(16,185,129,0.4);
}
.gen-current-success .gen-current-icon::before {
    border-color: #16a34a;
}
.gen-current-failed .gen-current-icon {
    background: radial-gradient(circle, rgba(239,68,68,0.2) 0%, rgba(239,68,68,0.04) 70%);
    border-color: rgba(239,68,68,0.4);
}
.gen-current-failed .gen-current-icon::before {
    border-color: #dc2626;
}
.gen-current-failed .gen-pulse-ring {
    animation: none;
    opacity: 0;
}
.gen-current-success .gen-pulse-ring {
    animation: none;
    opacity: 0;
}

/* Summary list (shown when pipeline completes) */
.gen-progress-summary-list {
    padding: 1rem 1.75rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.15);
}
.gen-summary-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 0;
    font-size: 0.85rem;
}
.gen-summary-icon {
    font-size: 1rem;
    font-weight: 700;
    width: 18px;
    text-align: center;
}
.gen-summary-name {
    flex: 1;
    color: var(--color-text);
}
.gen-summary-dur {
    color: var(--color-text-muted);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

/* Footer */
.gen-progress-foot {
    padding: 1rem 1.75rem 1.5rem;
    text-align: center;
}
.gen-progress-foot .btn { min-width: 120px; }

/* Error block */
#gen-progress-error {
    padding: 0 1.75rem;
}

/* Mobile responsive */
@media (max-width: 540px) {
    .gen-progress-card { max-width: 95vw; margin: 0 auto; }
    .gen-progress-head { padding: 1.25rem 1.25rem 0.75rem; }
    .gen-progress-dots { padding: 1rem 0.75rem 0; }
    .gen-dot-num { width: 28px; height: 28px; font-size: 0.78rem; }
    .gen-dot-label { font-size: 0.62rem; }
    .gen-current-stage { padding: 1rem 1.25rem; }
    .gen-current-icon { width: 72px; height: 72px; }
    .gen-current-emoji { font-size: 2rem; }
    .gen-current-name { font-size: 1rem; }
}


/* -------------------------------------------------------------------------
   Rich Text Editor (RTE) � paired with public/assets/js/rte.js
   Self-hosted, dark-themed, matches the rest of the dashboard chrome.
   ------------------------------------------------------------------------- */
.rte-wrap {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: rgba(13, 22, 37, 0.6);
    overflow: hidden;
}
.rte-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 3px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid var(--color-border);
}
.rte-btn {
    background: transparent;
    color: var(--color-text);
    border: 1px solid transparent;
    border-radius: 5px;
    padding: 4px 8px;
    min-width: 32px;
    height: 30px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .12s ease, border-color .12s ease;
}
.rte-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); border-color: var(--color-border); }
.rte-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.rte-btn-active { background: rgba(59, 130, 246, 0.2); border-color: rgba(59, 130, 246, 0.4); }
.rte-btn-wide { padding-left: 10px; padding-right: 10px; }
.rte-select {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    padding: 4px 6px;
    font-size: 12px;
    font-family: inherit;
    height: 30px;
    cursor: pointer;
}
.rte-select:disabled { opacity: 0.5; cursor: not-allowed; }
.rte-sep {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: var(--color-border);
    margin: 0 4px;
}
.rte-spacer { flex: 1; }
.rte-editor {
    min-height: 320px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 14px 18px;
    color: var(--color-text);
    background: rgba(0, 0, 0, 0.15);
    font-size: 15px;
    line-height: 1.65;
    outline: none;
    cursor: text;
}
.rte-editor:focus { background: rgba(0, 0, 0, 0.2); }
.rte-editor h1, .rte-editor h2, .rte-editor h3, .rte-editor h4 {
    color: var(--color-text);
    margin: 1.1em 0 0.4em;
    line-height: 1.25;
    font-weight: 700;
}
.rte-editor h1 { font-size: 1.9em; }
.rte-editor h2 { font-size: 1.5em; }
.rte-editor h3 { font-size: 1.2em; }
.rte-editor h4 { font-size: 1.05em; }
.rte-editor p { margin: 0.6em 0; }
.rte-editor a { color: #60a5fa; text-decoration: underline; }
.rte-editor blockquote {
    margin: 1em 0;
    padding: 0.4em 1em;
    border-left: 3px solid rgba(59, 130, 246, 0.5);
    background: rgba(255, 255, 255, 0.03);
    color: var(--color-text-muted);
    font-style: italic;
}
.rte-editor ul, .rte-editor ol { margin: 0.6em 0; padding-left: 1.6em; }
.rte-editor li { margin: 0.2em 0; }
.rte-editor hr {
    border: 0;
    border-top: 1px solid var(--color-border);
    margin: 1.2em 0;
}
.rte-editor img { max-width: 100%; height: auto; border-radius: 4px; }
.rte-editor code {
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'SF Mono', 'Cascadia Mono', Consolas, monospace;
    font-size: 0.9em;
}
.rte-editor:empty::before {
    content: 'Start writing\u2026';
    color: var(--color-text-muted);
    pointer-events: none;
}

/* ============================================
   Reporting Dashboard
   ============================================ */
.reporting-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.kpi-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    backdrop-filter: blur(8px);
}
.kpi-label {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-top: 0.35rem;
    font-variant-numeric: tabular-nums;
}
.reporting-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}
.reporting-tab {
    padding: 0.6rem 1.25rem;
    border: none;
    background: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}
.reporting-tab:hover { color: var(--color-text); }
.reporting-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}
.reporting-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.reporting-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    color: var(--color-text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.reporting-table td {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--color-text);
}
.reporting-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.reporting-not-connected {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--color-text-muted);
}
.reporting-not-connected h3 { margin: 0 0 0.5rem; color: var(--color-text); }
.reporting-not-connected a { color: var(--color-primary); }
.conn-status { font-size: 0.82rem; color: var(--color-text-muted); }
.btn-danger {
    background: rgba(239,68,68,0.15);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover {
    background: rgba(239,68,68,0.25);
    border-color: rgba(239,68,68,0.5);
}
.badge-warning {
    background: rgba(217,119,6,0.15);
    color: #fbbf24;
    border: 1px solid rgba(217,119,6,0.3);
}

/* ============================================
   Dashboard panels & grids (replace inline styles)
   ============================================ */

.dashboard-panels-3col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

.dashboard-panels-2col {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.dashboard-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.dashboard-panel-head h3 { margin: 0; font-size: 1rem; }
.dashboard-panel-head .section-head-link { font-size: 0.8rem; }

.dashboard-panel-inner { padding: 1.25rem; }

.pipeline-list { display: flex; flex-direction: column; gap: 0.4rem; }
.pipeline-item { }
.pipeline-item-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 0.15rem;
}
.pipeline-bar {
    height: 6px;
    background: var(--color-bg);
    border-radius: 3px;
    overflow: hidden;
}
.pipeline-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.client-stats-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.client-stat-box {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    background: var(--color-bg);
    border-radius: 8px;
}
.client-stat-number { font-size: 1.5rem; font-weight: 700; }
.client-stat-number-up   { color: #22c55e; }
.client-stat-number-warn { color: #f59e0b; }
.client-stat-label { font-size: 0.75rem; color: var(--color-text-muted); }

.content-list { display: flex; flex-direction: column; gap: 0.5rem; }
.content-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.content-row-info { flex: 1; min-width: 0; }
.content-row-title {
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.content-row-meta { font-size: 0.7rem; color: var(--color-text-muted); }
.content-row-time {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 350px;
    overflow-y: auto;
}
.activity-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--color-border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon { font-size: 1rem; flex-shrink: 0; }
.activity-body { flex: 1; min-width: 0; font-size: 0.8rem; }
.activity-name { font-weight: 600; }
.activity-context { color: var(--color-text-muted); }
.activity-detail {
    color: var(--color-text-muted);
    font-size: 0.7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.activity-time {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.quick-links-list { display: flex; flex-direction: column; gap: 0.5rem; }
.quick-link-btn {
    text-align: left;
    padding: 0.6rem 0.75rem;
}

.brief-industry-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.brief-industry-name { }
.brief-industry-count { font-weight: 600; }

/* ============================================
   Feed — Facebook-style timeline
   ============================================ */

.page-admin-feed { max-width: 680px; margin: 0 auto; }

/* ─── Composer (Facebook-style "What's on your mind?") ─── */
.feed-composer-wrap.glass-card { padding: 1rem; }

.feed-composer {
    display: flex;
    gap: 0.75rem;
}
.feed-composer-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-top: 2px;
}
.feed-composer-avatar-initial {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 17px;
    color: #fff;
    flex-shrink: 0;
    margin-top: 2px;
}
.feed-composer-input-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.feed-composer-input {
    width: 100%;
    border: none;
    border-radius: 20px;
    padding: 0.55rem 1rem;
    font-size: 14px;
    font-family: inherit;
    background: rgba(255,255,255,.06);
    color: var(--color-text);
    outline: none;
    resize: none;
    min-height: 40px;
    box-sizing: border-box;
}
.feed-composer-input::placeholder { color: var(--color-text-muted); }
.feed-composer-input:focus { background: rgba(255,255,255,.09); }
.feed-composer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.15rem;
}
.feed-composer-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.feed-char-count {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}
.feed-post-btn {
    border-radius: 24px;
    padding: 0.35rem 1.1rem;
    font-size: 13px;
}

/* ─── Timeline posts ─── */
.feed-timeline { display: flex; flex-direction: column; gap: 1rem; padding-top: 20px; }

.feed-post {
    padding: 0.75rem 0.75rem 20px;
}
.feed-post-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.25rem;
}
.feed-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.feed-avatar-initial {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
}
a:has(> .feed-avatar):hover .feed-avatar,
a:has(> .feed-avatar-initial):hover .feed-avatar-initial { opacity: .8; }
.feed-post-author { display: flex; flex-direction: column; }
.feed-post-author strong { font-size: 15px; }
.feed-post-author strong a:hover { text-decoration: underline !important; }
.feed-post-time {
    font-size: 12px;
    color: var(--color-text-muted);
}
.feed-post-body {
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 0.25rem 0 0.85rem;
}

/* ─── Action bar (Like · Comment) ─── */
.feed-post-actions {
    display: flex;
    border-top: 1px solid rgba(255,255,255,.08);
    margin: 0 -0.75rem;
    padding: 0;
}
.feed-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 0;
    transition: background .15s, color .15s;
    font-family: inherit;
}
.feed-action-btn:hover {
    background: rgba(255,255,255,.08);
    color: var(--color-text);
}
.feed-action-btn.is-liked {
    color: var(--color-primary);
}
.feed-action-btn.is-liked .feed-action-icon {
    filter: brightness(1.2);
}
.feed-action-icon { font-size: 16px; }

/* ─── Feed media toolbar (emoji + image upload) ─── */
.feed-media-toolbar {
    display: flex;
    gap: 2px;
    padding: 0;
}
.feed-media-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    transition: all var(--transition);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.feed-media-btn:hover {
    background: rgba(255,255,255,.08);
    color: var(--color-text);
}
.feed-media-btn-label { font-size: 11px; font-weight: 500; }

/* Image preview before upload */
.feed-image-preview-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: 0 0.25rem;
}
.feed-image-preview {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
}
.feed-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.feed-image-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,.6);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Feed post images */
.feed-post-images {
    display: grid;
    gap: 4px;
    margin: 0 -0.75rem 0.75rem;
}
.feed-post-images.single { grid-template-columns: 1fr; }
.feed-post-images.pair { grid-template-columns: 1fr 1fr; }
.feed-post-images.multi { grid-template-columns: 1fr 1fr; }
.feed-post-images img {
    width: 100%;
    display: block;
    object-fit: cover;
    max-height: 420px;
    cursor: pointer;
    transition: opacity .15s;
}
.feed-post-images img:hover { opacity: .85; }
.feed-post-images.single img { border-radius: var(--radius-sm); max-height: 500px; }
.feed-post-images.pair img { height: 220px; }
.feed-post-images.multi img { height: 170px; }
.feed-post-images.multi img:first-child { grid-row: span 2; height: 344px; }

/* Lightbox */
.feed-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.feed-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius-lg);
}

/* Comment section */
.feed-comment-section {
    border-top: 1px solid var(--color-border-soft);
    padding-top: var(--space-3);
    margin-top: var(--space-2);
}
.feed-comment-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.feed-comment {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    position: relative;
}
.feed-comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.feed-comment-avatar-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-gradient);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}
.feed-comment-body {
    flex: 1;
    min-width: 0;
}
.feed-comment-body strong {
    font-size: 13px;
    color: var(--color-text);
}
.feed-comment-body p {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.4;
}
.feed-comment-time {
    font-size: 11px;
    color: var(--color-text-muted);
}
.feed-comment-del {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    opacity: 0;
    transition: opacity .15s;
}
.feed-comment:hover .feed-comment-del { opacity: 1; }
.feed-comment-del:hover { color: var(--color-danger); }
.feed-comment-del-form { flex-shrink: 0; }
.feed-comment-form {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}
.feed-comment-input {
    flex: 1;
    background: rgba(255,255,255,.06);
    border: none;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 14px;
    font-family: inherit;
    color: var(--color-text);
    outline: none;
    transition: background .15s;
}
.feed-comment-input::placeholder { color: var(--color-text-muted); }
.feed-comment-input:focus {
    background: rgba(255,255,255,.09);
}
.feed-comment-submit {
    border-radius: 24px;
    padding: 0.35rem 1.1rem;
    font-size: 13px;
    flex-shrink: 0;
}

/* Emoji picker */
.feed-emoji-picker {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 500;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-lg);
    padding: var(--space-2);
    box-shadow: var(--shadow-lg);
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 1px;
    width: 310px;
    max-height: 220px;
    overflow-y: auto;
    margin-top: 4px;
}
.feed-emoji-btn {
    background: none;
    border: none;
    font-size: 18px;
    padding: 3px 2px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background .1s;
    text-align: center;
    line-height: 1;
}
.feed-emoji-btn:hover { background: var(--color-primary-soft); }

/* ─── Empty ─── */
.feed-empty { text-align: center; padding: 3rem 1rem; }

/* ============================================
   Provider cards (admin/providers)
   — replaces old light-theme embedded <style>
   ============================================ */

.providers-list-section { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; }
.providers-section-heading {
    font-size: 1.15rem;
    margin-bottom: 1rem;
}

.provider-card.status-disabled { opacity: 0.55; }
.provider-card.status-active { border-color: var(--color-primary); border-width: 2px; }

.provider-card-main { flex: 1; min-width: 0; }
.provider-card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-shrink: 0;
}

.provider-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
}
.provider-title strong { color: var(--color-text); }

.status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.dot-ok      { background: #16a34a; box-shadow: 0 0 6px rgba(22,163,74,.4); }
.dot-fail    { background: #dc2626; box-shadow: 0 0 6px rgba(220,38,38,.4); }
.dot-unknown { background: var(--color-text-subtle); }

.badge-disabled {
    background: rgba(255,255,255,.06);
    color: var(--color-text-subtle);
    border: 1px solid rgba(255,255,255,.1);
}

.provider-meta {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1rem;
    margin: 0;
    font-size: 0.9rem;
}
.provider-meta dt {
    color: var(--color-text-muted);
    font-weight: normal;
}
.provider-meta dd { margin: 0; word-break: break-all; }
.provider-meta code, .provider-help code {
    background: rgba(255,255,255,.06);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

.provider-empty-list {
    margin-top: 2rem;
    margin-bottom: 1.5rem;
}

.provider-help-section {
    margin-top: 2.5rem;
    padding: 1.5rem;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}
.provider-help-section h3 { margin-top: 0; font-size: 18px; }

.alert-provider {
    padding: 0.85rem 1.1rem;
    border-radius: 6px;
    background: var(--color-primary-soft);
    border-left: 3px solid var(--color-primary);
    color: #93c5fd;
}
.alert-provider strong { color: var(--color-primary-hover); }

/* ============================================
   SEO Yoast-style live scorer — page detail
   ============================================ */

.seo-preview-wrap {
    background: #fff;
    color: #202124;
    border-radius: 8px;
    padding: 14px 16px;
    font-family: arial, sans-serif;
    max-width: 600px;
}
.seo-preview-title { color: #1a0dab; font-size: 20px; line-height: 1.3; cursor: pointer; }
.seo-preview-url  { color: #006621; font-size: 14px; line-height: 1.3; margin-top: 2px; }
.seo-preview-slug { color: #5f6368; }
.seo-preview-desc { color: #4d5156; font-size: 14px; line-height: 1.58; margin-top: 4px; }

.seo-bar-wrap { height: 6px; background: rgba(255,255,255,.08); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.seo-bar { height: 100%; border-radius: 3px; transition: width .2s, background .2s; }
.seo-bar-green   { background: #22c55e; }
.seo-bar-orange  { background: #f59e0b; }
.seo-bar-red     { background: #ef4444; }

.seo-live-score {
    background: rgba(255,255,255,.03);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}
.seo-score-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-2); }
.seo-score-label { font-size: 13px; font-weight: 600; color: var(--color-text); }
.seo-score-num { font-size: 22px; font-weight: 800; }
.seo-score-green-text { color: #22c55e; }
.seo-score-orange-text { color: #f59e0b; }
.seo-score-red-text { color: #ef4444; }

.seo-score-bar-wrap { height: 8px; background: rgba(255,255,255,.06); border-radius: 4px; overflow: hidden; margin-bottom: var(--space-3); }
.seo-score-bar { height: 100%; border-radius: 4px; transition: width .3s ease; }
.seo-score-green { background: #22c55e; }
.seo-score-orange { background: #f59e0b; }
.seo-score-red { background: #ef4444; }

.seo-suggestions { display: flex; flex-direction: column; gap: 6px; }
.seo-sugg { font-size: 13px; display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; }
.seo-sugg-ok   { background: rgba(34,197,94,.08); color: #86efac; }
.seo-sugg-warn { background: rgba(239,68,68,.08); color: #fca5a5; }
.seo-sugg-icon { font-size: 14px; font-weight: 700; }

/* SEO big score (page_detail sidebar) */
.seo-big-score {
    font-size: 48px;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   Content edit grid
   ============================================ */

.content-edit-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 1.5rem;
    align-items: start;
}

.content-edit-generator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
}

.content-edit-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.content-edit-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* ============================================
   Link project list (websites/show)
   ============================================ */

.link-project-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    margin-bottom: 0.4rem;
}

.link-project-item-actions {
    display: flex;
    gap: 0.4rem;
}

/* ============================================
   Audit summary grid (websites/show SEO modal)
   ============================================ */

.audit-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.audit-summary-item {
    text-align: center;
    padding: 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
}
.audit-summary-item-critical {
    border-color: #fecaca;
    background: rgba(220,38,38,0.05);
}
.audit-summary-item-warning {
    border-color: #fcd34d;
    background: rgba(217,119,6,0.05);
}
.audit-summary-item-opportunity {
    border-color: #bfdbfe;
    background: rgba(37,99,235,0.05);
}

.audit-summary-number {
    font-size: 1.5rem;
    font-weight: 700;
}
.audit-summary-number-critical     { color: #dc2626; }
.audit-summary-number-warning      { color: #d97706; }
.audit-summary-number-opportunity  { color: #2563eb; }

.audit-summary-label { font-size: 0.8rem; color: var(--color-text-muted); }

/* Logo upload row (settings) — prevents Clear button from being pushed off */
.logo-upload-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.logo-upload-row input[type="file"] {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: rgba(255,255,255,.06);
    color: var(--color-text);
    font-size: 13px;
}
.logo-upload-row input[type="file"]::file-selector-button {
    padding: 4px 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,.08);
    color: var(--color-text);
    cursor: pointer;
    font-size: 12px;
    margin-right: 8px;
}
.logo-upload-row input[type="file"]::file-selector-button:hover {
    background: rgba(255,255,255,.14);
}

/* ============================================
   Page actions inline pattern
   ============================================ */

.page-actions-inline {
    display: flex;
    gap: 0.5rem;
}

/* ============================================
   Sidebar responsive — collapse on mobile
   ============================================ */

@media (max-width: 900px) {
    .sidebar-toggle-mobile { display: inline-flex; }
    body { padding-left: 0 !important; }
    .sidebar {
        width: var(--sidebar-width) !important;
        transform: translateX(-100%);
        transition: transform .25s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 199;
        display: none;
    }
    .sidebar-overlay.open { display: block; }
    .sidebar-collapsed .sidebar { transform: translateX(-100%); }
    .sidebar-collapsed .sidebar.open { transform: translateX(0); }
}

@media (max-width: 640px) {
    .main-wrap { padding: var(--space-4) var(--space-3); }
    .feed-post-images.single img { max-height: 260px; }
    .feed-post-images.pair { grid-template-columns: 1fr; }
    .feed-post-images.pair img,
    .feed-post-images.multi img { height: 200px; }
    .feed-post-images.multi img:first-child { height: 200px; }
    .feed-emoji-picker { width: 230px; grid-template-columns: repeat(8, 1fr); max-height: 180px; }
    .feed-image-preview { width: 64px; height: 64px; }
    .feed-composer-avatar { width: 32px; height: 32px; }
    .feed-composer-avatar-initial { width: 32px; height: 32px; font-size: 14px; }
    .feed-avatar { width: 36px; height: 36px; }
    .feed-avatar-initial { width: 36px; height: 36px; font-size: 15px; }
}

/* ─── SMC badge ─── */
.feed-avatar-smc {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    flex-shrink: 0;
}
.feed-badge-smc {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    color: #fff;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 4px;
    vertical-align: middle;
}
.feed-post-source {
    padding: 0 0.75rem 0.5rem;
}
.feed-post-source a {
    font-size: 13px;
    color: var(--color-primary);
    text-decoration: none;
}
.feed-post-source a:hover { text-decoration: underline; }

/* ─── Feed like count ─── */
.feed-like-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary);
    margin-left: 3px;
}
.feed-action-btn.is-liked .feed-like-count { color: var(--color-primary); }

/* ─── Notification bell ─── */
.sidebar-notif-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.sidebar-notif-badge {
    position: absolute;
    top: -2px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    background: var(--color-danger);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    pointer-events: none;
}
.sidebar-notif-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: -11px;
    width: 220px;
    max-height: 420px;
    /* Opaque: the dark theme's surface-raised is 10% white, which let the
       sidebar links show through the open dropdown. */
    background: var(--color-bg-2);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-lg);
    box-shadow: 0 -4px 24px rgba(0,0,0,.25);
    z-index: 501;
    overflow-y: auto;
}
[data-theme="light"] .sidebar-notif-dropdown { background: var(--color-surface-raised); }
.notif-dropdown { padding: 0; }
.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border-soft);
    font-size: 14px;
}
.notif-mark-all-btn {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 12px;
    cursor: pointer;
}
.notif-mark-all-btn:hover { text-decoration: underline; }
.notif-dropdown-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
}
.notif-dropdown-list { display: flex; flex-direction: column; }
.notif-item {
    display: block;
    padding: 0.6rem 1rem;
    text-decoration: none;
    border-bottom: 1px solid var(--color-border-soft);
    transition: background .1s;
}
.notif-item:hover { background: var(--color-surface-hover); }
.notif-unread { background: rgba(37,99,235,.06); }
.notif-item-title { font-size: 13px; color: var(--color-text); font-weight: 500; }
.notif-item-msg { font-size: 12px; color: var(--color-text-secondary); margin-top: 2px; }
.notif-item-time { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }
.notif-dropdown-view-all {
    display: block;
    text-align: center;
    padding: 0.6rem;
    font-size: 13px;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}
.notif-dropdown-view-all:hover { background: var(--color-surface-hover); }

/* ─── Notifications page ─── */
.notif-page-list { display: flex; flex-direction: column; gap: 0.5rem; }
.notif-page-item {
    display: block;
    padding: 1rem;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: border-color .15s;
}
.notif-page-item:hover { border-left-color: var(--color-primary); }
.notif-page-unread { border-left-color: var(--color-primary); background: rgba(37,99,235,.04); }
.notif-page-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.notif-page-type {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 4px;
}
.notif-type-like { background: rgba(239,68,68,.12); color: #ef4444; }
.notif-type-comment { background: rgba(37,99,235,.12); color: #2563eb; }
.notif-type-mention { background: rgba(124,58,237,.12); color: #7c3aed; }
.notif-page-time { font-size: 12px; color: var(--color-text-muted); }
.notif-page-title { font-size: 14px; color: var(--color-text); font-weight: 500; }
.notif-page-msg { font-size: 13px; color: var(--color-text-secondary); margin-top: 2px; }

/* ─── Feed sources page ─── */
.feed-source-form { margin: 0; }
.feed-source-fields {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.feed-source-input, .feed-source-select {
    padding: 0.5rem 0.75rem;
    font-size: 13px;
    font-family: inherit;
    background: var(--color-surface);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-md);
    color: var(--color-text);
    outline: none;
}
.feed-source-input:focus, .feed-source-select:focus {
    border-color: var(--color-primary);
}
.feed-source-link {
    font-size: 13px;
    color: var(--color-primary);
    text-decoration: none;
}
.feed-source-link:hover { text-decoration: underline; }
.feed-source-cat {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}
.feed-cat-seo { background: rgba(37,99,235,.12); color: #2563eb; }
.feed-cat-webdev { background: rgba(124,58,237,.12); color: #7c3aed; }
.feed-cat-social { background: rgba(236,72,153,.12); color: #ec4899; }
.feed-cat-paid { background: rgba(245,158,11,.12); color: #f59e0b; }
.feed-cat-marketing { background: rgba(16,185,129,.12); color: #10b981; }

/* ─── Profile Page (MySpace-style) ─── */
.page-profile-wrap { min-height: calc(100vh - 60px); background: var(--color-bg); }
.prof-cover {
    width: 100%; height: 300px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #1e293b 100%);
    background-size: cover; background-position: center;
    position: relative; border-radius: 0;
}
.prof-cover-upload {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    opacity: 0; transition: opacity .2s;
    background: rgba(0,0,0,.7); color: #fff;
    padding: 8px 16px; border-radius: 6px; font-size: 13px; cursor: pointer;
}
.prof-cover:hover .prof-cover-upload { opacity: 1; }
.prof-cover-remove {
    position: absolute; top: 12px; right: 12px;
    background: rgba(239,68,68,.8); color: #fff;
    border: none; width: 28px; height: 28px; border-radius: 50%;
    font-size: 14px; cursor: pointer; opacity: 0; transition: opacity .2s;
}
.prof-cover:hover .prof-cover-remove { opacity: 1; }
.prof-header {
    max-width: 1060px; margin: -60px auto 0; padding: 0 28px;
    display: flex; align-items: flex-end; gap: 20px;
}
.prof-avatar-wrap { position: relative; flex-shrink: 0; }
.prof-avatar {
    width: 120px; height: 120px; border-radius: 50%;
    border: 4px solid var(--color-bg);
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    background-size: cover; background-position: center;
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}
.prof-avatar-initial { font-size: 42px; color: #fff; font-weight: 700; }
.prof-avatar-upload {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.5); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; cursor: pointer;
    opacity: 0; transition: opacity .2s;
}
.prof-avatar:hover .prof-avatar-upload { opacity: 1; }
.prof-avatar-remove {
    position: absolute; top: -4px; right: -4px;
    background: rgba(239,68,68,.9); color: #fff;
    border: none; width: 22px; height: 22px; border-radius: 50%;
    font-size: 11px; cursor: pointer;
}
.prof-info { padding-bottom: 8px; }
.prof-name { font-size: 28px; margin: 0 0 2px; z-index: 9999999; position: relative; }
.prof-role { font-size: 14px; color: var(--color-text-muted); margin: 0; }
.prof-email { font-size: 13px; color: var(--color-text-muted); margin: 2px 0 0; }
.prof-content {
    max-width: 1060px; margin: 32px auto; padding: 0 28px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
}
@media(max-width:760px){ .prof-content { grid-template-columns: 1fr; } }
.prof-card {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); padding: 20px;
    backdrop-filter: var(--blur); margin-bottom: 24px;
}
.prof-card h3 { font-size: 16px; margin: 0 0 14px; }
.prof-empty { color: var(--color-text-muted); font-size: 13px; margin: 0 0 10px; }
.prof-edit-btn {
    font-size: 12px; color: var(--color-primary); cursor: pointer;
    background: none; border: none; text-decoration: underline; padding: 0;
}
.prof-edit-btn:hover { color: var(--color-accent); }
.prof-edit-form { margin-top: 10px; }
.prof-input {
    width: 100%; padding: 8px 12px; font-size: 14px; font-family: inherit;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); color: var(--color-text); margin-bottom: 8px; outline: none;
}
.prof-input:focus { border-color: var(--color-primary); }
.prof-textarea {
    width: 100%; padding: 8px 12px; font-size: 14px; font-family: inherit;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); color: var(--color-text); margin-bottom: 8px; outline: none; resize: vertical;
}
.prof-textarea:focus { border-color: var(--color-primary); }
.prof-label {
    display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--color-text);
}
.prof-hint { font-weight: 400; color: var(--color-text-muted); font-size: 11px; }
.prof-color-row {
    display: flex; gap: 8px; align-items: center; margin-bottom: 8px;
}
.prof-color-pick { width: 36px; height: 36px; border: none; border-radius: 6px; cursor: pointer; padding: 0; }
.prof-music-embed { margin: 0 0 10px; }

/* ── Builder: "Auto-create from brief" suggestions card ──────────────────────
   Used by app/views/pages/index.php. Defined here (rather than remapping the
   markup) so the card matches the .glass-card vocabulary in the dark theme. */
.suggestions-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
    backdrop-filter: var(--blur);
}
.suggestions-head { margin-bottom: var(--space-4); }
.suggestions-head h2,
.suggestions-head h3 { margin: 0 0 var(--space-1); }
.suggestions-head p { margin: 0; color: var(--color-text-muted); font-size: 0.9rem; }
.suggestions-form { display: flex; flex-direction: column; gap: var(--space-2); }
.suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-alt, var(--color-surface));
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.suggestion-item:hover { border-color: var(--color-primary); }
.suggestion-item input[type="checkbox"],
.suggestion-item input[type="radio"] { margin-top: 3px; accent-color: var(--color-primary); cursor: pointer; }
.suggestion-inner { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.suggestion-title { font-weight: 600; color: var(--color-text); }
.suggestion-detail { font-size: 0.85rem; color: var(--color-text-muted); }
.suggestions-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

/* ============================================================================
   Accessibility baseline (global) — applies to every page/module.
   Keyboard focus was previously invisible; these give one consistent focus
   affordance, respect reduced-motion, and guarantee a usable touch target.
   ============================================================================ */

/* Visible keyboard focus for every interactive element. :focus-visible only
   shows the ring for keyboard/AT navigation, never on mouse click, so it does
   not disturb the existing hover/click visuals. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
.btn:focus-visible,
.sidebar-link:focus-visible,
.tf-page-check:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Inputs already carry a focus box-shadow; pair it with a real outline so the
   affordance survives high-contrast mode. */
.form-input:focus-visible,
.field-input:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

/* Small icon-only buttons must still meet the ~44px touch-target minimum. */
.btn.btn-icon,
.icon-btn,
button.icon-only {
    min-width: 40px;
    min-height: 40px;
}

/* Honor the OS "reduce motion" setting: strip transitions/animations for users
   who ask for it (vestibular safety), without changing anyone else's experience. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* The one button class used without a base .btn (templates "set default" star).
   Give it a consistent, accessible affordance so it matches the design system. */
.btn-toggle-default {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-toggle-default:hover {
    border-color: var(--color-primary);
    color: var(--color-text);
}
.btn-toggle-default.is-default {
    border-color: var(--color-warn);
    color: var(--color-warn);
}

/* ============================================================================
   Utility layer — the sanctioned alternative to inline style="" attributes.
   Covers the layout/text patterns views were hand-rolling inline. New code
   should compose these (plus the tokens above) instead of style attributes,
   so light/dark theming and future design changes apply everywhere.
   ============================================================================ */

/* Flex layout */
.u-flex        { display: flex; }
.u-inline-flex { display: inline-flex; }
.u-col         { flex-direction: column; }
.u-wrap        { flex-wrap: wrap; }
.u-ai-center   { align-items: center; }
.u-ai-start    { align-items: flex-start; }
.u-ai-baseline { align-items: baseline; }
.u-jc-between  { justify-content: space-between; }
.u-jc-center   { justify-content: center; }
.u-jc-end      { justify-content: flex-end; }
.u-flex-1      { flex: 1; }
.u-shrink-0    { flex-shrink: 0; }

/* Gap / spacing (token scale) */
.u-gap-1 { gap: var(--space-1); }
.u-gap-2 { gap: var(--space-2); }
.u-gap-3 { gap: var(--space-3); }
.u-gap-4 { gap: var(--space-4); }
.u-mt-0 { margin-top: 0; }
.u-mt-1 { margin-top: var(--space-1); }
.u-mt-2 { margin-top: var(--space-2); }
.u-mt-3 { margin-top: var(--space-3); }
.u-mt-4 { margin-top: var(--space-4); }
.u-mb-0 { margin-bottom: 0; }
.u-mb-1 { margin-bottom: var(--space-1); }
.u-mb-2 { margin-bottom: var(--space-2); }
.u-mb-3 { margin-bottom: var(--space-3); }
.u-mb-4 { margin-bottom: var(--space-4); }

/* Text */
.u-text-muted   { color: var(--color-text-muted); }
.u-text-subtle  { color: var(--color-text-subtle); }
.u-text-success { color: var(--color-success-text); }
.u-text-warn    { color: var(--color-warn-text); }
.u-text-error   { color: var(--color-error-text); }
.u-text-sm      { font-size: 13px; }
.u-text-xs      { font-size: 12px; }
.u-text-center  { text-align: center; }
.u-text-right   { text-align: right; }
.u-mono         { font-family: var(--font-mono); }
.u-bold         { font-weight: 700; }
.u-semibold     { font-weight: 600; }
.u-break        { word-break: break-all; }
.u-nowrap       { white-space: nowrap; }

/* Misc */
.u-hidden    { display: none; }
.u-block     { display: block; }
.u-w-full    { width: 100%; }
.u-scroll-x  { overflow-x: auto; }
.u-relative  { position: relative; }

/* ============================================================================
   Component layer — blessed building blocks (see /admin/styleguide).
   Every page composes THESE (plus the utilities above) instead of inline
   styles, so the whole platform can be re-themed from one file.
   ============================================================================ */

/* Card title + header row — replaces the hand-rolled
   <h3 style="margin-top:0;font-size:1rem"> and flex-between headers. */
.card-title {
    margin: 0 0 var(--space-3);
    font-size: 1rem;
    font-weight: 700;
}
.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-3);
}
.card-head .card-title { margin-bottom: 0; }
.card-head:last-child  { margin-bottom: 0; }

/* Action bar — the strip of page-level actions under the header
   (buttons left, status text right via .u-flex-1 spacer). */
.action-bar {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    backdrop-filter: var(--blur);
    margin-bottom: var(--space-5);
}

/* Kicker — the small uppercase section label used above lists/metrics. */
.kicker {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--color-text-muted);
    font-weight: 700;
    margin-bottom: var(--space-1);
}

/* Compact stat tiles — dense dashboards (7+ tiles per row). Compose with
   the existing .stats-row/.stat-card and add the modifier on the row. */
.stats-row.stats-compact {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-3);
}
.stats-row.stats-compact .stat-card { padding: var(--space-4) var(--space-4); }
.stats-row.stats-compact .stat-number { font-size: 1.7rem; letter-spacing: -0.01em; }
.stats-row.stats-compact .stat-sub { margin-top: var(--space-1); font-size: 11px; color: var(--color-text-subtle); }

/* Status dot — generic liveness/status indicator (list rows, action bars). */
.status-dot {
    display: inline-block;
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--color-text-subtle);
    flex-shrink: 0;
}
.status-dot-success { background: var(--color-success); box-shadow: 0 0 6px rgba(16,185,129,.6); }
.status-dot-warn    { background: var(--color-warn);    box-shadow: 0 0 6px rgba(245,158,11,.6); }
.status-dot-error   { background: var(--color-error);   box-shadow: 0 0 6px rgba(239,68,68,.6); }

/* Underline tabs — secondary tab row inside a page (content hub, settings). */
.subtabs {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-5);
}
.subtab-link {
    padding: 0.65rem 1.1rem;
    text-decoration: none;
    color: var(--color-text-muted);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--transition);
}
.subtab-link:hover { color: var(--color-text); text-decoration: none; }
.subtab-link-active {
    color: var(--color-text);
    font-weight: 600;
    border-bottom-color: var(--color-primary);
}

/* Muted suffix inside a card title: <h3 class="card-title">X <span class="title-sub">— note</span></h3> */
.title-sub {
    font-weight: 400;
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Plain list — compact bullet lists inside cards. */
.list-plain {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 13.5px;
}
.list-plain li { margin-bottom: var(--space-1); }

/* ── Command palette (Ctrl/Cmd+K) ── */
.cmdk-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
}
.cmdk-panel {
    width: 100%;
    max-width: 560px;
    background: var(--color-surface-solid, #16233a);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(0,0,0,.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 70vh;
}
:root[data-theme="light"] .cmdk-panel { background: #fff; }
.cmdk-input {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text);
    font-size: 16px;
    padding: var(--space-4) var(--space-5);
    outline: none;
}
.cmdk-input::placeholder { color: var(--color-text-subtle); }
.cmdk-results { overflow-y: auto; padding: var(--space-2) 0; }
.cmdk-group-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--color-text-subtle);
    font-weight: 700;
    padding: var(--space-2) var(--space-5) var(--space-1);
}
.cmdk-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-5);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    color: var(--color-text);
}
.cmdk-item-active, .cmdk-item:hover { background: rgba(255,255,255,.07); }
:root[data-theme="light"] .cmdk-item-active,
:root[data-theme="light"] .cmdk-item:hover { background: rgba(0,0,0,.05); }
.cmdk-item-icon { font-size: 16px; flex-shrink: 0; }
.cmdk-item-body { min-width: 0; flex: 1; }
.cmdk-item-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item-sub { font-size: 11.5px; color: var(--color-text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-empty { padding: var(--space-5); text-align: center; color: var(--color-text-muted); font-size: 13px; }
.cmdk-hint {
    display: flex;
    justify-content: space-between;
    padding: var(--space-2) var(--space-5);
    border-top: 1px solid var(--color-border);
    font-size: 11px;
    color: var(--color-text-subtle);
}
.cmdk-hint kbd {
    background: rgba(255,255,255,.08);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: var(--font-mono);
    font-size: 10px;
}

/* Sidebar search trigger — opens the palette. */
.sidebar-search-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: calc(100% - 2 * var(--space-4));
    margin: var(--space-2) var(--space-4);
    padding: var(--space-2) var(--space-3);
    background: rgba(255,255,255,.04);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-subtle);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}
.sidebar-search-btn:hover { background: rgba(255,255,255,.08); color: var(--color-text-muted); }
.sidebar-search-btn kbd {
    margin-left: auto;
    background: rgba(255,255,255,.08);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 0 5px;
    font-family: var(--font-mono);
    font-size: 10px;
}
.sidebar-collapsed .sidebar-search-btn .sidebar-search-text,
.sidebar-collapsed .sidebar-search-btn kbd { display: none; }

/* Media picker grid — browse-the-library tab of the Insert-image modal. */
.media-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: var(--space-2);
}
.media-pick-item {
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    background: rgba(0,0,0,.15);
    padding: 0;
    line-height: 0;
    transition: border-color var(--transition);
}
.media-pick-item img { width: 100%; height: 78px; object-fit: cover; display: block; }
.media-pick-item:hover { border-color: var(--color-border); }
.media-pick-item-active { border-color: var(--color-primary); box-shadow: var(--glow-blue); }

/* Queue grid — the "My Work" cards on the home dashboard. */
.queue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-4);
}
.queue-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-muted);
}

/* Accounts table — the CRM-style client list. */
.clients-table td { vertical-align: middle; }
.clients-table a.badge { text-decoration: none; }
.clients-table a.badge:hover { filter: brightness(1.15); }

/* Two-column card grid that stacks on small screens. */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
    align-items: start;
}
@media (max-width: 900px) {
    .grid-2col { grid-template-columns: 1fr; }
}

/* ─── QR code tool ─────────────────────────── */

/* White tile behind the QR so codes read correctly on the dark theme. */
.qr-tile {
    flex: 0 0 auto;
    display: block;
    width: 104px;
    height: 104px;
    background: #fff;
    border-radius: var(--radius-md);
    padding: 8px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.qr-tile img { width: 100%; height: 100%; display: block; }
/* Small variant for table rows. */
.qr-tile-sm {
    width: 44px;
    height: 44px;
    padding: 4px;
    border-radius: var(--radius-sm);
}
/* Short-link pill with inline copy button. */
.qr-link-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    background: rgba(59,130,246,.08);
    border: 1px solid rgba(59,130,246,.25);
    border-radius: 999px;
    padding: 2px 4px 2px 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--color-primary);
    white-space: nowrap;
}
.qr-link-pill .qr-copy {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 999px;
    line-height: 1.2;
}
.qr-link-pill .qr-copy:hover { background: rgba(59,130,246,.18); }
/* Compact stat chips used on the QR analytics card. */
.qr-ministats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: var(--space-2);
}
.qr-ministat {
    background: rgba(148,163,184,.07);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
}
.qr-ministat .n { font-size: 22px; font-weight: 800; line-height: 1.1; }
.qr-ministat .l {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: 700;
    color: var(--color-text-subtle);
    margin-top: 2px;
}
/* White backing for the big preview on the manage page. */
.qr-preview-wrap {
    display: grid;
    place-items: center;
    background: #fff;
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

/* Small utility fills used by the QR pages (and reusable elsewhere). */
.u-font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.u-fw-600 { font-weight: 600; }
.u-ai-end { align-items: flex-end; }

/* ─── Kanban board (CRM pipeline + Tasks) ─────────────────────────── */
.kanban-board {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(230px, 1fr);
    gap: var(--space-3);
    overflow-x: auto;
    align-items: start;
    padding-bottom: var(--space-2);
}
.kanban-col {
    background: rgba(148,163,184,.05);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2);
    min-height: 120px;
}
.kanban-col-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--color-text-subtle);
}
.kanban-col-head .kanban-count {
    background: var(--color-border);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 11px;
    color: var(--color-text-muted);
}
.kanban-col.drag-over { border-color: var(--color-primary); background: rgba(59,130,246,.06); }
.kanban-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: var(--space-2);
    cursor: grab;
    transition: border-color var(--transition), box-shadow var(--transition);
    display: block;
    text-decoration: none;
    color: inherit;
}
.kanban-card:hover { border-color: rgba(59,130,246,.4); box-shadow: var(--glow-blue); }
.kanban-card.dragging { opacity: .45; }
.kanban-card-title { font-weight: 600; font-size: 13.5px; margin-bottom: 4px; display: block; color: var(--color-text); }
.kanban-card-meta { font-size: 11.5px; color: var(--color-text-muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kanban-col-muted { opacity: .75; }
/* Priority chips for task cards */
.prio-low    { color: var(--color-text-subtle); }
.prio-normal { color: var(--color-text-muted); }
.prio-high   { color: #f59e0b; font-weight: 700; }
.prio-urgent { color: var(--color-error); font-weight: 700; }

/* ─── Team chat ─────────────────────────── */
.chat-wrap { display: flex; min-height: 560px; max-height: calc(100vh - 220px); overflow: hidden; }
.chat-side {
    width: 230px;
    flex: 0 0 auto;
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    padding: 6px 0;
}
.chat-side-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px 2px; }
.chat-chan {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 7px 12px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
    gap: 8px;
}
.chat-chan:hover { background: rgba(148,163,184,.08); color: var(--color-text); }
.chat-chan-active { background: rgba(59,130,246,.12); color: var(--color-text); font-weight: 600; }
.chat-unread {
    background: var(--color-primary);
    color: #fff;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 7px;
}
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-main-head { padding: 10px 16px; border-bottom: 1px solid var(--color-border); font-weight: 700; }
.chat-messages { flex: 1; overflow-y: auto; padding: 12px 16px; }
.chat-msg { margin-bottom: 10px; max-width: 78%; }
.chat-msg-mine { margin-left: auto; text-align: right; }
.chat-msg-meta { font-size: 11px; color: var(--color-text-subtle); margin-bottom: 2px; }
.chat-msg-meta span { opacity: .8; }
.chat-msg-body {
    display: inline-block;
    background: rgba(148,163,184,.1);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 7px 11px;
    font-size: 13.5px;
    text-align: left;
    word-break: break-word;
}
.chat-msg-mine .chat-msg-body { background: rgba(59,130,246,.14); border-color: rgba(59,130,246,.3); }
.chat-compose { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--color-border); }
@media (max-width: 760px) {
    .chat-side { width: 160px; }
}
/* Sidebar nav unread pill */
.nav-badge {
    background: var(--color-primary);
    color: #fff;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    margin-left: auto;
}

/* ─── SOP reader ─────────────────────────── */
.sop-doc { padding: var(--space-6); }
.sop-body { max-width: 760px; margin: 0 auto; line-height: 1.7; font-size: 15px; }
.sop-body h2 { margin: 1.6em 0 .5em; font-size: 1.3rem; }
.sop-body h3 { margin: 1.2em 0 .4em; font-size: 1.1rem; }
.sop-body h4 { margin: 1em 0 .3em; font-size: 1rem; }
.sop-body p { margin: 0 0 .9em; color: var(--color-text-muted); }
.sop-body ul, .sop-body ol { margin: 0 0 1em 1.4em; color: var(--color-text-muted); }
.sop-body li { margin-bottom: .35em; }
.sop-body strong { color: var(--color-text); }
.sop-body a { color: var(--color-primary); }
.sop-table td { padding-top: 6px; padding-bottom: 6px; }

/* ─── Floating chat dock (Messenger-style) ─── */
#chatDock { position: fixed; bottom: 0; right: 0; z-index: 800; pointer-events: none; }
#chatDock > * { pointer-events: auto; }
.chat-dock-btn {
    position: fixed;
    bottom: 18px; right: 18px;
    width: 52px; height: 52px;
    border-radius: 50%;
    border: 1px solid var(--color-border-strong);
    background: var(--color-primary);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(0,0,0,.35);
    display: flex; align-items: center; justify-content: center;
    transition: transform var(--transition), background var(--transition);
}
.chat-dock-btn:hover { background: var(--color-primary-hover); transform: translateY(-2px); }
.chat-dock-badge {
    position: absolute; top: -3px; right: -3px;
    min-width: 18px; height: 18px;
    background: var(--color-danger, #ef4444);
    color: #fff; font-size: 10px; font-weight: 700;
    border-radius: 9px; padding: 0 5px;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}
.chat-dock-panel {
    position: fixed;
    bottom: 80px; right: 18px;
    width: 280px; max-height: 60vh;
    background: var(--color-bg-2);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0,0,0,.4);
    overflow-y: auto;
    z-index: 801;
}
[data-theme="light"] .chat-dock-panel { background: var(--color-surface-raised); }
.chat-dock-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px;
    font-weight: 700; font-size: 14px;
    border-bottom: 1px solid var(--color-border);
    position: sticky; top: 0;
    background: inherit;
}
.chat-dock-head a { color: var(--color-text-muted); text-decoration: none; font-size: 15px; }
.chat-dock-head a:hover { color: var(--color-primary); }
.chat-dock-sect {
    padding: 8px 14px 4px;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em;
    color: var(--color-text-subtle);
}
.chat-dock-item {
    display: flex; align-items: center; gap: 9px;
    width: 100%;
    padding: 7px 14px;
    background: none; border: none; cursor: pointer;
    color: var(--color-text);
    font-size: 13px; text-align: left;
}
.chat-dock-item:hover { background: var(--color-primary-soft); }
.chat-dock-ic { width: 24px; text-align: center; color: var(--color-text-muted); font-weight: 700; flex-shrink: 0; }
.chat-dock-av {
    width: 24px; height: 24px; border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    color: #fff; font-size: 11px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.chat-dock-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-dock-unread {
    min-width: 17px; height: 17px;
    background: var(--color-danger, #ef4444);
    color: #fff; font-size: 10px; font-weight: 700;
    border-radius: 9px; padding: 0 5px;
    display: flex; align-items: center; justify-content: center;
}
.chat-dock-loading { padding: 16px; font-size: 13px; color: var(--color-text-muted); text-align: center; }

/* Chat windows — dock along the bottom, Messenger-style */
.chat-win {
    position: fixed;
    bottom: 0;
    width: 284px; height: 384px;
    display: flex; flex-direction: column;
    background: var(--color-bg-2);
    border: 1px solid var(--color-border-strong);
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -4px 28px rgba(0,0,0,.35);
    z-index: 799;
    overflow: hidden;
}
[data-theme="light"] .chat-win { background: var(--color-surface-raised); }
.chat-win-minimized { height: 40px; }
.chat-win-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 9px 12px;
    background: var(--color-primary);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
}
.chat-win-title { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.chat-win-unseen {
    min-width: 17px; height: 17px;
    background: var(--color-danger, #ef4444);
    color: #fff; font-size: 10px; font-weight: 700;
    border-radius: 9px; padding: 0 5px;
    display: inline-flex; align-items: center; justify-content: center;
}
.chat-win-btns { display: flex; gap: 2px; flex-shrink: 0; }
.chat-win-hbtn {
    width: 22px; height: 22px;
    background: none; border: none;
    color: rgba(255,255,255,.85);
    font-size: 15px; line-height: 1;
    cursor: pointer; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
}
.chat-win-hbtn:hover { background: rgba(255,255,255,.18); color: #fff; }
.chat-win-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex; flex-direction: column; gap: 7px;
}
.chat-win-minimized .chat-win-body, .chat-win-minimized .chat-win-form { display: none; }
.chat-msg { display: flex; flex-direction: column; max-width: 82%; }
.chat-msg-me { align-self: flex-end; align-items: flex-end; }
.chat-msg-them { align-self: flex-start; align-items: flex-start; }
.chat-msg-who { font-size: 10px; color: var(--color-text-subtle); margin: 0 4px 2px; }
.chat-msg-bubble {
    padding: 6px 11px;
    border-radius: 14px;
    font-size: 13px; line-height: 1.45;
    word-break: break-word; white-space: pre-wrap;
}
.chat-msg-me .chat-msg-bubble { background: var(--color-primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg-them .chat-msg-bubble { background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-text); border-bottom-left-radius: 4px; }
[data-theme="light"] .chat-msg-them .chat-msg-bubble { background: rgba(0,0,0,.05); }
.chat-win-form {
    display: flex; gap: 6px;
    padding: 8px;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}
.chat-win-input {
    flex: 1;
    padding: 7px 11px;
    font-size: 13px;
    border-radius: 16px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    outline: none;
}
.chat-win-input:focus { border-color: var(--color-primary); }
.chat-win-send {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: none;
    background: var(--color-primary);
    color: #fff; font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.chat-win-send:hover { background: var(--color-primary-hover); }

@media (max-width: 640px) {
    /* Small screens: keep the launcher, but floating windows would cover the
       whole viewport — send people to the full /chat page instead. */
    .chat-win { display: none; }
}
