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

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface-hover: #22263a;
    --surface-2: #141724;
    --border: #2a2e3f;
    --text: #e4e4e7;
    --text-muted: #9ca3af;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-soft: rgba(99, 102, 241, 0.16);
    --high: #ef4444;
    --high-bg: #451a1a;
    --medium: #f59e0b;
    --medium-bg: #452a1a;
    --low: #22c55e;
    --low-bg: #1a3a2a;
    --radius: 8px;
}

html { color-scheme: dark; }
[hidden] { display: none !important; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

a { color: var(--primary-hover); }
a.link { color: var(--primary-hover); text-decoration: none; }
a.link:hover { text-decoration: underline; }
h2 { font-size: 1.5rem; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; }
h4 { font-size: 0.9rem; }
code { background: var(--surface-2); padding: 0.05rem 0.35rem; border-radius: 4px; font-size: 0.85em; }
.muted { color: var(--text-muted); }
.small { font-size: 0.8rem; }
.count { color: var(--text-muted); font-weight: 400; font-size: 0.85rem; margin-left: 0.3rem; }
.grow { flex: 1; }
.top-gap { margin-top: 0.75rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.7rem; color: var(--text-muted); font-weight: 600; }

/* ---------- Nav ---------- */
.topnav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.7rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 17, 23, 0.9);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 50;
}
.brand { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--text); font-weight: 700; }
.brand-mark { font-size: 1.2rem; }
.nav-links { display: flex; gap: 0.25rem; flex: 1; }
.nav-links a {
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-links a.active { color: white; background: var(--primary-soft); }
.nav-level { display: flex; align-items: center; gap: 0.6rem; }
.nav-level-badge {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.9rem; color: white;
}
.nav-level-meta { display: flex; flex-direction: column; gap: 0.2rem; min-width: 120px; }
.nav-level-title { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.nav-xp-bar { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.nav-xp-fill { height: 100%; background: var(--primary); width: 0; transition: width 0.6s ease; }
.nav-streak { font-size: 0.85rem; font-weight: 600; }

/* ---------- Layout ---------- */
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem; }
.page { display: flex; flex-direction: column; gap: 1rem; animation: fadeIn 0.25s ease; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.page-loading { color: var(--text-muted); padding: 3rem; text-align: center; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.hero-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; }
.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.row { display: flex; gap: 0.5rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 0.6rem; }
.row.between { justify-content: space-between; margin-top: 0.5rem; flex-wrap: wrap; }
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.sub-head { margin: 1rem 0 0.4rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.72rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-state h3 { color: var(--text); margin-bottom: 0.4rem; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Forms & buttons ---------- */
input[type="text"], input[type="password"], input:not([type]), input[type="url"], input[type="email"], input[type="search"], textarea, select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); }
.field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--text-muted); }
.check-label { display: flex; align-items: center; gap: 0.4rem; white-space: nowrap; font-size: 0.85rem; color: var(--text-muted); }
button { font-family: inherit; }
.primary-btn, .secondary-btn, .mini-btn, .danger-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem;
    border-radius: var(--radius); cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
}
.primary-btn { padding: 0.55rem 1rem; background: var(--primary); color: white; border: none; font-size: 0.85rem; font-weight: 600; }
.primary-btn:hover { background: var(--primary-hover); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.primary-btn.small { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
.secondary-btn { padding: 0.55rem 1rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); font-size: 0.85rem; }
.secondary-btn:hover { background: var(--surface-hover); }
.mini-btn { padding: 0.35rem 0.75rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 0.78rem; }
.mini-btn:hover { background: var(--surface-hover); }
.mini-btn.accept:hover { background: rgba(34, 197, 94, 0.15); border-color: var(--low); }
.mini-btn.decline:hover, .mini-btn.danger:hover { background: rgba(239, 68, 68, 0.15); border-color: var(--high); }
.danger-btn { padding: 0.55rem 1rem; background: var(--high); color: white; border: none; font-size: 0.85rem; font-weight: 600; }
.icon-btn { background: none; border: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; }
.chip-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip {
    padding: 0.3rem 0.7rem; border-radius: 9999px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-muted); font-size: 0.78rem; cursor: pointer;
}
.chip:hover { color: var(--text); background: var(--surface-hover); }
.chip.active { background: var(--primary-soft); color: white; border-color: var(--primary); }
.pill { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 9999px; font-size: 0.68rem; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); vertical-align: middle; }
.pill.primary { background: var(--primary-soft); border-color: var(--primary); color: white; }
.xp-pill { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 9999px; font-size: 0.72rem; font-weight: 700; background: var(--primary-soft); color: var(--primary-hover); white-space: nowrap; }
.xp-pill.small { font-size: 0.65rem; }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.4rem 0; }
.tag { padding: 0.2rem 0.55rem; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); font-size: 0.72rem; color: var(--text-muted); }
.tag.must { border-color: rgba(245, 158, 11, 0.5); color: var(--medium); }

.drop-zone {
    border: 2px dashed var(--border); border-radius: var(--radius); padding: 2rem 1.5rem;
    text-align: center; cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.drop-zone.compact { padding: 1.4rem 1rem; }
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--primary); background: rgba(99, 102, 241, 0.05); }
.drop-zone-hint { color: var(--text-muted); font-size: 0.78rem; margin-top: 0.4rem; }
.paste-details { margin-top: 0.75rem; }
.paste-details summary, details summary { cursor: pointer; color: var(--text-muted); font-size: 0.85rem; }
.paste-details form { margin-top: 0.75rem; }

/* ---------- Dashboard ---------- */
.level-card { display: flex; gap: 1.5rem; align-items: center; }
.level-ring { position: relative; width: 110px; height: 110px; flex-shrink: 0; }
.level-ring svg { width: 110px; height: 110px; transform: rotate(-90deg); }
.level-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 800; }
.streak-line { margin-top: 0.4rem; font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.stat { text-align: center; padding: 0.6rem; background: var(--surface-2); border-radius: var(--radius); }
.stat-num { font-size: 1.7rem; font-weight: 800; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.setup-list { list-style: none; margin-top: 0.5rem; }
.setup-list li { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0; }
.setup-list .check { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 0.7rem; color: var(--low); }
.setup-list li.done .check { background: var(--low-bg); border-color: var(--low); }
.setup-list li.done a { color: var(--text-muted); text-decoration: line-through; }
.next-list, .log-list { list-style: none; }
.next-list li { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.55rem 0; border-bottom: 1px solid var(--border); }
.next-list li:last-child { border-bottom: none; }
.next-list a { display: flex; flex-direction: column; text-decoration: none; color: var(--text); }
.log-list li { display: flex; gap: 0.6rem; align-items: center; padding: 0.35rem 0; font-size: 0.88rem; }
.log-list .muted { margin-left: auto; font-size: 0.75rem; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 0.5rem; }
.badge { text-align: center; padding: 0.6rem 0.3rem; border-radius: var(--radius); background: var(--surface-2); opacity: 0.35; filter: grayscale(1); }
.badge.earned { opacity: 1; filter: none; background: var(--primary-soft); }
.badge-icon { display: block; font-size: 1.5rem; }
.badge-name { display: block; font-size: 0.68rem; margin-top: 0.2rem; }

/* ---------- Library ---------- */
.doc-list { list-style: none; }
.doc-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
.doc-row:last-child { border-bottom: none; }
.doc-title { font-weight: 600; }
.doc-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }
.doc-view { white-space: pre-wrap; font-family: inherit; font-size: 0.88rem; line-height: 1.6; max-height: 60vh; overflow: auto; background: var(--surface-2); padding: 1rem; border-radius: var(--radius); }
.style-summary { font-size: 0.95rem; line-height: 1.6; margin-bottom: 0.75rem; }
.style-dl { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.75rem; font-size: 0.85rem; margin-bottom: 0.75rem; }
.style-dl dt { color: var(--text-muted); }
.style-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; font-size: 0.83rem; }
.style-cols h4, .style-card details h4 { margin: 0.5rem 0 0.25rem; color: var(--text-muted); }
.style-cols ul, .style-card details ul { padding-left: 1.1rem; }
.fingerprint { margin-top: 0.75rem; border-top: 1px solid var(--border); }
.fp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin-bottom: 0.5rem; }
.fp-grid div { text-align: center; background: var(--surface-2); padding: 0.5rem 0.25rem; border-radius: var(--radius); }
.fp-grid b { display: block; font-size: 1.1rem; }
.fp-grid span { font-size: 0.65rem; color: var(--text-muted); }

/* ---------- Jobs ---------- */
.search-row { display: grid; grid-template-columns: 2fr 1fr auto auto; gap: 0.5rem; align-items: center; }
.job-list { display: flex; flex-direction: column; gap: 0.75rem; }
.job-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.job-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.job-sub { color: var(--text-muted); font-size: 0.88rem; }
.job-meta { margin-top: 0.3rem; }
.job-desc { font-size: 0.88rem; color: var(--text-muted); margin: 0.5rem 0; }
.job-foot { display: flex; gap: 0.5rem; }
.job-full { white-space: pre-wrap; font-family: inherit; font-size: 0.85rem; line-height: 1.6; margin-top: 0.75rem; padding: 0.9rem; background: var(--surface-2); border-radius: var(--radius); max-height: 480px; overflow: auto; }

/* ---------- Applications ---------- */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.75rem; }
.app-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; text-decoration: none; color: var(--text); transition: border-color 0.2s, transform 0.15s; }
.app-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.app-card h3 { margin: 0.4rem 0 0.1rem; }
.app-card-top { display: flex; justify-content: space-between; align-items: center; }
.status-pill { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 9999px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-2); color: var(--text-muted); }
.status-pill.tailoring { background: var(--medium-bg); color: var(--medium); }
.status-pill.applied { background: var(--primary-soft); color: var(--primary-hover); }
.status-pill.interviewing { background: #1a3340; color: #22d3ee; }
.status-pill.offer { background: var(--low-bg); color: var(--low); }
.status-pill.rejected { background: var(--high-bg); color: var(--high); }
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin: 0.6rem 0 0.3rem; }
.progress.big { height: 9px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #22c55e); transition: width 0.5s ease; }

.app-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.app-head h2[contenteditable]:focus, .editable:focus { outline: 1px dashed var(--primary); border-radius: 4px; }
.app-sub { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.2rem; }
.app-head-actions { display: flex; gap: 0.5rem; align-items: center; }
.app-head-actions select { width: auto; }
.app-layout { display: grid; grid-template-columns: 320px 1fr; gap: 1rem; align-items: start; }
.checklist-card { position: sticky; top: 72px; }
.checklist { list-style: none; margin: 0.75rem 0; }
.checklist li { padding: 0.45rem 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: none; }
.checklist label { display: flex; align-items: center; gap: 0.55rem; cursor: pointer; font-size: 0.88rem; }
.checklist input { accent-color: var(--low); width: 16px; height: 16px; flex-shrink: 0; }
.checklist .cl-label { flex: 1; }
.checklist li.done .cl-label { color: var(--text-muted); text-decoration: line-through; }
.cl-hint { font-size: 0.72rem; color: var(--text-muted); margin: 0.2rem 0 0 1.65rem; display: none; }
.checklist li:hover .cl-hint { display: block; }
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 0.75rem; overflow-x: auto; }
.tab { padding: 0.55rem 0.9rem; background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-muted); cursor: pointer; font-size: 0.9rem; font-weight: 500; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: white; border-bottom-color: var(--primary); }
.tab-body textarea { margin-top: 0.5rem; }
.extract { margin-bottom: 1rem; padding: 0.9rem 1rem; background: var(--surface-2); border-left: 3px solid var(--primary); border-radius: var(--radius); font-size: 0.9rem; }
.extract h4 { margin-top: 0.6rem; color: var(--text-muted); }
.extract ul { padding-left: 1.1rem; font-size: 0.85rem; }
.gen-controls { display: grid; grid-template-columns: auto 1fr auto; gap: 0.5rem; align-items: center; }
.gen-controls select { width: auto; }
.quick-fill { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin: 0.75rem 0; }
.answer-list { list-style: none; counter-reset: ans; display: flex; flex-direction: column; gap: 0.75rem; }
.answer { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 0.9rem; }
.answer-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
.answer textarea { margin-top: 0.4rem; background: var(--surface); }
.answer-foot { margin-top: 0.3rem; }

/* ---------- Profile ---------- */
.quick-list { display: flex; flex-direction: column; gap: 0.35rem; }
.quick-row { display: flex; justify-content: space-between; gap: 0.75rem; align-items: center; width: 100%; text-align: left; padding: 0.5rem 0.7rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); cursor: pointer; font-size: 0.85rem; }
.quick-row:hover { border-color: var(--primary); }
.quick-row code { max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Optimizer (score, keywords, document) ---------- */
.score-hero { display: flex; align-items: center; gap: 2rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin: 1rem 0; flex-wrap: wrap; }
.score-ring-container { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.score-ring { transform: rotate(-90deg); width: 120px; height: 120px; }
.score-ring-bg { fill: none; stroke: var(--border); stroke-width: 8; }
.score-ring-fill { fill: none; stroke: var(--primary); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset 1.2s ease, stroke 0.4s ease; }
.score-number { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 800; }
.score-details { flex: 1; min-width: 200px; }
.score-details h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.score-summary { color: var(--text-muted); font-size: 0.9rem; }
.score-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.applied-counter { margin-top: 0.5rem; font-size: 0.85rem; font-weight: 600; color: var(--primary-hover); }
.keywords-section { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.keywords-panel { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.keywords-panel h4 { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.75rem; }
.keywords-panel.found h4 { color: var(--low); }
.keywords-panel.missing h4 { color: var(--high); }
.keyword-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.keyword-tag { padding: 0.3rem 0.65rem; border-radius: 9999px; font-size: 0.78rem; font-weight: 500; }
.keyword-tag.found { background: var(--low-bg); color: var(--low); border: 1px solid rgba(34, 197, 94, 0.3); }
.keyword-tag.missing { background: var(--high-bg); color: var(--high); border: 1px solid rgba(239, 68, 68, 0.3); }
.no-keywords { color: var(--text-muted); font-size: 0.85rem; font-style: italic; }
.doc-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.doc-toolbar-title { font-size: 0.85rem; color: var(--text-muted); }
.doc-toolbar-actions { display: flex; gap: 0.5rem; }
.doc-page {
    background: #fbfbf8; color: #1f2024; border-radius: var(--radius); padding: 3rem 3.5rem; max-width: 850px; margin: 0 auto 1.5rem;
    font-family: Georgia, "Times New Roman", serif; font-size: 1rem; line-height: 1.6; word-wrap: break-word; box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}
.doc-page.plain { white-space: pre-wrap; line-height: 1.85; }
.doc-page.rendered h1 { font-size: 1.6rem; margin: 0.6rem 0 0.4rem; }
.doc-page.rendered h2 { font-size: 1.3rem; margin: 0.6rem 0 0.35rem; }
.doc-page.rendered h3 { font-size: 1.1rem; margin: 0.5rem 0 0.3rem; }
.doc-page.rendered h4, .doc-page.rendered h5, .doc-page.rendered h6 { font-size: 1rem; margin: 0.5rem 0 0.3rem; }
.doc-page.rendered p { margin: 0.4rem 0; }
.doc-page.rendered ul, .doc-page.rendered ol { margin: 0.4rem 0 0.4rem 1.5rem; }
.doc-page.rendered li { margin-bottom: 0.2rem; }
.doc-page.rendered table { border-collapse: collapse; width: 100%; margin: 0.6rem 0; }
.doc-page.rendered td, .doc-page.rendered th { border: 1px solid #d4d4d0; padding: 0.4rem 0.6rem; vertical-align: top; }
.doc-page.rendered strong { font-weight: 700; }
.doc-page.rendered a { color: #1d4ed8; }
.sugg { cursor: pointer; border-radius: 2px; padding: 0 1px; transition: background 0.15s; }
.sugg.pending { background: rgba(245, 158, 11, 0.35); border-bottom: 2px solid #d97706; }
.sugg.pending:hover { background: rgba(245, 158, 11, 0.55); }
.sugg.accepted { background: rgba(34, 197, 94, 0.25); border-bottom: 2px solid #16a34a; color: #14532d; }
.sugg.declined { background: transparent; border-bottom: 1px dotted #9ca3af; opacity: 0.75; }
.suggestion-popover { position: fixed; z-index: 200; width: 340px; max-width: calc(100vw - 2rem); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55); }
.pop-category { display: inline-block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--primary-hover); margin-bottom: 0.5rem; }
.pop-reason { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 0.75rem; }
.pop-diff { font-size: 0.85rem; line-height: 1.5; margin-bottom: 0.85rem; }
.pop-diff .pop-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); display: block; margin-bottom: 0.15rem; }
.pop-original { background: var(--high-bg); color: #fca5a5; padding: 0.35rem 0.5rem; border-radius: 4px; margin-bottom: 0.5rem; }
.pop-replacement { background: var(--low-bg); color: #86efac; padding: 0.35rem 0.5rem; border-radius: 4px; }
.pop-actions { display: flex; gap: 0.5rem; }
.pop-actions button { flex: 1; padding: 0.5rem; border-radius: var(--radius); border: none; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.pop-accept { background: var(--low); color: #052e16; }
.pop-decline { background: var(--surface-hover); color: var(--text); }
.pop-undo { background: var(--medium); color: #1a1d27; }
.ats-notes { max-width: 850px; margin: 0 auto; }
.ats-overall { background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: var(--radius); padding: 0.9rem 1.1rem; margin: 0.75rem 0 1rem; font-size: 0.9rem; line-height: 1.6; }
.rec-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 0.75rem; border-left: 3px solid; }
.rec-card.high { border-left-color: var(--high); background: var(--high-bg); }
.rec-card.medium { border-left-color: var(--medium); background: var(--medium-bg); }
.rec-card.low { border-left-color: var(--low); background: var(--low-bg); }
.rec-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.rec-category { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.rec-severity { font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 9999px; font-weight: 600; text-transform: uppercase; }
.rec-severity.high { background: var(--high); color: white; }
.rec-severity.medium { background: var(--medium); color: #1a1d27; }
.rec-severity.low { background: var(--low); color: #1a1d27; }
.rec-message { font-size: 0.9rem; margin-bottom: 0.5rem; }
.rec-suggestion { font-size: 0.85rem; color: var(--text-muted); }

/* ---------- Toasts, modal, loading, confetti ---------- */
.toast-stack { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 300; pointer-events: none; }
.toast { padding: 0.65rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: 0 8px 30px rgba(0,0,0,0.5); font-size: 0.85rem; max-width: 340px; opacity: 0; transform: translateY(8px); transition: opacity 0.25s, transform 0.25s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.xp { border-color: var(--primary); }
.toast.badge { border-color: var(--medium); }
.toast.level { border-color: var(--low); font-weight: 700; }
.toast.error { border-color: var(--high); }
.toast.ok { border-color: var(--low); }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.65); display: flex; align-items: center; justify-content: center; z-index: 250; padding: 1rem; }
.modal-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; width: 100%; max-width: 720px; max-height: 90vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.modal-text { margin-bottom: 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }
.loading-overlay { position: fixed; inset: 0; background: rgba(15, 17, 23, 0.85); display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 100; }
.loading-overlay.visible { display: flex; }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay p { margin-top: 1rem; color: var(--text-muted); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 400; }

footer { text-align: center; padding: 1.5rem 1rem; color: var(--text-muted); font-size: 0.78rem; border-top: 1px solid var(--border); margin-top: 3rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .two-col, .hero-grid, .app-layout { grid-template-columns: 1fr; }
    .checklist-card { position: static; }
    .search-row, .gen-controls { grid-template-columns: 1fr; }
    .nav-level-meta { display: none; }
    .nav-links { overflow-x: auto; }
}
@media (max-width: 640px) {
    .keywords-section, .style-cols { grid-template-columns: 1fr; }
    .fp-grid { grid-template-columns: repeat(2, 1fr); }
    .score-hero { flex-direction: column; text-align: center; }
    .doc-page { padding: 1.5rem 1.25rem; font-size: 0.95rem; }
    .topnav { gap: 0.75rem; padding: 0.6rem 0.75rem; }
    .brand-name { display: none; }
}

/* Account gate stays closed until Neon confirms a session. */
body:not(.signed-in) > .topnav,
body:not(.signed-in) > #view,
body:not(.signed-in) > footer,
body:not(.signed-in) > #modal,
body:not(.signed-in) > #loading { display: none; }
#auth-panel { padding: 48px 20px; min-height: 85vh; }
#auth-panel[hidden] { display: none; }
.auth-card { max-width: 460px; margin: 0 auto; padding: 28px; }
.auth-card h1 { margin: 12px 0; }
.auth-google { width: 100%; margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 40px; padding: 10px 12px; background: #fff; color: #1f1f1f; border: 1px solid #747775; }
.auth-google:hover:not(:disabled) { background: #f2f2f2; }
.google-icon { width: 20px; height: 20px; flex: none; }
#auth-message { min-height: 24px; overflow-wrap: anywhere; }
.account-controls { display: flex; align-items: center; gap: 8px; font-size: 12px; }
#account-email { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .account-controls { width: 100%; justify-content: flex-end; } .auth-card { padding: 20px; } }

/* Discovery: jobs lead; setup and progress support the search. */
.discovery-intro { margin: 12px 0 28px; }
.discovery-intro h1 { font-size: clamp(28px, 4vw, 42px); letter-spacing: -0.035em; line-height: 1.15; margin: 10px 0 14px; }
.discovery-intro > p, .discovery-intro > div > p { max-width: 660px; }
.onboarding-page { max-width: 850px; }
.preference-form { display: flex; flex-direction: column; gap: 24px; padding: 28px; }
.preference-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.preference-form .field { gap: 8px; }
.preference-form .primary-btn { padding: 13px 24px; }
#preference-error:empty { display: none; }
#preference-error { color: #fca5a5; }
.match-intro { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.match-intro > a { flex: none; }
.match-toolbar { display: flex; gap: 16px; justify-content: space-between; align-items: center; margin-bottom: 20px; color: var(--text-muted); font-size: 13px; }
.match-toolbar button { flex: none; }
.match-list { display: grid; gap: 18px; }
.match-card { padding: 28px; }
.match-card h2 { font-size: 23px; margin: 4px 0 8px; }
.match-company { font-size: 13px; font-weight: 600; color: var(--primary-hover); }
.match-order { color: var(--text-muted); font-size: 18px; }
.match-reasons { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 18px 0; }
.match-reasons li { font-size: 12px; padding: 5px 9px; border-radius: 5px; background: var(--primary-soft); color: #c7d2fe; }
.match-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; margin-top: 20px; }
.dismiss-controls { display: flex; gap: 8px; align-items: center; }
.dismiss-controls select { width: auto; min-width: 0; max-width: 260px; font-size: 12px; padding: 7px 10px; }
.feedback-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; margin-bottom: 18px; border: 1px solid var(--primary); border-radius: var(--radius); background: var(--primary-soft); }
.feedback-list { max-height: 50vh; overflow: auto; margin-top: 18px; }
.feedback-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.discovery-bottom { margin-top: 36px; display: flex; flex-direction: column; gap: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 640px) {
    .preference-grid { grid-template-columns: 1fr; gap: 20px; }
    .preference-form, .match-card { padding: 20px; }
    .match-intro { flex-direction: column; align-items: flex-start; gap: 8px; }
    .match-toolbar { align-items: flex-start; }
    .dismiss-controls { width: 100%; }
    .dismiss-controls select { flex: 1; width: 0; }
    .match-card h2 { font-size: 21px; }
}
.onboarding-page { margin-left: auto; margin-right: auto; }
@media (max-width: 900px) {
    .topnav { flex-wrap: wrap; gap: 12px; }
    .topnav .brand { order: 0; flex: none; }
    .topnav .brand-name { display: inline; }
    .topnav .account-controls { order: 1; flex: 1; width: auto; min-width: 0; justify-content: flex-end; }
    .topnav .nav-links { order: 2; flex: 1 0 100%; min-width: 0; white-space: nowrap; }
    .topnav .nav-level { display: none; }
    #account-email { max-width: 120px; }
}
@media (prefers-reduced-motion: reduce) { .page { animation: none; } }
