:root {
  --cream: #F6F1E7;
  --app-bg: #F4F5F7;
  --bar: #ffffff;
  --tab-h: 64px;
  --cream-2: #EFE6D6;
  --cream-3: #FFFBF4;
  --ink: #1A1714;
  --ink-soft: #3D342C;
  --muted: #6B5D50;
  --gold: #C4A35A;
  --gold-deep: #9A7A32;
  --gold-soft: rgba(196, 163, 90, 0.28);
  --line: rgba(26, 23, 20, 0.12);
  --white: #ffffff;
  --danger: #8B2E2E;
  --ok: #2F5D3A;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Manrope", system-ui, sans-serif;
  --shadow: 0 16px 40px rgba(26, 23, 20, 0.1);
  --radius: 16px;
  --nav-h: 64px;
  --progress-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--app-bg);
  font-family: var(--sans);
  font-size: 1.02rem;
  line-height: 1.55;
  min-height: 100dvh;
}
img { max-width: 100%; display: block; }
a { color: var(--gold-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 {
  font-family: var(--sans);
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0 0 0.45rem;
}
h1 { font-size: clamp(1.85rem, 5.5vw, 2.7rem); }
h2 { font-size: clamp(1.35rem, 3.5vw, 1.85rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 0.85rem; }

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 90;
  background: #fff;
  padding: 8px 12px;
  border-radius: 8px;
}

.wrap { width: min(920px, calc(100% - 1.5rem)); margin-inline: auto; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold-deep);
  margin: 0 0 0.55rem;
}
.hint { color: var(--muted); font-size: 0.88rem; }
.lede { color: var(--ink-soft); font-size: 1.08rem; max-width: 40rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(246, 241, 231, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: inherit;
}
.brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #111;
  object-fit: cover;
}
.brand strong { display: block; font-size: 1.02rem; }
.brand span { display: block; font-size: 0.75rem; color: var(--muted); }

.site-footer {
  padding: 2rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.88rem;
  border-top: 1px solid var(--line);
  margin-top: 2rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; }

.view { display: none; padding: 0.75rem 0 5.5rem; }
.view.is-on { display: block; }

.card {
  background: var(--cream-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.2rem;
  box-shadow: var(--shadow);
}
.hero-mark { width: 96px; height: 96px; border-radius: 12px; margin-bottom: 1rem; background: #111; }

.consent {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin: 1.1rem 0 1.25rem;
  padding: 0.9rem;
  background: var(--cream-2);
  border-radius: 12px;
}
.consent input { width: 1.25rem; height: 1.25rem; margin-top: 0.2rem; flex-shrink: 0; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.65rem 1.15rem;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 650;
  text-decoration: none;
  background: transparent;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover:not(:disabled) { filter: brightness(1.05); }
.btn-ghost { border-color: var(--line); background: var(--cream-3); }
.btn-ink { background: var(--ink); color: var(--cream); }
.btn-text { border: 0; min-height: 44px; color: var(--gold-deep); }

.progress {
  position: sticky;
  top: var(--nav-h);
  z-index: 30;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0;
}
.progress ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
}
.progress button {
  white-space: nowrap;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0.45rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  min-height: 40px;
}
.progress button.is-on {
  background: var(--gold-soft);
  color: var(--ink);
}
.progress button.is-done { color: var(--ok); }

.field { margin-bottom: 1rem; }
.field label, .field .lbl {
  display: block;
  font-weight: 650;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}
.req { color: var(--gold-deep); }
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}
textarea { min-height: 120px; resize: vertical; }
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
}
.error { color: var(--danger); font-size: 0.82rem; margin-top: 0.25rem; display: none; }
.error.is-on { display: block; }

.repeat-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem;
  margin-bottom: 0.75rem;
  background: #fff;
}
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.4rem 0 0.8rem; }
.chip {
  border: 1px solid var(--line);
  background: var(--cream);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  min-height: 40px;
  cursor: pointer;
  font-size: 0.88rem;
}
.chip.is-on { background: var(--gold); border-color: var(--gold); font-weight: 650; }

/* Photo crop */
.crop-wrap { display: grid; gap: 1rem; }
@media (min-width: 720px) {
  .crop-wrap { grid-template-columns: 1fr 220px; align-items: start; }
}
.crop-stage {
  position: relative;
  width: min(100%, 360px);
  aspect-ratio: 1;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  margin-inline: auto;
}
.crop-stage.is-drag { cursor: grabbing; }
.crop-stage img {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  user-select: none;
  pointer-events: none;
  transform-origin: center center;
}
.crop-preview {
  text-align: center;
}
.crop-preview img, .id-slot {
  width: 160px;
  height: 160px;
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--line);
  margin: 0 auto 0.4rem;
}
.id-slot {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.82rem;
}
.photo-label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.polish-box {
  display: grid;
  gap: 0.75rem;
}
@media (min-width: 720px) {
  .polish-box { grid-template-columns: 1fr 1fr; }
}
.polish-col {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
}
.polish-col h3 { font-size: 0.85rem; font-family: var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* Resume A4 */
.resume-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1rem;
}
.resume-fit {
  width: 100%;
  max-width: 100%;
}
.resume-zoom-hint { display: none; margin: 0 0 0.75rem; }
.resume-sheet {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  background: #fff;
  color: #1a1714;
  padding: 14mm 14mm 16mm;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.resume-top {
  display: grid;
  grid-template-columns: 28mm 1fr;
  gap: 8mm;
  align-items: start;
  border-bottom: 2px solid #C4A35A;
  padding-bottom: 6mm;
  margin-bottom: 6mm;
}
.resume-photo {
  width: 28mm;
  height: 28mm;
  object-fit: cover;
  background: #fff;
  border: 1px solid #ddd;
}
.resume-name {
  font-family: var(--serif);
  font-size: 22pt;
  line-height: 1.15;
  margin: 0 0 2mm;
}
.resume-role {
  font-size: 11pt;
  color: #9A7A32;
  font-weight: 700;
  margin: 0 0 3mm;
}
.resume-meta {
  font-size: 9pt;
  color: #3d342c;
}
.resume h3 {
  font-family: var(--sans);
  font-size: 9.5pt;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9A7A32;
  border-bottom: 1px solid #e6dcc8;
  padding-bottom: 1.5mm;
  margin: 5mm 0 3mm;
}
.resume p, .resume li { font-size: 10pt; }
.resume ul { margin: 0 0 2mm; padding-left: 4.5mm; }
.resume-job { margin-bottom: 4mm; }
.resume-job strong { display: block; font-size: 10.5pt; }
.resume-job .when { color: #6b5d50; font-size: 9pt; }

.status {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: var(--cream-2);
  margin: 0.75rem 0;
}
.status.ok { background: #e6f0e8; color: var(--ok); }
.status.warn { background: #f3ead0; }

.radio-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.radio-row label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

.pdf-busy {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(244, 245, 247, 0.94);
  text-align: center;
  font-weight: 700;
}
html.is-pdf-capture,
html.is-pdf-capture body { overflow: hidden; }
.pdf-busy p { margin: 0; }

@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; }
  .site-header, .site-footer, .progress, .resume-tools, .no-print, .skip { display: none !important; }
  .view { display: none !important; padding: 0; }
  .view.is-on, #view-resume { display: block !important; }
  .resume-fit { overflow: visible !important; height: auto !important; }
  .resume-sheet {
    zoom: 1 !important;
    box-shadow: none;
    border: 0;
    width: auto;
    min-height: auto;
    padding: 0;
  }
}

@media (max-width: 820px) {
  .resume-zoom-hint { display: block; }
  .resume-fit {
    container-type: inline-size;
    overflow: hidden;
    touch-action: manipulation;
  }
  /* Fit the A4 page to the screen before JS measures. Pinch-zoom still works on the page. */
  .resume-sheet {
    zoom: min(1, calc((100cqw - 2px) / 210mm));
    transform-origin: top center;
  }
  #pdf-file-link:not([hidden]) { flex: 1 1 100%; }
}

.app-bar {
  position: sticky; top: 0; z-index: 40; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0.9rem; padding-top: env(safe-area-inset-top);
  background: rgba(255,255,255,0.94); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.app-bar-end { display: flex; align-items: center; gap: 0.5rem; }
.brand-title { font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.user-chip {
  max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 0.78rem; font-weight: 600; color: var(--ink-soft);
  background: #f0f1f4; border-radius: 999px; padding: 0.35rem 0.7rem;
}
.btn-sm { min-height: 40px; padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn-google {
  width: 100%; background: #fff; border: 1px solid var(--line); color: var(--ink); font-weight: 650;
}
.screen-pad { padding: 0.25rem 0 1rem; }
.auth-screen {
  width: min(420px, calc(100% - 2rem)); margin: 2rem auto 3rem; text-align: center;
}
.auth-logo { width: 72px; height: 72px; border-radius: 16px; margin: 0 auto 1rem; background: #111; }
.auth-sub, .auth-or { color: var(--muted); }
.auth-or { margin: 1rem 0 0.75rem; font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; }
.auth-form { text-align: left; }
.auth-screen h1 { font-size: 1.7rem; }
.tab-bar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid var(--line);
  grid-template-columns: 1fr 1fr 1fr;
}
.tab-bar .tab {
  border: 0; background: transparent; color: var(--muted); font-weight: 650; font-size: 0.78rem;
}
.tab-bar .tab.is-on { color: var(--gold-deep); }
@media (max-width: 820px) {
  .is-authed.has-tabs .tab-bar { display: grid; }
  .progress { display: none; }
  .site-footer { display: none; }
  h1 { font-size: 1.55rem; }
}
@media (min-width: 821px) {
  .tab-bar { display: none !important; }
  .view { padding-bottom: 2.5rem; }
}
.resume-name { font-family: var(--serif); }

.btn-google {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  background: #fff !important; color: #1f1f1f !important; border: 1px solid #dadce0 !important;
  font-weight: 650; opacity: 1 !important;
}
.btn-google .g-icon { flex: 0 0 18px; }

.selfie-live { margin: 0.8rem 0 1rem; }
.selfie-live video {
  width: 100%; max-width: 320px; aspect-ratio: 1; object-fit: cover;
  border-radius: 12px; background: #111; display: block; margin-bottom: 0.6rem;
}

.selfie-live video.is-mirror { transform: scaleX(-1); }
.crop-preview .btn { width: 100%; margin-top: 0.45rem; }
