:root {
  --bg: #f3f4f6; --card: #fff; --ink: #111827; --muted: #6b7280; --line: #e5e7eb; --accent: #1d4ed8; --accent-ink: #fff;
  --hit: #dcfce7; --hit-ink: #166534; --miss: #fee2e2; --miss-ink: #991b1b; --warn: #b45309; --err: #b91c1c; --ok: #15803d;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b0d12; --card: #151821; --ink: #e5e7eb; --muted: #9ca3af; --line: #272b36; --accent: #60a5fa; --accent-ink: #0b1220;
    --hit: #12301f; --hit-ink: #86efac; --miss: #3a1618; --miss-ink: #fca5a5; --warn: #fbbf24; --err: #f87171; --ok: #4ade80; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; font-size: 16px; }
.tabs { display: flex; gap: 4px; }
.tabs button { background: transparent; color: var(--muted); border: 1px solid transparent; }
.tabs button.active { color: var(--ink); border-color: var(--line); background: var(--bg); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
button, .file-btn { font: inherit; font-weight: 600; border-radius: 8px; padding: 7px 12px; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); white-space: nowrap; }
.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.ghost { background: transparent; color: var(--muted); border-color: transparent; }
.small { padding: 3px 8px; font-size: 13px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; width: 100%; min-width: 0; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
label.inline { flex-direction: row; align-items: center; gap: 6px; margin: 0; }
label.inline select { width: auto; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
.muted { color: var(--muted); } p.small { font-size: 12px; }

.layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr) minmax(260px, 320px); gap: 16px; padding: 16px; align-items: start; }
.cover-layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 16px; padding: 16px; align-items: start; }
@media (max-width: 1200px) { .layout { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); } .matcher { grid-column: 1 / -1; } }
@media (max-width: 820px) { .layout, .cover-layout { grid-template-columns: minmax(0, 1fr); } .grid2 { grid-template-columns: minmax(0, 1fr); } .actions { margin-left: 0; } }

.editor, .matcher { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.matcher { position: sticky; top: 70px; }
details { border-bottom: 1px solid var(--line); padding: 8px 0; }
details:last-child { border-bottom: 0; }
summary { font-weight: 700; cursor: pointer; padding: 2px 0 8px; }
.entry { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 0 0 10px; }
.entry-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.entry-head span { flex: none; white-space: nowrap; }
.entry-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-wrap { min-width: 0; overflow-x: auto; }
.preview-bar { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }

.matcher h2 { font-size: 15px; margin: 4px 0 8px; }
.matcher h3 { font-size: 12px; color: var(--muted); margin: 10px 0 4px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.score { display: flex; gap: 12px; align-items: center; margin: 10px 0; }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--c, var(--accent)) calc(var(--p) * 1%), var(--line) 0); }
.ring[data-band=strong] { --c: var(--ok); } .ring[data-band=fair] { --c: var(--warn); } .ring[data-band=weak] { --c: var(--err); }
.ring span { width: 50px; height: 50px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.score p { margin: 2px 0 0; font-size: 12px; }
.chip { display: inline-block; padding: 2px 8px; margin: 0 4px 4px 0; border-radius: 999px; font-size: 12px; }
.chip.hit { background: var(--hit); color: var(--hit-ink); } .chip.miss { background: var(--miss); color: var(--miss-ink); }
.checks { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.checks li { padding: 5px 0 5px 18px; position: relative; border-bottom: 1px solid var(--line); }
.checks li::before { content: "●"; position: absolute; left: 0; font-size: 10px; top: 8px; }
.checks .error::before { color: var(--err); } .checks .warn::before { color: var(--warn); } .checks .tip::before { color: var(--accent); } .checks .ok::before { color: var(--ok); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--card); padding: 8px 14px; border-radius: 8px; opacity: 0; transition: .2s; pointer-events: none; z-index: 10; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 4px 16px 28px; color: var(--muted); font-size: 13px; }
.foot a { color: var(--accent); font-weight: 600; }

/* ---------- Resume page (always light, like paper) ---------- */
.page { background: #fff; color: #111; width: 210mm; max-width: 100%; min-height: 297mm; margin: 0 auto; padding: 16mm 16mm; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.06); font-size: 10.5pt; line-height: 1.4; }
.page.font-sans { font-family: Arial, Helvetica, "Liberation Sans", sans-serif; }
.page.font-serif { font-family: Georgia, "Times New Roman", "Liberation Serif", serif; }
.r-head h1 { font-size: 22pt; margin: 0; letter-spacing: -.01em; }
.r-title { font-size: 12pt; color: #333; margin-top: 2px; }
.r-contact { font-size: 9.5pt; color: #333; margin-top: 4px; overflow-wrap: anywhere; }
.r-contact .sep { color: #999; }
.r-sec { margin-top: 12px; }
.r-sec h2 { font-size: 10.5pt; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid #111; padding-bottom: 2px; margin: 0 0 6px; }
.r-item { margin-bottom: 8px; break-inside: avoid; }
.r-row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.r-row h3 { font-size: 10.5pt; margin: 0; }
.r-org { font-weight: 400; }
.r-date { font-size: 9.5pt; color: #333; white-space: nowrap; }
.r-sub { font-size: 9.5pt; color: #444; }
.page ul { margin: 3px 0 0; padding-left: 16px; }
.page li { margin-bottom: 2px; }
.page p { margin: 0; }
.r-plain { list-style: none; padding-left: 0 !important; }
.page.two .r-cols { display: grid; grid-template-columns: minmax(0, 1fr) 58mm; gap: 8mm; }
.page.two .r-side .r-sec h2 { border-bottom-width: 1px; }
.page.two .r-skills { list-style: none; padding: 0; }
.page.two .r-side .r-row { flex-direction: column; gap: 0; }

.letter { font-family: Arial, Helvetica, sans-serif; }
.cl-header h1 { font-size: 18pt; margin: 0; }
.cl-date { margin: 14px 0 !important; color: #333; }
.cl-body { width: 100%; min-height: 180mm; border: 1px dashed #ccc; background: #fff; color: #111; font: 11pt/1.55 Arial, Helvetica, sans-serif; padding: 6px; }
.cl-print { display: none; white-space: pre-wrap; font: 11pt/1.55 Arial, Helvetica, sans-serif; }

@media print {
  @page { size: A4; margin: 14mm 16mm; }
  body { background: #fff; }
  .no-print { display: none !important; }
  .layout, .cover-layout { display: block; padding: 0; }
  .page { box-shadow: none; margin: 0; width: auto; min-height: 0; padding: 0; }
  .cl-body { display: none; }
  .cl-print { display: block; }
}
