* { margin: 0; padding: 0; box-sizing: border-box; }

/* ============================================================
   DESIGN SYSTEM — LIGHT THEME (DEFAULT) + DARK THEME TOGGLE
   ============================================================ */

:root,
[data-theme="light"] {
    /* Surfaces */
    --surface-0: #FAFBFD;
    --surface-1: #FFFFFF;
    --surface-2: #F4F5F7;
    --surface-3: #ECEEF2;
    --surface-4: #F0F1F4;

    /* Borders */
    --border-subtle: rgba(0,0,0,0.06);
    --border-default: rgba(0,0,0,0.10);
    --border-strong: rgba(0,0,0,0.16);

    /* Text */
    --text-primary: #1A1D23;
    --text-secondary: #5F6673;
    --text-tertiary: #8E95A2;
    --text-disabled: #B5BAC5;

    /* Accent */
    --accent: #4F46E5;
    --accent-hover: #4338CA;
    --accent-subtle: rgba(79,70,229,0.08);
    --accent-ring: rgba(79,70,229,0.25);

    /* Semantic */
    --success: #16A34A;
    --success-bg: rgba(22,163,74,0.08);
    --warning: #D97706;
    --warning-bg: rgba(217,119,6,0.08);
    --error: #DC2626;
    --error-bg: rgba(220,38,38,0.06);
    --error-border: rgba(220,38,38,0.20);
    --error-text: #DC2626;

    /* Card shadow — minimal, light only */
    --shadow-card: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-panel: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-modal: 0 8px 32px rgba(0,0,0,0.12);
}

[data-theme="dark"] {
    /* Surfaces */
    --surface-0: #0C0D11;
    --surface-1: #141520;
    --surface-2: #1A1B27;
    --surface-3: #222432;
    --surface-4: #2A2C3A;

    /* Borders */
    --border-subtle: rgba(255,255,255,0.06);
    --border-default: rgba(255,255,255,0.10);
    --border-strong: rgba(255,255,255,0.16);

    /* Text */
    --text-primary: #EDEEF2;
    --text-secondary: #9CA3B0;
    --text-tertiary: #6B7280;
    --text-disabled: #4B5060;

    /* Accent */
    --accent: #6366F1;
    --accent-hover: #818CF8;
    --accent-subtle: rgba(99,102,241,0.12);
    --accent-ring: rgba(99,102,241,0.30);

    /* Semantic */
    --success: #22C55E;
    --success-bg: rgba(34,197,94,0.10);
    --warning: #F59E0B;
    --warning-bg: rgba(245,158,11,0.10);
    --error: #EF4444;
    --error-bg: rgba(239,68,68,0.08);
    --error-border: rgba(239,68,68,0.25);
    --error-text: #FCA5A5;

    --shadow-card: none;
    --shadow-panel: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-modal: 0 8px 40px rgba(0,0,0,0.6);
}

:root {
    /* Legacy aliases — kept for JS component compat */
    --bg: var(--surface-0);
    --bg-raised: var(--surface-2);
    --bg-input: var(--surface-4);
    --border: var(--border-default);
    --border-hover: var(--border-strong);
    --border-focus: var(--accent-ring);
    --text: var(--text-primary);
    --text-dim: var(--text-secondary);
    --text-muted: var(--text-tertiary);
    --text-faint: var(--text-disabled);
    --text-ghost: var(--text-disabled);
    --white: var(--text-primary);
    --accent-blue: var(--accent);
    --accent-blue-bg: var(--accent-subtle);
    --accent-gray: var(--text-tertiary);
    --accent-gray-bg: rgba(120,120,120,0.12);
    --accent-green: var(--success);
    --accent-yellow: var(--warning);
    --accent-red: var(--error);
    --text-main: var(--text-primary);
    --bg-panel: var(--surface-2);

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Radius */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 120ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
}

body {
    font-family: var(--font-sans);
    background: var(--surface-0);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   APP SHELL — sidebar + main layout
   ============================================================ */

.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--surface-0);
}

/* ============================================================
   LEFT SIDEBAR
   ============================================================ */

.sidebar {
    width: 260px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    background: var(--surface-2);
    border-right: 1px solid var(--border-subtle);
    overflow: hidden;
    transition: width var(--transition-slow), min-width var(--transition-slow);
    z-index: 10;
}

.sidebar.collapsed,
.sidebar--collapsed {
    width: 0;
    min-width: 0;
    border-right: none;
    overflow: hidden;
}

.main-area--full {
    margin-left: 0;
}

/* Logo / branding */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.sidebar-logo svg {
    color: var(--accent);
    flex-shrink: 0;
}

.sidebar-logo-mark {
    width: 28px;
    height: 28px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-logo-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

/* New thread button */
.sidebar-new-btn {
    margin: 12px 12px 8px;
    padding: 9px 14px;
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    flex-shrink: 0;
    box-shadow: var(--shadow-card);
}

.sidebar-new-btn:hover {
    background: var(--surface-3);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

/* Thread search */
.sidebar-search {
    margin: 0 12px 8px;
    position: relative;
    flex-shrink: 0;
}

.sidebar-search input {
    width: 100%;
    padding: 8px 12px 8px 32px;
    background: var(--surface-4);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.sidebar-search input:focus {
    border-color: var(--border-default);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.sidebar-search input::placeholder {
    color: var(--text-disabled);
}

.sidebar-search svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-disabled);
    pointer-events: none;
}

.sidebar-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-disabled);
    pointer-events: none;
}

/* Thread list */
.sidebar-threads {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-default) transparent;
}

.sidebar-threads::-webkit-scrollbar { width: 4px; }
.sidebar-threads::-webkit-scrollbar-track { background: transparent; }
.sidebar-threads::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }

.sidebar-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-disabled);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 8px 4px 4px;
}

.thread-item {
    padding: 9px 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
    margin-bottom: 1px;
    position: relative;
}

.thread-item:hover { background: var(--surface-3); }

.thread-item.active,
.thread-item--active {
    background: var(--accent-subtle);
}

.thread-item.active::before,
.thread-item--active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}

.thread-title {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.thread-item.active .thread-title,
.thread-item--active .thread-title {
    color: var(--accent);
}

.thread-meta {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.sidebar-threads-empty {
    padding: 16px 4px;
    font-size: 13px;
    color: var(--text-disabled);
    line-height: 1.5;
}

/* Sidebar footer */
.sidebar-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sidebar-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    background: var(--accent-subtle);
    border: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
}

.sidebar-user-email {
    font-size: 12px;
    color: var(--text-tertiary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-icon-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
    flex-shrink: 0;
}

.sidebar-icon-btn:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}

/* Theme toggle button */
.theme-toggle-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}

.theme-toggle-btn .icon-sun { display: none; }
.theme-toggle-btn .icon-moon { display: block; }

[data-theme="dark"] .theme-toggle-btn .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle-btn .icon-moon { display: none; }

/* ============================================================
   MAIN AREA
   ============================================================ */

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    background: var(--surface-0);
}

/* Top bar */
.main-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 20px;
    height: 52px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    background: var(--surface-1);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sidebar-toggle-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}

.topbar-thread-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.platform-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.badge-linkedin {
    background: var(--accent-subtle);
    color: var(--accent);
}

.badge-twitter {
    background: rgba(120,120,120,0.10);
    color: var(--text-secondary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.topbar-btn {
    height: 32px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
    font-family: inherit;
}

.topbar-btn:hover {
    background: var(--surface-3);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.topbar-icon-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.topbar-icon-btn:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}

/* Notification bar (alerts, nudge, discovery) */
.notification-zone {
    flex-shrink: 0;
}

/* Chat messages area (scrollable portion only) */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-default) transparent;
    min-height: 0;
}

.chat-area::-webkit-scrollbar { width: 6px; }
.chat-area::-webkit-scrollbar-track { background: transparent; }
.chat-area::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }

.chat-messages {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Empty state */
.chat-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 40px 24px;
}

.chat-empty-icon {
    width: 56px;
    height: 56px;
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
}

.chat-empty-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.4px;
}

.chat-empty-sub {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-bottom: 28px;
    max-width: 400px;
    line-height: 1.5;
}

.quickstart-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 520px;
    margin-bottom: 24px;
}

.quickstart-chip {
    padding: 8px 16px;
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    font-family: inherit;
    box-shadow: var(--shadow-card);
}

.quickstart-chip:hover {
    background: var(--accent-subtle);
    border-color: var(--accent-ring);
    color: var(--accent);
}

/* Message bubbles */
.msg-user {
    max-width: 80%;
    margin-left: auto;
    padding: 12px 16px;
    background: var(--accent-subtle);
    border: 1px solid var(--accent-ring);
    border-radius: 16px 16px 4px 16px;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.msg-assistant {
    max-width: 85%;
    padding: 4px 0;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
}

.msg-assistant-inner {
    white-space: pre-wrap;
    word-break: break-word;
}

.msg-role-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-disabled);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 6px;
}

.msg-streaming-indicator {
    display: inline-block;
    width: 8px;
    height: 14px;
    background: var(--accent);
    border-radius: 2px;
    margin-left: 2px;
    animation: cursor-blink 0.8s steps(1) infinite;
    vertical-align: text-bottom;
    opacity: 0.7;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0; }
}

.msg-system {
    padding: 8px 12px;
    background: var(--warning-bg);
    border: 1px solid rgba(217,119,6,0.2);
    border-radius: var(--radius-md);
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Inline content card (in assistant message) */
.msg-content-card {
    margin-top: 12px;
    padding: 16px;
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.msg-content-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.msg-content-card-body {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.msg-content-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Chat status line */
.chat-status {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 24px;
    font-size: 12px;
    color: var(--text-tertiary);
    min-height: 20px;
}

/* Chat input area */
.chat-input-area {
    flex-shrink: 0;
    border-top: 1px solid var(--border-subtle);
    padding: 14px 24px 18px;
    background: var(--surface-1);
}

.chat-input-wrap {
    max-width: 760px;
    margin: 0 auto;
    position: relative;
    background: var(--surface-0);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: var(--shadow-card);
}

.chat-input-wrap:focus-within {
    border-color: var(--accent-ring);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.chat-textarea {
    width: 100%;
    padding: 14px 56px 14px 16px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    line-height: 1.5;
    min-height: 52px;
    max-height: 200px;
    overflow-y: auto;
    display: block;
    border-radius: var(--radius-xl);
    scrollbar-width: thin;
}

.chat-textarea::placeholder {
    color: var(--text-disabled);
}

.chat-send-btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 32px;
    height: 32px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast), opacity var(--transition-fast);
    flex-shrink: 0;
}

.chat-send-btn:hover { background: var(--accent-hover); }
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.chat-input-hint {
    max-width: 760px;
    margin: 6px auto 0;
    font-size: 11px;
    color: var(--text-disabled);
    text-align: center;
}

/* Legacy step panels — hidden in new layout but keep markup accessible */
.step-indicator { display: none; }
.step-panel { display: none; }
.step-panel.active { display: none; }

/* ============================================================
   RIGHT PANEL (slides in over main)
   ============================================================ */

.right-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-slow);
}

.right-panel-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.right-panel {
    position: fixed;
    top: 0;
    right: -460px;
    width: 460px;
    height: 100vh;
    background: var(--surface-1);
    border-left: 1px solid var(--border-default);
    z-index: 201;
    overflow-y: auto;
    transition: right var(--transition-slow);
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: var(--border-default) transparent;
    box-shadow: var(--shadow-panel);
}

.right-panel.visible { right: 0; }

.right-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.right-panel-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.right-panel-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.right-panel-close:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}

.right-panel-body {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
}

/* Panel tabs */
.panel-tabs {
    display: flex;
    gap: 0;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    padding: 3px;
    margin-bottom: 20px;
    border: 1px solid var(--border-subtle);
}

.panel-tab {
    flex: 1;
    padding: 7px 12px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--transition-fast);
    font-family: inherit;
    text-align: center;
}

.panel-tab.active {
    background: var(--surface-1);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: var(--shadow-card);
}

/* ============================================================
   NOTIFICATION BANNERS (in notification-zone)
   ============================================================ */

.notification-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
    color: var(--text-secondary);
}

.notification-banner.visible { display: flex; }

.profile-nudge {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: var(--accent-subtle);
    border-bottom: 1px solid var(--accent-ring);
    font-size: 13px;
    color: var(--text-secondary);
}

.profile-nudge.visible { display: flex; }
.profile-nudge span { flex: 1; }

.nudge-dismiss {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.nudge-dismiss:hover { color: var(--text-primary); }

/* Deep discovery card */
.deep-discovery-card {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 20px;
    background: var(--success-bg);
    border-bottom: 1px solid rgba(22,163,74,0.15);
    font-size: 13px;
}

.deep-discovery-card.visible { display: flex; }

.deep-discovery-card-copy h3 {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.deep-discovery-card-copy p {
    font-size: 12px;
    color: var(--text-tertiary);
}

.deep-discovery-card-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.deep-discovery-settings-reminder {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
    color: var(--text-tertiary);
    background: var(--surface-1);
}

.deep-discovery-settings-reminder.visible { display: flex; }

/* Alerts bar */
#alerts-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 20px;
    background: var(--warning-bg);
    border-bottom: 1px solid rgba(217,119,6,0.15);
    font-size: 13px;
    color: var(--text-secondary);
}

#alerts-bar.visible { display: flex; }

/* Usage bar (hidden in main, shown in settings) */
.usage-bar { display: none; }

/* ============================================================
   FORMS & INPUTS (shared across panels)
   ============================================================ */

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    padding: 9px 12px;
    background: var(--surface-0);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
    border-color: var(--accent-ring);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.form-input::placeholder {
    color: var(--text-disabled);
}

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

select.form-input {
    cursor: pointer;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

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

.btn-primary:disabled {
    background: var(--surface-3);
    color: var(--text-disabled);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--surface-3);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-default);
    color: var(--text-tertiary);
    padding: 6px 12px;
    font-size: 12px;
}

.btn-ghost:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
    background: var(--surface-2);
}

.btn-ghost.copied {
    border-color: var(--success);
    color: var(--success);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
}

/* ============================================================
   SPINNER
   ============================================================ */

.spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-default);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn.loading .spinner { display: inline-block; }
.btn.loading .btn-text { display: none; }

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

.step-loading {
    display: none;
    text-align: center;
    padding: 48px;
}

.step-loading.visible { display: block; }

.step-loading .step-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 14px;
}

.step-loading p {
    font-size: 13px;
    color: var(--text-tertiary);
}

/* ============================================================
   ERROR BOX
   ============================================================ */

.error-box {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--error-text);
    font-size: 13px;
    margin-bottom: 14px;
    display: none;
}

.error-box.visible { display: block; }

/* ============================================================
   CHIPS
   ============================================================ */

.chip-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--text-secondary);
}

.chip .remove-chip {
    cursor: pointer;
    color: var(--text-disabled);
    font-size: 13px;
    line-height: 1;
    margin-left: 2px;
}

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

.chip-add {
    display: flex;
    gap: 6px;
}

.chip-add input {
    padding: 6px 10px;
    background: var(--surface-0);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    outline: none;
    flex: 1;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chip-add input:focus {
    border-color: var(--accent-ring);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.chip-add input::placeholder { color: var(--text-disabled); }

.chip-add button {
    padding: 6px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.chip-add button:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}

/* ============================================================
   IMPORT SECTION (profile panel)
   ============================================================ */

.import-section {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border-subtle);
}

.import-section h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.import-source-group {
    margin-bottom: 14px;
    text-align: left;
}

.import-section-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 5px;
}

/* ============================================================
   FILE DROP ZONE
   ============================================================ */

.file-drop-zone {
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-md);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.file-drop-zone:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.file-drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.file-drop-zone p {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 6px;
}

.file-drop-zone-sm {
    padding: 12px;
}

.file-drop-zone-sm p {
    font-size: 12px;
    margin-top: 0;
}

.file-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.file-selected span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-file {
    background: none;
    border: none;
    color: var(--text-disabled);
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

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

.link-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    text-decoration: underline;
    padding: 0;
}

.link-btn:hover { color: var(--accent-hover); }

.input-hint {
    font-size: 12px;
    color: var(--text-disabled);
    margin-top: 5px;
    line-height: 1.4;
}

/* ============================================================
   COMPANY LIST
   ============================================================ */

.company-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.company-item {
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 10px 12px;
}

.company-item .company-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.company-item .company-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.company-item .company-role {
    font-size: 12px;
    color: var(--text-secondary);
}

.company-item .company-desc {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 3px;
    line-height: 1.4;
}

.company-item .remove-company {
    background: none;
    border: none;
    color: var(--text-disabled);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
}

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

/* ============================================================
   DIALOG
   ============================================================ */

.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.dialog-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.dialog {
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 380px;
    transform: scale(0.97);
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-modal);
}

.dialog-overlay.visible .dialog { transform: scale(1); }

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.dialog-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.dialog-header .close-btn {
    position: static;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
}

.dialog-header .close-btn:hover { color: var(--text-primary); }

.dialog-body .form-group:last-child { margin-bottom: 0; }

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

/* ============================================================
   CONTENT CANVAS PANEL
   ============================================================ */

.history-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-slow);
}

.history-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.history-slide {
    position: fixed;
    top: 0;
    right: -520px;
    width: 520px;
    height: 100vh;
    background: var(--surface-1);
    border-left: 1px solid var(--border-default);
    z-index: 201;
    overflow-y: auto;
    transition: right var(--transition-slow);
    padding: 28px 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-default) transparent;
    box-shadow: var(--shadow-panel);
}

.history-slide.visible { right: 0; }

.history-slide h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.history-slide .close-btn {
    position: absolute;
    top: 22px;
    right: 22px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-slide .close-btn:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}

.history-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 18px;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    padding: 3px;
    border: 1px solid var(--border-subtle);
}

.history-tab {
    flex: 1;
    padding: 7px 12px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.history-tab.active {
    background: var(--surface-1);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: var(--shadow-card);
}

.thread-tools {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.thread-tools.hidden { display: none; }

.thread-search-input {
    width: 100%;
    background: var(--surface-0);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

.history-entry {
    padding: 12px 14px;
    background: var(--surface-0);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.history-entry:hover {
    border-color: var(--border-default);
    background: var(--surface-2);
}

.history-entry .entry-date {
    font-size: 11px;
    color: var(--text-disabled);
    margin-bottom: 3px;
}

.history-entry .entry-topic {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.history-entry .entry-platform {
    font-size: 12px;
    color: var(--text-tertiary);
}

.history-entry .entry-status {
    display: inline-block;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.entry-status.generated { background: var(--accent-subtle); color: var(--accent); }
.entry-status.edited { background: var(--warning-bg); color: var(--warning); }
.entry-status.finalized { background: var(--success-bg); color: var(--success); }
.entry-status.active { background: var(--success-bg); color: var(--success); }
.entry-status.archived { background: var(--surface-3); color: var(--text-disabled); }

.topic-entry {
    padding: 10px 12px;
    background: var(--surface-0);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.topic-entry .date {
    color: var(--text-secondary);
    font-weight: 600;
}

.history-detail { display: none; }
.history-detail.visible { display: block; }

.history-detail .back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-tertiary);
    cursor: pointer;
    margin-bottom: 14px;
    border: none;
    background: none;
    font-family: inherit;
}

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

/* ============================================================
   CONTENT CANVAS COMPONENTS
   ============================================================ */

.canvas-head-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.canvas-count {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: var(--radius-full);
}

.canvas-count.green { background: var(--success-bg); color: var(--success); }
.canvas-count.yellow { background: var(--warning-bg); color: var(--warning); }
.canvas-count.red { background: var(--error-bg); color: var(--error); }

.canvas-empty-state {
    padding: 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--surface-2);
}

.canvas-empty-state p {
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 13px;
}

.canvas-text {
    white-space: pre-wrap;
    font-family: inherit;
    margin: 0 0 10px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.65;
    background: var(--surface-0);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 12px;
}

.canvas-tweet-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.canvas-tweet-card {
    border: 1px solid var(--border-default);
    background: var(--surface-0);
    border-radius: var(--radius-md);
    padding: 10px;
}

.canvas-feedback-widget {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--accent-ring);
    background: var(--accent-subtle);
    border-radius: var(--radius-md);
    position: relative;
}

.canvas-feedback-widget p {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.canvas-feedback-close {
    position: absolute;
    top: 6px;
    right: 8px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
}

.canvas-feedback-close:hover { color: var(--text-primary); }

.canvas-diff-box {
    margin-top: 10px;
    border: 1px solid var(--border-default);
    background: var(--surface-2);
    border-radius: var(--radius-md);
    padding: 10px;
}

.canvas-diff-box h3 {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.canvas-diff-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.canvas-diff-grid h4 {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.canvas-pangram {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    border: 1px solid var(--border-default);
    font-size: 12px;
}

.canvas-pangram strong { color: var(--text-primary); }
.canvas-pangram.green { background: var(--success-bg); border-color: rgba(22,163,74,0.2); }
.canvas-pangram.yellow { background: var(--warning-bg); border-color: rgba(217,119,6,0.2); }
.canvas-pangram.red { background: var(--error-bg); border-color: var(--error-border); }
.canvas-pangram.unavailable { background: var(--surface-2); }

/* ============================================================
   CONTENT CARDS (in history detail view / canvas)
   ============================================================ */

.content-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.content-card {
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: border-color var(--transition-fast);
    box-shadow: var(--shadow-card);
}

.content-card:hover { border-color: var(--border-strong); }

.content-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.post-type-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.content-card-actions {
    display: flex;
    gap: 6px;
}

.content-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
    min-height: 40px;
}

.content-text.selection-mode {
    cursor: text;
    background: var(--accent-subtle);
    border-radius: var(--radius-md);
    padding: 8px;
    border: 1px dashed var(--accent-ring);
}

.char-count {
    font-size: 11px;
    color: var(--text-disabled);
    margin-top: 6px;
    text-align: right;
}

.char-count.over { color: var(--error); }

/* Edit panels */
.edit-panel {
    margin-top: 14px;
    padding: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    display: none;
}

.edit-panel.visible { display: block; }

.edit-panel label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.edit-panel .selected-text-preview {
    font-size: 12px;
    color: var(--text-tertiary);
    background: var(--surface-1);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    font-style: italic;
    border-left: 3px solid var(--accent);
}

.edit-textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    resize: vertical;
    min-height: 56px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.edit-textarea:focus {
    border-color: var(--accent-ring);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.edit-textarea::placeholder { color: var(--text-disabled); }

.edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: flex-end;
}

.inline-edit-float {
    position: absolute;
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 12px;
    box-shadow: var(--shadow-modal);
    z-index: 100;
    width: 300px;
    display: none;
}

.inline-edit-float.visible { display: block; }

.highlight-change {
    background: var(--success-bg);
    border-radius: 2px;
    transition: background 2s;
}

/* Adaptation prompt box */
.canvas-empty-state.adaptation-prompt {
    border-color: var(--accent-ring);
    background: var(--accent-subtle);
}

/* ============================================================
   THREAD COMPOSER (inside history thread detail)
   ============================================================ */

.thread-message {
    padding: 10px 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--surface-1);
}

.thread-message.role-user { border-color: var(--accent-ring); background: var(--accent-subtle); }
.thread-message.role-assistant { border-color: var(--border-default); }
.thread-message.role-system {
    border-color: rgba(217,119,6,0.2);
    background: var(--warning-bg);
}

.thread-message .thread-role {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-disabled);
    margin-bottom: 4px;
}

.thread-stream-content { white-space: pre-wrap; word-break: break-word; }

.thread-composer {
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
    margin-top: 12px;
}

/* ============================================================
   ONBOARDING MODAL
   ============================================================ */

.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-slow);
}

.onboarding-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.onboarding-modal {
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 36px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.97);
    transition: transform var(--transition-slow);
    text-align: center;
    scrollbar-width: thin;
    box-shadow: var(--shadow-modal);
}

.onboarding-overlay.visible .onboarding-modal { transform: scale(1); }

.onboarding-modal h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.onboarding-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 22px;
    line-height: 1.55;
}

.onboarding-textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px 14px;
    background: var(--surface-0);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    resize: vertical;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    margin-bottom: 0;
}

.onboarding-textarea:focus {
    border-color: var(--accent-ring);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.onboarding-textarea::placeholder { color: var(--text-disabled); }

.onboarding-modal .error-box {
    text-align: left;
    margin-bottom: 10px;
}

.onboarding-cta {
    width: 100%;
    justify-content: center;
    padding: 13px 20px;
    font-size: 14px;
    margin-bottom: 10px;
}

.onboarding-skip {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    padding: 4px;
}

.onboarding-skip:hover {
    color: var(--text-secondary);
    text-decoration: underline;
}

.onboarding-success-icon { margin-bottom: 14px; }

.onboarding-mini-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid var(--border-default);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 18px auto 0;
}

/* Focus Lock & Deep Discovery */
.focus-lock-progress {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 11px;
    color: var(--text-disabled);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.focus-lock-step label {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.8;
}

.focus-lock-actions {
    display: flex;
    gap: 8px;
}

.focus-lock-actions .onboarding-cta { flex: 1; }

.deep-discovery-step { }
.deep-discovery-step.hidden { display: none; }

.deep-discovery-results {
    margin-top: 12px;
    padding: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
}

.deep-discovery-results h3 {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.deep-discovery-results pre {
    background: var(--surface-0);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 10px;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 11px;
    white-space: pre-wrap;
    max-height: 200px;
    overflow: auto;
}

/* ============================================================
   PROFILE PANEL
   ============================================================ */

.profile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-slow);
}

.profile-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.profile-panel {
    position: fixed;
    top: 0;
    right: -460px;
    width: 460px;
    height: 100vh;
    background: var(--surface-1);
    border-left: 1px solid var(--border-default);
    z-index: 201;
    overflow-y: auto;
    transition: right var(--transition-slow);
    padding: 28px 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-default) transparent;
    box-shadow: var(--shadow-panel);
}

.profile-panel.visible { right: 0; }

.profile-panel h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.profile-panel .close-btn {
    position: absolute;
    top: 22px;
    right: 22px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-panel .close-btn:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}

/* ============================================================
   VOICE LEARNING
   ============================================================ */

.voice-analysis-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.voice-dim-card {
    border: 1px solid var(--border-default);
    background: var(--surface-2);
    border-radius: var(--radius-md);
    padding: 10px 12px;
}

.voice-dim-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.voice-dim-header strong {
    color: var(--text-primary);
    font-size: 12px;
    text-transform: capitalize;
}

.voice-confidence {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

.voice-confidence.high { background: var(--success-bg); color: var(--success); }
.voice-confidence.medium { background: var(--warning-bg); color: var(--warning); }
.voice-confidence.low { background: var(--error-bg); color: var(--error); }

.voice-dim-pattern {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.voice-dim-example {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 6px;
}

.voice-dim-actions { display: flex; gap: 6px; }

.voice-consistency-card {
    border: 1px solid var(--border-default);
    background: var(--surface-2);
    border-radius: var(--radius-md);
    padding: 10px 12px;
}

.voice-consistency-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 12px;
    color: var(--text-secondary);
}

.voice-consistency-row strong { color: var(--text-primary); }

.voice-alert-item,
.voice-suggestion-item {
    border: 1px solid var(--border-default);
    background: var(--surface-1);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ============================================================
   FEEDBACK FAB
   ============================================================ */

.feedback-fab {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 70;
    background: var(--surface-1);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow-card);
    font-family: inherit;
    transition: all var(--transition-fast);
}

.feedback-fab:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.feedback-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base);
    z-index: 80;
}

.feedback-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.feedback-modal {
    position: fixed;
    right: 16px;
    bottom: 68px;
    width: min(400px, calc(100vw - 24px));
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 20px;
    z-index: 90;
    box-shadow: var(--shadow-modal);
    transform: translateY(8px);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.feedback-modal.visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.feedback-modal h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.feedback-modal .close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
}

.feedback-modal .close-btn:hover { color: var(--text-primary); }

/* ============================================================
   URL ACTION MODAL
   ============================================================ */

#url-action-result { }

/* ============================================================
   UTILITY
   ============================================================ */

.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Icon btn (header compat) */
.icon-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    border-color: var(--border-strong);
    background: var(--surface-2);
    color: var(--text-primary);
}

.icon-btn.active {
    background: var(--surface-2);
    color: var(--text-primary);
}

/* Quick-starts (old compat — hidden; moved to empty state) */
.quick-starts { display: none; }

/* User email in old header compat */
.user-email { display: none; }

/* Old container layout compat */
.container { display: none; }

/* Footer gone */
footer { display: none; }

/* Close button base */
.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
