/* ============================================================
   RESUMER — Design System & App-Level Components
   Production-ready CSS with theming, animations, and polish.
   ============================================================ */

/* ---------- Design Tokens (Light Theme) ---------- */
:root {
    /* Brand */
    --brand-primary: #4f6df5;
    --brand-primary-hover: #3d5bd9;
    --brand-primary-soft: rgba(79, 109, 245, 0.12);
    --brand-gradient: linear-gradient(135deg, #4f6df5 0%, #7c3aed 100%);
    --brand-gradient-hover: linear-gradient(135deg, #3d5bd9 0%, #6929cc 100%);

    /* Surfaces */
    --surface-app: #f0f2f5;
    --surface-card: #ffffff;
    --surface-elevated: #ffffff;
    --surface-header: #0f172a;
    --surface-header-glass: rgba(15, 23, 42, 0.92);
    --surface-input: #f8fafc;
    --surface-code: #f1f5f9;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-on-brand: #ffffff;
    --text-on-header: #e2e8f0;
    --text-on-header-muted: #94a3b8;

    /* Borders */
    --border-default: #e2e8f0;
    --border-subtle: #f1f5f9;
    --border-focus: var(--brand-primary);

    /* State Colors */
    --color-success: #22c55e;
    --color-success-soft: rgba(34, 197, 94, 0.12);
    --color-warning: #f59e0b;
    --color-warning-soft: rgba(245, 158, 11, 0.12);
    --color-danger: #ef4444;
    --color-danger-soft: rgba(239, 68, 68, 0.12);
    --color-info: #3b82f6;
    --color-info-soft: rgba(59, 130, 246, 0.12);

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.06);
    --shadow-header: 0 1px 3px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.15);

    /* 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;

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

    /* Transitions */
    --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    /* Typography */
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
    --font-size-xs: 11px;
    --font-size-sm: 12px;
    --font-size-base: 13px;
    --font-size-md: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    --font-size-2xl: 24px;

    /* Z-index scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-header: 1000;
    --z-overlay: 1100;
    --z-modal: 1200;
    --z-toast: 1300;

    /* Status bar */
    --status-bar-height: 28px;
    --header-height: 56px;

    /* Left toolbar */
    --left-toolbar-width: 112px;
}

/* ---------- Dark Theme ---------- */
[data-theme="dark"] {
    --surface-app: #0f172a;
    --surface-card: #1e293b;
    --surface-elevated: #1e293b;
    --surface-header: #020617;
    --surface-header-glass: rgba(2, 6, 23, 0.92);
    --surface-input: #1e293b;
    --surface-code: #1e293b;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-on-header: #e2e8f0;
    --text-on-header-muted: #64748b;

    --border-default: #334155;
    --border-subtle: #1e293b;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.5);
    --shadow-header: 0 1px 3px rgba(0, 0, 0, 0.6), 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ---------- Global Reset ---------- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--surface-app);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--duration-slow) var(--ease-default),
                color var(--duration-slow) var(--ease-default);
}

/* ---------- Scrollbar (Webkit) ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ---------- Focus Ring ---------- */
:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ---------- Toast Notification System ---------- */
#toast-container {
    position: fixed;
    bottom: calc(var(--status-bar-height) + 16px);
    right: 20px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    min-width: 280px;
    max-width: 420px;
    background: var(--surface-elevated);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border-left: 4px solid transparent;
    font-size: var(--font-size-md);
    font-weight: 500;
    pointer-events: auto;
    animation: toastSlideIn var(--duration-slow) var(--ease-bounce) forwards;
    transform: translateX(120%);
    opacity: 0;
}

.toast.toast-exit {
    animation: toastSlideOut var(--duration-normal) var(--ease-default) forwards;
}

.toast--success { border-left-color: var(--color-success); }
.toast--warning { border-left-color: var(--color-warning); }
.toast--error   { border-left-color: var(--color-danger); }
.toast--info    { border-left-color: var(--color-info); }

.toast__icon {
    flex-shrink: 0;
    font-size: 18px;
}
.toast--success .toast__icon { color: var(--color-success); }
.toast--warning .toast__icon { color: var(--color-warning); }
.toast--error .toast__icon   { color: var(--color-danger); }
.toast--info .toast__icon    { color: var(--color-info); }

.toast__message { flex: 1; line-height: 1.4; }

.toast__close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color var(--duration-fast);
    font-size: 16px;
}
.toast__close:hover { color: var(--text-primary); }

@keyframes toastSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(120%); opacity: 0; }
}

/* ---------- Status Bar ---------- */
#status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--status-bar-height);
    background: var(--surface-header);
    color: var(--text-on-header-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    font-size: var(--font-size-xs);
    z-index: var(--z-header);
    border-top: 1px solid rgba(255,255,255,0.06);
    user-select: none;
}

#status-bar .status-left,
#status-bar .status-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

#status-bar .status-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: background var(--duration-fast);
    cursor: default;
}

#status-bar .status-item:hover {
    background: rgba(255,255,255,0.06);
}

#status-bar .status-item .iconify {
    font-size: 13px;
}

#status-bar .status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-success);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@media print {
    #status-bar,
    #toast-container,
    #compact-header,
    #left-toolbar,
    #ai-panel,
    #jd-sidebar,
    #customize-panel,
    #customize-btn,
    #shortcut-modal,
    #ats-checker-tab,
    #cover-letter-tab,
    .tab-content:not(#resume-tab) { display: none !important; }

    #resume-tab,
    #resume-workspace,
    #preview-container { display: block !important; }

    body { margin: 0; padding: 0; background: #fff; }
}

@media (max-width: 640px) {
    #resume-content {
        padding: 8px 4px !important;
        gap: 10px !important;
    }
}

/* ---------- Keyboard Shortcut Modal ---------- */
#shortcut-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-normal), visibility var(--duration-normal);
}

#shortcut-modal.is-open {
    opacity: 1;
    visibility: visible;
}

#shortcut-modal .modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

#shortcut-modal .modal-content {
    position: relative;
    background: var(--surface-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 28px 32px;
    max-width: 480px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--duration-normal) var(--ease-bounce);
}

#shortcut-modal.is-open .modal-content {
    transform: scale(1) translateY(0);
}

#shortcut-modal .modal-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin: 0 0 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

#shortcut-modal .shortcut-group {
    margin-bottom: 18px;
}

#shortcut-modal .shortcut-group-title {
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-tertiary);
    margin: 0 0 8px;
}

#shortcut-modal .shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
}

#shortcut-modal .shortcut-label {
    font-size: var(--font-size-md);
    color: var(--text-secondary);
}

#shortcut-modal .shortcut-keys {
    display: flex;
    gap: 4px;
}

#shortcut-modal kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 26px;
    padding: 0 8px;
    background: var(--surface-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: 0 1px 0 var(--border-default);
}

/* ---------- Loading Spinner ---------- */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--text-tertiary);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ---------- Tab Transition ---------- */
/* display: none/block handled in settings.css; these add opacity transitions */
.tab-content.active {
    opacity: 1;
    pointer-events: auto;
}

/* ---------- Empty State ---------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-tertiary);
    text-align: center;
}

.empty-state .iconify {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: var(--font-size-md);
    margin: 0;
    max-width: 400px;
    line-height: 1.5;
}

/* ---------- ATS Score Circle Animation ---------- */
.score-ring {
    position: relative;
    width: 180px;
    height: 180px;
}

.score-ring svg {
    transform: rotate(-90deg);
}

.score-ring .ring-bg {
    stroke: rgba(255,255,255,0.15);
    fill: none;
    stroke-width: 8;
}

.score-ring .ring-fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 440;
    stroke-dashoffset: 440;
    transition: stroke-dashoffset 1.5s var(--ease-default);
}

.score-ring .ring-fill.score-high   { stroke: var(--color-success); }
.score-ring .ring-fill.score-medium { stroke: var(--color-warning); }
.score-ring .ring-fill.score-low    { stroke: var(--color-danger); }

.score-ring .ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-ring .ring-value {
    font-size: 48px;
    font-weight: 800;
    font-family: var(--font-sans);
    line-height: 1;
}

.score-ring .ring-value.score-high   { color: var(--color-success); }
.score-ring .ring-value.score-medium { color: var(--color-warning); }
.score-ring .ring-value.score-low    { color: var(--color-danger); }

.score-ring .ring-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* ---------- Utility: Visually Hidden ---------- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
}

/* ---------- Tooltip ---------- */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 5px 10px;
    background: var(--surface-header);
    color: var(--text-on-header);
    font-size: var(--font-size-xs);
    font-weight: 500;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-fast), transform var(--duration-fast);
    z-index: var(--z-dropdown);
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------- Animated Counter (for ATS score) ---------- */
@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: countUp var(--duration-slow) var(--ease-default) forwards;
}

/* ---------- Responsive Utilities ---------- */
@media (max-width: 768px) {
    #toast-container {
        right: 12px;
        left: 12px;
    }
    .toast {
        min-width: auto;
        max-width: none;
    }
    #shortcut-modal .modal-content {
        padding: 20px 24px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   PHASE 3 — ATS Live Badge + JD Sidebar + Heat Map
   ═══════════════════════════════════════════════════════════════ */

/* ── ATS Live Badge ─────────────────────────────────────────── */
.ats-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1.5px solid var(--color-border, #ddd);
    background: var(--color-bg-secondary, #f5f5f5);
    color: var(--color-text, #333);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    white-space: nowrap;
    min-width: 52px;
    justify-content: center;
}
.ats-live-badge:hover {
    border-color: var(--color-primary, #2563eb);
}
.ats-live-badge.score-low {
    background: #fef2f2;
    border-color: #f87171;
    color: #b91c1c;
}
.ats-live-badge.score-medium {
    background: #fffbeb;
    border-color: #fbbf24;
    color: #92400e;
}
.ats-live-badge.score-high {
    background: #f0fdf4;
    border-color: #4ade80;
    color: #166534;
}
.ats-live-badge.score-excellent {
    background: #eff6ff;
    border-color: #60a5fa;
    color: #1d4ed8;
}

/* ── Resume Workspace (flex row with sidebar) ────────────────── */
.resume-workspace {
    display: flex;
    height: 100%;
    overflow: hidden;
    position: relative;
}
.resume-workspace #editor-container,
.resume-workspace #preview-container {
    flex: 1;
    min-width: 0;
    overflow: auto;
    transition: flex 0.3s ease;
}

/* ── JD Sidebar ─────────────────────────────────────────────── */
.jd-sidebar {
    width: 300px;
    min-width: 260px;
    max-width: 360px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-left: 1.5px solid var(--color-border, #ddd);
    background: var(--color-bg-secondary, #f9fafb);
    overflow: hidden;
    transition: width 0.3s ease, min-width 0.3s ease, opacity 0.3s ease;
}
.jd-sidebar.collapsed {
    width: 0;
    min-width: 0;
    opacity: 0;
    pointer-events: none;
}
.jd-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border, #ddd);
    background: var(--color-bg, #fff);
    gap: 8px;
    flex-shrink: 0;
}
.jd-sidebar-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text, #333);
    white-space: nowrap;
}
.jd-sidebar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.jd-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: var(--color-text-muted, #666);
    display: flex;
    align-items: center;
    font-size: 1rem;
    transition: background 0.15s, color 0.15s;
}
.jd-action-btn:hover {
    background: var(--color-border, #eee);
    color: var(--color-text, #333);
}
.jd-action-btn.active {
    color: var(--color-primary, #2563eb);
}
.jd-textarea {
    flex: 1;
    resize: none;
    border: none;
    padding: 12px;
    font-size: 0.8rem;
    line-height: 1.55;
    background: var(--color-bg-secondary, #f9fafb);
    color: var(--color-text, #333);
    outline: none;
    font-family: inherit;
}
.jd-textarea:focus {
    background: var(--color-bg, #fff);
}

/* ── Quick Wins Panel ───────────────────────────────────────── */
.quick-wins-panel {
    border-top: 1px solid var(--color-border, #ddd);
    padding: 10px 12px;
    flex-shrink: 0;
    max-height: 220px;
    overflow-y: auto;
}
.quick-wins-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted, #666);
    margin-bottom: 8px;
}
.quick-wins-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.quick-win-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--color-bg, #fff);
    border: 1px solid var(--color-border, #ddd);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 0.78rem;
}
.quick-win-keyword {
    flex: 1;
    font-weight: 500;
    color: var(--color-text, #333);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.quick-win-insert {
    flex-shrink: 0;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--color-primary, #2563eb);
    background: none;
    color: var(--color-primary, #2563eb);
    cursor: pointer;
    transition: background 0.15s;
}
.quick-win-insert:hover {
    background: var(--color-primary, #2563eb);
    color: #fff;
}
.quick-wins-empty {
    font-size: 0.78rem;
    color: var(--color-text-muted, #999);
    text-align: center;
    padding: 8px 0;
}

/* ── Keyword Heat Map ───────────────────────────────────────── */
.kw-match {
    background: rgba(74, 222, 128, 0.25);
    border-bottom: 2px solid #4ade80;
    border-radius: 2px;
    padding: 0 1px;
    transition: background 0.2s;
}
.kw-miss {
    background: rgba(251, 191, 36, 0.25);
    border-bottom: 2px dashed #f59e0b;
    border-radius: 2px;
    padding: 0 1px;
}

/* Dark mode overrides */
[data-theme="dark"] .ats-live-badge {
    background: var(--color-bg-secondary, #1e293b);
    border-color: var(--color-border, #334155);
    color: var(--color-text, #e2e8f0);
}
[data-theme="dark"] .ats-live-badge.score-low {
    background: #450a0a;
    border-color: #f87171;
    color: #fca5a5;
}
[data-theme="dark"] .ats-live-badge.score-medium {
    background: #422006;
    border-color: #fbbf24;
    color: #fde68a;
}
[data-theme="dark"] .ats-live-badge.score-high {
    background: #052e16;
    border-color: #4ade80;
    color: #86efac;
}
[data-theme="dark"] .ats-live-badge.score-excellent {
    background: #1e3a5f;
    border-color: #60a5fa;
    color: #bfdbfe;
}
[data-theme="dark"] .jd-sidebar {
    background: var(--color-bg-secondary, #1e293b);
    border-color: var(--color-border, #334155);
}
[data-theme="dark"] .jd-textarea {
    background: var(--color-bg-secondary, #1e293b);
    color: var(--color-text, #e2e8f0);
}
[data-theme="dark"] .kw-match {
    background: rgba(74, 222, 128, 0.18);
}
[data-theme="dark"] .kw-miss {
    background: rgba(251, 191, 36, 0.18);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .jd-sidebar {
        position: fixed;
        right: 0;
        top: var(--header-height, 56px);
        bottom: 0;
        z-index: 200;
        box-shadow: -4px 0 20px rgba(0,0,0,0.15);
        width: 90vw !important;
        max-width: 360px;
    }
    .jd-sidebar.collapsed {
        width: 0 !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   PHASE 4 — AI Panel, Import Modal, Settings Modal
   ═══════════════════════════════════════════════════════════════ */

/* ── AI Panel Button ────────────────────────────────────────── */
.ai-panel-btn {
    position: relative;
}
.ai-panel-btn.active::after {
    content: '';
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 6px;
    height: 6px;
    background: var(--color-primary, #2563eb);
    border-radius: 50%;
}

/* ── AI Panel (right drawer) ────────────────────────────────── */
.ai-panel {
    position: fixed;
    top: var(--header-height, 56px);
    right: 0;
    bottom: var(--status-bar-height, 28px);
    width: 340px;
    background: var(--color-bg, #fff);
    border-left: 1.5px solid var(--color-border, #ddd);
    display: flex;
    flex-direction: column;
    z-index: 150;
    box-shadow: -4px 0 24px rgba(0,0,0,0.1);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}
.ai-panel.collapsed {
    transform: translateX(100%);
}

/* ── AI Panel Header ─────────────────────────────────────────── */
.ai-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border, #ddd);
    flex-shrink: 0;
    background: linear-gradient(90deg, var(--color-bg-secondary, #f8fafc) 0%, var(--color-bg, #fff) 100%);
}
.ai-panel-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-primary, #2563eb);
}
.ai-panel-header-actions {
    display: flex;
    gap: 4px;
}
.ai-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: var(--color-text-muted, #666);
    font-size: 1rem;
    display: flex;
    align-items: center;
    transition: background 0.15s;
}
.ai-icon-btn:hover {
    background: var(--color-border, #eee);
    color: var(--color-text, #333);
}

/* ── AI Quick Actions ────────────────────────────────────────── */
.ai-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border, #ddd);
    flex-shrink: 0;
}
.ai-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 6px;
    border-radius: 8px;
    border: 1.5px solid var(--color-border, #e2e8f0);
    background: var(--color-bg-secondary, #f8fafc);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-text, #333);
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    text-align: center;
    min-height: 58px;
}
.ai-action-btn:hover {
    border-color: var(--color-primary, #2563eb);
    background: #eff6ff;
    color: var(--color-primary, #2563eb);
}
.ai-action-btn .iconify {
    font-size: 1.3rem;
}
.ai-action-label {
    line-height: 1.2;
}
/* Make "Import from text" span full width */
.ai-action-btn:first-child {
    grid-column: span 2;
    flex-direction: row;
    gap: 8px;
    min-height: 44px;
    font-size: 0.8rem;
    justify-content: center;
}

/* ── Provider Status Bar ─────────────────────────────────────── */
.ai-provider-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    border-bottom: 1px solid var(--color-border, #ddd);
    flex-shrink: 0;
    font-size: 0.75rem;
}
.ai-provider-label {
    color: var(--color-text-muted, #666);
    font-weight: 500;
}
.ai-provider-label.connected { color: #16a34a; }
.ai-provider-label.error     { color: #dc2626; }
.ai-test-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--color-border, #ddd);
    background: none;
    cursor: pointer;
    color: var(--color-text-muted, #666);
    transition: background 0.15s;
}
.ai-test-btn:hover {
    background: var(--color-border, #eee);
}

/* ── AI Output Area ──────────────────────────────────────────── */
.ai-output {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--color-text, #333);
}
.ai-output-empty {
    color: var(--color-text-muted, #999);
    text-align: center;
    padding: 30px 16px;
    font-style: italic;
}
.ai-output-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 30px 16px;
    color: var(--color-text-muted, #666);
}
.ai-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--color-border, #ddd);
    border-top-color: var(--color-primary, #2563eb);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ai-output-section { margin-bottom: 14px; }
.ai-output-section h4 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted, #666);
    margin-bottom: 6px;
}
.ai-bullet-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 5px 0;
    border-bottom: 1px solid var(--color-border, #f0f0f0);
    font-size: 0.78rem;
}
.ai-bullet-item:last-child { border-bottom: none; }
.ai-keyword-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
    margin: 2px;
}
.ai-keyword-chip.critical { background: #fee2e2; color: #991b1b; border-color: #f87171; }

/* ── Diff Panel ──────────────────────────────────────────────── */
.ai-diff-panel {
    border-top: 2px solid var(--color-primary, #2563eb);
    padding: 12px 14px;
    flex-shrink: 0;
    max-height: 260px;
    overflow-y: auto;
    background: var(--color-bg-secondary, #f8fafc);
}
.ai-diff-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.ai-diff-header span {
    font-size: 0.8rem;
    font-weight: 700;
}
.ai-diff-actions { display: flex; gap: 8px; }
.ai-accept-btn, .ai-reject-btn {
    padding: 4px 12px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    transition: opacity 0.15s;
}
.ai-accept-btn { background: #16a34a; color: #fff; }
.ai-accept-btn:hover { opacity: 0.85; }
.ai-reject-btn { background: var(--color-border, #e5e7eb); color: var(--color-text, #333); }
.ai-reject-btn:hover { opacity: 0.8; }
.ai-diff-content { font-size: 0.78rem; line-height: 1.6; }
.ai-diff-old { color: #dc2626; text-decoration: line-through; margin-bottom: 4px; }
.ai-diff-new { color: #16a34a; font-weight: 500; }

/* ── Import Modal ────────────────────────────────────────────── */
.import-modal-content {
    max-width: 600px;
    width: 90vw;
}
.import-modal-desc {
    font-size: 0.85rem;
    color: var(--color-text-muted, #666);
    margin: -8px 0 14px;
    line-height: 1.5;
}
.import-textarea {
    width: 100%;
    resize: vertical;
    border: 1.5px solid var(--color-border, #ddd);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.82rem;
    line-height: 1.55;
    font-family: inherit;
    background: var(--color-bg-secondary, #f9fafb);
    color: var(--color-text, #333);
    outline: none;
    box-sizing: border-box;
}
.import-textarea:focus {
    border-color: var(--color-primary, #2563eb);
    background: var(--color-bg, #fff);
}
.import-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}

/* ── AI Settings Modal ───────────────────────────────────────── */
.ai-settings-content { max-width: 420px; width: 90vw; }
.ai-settings-field {
    margin-bottom: 14px;
}
.ai-settings-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--color-text, #333);
}
.ai-settings-field select,
.ai-settings-field input[type="text"],
.ai-settings-field input[type="url"],
.ai-settings-field input[type="password"] {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid var(--color-border, #ddd);
    border-radius: 6px;
    font-size: 0.82rem;
    background: var(--color-bg-secondary, #f9fafb);
    color: var(--color-text, #333);
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
}
.ai-settings-field select:focus,
.ai-settings-field input:focus {
    border-color: var(--color-primary, #2563eb);
}
.ai-key-hint {
    font-weight: 400;
    color: var(--color-text-muted, #888);
    font-size: 0.75rem;
}
.ai-settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

/* ── Shared Modal Buttons ────────────────────────────────────── */
.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    transition: opacity 0.15s, background 0.15s;
}
.btn-primary  { background: var(--color-primary, #2563eb); color: #fff; }
.btn-primary:hover  { opacity: 0.88; }
.btn-secondary { background: var(--color-border, #e5e7eb); color: var(--color-text, #333); }
.btn-secondary:hover { opacity: 0.8; }

/* ── Modal overlay shared ────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Dark mode ───────────────────────────────────────────────── */
[data-theme="dark"] .ai-panel {
    background: var(--color-bg, #0f172a);
    border-color: var(--color-border, #334155);
}
[data-theme="dark"] .ai-action-btn {
    background: var(--color-bg-secondary, #1e293b);
    border-color: var(--color-border, #334155);
    color: var(--color-text, #e2e8f0);
}
[data-theme="dark"] .ai-action-btn:hover {
    background: #1e3a5f;
    border-color: #60a5fa;
    color: #bfdbfe;
}
[data-theme="dark"] .import-textarea,
[data-theme="dark"] .ai-settings-field select,
[data-theme="dark"] .ai-settings-field input {
    background: var(--color-bg-secondary, #1e293b);
    color: var(--color-text, #e2e8f0);
    border-color: var(--color-border, #334155);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .ai-panel {
        width: 100vw;
        border-left: none;
        border-top: 1.5px solid var(--color-border, #ddd);
        top: auto;
        bottom: var(--status-bar-height, 28px);
        height: 70vh;
    }
    .ai-panel.collapsed {
        transform: translateY(100%);
    }
}

/* ═══════════════════════════════════════════════════════════
   PHASE 5 — Customise Panel
   ═══════════════════════════════════════════════════════════ */

/* ── Panel container ──────────────────────────────────────── */
.customize-panel {
    position: fixed;
    top: calc(var(--header-height, 52px) + 8px);
    right: 12px;
    width: 280px;
    background: var(--surface-card, #fff);
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 8px 30px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
    z-index: 1100;
    display: none;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    font-size: 0.82rem;
    color: var(--color-text, #1e293b);
    animation: customizePanelIn .18s ease;
}
.customize-panel.open { display: flex; }

@keyframes customizePanelIn {
    from { opacity: 0; transform: translateY(-8px) scale(.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

/* ── Header ──────────────────────────────────────────────── */
.customize-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 8px;
    border-bottom: 1px solid var(--color-border, #e2e8f0);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text, #1e293b);
    background: var(--surface-card, #fff);
}
.customize-panel-header span { display: flex; align-items: center; gap: 6px; }
.customize-close {
    background: none; border: none; cursor: pointer; padding: 4px; line-height: 1;
    font-size: 1.1rem; color: var(--color-text-muted, #64748b);
    border-radius: 4px;
}
.customize-close:hover { background: var(--surface-hover, #f1f5f9); color: var(--color-text, #1e293b); }

/* ── Sections ────────────────────────────────────────────── */
.customize-section {
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border, #e2e8f0);
}
.customize-section:last-of-type { border-bottom: none; }

.customize-label {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--color-text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.customize-hint { font-weight: 400; font-size: 0.73rem; text-transform: none; letter-spacing: 0; }

/* ── Font buttons ────────────────────────────────────────── */
.customize-font-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.font-btn {
    padding: 4px 10px;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 6px;
    background: var(--surface-card, #fff);
    color: var(--color-text, #1e293b);
    font-size: 0.78rem;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.font-btn:hover  { background: var(--surface-hover, #f1f5f9); border-color: var(--color-primary, #6366f1); }
.font-btn.active { background: var(--color-primary, #6366f1); border-color: var(--color-primary, #6366f1); color: #fff; }

/* ── Accent swatches ─────────────────────────────────────── */
.customize-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.accent-swatch {
    width: 24px; height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: var(--swatch, #888);
    cursor: pointer;
    transition: transform .12s, border-color .12s;
}
.accent-swatch:hover  { transform: scale(1.15); }
.accent-swatch.active { border-color: var(--color-text, #1e293b); transform: scale(1.15); }

.accent-color-picker {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid var(--color-border, #e2e8f0);
    padding: 0;
    cursor: pointer;
    background: none;
    overflow: hidden;
}
.accent-color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.accent-color-picker::-webkit-color-swatch { border: none; border-radius: 50%; }

/* ── Range sliders ───────────────────────────────────────── */
.customize-range {
    width: 100%;
    accent-color: var(--color-primary, #6366f1);
    margin: 4px 0 0;
}
.customize-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.71rem;
    color: var(--color-text-muted, #94a3b8);
    margin-top: 2px;
}

/* ── Margin buttons ──────────────────────────────────────── */
.customize-margin-btns {
    display: flex;
    gap: 4px;
}
.margin-btn {
    flex: 1;
    padding: 5px 0;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 6px;
    background: var(--surface-card, #fff);
    color: var(--color-text, #1e293b);
    font-size: 0.78rem;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.margin-btn:hover  { background: var(--surface-hover, #f1f5f9); border-color: var(--color-primary, #6366f1); }
.margin-btn.active { background: var(--color-primary, #6366f1); border-color: var(--color-primary, #6366f1); color: #fff; }

/* ── Footer ──────────────────────────────────────────────── */
.customize-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--color-border, #e2e8f0);
    background: var(--surface-card, #fff);
}

/* ── Customize button (header toolbar) active state ─────── */
#customize-btn.active {
    background: var(--color-primary-soft, rgba(99,102,241,.12));
    color: var(--color-primary, #6366f1);
}

/* ── Dark mode ────────────────────────────────────────────── */
[data-theme="dark"] .customize-panel {
    background: var(--surface-card, #1e293b);
    border-color: var(--color-border, #334155);
    box-shadow: 0 8px 30px rgba(0,0,0,.4);
}
[data-theme="dark"] .customize-panel-header,
[data-theme="dark"] .customize-footer { background: var(--surface-card, #1e293b); }
[data-theme="dark"] .font-btn,
[data-theme="dark"] .margin-btn {
    background: var(--surface-raised, #0f172a);
    border-color: var(--color-border, #334155);
    color: var(--color-text, #e2e8f0);
}


/* ═══════════════════════════════════════════════════════════
   PHASE 6 — Cover Letter Builder
   ═══════════════════════════════════════════════════════════ */

/* ── Workspace: main + sidebar ───────────────────────────── */
.cl-workspace {
    display: flex;
    gap: 0;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}
.cl-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.cl-sidebar {
    width: 260px;
    flex-shrink: 0;
    border-left: 1px solid var(--color-border, #e2e8f0);
    background: var(--surface-raised, #f8fafc);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* ── Toolbar ─────────────────────────────────────────────── */
.cl-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: var(--surface-header);
    flex-shrink: 0;
}
.cl-style-group {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(255, 255, 255, 0.06);
    padding: 3px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.cl-style-btn {
    padding: 5px 12px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-on-header-muted);
    font-size: var(--font-size-sm);
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-default);
    height: 28px;
    display: inline-flex;
    align-items: center;
    letter-spacing: 0.3px;
}
.cl-style-btn:hover  { background: rgba(255, 255, 255, 0.08); color: #ffffff; }
.cl-style-btn.active { background: var(--brand-gradient); color: white; box-shadow: 0 2px 8px rgba(79, 109, 245, 0.4); }

/* ── Word count badge ────────────────────────────────────── */
.cl-word-count-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-on-header-muted);
    padding: 3px 10px;
    border-radius: 99px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    transition: color .2s, background .2s, border-color .2s;
}
.cl-word-count-badge.good   { color: #4ade80; border-color: rgba(74, 222, 128, 0.3); background: rgba(74, 222, 128, 0.08); }
.cl-word-count-badge.amber  { color: #fbbf24; border-color: rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.08); }
.cl-word-count-badge.red    { color: #f87171; border-color: rgba(248, 113, 113, 0.3); background: rgba(248, 113, 113, 0.08); }
.cl-word-count-badge.low    { color: #a78bfa; border-color: rgba(167, 139, 250, 0.3); background: rgba(167, 139, 250, 0.08); }

/* ── Sidebar sections ────────────────────────────────────── */
.cl-sidebar-section {
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border, #e2e8f0);
}
.cl-sidebar-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}
.cl-sidebar-heading {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 8px;
}
.cl-sidebar-empty { font-size: 0.76rem; color: var(--color-text-muted, #94a3b8); margin: 0; font-style: italic; }

.cl-badge {
    background: #ef4444;
    color: #fff;
    font-size: 0.68rem;
    padding: 1px 6px;
    border-radius: 99px;
    font-weight: 700;
    margin-left: 4px;
}

/* ── Role input ──────────────────────────────────────────── */
.cl-role-input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 6px;
    font-size: 0.82rem;
    background: var(--surface-card, #fff);
    color: var(--color-text, #1e293b);
    box-sizing: border-box;
}
.cl-role-input:focus { outline: none; border-color: var(--color-primary, #6366f1); }

/* ── Structure guide ─────────────────────────────────────── */
.cl-guide { display: flex; flex-direction: column; gap: 8px; }
.cl-guide-step {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.cl-guide-num {
    width: 20px; height: 20px; min-width: 20px;
    border-radius: 50%;
    background: var(--color-primary, #6366f1);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}
.cl-guide-step strong { display: block; font-size: 0.78rem; color: var(--color-text, #1e293b); }
.cl-guide-step p { font-size: 0.73rem; color: var(--color-text-muted, #64748b); margin: 2px 0 0; line-height: 1.4; }

/* ── Forbidden phrases list ──────────────────────────────── */
.cl-forbidden-list { display: flex; flex-direction: column; gap: 4px; }
.cl-forbidden-item {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 5px;
    padding: 5px 8px;
}
.cl-forbidden-phrase { font-size: 0.75rem; font-weight: 600; color: #dc2626; }
.cl-forbidden-context { font-size: 0.71rem; color: #9ca3af; margin-top: 2px; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── CL ATS score ────────────────────────────────────────── */
.cl-ats-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.cl-ats-score-ring {
    width: 54px; height: 54px;
    border-radius: 50%;
    border: 4px solid var(--color-border, #e2e8f0);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    transition: border-color .3s;
}
.cl-ats-score-ring.good   { border-color: #16a34a; color: #16a34a; }
.cl-ats-score-ring.amber  { border-color: #d97706; color: #d97706; }
.cl-ats-score-ring.low    { border-color: #dc2626; color: #dc2626; }
#cl-ats-score-val { font-size: 1rem; line-height: 1; }
.cl-ats-label { font-size: 0.65rem; color: var(--color-text-muted, #94a3b8); }
.cl-ats-btn {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 6px;
    background: var(--surface-card, #fff);
    color: var(--color-text, #1e293b);
    font-size: 0.78rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: center;
}
.cl-ats-btn:hover { background: var(--surface-hover, #f1f5f9); border-color: var(--color-primary, #6366f1); }
.cl-ats-detail { font-size: 0.73rem; color: var(--color-text-muted, #64748b); line-height: 1.5; }
.cl-ats-kw-chip {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 99px;
    font-size: 0.69rem;
    margin: 2px 2px 0 0;
    border: 1px solid;
}
.cl-ats-kw-chip.matched { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.cl-ats-kw-chip.missing { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

/* ── Dark mode ───────────────────────────────────────────── */
[data-theme="dark"] .cl-sidebar { background: var(--surface-raised, #0f172a); border-color: var(--color-border, #334155); }
[data-theme="dark"] .cl-forbidden-item { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); }
[data-theme="dark"] .cl-ats-score-ring { border-color: var(--color-border, #334155); }
[data-theme="dark"] .cl-role-input { background: var(--surface-raised, #0f172a); border-color: var(--color-border, #334155); color: var(--color-text, #e2e8f0); }

/* ── Responsive: stack on narrow screens ─────────────────── */
@media (max-width: 768px) {
    .cl-workspace { flex-direction: column; }
    .cl-sidebar { width: 100%; border-left: none; border-top: 1px solid var(--color-border, #e2e8f0); max-height: 280px; }
}


/* ══════════════════════════════════════════════════════════════
   Phase 7 — Export & Sharing
   ══════════════════════════════════════════════════════════════ */

/* ── Export / Import Dropdown Wrappers ──────────────────────── */
.export-drop, .import-drop {
    position: relative;
}

.export-menu, .import-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 178px;
    background: var(--surface-card, #ffffff);
    border: 1px solid var(--border, rgba(0,0,0,0.12));
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.14);
    z-index: 2000;
    overflow: hidden;
}

.export-menu.open, .import-menu.open {
    display: block;
}

.export-menu button, .import-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    border-radius: 0;
    color: var(--text-primary, #1e293b);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background 120ms;
    white-space: nowrap;
}

.export-menu button:hover, .import-menu button:hover {
    background: var(--surface-hover, #f1f5f9);
}

.export-menu button .iconify, .import-menu button .iconify {
    font-size: 16px;
    color: var(--text-secondary, #64748b);
    flex-shrink: 0;
}

/* ── Share Modal ─────────────────────────────────────────────── */
.share-modal-content {
    width: 500px;
    max-width: calc(100vw - 40px);
}

.share-modal-desc {
    color: var(--text-secondary, #64748b);
    font-size: 13px;
    margin-bottom: 14px;
    line-height: 1.5;
}

.share-url-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

.share-url-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border, rgba(0,0,0,0.12));
    border-radius: var(--radius-sm, 6px);
    background: var(--surface-input, #f8fafc);
    color: var(--text-primary, #1e293b);
    font-size: 12px;
    font-family: 'SFMono-Regular', Consolas, monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.share-url-size {
    font-size: 11px;
    color: var(--text-secondary, #64748b);
    margin-bottom: 0;
}

.share-url-size.warn {
    color: #d97706;
}

.share-modal-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

/* ── GitHub Import Modal ─────────────────────────────────────── */
.github-import-content {
    width: 560px;
    max-width: calc(100vw - 40px);
}

.github-import-row {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.github-username-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border, rgba(0,0,0,0.12));
    border-radius: var(--radius-sm, 6px);
    background: var(--surface-input, #f8fafc);
    color: var(--text-primary, #1e293b);
    font-size: 13px;
}

.github-import-preview {
    background: var(--surface-app, #f1f5f9);
    border: 1px solid var(--border, rgba(0,0,0,0.12));
    border-radius: var(--radius-sm, 6px);
    padding: 12px;
    font-size: 12px;
    font-family: 'SFMono-Regular', Consolas, monospace;
    max-height: 220px;
    overflow-y: auto;
    white-space: pre-wrap;
    color: var(--text-primary, #1e293b);
    margin-bottom: 12px;
    line-height: 1.5;
}

.github-import-confirm {
    justify-content: flex-end;
    gap: 8px;
}

/* ── LinkedIn Import Modal ───────────────────────────────────── */
.linkedin-import-content {
    width: 460px;
    max-width: calc(100vw - 40px);
}

.linkedin-file-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 0;
}

.linkedin-file-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--surface-card, #ffffff);
    border: 1px solid var(--border, rgba(0,0,0,0.12));
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary, #1e293b);
    transition: background 120ms;
    user-select: none;
}

.linkedin-file-label:hover {
    background: var(--surface-hover, #f1f5f9);
}

.linkedin-file-status {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

/* ── Dark mode overrides ─────────────────────────────────────── */
[data-theme="dark"] .export-menu,
[data-theme="dark"] .import-menu {
    background: var(--surface-card, #1e293b);
    border-color: var(--border, #334155);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

[data-theme="dark"] .export-menu button,
[data-theme="dark"] .import-menu button {
    color: var(--text-primary, #e2e8f0);
}

[data-theme="dark"] .export-menu button:hover,
[data-theme="dark"] .import-menu button:hover {
    background: var(--surface-hover, #0f172a);
}

[data-theme="dark"] .share-url-input,
[data-theme="dark"] .github-username-input {
    background: var(--surface-input, #0f172a);
    border-color: var(--border, #334155);
    color: var(--text-primary, #e2e8f0);
}

[data-theme="dark"] .github-import-preview {
    background: var(--surface-app, #020617);
    border-color: var(--border, #334155);
    color: var(--text-primary, #e2e8f0);
}

[data-theme="dark"] .linkedin-file-label {
    background: var(--surface-card, #1e293b);
    border-color: var(--border, #334155);
    color: var(--text-primary, #e2e8f0);
}

[data-theme="dark"] .linkedin-file-label:hover {
    background: var(--surface-hover, #0f172a);
}


/* ═══════════════════════════════════════════════════════════════════
   Onboarding Wizard — First-run modal overlay
   ═══════════════════════════════════════════════════════════════════ */

.onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 1;
    transition: opacity 0.25s ease;
}

.onboarding-overlay--hidden {
    opacity: 0;
    pointer-events: none;
}

.onboarding-modal {
    position: relative;
    background: var(--surface-card, #1e293b);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl, 16px);
    padding: 36px 40px 32px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.04);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Progress dots */
.onboarding-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.onboarding-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

/* Progress dots */
.onboarding-progress {
    display: flex;
    gap: 6px;
    align-items: center;
}

.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: background 0.2s, transform 0.2s;
}

.onboarding-dot.active {
    background: var(--color-primary, #6366f1);
    transform: scale(1.2);
}

.onboarding-dot.done {
    background: rgba(99, 102, 241, 0.45);
}

/* Title */
.onboarding-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #f1f5f9);
    margin: 0;
    line-height: 1.3;
    letter-spacing: -0.3px;
}

/* Content */
.onboarding-content {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.925rem;
    line-height: 1.65;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.onboarding-content p { margin: 0; }

.onboarding-content code {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.85em;
    color: #a5b4fc;
    font-family: var(--font-mono, monospace);
}

.onboarding-content kbd {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.8em;
    color: #cbd5e1;
    font-family: var(--font-mono, monospace);
}

.onboarding-content ul {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.onboarding-content li strong { color: var(--text-primary, #f1f5f9); }

/* Step 2 option cards */
.onboarding-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.onboarding-option {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md, 8px);
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    color: var(--text-primary, #f1f5f9);
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

.onboarding-option:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.4);
}

.onboarding-option strong {
    font-weight: 600;
    color: var(--text-primary, #f1f5f9);
}

.onboarding-option span {
    font-size: 0.8rem;
    color: var(--text-secondary, #94a3b8);
    font-weight: 400;
}

/* Action buttons */
.onboarding-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.onboarding-btn {
    padding: 10px 24px;
    border-radius: var(--radius-md, 8px);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
    line-height: 1;
}

.onboarding-btn--primary {
    background: var(--brand-gradient, linear-gradient(135deg, #6366f1, #8b5cf6));
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.onboarding-btn--primary:hover {
    opacity: 0.9;
    box-shadow: 0 4px 18px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

.onboarding-btn--secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary, #94a3b8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.onboarding-btn--secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #f1f5f9);
    border-color: rgba(255, 255, 255, 0.2);
}
