/* CV CRM interface — light theme, navy accents. Uses system fonts only (works offline). */
:root {
  --navy: #1f3a5f;
  --navy-700: #172d4a;
  --navy-50: #eef3f9;
  --navy-100: #dbe5f1;
  --ink: #1b2430;
  --muted: #5b6676;
  --line: #d9dee6;
  --bg: #f4f6f9;
  --card: #ffffff;
  --ok: #1e6b3a;
  --ok-bg: #e7f4ec;
  --warn: #7a4b00;
  --warn-bg: #fff4dc;
  --err: #a12622;
  --err-bg: #fdecea;
  --focus: #2f6fdb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 58, .06), 0 2px 8px rgba(16, 32, 58, .05);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 24px 20px 40px; }
main:focus { outline: none; }
.workspace-page main { max-width: 1600px; }
h1 { font-size: 1.6rem; margin: 0 0 4px; color: var(--navy-700); letter-spacing: -.01em; }
h2 { font-size: 1.08rem; margin: 0 0 10px; color: var(--navy-700); }
h3 { font-size: 1rem; margin: 0 0 8px; }
a { color: var(--navy); }
a:hover { color: var(--navy-700); }
code, .path { font-family: Consolas, "Cascadia Mono", monospace; font-size: .88em; background: var(--navy-50); padding: 2px 5px; border-radius: 4px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 100; border-radius: 6px; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* top bar */
.topbar { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 56px; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }
.brand:hover { color: #fff; }
.brand-mark { background: #fff; color: var(--navy); border-radius: 6px; font-size: .78rem; padding: 3px 6px; letter-spacing: .03em; }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { color: #dfe8f4; text-decoration: none; padding: 7px 12px; border-radius: 7px; }
.topbar nav a:hover, .topbar nav a[aria-current] { background: rgba(255,255,255,.13); color: #fff; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 14px 20px 18px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: .92rem;
  border: 1px solid var(--line); background: #fff; color: var(--navy-700); padding: 8px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap; }
.btn:hover { background: var(--navy-50); border-color: var(--navy-100); color: var(--navy-700); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-700); border-color: var(--navy-700); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger:hover { background: #821d1a; color: #fff; border-color: #821d1a; }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--err); }
.btn-danger-ghost:hover { background: var(--err-bg); color: var(--err); border-color: transparent; }
.btn-small { padding: 5px 10px; font-size: .84rem; }
.icon-btn { font: inherit; width: 30px; height: 30px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; line-height: 1; font-size: .95rem; }
.icon-btn:hover:not(:disabled) { background: var(--navy-50); color: var(--navy-700); }
.icon-btn.danger:hover:not(:disabled) { background: var(--err-bg); color: var(--err); }
.icon-btn:disabled { opacity: .3; cursor: default; }

/* flashes and notices */
.flashes { margin-bottom: 16px; display: grid; gap: 8px; }
.flash { padding: 10px 14px; border-radius: 8px; border: 1px solid; }
.flash-success { background: var(--ok-bg); border-color: #b9dfc6; color: var(--ok); }
.flash-error { background: var(--err-bg); border-color: #f2c1bd; color: var(--err); }
.flash-info { background: var(--navy-50); border-color: var(--navy-100); color: var(--navy-700); }
.notice { background: var(--navy-50); border: 1px solid var(--navy-100); border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; font-size: .9rem; }
.notice-warn { background: var(--warn-bg); border-color: #f0d79c; color: var(--warn); }

/* page headings, list */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.tabs-row { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.pill { text-decoration: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: .9rem; }
.pill.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.pill .count { opacity: .7; margin-left: 4px; font-size: .82rem; }
.search { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.search input[type=search] { flex: 1 1 280px; }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.list td { padding: 12px 14px; border-bottom: 1px solid #edf0f4; vertical-align: middle; }
.list tr:last-child td { border-bottom: none; }
.list tbody tr:hover { background: #fafbfd; }
.name-link { font-weight: 650; text-decoration: none; color: var(--navy-700); }
.name-link:hover { text-decoration: underline; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions form { display: inline; }
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--navy-50); color: var(--navy-700); }
.badge-placed, .badge-offered { background: var(--ok-bg); color: var(--ok); }
.badge-interviewing { background: #e9f0ff; color: #234a9c; }
.badge-on-hold { background: var(--warn-bg); color: var(--warn); }
.badge-not-progressing { background: #eef0f3; color: #59606b; }
.badge-archived { background: #eef0f3; color: #59606b; vertical-align: middle; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }
.empty { text-align: center; padding: 48px 20px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty h2 { font-size: 1.2rem; }
.small-empty { padding: 28px 16px; }

/* forms */
.narrow { max-width: 640px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 18px 16px; margin-bottom: 16px; }
.form-card { padding: 22px; }
.danger-card { border-color: #f2c1bd; }
.field { margin-bottom: 12px; min-width: 0; }
.field label, .bullets-label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 4px; color: #2a3442; }
input[type=text], input[type=email], input[type=tel], input[type=search], input[type=date], input:not([type]), select, textarea {
  width: 100%; font: inherit; font-size: .95rem; color: var(--ink); background: #fff; border: 1px solid #c5ccd6; border-radius: 7px; padding: 8px 10px; min-width: 0; }
textarea { resize: vertical; line-height: 1.45; min-height: 64px; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: 2px solid rgba(47,111,219,.25); outline-offset: 0; }
input:disabled { background: #f1f3f6; color: #8a93a0; }
.search select { width: auto; }
.stale-check { font-size: .86rem; color: var(--muted); }
a.menu-item { text-decoration: none; }
.req { font-weight: 400; color: var(--muted); font-size: .8rem; }
.hint { margin: 4px 0 0; font-size: .8rem; color: var(--muted); }
.error-text { margin: 4px 0 0; color: var(--err); font-size: .84rem; font-weight: 600; }
.has-error input, .has-error textarea, .has-error select { border-color: var(--err); background: #fffafa; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: .9rem; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--navy); }
.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.span-2 { grid-column: 1 / -1; }
.field-check { display: flex; align-items: flex-end; padding-bottom: 26px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: start; }
.compact-table td, .compact-table th { padding: 8px 10px; font-size: .88rem; }

/* workspace */
.ws-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.ws-title { min-width: 0; }
.ws-title .back { font-size: .88rem; text-decoration: none; }
.ws-title h1 { margin-top: 2px; overflow-wrap: anywhere; }
.ws-title p { margin: 0; }
.ws-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.save-status { font-size: .86rem; padding: 5px 10px; border-radius: 999px; background: #eef0f3; color: var(--muted); white-space: nowrap; }
.save-status::before { content: "●"; margin-right: 6px; font-size: .7em; vertical-align: 1px; }
.status-saved { background: var(--ok-bg); color: var(--ok); }
.status-saving, .status-dirty { background: var(--warn-bg); color: var(--warn); }
.status-error { background: var(--err-bg); color: var(--err); font-weight: 600; }
.btn-doc { font-weight: 700; }
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-body { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 8px 24px rgba(16,32,58,.14); min-width: 230px; padding: 6px; z-index: 20; }
.menu-item { display: block; width: 100%; text-align: left; font: inherit; font-size: .9rem; background: none; border: 0; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--ink); }
.menu-item:hover { background: var(--navy-50); }
.menu-item.danger { color: var(--err); }
.menu-item.danger:hover { background: var(--err-bg); }
.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid; font-size: .92rem; }
.banner-error { background: var(--err-bg); border-color: #f2c1bd; color: var(--err); }
.banner-warn { background: var(--warn-bg); border-color: #f0d79c; color: var(--warn); }
.banner-ok { background: var(--ok-bg); border-color: #b9dfc6; color: var(--ok); }
.banner-info { background: var(--navy-50); border-color: var(--navy-100); color: var(--navy-700); }
.banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ws-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.ws-tabs [role=tab] { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 16px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.ws-tabs [role=tab]:hover { color: var(--navy-700); }
.ws-tabs [role=tab][aria-selected=true] { color: var(--navy-700); border-bottom-color: var(--navy); }
.ws-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr); gap: 20px; align-items: start; }
.editor { min-width: 0; }
.loading { padding: 40px; text-align: center; color: var(--muted); background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); }
.loading.error { color: var(--err); }
.preview { position: sticky; top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; min-width: 0; }
.preview-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; color: var(--navy-700); }
.preview-warning { margin: 0 0 8px; font-size: .85rem; background: var(--warn-bg); color: var(--warn); border-radius: 6px; padding: 6px 10px; }
.preview-frame-wrap { position: relative; height: calc(100vh - 120px); min-height: 480px; background: #e9edf2; border-radius: 6px; overflow: hidden; }
.preview-frame-wrap iframe { width: 100%; height: 100%; border: 0; display: block; background: #e9edf2; }
.preview-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; color: var(--muted); font-size: .9rem; }

/* CV editor */
.cv-toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; }
.cv-toolbar p { margin: 0; flex: 1 1 260px; }
.cv-toolbar select { width: auto; max-width: 100%; }
.section-card { padding: 12px 14px 14px; }
.section-card.is-hidden { background: #fbfbfc; border-style: dashed; }
.section-card.is-hidden .section-label { color: var(--muted); }
.section-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-label-field { flex: 1 1 200px; margin: 0; }
.section-label { font-weight: 700; color: var(--navy-700); font-size: 1rem !important; border-color: transparent !important; background: transparent !important; padding-left: 6px !important; }
.section-label:hover { border-color: var(--line) !important; }
.section-label:focus { border-color: var(--focus) !important; background: #fff !important; }
.collapse-btn { font: inherit; background: none; border: 0; width: 28px; height: 28px; cursor: pointer; color: var(--navy); border-radius: 6px; }
.collapse-btn:hover { background: var(--navy-50); }
.section-tools { display: inline-flex; gap: 2px; flex: none; }
.vis-toggle { font-size: .86rem; color: var(--muted); }
.hidden-note { margin: 4px 0 6px 36px; font-size: .82rem; color: var(--muted); font-style: italic; }
.section-card > .field { margin: 10px 0 0; }
.entries { display: grid; gap: 10px; margin-top: 10px; }
.empty-entries { margin: 4px 0 0 4px; }
.entry { border: 1px solid #e3e7ed; border-radius: 9px; padding: 8px 10px 4px; background: #fcfdfe; }
.entry.is-hidden { opacity: .72; border-style: dashed; }
.entry-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.entry-summary { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: flex-start; text-align: left; background: none; border: 0; padding: 4px; font: inherit; cursor: pointer; border-radius: 6px; color: var(--ink); }
.entry-summary:hover { background: var(--navy-50); }
.chev { color: var(--navy); width: 14px; flex: none; }
.es-text { display: flex; flex-direction: column; min-width: 0; }
.es-first { font-weight: 650; overflow-wrap: anywhere; }
.es-second { font-size: .83rem; color: var(--muted); }
.entry-tools { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.field-date input { max-width: 160px; }
.bullets { margin: 2px 0 8px; }
.bullet-list { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 6px; }
.bullet-row { display: flex; align-items: flex-start; gap: 6px; margin: 0; }
.bullet-row textarea { flex: 1; resize: none; overflow: hidden; min-height: 38px; }
.bullet-dot { color: var(--navy); padding-top: 8px; width: 10px; flex: none; }
.bullet-row .section-tools { padding-top: 4px; }
.card-internal { border-left: 4px solid #8a6d00; }
.lock-tag { font-size: .74rem; font-weight: 700; background: var(--warn-bg); color: var(--warn); padding: 2px 8px; border-radius: 999px; vertical-align: middle; margin-left: 4px; }

/* letters */
.letters-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; align-items: start; }
.letters-side { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.small-h { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.letter-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 4px; }
.letter-item { width: 100%; text-align: left; font: inherit; background: none; border: 1px solid transparent; border-radius: 7px; padding: 7px 9px; cursor: pointer; display: flex; flex-direction: column; color: var(--ink); }
.letter-item:hover { background: var(--navy-50); }
.letter-item.active { background: var(--navy-50); border-color: var(--navy-100); }
.ll-title { font-weight: 600; font-size: .9rem; overflow-wrap: anywhere; }
.new-letter { border-top: 1px solid var(--line); padding-top: 12px; }
.new-letter h3 { font-size: .9rem; }
.para-head { display: flex; justify-content: space-between; align-items: center; }
.para-head label { margin: 0; }
.letter-footer { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.order-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: -4px 0 12px; }

/* history */
.history-list { list-style: none; padding: 0; margin: 0; }
.history-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid #edf0f4; flex-wrap: wrap; }
.history-list li:last-child { border-bottom: 0; }

/* responsive */
@media (max-width: 1100px) {
  .ws-body { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; }
  .preview-frame-wrap { height: 80vh; }
}
@media (max-width: 760px) {
  main { padding: 16px 12px 32px; }
  .field-grid, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .letters-layout { grid-template-columns: minmax(0, 1fr); }
  .ws-actions { justify-content: flex-start; }
  .topbar { height: auto; padding: 10px 12px; gap: 8px 16px; }
  table.list thead { display: none; }
  table.list, .list tbody, .list tr, .list td { display: block; width: 100%; }
  .list tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .list td { border: 0; padding: 4px 14px; }
  .list td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: var(--muted); font-size: .8rem; }
  .list td[data-label="Name"]::before { content: none; }
  .row-actions { text-align: left; white-space: normal; }
  .entry-head { flex-wrap: wrap; }
  .field-check { padding-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* accounts */
.userbox { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: .88rem; }
.userbox a { color: #dfe8f4; text-decoration: none; }
.userbox a:hover { color: #fff; text-decoration: underline; }
.userbox form { margin: 0; }
.linkish { font: inherit; background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 7px; padding: 4px 10px; cursor: pointer; }
.linkish:hover { background: rgba(255,255,255,.12); }
.login-card { max-width: 400px; margin: 40px auto; }
.login-card h1 { text-align: center; }
.login-card .btn { width: 100%; }
.center { text-align: center; }
