/* ============================================================
   Rezume — resume builder and writing checklist
   Aesthetic: clean career-tech. Ink navy + emerald, warm paper.
   ============================================================ */

:root {
  /* Brand */
  --navy: #0d1b2a;
  --navy-700: #16263a;
  --ink: #1a2230;
  --emerald: #087a55;
  --emerald-600: #066343;
  --emerald-50: #e8f6f0;
  --amber: #8f5900;
  --rose: #b42318;

  /* Neutrals */
  --paper: #ffffff;
  --bg: #f4f5f7;
  --bg-rail: #fbfbfc;
  --line: #e7e9ee;
  --line-soft: #eef0f3;
  --text: #1d2532;
  --text-2: #5a6373;
  --text-3: #667085;

  /* Accent (resume), set by JS */
  --accent: #0d1b2a;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.04);
  --shadow-md: 0 4px 16px rgba(16,24,40,.08), 0 2px 6px rgba(16,24,40,.05);
  --shadow-lg: 0 24px 60px rgba(13,27,42,.16), 0 8px 24px rgba(13,27,42,.08);

  --sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --display: 'Fraunces', Georgia, serif;
  --resume-serif: 'Source Serif 4', Georgia, serif;
  --resume-sans: 'Plus Jakarta Sans', sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }
::selection { background: rgba(14,159,110,.22); }

.skip-link {
  position: fixed; left: 12px; top: 10px; z-index: 1000;
  padding: 10px 14px; border-radius: 8px; color: #fff; background: var(--navy);
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }
.sr-only {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}
:where(button, a, input, textarea, [tabindex]):focus-visible {
  outline: 3px solid #1769aa; outline-offset: 3px;
}

/* ---------------- App shell ---------------- */
.app { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 60px;
  padding: 0 18px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 18px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--navy); }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--navy); color: #fff;
}
.brand-word { font-family: var(--display); font-weight: 600; font-size: 21px; letter-spacing: -.02em; }
.brand-word::after { content: "."; color: var(--emerald); }

.resume-title-wrap {
  display: flex; align-items: center; gap: 10px;
  padding-left: 16px; border-left: 1px solid var(--line);
  min-width: 0;
}
.resume-title-input {
  border: 1px solid transparent; background: transparent;
  font-size: 14px; font-weight: 600; color: var(--text);
  min-height: 44px; padding: 5px 9px; border-radius: var(--r-sm); width: 190px;
  transition: .15s; outline: none;
}
.resume-title-input:hover { background: var(--bg); }
.resume-title-input:focus { background: var(--paper); border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(14,159,110,.14); }
.save-state {
  font-size: 11px; color: var(--text-3); font-weight: 600;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.save-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--emerald); }
.save-state.saving::before { background: var(--amber); animation: pulse 1s infinite; }
.save-state.error { color: var(--rose); }
.save-state.error::before { background: var(--rose); }
@keyframes pulse { 50% { opacity: .3; } }

.topbar-tabs { display: flex; gap: 4px; justify-self: center; background: var(--bg); padding: 4px; border-radius: 10px; }
.tab {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  min-height: 44px; padding: 7px 16px; border-radius: 7px; transition: .15s;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--paper); color: var(--navy); box-shadow: var(--shadow-sm); }

.topbar-right { display: flex; align-items: center; gap: 10px; justify-self: end; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 44px; font-size: 13px; font-weight: 600; padding: 9px 15px; border-radius: 9px;
  transition: .15s; white-space: nowrap;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-700); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-ghost { color: var(--text-2); border: 1px solid var(--line); background: var(--paper); }
.btn-ghost:hover { color: var(--navy); border-color: var(--text-3); }
.btn-emerald { background: var(--emerald); color: #fff; }
.btn-emerald:hover { background: var(--emerald-600); }

/* ---------------- Views ---------------- */
.view { display: none; flex: 1; min-height: 0; }
.view.is-active { display: flex; }
.view-editor { overflow: hidden; }

/* ---------------- Rails ---------------- */
.rail { background: var(--bg-rail); overflow-y: auto; }
.rail-form { width: 380px; flex-shrink: 0; border-right: 1px solid var(--line); }
.rail-inspect { width: 340px; flex-shrink: 0; border-left: 1px solid var(--line); background: var(--paper); display: flex; flex-direction: column; }
.rail-inner { padding: 18px 18px 80px; }

/* scrollbars */
.rail::-webkit-scrollbar, .paper-scroll::-webkit-scrollbar, .inspect-body::-webkit-scrollbar { width: 9px; }
.rail::-webkit-scrollbar-thumb, .paper-scroll::-webkit-scrollbar-thumb, .inspect-body::-webkit-scrollbar-thumb { background: #d6d9e0; border-radius: 8px; border: 2px solid var(--bg-rail); }
.rail::-webkit-scrollbar-thumb:hover { background: #c2c7d0; }

/* ---------------- Form sections ---------------- */
.section-card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-md); margin-bottom: 12px; overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.section-card.is-open { box-shadow: var(--shadow-sm); }
.section-head {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 56px; padding: 13px 14px; cursor: pointer; user-select: none; text-align: left;
}
.section-head:hover { background: var(--bg); }
.section-head:focus-visible { outline-offset: -3px; }
.section-grip { color: var(--text-3); cursor: grab; display: flex; opacity: .55; transition: .15s; }
.section-grip:active { cursor: grabbing; }
.section-card:hover .section-grip { opacity: 1; }
.section-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--emerald-50); color: var(--emerald-600); flex-shrink: 0; }
.section-titles { flex: 1; min-width: 0; }
.section-titles h3 { font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; }
.section-titles p { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.section-chevron { color: var(--text-3); transition: transform .2s; }
.section-card.is-open .section-chevron { transform: rotate(180deg); }
.section-actions { display: flex; gap: 2px; }

.section-body { display: none; padding: 4px 14px 16px; }
.section-card.is-open .section-body { display: block; animation: slideDown .22s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-4px); } }

/* form fields */
.field { margin-bottom: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row .field { margin-bottom: 0; }
label.lbl { display: block; font-size: 11px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5px; }
.inp, .ta {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm);
  min-height: 44px; padding: 9px 11px; font-size: 13px; color: var(--text); background: var(--paper);
  transition: .15s; outline: none;
}
.inp:hover, .ta:hover { border-color: #d3d7df; }
.inp:focus, .ta:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(14,159,110,.14); }
.inp::placeholder, .ta::placeholder { color: var(--text-3); }
.ta { resize: vertical; min-height: 64px; line-height: 1.5; }

/* repeated item blocks (experience, education...) */
.item-block {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 13px; margin-bottom: 12px; background: var(--bg-rail);
  position: relative;
}
.item-block.dragging { opacity: .4; }
.item-block.drag-over { border-color: var(--emerald); box-shadow: 0 0 0 2px rgba(14,159,110,.2); }
.item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; }
.item-grip { color: var(--text-3); cursor: grab; display: flex; }
.item-grip:active { cursor: grabbing; }
.item-title-mini { flex: 1; font-size: 12px; font-weight: 700; color: var(--text-2); }
.item-del { width: 44px; min-height: 44px; color: var(--text-3); padding: 4px; border-radius: 6px; display: flex; align-items: center; justify-content: center; transition: .15s; }
.item-del:hover { color: var(--rose); background: rgba(212,72,59,.08); }
.item-move { width: 44px; min-height: 44px; border-radius: 6px; color: var(--text-2); font-weight: 700; }
.item-move:hover:not(:disabled) { color: var(--navy); background: var(--paper); }
.item-move:disabled { opacity: .35; cursor: not-allowed; }

/* bullets */
.bullets { margin-top: 8px; }
.bullet-row { display: flex; gap: 7px; align-items: flex-start; margin-bottom: 7px; }
.bullet-dot { margin-top: 13px; color: var(--accent); font-size: 9px; flex-shrink: 0; }
.bullet-input { flex: 1; }
.bullet-tools { display: flex; flex-direction: column; gap: 3px; padding-top: 3px; }
.bullet-btn { width: 44px; min-height: 44px; padding: 4px; border-radius: 6px; color: var(--text-3); display: flex; align-items: center; justify-content: center; transition: .15s; }
.bullet-btn:hover { background: var(--bg); color: var(--text); }
.bullet-btn.improve { color: var(--emerald-600); }
.bullet-btn.improve:hover { background: var(--emerald-50); }
.bullet-btn.del:hover { color: var(--rose); }

.add-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--emerald-600);
  min-height: 44px; padding: 7px 11px; border-radius: var(--r-sm); border: 1px dashed #c7e3d6;
  background: var(--emerald-50); transition: .15s; margin-top: 4px;
}
.add-btn:hover { background: #ddf1e8; border-color: var(--emerald); }
.add-btn.block { width: 100%; justify-content: center; }

/* skill chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 20px;
  padding: 5px 6px 5px 11px; font-size: 12.5px; font-weight: 500;
}
.chip button { color: var(--text-3); display: flex; align-items: center; justify-content: center; width: 44px; min-height: 44px; padding: 1px; border-radius: 50%; }
.chip button:hover { color: var(--rose); }

/* ---------------- Stage / preview ---------------- */
.stage { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.stage-toolbar {
  min-height: 52px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.6); backdrop-filter: blur(6px);
}
.zoom-wrap { display: flex; align-items: center; gap: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.icon-btn { width: 44px; height: 44px; border-radius: 6px; display: grid; place-items: center; font-size: 16px; font-weight: 600; color: var(--text-2); transition: .12s; }
.icon-btn:hover { background: var(--bg); color: var(--navy); }
.zoom-val { font-size: 12px; font-weight: 600; color: var(--text-2); min-width: 42px; text-align: center; }
.page-meta { font-size: 12px; font-weight: 600; color: var(--text-3); }

.paper-scroll { flex: 1; overflow: auto; padding: 36px; display: flex; justify-content: center; align-items: flex-start; }
.paper-zoom { transform-origin: top center; transition: transform .18s ease; }

/* A4 paper */
.paper {
  width: 794px;            /* A4 @ 96dpi */
  min-height: 1123px;
  background: var(--paper);
  box-shadow: var(--shadow-lg);
  border-radius: 3px;
  color: #1c2330;
  --rfont: var(--resume-serif);
  font-family: var(--rfont);
}

/* ---------------- Inspector ---------------- */
.inspect-tabs { display: flex; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.itab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  min-height: 48px; padding: 13px 6px; border-bottom: 2px solid transparent; transition: .15s;
}
.itab:hover { color: var(--navy); background: var(--bg-rail); }
.itab.is-active { color: var(--emerald-600); border-bottom-color: var(--emerald); }
.inspect-body { flex: 1; overflow-y: auto; padding: 18px; }
.panel { display: none; animation: fadeIn .2s ease; }
.panel.is-active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } }

.panel-h { font-size: 11px; font-weight: 800; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 10px; }

/* Writing checklist score ring */
.score-hero { text-align: center; padding: 6px 0 4px; }
.score-ring { position: relative; display: inline-block; }
.ring-track { fill: none; stroke: var(--line); stroke-width: 9; }
.ring-fill {
  fill: none; stroke: var(--emerald); stroke-width: 9; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 60px 60px;
  stroke-dasharray: 326.7; stroke-dashoffset: 326.7;
  transition: stroke-dashoffset .6s cubic-bezier(.2,.8,.2,1), stroke .4s;
}
.score-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-num span { font-family: var(--display); font-size: 38px; font-weight: 600; color: var(--navy); line-height: 1; }
.score-num i { font-size: 10px; font-weight: 800; letter-spacing: .14em; color: var(--text-3); text-transform: uppercase; font-style: normal; margin-top: 3px; }
.score-caption { font-size: 12.5px; color: var(--text-2); margin: 8px 4px 4px; line-height: 1.45; }

.checks { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.check {
  display: flex; gap: 11px; padding: 11px 12px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--paper); transition: .15s;
}
.check-ic { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; }
.check.pass .check-ic { background: var(--emerald-50); color: var(--emerald-600); }
.check.warn .check-ic { background: #fdf3e2; color: var(--amber); }
.check.fail .check-ic { background: #fcebe9; color: var(--rose); }
.check-body h4 { font-size: 12.5px; font-weight: 700; }
.check-body p { font-size: 11.5px; color: var(--text-2); margin-top: 2px; line-height: 1.4; }
.check-pts { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--text-3); white-space: nowrap; padding-top: 1px; }

/* Design panel */
.template-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tmpl-card { width: 100%; min-height: 44px; border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 8px; cursor: pointer; transition: .15s; background: var(--paper); }
.tmpl-card:hover { border-color: var(--text-3); transform: translateY(-2px); }
.tmpl-card.is-active { border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(14,159,110,.13); }
.tmpl-thumb { aspect-ratio: 0.78; border-radius: 6px; background: #fff; border: 1px solid var(--line-soft); overflow: hidden; margin-bottom: 7px; padding: 7px; }
.tmpl-name { font-size: 12px; font-weight: 700; text-align: center; color: var(--text); }
/* thumbnail mini-layouts */
.th-line { height: 3px; border-radius: 2px; background: #dde1e8; margin-bottom: 3px; }
.th-line.accent { background: var(--accent); }
.th-line.w70 { width: 70%; } .th-line.w50 { width: 50%; } .th-line.w90 { width: 90%; } .th-line.w40 { width: 40%; }
.th-bar { height: 8px; border-radius: 2px; background: var(--accent); margin-bottom: 6px; }
.th-cols { display: flex; gap: 5px; height: 100%; }
.th-side { width: 34%; background: #eef1f5; border-radius: 3px; padding: 5px 4px; }
.th-main { flex: 1; }
.th-center { text-align: center; }
.th-center .th-line { margin-left: auto; margin-right: auto; }

.swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; cursor: pointer; transition: .15s; position: relative; box-shadow: inset 0 0 0 4px rgba(255,255,255,.9), 0 1px 3px rgba(0,0,0,.12); }
.swatch:hover { transform: scale(1.12); }
.swatch.is-active::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid currentColor; }

.font-toggle { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 9px; }
.font-toggle button { flex: 1; min-height: 44px; font-size: 12.5px; font-weight: 600; color: var(--text-2); padding: 8px; border-radius: 6px; transition: .15s; }
.font-toggle button.is-active { background: var(--paper); color: var(--navy); box-shadow: var(--shadow-sm); }

/* AI panel */
.ai-intro .muted-sm, .muted-sm { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.ai-target { margin-top: 14px; }
.ai-empty { text-align: center; padding: 30px 16px; color: var(--text-3); border: 1px dashed var(--line); border-radius: var(--r-md); }
.ai-empty svg { color: #c7cdd8; margin-bottom: 10px; }
.ai-empty p { font-size: 12.5px; }
.ai-card { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.ai-orig { padding: 12px 13px; background: var(--bg-rail); border-bottom: 1px solid var(--line); }
.ai-orig .ai-lab, .ai-new .ai-lab { font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); margin-bottom: 5px; display: block; }
.ai-orig p { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.ai-new { padding: 12px 13px; }
.ai-new .ai-lab { color: var(--emerald-600); }
.ai-new p { font-size: 12.5px; color: var(--text); line-height: 1.55; font-weight: 500; }
.ai-thinking { display: flex; align-items: center; gap: 9px; padding: 16px; color: var(--text-2); font-size: 12.5px; }
.ai-spinner { width: 16px; height: 16px; border: 2px solid var(--emerald-50); border-top-color: var(--emerald); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-actions { display: flex; gap: 8px; padding: 0 13px 13px; }
.ai-actions .btn { flex: 1; justify-content: center; font-size: 12.5px; }
.ai-redo { background: var(--paper); border: 1px solid var(--line); color: var(--text-2); }
.ai-redo:hover { border-color: var(--text-3); color: var(--navy); }
.ai-note { font-size: 11px; color: var(--text-3); margin-top: 12px; text-align: center; }

/* ---------------- My Resumes ---------------- */
.view-resumes { overflow-y: auto; background: var(--bg); }
.resumes-wrap { max-width: 1080px; margin: 0 auto; padding: 44px 32px 80px; width: 100%; }
.resumes-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; }
.resumes-head h1 { font-family: var(--display); font-size: 32px; font-weight: 600; letter-spacing: -.02em; color: var(--navy); }
.muted { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.resumes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; }
.r-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; transition: .18s; cursor: pointer; }
.r-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #d8dbe2; }
.r-card.is-current { border-color: var(--emerald); box-shadow: 0 0 0 2px rgba(14,159,110,.18); }
.r-thumb { aspect-ratio: 0.77; background: var(--bg-rail); border-bottom: 1px solid var(--line); position: relative; overflow: hidden; padding: 22px 20px; }
.r-thumb-name { font-family: var(--resume-serif); font-size: 15px; font-weight: 700; color: var(--navy); }
.r-thumb-role { font-size: 9px; color: var(--text-2); margin-top: 2px; }
.r-thumb .th-bar { margin-top: 12px; height: 5px; }
.r-thumb .th-line { margin-bottom: 4px; }
.r-badge { position: absolute; top: 10px; right: 10px; font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 20px; background: var(--navy); color: #fff; }
.r-meta { padding: 14px 16px; }
.r-meta h3 { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.r-meta .r-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; display: flex; align-items: center; gap: 7px; }
.r-score-pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.r-actions { display: flex; gap: 4px; padding: 0 12px 12px; }
.r-act { flex: 1; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 8px; border-radius: 8px; color: var(--text-2); transition: .15s; }
.r-act:hover { background: var(--bg); color: var(--navy); }
.r-act.del:hover { color: var(--rose); background: rgba(212,72,59,.08); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 11px;
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: .25s; z-index: 100;
  display: flex; align-items: center; gap: 9px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .t-ic { color: var(--emerald); display: flex; }

/* ---------------- Overflow menu ---------------- */
.menu-wrap { position: relative; }
.menu-btn { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--text-2); }
.menu-btn:hover { color: var(--navy); border-color: var(--text-3); }
.menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); padding: 6px; min-width: 210px;
}
.menu[hidden] { display: none; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  font-size: 13px; font-weight: 600; color: var(--text); text-decoration: none;
  min-height: 44px; padding: 9px 11px; border-radius: 8px; transition: .12s;
}

.date-field { min-width: 0; border: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .btn-primary:hover, .tmpl-card:hover, .r-card:hover, .swatch:hover { transform: none; }
}
.menu-item:hover { background: var(--bg); color: var(--navy); }
.menu-item svg { color: var(--text-3); }
.menu-item:hover svg { color: var(--emerald-600); }

.tmpl-feat { position: absolute; top: 4px; left: 4px; z-index: 1; font-size: 8.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; background: var(--navy); color: #fff; padding: 2px 6px; border-radius: 20px; }
.tmpl-card { position: relative; }

/* ---------------- Home / Dashboard ---------------- */
.view-home { overflow-y: auto; background: var(--bg); }
.home-wrap { width: 100%; }
.home-inner { max-width: 1100px; margin: 0 auto; padding: 40px 32px 80px; }
.home-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 30px; flex-wrap: wrap; }
.home-eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--emerald-600); margin-bottom: 8px; }
.home-hero h1 { font-family: var(--display); font-size: 34px; font-weight: 600; letter-spacing: -.02em; color: var(--navy); line-height: 1.05; }
.home-lede { color: var(--text-2); font-size: 14.5px; margin-top: 8px; max-width: 460px; line-height: 1.5; }
.home-hero-actions { display: flex; gap: 10px; flex-shrink: 0; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.home-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.stat-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 18px 16px; box-shadow: var(--shadow-sm); }
.stat-ic { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--emerald-50); color: var(--emerald-600); margin-bottom: 12px; }
.stat-num { font-family: var(--display); font-size: 30px; font-weight: 600; color: var(--navy); line-height: 1; }
.stat-label { font-size: 13px; font-weight: 700; color: var(--text); margin-top: 7px; }
.stat-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.home-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.home-panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.home-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.home-panel-head h2 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; color: var(--navy); }
.home-link { min-height: 44px; padding: 8px; font-size: 12.5px; font-weight: 700; color: var(--emerald-600); }
.home-link:hover { color: var(--emerald); }

.home-rlist { display: flex; flex-direction: column; gap: 8px; }
.home-rrow { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 13px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-rail); transition: .14s; }
.home-rrow:hover { border-color: var(--text-3); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.home-rrow.cur { border-color: var(--emerald); box-shadow: 0 0 0 2px rgba(14,159,110,.14); }
.home-rdot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.home-rinfo { flex: 1; min-width: 0; }
.home-rtitle { display: block; font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-rmeta { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.home-rpill { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }

.home-empty { text-align: center; padding: 36px 20px; color: var(--text-3); }
.home-empty svg { color: #c7cdd8; margin-bottom: 12px; }
.home-empty p { font-size: 13px; margin-bottom: 16px; color: var(--text-2); }

.home-continue { width: 100%; min-height: 44px; text-align: left; border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; margin-bottom: 16px; cursor: pointer; transition: .14s; background: var(--bg-rail); }
.home-continue:hover { border-color: var(--emerald); }
.home-continue-top { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.home-continue-title { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-progress { height: 7px; border-radius: 20px; background: var(--line-soft); overflow: hidden; }
.home-progress i { display: block; height: 100%; border-radius: 20px; transition: width .5s; }
.home-tiplist { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.home-tiplist li { display: flex; flex-direction: column; gap: 3px; padding-left: 18px; position: relative; }
.home-tiplist li::before { content: ""; position: absolute; left: 0; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--emerald); }
.home-tiplist strong { font-size: 13px; font-weight: 700; color: var(--text); }
.home-tiplist span { font-size: 12px; color: var(--text-2); line-height: 1.45; }

/* ---------------- Onboarding overlay ---------------- */
body.onb-open { overflow: hidden; }
.onb {
  position: fixed; inset: 0; z-index: 200;
  background: radial-gradient(120% 120% at 50% 0%, rgba(13,27,42,.62), rgba(13,27,42,.78));
  backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 24px;
  animation: onbFade .25s ease;
}
.onb[hidden] { display: none; }
@keyframes onbFade { from { opacity: 0; } }
.onb-card {
  position: relative; width: 100%; max-width: 540px;
  background: var(--paper); border-radius: 22px; box-shadow: var(--shadow-lg);
  padding: 38px 38px 34px; animation: onbPop .3s cubic-bezier(.2,.9,.3,1);
}
@keyframes onbPop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.onb-skip { position: absolute; top: 12px; right: 14px; min-height: 44px; padding: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.onb-skip:hover { color: var(--text); }
.onb-dots { display: flex; gap: 7px; margin-bottom: 26px; }
.onb-dot { width: 26px; height: 5px; border-radius: 20px; background: var(--line); transition: .2s; }
.onb-dot.on { background: var(--emerald); }
.onb-dot.cur { background: var(--navy); }

.onb-welcome { text-align: center; }
.onb-mark { display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 16px; background: var(--navy); color: #fff; margin-bottom: 20px; }
.onb-welcome h1 { font-family: var(--display); font-size: 30px; font-weight: 600; color: var(--navy); letter-spacing: -.02em; }
.onb-welcome p { font-size: 14.5px; color: var(--text-2); line-height: 1.55; margin: 12px auto 22px; max-width: 400px; }
.onb-bullets { list-style: none; display: inline-flex; flex-direction: column; gap: 10px; text-align: left; margin-bottom: 26px; }
.onb-bullets li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; color: var(--text); }
.onb-bullets span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--emerald-50); color: var(--emerald-600); font-size: 11px; font-weight: 800; }
.onb-cta { font-size: 14px; padding: 12px 26px; }

.onb-step h2 { font-family: var(--display); font-size: 25px; font-weight: 600; color: var(--navy); letter-spacing: -.02em; }
.onb-sub { font-size: 13.5px; color: var(--text-2); margin: 7px 0 22px; line-height: 1.5; }
.onb-input { width: 100%; border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 15px; font-size: 16px; color: var(--text); background: var(--paper); outline: none; transition: .15s; }
.onb-input:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(14,159,110,.14); }

.onb-grid { display: grid; gap: 9px; }
.onb-grid-roles { grid-template-columns: 1fr 1fr; }
.onb-choice { text-align: left; font-size: 13.5px; font-weight: 600; color: var(--text); border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 14px; background: var(--paper); transition: .13s; }
.onb-choice:hover { border-color: var(--text-3); }
.onb-choice.on { border-color: var(--emerald); background: var(--emerald-50); color: var(--emerald-600); box-shadow: 0 0 0 2px rgba(14,159,110,.14); }

.onb-list { display: flex; flex-direction: column; gap: 8px; }
.onb-row { display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 15px; background: var(--paper); transition: .13s; }
.onb-row:hover { border-color: var(--text-3); }
.onb-row.on { border-color: var(--emerald); background: var(--emerald-50); }
.onb-row-main { font-size: 14px; font-weight: 700; color: var(--text); }
.onb-row-sub { font-size: 12px; color: var(--text-3); margin-left: auto; }
.onb-row.on .onb-row-sub { margin-right: 8px; }
.onb-row-check { display: none; color: var(--emerald-600); font-weight: 900; }
.onb-row.on .onb-row-check { display: inline; }

.onb-grid-tmpl { grid-template-columns: 1fr 1fr; }
.onb-tmpl { border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 9px; background: var(--paper); transition: .13s; }
.onb-tmpl:hover { border-color: var(--text-3); }
.onb-tmpl.on { border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(14,159,110,.13); }
.onb-tmpl-thumb { display: block; aspect-ratio: 1.5; background: #fff; border: 1px solid var(--line-soft); border-radius: 6px; padding: 9px; margin-bottom: 8px; --accent: var(--navy); }
.onb-tmpl-name { font-size: 12.5px; font-weight: 700; color: var(--text); display: block; text-align: center; }
.onb-tmpl-name em { font-style: normal; font-size: 9px; color: var(--emerald-600); font-weight: 800; }
.ot-l { display: block; height: 3px; border-radius: 2px; background: #dde1e8; margin-bottom: 4px; }
.ot-l.accent { background: var(--accent); }
.ot-l.w70 { width: 70%; } .ot-l.w90 { width: 90%; } .ot-l.w50 { width: 50%; } .ot-l.w40 { width: 40%; }
.ot-l.h5 { height: 5px; } .ot-l.h4 { height: 4px; } .ot-l.h2 { height: 2px; }
.ot-l.ctr { margin-left: auto; margin-right: auto; }
.ot-cols { display: flex; gap: 5px; height: 100%; }
.ot-side { width: 34%; background: #eef1f5; border-radius: 3px; }
.ot-main { flex: 1; }

.onb-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 26px; }
.onb-back { min-height: 44px; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 9px 8px; }
.onb-back:hover { color: var(--navy); }
.onb-nav .btn { padding: 11px 22px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1180px) {
  .rail-inspect { width: 300px; }
  .rail-form { width: 330px; }
}
@media (max-width: 980px) {
  body { overflow: auto; }
  .topbar { grid-template-columns: auto 1fr auto; gap: 10px; }
  .topbar-tabs { padding: 3px; }
  .topbar-tabs .tab { padding: 6px 11px; font-size: 12px; }
  .resume-title-wrap { display: none; }
  .view-editor { flex-direction: column; height: auto; overflow: visible; }
  .rail-form, .rail-inspect { width: 100%; max-height: none; border: none; border-bottom: 1px solid var(--line); }
  .stage { min-height: 70vh; }
  .rail-inspect { order: 3; }
  .stage { order: 2; }
  .rail-form { order: 1; }
}
@media (max-width: 900px) {
  .home-stats { grid-template-columns: 1fr 1fr; }
  .home-cols { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar { grid-template-columns: auto 1fr; row-gap: 8px; height: auto; padding: 8px 12px; }
  .topbar-tabs { grid-column: 1 / -1; justify-self: stretch; }
  .topbar-tabs .tab { flex: 1; }
  .field-row { grid-template-columns: 1fr; }
  .resumes-grid { grid-template-columns: 1fr; }
  .home-inner { padding: 24px 16px 64px; }
  .home-hero h1 { font-size: 27px; }
  .home-stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .home-hero-actions { width: 100%; }
  .home-hero-actions .btn { flex: 1; justify-content: center; }
  .onb-card { padding: 28px 22px 26px; }
  .onb-grid-roles { grid-template-columns: 1fr; }
}
