/* CV Tailor — minimal, clean, white. System fonts, lots of whitespace, one accent. */

:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #ececf0;
  --line-strong: #d7d7de;
  --accent: #111827;     /* near-black primary */
  --accent-soft: #f4f4f5;
  --blue: #2563eb;
  --green: #16a34a;
  --amber: #b45309;
  --amber-bg: #fff7ed;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(17,24,39,.04), 0 8px 24px rgba(17,24,39,.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---- top bar ---- */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 28px;
  padding: 16px 28px;
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: -.02em; font-size: 16px; display: flex; align-items: center; gap: 9px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); display: inline-block; }
.nav .links { display: flex; gap: 6px; margin-left: 6px; }
.nav .links a {
  text-decoration: none; color: var(--muted); font-weight: 500;
  padding: 7px 12px; border-radius: 9px;
}
.nav .links a:hover { background: var(--accent-soft); color: var(--ink); }
.nav .links a.active { background: var(--accent-soft); color: var(--ink); }
.nav .spacer { flex: 1; }
.nav .user-wrap { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }

/* ---- layout ---- */
.wrap { max-width: 880px; margin: 0 auto; padding: 36px 24px 80px; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -.025em; margin: 4px 0 4px; }
.page-sub { color: var(--muted); margin: 0 0 26px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card h2 { font-size: 15px; font-weight: 600; margin: 0 0 14px; letter-spacing: -.01em; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }

/* ---- form ---- */
label { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 6px; font-weight: 500; }
input[type=text], input[type=email], textarea, select {
  width: 100%; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 10px 12px; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, textarea:focus, select:focus {
  border-color: #b6b6c0; box-shadow: 0 0 0 4px rgba(17,24,39,.06);
}
textarea { resize: vertical; min-height: 90px; }
.field { margin-bottom: 14px; }

/* ---- buttons ---- */
.btn {
  appearance: none; cursor: pointer; font: inherit; font-weight: 600;
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 10px; transition: opacity .12s, transform .04s;
}
.btn:hover { opacity: .88; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--accent-soft); opacity: 1; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--accent-soft); color: var(--ink); }
.btn.sm { padding: 7px 11px; font-size: 13px; border-radius: 8px; }
.btn.xs { padding: 4px 8px; font-size: 12.5px; border-radius: 7px; text-decoration: underline; text-underline-offset: 2px; }
.btn.danger { color: #b91c1c; }
.btn.danger:hover { background: #fef2f2; color: #b91c1c; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---- score + chips ---- */
.score {
  display: flex; align-items: center; gap: 16px;
}
.score .num {
  font-size: 40px; font-weight: 700; letter-spacing: -.03em;
  width: 92px; height: 92px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid var(--line); color: var(--ink);
}
.score .num.good { border-color: var(--green); }
.score .num.mid  { border-color: var(--amber); }
.score .num.low  { border-color: var(--line-strong); }
.score .num small { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 2px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-size: 12.5px; padding: 5px 11px; border-radius: 999px;
  background: var(--accent-soft); color: var(--ink); border: 1px solid var(--line);
}
.chip.gap { background: var(--amber-bg); color: var(--amber); border-color: #fed7aa; }

/* ---- misc ---- */
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.banner {
  border: 1px solid #fed7aa; background: var(--amber-bg); color: var(--amber);
  padding: 12px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px;
}
.banner.ok { border-color: #bbf7d0; background: #f0fdf4; color: var(--green); }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13.5px; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 4px; border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: none; }
.list-item .meta { flex: 1; min-width: 0; }
.list-item .meta .t { font-weight: 600; }
.list-item .meta .s { color: var(--muted); font-size: 13px; }

.section-block { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.section-block .sb-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.section-block.collapsed .sb-body { display: none; }
.section-block .sb-body { margin-top: 12px; }
.section-block .sb-title { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-block .sb-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.section-block .sb-snippet { color: var(--muted); font-size: 13px; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.section-block.editing { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(17,24,39,.05); }
.section-block.editing .sb-snippet { display: none; }
.field-full { margin-bottom: 12px; }

/* ---- profile: bullets editor (bullets vs paragraph) ---- */
.bullets-editor .be-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; flex: 0 0 auto; }
.seg-btn { appearance: none; cursor: pointer; font: inherit; font-size: 12.5px; padding: 5px 12px; border: none; background: #fff; color: var(--muted); }
.seg-btn + .seg-btn { border-left: 1px solid var(--line-strong); }
.seg-btn.active { background: var(--ink); color: #fff; }
.bullet-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.bullet-row { display: flex; gap: 8px; align-items: center; }
.bullet-row input { flex: 1; }
.bullet-x { appearance: none; cursor: pointer; border: 1px solid var(--line-strong); background: #fff; color: var(--muted);
  width: 36px; height: 36px; border-radius: 8px; font-size: 18px; line-height: 1; flex: 0 0 auto; }
.bullet-x:hover { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

/* ---- skills tag input (type → chip) ---- */
.tag-input { display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px; min-height: 46px; }
.tag-input:focus-within { border-color: #b6b6c0; box-shadow: 0 0 0 4px rgba(17,24,39,.06); }
.tag { display: inline-flex; align-items: center; gap: 7px; background: var(--accent-soft);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 13px; }
.tag-x { appearance: none; cursor: pointer; border: none; background: var(--line); color: var(--ink);
  width: 18px; height: 18px; border-radius: 50%; font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.tag-x:hover { background: #b91c1c; color: #fff; }
.tag-entry { border: none !important; box-shadow: none !important; flex: 1; min-width: 150px; padding: 6px 4px !important; }
.tag-more { appearance: none; cursor: pointer; border: none; background: transparent; color: var(--blue);
  font: inherit; font-size: 13px; font-weight: 600; padding: 4px 8px; }

/* ---- profile: two-pane editor + live preview ---- */
body[data-page="profile"] .wrap { max-width: 1180px; }
.profile-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.profile-preview { position: sticky; top: 86px; }
.pv-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px 26px 30px; max-height: calc(100vh - 120px); overflow: auto; }
.pv-name { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.pv-contact { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.pv-section { margin-top: 18px; }
.pv-section > h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.pv-item { margin-bottom: 12px; }
.pv-item .pv-row1 { display: flex; justify-content: space-between; gap: 10px; }
.pv-item .pv-t { font-weight: 600; font-size: 14px; }
.pv-item .pv-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.pv-item .pv-sub { color: var(--muted); font-size: 12.5px; }
.pv-item ul { margin: 6px 0 0; padding-left: 18px; }
.pv-item li { font-size: 13px; margin-bottom: 3px; }
.pv-summary { font-size: 13.5px; }
.pv-empty { color: var(--muted); font-size: 13px; font-style: italic; }
@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; }
  .profile-preview { position: static; }
}
.spinner {
  width: 16px; height: 16px; border: 2px solid #fff; border-top-color: transparent;
  border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ---- templates gallery ---- */
.tpl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.tpl-card {
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.tpl-card.selected { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.tpl-thumb { background: #f6f6f7; border-bottom: 1px solid var(--line); cursor: zoom-in; }
.tpl-thumb img { width: 100%; display: block; }
.tpl-meta { padding: 14px 16px; }
.tpl-meta .t { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.tpl-meta .d { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--muted); }
.badge.on { background: #f0fdf4; color: var(--green); border: 1px solid #bbf7d0; }
.badge.soon { background: var(--amber-bg); color: var(--amber); border: 1px solid #fed7aa; }

.tpl-modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.tpl-modal-bg { position: absolute; inset: 0; background: rgba(17,24,39,.6); }
.tpl-modal img { position: relative; max-height: 92vh; max-width: 92vw; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }

/* ---- auth (login / signup) ---- */
.auth-wrap { max-width: 400px; margin: 8vh auto 0; padding: 0 20px; }
.auth-card { padding: 30px 28px; }
.auth-card .page-title { margin-bottom: 4px; text-align: center; }
.auth-card .page-sub { margin-bottom: 22px; text-align: center; }
.auth-card .field { margin-bottom: 16px; }
.auth-card label { font-size: 13px; margin-bottom: 7px; }
.auth-wrap input[type=email], .auth-wrap input[type=password], .auth-wrap input[type=text] {
  padding: 12px 14px; font-size: 15px; border-radius: 11px;
}
.auth-card .submitBtn, .auth-card #submitBtn { margin-top: 6px; padding: 12px; font-size: 15px; border-radius: 11px; }
.auth-card a { color: var(--blue); font-weight: 600; text-decoration: none; }
.auth-card a:hover { text-decoration: underline; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 64px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; color: var(--muted);
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 6px 9px; border-radius: 7px;
}
.pw-toggle:hover { background: var(--accent-soft); color: var(--ink); }
