/* ── Design tokens ── */
:root {
  --accent:        oklch(48% 0.18 250);
  --accent-hover:  oklch(42% 0.18 250);
  --accent-soft:   oklch(95.5% 0.05 250);
  --accent-dim:    oklch(35% 0.15 250);
  --bg:            oklch(98.5% 0.005 250);
  --surface:       oklch(100% 0 0);
  --border:        oklch(92% 0.01 250);
  --border-strong: oklch(84% 0.02 250);
  --text:          oklch(15% 0.02 250);
  --text-2:        oklch(45% 0.025 250);
  --text-3:        oklch(65% 0.015 250);
  --ok:            oklch(52% 0.17 145);
  --ok-soft:       oklch(96% 0.05 145);
  --err:           oklch(52% 0.22 25);
  --err-soft:      oklch(97% 0.04 25);
  --warn:          oklch(65% 0.14 75);
  --r-sm:  6px;
  --r-md:  14px;
  --r-lg:  22px;
  --r-pill:100px;
  --shadow:       0 2px 20px oklch(50% 0.06 250 / 0.10);
  --shadow-hover: 0 8px 32px oklch(50% 0.06 250 / 0.18);
  --shadow-sm:    0 1px 8px oklch(50% 0.06 250 / 0.07);
  --font-d: 'Fraunces', Georgia, serif;
  --font-b: 'DM Sans', system-ui, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-b);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Auth Overlay ── */
.auth-overlay {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse 120% 80% at 60% 40%, oklch(92% 0.07 250), oklch(98.5% 0.01 250));
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.auth-card {
  background: var(--surface); border-radius: var(--r-lg); padding: 44px 40px;
  width: 100%; max-width: 420px;
  box-shadow: 0 24px 64px oklch(40% 0.12 250 / 0.18), 0 4px 16px oklch(40% 0.12 250 / 0.10);
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo h1 {
  font-family: var(--font-d); font-size: 2rem; font-weight: 700;
  color: var(--accent); letter-spacing: -0.03em;
}
.auth-logo p { font-size: 0.88rem; color: var(--text-2); margin-top: 6px; }

.btn-google {
  width: 100%; padding: 12px 16px; border: 1.5px solid var(--border-strong);
  border-radius: var(--r-md); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  gap: 10px; font-family: var(--font-b); font-size: 0.93rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s, border-color 0.15s; color: var(--text);
}
.btn-google:hover { background: var(--bg); border-color: var(--accent); }
.btn-google svg { flex-shrink: 0; }

.or-divider {
  text-align: center; margin: 20px 0; position: relative;
  color: var(--text-3); font-size: 0.82rem;
}
.or-divider::before, .or-divider::after {
  content: ''; position: absolute; top: 50%; width: 43%; height: 1px; background: var(--border);
}
.or-divider::before { left: 0; } .or-divider::after { right: 0; }

.auth-tabs {
  display: flex; background: var(--bg); border-radius: var(--r-pill);
  padding: 4px; margin-bottom: 22px;
}
.auth-tab-btn {
  flex: 1; padding: 9px 16px; border: none; background: transparent; cursor: pointer;
  font-family: var(--font-b); font-size: 0.88rem; font-weight: 600;
  color: var(--text-2); border-radius: var(--r-pill); transition: all 0.2s;
}
.auth-tab-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.auth-field { margin-bottom: 14px; }
.auth-field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.auth-field input {
  width: 100%; border: 1.5px solid var(--border); border-radius: var(--r-md);
  padding: 11px 14px; font-size: 0.93rem; font-family: var(--font-b);
  color: var(--text); outline: none; transition: border-color 0.2s, box-shadow 0.2s; background: var(--surface);
}
.auth-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px oklch(48% 0.18 250 / 0.12); }

.btn-auth {
  width: 100%; padding: 12px; background: var(--accent); color: white; border: none;
  border-radius: var(--r-md); font-family: var(--font-b); font-size: 0.95rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s, transform 0.1s; margin-top: 4px;
}
.btn-auth:hover { background: var(--accent-hover); }
.btn-auth:active { transform: scale(0.98); }
.auth-error { color: var(--err); font-size: 0.83rem; margin-top: 12px; text-align: center; min-height: 18px; }

/* ── Header ── */
header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; position: sticky; top: 0; z-index: 100;
}
.header-logo {
  font-family: var(--font-d); font-size: 1.3rem; font-weight: 700;
  color: var(--accent); letter-spacing: -0.03em;
}
.header-tabs {
  display: flex; background: var(--bg); border-radius: var(--r-pill); padding: 4px;
}
.tab-btn {
  padding: 7px 18px; border-radius: var(--r-pill); border: none;
  background: transparent; font-family: var(--font-b);
  font-size: 0.85rem; font-weight: 500; color: var(--text-2);
  cursor: pointer; transition: all 0.2s;
}
.tab-btn.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); font-weight: 600; }
.tab-btn:hover:not(.active) { color: var(--text); }

.header-user { display: flex; align-items: center; gap: 12px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), oklch(38% 0.18 270));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; color: white; cursor: pointer;
  transition: opacity 0.2s; flex-shrink: 0;
}
.user-avatar:hover { opacity: 0.85; }
#user-name { font-size: 0.85rem; color: var(--text-2); font-weight: 500; }
.btn-signout {
  padding: 6px 14px; border: 1.5px solid var(--border-strong);
  border-radius: var(--r-pill); background: transparent; color: var(--text-2);
  font-family: var(--font-b); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.btn-signout:hover { border-color: var(--accent); color: var(--accent); }

/* ── Layout ── */
.container { max-width: 1400px; margin: 0 auto; padding: 36px 28px; }
.panel { display: none; }
.panel.active { display: block; }

/* ── Cards ── */
.card {
  background: var(--surface); border-radius: var(--r-md);
  box-shadow: var(--shadow); padding: 28px; margin-bottom: 20px;
}
.card-title {
  font-family: var(--font-d); font-size: 1.05rem; font-weight: 600; color: var(--text);
  margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; letter-spacing: -0.02em;
}

/* ── Generate hero ── */
.gen-hero { margin-bottom: 32px; }
.gen-hero h2 {
  font-family: var(--font-d); font-size: 2.6rem; font-weight: 700;
  line-height: 1.12; letter-spacing: -0.04em; color: var(--text); margin-bottom: 12px;
}
.gen-hero h2 em { font-style: italic; color: var(--accent); }
.gen-hero p { font-size: 1rem; color: var(--text-2); line-height: 1.6; max-width: 520px; }

/* ── Steps ── */
.steps {
  display: flex; margin-bottom: 24px;
  background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow); overflow: hidden;
}
.step {
  flex: 1; padding: 22px 20px; border-right: 1px solid var(--border);
}
.step:last-child { border-right: none; }
.step-num {
  font-family: var(--font-d); font-size: 1.8rem; font-weight: 700;
  color: var(--accent); opacity: 0.25; line-height: 1; margin-bottom: 10px;
}
.step h3 { font-size: 0.88rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.step p  { font-size: 0.78rem; color: var(--text-3); line-height: 1.5; }

/* ── Forms ── */
label { display: block; font-weight: 600; font-size: 0.83rem; margin-bottom: 6px; color: var(--text-2); }
input[type="text"], textarea, select {
  width: 100%; border: 1.5px solid var(--border); border-radius: var(--r-md);
  padding: 10px 14px; font-size: 0.92rem; font-family: var(--font-b);
  color: var(--text); transition: border-color 0.2s, box-shadow 0.2s; outline: none; background: var(--surface);
}
input[type="text"]:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px oklch(48% 0.18 250 / 0.10); }
textarea { resize: vertical; min-height: 200px; line-height: 1.6; }
.form-group { margin-bottom: 18px; }

/* ── Buttons ── */
button { font-family: var(--font-b); padding: 10px 22px; border: none; border-radius: var(--r-md); font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: all 0.15s; }
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary   { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--bg); color: var(--text-2); border: 1.5px solid var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); }
.btn-success   { background: var(--ok); color: white; }
.btn-danger    { background: var(--err-soft); color: var(--err); border: 1px solid oklch(55% 0.22 25 / 0.2); font-size: 0.8rem; padding: 6px 12px; border-radius: var(--r-sm); }
.btn-danger:hover:not(:disabled) { background: var(--err); color: white; }
.btn-sm        { padding: 6px 14px; font-size: 0.8rem; }
.btn-ghost     { background: transparent; color: var(--accent); padding: 5px 12px; font-size: 0.8rem; border: 1.5px solid var(--accent); border-radius: var(--r-sm); font-family: var(--font-b); font-weight: 600; cursor: pointer; transition: all 0.15s; }
.btn-ghost:hover { background: var(--accent-soft); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ── Status ── */
.status { margin-top: 14px; padding: 12px 16px; border-radius: var(--r-md); font-size: 0.85rem; display: none; }
.status.loading { background: oklch(95.5% 0.05 250); color: var(--accent-dim); }
.status.success { background: var(--ok-soft); color: var(--ok); }
.status.error   { background: var(--err-soft); color: var(--err); }
.spinner { display: inline-block; width: 13px; height: 13px; border: 2px solid oklch(80% 0.10 250); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; margin-right: 7px; }
@keyframes spin { to { transform: rotate(360deg); } }
.download-link {
  display: inline-block; margin-top: 8px; padding: 8px 20px;
  background: var(--ok); color: white; text-decoration: none;
  border-radius: var(--r-md); font-weight: 600; font-size: 0.85rem;
}
.download-link:hover { opacity: 0.9; }

/* ── Progress tracker ── */
.progress-step { display: flex; align-items: center; gap: 12px; padding: 9px 0; font-size: 0.88rem; color: var(--text-3); border-bottom: 1px solid var(--border); }
.progress-step:last-child { border-bottom: none; }
.progress-step.done   { color: var(--ok); }
.progress-step.active { color: var(--accent); font-weight: 600; }
.progress-step .ps-icon { width: 22px; text-align: center; flex-shrink: 0; }

/* ── ATS score ── */
.ats-score-ring { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.ats-score-ring > div { min-width: 0; }
#atsSummary { font-size: 0.82rem; color: var(--text-2); line-height: 1.55; max-height: 3.6em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.ats-circle {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-d); font-size: 1.4rem; font-weight: 700; flex-shrink: 0;
}
.ats-circle.high { background: var(--ok-soft); color: var(--ok); box-shadow: 0 0 0 3px oklch(52% 0.17 145 / 0.2); }
.ats-circle.mid  { background: oklch(97% 0.06 75); color: var(--warn); box-shadow: 0 0 0 3px oklch(65% 0.14 75 / 0.2); }
.ats-circle.low  { background: var(--err-soft); color: var(--err); box-shadow: 0 0 0 3px oklch(52% 0.22 25 / 0.2); }
.ats-keywords { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.kw-match { background: var(--ok-soft); color: var(--ok); padding: 3px 10px; border-radius: var(--r-pill); font-size: 0.78rem; font-weight: 500; }
.kw-miss  { background: var(--err-soft); color: var(--err); padding: 3px 10px; border-radius: var(--r-pill); font-size: 0.78rem; font-weight: 500; }
.ats-section-label { font-size: 0.75rem; font-weight: 700; color: var(--text-2); margin: 14px 0 6px; text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Editor ── */
.tex-editor { width: 100%; height: 380px; font-family: "SF Mono","Fira Code",monospace; font-size: 0.76rem; line-height: 1.6; background: oklch(14% 0.02 250); color: oklch(88% 0.02 250); border: none; border-radius: var(--r-md); padding: 16px; resize: vertical; }
.improve-select { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--r-md); font-size: 0.85rem; font-family: var(--font-b); background: var(--surface); color: var(--text); outline: none; }
.improve-select:focus { border-color: var(--accent); }

/* ── Upload area ── */
.upload-area {
  border: 2px dashed var(--border-strong); border-radius: var(--r-md); padding: 44px 20px;
  text-align: center; transition: border-color 0.2s, background 0.2s; cursor: pointer; position: relative;
}
.upload-area:hover, .upload-area.dragover { border-color: var(--accent); background: var(--accent-soft); }
.upload-area p { font-size: 0.85rem; color: var(--text-3); margin-top: 8px; }
.upload-area strong { color: var(--text-2); font-size: 0.92rem; }
.upload-icon { font-size: 2.4rem; display: block; margin-bottom: 10px; }

/* ── Profile section ── */
.profile-section { margin-bottom: 24px; }
.profile-section-title {
  font-family: var(--font-d); font-size: 1rem; font-weight: 600; color: var(--accent);
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px; letter-spacing: -0.02em;
}
.experience-card { border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px; margin-bottom: 12px; transition: border-color 0.15s; }
.experience-card:hover { border-color: var(--border-strong); }
.exp-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.exp-title { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.exp-meta  { font-size: 0.8rem; color: var(--text-3); margin-top: 2px; }
.exp-dates { font-size: 0.8rem; color: var(--text-3); white-space: nowrap; }

.fact-list { list-style: none; padding: 0; margin-top: 10px; }
.fact-item { display: flex; gap: 8px; align-items: flex-start; padding: 5px 6px; border-radius: var(--r-sm); font-size: 0.84rem; color: var(--text-2); transition: background 0.15s; }
.fact-item:hover { background: var(--bg); }
.fact-dot { color: var(--accent); font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.fact-text { flex: 1; }
.fact-variant { font-size: 0.7rem; color: oklch(52% 0.22 300); background: oklch(96% 0.05 300); padding: 1px 6px; border-radius: 4px; margin-left: 4px; }
.fact-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.fact-item:hover .fact-actions { opacity: 1; }
.fact-edit-btn { background: none; border: none; cursor: pointer; color: var(--accent); font-size: 0.75rem; padding: 2px 5px; }
.fact-del-btn  { background: none; border: none; cursor: pointer; color: var(--err); font-size: 0.75rem; padding: 2px 5px; }

.tag { display: inline-block; padding: 2px 8px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); font-size: 0.7rem; font-weight: 600; margin: 2px 2px 0 0; }
.tags-row { margin-top: 4px; }

/* ── Editable fields ── */
.editable-field {
  display: inline; cursor: text; border-bottom: 1px dashed transparent; transition: border-color 0.15s; padding: 1px 2px; border-radius: 3px;
}
.editable-field:hover { border-bottom-color: var(--accent); background: var(--accent-soft); }
.inline-edit-input {
  border: 1.5px solid var(--accent); border-radius: var(--r-sm); padding: 2px 8px;
  font-size: inherit; font-family: inherit; outline: none; width: auto; min-width: 120px;
}
.link-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 0.88rem; }
.link-row .link-label { font-weight: 600; color: var(--text-3); min-width: 80px; font-size: 0.82rem; }
.link-row a { color: var(--accent); text-decoration: none; word-break: break-all; }
.link-row a:hover { text-decoration: underline; }
.link-edit-btn { background: none; border: none; cursor: pointer; color: var(--text-3); font-size: 0.78rem; padding: 2px 4px; }
.link-edit-btn:hover { color: var(--accent); }

/* ── Personal info grid ── */
.personal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }
.personal-field .field-label { font-size: 0.72rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 3px; }
.personal-field .field-value { font-size: 0.92rem; color: var(--text); }

/* ── Profile list ── */
.profile-list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border: 1.5px solid var(--border); border-radius: var(--r-md); margin-bottom: 10px; transition: all 0.15s;
}
.profile-list-item:hover { border-color: var(--border-strong); }
.profile-list-item.active-profile,
.profile-list-item.selected-profile { border-color: var(--accent); background: var(--accent-soft); }
.profile-list-item .profile-meta { flex: 1; min-width: 0; }
.profile-list-item .profile-name { font-weight: 600; font-size: 0.9rem; }
.profile-list-item .profile-date { font-size: 0.78rem; color: var(--text-3); }
.profile-select { display: flex; align-items: center; cursor: pointer; }
.profile-select input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.default-badge { background: var(--text-3); color: white; font-size: 0.65rem; font-weight: 600; padding: 2px 7px; border-radius: var(--r-pill); vertical-align: middle; }
.profiles-hint { font-size: 0.82rem; color: var(--text-2); margin-bottom: 12px; line-height: 1.6; }
.active-badge { background: var(--accent); color: white; font-size: 0.72rem; font-weight: 600; padding: 3px 10px; border-radius: var(--r-pill); }

/* ── Application Q&A ── */
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .qa-grid { grid-template-columns: 1fr; } }
.btn-chip { background: var(--accent-soft); color: var(--accent); border: 1px solid transparent; font-size: 0.78rem; padding: 5px 11px; border-radius: var(--r-pill); cursor: pointer; font-family: var(--font-b); font-weight: 600; transition: all 0.15s; }
.btn-chip:hover { border-color: var(--accent); }
.qa-answer { border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 12px; }
.qa-answer .qa-q { font-weight: 600; font-size: 0.9rem; color: var(--text); margin-bottom: 8px; }
.qa-answer .qa-a { font-size: 0.9rem; color: var(--text-2); line-height: 1.7; white-space: pre-wrap; }
.qa-answer .qa-actions { margin-top: 10px; display: flex; gap: 8px; }

/* ── AI-edit change summary + source diff ── */
.change-summary-title { font-weight: 600; font-size: 0.86rem; margin-bottom: 4px; }
.change-summary { margin: 0 0 4px 0; padding-left: 18px; font-size: 0.84rem; line-height: 1.55; }
.change-summary li { margin-bottom: 2px; }
.diff-details { margin-top: 8px; }
.diff-details > summary { cursor: pointer; font-size: 0.8rem; color: var(--accent); font-weight: 600; }
.diff-block { margin-top: 8px; max-height: 280px; overflow: auto; background: var(--bg-2, #f6f6f6); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.74rem; line-height: 1.5; white-space: pre; }
.diff-block .diff-add { background: oklch(72% 0.18 145 / 0.18); color: var(--text); }
.diff-block .diff-del { background: oklch(62% 0.2 25 / 0.16); color: var(--text); }
.diff-block .diff-eq  { color: var(--text-3); }
.diff-block .diff-gap { color: var(--text-3); text-align: center; }

/* ── Cover letter ── */
.cover-letter-text {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px;
  font-size: 0.87rem; line-height: 1.75; white-space: pre-wrap; color: var(--text-2);
}
.cover-letter-options { margin-top: 16px; }
.checkbox-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 0.9rem; color: var(--text-2); }
.collapsible-field { overflow: hidden; transition: max-height 0.25s ease; max-height: 0; }
.collapsible-field.open { max-height: 90px; }

/* ── Skills ── */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.skill-group h4 { font-size: 0.72rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }

/* ── No profile ── */
.no-profile { text-align: center; padding: 60px 20px; color: var(--text-3); }
.no-profile h3 { margin-bottom: 10px; font-size: 1.2rem; font-family: var(--font-d); color: var(--text-2); font-weight: 600; letter-spacing: -0.02em; }

/* ── Save bar ── */
.save-bar {
  position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border);
  padding: 14px 28px; display: flex; align-items: center; gap: 14px;
  box-shadow: 0 -4px 20px oklch(50% 0.06 250 / 0.08); z-index: 10;
}
.save-indicator { font-size: 0.83rem; color: var(--ok); font-weight: 500; }
.unsaved-indicator { font-size: 0.83rem; color: var(--warn); }

/* ── LaTeX preview ── */
.tex-preview { background: oklch(14% 0.02 250); color: oklch(88% 0.02 250); border-radius: var(--r-md); padding: 18px; font-family: "SF Mono","Fira Code",monospace; font-size: 0.74rem; line-height: 1.6; overflow: auto; max-height: 380px; white-space: pre-wrap; }

/* ── History panel ── */
.history-card {
  background: var(--surface); border-radius: var(--r-md); padding: 22px;
  margin-bottom: 16px; box-shadow: var(--shadow); transition: box-shadow 0.2s, transform 0.2s;
}
.history-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.history-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.history-title { font-family: var(--font-d); font-size: 1.05rem; font-weight: 600; color: var(--text); letter-spacing: -0.02em; }
.history-meta { font-size: 0.78rem; color: var(--text-3); margin-top: 4px; }
.history-actions { display: flex; gap: 8px; flex-shrink: 0; }
.history-jd { font-size: 0.82rem; color: var(--text-2); line-height: 1.65; margin-top: 10px; max-height: 80px; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-jd.expanded { max-height: none; }
.history-cl { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; margin-top: 12px; font-size: 0.83rem; color: var(--text-2); line-height: 1.75; white-space: pre-wrap; max-height: 160px; overflow: hidden; }
.history-cl.expanded { max-height: none; }
.btn-expand { background: none; border: none; color: var(--accent); font-size: 0.8rem; cursor: pointer; padding: 0; margin-top: 4px; font-family: var(--font-b); }
.history-empty { text-align: center; padding: 70px 20px; color: var(--text-3); }

/* ── User panel ── */
.user-panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .user-panel-grid { grid-template-columns: 1fr; } }
.user-avatar-large {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), oklch(38% 0.18 270));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-d); font-size: 2rem; font-weight: 700; color: white;
  margin: 0 auto 16px; letter-spacing: -1px;
}
.user-stats { display: flex; gap: 36px; justify-content: center; margin: 20px 0; }
.user-stat { text-align: center; }
.user-stat-num { font-family: var(--font-d); font-size: 2.2rem; font-weight: 700; color: var(--accent); line-height: 1; }
.user-stat-label { font-size: 0.75rem; color: var(--text-3); margin-top: 5px; }

/* ── Template selector ── */
.template-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.template-card {
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--border); border-radius: var(--r-pill);
  padding: 8px 18px; cursor: pointer; transition: all 0.15s;
  font-size: 0.85rem; font-weight: 600; color: var(--text-2); background: var(--surface);
}
.template-card:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.template-card.selected { border-color: var(--accent); background: var(--accent); color: white; }
.template-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.template-preview-area { margin-top: 14px; display: flex; align-items: flex-start; gap: 14px; }
.template-preview-frame { width: 160px; min-width: 160px; height: 118px; border: 1.5px solid var(--border); border-radius: 6px; overflow: hidden; background: #fff; box-shadow: 0 2px 8px oklch(0% 0 0 / 0.08); flex-shrink: 0; }
.template-preview-info { display: flex; flex-direction: column; gap: 4px; padding-top: 2px; }
.template-preview-name { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.template-preview-desc { font-size: 0.78rem; color: var(--text-2); line-height: 1.6; }

/* ── Landing page ── */
#landing-page { display: none; }
.lp-nav {
  position: sticky; top: 0; z-index: 200;
  background: oklch(100% 0 0 / 0.92); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px; height: 64px;
}
.lp-logo { font-family: var(--font-d); font-size: 1.4rem; font-weight: 700; color: var(--accent); letter-spacing: -0.03em; }
.lp-nav-actions { display: flex; align-items: center; gap: 10px; }
.btn-lp-ghost {
  padding: 8px 18px; border: 1.5px solid var(--border-strong); border-radius: var(--r-pill);
  background: transparent; color: var(--text-2); font-family: var(--font-b); font-size: 0.88rem;
  font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.btn-lp-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-lp-primary {
  padding: 8px 20px; border: none; border-radius: var(--r-pill);
  background: var(--accent); color: white; font-family: var(--font-b); font-size: 0.88rem;
  font-weight: 600; cursor: pointer; transition: background 0.15s;
}
.btn-lp-primary:hover { background: var(--accent-hover); }

/* ── Guest header ── */
#header-guest { display: none; align-items: center; gap: 8px; }
.btn-header-ghost {
  padding: 6px 14px; border: 1.5px solid var(--border-strong); border-radius: var(--r-pill);
  background: transparent; color: var(--text-2); font-family: var(--font-b); font-size: 0.82rem;
  font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.btn-header-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-header-register {
  padding: 6px 14px; border: none; border-radius: var(--r-pill);
  background: var(--accent); color: white; font-family: var(--font-b); font-size: 0.82rem;
  font-weight: 600; cursor: pointer; transition: background 0.15s;
}
.btn-header-register:hover { background: var(--accent-hover); }

.lp-hero {
  min-height: calc(100vh - 64px);
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse 100% 70% at 50% 0%, oklch(94% 0.06 250), oklch(98.5% 0.005 250));
  padding: 80px 40px;
}
.lp-hero-inner { max-width: 680px; text-align: center; }
.lp-hero h1 {
  font-family: var(--font-d); font-size: clamp(2.8rem, 6vw, 4.4rem);
  font-weight: 700; line-height: 1.08; letter-spacing: -0.04em;
  color: var(--text); margin-bottom: 22px;
}
.lp-hero h1 em { font-style: italic; color: var(--accent); }
.lp-hero p {
  font-size: 1.1rem; color: var(--text-2); line-height: 1.65;
  max-width: 520px; margin: 0 auto 36px;
}
.btn-hero-cta {
  display: inline-block; padding: 14px 36px; background: var(--accent); color: white;
  border: none; border-radius: var(--r-pill); font-family: var(--font-b);
  font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 4px 24px oklch(48% 0.18 250 / 0.30);
}
.btn-hero-cta:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-hero-cta:active { transform: scale(0.98); }

.lp-features { padding: 80px 40px; background: var(--surface); border-top: 1px solid var(--border); }
.lp-features-inner { max-width: 960px; margin: 0 auto; }
.lp-features-title {
  font-family: var(--font-d); font-size: 1.8rem; font-weight: 700;
  text-align: center; letter-spacing: -0.03em; color: var(--text); margin-bottom: 48px;
}
.lp-feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.lp-feature-card {
  background: var(--bg); border-radius: var(--r-md); padding: 24px 20px;
  border: 1px solid var(--border); transition: box-shadow 0.2s, transform 0.2s;
}
.lp-feature-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.lp-feature-icon { font-size: 1.8rem; margin-bottom: 12px; }
.lp-feature-card h3 { font-family: var(--font-d); font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 8px; letter-spacing: -0.02em; }
.lp-feature-card p { font-size: 0.83rem; color: var(--text-2); line-height: 1.6; }

/* ── Auth overlay (modal) ── */
.auth-overlay {
  position: fixed; inset: 0;
  background: oklch(5% 0.01 250 / 0.50);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.auth-card { position: relative; }
.auth-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; font-size: 1rem; cursor: pointer;
  color: var(--text-3); width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; padding: 0;
}
.auth-close:hover { background: var(--bg); color: var(--text); }

/* ── User menu dropdown ── */
.user-menu { position: relative; }
.user-menu-trigger {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 4px 8px; border-radius: var(--r-md); transition: background 0.15s;
}
.user-menu-trigger:hover { background: var(--bg); }
.menu-caret { color: var(--text-3); font-size: 0.7rem; transition: transform 0.2s; }
.user-menu-trigger.open .menu-caret { transform: rotate(180deg); }
.user-menu-dropdown {
  display: none; position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-hover); min-width: 180px; z-index: 200; overflow: hidden;
}
.user-menu-dropdown.open { display: block; }
.menu-item {
  display: block; width: 100%; text-align: left; padding: 10px 16px;
  background: none; border: none; font-family: var(--font-b); font-size: 0.88rem;
  font-weight: 500; color: var(--text); cursor: pointer; transition: background 0.1s;
}
.menu-item:hover { background: var(--bg); }
.menu-item.danger { color: var(--err); }
.menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Gen track (3-screen slide) ── */
.gen-track-wrapper { overflow: hidden; transition: height 0.4s ease; }
.gen-track {
  display: flex; width: 300%;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  align-items: flex-start;
}
.gen-screen { width: 33.333%; flex-shrink: 0; min-width: 33.333%; }

/* ── Generate grid layouts ── */
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.setup-right-col { display: flex; flex-direction: column; gap: 20px; }
.gen-grid { display: grid; grid-template-columns: 44fr 56fr; gap: 28px; align-items: start; }
.gen-gen-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; padding: 8px 0; }
.gen-results-grid { display: grid; grid-template-columns: 38fr 62fr; gap: 24px; align-items: start; }
.results-left-col { display: flex; flex-direction: column; gap: 16px; }
.results-right-col { align-self: start; }
/* PDF.js preview: the paper fills the panel width edge-to-edge (no margins, no
   native-viewer chrome) and the panel grows to the full page height so the whole
   resume lays open with no scrollbar. */
.preview-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.preview-bar {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  color: var(--text); font-family: var(--font-d); font-size: 1.05rem; font-weight: 600;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--border);
}
.pdf-scroll { display: block; }
.pdf-scroll canvas { display: block; width: 100%; height: auto; }
.pdf-loading { color: var(--text-3); font-family: var(--font-b); font-size: 0.85rem; text-align: center; padding: 40px; }
.ai-edit-card { border-left: 3px solid var(--accent); display: flex; flex-direction: column; }
.ai-edit-card .card-title { color: var(--accent); }
.latex-toggle-btn { margin-top: 14px; width: 100%; text-align: left; font-size: 0.82rem; }
.latex-back-btn { font-size: 0.78rem; color: var(--text-3); background: none; border: none; cursor: pointer; padding: 0; margin-bottom: 8px; font-family: var(--font-b); }
.latex-back-btn:hover { color: var(--accent); }
/* AI chat */
.ai-chat-history { min-height: 160px; max-height: 420px; overflow-y: auto; padding: 4px 0 12px; margin-bottom: 14px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.ai-chat-empty { font-size: 0.82rem; color: var(--text-3); text-align: center; padding: 24px 10px; line-height: 1.65; }
.ai-chat-msg { display: flex; flex-direction: column; gap: 3px; }
.ai-chat-msg.user { align-items: flex-end; }
.ai-chat-msg.assistant { align-items: flex-start; }
.ai-chat-bubble { display: inline-block; padding: 9px 13px; border-radius: 14px; font-size: 0.83rem; line-height: 1.5; max-width: 90%; }
.ai-chat-msg.user .ai-chat-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.ai-chat-msg.assistant .ai-chat-bubble { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-bottom-left-radius: 4px; }
.ai-chat-meta { font-size: 0.72rem; color: var(--text-3); padding: 0 4px; }
.ai-chat-input-area { display: flex; flex-direction: column; gap: 8px; }
.ai-chat-row { display: flex; gap: 8px; }
.ai-chat-row input { flex: 1; }
.ai-send-btn { flex-shrink: 0; padding: 0 18px; }
.gen-intro-col { padding-top: 8px; }
.gen-hero-2 { margin-bottom: 28px; }
.gen-hero-2 h2 {
  font-family: var(--font-d); font-size: 2.2rem; font-weight: 700;
  line-height: 1.12; letter-spacing: -0.04em; color: var(--text); margin-bottom: 10px;
}
.gen-hero-2 h2 em { font-style: italic; color: var(--accent); }
.gen-hero-2 p { font-size: 0.93rem; color: var(--text-2); line-height: 1.65; }
.gen-steps-v { margin: 20px 0; }
.gen-step-v {
  display: flex; align-items: flex-start; gap: 14px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.gen-step-v:last-child { border-bottom: none; }
.gen-step-num {
  font-family: var(--font-d); font-size: 1.4rem; font-weight: 700;
  color: var(--accent); opacity: 0.3; line-height: 1; flex-shrink: 0; width: 28px;
}
.gen-step-v h4 { font-size: 0.88rem; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.gen-step-v p { font-size: 0.8rem; color: var(--text-3); line-height: 1.5; }
.gen-feature-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.gen-feature-pill {
  padding: 4px 12px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent);
  font-size: 0.75rem; font-weight: 600;
}

/* ── Tip card (screen 1) ── */
.gen-tips-card {
  background: linear-gradient(135deg, oklch(96% 0.06 250), oklch(98% 0.03 270));
  border: 1.5px solid oklch(88% 0.06 250); border-radius: var(--r-md);
  padding: 32px 28px; min-height: 200px;
  display: flex; flex-direction: column; justify-content: center;
  transition: opacity 0.3s ease;
}
.tip-icon { font-size: 2.2rem; margin-bottom: 14px; }
.tip-title { font-family: var(--font-d); font-size: 1.3rem; font-weight: 700; color: var(--text); letter-spacing: -0.02em; margin-bottom: 10px; }
.tip-body { font-size: 0.9rem; color: var(--text-2); line-height: 1.65; }
.gen-result-back { margin-top: 14px; }

/* ── Upload file items (per-file progress) ── */
#upload-files-list { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.upload-file-item {
  background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--r-md);
  padding: 12px 16px;
}
.ufi-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ufi-name { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.ufi-status { font-size: 0.78rem; color: var(--text-3); }
.ufi-bar-wrap {
  height: 5px; background: oklch(90% 0.02 250); border-radius: 99px; overflow: hidden;
}
.ufi-bar {
  height: 100%; width: 0; border-radius: 99px;
  background: var(--accent); transition: width 0.1s linear;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .gen-grid, .gen-results-grid, .gen-gen-grid, .setup-grid { grid-template-columns: 1fr; }
  .results-right-col { position: static; height: auto; }
  .lp-feature-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  header { padding: 0 16px; }
  .header-logo { font-size: 1.1rem; }
  .container { padding: 20px 12px; }
  .personal-grid { grid-template-columns: 1fr; }
  .header-tabs { display: none; }
  .lp-nav { padding: 0 20px; }
  .lp-hero { padding: 60px 20px; }
  .lp-features { padding: 60px 20px; }
  .lp-feature-grid { grid-template-columns: 1fr; }
}

/* ── Structured content editor (Edit content) ──────────────────────────────── */
#contentEditor { display: flex; flex-direction: column; gap: 18px; }
.ce-section {
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 16px 16px 18px; background: var(--surface);
}
.ce-section-title {
  font-family: var(--font-d); font-size: 0.95rem; font-weight: 600; color: var(--accent);
  margin-bottom: 12px; letter-spacing: -0.01em;
}
.ce-entry {
  border-left: 2px solid var(--border-strong); padding: 4px 0 4px 14px;
  margin-bottom: 16px;
}
.ce-entry:last-child { margin-bottom: 8px; }
.ce-entries { display: flex; flex-direction: column; }
.ce-field { margin-bottom: 10px; }
.ce-label {
  display: block; font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-3); margin-bottom: 4px;
}
.ce-input, .ce-textarea, .ce-bullet-input {
  width: 100%; border: 1.5px solid var(--border); border-radius: var(--r-sm);
  padding: 9px 12px; font-size: 0.9rem; font-family: var(--font-b); color: var(--text);
  background: var(--surface); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.ce-input:focus, .ce-textarea:focus, .ce-bullet-input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px oklch(48% 0.18 250 / 0.1);
}
.ce-textarea, .ce-bullet-input { resize: vertical; line-height: 1.5; }
.ce-bullets { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 8px; }
.ce-bullet { display: flex; gap: 8px; align-items: flex-start; }
.ce-bullet .ce-bullet-input { flex: 1; }
.ce-del-btn {
  flex: 0 0 auto; background: var(--err-soft); color: var(--err);
  border: 1px solid oklch(55% 0.22 25 / 0.2); border-radius: var(--r-sm);
  padding: 7px 11px; font-size: 0.78rem; line-height: 1; align-self: stretch;
}
.ce-del-btn:hover { background: oklch(93% 0.06 25); }
.ce-link-btn {
  background: none; border: none; color: var(--accent); font-size: 0.82rem;
  font-weight: 600; padding: 2px 0; cursor: pointer;
}
.ce-link-btn:hover { text-decoration: underline; }
.ce-add { margin-top: 6px; font-size: 0.82rem; padding: 8px 16px; }
.ce-note { font-size: 0.84rem; color: var(--text-3); line-height: 1.5; font-style: italic; }
