/* ATS Resume Builder — interface styles. The resume sheet itself lives in resume.css. */
:root {
  --desk: #E3E7EB;
  --panel: #FFFFFF;
  --panel-2: #F5F7F9;
  --ink: #1D2731;
  --ink-2: #55616D;
  --ink-3: #85919C;
  --line: #D2D9E0;
  --line-2: #E6EAEE;
  --carbon: #2B44C1;
  --carbon-ink: #22379F;
  --carbon-soft: #E8ECFB;
  --on-carbon: #FFFFFF;
  --hi: #FFE257;
  --hi-ink: #3D3300;
  --red: #C0352A;
  --red-soft: #FBEAE8;
  --amber: #9A6200;
  --amber-soft: #FBF0D9;
  --green: #2B7449;
  --green-soft: #E3F1E8;
  --shadow-sheet: 0 1px 2px rgba(29, 39, 49, .14), 0 10px 30px rgba(29, 39, 49, .10);
  --shadow-menu: 0 2px 6px rgba(29, 39, 49, .10), 0 12px 32px rgba(29, 39, 49, .16);
  --r: 6px;
  --font: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --desk: #12171C;
    --panel: #1B2229;
    --panel-2: #222A32;
    --ink: #E6EBEF;
    --ink-2: #A9B4BE;
    --ink-3: #7A8691;
    --line: #333D47;
    --line-2: #29323B;
    --carbon: #7E93F2;
    --carbon-ink: #A3B2F7;
    --carbon-soft: #263056;
    --on-carbon: #0E1430;
    --red: #F08A80;
    --red-soft: #3A2220;
    --amber: #E8B04F;
    --amber-soft: #3A2E17;
    --green: #74C795;
    --green-soft: #1C3226;
    --shadow-sheet: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 32px rgba(0, 0, 0, .4);
    --shadow-menu: 0 2px 6px rgba(0, 0, 0, .4), 0 14px 36px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--desk);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--carbon-ink); }
[hidden] { display: none !important; }
.ic { width: 16px; height: 16px; flex: none; }
:focus-visible { outline: 2px solid var(--carbon); outline-offset: 2px; }
.muted { color: var(--ink-3); font-weight: 400; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- app frame ---------- */
.app { display: grid; grid-template-rows: auto 1fr; height: 100vh; height: 100dvh; }
.topbar {
  display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 8px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: relative; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.brand-mark { width: 24px; height: 24px; flex: none; }
.doc-title { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 0 1 340px; margin-left: 6px; padding-left: 16px; border-left: 1px solid var(--line); }
.doc-title input {
  min-width: 0; width: 100%; border: 1px solid transparent; background: transparent; border-radius: var(--r);
  padding: 5px 8px; font-weight: 600; font-size: 14px;
}
.doc-title input:hover { border-color: var(--line); }
.doc-title input:focus { border-color: var(--carbon); outline: none; background: var(--panel); }
.sync { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.sync::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.sync[data-state="synced"]::before { background: var(--green); }
.sync[data-state="syncing"]::before { background: var(--carbon); }
.sync[data-state="error"]::before, .sync[data-state="offline"]::before { background: var(--amber); }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.workspace { display: grid; grid-template-columns: minmax(400px, 540px) minmax(0, 1fr); min-height: 0; }
.editor-pane { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.preview-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); color: var(--ink);
  font-weight: 600; font-size: 13.5px; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--panel-2); border-color: var(--ink-3); }
.btn.primary { background: var(--carbon); border-color: var(--carbon); color: var(--on-carbon); }
.btn.primary:hover { background: var(--carbon-ink); border-color: var(--carbon-ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--ink); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn.ai { color: var(--carbon-ink); border-color: color-mix(in srgb, var(--carbon) 35%, var(--line)); background: var(--carbon-soft); }
.btn.ai:hover { border-color: var(--carbon); background: color-mix(in srgb, var(--carbon-soft) 70%, var(--carbon) 8%); }
.btn:disabled { opacity: .55; cursor: default; }
.btn[aria-busy="true"] .ic { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: var(--r);
  background: transparent; color: var(--ink-2);
}
.icon-btn:hover:not(:disabled) { background: var(--panel-2); color: var(--ink); }
.icon-btn.danger:hover:not(:disabled) { color: var(--red); background: var(--red-soft); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn-spacer { display: inline-block; width: 30px; }
.link { border: 0; background: none; padding: 0; color: var(--carbon-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--carbon-soft);
  color: var(--carbon-ink); font-weight: 700;
}

/* ---------- menus ---------- */
.menu-wrap { position: relative; }
.menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 280px; max-width: 340px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-menu); z-index: 40;
}
.menu-right { left: auto; right: 0; }
.menu-h { margin: 6px 10px 4px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.menu-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; }
.menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; border-radius: 5px;
  background: none; text-align: left; font-size: 13.5px;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--panel-2); outline: none; }
.menu-item.is-on { background: var(--carbon-soft); }
.menu-item.danger { color: var(--red); }
.menu-item b { font-weight: 600; }
.menu-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.menu-meta { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.menu-stack { display: flex; flex-direction: column; gap: 1px; align-items: flex-start; }
.menu-sep { height: 1px; background: var(--line-2); margin: 6px 4px; }
.menu-email { margin: 0 10px; font-weight: 600; word-break: break-all; }
.menu-note { margin: 4px 10px 6px; font-size: 12.5px; color: var(--ink-2); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); flex: none; }
.tabs button {
  position: relative; display: flex; align-items: center; gap: 7px; padding: 12px 12px 11px; border: 0; background: none;
  color: var(--ink-2); font-weight: 600; font-size: 13.5px;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs button[aria-selected="true"]::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--carbon); border-radius: 2px 2px 0 0;
}
.tab-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff;
  font-size: 11px; line-height: 18px; text-align: center; font-weight: 700;
}
.editor { flex: 1; overflow: auto; overscroll-behavior: contain; padding-bottom: 48px; }

/* ---------- editor sections ---------- */
.ed-sec { border-bottom: 1px solid var(--line-2); }
.ed-sec-h { margin: 0; }
.ed-sec-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 15px 20px; border: 0; background: none; text-align: left;
}
.ed-sec-btn:hover { background: var(--panel-2); }
.ed-sec-title { font-size: 15px; font-weight: 650; font-weight: 600; letter-spacing: -.005em; }
.ed-sec-meta { margin-left: auto; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.chev { color: var(--ink-3); transition: transform .15s; }
.is-open > .ed-sec-h .chev, .entry.is-open > .entry-head .chev { transform: rotate(180deg); }
.ed-sec.is-hidden .ed-sec-title { color: var(--ink-3); }
.tag { font-size: 11.5px; font-weight: 600; color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--line); padding: 1px 7px; border-radius: 10px; }
.ed-sec-body { padding: 2px 20px 22px; }
.ed-foot { margin: 18px 20px; color: var(--ink-3); font-size: 13px; }
.ed-pad { padding: 18px 20px 8px; }
.ed-h { margin: 22px 0 4px; font-size: 15px; font-weight: 600; }
.ed-pad > .ed-h:first-child, .check-card > .ed-h:first-child { margin-top: 0; }
.ed-p { margin: 0 0 12px; color: var(--ink-2); font-size: 13px; }

/* ---------- fields ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 12px; }
.grid .wide, .grid .check.wide { grid-column: 1 / -1; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field.wide { margin-top: 12px; }
.grid .field.wide { margin-top: 0; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: flex; align-items: baseline; gap: 6px; }
.field-label output { margin-left: auto; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.field-note { font-weight: 400; color: var(--ink-3); }
.field-hint { font-size: 12.5px; color: var(--ink-3); margin: 0; }
.field input[type="text"], .field input[type="email"], .field input[type="tel"], .field input[type="url"], .field select, .field textarea,
.sec-title, .import-text {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); padding: 7px 10px;
  font-size: 14px; line-height: 1.45; transition: border-color .12s, box-shadow .12s;
}
.field input:hover, .field select:hover, .field textarea:hover, .sec-title:hover { border-color: var(--ink-3); }
.field input:focus, .field select:focus, .field textarea:focus, .sec-title:focus, .import-text:focus {
  outline: none; border-color: var(--carbon); box-shadow: 0 0 0 3px color-mix(in srgb, var(--carbon) 22%, transparent);
}
.field input:disabled { background: var(--panel-2); color: var(--ink-3); }
.field textarea { resize: vertical; min-height: 72px; }
.field input::placeholder, .field textarea::placeholder, .import-text::placeholder { color: var(--ink-3); opacity: .8; }
input[type="range"] { accent-color: var(--carbon); width: 100%; margin: 6px 0 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--carbon); margin: 0; }
.row-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.row-tools.end { justify-content: flex-end; }
.lint { font-size: 12.5px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 5px; }
.lint-warn { color: var(--amber); }
.lint-ok { color: var(--green); display: inline-flex; align-items: center; gap: 4px; }
.lint-ok .ic { width: 14px; height: 14px; }

/* ---------- entries ---------- */
.entry { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; background: var(--panel); }
.entry.is-open { border-color: color-mix(in srgb, var(--ink-3) 60%, var(--line)); }
.entry-head { display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 4px; }
.entry-toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 8px 6px; border: 0; background: none; text-align: left; border-radius: 5px;
}
.entry-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-dates { margin-left: auto; color: var(--ink-3); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.entry-tools { display: flex; gap: 0; flex: none; }
.entry-body { padding: 6px 14px 16px; border-top: 1px solid var(--line-2); }
.entry-body .grid { margin-top: 10px; }
.add-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; padding: 10px; margin-top: 2px;
  border: 1px dashed var(--line); border-radius: 8px; background: none; color: var(--carbon-ink); font-weight: 600; font-size: 13.5px;
}
.add-btn:hover { border-color: var(--carbon); background: var(--carbon-soft); }
.skill-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.skill-row { display: grid; grid-template-columns: 140px 1fr 30px; gap: 8px; align-items: end; }
.skill-row .icon-btn { margin-bottom: 3px; }
.skill-rows + .field-hint { margin-bottom: 12px; }

/* ---------- AI output ---------- */
.ai-out { margin-top: 12px; padding: 12px 14px; border-radius: 8px; background: var(--carbon-soft); border: 1px solid color-mix(in srgb, var(--carbon) 25%, transparent); }
.ai-out-h { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-weight: 600; font-size: 13px; color: var(--carbon-ink); flex-wrap: wrap; }
.ai-out-h .muted { font-weight: 400; color: var(--ink-2); }
.ai-list { margin: 0 0 10px; padding-left: 18px; }
.ai-list li { margin: 4px 0; }
.ai-text { margin: 0 0 10px; }
.ai-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.edits, .gaps { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.edit { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.edit-from { margin: 0 0 4px; color: var(--ink-3); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--red) 60%, transparent); font-size: 13px; }
.edit-to { margin: 0 0 8px; }
.gaps li { padding-left: 14px; position: relative; }
.gaps li::before { content: ''; position: absolute; left: 0; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }

/* ---------- welcome ---------- */
.welcome { margin: 16px 20px 6px; padding: 18px 18px 16px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-2); }
.welcome-h { margin: 0 0 4px; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.welcome p { margin: 0 0 14px; color: var(--ink-2); }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- design tab ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tpl-card { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.tpl-card:hover { border-color: var(--ink-3); }
.tpl-card.is-on { border-color: var(--carbon); box-shadow: 0 0 0 1px var(--carbon); }
.tpl-card input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-card:has(input:focus-visible) { outline: 2px solid var(--carbon); outline-offset: 2px; }
.tpl-thumb { display: flex; flex-direction: column; gap: 3px; aspect-ratio: 210 / 230; padding: 9px 10px; margin-bottom: 6px; background: #fff; border: 1px solid #E1E6EA; border-radius: 3px; overflow: hidden; }
.tpl-thumb i { display: block; height: 3px; border-radius: 1px; background: #CED5DC; }
.tpl-thumb i.short { width: 60%; }
.tpl-thumb .t-name { height: 6px; width: 55%; background: #39434D; margin-bottom: 1px; }
.tpl-thumb .t-line { width: 80%; height: 2px; background: #AEB8C2; }
.tpl-thumb .t-h { height: 3px; width: 42%; background: #39434D; margin-top: 5px; }
.tpl-thumb-classic .t-name, .tpl-thumb-classic .t-line { align-self: center; }
.tpl-thumb-classic .t-h { width: 100%; background: linear-gradient(#39434D, #39434D) left top / 40% 3px no-repeat, linear-gradient(#39434D, #39434D) left bottom / 100% 1px no-repeat; height: 6px; }
.tpl-thumb-modern .t-name { height: 8px; width: 62%; }
.tpl-thumb-modern .t-h { background: #1F3A68; width: 48%; height: 4px; }
.tpl-thumb-compact { gap: 2px; }
.tpl-thumb-compact .t-name { height: 5px; width: 45%; }
.tpl-thumb-compact .t-h { margin-top: 3px; width: 100%; background: linear-gradient(#39434D, #39434D) left top / 35% 3px no-repeat, linear-gradient(#39434D, #39434D) left bottom / 100% 1px no-repeat; height: 5px; }
.tpl-name { font-weight: 600; font-size: 13.5px; }
.tpl-note { font-size: 12px; color: var(--ink-3); line-height: 1.35; }
.seg { display: inline-flex; padding: 2px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; }
.seg button, .seg-opt span {
  display: inline-flex; align-items: center; padding: 5px 12px; border: 0; border-radius: 5px; background: none;
  font-weight: 600; font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.seg button[aria-pressed="true"], .seg-opt input:checked + span { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(29, 39, 49, .15); }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt:has(input:focus-visible) span { outline: 2px solid var(--carbon); }
.seg-field { align-self: flex-start; margin-top: 2px; }
.sec-list { list-style: none; margin: 0 0 10px; padding: 0; border: 1px solid var(--line); border-radius: 8px; }
.sec-row { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 12px; }
.sec-row + .sec-row { border-top: 1px solid var(--line-2); }
.sec-row.is-off .sec-title { color: var(--ink-3); }
.sec-title { flex: 1; min-width: 0; padding: 5px 8px; }
.sec-tools { display: flex; }

/* ---------- check tab ---------- */
.check-card + .check-card { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line-2); }
.score-head { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.dial { position: relative; width: 68px; height: 68px; flex: none; }
.dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dial circle { fill: none; stroke-width: 6; }
.dial-bg { stroke: var(--line-2); }
.dial-fg { stroke-linecap: round; transition: stroke-dashoffset .4s ease; }
.dial.good .dial-fg { stroke: var(--green); }
.dial.mid .dial-fg { stroke: var(--amber); }
.dial.low .dial-fg { stroke: var(--red); }
.dial-n { position: absolute; inset: 0; display: grid; place-items: center; font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.score-title { margin: 0; font-size: 16px; font-weight: 700; }
.score-sub { margin: 2px 0 0; color: var(--ink-2); font-size: 13.5px; }
.list-h { margin: 18px 0 8px; font-size: 13px; font-weight: 700; color: var(--ink); display: flex; gap: 8px; align-items: baseline; }
.list-h .muted { font-weight: 500; font-size: 12.5px; }
.issues { list-style: none; margin: 0; padding: 0; }
.issue { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-2); }
.issues > .issue:first-child { border-top: 0; }
.issue-ic { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex: none; margin-top: 1px; }
.issue-ic .ic { width: 13px; height: 13px; stroke-width: 2.6; }
.issue.is-pass .issue-ic { background: var(--green-soft); color: var(--green); }
.issue.is-warn .issue-ic { background: var(--amber-soft); color: var(--amber); }
.issue.is-fail .issue-ic { background: var(--red-soft); color: var(--red); }
.issue-main { min-width: 0; flex: 1; }
.issue-t { margin: 0; font-weight: 600; font-size: 13.5px; }
.issue-d { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
.issue-go { font-size: 12.5px; margin-top: 4px; }
.more { margin-top: 12px; border-top: 1px solid var(--line-2); padding-top: 10px; }
.more summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); padding: 2px 0; }
.more summary:hover { color: var(--ink); }
.more .issues { margin-top: 6px; }
.match-block { margin-top: 16px; }
.match-head { padding: 14px; border-radius: 8px; background: var(--panel-2); margin-bottom: 8px; }
.match-n { margin: 0 0 8px; font-size: 14px; }
.match-n b { font-size: 22px; letter-spacing: -.02em; margin-right: 4px; font-variant-numeric: tabular-nums; }
.match-head .muted { margin: 8px 0 0; font-size: 12.5px; color: var(--ink-2); }
.meter { height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 4px; background: var(--carbon); transition: width .3s ease; }
.reqs { margin: 6px 0 4px; }
.empty { color: var(--ink-3); font-size: 13px; margin: 6px 0; }
.kws { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; padding: 0; }
.kw { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; line-height: 1.3; padding: 4px 9px; border-radius: 4px; font-weight: 500; }
.kw.is-hit {
  color: var(--hi-ink);
  background: linear-gradient(100deg, transparent 0, var(--hi) 4px, var(--hi) calc(100% - 4px), transparent 100%),
              linear-gradient(var(--hi), var(--hi)) center / 100% 70% no-repeat;
  background-blend-mode: normal;
}
.kw.is-miss { border: 1px dashed color-mix(in srgb, var(--red) 70%, transparent); background: transparent; color: var(--red); }
.kw.is-miss:hover { background: var(--red-soft); border-style: solid; }
.kw.is-miss .ic { width: 12px; height: 12px; stroke-width: 2.5; }

/* ---------- preview ---------- */
.preview-bar { display: flex; align-items: center; gap: 12px; padding: 10px 32px; flex-wrap: wrap; }
.pv-info { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pv-info.is-over { color: var(--red); font-weight: 600; }
.pv-scores { display: flex; gap: 6px; margin-left: auto; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 15px;
  border: 1px solid var(--line); background: var(--panel); font-size: 12.5px; color: var(--ink-2); font-weight: 500;
}
.chip b { color: var(--ink); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.chip.good::before { background: var(--green); }
.chip.mid::before { background: var(--amber); }
.chip.low::before { background: var(--red); }
.chip.none b { color: var(--ink-3); }
.chip:hover { border-color: var(--ink-3); }
.preview-scroll { flex: 1; overflow: auto; padding: 6px 32px 56px; min-height: 0; }
.sheet-wrap { position: relative; margin: 0 auto; }
.sheet { position: absolute; top: 0; left: 0; transform-origin: top left; background: #fff; box-shadow: var(--shadow-sheet); }
.page-break { position: absolute; left: 0; right: 0; height: 0; border-top: 1.5px dashed #8E9AA6; pointer-events: none; }
.page-break span {
  position: absolute; right: 8px; top: -11px; background: #fff; color: #6B7783; font: 600 11px/20px var(--font);
  padding: 0 7px; border: 1px solid #D2D9E0; border-radius: 10px;
}
.parsed-wrap { max-width: 780px; margin: 0 auto; }
.parsed-note { margin: 0 0 10px; font-size: 13px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.parsed-legend { display: inline-flex; align-items: center; gap: 6px; }
.parsed-legend mark, .parsed mark {
  color: inherit; padding: 0 2px; margin: 0 -2px; border-radius: 3px;
  background: linear-gradient(100deg, rgba(255, 226, 87, 0) 0, rgba(255, 226, 87, .95) 3px, rgba(255, 226, 87, .95) calc(100% - 3px), rgba(255, 226, 87, 0) 100%);
}
.parsed {
  margin: 0; padding: 30px 34px; background: #FDFDFB; color: #20262C; box-shadow: var(--shadow-sheet);
  font: 12.5px/1.65 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
  background-image: repeating-linear-gradient(#FDFDFB 0, #FDFDFB calc(1.65em - 1px), #EEF1F4 calc(1.65em - 1px), #EEF1F4 1.65em);
  background-position: 0 30px;
}

/* ---------- import dialog ---------- */
.dialog {
  width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line);
  border-radius: 12px; background: var(--panel); color: var(--ink); box-shadow: var(--shadow-menu);
}
.dialog::backdrop { background: rgba(18, 23, 28, .45); }
.dialog-inner { display: flex; flex-direction: column; gap: 12px; padding: 22px 22px 18px; }
.dialog-head { display: flex; align-items: flex-start; gap: 12px; }
.dialog-head h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.dialog-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px; }
.dialog-head .icon-btn { margin-left: auto; }
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px; border: 1.5px dashed var(--line);
  border-radius: 10px; text-align: center; color: var(--ink-2); font-size: 13.5px;
}
.drop.is-over { border-color: var(--carbon); background: var(--carbon-soft); }
.drop strong { color: var(--ink); }
.field .import-text { min-height: 180px; max-height: 40vh; resize: vertical; font-size: 13px; }
.import-status { margin: 0; font-size: 13px; color: var(--ink-2); min-height: 1.4em; }
.import-status.error { color: var(--red); }
.import-status.ok { color: var(--green); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.dialog-actions .note { margin-right: auto; font-size: 12.5px; color: var(--ink-3); }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  padding: 10px 14px; border-radius: 8px; background: #1D2731; color: #F2F5F7; font-size: 13.5px; box-shadow: var(--shadow-menu);
  animation: toast-in .18s ease-out;
}
.toast a { color: #B7C4FF; font-weight: 600; margin-left: 6px; }
.toast.is-error { background: #5A1D17; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.mobile-nav { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: minmax(360px, 460px) minmax(0, 1fr); }
  .brand span { display: none; }
  .doc-title { margin-left: 0; }
  .preview-bar, .preview-scroll { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 900px) {
  .app { grid-template-rows: auto 1fr auto; }
  .workspace { grid-template-columns: 1fr; }
  .editor-pane { border-right: 0; }
  body[data-pane="edit"] .preview-pane { display: none; }
  body[data-pane="preview"] .editor-pane { display: none; }
  .topbar { gap: 8px; padding: 8px 12px; }
  .doc-title { flex: 1 1 auto; padding-left: 10px; }
  .sync { font-size: 0; gap: 0; }
  .top-actions .btn .btn-label, .top-actions .btn.ghost span { display: none; }
  .top-actions .btn { padding: 0 10px; }
  .mobile-nav {
    display: grid; grid-template-columns: repeat(3, 1fr); background: var(--panel); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-nav button { padding: 12px 6px; border: 0; background: none; font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
  .mobile-nav button[aria-current="page"] { color: var(--carbon-ink); box-shadow: inset 0 2px 0 var(--carbon); }
  .preview-bar { padding: 10px 12px; }
  .preview-scroll { padding: 4px 12px 40px; }
  .pv-scores { margin-left: 0; }
  .toasts { bottom: calc(64px + env(safe-area-inset-bottom)); }
}
@media (max-width: 520px) {
  .grid, .pair { grid-template-columns: 1fr; }
  .tpl-grid { gap: 6px; }
  .tpl-note { display: none; }
  .skill-row { grid-template-columns: 1fr 30px; }
  .skill-row .skill-items { grid-column: 1 / 2; }
  .ed-sec-btn, .ed-pad { padding-left: 16px; padding-right: 16px; }
  .ed-sec-body { padding-left: 16px; padding-right: 16px; }
  .menu { position: fixed; left: 12px; right: 12px; top: 60px; max-width: none; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- printing: only the resume ---------- */
#print-root { display: none; }
@media print {
  html, body { height: auto; background: #fff; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  #print-root .resume { width: auto; min-height: 0; padding: 0; box-shadow: none; }
}