/* Tailored Resume — professional light-first design: white cards on a cool
 * gray page, soft layered shadows, segmented controls, ultramarine primary.
 * Mono small-cap labels and trace cards follow the reference mock. Dark theme
 * keeps the same bones; the resume paper stays white in both. */

:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --panel-2: #f1f3f8;
  --line: #e7eaf1;
  --line-strong: #d3d8e3;
  --text: #131722;
  --muted: #667085;
  --accent: #3646e4;
  --accent-hover: #2e3dc9;
  --accent-soft: #eef0fd;
  --accent-ink: #ffffff;
  --danger: #b4472f;
  --warn: #a8552e;
  --ok: #1e7a4d;
  --chip: #4353e8;
  --desk: #eceef4;
  --radius: 12px;
  --sh-1: 0 1px 2px rgba(16, 24, 40, 0.05);
  --sh-2: 0 2px 4px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.06);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e1116;
  --panel: #151a22;
  --panel-2: #1c222d;
  --line: #262d39;
  --line-strong: #3a4251;
  --text: #e7eaf1;
  --muted: #8f96a6;
  --accent: #6f7dff;
  --accent-hover: #7f8bff;
  --accent-soft: #232946;
  --accent-ink: #ffffff;
  --danger: #e07a6a;
  --warn: #d98d5f;
  --ok: #6fbf8f;
  --chip: #8b96ff;
  --desk: #0a0d12;
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --sh-2: 0 2px 4px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
a { color: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* the mock's small-caps mono section labels */
.klabel {
  display: block;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

/* --- Header ------------------------------------------------------------- */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  max-width: 1104px;
  margin: 0 auto;
  width: 100%;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand .mark { width: 32px; height: 32px; color: var(--accent); flex-shrink: 0; }
.brand h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.tagline { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); }
.session { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.credits { font-size: 12.5px; color: var(--muted); }
.topup { font-size: 12.5px; color: var(--accent); text-decoration: none; font-weight: 600; }
.topup:hover { text-decoration: underline; }
/* Back to the platform — this app is a demo of it, so say so and link home. */
.home-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px 5px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.home-link strong { font-weight: 700; color: var(--text); }
.home-link svg { width: 13px; height: 13px; flex-shrink: 0; }
.home-link:hover { background: var(--panel-2); color: var(--text); border-color: var(--line-strong); }

button {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.06s;
}
button svg { width: 15px; height: 15px; flex-shrink: 0; }
button:disabled { opacity: 0.55; cursor: default; }
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible, .tab:focus-visible, .dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: var(--sh-1), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover:not(:disabled) { background: var(--panel-2); color: var(--text); }
.dl-actions button.ghost { border-color: var(--line-strong); background: var(--panel); color: var(--text); box-shadow: var(--sh-1); }
.dl-actions button.ghost:hover:not(:disabled) { background: var(--panel-2); }
.theme-toggle { padding: 7px 10px; }
.theme-toggle::after { content: "\263E"; }
:root[data-theme="dark"] .theme-toggle::after { content: "\2600"; }

/* --- Form --------------------------------------------------------------- */

main {
  width: 100%;
  max-width: 1104px;
  margin: 0 auto;
  padding: 30px 28px 64px;
  flex: 1;
}
form { display: flex; flex-direction: column; gap: 22px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.label-row .klabel { margin-bottom: 9px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 10px 6px;
  box-shadow: var(--sh-1);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent), var(--sh-1);
}
.doc-field.dropping .card {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }

textarea, input[type="text"], input[type="url"], select {
  width: 100%;
  font: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 9px 12px;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.card textarea { border: 0; background: transparent; padding: 8px 7px; min-height: 132px; box-shadow: none; }
.card textarea:focus { border: 0; box-shadow: none; }

/* segmented paste/upload/link switch */
.tabs {
  display: inline-flex;
  gap: 2px;
  background: var(--panel-2);
  border-radius: 8px;
  padding: 2px;
}
.tab {
  border: 0;
  background: transparent;
  padding: 3px 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.tab:active { transform: none; }
.tab.active { background: var(--panel); color: var(--accent); font-weight: 600; box-shadow: var(--sh-1); }

.importer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 7px 11px;
  border-bottom: 1px dashed var(--line);
}
.importer input[type="file"] { display: none; }
.file-btn {
  display: inline-block;
  font-weight: 500;
  font-size: 13px;
  margin: 0;
  padding: 7px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.file-btn:hover { border-color: var(--accent); color: var(--accent); }
.hint { color: var(--muted); font-size: 12px; }
.importer input[type="url"] { flex: 1; min-width: 200px; }
.fetch-btn { flex-shrink: 0; }

.doc-status { min-height: 16px; font-size: 12px; margin: 2px 7px 5px; color: var(--muted); }
.doc-status.ok { color: var(--ok); }
.doc-status.err { color: var(--danger); }

.progress { display: flex; align-items: center; gap: 12px; padding: 8px 7px; }
.progress .bar { flex: 1; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; position: relative; }
.progress .fill { height: 100%; width: 0%; background: var(--accent); border-radius: 2px; transition: width 0.15s; }
.progress .fill.indet { position: absolute; width: 30%; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { 0% { left: -30%; } 100% { left: 100%; } }
.plabel { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.doc-field.busy .tabs, .doc-field.busy .importer { opacity: 0.5; pointer-events: none; }
.doc-field.busy textarea { opacity: 0.7; }

.options { border: 0; }
.options summary { cursor: pointer; list-style: none; display: inline-block; }
.options summary::-webkit-details-marker { display: none; }
.options summary .klabel, .options summary.klabel { margin-bottom: 0; }
.options summary::after { content: " +"; color: var(--muted); font-family: var(--mono); }
.options[open] summary::after { content: " \2212"; }
.options .row.three {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.2fr;
  gap: 16px;
  margin-top: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--sh-1);
  padding: 16px 18px;
}

.actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
button.big { padding: 12px 30px; font-size: 15.5px; border-radius: 10px; }
.meter { color: var(--muted); font-size: 12px; }

/* --- History --------------------------------------------------------------- */

/* Full-screen modal: the page behind is dimmed and blurred so the history
 * reads as a layer over the app rather than another block of page. */
.history-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 20px;
  overflow-y: auto;
  background: rgba(17, 22, 32, 0.42);
  backdrop-filter: blur(10px) saturate(0.85);
  -webkit-backdrop-filter: blur(10px) saturate(0.85);
  animation: fadein 0.16s ease-out;
}
:root[data-theme="dark"] .history-overlay { background: rgba(4, 6, 10, 0.62); }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.hist-modal {
  width: 100%;
  max-width: 880px;
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(9, 12, 20, 0.34), 0 2px 6px rgba(9, 12, 20, 0.18);
  padding: 22px 26px 20px;
  animation: modalin 0.18s ease-out;
}
@keyframes modalin {
  from { opacity: 0; transform: translateY(-8px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .history-overlay, .hist-modal { animation: none; }
}
body.modal-open { overflow: hidden; }
.hist-foot kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 4px;
  color: var(--text);
}
.hist-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.hist-head .klabel { margin: 0 0 3px; }
.hist-head-acts { display: flex; gap: 8px; flex-shrink: 0; }
.hist-count { font-size: 11.5px; color: var(--muted); }
.small-btn { padding: 4px 11px; font-size: 12.5px; }
button.danger { color: var(--danger); }
button.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
/* the list scrolls inside the modal; header and footer stay put */
.hist-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 14px -4px 0;
  padding: 2px 4px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.hist-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  background: var(--bg);
}
.hist-card:hover { border-color: var(--line-strong); }
.hist-card.current { border-color: var(--accent); background: var(--accent-soft); }
.hist-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hist-main { min-width: 0; }
.hist-label { font-weight: 600; font-size: 14px; line-height: 1.35; }
.hist-badge {
  display: inline-block;
  margin-left: 9px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 999px;
  padding: 1px 7px;
  vertical-align: 1px;
}
.hist-badge.warn {
  color: var(--muted);
  border-color: var(--line-strong);
}
/* where this history lives: account copy or this device only */
.hist-sync {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  max-width: 58ch;
}
.hist-sync button.linkish { font-size: 12px; padding: 0; }
.hist-sync.busy .hist-sync-text { opacity: 0.75; }
.hist-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.hist-acts { display: flex; gap: 7px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.hist-acts button { font-size: 12.5px; padding: 5px 11px; }
.hist-sub {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hist-sub-blk .kw-title { margin-bottom: 5px; }
.hist-sub-text { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.hist-sub-note { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.hist-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; font-size: 13.5px; color: var(--muted); padding: 6px 0 2px; }
.hist-foot { margin: 14px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.hist-foot strong { color: var(--text); font-weight: 600; }

.toast-action {
  border: 0;
  background: transparent;
  padding: 0 0 0 10px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: underline;
}
.toast-action:hover { background: transparent; color: var(--accent-hover); }
.toast-action:active { transform: none; }

/* --- Streaming progress ---------------------------------------------------- */

.progress-panel {
  margin-top: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--sh-1);
  padding: 18px 22px 20px;
}
.pp-top { display: flex; align-items: center; gap: 16px; }
.pp-top .klabel { margin: 0; flex-shrink: 0; }
.progress-panel .pp-bar { flex: 1; height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; position: relative; }
.progress-panel .pp-fill { position: absolute; width: 30%; height: 100%; background: var(--accent); border-radius: 2px; animation: indet 1.1s ease-in-out infinite; }
.progress-panel.finished .pp-bar { visibility: hidden; }
.progress-panel #status { font-size: 12px; color: var(--muted); white-space: nowrap; }

.steps { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.step { display: flex; align-items: flex-start; gap: 12px; }
.step-ic {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  flex-shrink: 0;
  margin-top: 1px;
  position: relative;
}
.step.done .step-ic { border-color: var(--ok); background: var(--ok); }
.step.done .step-ic::after {
  content: "";
  position: absolute;
  left: 4.5px; top: 1.5px;
  width: 4px; height: 8px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.step.active .step-ic { border-color: var(--accent); }
.step.active .step-ic::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
  animation: steppulse 1.1s ease-in-out infinite;
}
@keyframes steppulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.step.pending { opacity: 0.45; }
.step-label { font-weight: 600; font-size: 13.5px; line-height: 1.4; }
.step-detail { color: var(--muted); font-size: 12px; font-family: var(--mono); margin-top: 1px; }

/* --- Trace zone (the mock's centerpiece) ------------------------------------ */

.result { margin-top: 40px; display: flex; flex-direction: column; gap: 44px; }

.trace-list { display: flex; flex-direction: column; gap: 12px; }
.trace-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 15px 18px;
  box-shadow: var(--sh-1);
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
.trace-card:hover {
  border-color: var(--line-strong);
  border-left-color: var(--accent);
  box-shadow: var(--sh-2);
  transform: translateY(-1px);
}
.trace-claim { font-size: 15.5px; line-height: 1.45; }
.trace-side { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; flex-shrink: 0; }
.trace-src {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--chip);
  white-space: nowrap;
  flex-shrink: 0;
}
.trace-acts { display: flex; gap: 6px; }
.kbtn {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
}
.kbtn:hover:not(:disabled) { border-color: var(--text); color: var(--text); background: transparent; }
.kbtn.keep.on {
  border-color: color-mix(in srgb, var(--ok) 55%, transparent);
  background: color-mix(in srgb, var(--ok) 8%, transparent);
  color: var(--ok);
}
.kbtn.out.on {
  border-color: color-mix(in srgb, var(--danger) 55%, transparent);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  color: var(--danger);
}
.trace-card.rejected { opacity: 0.62; border-left-color: var(--line-strong); }
.trace-card.rejected:hover { transform: none; box-shadow: var(--sh-1); }
.trace-card.rejected .trace-claim { text-decoration: line-through; color: var(--muted); }
.trace-note { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 2px 2px 0; }

.trace-divider {
  height: 7px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--line) 0%, transparent 100%);
  margin: 8px 2px 0;
}

.unmatched {
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
  display: block;
  padding: 2px 0;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--warn);
  cursor: pointer;
}
.unmatched:active { transform: none; }
.unmatched::before { content: "!"; font-weight: 800; margin-right: 10px; }
.unmatched:hover { text-decoration: underline; background: transparent; }
.unmatched.none { color: var(--ok); cursor: default; }
.unmatched.none:hover { text-decoration: none; }
.unmatched-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px 18px;
  background: color-mix(in srgb, var(--warn) 6%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent);
  border-radius: 10px;
}
.unmatched-item { font-size: 13.5px; color: var(--muted); }
.unmatched-item strong { color: var(--text); font-weight: 600; }

/* --- Document zone ----------------------------------------------------------- */

.doc-tools {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  flex-wrap: wrap;
}
.tpl-row { display: flex; gap: 10px; flex-wrap: wrap; }
.tpl-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 9px 10px 7px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--sh-1);
}
.tpl-card:hover { border-color: var(--line-strong); box-shadow: var(--sh-2); transform: translateY(-1px); }
.tpl-card:active { transform: translateY(0); }
.tpl-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent), var(--sh-1);
}
.tpl-card span { font-size: 11px; font-family: var(--mono); letter-spacing: 0.05em; color: var(--muted); }
.tpl-card.active span { color: var(--accent); font-weight: 600; }

/* CSS minidoc thumbnails */
.thumb {
  width: 78px;
  height: 100px;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 9px 8px;
  position: relative;
  overflow: hidden;
}
.thumb i { display: block; height: 3px; background: #d8dbe4; margin: 4px 0; border-radius: 1px; }
.thumb .l0 { height: 6px; width: 62%; background: var(--da); margin-bottom: 5px; }
.thumb .l1 { width: 40%; }
.thumb .l2 { width: 88%; margin-top: 8px; }
.thumb .l3 { width: 92%; }
.thumb .l4 { width: 74%; }
.thumb .l5 { width: 88%; margin-top: 8px; }
.thumb .l6 { width: 80%; }
.thumb .l7 { width: 56%; }
.th-classic i, .th-executive i { margin-left: auto; margin-right: auto; }
.th-classic .l0, .th-executive .l0 { width: 54%; }
.th-classic .l2, .th-classic .l5, .th-executive .l2, .th-executive .l5 { width: 90%; }
.th-executive .l0 { height: 5px; }
.th-minimal i { background: #e3e5ec; }
.th-minimal .l0 { background: #2a2f3a; }
.th-compact i { margin: 2.5px 0; height: 2.5px; }
.th-compact .l0 { height: 5px; }
.th-sidebar { padding-left: 30px; }
.th-sidebar::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 24px;
  background: color-mix(in srgb, var(--da) 14%, #ffffff);
  border-right: 1px solid var(--line);
}

.tool-side { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; padding-top: 2px; }
.side-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.page-sel { margin-bottom: 0; }
.doc-subbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 18px 0 12px; }
.page-badge {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 2px 10px;
  white-space: nowrap;
}
.accents { display: flex; gap: 9px; }
.dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--c);
  padding: 0;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: transform 0.12s, box-shadow 0.15s;
}
.dot:hover { transform: scale(1.12); }
.dot.active { border-color: var(--bg); box-shadow: 0 0 0 2px var(--c); }
.dl-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* Editing is the least discoverable part of the app, so this reads as a real
 * callout rather than fine print. */
.edit-hint {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  border-radius: 999px;
  padding: 7px 15px 7px 12px;
  margin: 0;
}
.edit-hint svg { width: 15px; height: 15px; flex-shrink: 0; }
.edit-hint .eh-tail { font-weight: 400; color: color-mix(in srgb, var(--accent) 74%, var(--text)); }
.page-badge { margin: 0; }

/* --- The paper on its desk ---------------------------------------------------- */

.paper-wrap {
  /* the floating per-line refine button is positioned against this box */
  position: relative;
  overflow-x: auto;
  background: var(--desk);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 34px 24px 40px;
}
.paper {
  --da: #3646e4;
  width: 816px;
  max-width: 100%;
  min-height: 400px;
  margin: 0 auto;
  position: relative;
  background: #ffffff;
  color: #1a1f2b;
  box-shadow: 0 1px 3px rgba(15, 18, 30, 0.16), 0 16px 48px rgba(15, 18, 30, 0.16);
  border-radius: 3px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13.3px;
  line-height: 1.34;
}
:root[data-theme="dark"] .paper { box-shadow: 0 0 0 1px #2a303c, 0 18px 52px rgba(0, 0, 0, 0.55); }

/* Where the PDF breaks to the next sheet. Inserted into the flow at the exact
 * content position the PDF engine reported, so it reads as the gap between two
 * printed pages — bottom margin, sheet edge, top margin. */
.page-break {
  --gut: #e4e7ee;
  position: relative;
  list-style: none;
  /* app.js measures the sheet and sets margin-left / width so the band bleeds
   * to both paper edges from whatever container it was inserted into */
  pointer-events: none;
}
/* sheet edges either side of the gutter */
.page-break::before,
.page-break::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 9px;
}
.page-break::before {
  top: calc(var(--seam, 0px) - 9px);
  background: linear-gradient(180deg, rgba(15, 18, 30, 0) 0%, rgba(15, 18, 30, 0.07) 100%);
}
.page-break::after {
  top: calc(var(--seam, 0px) + 26px);
  background: linear-gradient(180deg, rgba(15, 18, 30, 0.09) 0%, rgba(15, 18, 30, 0) 100%);
}
.page-break span {
  position: absolute;
  right: 14px;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8b93a3;
  background: #f6f7fa;
  border: 1px solid #dcdfe7;
  border-radius: 999px;
  padding: 2px 9px;
  z-index: 1;
}

.paper [contenteditable] { outline: none; border-radius: 2px; }
.paper [contenteditable]:hover { box-shadow: 0 0 0 1px color-mix(in srgb, var(--da) 45%, transparent); }
.paper [contenteditable]:focus { box-shadow: 0 0 0 1.5px var(--da); background: color-mix(in srgb, var(--da) 5%, #ffffff); }

.doc-name { font-weight: 700; font-size: 28px; line-height: 1.15; letter-spacing: -0.01em; }
.doc-headline { font-size: 14.6px; color: #5a6272; margin-top: 3px; }
.doc-contact { color: #5a6272; font-size: 12.5px; margin-top: 6px; }
.doc-contact .doc-sep { margin: 0 7px; color: #9aa1ae; }
.doc-contact.vertical { display: flex; flex-direction: column; gap: 5px; margin-top: 0; }
/* Vertical rhythm mirrors the PDF's advances (heading ≈ 38px, 2-bullet entry
 * ≈ 82px) so the preview's height tracks the printed page. */
.doc-sec h2 {
  font-size: 13.3px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 13px 0 4px;
  padding-bottom: 2px;
}
.doc-sec p { margin: 0; }
.sk-row { margin: 2px 0; }
.sk-label { font-weight: 700; }
.sk-label::after { content: ":"; margin-right: 6px; }
.xp { margin: 0 0 6px; }
.xp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; }
.xp-role { font-weight: 700; font-size: 14px; }
.xp-dates { color: #5a6272; font-size: 11.8px; white-space: nowrap; }
.xp-sub { color: #5a6272; font-style: italic; font-size: 12.9px; }
.xp-sub .xp-loc::before { content: " \00b7\00a0"; }
.xp ul, .plain-list { margin: 2px 0 0; padding-left: 20px; }
.xp li, .plain-list li { margin: 1px 0; }
.paper li::marker { color: var(--da); }
.edu .xp-head { margin-bottom: 1px; }

/* Modern — split header, accent name + rules */
.tpl-modern { padding: 66px 66px 60px; }
.tpl-modern .doc-header { display: flex; justify-content: space-between; gap: 24px; border-bottom: 2.5px solid var(--da); padding-bottom: 14px; }
.tpl-modern .doc-name { color: var(--da); }
.tpl-modern .doc-contact.stack { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; margin-top: 2px; text-align: right; line-height: 1.35; }
.tpl-modern .doc-contact.stack .doc-sep { display: none; }
.tpl-modern .doc-sec h2 { border-bottom: 1.5px solid var(--da); padding-bottom: 3px; }

/* Classic — centered serif */
.tpl-classic { padding: 75px 75px 66px; font-family: "Times New Roman", Times, serif; font-size: 13.7px; line-height: 1.35; }
.tpl-classic .doc-header { text-align: center; border-bottom: 1px solid #1a1f2b; padding-bottom: 14px; }
.tpl-classic .doc-name { font-size: 30.6px; }
.tpl-classic .doc-headline { font-style: italic; }
.tpl-classic .doc-contact { margin-top: 8px; }
.tpl-classic .doc-sec h2 { letter-spacing: 0.1em; border-bottom: 1px solid #1a1f2b; padding-bottom: 3px; font-size: 13.6px; }
.tpl-classic .xp-role { font-size: 14.4px; }

/* Compact — dense */
.tpl-compact { padding: 53px 53px 48px; font-size: 12.5px; line-height: 1.28; }
.tpl-compact .doc-name { font-size: 22.6px; }
.tpl-compact .doc-headline { font-size: 13.3px; color: var(--da); }
.tpl-compact .doc-header { border-bottom: 1px solid #c9cdd6; padding-bottom: 10px; }
.tpl-compact .doc-sec h2 { font-size: 12px; margin: 15px 0 5px; border-bottom: 1px solid #dcdfe6; padding-bottom: 2px; }
.tpl-compact .xp { margin-bottom: 8px; }
.tpl-compact .xp ul { margin-top: 2px; padding-left: 17px; }
.tpl-compact .xp li { margin: 1.5px 0; }
.tpl-compact .xp-role { font-size: 13.1px; }

/* Executive — spaced caps serif */
.tpl-executive { padding: 77px 77px 68px; font-family: "Times New Roman", Times, serif; font-size: 13.6px; line-height: 1.37; }
.tpl-executive .doc-header { text-align: center; border-bottom: 1px solid #1a1f2b; padding-bottom: 16px; }
.tpl-executive .doc-name { font-size: 25.3px; letter-spacing: 0.22em; text-transform: uppercase; }
.tpl-executive .doc-headline { letter-spacing: 0.1em; margin-top: 6px; }
.tpl-executive .doc-sec h2 { color: var(--da); letter-spacing: 0.2em; font-size: 13.3px; border-bottom: 1px solid #1a1f2b; padding-bottom: 4px; }

/* Minimal — no rules, air */
.tpl-minimal { padding: 82px 82px 74px; line-height: 1.42; }
.tpl-minimal .doc-headline { color: #5a6272; }
.tpl-minimal .doc-contact { margin-top: 8px; }
.tpl-minimal .doc-sec h2 { font-size: 12px; letter-spacing: 0.16em; color: #8b93a2; margin: 26px 0 9px; }
.tpl-minimal .xp { margin-bottom: 15px; }

/* Sidebar — two columns, tinted rail */
.tpl-sidebar { padding: 0; }
.tpl-sidebar .doc-name { font-size: 25.3px; }
.tpl-sidebar .doc-headline { color: var(--da); }
.tpl-sidebar .doc-cols { display: grid; grid-template-columns: 264px 1fr; min-height: 400px; }
.tpl-sidebar .doc-side {
  background: color-mix(in srgb, var(--da) 9%, #ffffff);
  padding: 61px 30px 50px 43px;
  font-size: 11.7px;
}
.tpl-sidebar .doc-main { padding: 61px 61px 55px 28px; }
.tpl-sidebar .doc-main .doc-header { margin-bottom: 6px; }
.tpl-sidebar .doc-side .doc-sec h2 { color: var(--da); font-size: 11.5px; letter-spacing: 0.12em; border-bottom: 1px solid color-mix(in srgb, var(--da) 30%, #ffffff); padding-bottom: 3px; }
.tpl-sidebar .doc-main .doc-sec h2 { color: var(--da); border-bottom: 1px solid #c9cdd6; padding-bottom: 3px; }
.tpl-sidebar .doc-side .xp { margin-bottom: 10px; }
.tpl-sidebar .doc-side .xp-head { flex-direction: column; gap: 0; }
.tpl-sidebar .doc-side ul { padding-left: 16px; }

/* --- Briefing ------------------------------------------------------------------ */

.tabs2 {
  display: inline-flex;
  gap: 2px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  background: var(--panel-2);
  border-radius: 9px;
  padding: 3px;
}
.tabs2 button {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: var(--muted);
}
.tabs2 button:active { transform: none; }
.tabs2 button.active { background: var(--panel); color: var(--accent); font-weight: 600; box-shadow: var(--sh-1); }

.brief-body {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--sh-1);
  padding: 20px 24px;
  font-size: 14.5px;
}
.brief-body ul { margin: 0; padding-left: 20px; }
.brief-body li { margin: 7px 0; }
.brief-body .gap-fix { color: var(--muted); }
.brief-body .gap-fix::before { content: " \2192 "; color: var(--accent); }
.kw-group { margin: 4px 0 16px; }
.kw-group:last-child { margin-bottom: 4px; }
.kw-title { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 9px; }
.kw-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.kw {
  font-size: 12.5px;
  font-weight: 500;
  padding: 3px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
}
.kw.match { border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 7%, var(--panel)); color: var(--ok); }
.kw.miss { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 7%, var(--panel)); color: var(--warn); }

.run-meta { font-size: 12px; color: var(--muted); }

.raw-result { margin-top: 34px; }
.raw-output {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--sh-1);
  padding: 18px 22px;
  font-size: 14.5px;
}
.raw-output h1, .raw-output h2, .raw-output h3 { margin: 16px 0 8px; line-height: 1.25; }
.raw-output h2 { font-size: 16px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.raw-output ul { margin: 8px 0; padding-left: 22px; }
.raw-output p { margin: 8px 0; }
.raw-output code { font-family: var(--mono); font-size: 13px; background: var(--panel-2); border-radius: 4px; padding: 1px 5px; }
.raw-output pre { background: var(--panel-2); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }

/* --- How it works ---------------------------------------------------------------- */

.how { margin-top: 64px; border-top: 1px solid var(--line); padding-top: 30px; }
.how-lead { margin: -2px 0 20px; font-size: 14px; color: var(--muted); max-width: 760px; }
.how-lead a { color: var(--accent); font-weight: 600; }
.linkish {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  display: inline;
}
.linkish:hover { background: transparent; color: var(--accent-hover); }
.linkish:active { transform: none; }
.how-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.how-step {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--sh-1);
  padding: 20px 22px;
}
.step-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 12px;
}
.how-step h3 { margin: 0 0 6px; font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
.how-step p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

/* --- Footer + toasts ---------------------------------------------------------------- */

footer { padding: 22px 24px; border-top: 1px solid var(--line); text-align: center; }
footer a { color: var(--muted); font-size: 12.5px; text-decoration: none; }
footer a:hover { color: var(--text); }
.foot-sep { color: var(--line-strong); font-size: 12.5px; margin: 0 7px; }

.toasts {
  position: fixed;
  bottom: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* above the history modal — an Undo offered from inside it must be clickable */
  z-index: 80;
  max-width: min(420px, calc(100vw - 36px));
}
.toast {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ok);
  border-radius: 10px;
  padding: 11px 15px;
  font-size: 13.5px;
  box-shadow: var(--sh-2);
  transition: opacity 0.5s;
}
.toast.err { border-left-color: var(--danger); }
.toast.gone { opacity: 0; }
.toast a { color: var(--accent); margin-left: 8px; font-weight: 600; }

/* --- Print: only the resume page ---------------------------------------------------- */

@media print {
  body > header, body > footer, form, .progress-panel, .trace-zone, .briefing,
  .doc-tools, .doc-subbar, .klabel, .how, .toasts, .run-meta, .raw-result,
  .history-overlay, .page-break { display: none !important; }
  body, main { padding: 0; margin: 0; background: #ffffff; }
  .result { margin: 0; gap: 0; }
  .paper-wrap { overflow: visible; padding: 0; background: none; border: 0; border-radius: 0; }
  .paper { box-shadow: none; border-radius: 0; width: 100%; min-height: 0 !important; }
  .paper [contenteditable]:hover, .paper [contenteditable]:focus { box-shadow: none; background: transparent; }
}
@page { margin: 0; }

/* --- Small screens ------------------------------------------------------------------ */

@media (max-width: 860px) {
  .grid2 { grid-template-columns: 1fr; }
  .options .row.three { grid-template-columns: 1fr; }
  .doc-tools { flex-direction: column; }
  .tool-side { align-items: flex-start; }
  .dl-actions { justify-content: flex-start; }
  .how-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  header { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px 18px; }
  /* the session row is one item wider now — wrap instead of squeezing "Sign in" */
  .session { flex-wrap: wrap; gap: 8px; }
  main { padding: 18px 18px 44px; }
  .trace-card { flex-direction: column; align-items: flex-start; gap: 8px; }
  .trace-side { align-items: flex-start; }
  .pp-top { flex-wrap: wrap; }
  .hist-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .hist-acts { justify-content: flex-start; }
  .hist-head { flex-direction: column; }
  /* full-bleed sheet on phones */
  .history-overlay { padding: 0; }
  .hist-modal { max-width: none; max-height: 100vh; height: 100%; border-radius: 0; border: 0; padding: 18px 18px 16px; }
  .side-row { justify-content: flex-start; }
  .paper-wrap { padding: 14px 8px 18px; }
  .tpl-sidebar .doc-cols { grid-template-columns: 1fr; }
  .tpl-sidebar .doc-side { padding: 24px; order: 2; }
  .tpl-sidebar .doc-main { padding: 32px 24px 40px; }
}

/* --- Closing the gaps ---------------------------------------------------------
 * The honest counterpart to the unmatched list: what the posting wants, asked
 * as a question, and a report on which answers actually earned a place. */

.gap-zone { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.gap-lead {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px 17px;
  box-shadow: var(--sh-1);
}
.gap-lead strong { display: block; font-size: 14.5px; letter-spacing: -0.005em; }
.gap-lead p { margin: 7px 0 13px; font-size: 13.5px; color: var(--muted); max-width: 74ch; }
.gap-lead-acts { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; }
.gap-lead-acts .mono, .gap-acts .mono { font-size: 11.5px; color: var(--muted); }

.gap-form { display: flex; flex-direction: column; gap: 12px; }
.gap-q {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px 15px;
  box-shadow: var(--sh-1);
}
.gap-req {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--warn);
  margin-bottom: 7px;
}
.gap-ask { font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.gap-why { font-size: 13px; color: var(--muted); margin-top: 5px; line-height: 1.45; }
.gap-q textarea { width: 100%; min-height: 60px; margin-top: 11px; }
.gap-acts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 2px; }

.gap-report { display: flex; flex-direction: column; gap: 16px; }
.gap-group { display: flex; flex-direction: column; gap: 9px; }
.gap-added {
  border-left: 3px solid var(--ok);
  padding: 2px 0 2px 13px;
  background: color-mix(in srgb, var(--ok) 5%, transparent);
  border-radius: 0 8px 8px 0;
}
.gap-added-claim { font-size: 13.5px; line-height: 1.45; }
.gap-added-where { font-size: 10.5px; letter-spacing: 0.06em; color: var(--muted); margin-top: 3px; }
.gap-rejected {
  border-left: 3px solid var(--line-strong);
  padding: 2px 0 2px 13px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.45;
}
.gap-rejected strong { color: var(--text); font-weight: 600; }
.gap-note { font-size: 13px; color: var(--muted); font-style: italic; }

/* --- Refine ------------------------------------------------------------------- */

.refine-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin: 0 0 14px; }
.refine-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 3px;
}
.chip {
  padding: 5px 13px;
  font-size: 12.5px;
  border-radius: 999px;
  border-color: var(--line-strong);
  background: var(--panel);
  box-shadow: var(--sh-1);
}
.chip:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.refine-row .mono { font-size: 11.5px; color: var(--muted); }
button.busy { opacity: 0.7; cursor: progress; }

/* Follows the caret into the sheet's right margin — deliberately not a child of
 * the editable line, whose textContent is the model's source of truth. */
.line-refine {
  position: absolute;
  z-index: 4;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--sh-2);
  white-space: nowrap;
}
.line-refine:hover:not(:disabled) { background: var(--accent-hover); }

.ref-modal { max-width: 760px; }
.ref-orig {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.ref-orig-text { font-size: 13.5px; line-height: 1.45; margin-top: 5px; }
.ref-opts { display: flex; flex-direction: column; gap: 11px; }
.ref-opt {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 15px;
  box-shadow: var(--sh-1);
}
.ref-opt:hover { border-color: var(--line-strong); box-shadow: var(--sh-2); }
.ref-opt-body { min-width: 0; }
.ref-opt-text { font-size: 14px; line-height: 1.45; }
.ref-opt-why { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.ref-opt button { flex-shrink: 0; font-size: 12.5px; padding: 5px 13px; }
.ref-note { font-size: 13px; color: var(--warn); }
.ref-cost { font-size: 10.5px; letter-spacing: 0.06em; color: var(--muted); }

/* --- The cover letter --------------------------------------------------------- */

.letter-zone { display: flex; flex-direction: column; }
.letter-intro {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 17px 19px 18px;
  box-shadow: var(--sh-1);
}
.lt-lead { margin: 0 0 15px; font-size: 13.5px; color: var(--muted); max-width: 78ch; line-height: 1.5; }
.lt-recap { display: none; margin: 0 0 13px; font-size: 13px; color: var(--muted); }
.lt-recap strong { color: var(--text); font-weight: 600; }
/* Once a letter exists the pitch is spent, but its controls still drive Rewrite. */
.letter-intro.compact { padding: 14px 19px 15px; }
.letter-intro.compact .lt-lead, .letter-intro.compact #ltWrite { display: none; }
.letter-intro.compact .lt-recap { display: block; }
.letter-intro.compact .lt-status:empty { display: none; }
.lt-controls { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.lt-field { display: flex; flex-direction: column; gap: 6px; }
.lt-field.grow { flex: 1 1 240px; }
.lt-field label { font-size: 12.5px; color: var(--muted); }
.lt-field input, .lt-field select { width: 100%; }
.lt-status { font-size: 11.5px; color: var(--muted); margin-top: 11px; min-height: 14px; }
.letter-out { display: flex; flex-direction: column; }
.letter-out .dl-actions { margin-top: 16px; }

/* The letter borrows the resume's letterhead, so it inherits every .tpl-* rule;
 * only the body block below the header is its own. */
.paper.letter.tpl-sidebar { padding: 61px 61px 55px; }
/* The letter's PDF stacks the contact under the name for every template and
 * always rules off the letterhead — the preview has to agree, so modern's
 * split header and the two borderless headers are overridden here. */
.paper.letter.tpl-modern .doc-header { display: block; }
.paper.letter.tpl-minimal .doc-header,
.paper.letter.tpl-sidebar .doc-header { border-bottom: 1px solid #c9cdd6; padding-bottom: 14px; }
.paper.letter .doc-contact { margin-top: 7px; }
.paper.letter .lt-body { margin-top: 30px; font-size: 13.3px; }
.paper.letter.tpl-classic .lt-body, .paper.letter.tpl-executive .lt-body { font-size: 13.6px; }
.lt-date { color: #5a6272; margin-bottom: 20px; }
.lt-to { margin-bottom: 24px; line-height: 1.5; }
.lt-greet { margin-bottom: 15px; line-height: 1.42; }
.lt-para { margin: 0 0 14px; line-height: 1.42; }
.lt-close { margin-top: 20px; line-height: 1.42; }
.lt-sign { margin-top: 30px; font-weight: 700; }

@media print {
  /* Print stays "print the resume" — the letter has its own PDF and Word export. */
  .letter-zone, .gap-zone, .refine-row, .line-refine { display: none !important; }
}

@media (max-width: 640px) {
  .lt-controls { flex-direction: column; align-items: stretch; }
  .ref-opt { flex-direction: column; align-items: stretch; gap: 11px; }
}

/* --- Intro lede + question-shaped content sections (GEO) ----------------- */
.intro { margin: 2px 0 26px; }
.intro .lede {
  margin: 0;
  max-width: 860px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--muted);
}
.intro .lede strong { color: var(--text); }
.intro .lede a { color: var(--accent); font-weight: 600; }

.how.qa h2.klabel { display: block; margin: 0 0 12px; font-size: 15px; }
.how.qa p { margin: 0 0 12px; max-width: 820px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.how.qa p strong, .how.qa li strong { color: var(--text); }
.how.qa code { font: 12.5px var(--mono); background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.qa-list { margin: 0; padding-left: 22px; max-width: 820px; }
.qa-list li { margin: 0 0 10px; color: var(--muted); font-size: 14px; line-height: 1.6; }

@media print {
  .intro, .how.qa { display: none !important; }
}

/* Worked-example trace block on the #example section */
.ex-trace {
  max-width: 820px;
  margin: 0 0 12px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
}
.ex-trace p { margin: 0 0 10px; }
.ex-trace p:last-child { margin-bottom: 0; }
.ex-k { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }

/* --- Static content pages (guide/about/privacy) --------------------------- */
.docs-top.guide-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.docs-top.guide-top .brand { font-weight: 700; letter-spacing: -0.2px; color: var(--text); text-decoration: none; }
.docs-top.guide-top .open-app {
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.docs-top.guide-top .open-app:hover { background: var(--accent-hover); }
.guide-wrap { max-width: 780px; margin: 0 auto; padding: 34px 20px 60px; }
.guide-wrap h1 { font-size: clamp(24px, 4.5vw, 34px); letter-spacing: -0.5px; margin: 0 0 6px; }
.guide-wrap h2 { font-size: 19px; letter-spacing: -0.2px; margin: 30px 0 10px; }
.guide-wrap p, .guide-wrap li { color: var(--muted); font-size: 14.5px; line-height: 1.65; }
.guide-wrap p strong, .guide-wrap li strong { color: var(--text); }
.guide-wrap a { color: var(--accent); }
.guide-wrap code { font: 12.5px var(--mono); background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.guide-meta { font-family: var(--mono); font-size: 12px; letter-spacing: 0.02em; color: var(--muted); margin: 0 0 20px; }
.guide-lede { font-size: 15.5px; }
.guide-steps { padding-left: 22px; }
.guide-steps li { margin: 0 0 14px; }
.guide-sources { padding-left: 22px; }
.guide-sources li { margin: 0 0 8px; }
.guide-tool {
  margin-top: 34px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.guide-tool h2 { margin-top: 0; }
.guide-tool p { margin: 0; }
