/* Hallmark v2.0.0 · theme: custom (by request: corporate-professional HR tool) · genre: modern-minimal · scope: app · job: review and download a converted CV · nav: none · footer: none · system fonts only (served through ngrok, no CDN) */
/* Hallmark · pre-emit critique: P3 H4 E4 S3 R4 V3 · weakest: S, a form-heavy tool has little room for a signature; the 3-step progress line (upload, extract, review) is the one distinctive element and mirrors the real flow */
/* Hallmark · waive 24b · field and button paddings of 9px and 10px keep the 44px tap height on the form · recruiters use this form on Android Chrome where small taps fail */

:root {
  --font-body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Noto Serif", serif;

  --paper: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --ink: #16202e;
  --ink-2: #404b5a;
  --muted: #566170;
  --line: #d8dde4;
  --line-strong: #aab3bf;

  --brand: #0d2b45;
  --brand-ink: #ffffff;
  --brand-soft: #c9d8e6;
  --accent: #0a6aa1;
  --accent-hover: #085585;
  --accent-soft: #e4eff7;
  --focus: #0a6aa1;

  --ok-bg: #e0f2e6;
  --ok-ink: #135027;
  --warn-bg: #fff3d1;
  --warn-line: #e3c36a;
  --warn-ink: #5b4100;
  --err-bg: #fdeceb;
  --err-line: #eba9a3;
  --err-ink: #7d1a12;
  --info-bg: #e1ecf6;
  --info-ink: #0d3a63;
  --wait-bg: #e7eaef;
  --wait-ink: #3b4655;
  --white: #ffffff;
  --accent-off: #8fb6cf;
  --canvas-shadow: rgba(13, 43, 69, .3);
  --scrim: rgba(13, 43, 69, .6);
  --page-bg: #e9ecf0;

  --radius: 8px;
  --radius-sm: 6px;
  --gap: 16px;
  --container: 920px;
  --tap: 44px;
  --shadow: 0 12px 40px rgba(13, 43, 69, .35);
}

* { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-body); font-size: 16px; line-height: 1.5; background: var(--paper); color: var(--ink); }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* masthead */
.masthead { background: var(--brand); color: var(--brand-ink); padding: 28px 16px 26px; border-bottom: 4px solid var(--accent); }
.masthead-in { max-width: var(--container); margin: 0 auto; }
.brand { margin: 0 0 2px; font-size: 15px; font-weight: 600; color: var(--brand-soft); }
.brand-logo { display: block; height: 44px; width: auto; max-width: 100%; margin-bottom: 14px; background: transparent; padding: 0; border-radius: 0; object-fit: contain; }
.masthead h1 { text-wrap: balance; margin: 0; font-family: var(--font-head); font-size: 32px; font-weight: 600; line-height: 1.15; overflow-wrap: break-word; min-width: 0; }
.masthead .sub { margin: 8px 0 0; max-width: 60ch; color: var(--brand-soft); font-size: 16px; }

main { max-width: var(--container); margin: 0 auto; padding: 20px 16px 64px; }

/* progress line */
.flow-nav { margin: 0 0 var(--gap); }
.flow { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.flow li { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 14px; }
.flow-no { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--wait-bg); color: var(--wait-ink); font-size: 13px; font-weight: 600; }
.flow li.done { color: var(--ink-2); }
.flow li.done .flow-no { background: var(--ok-bg); color: var(--ok-ink); }
.flow li[aria-current="step"] { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.flow li[aria-current="step"] .flow-no { background: var(--accent); color: var(--white); }

/* panels */
section, fieldset { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 var(--gap); min-width: 0; }
section.form-step { background: none; border: 0; padding: 0; }
legend { font-family: var(--font-head); font-size: 19px; font-weight: 600; padding: 0 6px; color: var(--ink); }
fieldset > small:first-of-type { margin-top: 0; }

/* fields */
label { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 14px 0 0; }
input, textarea, select { display: block; width: 100%; min-height: var(--tap); margin-top: 6px; padding: 9px 12px; font: inherit; font-weight: 400; color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
textarea { resize: vertical; line-height: 1.45; }
input::placeholder { color: var(--muted); opacity: 1; }
input:hover, textarea:hover, select:hover { border-color: var(--ink-2); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input:disabled, textarea:disabled, select:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 20px; }
@media (max-width: 640px) { .grid { grid-template-columns: minmax(0, 1fr); } }

/* buttons */
button, .btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; text-align: center; padding: 9px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); cursor: pointer; margin-top: 12px; transition: background-color .12s ease, border-color .12s ease, color .12s ease; }
button:hover:not(:disabled), .btn:hover { background: var(--surface-2); border-color: var(--ink-2); }
button:active:not(:disabled), .btn:active { background: var(--accent-soft); }
button:disabled { color: var(--muted); background: var(--surface-2); border-color: var(--line); cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--white); }
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
button.primary:active:not(:disabled) { background: var(--brand); border-color: var(--brand); }
button.primary:disabled { background: var(--wait-bg); border-color: var(--line); color: var(--muted); }
button.danger { color: var(--err-ink); }
button.danger:hover:not(:disabled) { background: var(--err-bg); border-color: var(--err-line); }
button.primary.big { font-size: 16px; }
button.linkish { min-height: var(--tap); border: 0; background: none; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; padding: 0 2px; margin-top: 8px; font-weight: 500; }
button.linkish:hover:not(:disabled) { background: none; color: var(--accent-hover); }
.btn.disabled, .att-add .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions button { margin-top: 12px; }
.action-bar { padding-top: 4px; }

.note, small { color: var(--muted); font-size: 14px; display: block; margin: 8px 0 0; line-height: 1.45; }

/* drop zone */
.drop { display: block; border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 40px 16px; text-align: center; cursor: pointer; font-weight: 400; color: var(--ink-2); background: var(--surface-2); margin: 0; transition: background-color .12s ease, border-color .12s ease; }
.drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.drop.over { background: var(--accent-soft); border-color: var(--accent); border-style: solid; }
.drop strong { display: block; font-family: var(--font-head); font-size: 20px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.picked { display: block; margin-top: 12px; font-weight: 600; color: var(--brand); overflow-wrap: anywhere; }

/* alerts */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); margin: 0 0 var(--gap); font-size: 15px; }
.alert.error { background: var(--err-bg); border: 1px solid var(--err-line); color: var(--err-ink); }
.alert.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.alert ul { margin: 6px 0 0 18px; padding: 0; }
.alert button { margin-top: 0; margin-left: 4px; min-height: 36px; padding: 4px 12px; }

/* loading */
.loader { height: 8px; background: var(--wait-bg); border-radius: 4px; overflow: hidden; margin: 12px 0; }
.bar { height: 100%; width: 35%; background: var(--accent); border-radius: 4px; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.loading-text { font-size: 18px; font-weight: 600; margin: 8px 0 0; }

/* repeating entries: ruled rows inside the panel, not cards in cards */
.card { border-top: 1px solid var(--line); padding: 4px 0 8px; margin-top: 16px; }
.card:first-child { margin-top: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; font-size: 15px; padding-top: 12px; }
.card-head .tools { display: flex; gap: 6px; }
.card-head .tools button, .att-item .tools button { margin: 0; min-height: 36px; padding: 4px 12px; font-size: 14px; }
fieldset > button[id^="add-"] { margin-top: 16px; border-style: dashed; color: var(--accent); }

/* photo */
.photo-row { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-top: 8px; }
#photo-img { max-width: 140px; max-height: 170px; border: 1px solid var(--line-strong); border-radius: 4px; }
.photo-none { width: 140px; height: 170px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line-strong); border-radius: 4px; color: var(--muted); font-size: 14px; background: var(--surface-2); }
.photo-actions { flex: 1 1 220px; min-width: 0; }
.photo-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-buttons button, .photo-buttons .btn { margin-top: 0; }

/* bulk */
.table-wrap { margin-top: 12px; }
.bulk-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.bulk-table th, .bulk-table td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.bulk-table th { background: var(--surface-2); font-weight: 600; color: var(--ink-2); font-size: 14px; border-top: 1px solid var(--line); }
.bulk-table tr.clickable { cursor: pointer; }
.bulk-table tr.clickable:hover { background: var(--accent-soft); }
.bulk-table td button { margin: 0 6px 6px 0; min-height: 36px; padding: 4px 12px; font-size: 14px; }
.bulk-table .fname { overflow-wrap: anywhere; }
.bulk-table small { margin-top: 4px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.badge.waiting { background: var(--wait-bg); color: var(--wait-ink); }
.badge.processing { background: var(--info-bg); color: var(--info-ink); }
.badge.ready { background: var(--ok-bg); color: var(--ok-ink); }
.badge.review { background: var(--warn-bg); color: var(--warn-ink); box-shadow: inset 0 0 0 1px var(--warn-line); }
.badge.failed { background: var(--err-bg); color: var(--err-ink); box-shadow: inset 0 0 0 1px var(--err-line); }

@media (max-width: 720px) {
  .bulk-table, .bulk-table tbody, .bulk-table tr, .bulk-table td { display: block; width: 100%; }
  .bulk-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .bulk-table tr { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 12px; margin-top: 10px; background: var(--surface); }
  .bulk-table td { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .bulk-table td:last-child { border-bottom: 0; }
  .bulk-table td::before { content: attr(data-label); color: var(--muted); font-size: 14px; font-weight: 600; }
  .bulk-table td > button { grid-column: 2; justify-self: start; }
}

/* preview modal */
.modal { position: fixed; inset: 0; z-index: 100; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 2vh 2vw; }
.modal-box { background: var(--surface); border-radius: var(--radius); width: min(1100px, 96vw); height: 94vh; height: 94dvh; display: flex; flex-direction: column; padding: 12px 16px; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 18px; }
.modal-head strong { font-family: var(--font-head); font-weight: 600; }
.modal-actions { display: flex; gap: 8px; }
.modal-actions button { margin: 0; }
.modal-body { flex: 1; min-height: 0; margin-top: 10px; position: relative; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--page-bg); }
.pv-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; text-align: center; font-weight: 600; }
.modal-note { margin-top: 8px; min-height: 1.4em; }
.spinner { width: 36px; height: 36px; border: 4px solid var(--brand-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pv-pages { position: absolute; inset: 0; overflow: auto; padding: 8px; text-align: center; -webkit-overflow-scrolling: touch; }
.pv-pages { overscroll-behavior: contain; }
.pv-pages canvas { display: block; width: 100%; max-width: 900px; height: auto; margin: 0 auto 10px; background: var(--white); box-shadow: 0 1px 4px var(--canvas-shadow); }
.modal-body .pv-pages[hidden] { display: none; }
/* browser preview (docx-preview): Word-like pages; wider pages are scaled by app.js (fitDocx) on narrow screens */
.pv-docx-outer { margin: 0 auto; }
.pv-docx { display: inline-block; transform-origin: top left; text-align: left; }
.pv-pages .docx-wrapper { background: transparent; padding: 0; padding-bottom: 0; }
.pv-pages .docx-wrapper > section.docx { box-shadow: 0 1px 4px var(--canvas-shadow); margin-bottom: 10px; }
#pv-approx { margin-top: 0; }

/* attachments */
.att-add { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.att-label-field { flex: 1 1 240px; margin: 10px 0 0; }
.att-add .btn { margin-top: 0; }
#att-msg { margin: 12px 0 0; }
.att-list { list-style: none; margin: 12px 0 0; padding: 0; }
.att-item { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding: 12px 0; }
.att-item img { width: 56px; height: 72px; object-fit: contain; background: var(--white); border: 1px solid var(--line-strong); border-radius: 3px; }
.att-item .att-no { font-weight: 600; font-size: 15px; min-width: 104px; }
.att-item .att-fields { flex: 1 1 200px; min-width: 0; }
.att-item .att-fields input { margin-top: 0; }
.att-item .tools { display: flex; gap: 6px; }
.att-item.bad input { border-color: var(--err-ink); outline: 3px solid var(--err-line); }

@media (max-width: 560px) {
  .masthead { padding: 20px 16px 18px; }
  .masthead h1 { font-size: 26px; }
  section, fieldset { padding: 16px 14px; }
  .actions > button, .action-bar > button { flex: 1 1 100%; }
  .actions.wrap > button { flex: 1 1 100%; }
  .drop { padding: 28px 12px; }
  .modal { padding: 0; }
  .modal-box { width: 100%; height: 100vh; height: 100dvh; border-radius: 0; padding: 10px 12px; }
  .modal-actions { width: 100%; }
  .modal-actions button { flex: 1; }
  .flow li { padding-right: 10px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .bar { animation: none; width: 100%; opacity: .55; }
  .spinner { animation: none; border-color: var(--accent); }
  button, .btn, .drop { transition: none; }
}

/* ---- Login, change password and admin (added with the sign-in feature; same tokens, no new colours) */
:root { --font-mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, Menlo, monospace; }

.auth-main { max-width: 460px; margin: 0 auto; padding: 24px 16px 64px; }
.auth-card, .panel-block, .secret { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 20px; }
.auth-card label:first-child { margin-top: 0; }
.auth-card .actions { margin-top: 6px; }
.auth-busy { display: inline-flex; align-items: center; gap: 10px; margin: 12px 0 0; color: var(--ink-2); font-size: 15px; }
.spinner-sm { width: 20px; height: 20px; border-width: 3px; flex: none; }
.auth-back { text-decoration: none; }

/* user bar in the masthead */
.userbar { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 16px; margin: -12px 0 14px; font-size: 14px; color: var(--brand-soft); }
.userbar:empty { display: none; }
.userbar strong { color: var(--brand-ink); font-weight: 600; overflow-wrap: anywhere; }
.userbar-link { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--brand-ink); text-underline-offset: 3px; }
.userbar-link:hover { color: var(--brand-soft); }
.userbar-link:focus-visible, .userbar-out:focus-visible { outline-color: var(--brand-ink); }
.userbar .userbar-out { margin: 0; background: transparent; color: var(--brand-ink); border-color: var(--brand-soft); }
.userbar .userbar-out:hover:not(:disabled) { background: var(--brand-ink); color: var(--brand); border-color: var(--brand-ink); }
.userbar .userbar-out:disabled { background: transparent; color: var(--brand-soft); border-color: var(--brand-soft); }

/* admin */
.panel-block { margin: 0 0 var(--gap); }
.panel-block h2, .secret h2 { margin: 0 0 4px; font-family: var(--font-head); font-size: 22px; font-weight: 600; line-height: 1.2; }
.add-form { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr) minmax(0, 1.2fr) auto; gap: 0 var(--gap); align-items: start; }
.add-form label { margin-top: 10px; }
.add-submit { align-self: end; }
.add-submit button { margin-top: 0; }
.secret { margin: 0 0 var(--gap); background: var(--ok-bg); border-color: var(--ok-ink); color: var(--ok-ink); }
.secret .note { color: var(--ok-ink); }
.secret-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0; }
.secret-row button { margin-top: 0; }
.secret-value { font-family: var(--font-mono); font-size: 18px; font-weight: 600; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 12px; overflow-wrap: anywhere; user-select: all; }
.tbl-wrap { overflow-x: auto; margin-top: 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: left; font-size: 14px; font-weight: 600; color: var(--ink-2); padding: 8px 10px; border-bottom: 2px solid var(--line-strong); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.row-actions button { margin-top: 0; min-height: 40px; padding: 6px 12px; font-size: 14px; }

@media (max-width: 860px) { .add-form { grid-template-columns: minmax(0, 1fr); } .add-submit button { width: 100%; margin-top: 12px; } }
@media (max-width: 720px) {
  .userbar { justify-content: flex-start; margin-top: -6px; }
  .tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0 0 10px; padding: 6px 10px; background: var(--surface-2); }
  .tbl td { border: 0; padding: 6px 0; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
  .tbl td::before { content: attr(data-label); flex: 0 0 8.5em; color: var(--muted); font-size: 14px; }
  .row-actions button { flex: 1 1 auto; }
}

/* ---- Show/hide password toggle (added by auth-pages.js on every password field; same tokens, no new colours) */
.pw-field { position: relative; display: block; margin-top: 6px; }
.pw-field input { margin-top: 0; padding-right: var(--tap); }
button.pw-toggle { position: absolute; top: 0; right: 0; width: var(--tap); height: 100%; min-height: var(--tap); margin: 0; padding: 0; border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted); }
button.pw-toggle:hover:not(:disabled) { background: none; color: var(--ink); }
button.pw-toggle:active:not(:disabled) { background: none; }
button.pw-toggle:focus-visible { outline-offset: -3px; }
button.pw-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
button.pw-toggle .eye-off { display: none; }
button.pw-toggle[aria-pressed="true"] .eye-on { display: none; }
button.pw-toggle[aria-pressed="true"] .eye-off { display: block; }
