:root {
  --ink: #1A1A1A;
  --body: #3a3a3a;
  --muted: #6b6b6b;
  --faint: #9a948c;
  --bronze: #8B7355;
  --bronze-soft: #b39c80;
  --green: #2D6A4F;
  --paper: #faf8f5;
  --card: #ffffff;
  --rule: #e7e2da;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

/* The [hidden] attribute must ALWAYS win, even over display:flex classes —
   without this, elements like .status/.render-overlay/.draft-banner stay
   painted while JS believes they are hidden. */
[hidden] { display: none !important; }

body {
  font-family: var(--sans);
  color: var(--body);
  background:
    radial-gradient(1100px 540px at 50% -10%, #fff 0%, var(--paper) 55%, #f3efe8 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 48px 24px 56px; }

/* ---------- hero ---------- */
.hero { text-align: center; margin-bottom: 26px; }
.kicker {
  font-size: 11px; letter-spacing: .34em; text-transform: uppercase;
  color: var(--bronze); font-weight: 600; margin-bottom: 12px;
}
.hero h1 {
  font-family: var(--serif); font-weight: 600; font-size: 42px;
  line-height: 1.08; color: var(--ink); letter-spacing: .005em;
}
.hero h1 .accent { color: var(--bronze); font-style: italic; }
.lede { margin: 14px auto 0; max-width: 560px; font-size: 14.5px; line-height: 1.6; color: var(--muted); }

/* ---------- upload card ---------- */
.card {
  max-width: 720px; margin: 0 auto;
  background: var(--card); border: 1px solid var(--rule); border-radius: 18px;
  padding: 26px; box-shadow: 0 18px 50px -28px rgba(60, 45, 30, .35);
}
.draft-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap;
  background: #f4efe6; border: 1px solid #e2d8c6; border-radius: 12px;
  padding: 12px 16px; margin-bottom: 18px;
}
.draft-text { font-size: 13.5px; color: var(--body); }
.draft-kicker {
  display: block; font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--bronze); font-weight: 600; margin-bottom: 2px;
}
.draft-text b { color: var(--ink); }
.draft-when { color: var(--muted); font-size: 12.5px; }
.draft-actions { display: flex; align-items: center; gap: 8px; }

.dropzone {
  display: block; border: 1.5px dashed #d8d0c4; border-radius: 14px;
  background: #fcfbf9; padding: 40px 24px; text-align: center; cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s;
}
.dropzone:hover { border-color: var(--bronze-soft); background: #fbf9f5; }
.dropzone.drag { border-color: var(--bronze); background: #f7f2ea; transform: translateY(-1px); }
.dropzone.filled { border-style: solid; border-color: var(--bronze-soft); background: #f9f6f1; }
.drop-icon { font-size: 30px; color: var(--bronze); line-height: 1; margin-bottom: 12px; }
.drop-title { font-family: var(--serif); font-size: 21px; font-weight: 600; color: var(--ink); }
.drop-sub { margin-top: 6px; font-size: 13px; color: var(--muted); }
.drop-sub .link { color: var(--bronze); text-decoration: underline; }
.filename {
  margin-top: 14px; display: inline-block; font-size: 13px; font-weight: 600;
  color: var(--ink); background: #efe8dd; border-radius: 999px; padding: 6px 14px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-block; margin-top: 20px; width: 100%; border: none;
  background: var(--ink); color: #fff; font-family: var(--sans);
  font-size: 14.5px; font-weight: 600; letter-spacing: .02em;
  padding: 14px 20px; border-radius: 11px; cursor: pointer; text-align: center;
  text-decoration: none; transition: background .18s, transform .12s, opacity .18s;
}
.btn:hover { background: #000; transform: translateY(-1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.btn.ghost:hover { background: #f4efe8; }
.btn.small { width: auto; margin-top: 0; padding: 8px 14px; font-size: 12.5px; border-radius: 8px; }

/* ---------- status / error ---------- */
.status { display: flex; align-items: center; gap: 14px; margin-top: 22px; padding: 16px 18px; background: #f7f3ec; border-radius: 12px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid #e3d8c6; border-top-color: var(--bronze); animation: spin .8s linear infinite; flex: none; }
.spinner.small { width: 15px; height: 15px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.status-text { font-size: 14px; color: var(--body); font-weight: 500; }
.error { margin-top: 18px; padding: 14px 16px; background: #fcf0ee; border: 1px solid #f0c9c2; border-radius: 11px; color: #9a3b2e; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }

/* ---------- result / workbench ---------- */
.result {
  margin-top: 26px; background: var(--card); border: 1px solid var(--rule);
  border-radius: 18px; padding: 24px; box-shadow: 0 18px 50px -28px rgba(60, 45, 30, .35);
}
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.result-kicker { font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--green); font-weight: 600; }
.result-head h2 { font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--ink); margin-top: 4px; }
.result-meta { font-size: 13px; color: var(--muted); margin-top: 4px; }
.result-actions { display: flex; gap: 10px; }
.result-actions .btn { margin-top: 0; width: auto; }

.workbench { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }

/* editor column */
.editor-col { min-width: 0; }
.editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.editor-head span { font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--ink); }
.editor-hint { font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 14px; }
.editor-hint code { background: #f1ebe1; border-radius: 4px; padding: 1px 5px; font-size: 11.5px; color: var(--bronze); }

.ed-sec { border-top: 1px solid var(--rule); padding: 14px 0; }
.ed-sec:first-child { border-top: none; padding-top: 0; }
.ed-sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ed-sec-head h4 { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--bronze); font-weight: 600; cursor: pointer; user-select: none; -webkit-user-select: none; }
.ed-count { font-size: 10.5px; letter-spacing: 0; color: var(--muted); background: #f1ebe1; border-radius: 999px; padding: 2px 8px; margin-left: 8px; vertical-align: 1px; }
.chev { display: inline-block; margin-left: 8px; color: var(--faint); font-size: 10px; transition: transform .15s; }
.ed-sec.collapsed > *:not(.ed-sec-head) { display: none; }
.ed-sec.collapsed .ed-sec-head { margin-bottom: 0; }
.ed-sec.collapsed .chev { transform: rotate(-90deg); }

.f { display: block; margin-bottom: 9px; }
.f-label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; font-weight: 500; }
.f input, .f textarea {
  width: 100%; border: 1px solid var(--rule); border-radius: 8px; background: #fff;
  font-family: var(--sans); font-size: 13px; color: var(--ink); padding: 8px 10px; resize: vertical;
}
.f textarea { min-height: 46px; line-height: 1.45; }
.f input:focus, .f textarea:focus { outline: none; border-color: var(--bronze-soft); box-shadow: 0 0 0 3px rgba(139,115,85,.12); }

.ed-rows { display: flex; flex-direction: column; gap: 8px; }
.ed-row { display: flex; gap: 8px; align-items: flex-start; }
.ed-row .f { flex: 1; margin-bottom: 0; }
.ed-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.ed-card { border: 1px solid var(--rule); border-radius: 10px; padding: 12px; margin-bottom: 12px; background: #fcfbf9; }
.ed-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ed-card-title { font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--ink); }
.ed-sub { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 10px 0 6px; font-weight: 600; }

.mini { border: 1px solid var(--rule); background: #fff; color: var(--muted); font-family: var(--sans); font-size: 11.5px; font-weight: 600; padding: 5px 9px; border-radius: 7px; cursor: pointer; flex: none; transition: background .15s, color .15s, border-color .15s; }
.mini:hover { background: #f4efe8; color: var(--ink); }
.mini.add { color: var(--bronze); border-color: var(--bronze-soft); }
.mini.del { color: #b15a4c; }
.mini.del:hover { background: #fbeeea; border-color: #e9bcb2; }

/* preview column */
.preview-col { min-width: 0; position: sticky; top: 18px; }
.preview-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.preview-head span { font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--ink); }
.preview-pages-label { font-family: var(--sans); font-size: 12px; font-weight: 500; color: var(--muted); }
.preview-stage { position: relative; }
.preview-wrap {
  background: #ece7df; border: 1px solid var(--rule); border-radius: 12px;
  padding: 16px; max-height: 78vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
}
.preview-page { width: 100%; border-radius: 3px; box-shadow: 0 12px 34px -16px rgba(0,0,0,.45); background: #fff; }

.render-overlay {
  position: absolute; inset: 0; z-index: 5; border-radius: 12px;
  background: rgba(250, 248, 245, .86);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.render-overlay-text { text-align: center; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.render-overlay-text span { display: block; margin-top: 3px; font-size: 11.5px; font-weight: 400; color: var(--muted); }

/* ---------- dirty / freshness indicators ---------- */
.btn.dirty::after, .mb-action.dirty::after {
  content: ''; display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: #EF9F27; margin-left: 8px; vertical-align: 1px;
}
.preview-pages-label.stale { color: #BA7517; font-weight: 600; }

/* ---------- design panel (theme x layout) ---------- */
.dz-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 6px 0 12px; }
.dz-theme, .dz-layout {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--rule); background: #fff; border-radius: 999px;
  padding: 7px 12px; font: 600 12px var(--sans); color: var(--muted);
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.dz-theme:hover, .dz-layout:hover { background: #faf7f1; }
.dz-theme.active, .dz-layout.active {
  border-color: var(--ink); color: var(--ink); background: #f4efe8;
}
.dz-dots { display: inline-flex; gap: 3px; }
.dz-dot { width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); }
.dz-hint { font: 500 12px var(--sans); color: #BA7517; margin-top: -4px; }

/* ---------- photo control ---------- */
.photo-ctl { display: flex; align-items: center; gap: 10px; }
.photo-thumb {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--rule);
}

/* ---------- rated skill dots (editor) ---------- */
.sdots { display: inline-flex; gap: 5px; align-items: center; padding: 0 4px; flex: none; }
.sdot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--bronze); background: #fff;
  cursor: pointer; transition: background .12s, transform .12s;
}
.sdot:hover { transform: scale(1.15); }
.sdot.on { background: var(--bronze); }

/* ---------- "Your resumes" panel ---------- */
.my-resumes { margin-top: 22px; border-top: 1px solid var(--rule); padding-top: 16px; }
.mr-head {
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--bronze); font-weight: 600; margin-bottom: 10px;
}
.mr-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px;
  margin-bottom: 8px; background: #fcfbf9;
}
.mr-info { flex: 1; min-width: 0; }
.mr-name { font: 600 13.5px var(--sans); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mr-meta { font: 400 12px var(--sans); color: var(--muted); margin-top: 1px; }
.mr-paid { font: 600 10.5px var(--sans); color: #0F6E56; background: #E1F5EE; border-radius: 999px; padding: 3px 9px; flex: none; }

/* ---------- account area (top right) ---------- */
.account-area { position: absolute; top: 14px; right: 18px; z-index: 80; }
.acct-signin {
  border: 1px solid var(--rule); background: #fff; color: var(--ink);
  font: 600 12.5px var(--sans); padding: 8px 16px; border-radius: 999px;
  cursor: pointer; transition: background .15s;
}
.acct-signin:hover { background: #f4efe8; }
.acct-chip {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--rule); border-radius: 999px;
  padding: 7px 8px 7px 12px; font: 500 12.5px var(--sans); color: var(--ink);
}
.acct-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }
.acct-chip button {
  border: none; background: #f4efe8; color: var(--muted);
  font: 600 11.5px var(--sans); padding: 5px 10px; border-radius: 999px;
  cursor: pointer; transition: color .15s, background .15s;
}
.acct-chip button:hover { color: #9a3b2e; background: #fbeeea; }
@media (max-width: 900px) {
  /* No free corner on a phone — flow the account chip ABOVE the hero
     instead of floating it over the centered heading. */
  .account-area {
    position: static;
    display: flex; justify-content: flex-end;
    padding: 12px 14px 0;
  }
}

/* ---------- login modal ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(30, 24, 16, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  position: relative;
  background: var(--card); border-radius: 16px;
  width: 100%; max-width: 380px;
  padding: 26px 24px;
  box-shadow: 0 24px 60px -24px rgba(0,0,0,.5);
}
.modal-close { position: absolute; top: 14px; right: 14px; }
.modal-kicker { font-size: 10.5px; letter-spacing: .26em; text-transform: uppercase; color: var(--bronze); font-weight: 600; }
.modal-title { font-family: var(--serif); font-size: 24px; font-weight: 600; color: var(--ink); margin-top: 6px; }
.modal-sub { font-size: 13px; color: var(--muted); line-height: 1.55; margin: 8px 0 16px; }
.modal .f input { font-size: 16px; padding: 11px 12px; }
.modal-btn { width: 100%; margin-top: 10px; }
#recaptcha-container { margin-top: 8px; }

/* ---------- mobile bottom bar (hidden on desktop) ---------- */
.mobile-bar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: #fffdf9; border-top: 1px solid var(--rule);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  gap: 10px; align-items: center;
}
.seg { display: flex; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; flex: none; background: #fff; }
.seg-btn { border: none; background: transparent; padding: 10px 16px; font: 600 13px var(--sans); color: var(--muted); cursor: pointer; }
.seg-btn.active { background: #f4efe8; color: var(--ink); }
.mb-action { flex: 1; margin-top: 0; width: auto; padding: 12px 10px; font-size: 13.5px; border-radius: 10px; }

@media (max-width: 900px) {
  .workbench { grid-template-columns: 1fr; }
  .preview-col { position: static; }
  .preview-wrap { max-height: none; padding: 10px; }
  .hero { margin-bottom: 18px; }
  .hero h1 { font-size: 30px; }
  .lede { font-size: 13.5px; }
  .wrap { padding: 28px 14px; }
  .card, .result { padding: 16px; }

  /* iOS zooms any input under 16px on focus — keep fields at 16px */
  .f input, .f textarea { font-size: 16px; }

  /* mode switching: show ONE pane at a time, driven by data-mode */
  .result[data-mode="edit"] .preview-col { display: none; }
  .result[data-mode="preview"] .editor-col { display: none; }

  /* the bottom bar replaces in-pane action buttons */
  .result .mobile-bar { display: flex; }
  .editor-head .btn, #apply2 { display: none; }
  .result-actions #download { display: none; }
  .result { padding-bottom: 92px; }
  .result-head h2 { font-size: 21px; }
}

/* ---------- site footer (legal links) ---------- */
.site-foot {
  margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--rule);
  display: flex; gap: 18px; flex-wrap: wrap; justify-content: center;
  font-size: 12.5px; color: var(--faint);
}
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--ink); text-decoration: underline; }
@media (max-width: 900px) {
  .site-foot { margin-bottom: 90px; }
}
