/* Resume Builder: app interface. The resume itself is styled inside the preview frame (see builder.js). */
@font-face { font-family: "Geist"; src: url("/assets/fonts/geist-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/assets/fonts/geist-mono-latin.woff2") format("woff2"); font-weight: 400 500; font-display: swap; }

:root {
  --bg: #f6f5f2; --panel: #ffffff; --soft: #f1efea; --line: #e4e1da; --line-2: #d3cfc5;
  --text: #161614; --muted: #57544d; --faint: #6c6861;
  --accent: #2b5cff; --accent-text: #1d4ed8; --accent-soft: #eaf0ff; --ink: #ffffff;
  --ok: #15803d; --ok-soft: #e9f7ee; --warn: #a15c07; --warn-soft: #fdf4e3; --bad: #b42318; --bad-soft: #fdecea;
  --radius: 12px; --top-h: 64px;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "Geist Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--text); color: #fff; padding: 10px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }
svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 16px; padding: 0 20px; background: rgba(246,245,242,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; margin-right: auto; min-width: 0; }
.brand svg { width: 32px; height: 32px; stroke: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b { font-size: 15px; }
.brand-text small { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-state { margin: 0; font-size: 13px; color: var(--faint); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.save-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.save-state.saving::before { background: var(--accent); }
.save-state.off::before { background: var(--warn); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); font-weight: 500; font-size: 14px; white-space: nowrap; transition: background .15s, border-color .15s, transform .15s; }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.btn.primary:hover { background: #1f4fe6; border-color: #1f4fe6; }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.pdf-status { position: fixed; z-index: 30; top: calc(var(--top-h) + 10px); right: 20px; margin: 0; max-width: 360px; font-size: 13px; background: var(--text); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.pdf-status:empty { display: none; }

.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(40,30,20,.14); padding: 6px; display: grid; }
.menu-list button { text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.menu-list button:hover, .menu-list button:focus-visible { background: var(--soft); }
.menu-list .danger { color: var(--bad); }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: minmax(380px, 520px) 1fr; height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h)); }
.editor { overflow-y: auto; border-right: 1px solid var(--line); background: var(--bg); padding: 0 20px 80px; scrollbar-gutter: stable; }
.editor:focus { outline: none; }
.preview { display: flex; flex-direction: column; min-width: 0; background: #e9e6df; }
.mobile-switch { display: none; }

.tabs { position: sticky; top: 0; z-index: 5; display: flex; gap: 4px; padding: 14px 0 12px; background: var(--bg); }
.tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; font-weight: 500; font-size: 14px; color: var(--muted); }
.tab[aria-selected="true"] { background: var(--text); border-color: var(--text); color: #fff; }
.score-pill { font-family: var(--mono); font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--soft); color: var(--text); }
.tab[aria-selected="true"] .score-pill { background: rgba(255,255,255,.18); color: #fff; }
.notice { margin: 0 0 12px; font-size: 13px; padding: 10px 12px; border-radius: 10px; }
.notice.privacy { color: var(--muted); background: var(--soft); }
.notice.warn { color: var(--warn); background: var(--warn-soft); border: 1px solid #f3dcae; }
.panel { display: grid; gap: 12px; }
.panel[hidden] { display: none; }
#resume-form { display: grid; gap: 12px; }
.panel > *, #resume-form > *, .card-body > *, .entries > *, .entry-body > * { min-width: 0; } /* long words never widen a card */
.card-title, .entry-name { overflow-wrap: anywhere; }

/* ---------- Section cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; user-select: none; border-radius: var(--radius); }
.card > summary::-webkit-details-marker { display: none; }
.card > summary:hover { background: #fbfaf8; }
.card-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.card-title { font-weight: 600; flex: 1; min-width: 0; }
.card-title small { display: block; font-weight: 400; font-size: 12.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { transition: transform .2s; color: var(--faint); }
.card[open] > summary .chev { transform: rotate(180deg); }
.card[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.card-body { padding: 16px; display: grid; gap: 14px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 12px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label, .label { font-size: 13px; font-weight: 500; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.label-hint { font-weight: 400; color: var(--faint); }
.input, .select, textarea.input { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 9px; background: #fff; font-size: 14.5px; transition: border-color .15s, box-shadow .15s; }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(43,92,255,.18); }
.input::placeholder, textarea::placeholder { color: #75716a; opacity: 1; }
.select.small { min-height: 34px; padding: 4px 10px; font-size: 13px; width: auto; }
.help { margin: 0; font-size: 12.5px; color: var(--faint); }
.help code { font-family: var(--mono); font-size: 12px; background: var(--soft); padding: 1px 5px; border-radius: 5px; }
.count { font-family: var(--mono); font-size: 12px; color: var(--faint); font-weight: 400; }
.count.good { color: var(--ok); } .count.warn { color: var(--warn); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Repeating entries */
.entries { display: grid; gap: 12px; }
.entry { border: 1px solid var(--line); border-radius: 10px; background: #fcfbf9; }
.entry-top { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line); }
.entry-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-name.empty { color: var(--faint); font-weight: 500; }
.entry-tools { display: flex; gap: 2px; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 8px; color: var(--muted); font-size: 18px; line-height: 1; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--soft); color: var(--text); }
.icon-btn.del:hover { background: var(--bad-soft); color: var(--bad); }
.icon-btn[disabled] { opacity: .35; pointer-events: none; }
.entry-body { padding: 14px; display: grid; gap: 12px; }
.add-btn { display: inline-flex; align-items: center; gap: 8px; justify-self: start; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px dashed var(--line-2); background: transparent; font-size: 14px; font-weight: 500; color: var(--text); }
.add-btn:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.custom-head { display: flex; gap: 8px; align-items: end; }
.custom-head .field { flex: 1; }

/* Photo */
.photo-row { display: flex; align-items: center; gap: 14px; }
.photo-thumb { width: 64px; height: 64px; border-radius: 50%; background: var(--soft) center/cover no-repeat; border: 1px solid var(--line); display: grid; place-items: center; color: var(--faint); flex: none; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Design panel ---------- */
.design-block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; }
.design-block h3 { margin: 0; font-size: 14px; font-weight: 600; }
.templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.tpl { border: 1.5px solid var(--line); border-radius: 10px; background: #fff; padding: 8px; text-align: left; display: grid; gap: 8px; transition: border-color .15s, box-shadow .15s, transform .15s; }
.tpl:hover { transform: translateY(-2px); border-color: var(--line-2); }
.tpl[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(43,92,255,.2); }
.tpl-name { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.tpl-tag { font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--ok); }
.tpl-tag.two { color: var(--warn); }
.mini { aspect-ratio: 210 / 297; border-radius: 5px; border: 1px solid var(--line); background: #fff; overflow: hidden; position: relative; --c: #4338ca; }
.mini i { position: absolute; display: block; border-radius: 2px; background: #d9d6cf; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-2); padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--text); }
.color-input { width: 44px; height: 32px; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; }
.seg { display: inline-flex; background: var(--soft); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font-size: 13.5px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 500; }
.range { width: 100%; accent-color: var(--accent); }
.order { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.order li { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fcfbf9; font-size: 14px; }
.order li.off .order-name { color: var(--faint); text-decoration: line-through; }
.order-name { flex: 1; }

/* ---------- ATS score panel ---------- */
.score-card { display: flex; align-items: center; gap: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.ring { --p: 0; --c: var(--ok); width: 92px; height: 92px; border-radius: 50%; flex: none; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--soft) 0); transition: --p .6s; }
.ring span { width: 74px; height: 74px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.score-text h3 { margin: 0 0 4px; font-size: 17px; }
.score-text p { margin: 0; font-size: 13.5px; color: var(--muted); }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checks li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; }
.checks .mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.checks .pass .mark { background: var(--ok-soft); color: var(--ok); }
.checks .warn .mark { background: var(--warn-soft); color: var(--warn); }
.checks .fail .mark { background: var(--bad-soft); color: var(--bad); }
.checks b { font-weight: 600; display: block; }
.checks small { color: var(--muted); font-size: 13px; }
.checks-head { margin: 6px 0 0; font-size: 12px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }

/* ---------- Preview ---------- */
.preview-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid #dcd8cf; background: #efece6; }
.pages { font-size: 13px; color: var(--muted); margin-right: auto; }
.pages.over { color: var(--warn); font-weight: 500; }
.zoom { display: flex; align-items: center; gap: 2px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.zoom .icon-btn { width: 30px; height: 30px; border-radius: 50%; }
.zoom-value { border: 0; background: transparent; font-family: var(--mono); font-size: 12.5px; min-width: 54px; padding: 4px 6px; border-radius: 8px; }
.stage { flex: 1; overflow: auto; padding: 28px; }
.paper { margin: 0 auto; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 18px 50px rgba(40,30,20,.16); background: #fff; position: relative; transition: width .15s, height .15s; }
#resume-preview { display: block; border: 0; background: #fff; transform-origin: 0 0; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: 14px; background: var(--text); color: #fff; padding: 10px 10px 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.2); }
.toast[hidden] { display: none; }
.toast button { border: 0; background: rgba(255,255,255,.14); color: #fff; padding: 6px 12px; border-radius: 999px; font-weight: 500; }
.toast button:hover { background: rgba(255,255,255,.24); }
.toast.no-undo button { display: none; }

.fade-in { animation: fade-in .35s ease both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .btn span { display: none; }
  .btn { padding: 0 12px; }
  .btn.primary span { display: inline; }
  .save-state { display: none; }
}
@media (max-width: 900px) {
  :root { --top-h: 58px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand-text small { display: none; }
  .mobile-switch { display: flex; position: sticky; top: var(--top-h); z-index: 15; gap: 4px; padding: 8px 12px; background: var(--bg); border-bottom: 1px solid var(--line); }
  .mobile-switch button { flex: 1; min-height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 10px; font-weight: 500; }
  .mobile-switch button[aria-selected="true"] { background: var(--text); color: #fff; border-color: var(--text); }
  .app { display: block; height: auto; }
  .app[data-view="edit"] .preview { display: none; }
  .app[data-view="preview"] .editor { display: none; }
  .editor { overflow: visible; border-right: 0; padding: 0 12px 80px; }
  .tabs { top: calc(var(--top-h) + 57px); }
  .preview { min-height: calc(100dvh - var(--top-h) - 57px); }
  .stage { padding: 14px; }
}
@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .tab { font-size: 13px; padding: 0 6px; }
  .score-pill { display: none; }
  .brand-text b { font-size: 14px; }
  .btn.primary span { display: none; }
  .pdf-status { left: 12px; right: 12px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  /* Printing the page itself (instead of "Save as PDF") prints just the resume frame. */
  .topbar, .mobile-switch, .editor, .preview-bar, .toast, .pdf-status, .skip { display: none !important; }
  .app, .preview, .stage { display: block !important; height: auto !important; overflow: visible !important; padding: 0 !important; background: #fff !important; }
}
