/* ─────────────────────────────────────────────────────────────
   Case notes: a well-kept clinical notebook.
   Warm paper, ink-blue type, a red pen for gaps and fixes,
   highlighter for where you are, ward-sticker labels.

   Sections: tokens · shell and navigation · page header · sheets and
   labels · forms · buttons · Home · applications and insights · profile
   entries and form templates · writing and review · interview · CV
   builder · account · overlays (sign-in, dialogs, toast, activity,
   progress) · phone view · small screens · print.
   ───────────────────────────────────────────────────────────── */

/* Interface fonts: self-hosted Latin WOFF2 from Fontsource (scripts/vendor.mjs); no request to Google. */
@font-face { font-family: 'Newsreader'; src: url('/fonts/web-5.3.0/newsreader-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('/fonts/web-5.3.0/newsreader-500-normal.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('/fonts/web-5.3.0/newsreader-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('/fonts/web-5.3.0/newsreader-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('/fonts/web-5.3.0/ibm-plex-sans-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('/fonts/web-5.3.0/ibm-plex-sans-500-normal.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('/fonts/web-5.3.0/ibm-plex-sans-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/web-5.3.0/ibm-plex-mono-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/web-5.3.0/ibm-plex-mono-500-normal.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/web-5.3.0/ibm-plex-mono-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Caveat'; src: url('/fonts/web-5.3.0/caveat-500-normal.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }

/* CV fonts: self-hosted so the preview and the PDF use the identical files.
   Only the CV builder uses them, so they are fetched when its preview first renders. */
@font-face { font-family: 'CV Sans'; src: url('/fonts/IBMPlexSans-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: block; }
@font-face { font-family: 'CV Sans'; src: url('/fonts/IBMPlexSans-Italic.ttf') format('truetype'); font-weight: 400; font-style: italic; font-display: block; }
@font-face { font-family: 'CV Sans'; src: url('/fonts/IBMPlexSans-Medium.ttf') format('truetype'); font-weight: 500; font-display: block; }
@font-face { font-family: 'CV Sans'; src: url('/fonts/IBMPlexSans-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: block; }
@font-face { font-family: 'CV Sans'; src: url('/fonts/IBMPlexSans-Bold.ttf') format('truetype'); font-weight: 700; font-display: block; }
@font-face { font-family: 'CV Serif'; src: url('/fonts/IBMPlexSerif-Regular.ttf') format('truetype'); font-weight: 400; font-display: block; }
@font-face { font-family: 'CV Serif'; src: url('/fonts/IBMPlexSerif-Medium.ttf') format('truetype'); font-weight: 500; font-display: block; }
@font-face { font-family: 'CV Serif'; src: url('/fonts/IBMPlexSerif-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: block; }

/* ── Tokens ─────────────────────────────────────────────────── */

:root {
  --paper: #F4F0E6;
  --paper-2: #ECE6D6;
  --sheet: #FFFDF8;
  --rule: #DCE3EE;
  --margin: #E3A39B;
  --line: rgba(28, 42, 68, .14);
  --line-2: rgba(28, 42, 68, .26);

  --ink: #1C2A44;
  --ink-2: #44526F;
  --ink-3: #6B7590;

  --pen: #B3261E;
  --pen-bg: #FBEAE6;
  --ok: #2E6A4E;
  --ok-bg: #E3EFE6;
  --amber: #8E5B00;
  --amber-bg: #FBEFD5;
  --info: #2D4E8A;
  --info-bg: #E6ECF7;
  --hl: #FFF09A;
  --scrim: rgba(18, 25, 42, .5);

  --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --hand: 'Caveat', 'Segoe Print', cursive;
  --cv-sans: 'CV Sans', 'IBM Plex Sans', sans-serif;
  --cv-serif: 'CV Serif', Georgia, serif;

  --r: 4px;
  --shadow: 0 1px 0 rgba(28, 42, 68, .06), 0 2px 0 -1px var(--sheet), 0 3px 0 -1px var(--line);
  --lift: 0 10px 30px -12px rgba(28, 42, 68, .25);
  color-scheme: light;
}

/* Night shift */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12192A; --paper-2: #0D1321; --sheet: #182237;
    --rule: #22304B; --margin: #6E3A3A;
    --line: rgba(216, 224, 240, .12); --line-2: rgba(216, 224, 240, .24);
    --ink: #E7EAF2; --ink-2: #B5BED3; --ink-3: #8790A8;
    --pen: #FF8A7A; --pen-bg: rgba(255, 138, 122, .12);
    --ok: #7FD1A8; --ok-bg: rgba(127, 209, 168, .12);
    --amber: #F2C063; --amber-bg: rgba(242, 192, 99, .12);
    --info: #9DB8F2; --info-bg: rgba(157, 184, 242, .12);
    --hl: rgba(255, 228, 92, .22);
    --scrim: rgba(0, 0, 0, .55);
    --shadow: 0 1px 0 rgba(0, 0, 0, .3);
    --lift: 0 10px 30px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden], .hidden { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  /* faint paper grain */
  background-image: radial-gradient(rgba(28, 42, 68, .035) 1px, transparent 1px);
  background-size: 3px 3px;
}
a { color: var(--info); text-underline-offset: 2px; }
::selection { background: var(--hl); color: var(--ink); }
:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
h4, .h4 { font-family: var(--mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin: 18px 0 8px; }
.loading { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; text-align: center; }
.loading .logo-stamp { width: 48px; height: 48px; font-size: 12px; }
.loading-name { font-family: var(--serif); font-weight: 500; font-size: 44px; line-height: 1.05; max-width: 7em; text-wrap: balance; }
.loading-msg { color: var(--ink-3); font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; }
.loading-help { max-width: 34em; color: var(--ink-2); font-size: 14px; }
.loading-retry { font: inherit; font-size: 14px; font-weight: 500; padding: 10px 18px; border-radius: var(--r); border: 1px solid var(--ink); background: var(--ink); color: var(--sheet); cursor: pointer; }

/* ── Shell and navigation ───────────────────────────────────── */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; min-width: 248px; height: 100vh; position: sticky; top: 0;
  display: flex; flex-direction: column; overflow-y: auto;
  background: var(--paper-2);
  border-right: 1px solid var(--line);
}
.sidebar-header { padding: 16px 20px 6px; display: flex; gap: 12px; align-items: center; }
.logo-stamp {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid var(--pen); color: var(--pen);
  display: grid; place-items: center; transform: rotate(-8deg);
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .04em;
  box-shadow: inset 0 0 0 2px var(--paper-2), inset 0 0 0 3px var(--pen);
}
.sidebar-logo { font-family: var(--serif); font-size: 18px; line-height: 1.1; font-weight: 500; }
.sidebar-nav { padding: 6px 12px 16px; flex: 1; }
.nav-group-label {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); padding: 11px 8px 4px; border-bottom: 1px dashed var(--line-2); margin-bottom: 4px;
}
.nav-item {
  display: flex; align-items: baseline; justify-content: flex-start; gap: 10px; width: 100%;
  padding: 4px 8px; border: 0; border-radius: var(--r); background: none;
  font: inherit; font-size: 14px; color: var(--ink-2); text-align: left; cursor: pointer;
}
.nav-num { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); min-width: 16px; }
.nav-num.done { color: var(--ok); }
.nav-count { font: 500 10.5px var(--mono); color: var(--ink-3); min-width: 16px; text-align: right; order: 2; margin-left: auto; }
.nav-count:not(:empty) { font-size: 10px; }
.nav-item:hover { color: var(--ink); background: rgba(28, 42, 68, .05); }
.nav-item.active { color: var(--ink); font-weight: 500; }
.nav-item.active .nav-label {
  /* highlighter stroke */
  background: linear-gradient(transparent 52%, var(--hl) 52%, var(--hl) 92%, transparent 92%);
  padding: 0 2px; margin: 0 -2px;
}
.nav-item.active .nav-num { color: var(--pen); }
.nav-cta { color: var(--info); font-weight: 500; }

/* The open application sits in a folder bracket with its steps */
.nav-current { margin: 8px 0 2px; }
.app-switch { margin: 0; border: 1px solid var(--line-2); border-radius: var(--r) var(--r) 0 0; background: var(--sheet); position: relative; }
.app-switch > summary { list-style: none; cursor: pointer; padding: 8px 30px 8px 10px; display: flex; flex-direction: column; gap: 1px; position: relative; }
.app-switch > summary::-webkit-details-marker { display: none; }
.app-switch > summary::after { content: '▾'; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 12px; }
.app-switch[open] > summary::after { content: '▴'; }
.app-switch-label { font-family: var(--serif); font-size: 15px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.app-switch-sub { font-size: 11.5px; color: var(--ink-3); }
.app-switch-menu, .user-menu-list { border-top: 1px solid var(--line); padding: 4px; display: grid; gap: 2px; }
.app-switch-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; border: 0; background: none; border-radius: var(--r); padding: 6px 8px; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; }
.app-switch-item:hover { background: var(--paper-2); }
.app-switch-item .muted { font-size: 11.5px; }
.app-switch-item.new { color: var(--info); font-weight: 500; }
.app-switch-item.danger { color: var(--pen); }
.nav-steps { border: 1px solid var(--line-2); border-top: 0; border-radius: 0 0 var(--r) var(--r); padding: 4px; background: color-mix(in srgb, var(--sheet) 45%, transparent); }
.nav-steps .nav-item { align-items: center; }
.nav-steps .nav-num { width: 18px; height: 18px; min-width: 18px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; font-size: 10px; line-height: 1; }
.nav-steps .nav-num.done { border-color: var(--ok); background: var(--ok-bg); }
.nav-steps .nav-item.active .nav-num { border-color: var(--pen); color: var(--pen); background: var(--sheet); }
.nav-current .nav-cta { border: 1px dashed var(--line-2); border-top: 0; border-radius: 0 0 var(--r) var(--r); padding: 8px 10px; }

/* Account menu at the foot of the sidebar */
.user-menu { position: sticky; bottom: 0; background: var(--paper-2); border-top: 1px solid var(--line); }
.user-menu > summary { list-style: none; cursor: pointer; border-top: 0; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover { background: rgba(28, 42, 68, .04); }
.user-menu-list { background: var(--sheet); }
.user-bar { padding: 12px 16px; display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: var(--sheet); border: 1px solid var(--line-2); font-family: var(--mono); font-size: 11.5px; font-weight: 600;
}
.user-meta { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-caret { color: var(--ink-3); font-size: 16px; padding: 0 4px; }
.save-status { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.save-status::before { content: '●'; margin-right: 5px; color: var(--ok); }
.save-status[data-state="pending"]::before { color: var(--amber); }
.save-status[data-state="error"] { color: var(--pen); font-weight: 600; }
.save-status[data-state="error"]::before { color: var(--pen); }

.main { flex: 1; min-width: 0; padding: 22px 40px 96px; }
.main > * { max-width: 1120px; }
.topbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; min-height: 26px; }
.topbar .nav-toggle { display: none; }

/* Breadcrumb, step sub-tabs and previous/next */
.crumbs { display: flex; flex-wrap: nowrap; align-items: baseline; gap: 6px; font-size: 13px; color: var(--ink-3); min-width: 0; overflow: hidden; }
.crumbs > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.crumbs > span:nth-child(3):not(.here) { flex-shrink: 1; min-width: 3em; }
.crumbs .here { flex-shrink: 0; color: var(--ink); font-weight: 500; }
.crumbs .sep { color: var(--line-2); }
.subtabs { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 14px; }
.subtab { font: inherit; font-size: 13.5px; color: var(--ink-2); background: none; border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 14px; cursor: pointer; }
.subtab:hover { background: var(--sheet); color: var(--ink); }
.subtab.active { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
.step-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--rule); }

/* Workflow: file-divider tabs. The sidebar lists the steps; these only appear when it is tucked away. */
.workflow-strip { display: flex; gap: 2px; flex-wrap: wrap; align-items: flex-end; border-bottom: 2px solid var(--ink); padding-left: 6px; margin-bottom: 22px; }
@media (min-width: 961px) { .workflow-strip { display: none !important; } }
.workflow-step {
  display: flex; align-items: baseline; gap: 8px; padding: 7px 14px 6px; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--ink-2);
  background: var(--paper-2); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 6px 6px 0 0;
  transform: translateY(1px); transition: background .15s, padding .15s;
}
.workflow-step:hover { background: var(--sheet); }
.workflow-step.active { background: var(--ink); border-color: var(--ink); color: var(--sheet); font-weight: 500; padding-top: 9px; }
.workflow-step-num { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.workflow-step.active .workflow-step-num { color: var(--hl); }
.workflow-step.complete .workflow-step-num { color: var(--ok); }

/* ── Page header: ward sticker + serif title on a ruled line ── */

.page { display: none; }
.page.active { display: block; animation: settle .25s ease-out; }
@keyframes settle { from { opacity: 0; transform: translateY(4px); } }
.page-header { position: relative; margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--rule); }
.page-header::after { content: ''; position: absolute; left: 0; right: 0; bottom: -4px; border-bottom: 1px solid var(--rule); }
.eyebrow {
  display: inline-block; font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-2); background: var(--sheet); border: 1px solid var(--line-2); border-radius: 2px; padding: 2px 7px; margin-bottom: 10px;
}
.page-title { font-family: var(--serif); font-weight: 500; font-size: 34px; line-height: 1.1; letter-spacing: -.01em; margin-bottom: 6px; }
.page-desc { color: var(--ink-2); font-size: 14px; max-width: 68ch; }

/* ── Sheets (cards), labels and small figures ───────────────── */

.card, .review-pane {
  position: relative; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r);
  padding: 20px 22px 20px 30px; margin-bottom: 18px; box-shadow: var(--shadow);
}
/* red margin rule down the left of every sheet */
.card::before, .review-pane::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: 16px; border-left: 1px solid var(--margin); opacity: .55;
}
.card-title {
  font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.card-title .spacer { flex: 1; }
.card-sub { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 16px 0 8px; }
.split { display: grid; grid-template-columns: 1.2fr .9fr; gap: 18px; align-items: start; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.review-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; align-items: start; }
.split > *, .cols-2 > *, .review-grid > * { min-width: 0; }

.tip {
  position: relative; background: var(--info-bg); color: var(--ink); border-radius: var(--r);
  padding: 10px 14px 10px 40px; margin-bottom: 16px; font-size: 13.5px;
}
.tip::before { content: 'i'; position: absolute; left: 14px; top: 10px; width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid var(--info); color: var(--info); font: 600 11px/14px var(--mono); text-align: center; }
.tip.warn { background: var(--amber-bg); }
.tip.warn::before { content: '!'; border-color: var(--amber); color: var(--amber); }
.tip ul { margin: 4px 0 0 18px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.center { text-align: center; }
.warn-text { color: var(--amber); }
.hr { height: 1px; background: var(--rule); margin: 16px 0; }
.note-box {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
  padding: 10px 12px; margin-bottom: 10px; white-space: pre-wrap;
}
.empty-state { padding: 22px; border: 1.5px dashed var(--line-2); border-radius: var(--r); background: transparent; }
.empty-state-title { font-family: var(--serif); font-size: 18px; margin-bottom: 2px; }
/* Inside a sheet the dashed box is one frame too many: the sheet is the frame. */
.card > .empty-state { border: 0; padding: 0; }

/* Stamped labels */
.badge {
  display: inline-block; font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  padding: 1px 6px; border: 1.5px solid currentColor; border-radius: 3px; line-height: 1.5; white-space: nowrap;
}
.badge-green { color: var(--ok); background: var(--ok-bg); }
.badge-amber { color: var(--amber); background: var(--amber-bg); }
.badge-red { color: var(--pen); background: var(--pen-bg); transform: rotate(-2deg); }
.badge-blue { color: var(--info); background: var(--info-bg); }
.status-stamp { font: 700 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; padding: 6px 10px; border: 2.5px solid currentColor; border-radius: 4px; transform: rotate(4deg); flex-shrink: 0; margin-top: 4px; }
.status-stamp.green { color: var(--ok); } .status-stamp.amber { color: var(--amber); } .status-stamp.red { color: var(--pen); } .status-stamp.blue { color: var(--info); }

/* Red-pen handwritten annotation */
.pen { font-family: var(--hand); font-size: 19px; line-height: 1.1; color: var(--pen); font-weight: 500; }
.pen-strike { text-decoration: line-through; text-decoration-color: var(--pen); text-decoration-thickness: 2px; }

.criteria-card { background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--line-2); border-radius: var(--r); padding: 10px 12px; margin-bottom: 8px; }
.criteria-card.pen-note { border-left-color: var(--pen); }
.check-row { padding: 8px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.check-row:last-child { border-bottom: 0; }

/* Figures and tables: counts are one ruled tally sheet, never separate tiles */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; background: var(--sheet); border: 1px solid var(--line); border-top: 3px double var(--line-2); border-radius: var(--r); box-shadow: var(--shadow); }
.stat { padding: 12px 18px 11px; border-left: 1px solid var(--rule); display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 2px; }
.stat:first-child { border-left: 0; }
.stat-value { font-family: var(--serif); font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 10px 8px; vertical-align: top; border-bottom: 1px solid var(--rule); }
.table th { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); border-bottom: 2px solid var(--line-2); }
.toolbar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .field { min-width: 180px; margin: 0; }
.meter { height: 8px; border-radius: 4px; background: var(--paper-2); overflow: hidden; margin-bottom: 6px; }
.meter i { display: block; height: 100%; background: var(--ok); }
.meter i.hot { background: var(--pen); }

/* Criteria checklist: tick, half, cross (criteria match and "Should I apply?") */
.crit-list { list-style: none; }
.crit { display: grid; grid-template-columns: 26px 1fr minmax(0, .9fr); gap: 4px 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.crit:last-child { border-bottom: 0; }
.crit-mark { font: 600 18px/1.2 var(--mono); text-align: center; }
.crit.strong .crit-mark { color: var(--ok); }
.crit.partial .crit-mark { color: var(--amber); }
.crit.gap .crit-mark { color: var(--pen); }
.crit.unchecked .crit-mark { color: var(--info); }
.crit-text { font-weight: 500; }
.crit-text .badge { margin-left: 6px; vertical-align: 1px; }
.crit-evidence { font-size: 13px; color: var(--ink-2); }
.crit-evidence div::before { content: '↳ '; color: var(--ink-3); }
.crit-note { grid-column: 2 / -1; font-size: 13px; color: var(--ink-2); }
.crit.gap .crit-note { font-family: var(--hand); font-size: 19px; line-height: 1.2; color: var(--pen); }
.screen-unlikely { border-left: 3px solid var(--pen); }
.screen-check { border-left: 3px solid var(--amber); }
.screen-good { border-left: 3px solid var(--ok); }
.screen-verdict { font-size: 15px; margin: 2px 0 4px; }

/* ── Forms ──────────────────────────────────────────────────── */

.field-grid { display: grid; gap: 12px 16px; margin-bottom: 12px; }
.fg-2 { grid-template-columns: 1fr 1fr; }
.fg-3 { grid-template-columns: 2fr 1fr 1fr; }
.fg-4 { grid-template-columns: repeat(3, 1fr) auto; align-items: end; }
.full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field-grid .field { margin-bottom: 0; }
.field > span { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.field small { font-size: 12px; }
.field input, .field textarea, .field select {
  font: inherit; font-size: 14px; color: var(--ink); width: 100%;
  background: var(--sheet); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: var(--r);
  padding: 8px 10px; transition: border-color .15s, box-shadow .15s;
}
.field input[type=range], .field input[type=file] { border: 0; padding: 4px 0; background: none; }
.field input[type=range] { accent-color: var(--ink); }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--info); box-shadow: 0 0 0 3px var(--info-bg); }
.field textarea { resize: vertical; line-height: 1.55; }
.field input::placeholder, .field textarea::placeholder { color: var(--ink-3); opacity: .8; }
.url-row { display: flex; gap: 8px; }
.url-row input { flex: 1; min-width: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { accent-color: var(--ink); width: 15px; height: 15px; }
.check-list .check { padding: 6px 0; }
.toggle-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 14px; margin: 10px 0; }
/* A checkbox in a row of fields sits on the fields' baseline, at their height. */
.fg-4 .pack-check { align-self: end; min-height: 38px; padding-bottom: 0; }
input[type=file] { font: inherit; font-size: 13px; color: var(--ink-3); max-width: 100%; }
input[type=file]::file-selector-button {
  font: inherit; font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; margin-right: 10px;
  padding: 6px 13px; border-radius: var(--r); border: 1px dashed var(--line-2); background: var(--paper);
}
input[type=file]::file-selector-button:hover { background: var(--paper-2); border-style: solid; }

/* The writing surface: ruled like a notepad */
.editor textarea[data-bind] {
  --lh: 28px;
  font-family: var(--serif); font-size: 16.5px; line-height: var(--lh);
  padding: 4px 14px 14px; border-bottom-width: 1px;
  background-color: var(--sheet);
  background-image: linear-gradient(transparent calc(var(--lh) - 1px), var(--rule) calc(var(--lh) - 1px));
  background-size: 100% var(--lh); background-position: 0 4px; background-attachment: local;
}
/* Writing toolbar: the instruction sits with the buttons it steers */
.editor .btn-row .push { margin-left: auto; }
.editor > .btn-row { margin-bottom: 14px; }

/* ── Buttons ────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; text-decoration: none;
  font: inherit; font-size: 13.5px; font-weight: 500; color: var(--ink);
  padding: 7px 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--sheet);
  box-shadow: 0 1px 0 var(--line); transition: transform .08s, background .15s;
}
.btn:hover:not(:disabled) { background: var(--paper-2); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--sheet); box-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.btn-primary:hover:not(:disabled) { background: var(--ink-2); }
.btn-danger { color: var(--pen); border-color: color-mix(in srgb, var(--pen) 40%, transparent); background: var(--sheet); }
.btn-danger:hover:not(:disabled) { background: var(--pen-bg); }
.btn-quiet { background: none; border-color: transparent; box-shadow: none; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.btn-quiet:hover:not(:disabled) { background: none; color: var(--ink); text-decoration-color: currentColor; }
.btn-xs { padding: 3px 9px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; padding: 10px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.btn-row.tight { margin-top: 0; }
.inline-actions { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.spinner { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Home ───────────────────────────────────────────────────── */

#pg-workspace .page-header { border: 0; margin-bottom: 4px; padding: 0; }
#pg-workspace .page-header::after { display: none; }
.home-greet { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--rule); }
.greet { font-family: var(--serif); font-weight: 500; font-size: 34px; line-height: 1.1; }
.home-greet .quick { display: flex; gap: 8px; flex-wrap: wrap; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.home-main, .home-side { min-width: 0; }

.home-hero { padding-top: 22px; }
.hero-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.hero-title { font-family: var(--serif); font-weight: 500; font-size: 24px; line-height: 1.2; margin: 0 0 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.hero-meta { color: var(--ink-2); }
.hero-due { margin-top: 6px; }
.hero-due .muted { margin-left: 6px; }
.due { font-weight: 500; }
.due.urgent { font-size: 20px; }
.due.past { color: var(--ink-3); }

.track { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); margin: 20px 0 16px; position: relative; }
.track::before { content: ''; position: absolute; left: 10%; right: 10%; top: 14px; border-top: 2px dashed var(--line-2); }
.track li { position: relative; text-align: center; }
.track button { background: none; border: 0; cursor: pointer; font: inherit; color: var(--ink-3); display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.track .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--sheet); border: 2px solid var(--line-2); font: 600 12px var(--mono); position: relative; }
.track .done .dot { background: var(--ok); border-color: var(--ok); color: var(--sheet); }
.track .next .dot { border-color: var(--ink); color: var(--ink); background: var(--sheet); box-shadow: 0 0 0 4px var(--hl); }
.track .done button, .track .next button { color: var(--ink); }
.track-label { font-size: 12.5px; line-height: 1.2; }
.next-do { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--ink); border-radius: var(--r); }
.next-do .eyebrow { margin-bottom: 6px; }
.next-title { font-family: var(--serif); font-size: 19px; line-height: 1.2; }
.hero-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.hstat { display: flex; flex-direction: column; gap: 3px; text-align: left; font: inherit; color: var(--ink); background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; cursor: pointer; }
.hstat:hover { border-color: var(--line-2); background: var(--paper); }
.hstat-k { font: 500 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.hstat-v { font-size: 13.5px; }
.hstat b.ok { color: var(--ok); } .hstat b.amber { color: var(--amber); } .hstat b.gap { color: var(--pen); }
.answer-bars { display: flex; gap: 4px; margin-top: 3px; }
.abar { flex: 1; height: 6px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.abar i { display: block; height: 100%; background: var(--ink-3); }
.abar.some i { background: var(--ok); }
.abar.over i { background: var(--pen); }

.pipeline { display: grid; grid-template-columns: repeat(5, 1fr); margin-bottom: 12px; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.pipe { display: flex; flex-direction: column; align-items: center; padding: 8px 4px 7px; border-left: 1px dashed var(--line); }
.pipe:first-child { border-left: 0; }
.pipe-n { font-family: var(--serif); font-size: 24px; line-height: 1; }
.pipe-l { font: 500 9.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-top: 4px; text-align: center; }
.app-rows { list-style: none; }
.app-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: var(--ink); background: none; border: 0; border-bottom: 1px dashed var(--line); padding: 9px 2px; cursor: pointer; }
.app-row:hover { background: var(--paper); }
.app-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-row-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-track { display: flex; gap: 3px; flex-shrink: 0; }
.mini-track i { width: 8px; height: 8px; border-radius: 50%; background: var(--paper-2); border: 1px solid var(--line-2); }
.mini-track i.on { background: var(--ok); border-color: var(--ok); }

.strength { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--paper-2) 0); }
.ring span { width: 50px; height: 50px; border-radius: 50%; background: var(--sheet); display: grid; place-items: center; font: 600 14px var(--mono); }
.todo { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: var(--r); padding: 8px 10px; margin-bottom: 6px; cursor: pointer; }
.todo:hover { border-color: var(--line-2); }
.todo-title { font-weight: 500; font-size: 13.5px; }
.gap-todo { border-left-color: var(--pen); }
.home-edited { text-align: right; }

.onboard-list { list-style: none; }
.onboard-list li { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.onboard-list li:last-child { border-bottom: 0; }
.onboard-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--ink); font: 600 13px var(--mono); }
.onboard-list li.done .onboard-n { background: var(--ok); border-color: var(--ok); color: var(--sheet); }
.onboard-list li.done .todo-title { text-decoration: line-through; color: var(--ink-3); }

/* Specialty training dates */
.deadlines .card-title, .jobs .card-title { justify-content: space-between; }
.deadline-list { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 8px; }
.deadline { display: grid; grid-template-columns: 74px 1fr; gap: 10px; align-items: start; font-size: 13.5px; }
.deadline-days { font: 600 12px/1.2 var(--mono); color: var(--ink-2); background: var(--paper-2); border-radius: var(--r); padding: 4px 6px; text-align: center; }
.deadline.near .deadline-days { background: var(--amber-bg); color: var(--amber); }
.deadline.urgent .deadline-days { background: var(--pen-bg); color: var(--pen); }
.deadline-msra { border-left: 3px solid var(--info); background: var(--info-bg); padding: 6px 8px; border-radius: var(--r); margin-bottom: 8px; }
.deadline-banner { background: var(--pen-bg); border: 1px solid var(--pen); color: var(--ink); border-radius: var(--r); padding: 10px 14px; margin-bottom: 14px; }
.deadline-status { margin: 6px 0; }
.deadline-status.stale { border-left: 3px solid var(--amber); background: var(--amber-bg); padding: 6px 8px; border-radius: var(--r); color: var(--ink); }
.interest-row { display: grid; grid-template-columns: 1fr minmax(150px, 220px) auto; gap: 6px; margin-bottom: 6px; }

/* New jobs */
.job-list { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 2px; }
.job-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; padding: 8px 0; border-top: 1px dashed var(--line); }
.job-row a { color: var(--ink); text-decoration: none; }
.job-row a:hover { text-decoration: underline; }
.job-row.urgent strong:last-child { color: var(--pen); }
.job-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

@media (max-width: 1180px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
  .home-side > .card { margin-bottom: 0; }
  .home-edited { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
  .home-side { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(3, 1fr); }
  .greet { font-size: 28px; }
  .track-label { font-size: 11px; }
  .next-do { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 720px) { .job-row { grid-template-columns: 1fr; } .job-actions { justify-content: flex-start; } }

/* ── All applications and insights ──────────────────────────── */

.app-card.active { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--ink), var(--shadow); }
.app-head { cursor: default; }
.app-head-tools { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.status-select { font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 5px 8px; border-radius: 3px; border: 1.5px solid currentColor; background: var(--sheet); cursor: pointer; }
.status-green { color: var(--ok); } .status-red { color: var(--pen); } .status-blue { color: var(--info); } .status-amber { color: var(--amber); }
.app-more { border-top: 1px dashed var(--line); }
.app-more > summary { cursor: pointer; list-style: none; padding: 7px 16px; font-size: 12.5px; color: var(--ink-3); }
.app-more > summary::-webkit-details-marker { display: none; }
.app-more > summary::before { content: '+ '; font-family: var(--mono); }
.app-more[open] > summary::before { content: '– '; }
.app-more > .field-grid { padding: 4px 16px 16px; }

.insight { border-top: 1px dashed var(--line); padding: 10px 0; display: grid; gap: 4px; }
.insight.top .insight-head strong { color: var(--pen); }
.insight-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.insight-count { font: 500 12px/1.4 var(--mono); color: var(--ink-3); }
.insight-bar { height: 6px; background: var(--paper-2); border-radius: 3px; overflow: hidden; }
.insight-bar span { display: block; height: 100%; background: var(--pen); border-radius: 3px; }
.factor { border-top: 1px dashed var(--line); padding: 10px 0; }
.factor-row { display: grid; grid-template-columns: minmax(140px, 1fr) 130px minmax(80px, 160px); gap: 10px; align-items: center; font-size: 13.5px; padding: 2px 0; }
.factor-n { font: 500 12px/1.4 var(--mono); color: var(--ink-3); }

/* ── Profile entries (index cards) and form templates ───────── */

.entity-card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; box-shadow: var(--shadow); }
.entity-card[open] { box-shadow: var(--lift); }
.entity-card.active { border-color: var(--ink); }
.entity-head { padding: 12px 16px; display: flex; justify-content: space-between; gap: 12px; align-items: center; cursor: pointer; list-style: none; }
.entity-head::-webkit-details-marker { display: none; }
details > .entity-head::before { content: ''; width: 7px; height: 7px; flex-shrink: 0; border-right: 1.5px solid var(--ink-2); border-bottom: 1.5px solid var(--ink-2); transform: rotate(-45deg); margin: 0 2px 0 -2px; transition: transform .15s; }
details[open] > .entity-head::before { transform: rotate(45deg) translate(-2px, -2px); }
.entity-head > div:first-of-type { flex: 1; min-width: 0; }
.entity-title { font-family: var(--serif); font-size: 17px; font-weight: 500; }
.entity-meta { font-size: 12.5px; color: var(--ink-3); }
.entity-body { padding: 16px; border-top: 1px dashed var(--line-2); }
/* Row tools stay quiet until the row is pointed at or opened */
.entity-head .inline-actions .btn { background: none; border-color: transparent; box-shadow: none; color: var(--ink-3); }
.entity-head .inline-actions .btn:hover:not(:disabled) { background: var(--paper-2); border-color: var(--line-2); color: var(--ink); }
.entity-head .inline-actions .btn-danger { color: var(--pen); }
@media (hover: hover) {
  details.entity-card:not([open]) > .entity-head { position: relative; }
  details.entity-card:not([open]) > .entity-head .inline-actions {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%); opacity: 0; pointer-events: none;
    background: var(--sheet); padding: 4px 0 4px 14px; box-shadow: -14px 0 12px -6px var(--sheet); transition: opacity .12s;
  }
  details.entity-card:not([open]):hover > .entity-head .inline-actions, details.entity-card:not([open]):focus-within > .entity-head .inline-actions { opacity: 1; pointer-events: auto; }
}
.versions summary { cursor: pointer; margin: 12px 0 8px; color: var(--ink-2); font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; }

/* Application form templates: copyable facts, reusable answers, criteria groups */
.form-section .card-title { margin-bottom: 4px; }
.copy-entry { border: 1px solid var(--line); border-radius: var(--r); background: var(--sheet); padding: 8px 10px; margin: 8px 0; }
.copy-entry-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.copy-row { display: grid; grid-template-columns: minmax(120px, 30%) 1fr auto; gap: 10px; align-items: start; padding: 4px 0; border-top: 1px dashed var(--line); font-size: 13.5px; }
.copy-row:first-of-type { border-top: 0; }
.copy-label { color: var(--ink-3); font: 500 12px/1.4 var(--sans); }
.copy-value { white-space: pre-wrap; word-break: break-word; }
.copy-btn { align-self: center; }
.reusable-block .small.muted { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.group-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.group-chip { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line-2); border-radius: var(--r); padding: 2px 4px; background: var(--sheet); }
.group-chip input { border: 0; background: transparent; font: inherit; width: 150px; padding: 2px 4px; }
.assign-list { display: grid; gap: 6px; }
.assign-row { display: grid; grid-template-columns: auto 1fr minmax(140px, 200px); gap: 8px; align-items: center; font-size: 13.5px; }
@media (max-width: 720px) { .copy-row { grid-template-columns: 1fr auto; } .copy-label { grid-column: 1 / -1; } .assign-row { grid-template-columns: auto 1fr; } .assign-row select { grid-column: 1 / -1; } }

/* Answer library: similar answers written before */
.library { margin-top: 8px; border: 1px dashed var(--line-2); border-radius: var(--r); padding: 6px 10px; background: var(--paper); }
.library-hit { border-top: 1px dashed var(--line); padding: 8px 0; display: grid; gap: 4px; }
.library-hit .note-box { max-height: 120px; overflow: auto; }

/* ── Writing and review ─────────────────────────────────────── */

.source-line { margin: -4px 0 10px; }
.word-status { font-family: var(--mono); font-size: 11.5px; padding: 2px 8px; border-radius: 3px; background: var(--paper-2); color: var(--ink-2); }
.word-status.ok { background: var(--ok-bg); color: var(--ok); }
.word-status.danger { background: var(--pen-bg); color: var(--pen); font-weight: 600; }
.output-origin { font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--info); border: 1px solid currentColor; border-radius: 3px; padding: 1px 6px; }
.output-origin-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ai-meta { display: grid; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.page-meta-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.review-pane .note-box { font-family: var(--serif); font-size: 16px; line-height: 1.6; background: var(--sheet); }
.review-verdict { margin-top: 12px; }
.prose { font-size: 15px; }
.prose h3, .prose h4, .prose h5 { font-family: var(--serif); font-size: 21px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink); margin: 22px 0 6px; }
.prose p { margin: 6px 0; max-width: 72ch; }
.prose ul, .prose ol { margin: 6px 0 6px 22px; max-width: 72ch; }

/* Cover letter */
.pitch { border-left: 3px solid var(--pen); }
.pitch-diff { font: italic 17px/1.4 var(--serif); color: var(--ink); margin: 4px 0 10px; }
.pitch-list { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 8px; }
.pitch-list li::marker { color: var(--pen); font-weight: 600; }
.letter-preview { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; margin-bottom: 12px; font-family: var(--serif); display: grid; gap: 8px; }
.letter-line { font-size: 15px; }

/* ── Interview: mock panel and the ChatGPT pack ─────────────── */

.mock-lede { font-size: 15px; margin-bottom: 14px; max-width: 70ch; }
.mock-progress { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.mock-dot { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--sheet); font: 600 12px var(--mono); color: var(--ink-2); cursor: pointer; }
.mock-dot.active { border-color: var(--ink); background: var(--ink); color: var(--sheet); }
.mock-dot.scored.s4, .mock-dot.scored.s3 { border-color: var(--ok); color: var(--ok); }
.mock-dot.scored.s2 { border-color: var(--amber); color: var(--amber); }
.mock-dot.scored.s1, .mock-dot.scored.s0 { border-color: var(--pen); color: var(--pen); }
.mock-dot.active.scored { color: var(--sheet); }
.panel-says { border-left: 3px solid var(--ink); padding: 4px 0 4px 16px; margin: 4px 0 16px; }
.mock-question { font-family: var(--serif); font-size: 22px; line-height: 1.35; }
.follow-up .panel-says p { font-family: var(--serif); font-size: 19px; }
.follow-up { margin-top: 18px; padding-top: 16px; border-top: 2px dashed var(--line-2); }
.answer-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.timer { font: 600 15px var(--mono); min-width: 44px; }
.timer.over { color: var(--pen); }
.mock-answer { font-family: var(--serif) !important; font-size: 16px !important; line-height: 1.6 !important; }
.why { margin-bottom: 12px; }
.why summary, .better summary { cursor: pointer; color: var(--info); }
.feedback { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--rule); }
.feedback-head { display: flex; gap: 16px; align-items: center; }
.feedback-head p { font-size: 15px; }
.score-stamp { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 74px; padding: 6px 8px; border: 2.5px solid currentColor; border-radius: 6px; font: 700 22px/1 var(--mono); transform: rotate(-3deg); flex-shrink: 0; }
.score-stamp small { font: 600 9.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; margin-top: 3px; }
.score-stamp.green { color: var(--ok); } .score-stamp.amber { color: var(--amber); } .score-stamp.red { color: var(--pen); }
.check-row .score-stamp { min-width: 60px; font-size: 15px; padding: 3px 6px; margin-left: auto; transform: none; }
.fb-list { margin: 4px 0 8px 18px; }
.fb-list li { margin-bottom: 4px; }
.fb-list.good li::marker { content: '✓  '; color: var(--ok); }
.fb-list.miss li::marker { content: '✗  '; color: var(--pen); }
.red-flags { background: var(--pen-bg); border: 1.5px solid var(--pen); border-radius: var(--r); padding: 10px 14px; margin: 14px 0; color: var(--pen); }
.red-flags ul { margin: 4px 0 0 18px; color: var(--ink); }
.better { margin: 10px 0; }
.pack-card .field-grid { margin-top: 12px; }
.pack-preview pre { white-space: pre-wrap; font-family: var(--mono); font-size: 12px; max-height: 420px; overflow: auto; background: var(--paper-2); padding: 12px; border-radius: 6px; }
@media (max-width: 720px) { .fg-4 { grid-template-columns: 1fr 1fr; } }

/* ── CV builder ─────────────────────────────────────────────── */

#pg-cv { max-width: 1520px; }
.cv-workbench { display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); gap: 18px; align-items: start; }
.cv-controls .card { margin-bottom: 14px; }
.cv-viewer { position: sticky; top: 12px; min-width: 0; }
.cv-viewer-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.cv-viewer-bar .spacer { flex: 1; }
.cv-viewer-bar select { font: inherit; font-size: 12.5px; width: auto; padding: 3px 24px 3px 8px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--sheet); color: var(--ink); }
.cv-pages-wrap { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; max-height: calc(100vh - 96px); overflow: auto; }
.country-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.country-card { display: flex; flex-direction: column; gap: 1px; text-align: left; font: inherit; color: var(--ink); cursor: pointer; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 9px; }
.country-card:hover { border-color: var(--line-2); }
.country-card.active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.country-name { font-family: var(--serif); font-size: 15px; line-height: 1.15; }
.country-sub { font-size: 11px; color: var(--ink-3); }
.conventions summary { cursor: pointer; color: var(--info); }
.conventions .practice { margin-top: 8px; }
.ready-row { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.ready-msg { font-size: 13.5px; flex: 1 1 200px; }
.ready-actions { flex-basis: 100%; display: flex; gap: 6px; flex-wrap: wrap; }
.ready-note { margin-top: 10px; }
.practice { margin: 0 0 4px 18px; font-size: 13.5px; }
.practice li { margin-bottom: 6px; }
.sources { margin: 4px 0 6px 18px; font-size: 12.5px; }
.sources li { margin-bottom: 3px; }

/* Section manager */
.sec-list { border-top: 1px solid var(--rule); }
.sec-row { padding: 5px 0; border-bottom: 1px solid var(--rule); }
.sec-row.off .sec-title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-2); }
.sec-main { display: flex; align-items: center; gap: 8px; }
.sec-main input[type=checkbox] { accent-color: var(--ink); width: 15px; height: 15px; flex-shrink: 0; }
.sec-title { flex: 1; min-width: 0; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: var(--r); padding: 3px 6px; }
.sec-title:hover { border-color: var(--line); }
.sec-title:focus { outline: none; border-color: var(--info); background: var(--sheet); }
.sec-tag { font: 600 9.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 3px; padding: 0 4px; flex-shrink: 0; }
.sec-move { display: flex; gap: 2px; flex-shrink: 0; }
.sec-move .btn { padding: 1px 6px; }
.sec-items, .sec-empty { margin: 4px 0 0 23px; }
.sec-items summary { cursor: pointer; }
.sec-item { padding: 3px 0; font-size: 12.5px; align-items: flex-start; }
.sec-item input { margin-top: 3px; }

/* A4 sheets: the preview is laid out in real page geometry and printed as-is.
   The sheet is white paper whatever the app's theme, so its colours are fixed on purpose. */
.cv-sheet { position: relative; box-sizing: border-box; width: 210mm; height: 297mm; padding: 15mm 16mm 18mm; margin: 0 auto 14px; overflow: hidden; background: #fff; color: #1d1d1f; box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 8px 24px -12px rgba(0,0,0,.35); }
.cv-sheet:last-child { margin-bottom: 0; }
.cv-foot { position: absolute; left: 16mm; right: 16mm; bottom: 8mm; display: flex; justify-content: space-between; font: 7.5pt var(--cv-sans); color: #66666d; }
.cv-measure { position: absolute; left: -10000px; top: 0; visibility: hidden; pointer-events: none; }
.cv-doc { font: 10.5pt/1.45 var(--cv-sans); color: #1d1d1f; }
.cv-doc h1, .cv-doc h2 { margin: 0; }
.cv-headwrap { display: flow-root; padding-bottom: 6px; }
.cv-block { display: flow-root; }
.cv-block.cv-first { padding-top: 10px; }
.cv-head { display: flex; justify-content: space-between; gap: 18px; }
.cv-doctype { font: 600 8pt var(--cv-sans); letter-spacing: .05em; text-transform: uppercase; color: #6b6b70; }
.cv-name { font: 500 24pt/1.1 var(--cv-serif); color: #111; }
.cv-contact { margin-top: 4px; color: #444; font-size: 9.5pt; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.cv-contact span { color: #aaa; }
.cv-facts { display: flex; flex-wrap: wrap; gap: 2px 18px; margin-top: 6px; font-size: 9.5pt; }
.cv-facts div { display: flex; gap: 6px; }
.cv-facts dt { color: #6b6b70; }
.cv-facts dd { font-weight: 500; margin: 0; }
.cv-block h2 { font: 600 9pt var(--cv-sans); letter-spacing: .04em; text-transform: uppercase; color: #333; padding-bottom: 3px; border-bottom: 1px solid #c9c9cf; margin-bottom: 7px; }
.cv-block h2.cv-cont { color: #666; }
.cv-entry { padding-bottom: 7px; }
.cv-entry-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.cv-entry-title { font-weight: 600; }
.cv-entry-date { flex-shrink: 0; color: #444; font-size: 9.5pt; font-variant-numeric: tabular-nums; }
.cv-entry-sub { color: #555; font-size: 9.5pt; }
.cv-detail { margin: 2px 0 0; font-size: 9.5pt; }
.cv-summary { margin: 0 0 4px; }
.cv-bullets { margin: 3px 0 0 2px; font-size: 9.5pt; }
.cv-bl, .cv-line { display: flex; gap: 7px; }
.cv-bl { padding-bottom: 1px; }
.cv-line { padding: 0 0 3px 2px; }
.cv-dot { color: #666; flex-shrink: 0; }
.cv-doc strong { font-weight: 600; }
.cv-pdf-stage { position: absolute; left: -12000px; top: 0; pointer-events: none; }
.cv-cite { display: flex; gap: 6px; padding-bottom: 4px; }
.cv-cite-n { color: #666; min-width: 16px; }
.cv-year { color: #6b6b70; }
.cv-referee { display: inline-block; width: 48%; vertical-align: top; padding: 0 2% 8px 0; font-size: 9.5pt; }
.cv-sign { display: flex; justify-content: space-between; gap: 24px; margin-top: 22px; }
.cv-sign span { flex: 1; border-top: 1px solid #333; padding-top: 4px; font-size: 9pt; color: #444; }
.cv-photo { flex-shrink: 0; overflow: hidden; background: #f4f4f4; border: 1px solid #ddd; width: 30mm; height: 36mm; }
/* Portrait is passport-like (5:6); square and circle are 1:1. Three sizes each. */
.cv-photo.portrait.small { width: 25mm; height: 30mm; } .cv-photo.portrait.large { width: 35mm; height: 42mm; }
.cv-photo.square, .cv-photo.circle { width: 32mm; height: 32mm; }
.cv-photo.square.small, .cv-photo.circle.small { width: 26mm; height: 26mm; }
.cv-photo.square.large, .cv-photo.circle.large { width: 38mm; height: 38mm; }
.cv-photo.circle { border-radius: 50%; }
.cv-photo img { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
/* Where the photo sits: beside the name, above it, or lined up with the sidebar column. */
.cv-head.photo-left { flex-direction: row-reverse; justify-content: flex-end; }
.cv-head.photo-top { flex-direction: column-reverse; align-items: center; gap: 10px; }
.cv-head.photo-top .cv-head-main { width: 100%; }
.cv-detailed .cv-head.photo-top, .cv-american .cv-head.photo-top, .cv-sidebar .cv-head.photo-top { align-items: flex-start; }
.cv-american .cv-head.photo-left, .cv-american .cv-head.photo-right { display: flex; }
.cv-sidebar .cv-head.photo-side { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; }
.cv-sidebar .cv-head.photo-side .cv-photo { margin-left: 4mm; }

/* UK and Ireland: classic, serif name centred over a double rule */
.cv-classic .cv-head { justify-content: center; text-align: center; border-bottom: 3px double #333; padding-bottom: 10px; }
.cv-classic .cv-head-main { flex: 1; }
.cv-classic .cv-contact, .cv-classic .cv-facts { justify-content: center; }
.cv-classic .cv-block h2 { font: 600 11.5pt var(--cv-serif); letter-spacing: .02em; text-transform: none; border-bottom-color: #999; }

/* Australia and New Zealand: detailed, with the date column on the left like a registration CV */
.cv-detailed .cv-head { border-bottom: 2px solid #1d1d1f; padding-bottom: 10px; }
.cv-detailed .cv-sec-employment .cv-entry, .cv-detailed .cv-sec-education .cv-entry, .cv-detailed .cv-sec-registration .cv-entry { display: grid; grid-template-columns: 34mm 1fr; column-gap: 12px; }
.cv-detailed .cv-sec-employment .cv-entry-head, .cv-detailed .cv-sec-education .cv-entry-head, .cv-detailed .cv-sec-registration .cv-entry-head { display: contents; }
.cv-detailed .cv-sec-employment .cv-entry-date, .cv-detailed .cv-sec-education .cv-entry-date, .cv-detailed .cv-sec-registration .cv-entry-date { grid-column: 1; grid-row: 1 / span 3; color: #333; font-weight: 500; }
.cv-detailed .cv-sec-employment .cv-entry > :not(.cv-entry-head), .cv-detailed .cv-sec-education .cv-entry > :not(.cv-entry-head), .cv-detailed .cv-sec-registration .cv-entry > :not(.cv-entry-head) { grid-column: 2; }
.cv-detailed .cv-entry-title { grid-column: 2; }
.cv-detailed .cv-sec-declaration { margin-top: 18px; padding-top: 8px; border-top: 1px solid #999; }

/* US and Canada: compact, bold rules, education first */
.cv-american .cv-head { display: block; text-align: left; border-bottom: 2px solid #111; padding-bottom: 8px; }
.cv-american .cv-name { font: 700 22pt/1.1 var(--cv-sans); letter-spacing: -.01em; }
.cv-american .cv-block h2 { font: 700 10pt var(--cv-sans); color: #111; border-bottom: 1.5px solid #111; }

/* Gulf: photo and key facts at the top, sidebar for licences, skills and languages */
.cv-sidebar .cv-head { align-items: flex-start; border-bottom: 2px solid #1d1d1f; padding-bottom: 12px; }
.cv-sidebar .cv-facts { flex-direction: column; gap: 2px; }
.cv-cols { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; }
.cv-cols .cv-side { background: #f4f4f6; padding: 2mm 4mm 4mm; border-radius: 2px; min-width: 0; }
.cv-cols .cv-main { min-width: 0; }
.cv-cols .cv-side.empty { background: none; }
.cv-cols .cv-referee { display: block; width: auto; }

/* Full-screen preview */
@media (max-width: 1180px) {
  .cv-workbench { grid-template-columns: 1fr; }
  .cv-viewer { position: static; order: -1; }
  .cv-pages-wrap { max-height: 70vh; }
}
.cv-full { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--paper-2); color: var(--ink); }
.cv-full::backdrop { background: var(--scrim); }
.cv-full-bar { position: sticky; top: 0; z-index: 1; display: flex; gap: 10px; align-items: center; padding: 10px 20px; background: var(--sheet); border-bottom: 1px solid var(--line); }
.cv-full-title { font-family: var(--serif); font-size: 18px; flex: 1; }
.cv-full-pages { padding: 24px 16px 48px; overflow: auto; height: calc(100vh - 54px); }

/* ── Account: AI usage, danger zone ─────────────────────────── */

.usage-card { margin-top: 18px; }
.usage-today { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.usage-today ul { margin: 0; padding-left: 18px; }
.usage-big { font-size: 34px; font-weight: 600; line-height: 1; }
.ubars { position: relative; display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; height: 130px; align-items: end; padding-bottom: 18px; margin-top: 22px; }
.ubar { height: 100%; display: flex; flex-direction: column; align-items: center; }
.ubar-col { position: relative; flex: 1; width: 100%; max-width: 26px; }
.ubar-col i { position: absolute; bottom: 0; left: 0; right: 0; border-radius: 3px 3px 0 0; }
.ubar-col i.site, .key.site { background: var(--paper-2); outline: 1px solid var(--line); }
.ubar-col i.mine, .key.mine { background: var(--ok); }
.ubar span { font-size: 10px; color: var(--ink-3); margin-top: 3px; height: 15px; }
.ubar-cap { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--pen); pointer-events: none; }
.ubar-cap span { position: absolute; right: 0; top: -15px; font-size: 10px; color: var(--pen); }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 5px 0 10px; vertical-align: -1px; }
.key:first-child { margin-left: 0; }
.usage-table td:nth-child(n+2), .usage-table th:nth-child(n+2) { text-align: right; }
.danger-zone { margin-top: 18px; border-style: dashed; border-color: color-mix(in srgb, var(--pen) 35%, transparent); }

/* ── Sign-in: the notes folder cover ───────────────────────── */

#auth-overlay { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: inherit; }
.auth-box {
  position: relative; width: 100%; max-width: 420px; padding: 36px 36px 28px 52px;
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--lift);
}
.auth-box::before { content: ''; position: absolute; top: 0; bottom: 0; left: 30px; border-left: 1px solid var(--margin); }
.auth-box .logo-stamp { position: absolute; top: 18px; right: 20px; width: 54px; height: 54px; font-size: 12px; }
.auth-logo { font-family: var(--serif); font-size: 30px; line-height: 1.05; padding-right: 60px; }
.auth-sub { color: var(--ink-3); font-size: 13.5px; margin: 6px 0 24px; }
.auth-tabs { display: flex; gap: 16px; margin-bottom: 20px; border-bottom: 1px solid var(--rule); }
.auth-tab { border: 0; background: none; font: inherit; font-weight: 500; color: var(--ink-3); cursor: pointer; padding: 6px 0; margin-bottom: -1px; border-bottom: 2px solid transparent; }
.auth-tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.auth-error { color: var(--pen); font-family: var(--hand); font-size: 19px; line-height: 1.1; min-height: 22px; margin-bottom: 8px; }
.auth-footer { color: var(--ink-3); font-size: 12px; margin-top: 16px; }

/* ── Overlays: welcome wizard, dialogs, import wizard ──────── */

#wizard-overlay { position: fixed; inset: 0; z-index: 190; display: none; place-items: center; padding: 16px; background: var(--scrim); backdrop-filter: blur(2px); }
#wizard-overlay.show { display: grid; }
.wizard-box { position: relative; width: 100%; max-width: 520px; padding: 32px 36px 28px 52px; background: var(--sheet); border-radius: var(--r); box-shadow: var(--lift); }
.wizard-box::before { content: ''; position: absolute; top: 0; bottom: 0; left: 30px; border-left: 1px solid var(--margin); }
.wizard-close { position: absolute; top: 12px; right: 14px; border: 0; background: none; font-size: 18px; color: var(--ink-3); cursor: pointer; }
.wizard-step-title { font-family: var(--serif); font-weight: 500; font-size: 28px; margin-bottom: 6px; }
.wizard-step-sub { color: var(--ink-2); margin-bottom: 18px; }
.wizard-nav { display: flex; gap: 10px; align-items: center; margin-top: 18px; }
.wizard-skip { margin-left: auto; border: 0; background: none; font: inherit; color: var(--ink-3); cursor: pointer; }

/* Dialog (privacy check, prompt preview, pickers) */
.sheet-dialog { margin: auto; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 0; border-radius: var(--r); padding: 28px 30px 24px 48px; background: var(--sheet); color: var(--ink); box-shadow: var(--lift); position: fixed; }
.sheet-dialog::before { content: ''; position: absolute; top: 0; bottom: 0; left: 28px; border-left: 1px solid var(--margin); }
.sheet-dialog::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
.sent-text { max-height: 46vh; overflow: auto; white-space: pre-wrap; font: 12.5px/1.6 var(--mono); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.sent-text mark, .ph { background: var(--ok-bg); color: var(--ok); border-radius: 2px; padding: 0 2px; font-weight: 600; }

/* Import review wizard */
.sheet-dialog.wide { width: min(900px, calc(100vw - 32px)); }
.sheet-dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 100px); }
.import-body { overflow: auto; flex: 1; padding-right: 4px; }
.wizard-steps { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 14px; font: 500 10.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.wizard-steps .active { color: var(--ink); background: linear-gradient(transparent 55%, var(--hl) 55%); }
.wizard-steps .done { color: var(--ok); }
.import-overview { margin: 10px 0 10px 20px; }
.change-row { display: grid; grid-template-columns: 18px 130px 1fr 18px 1fr; gap: 8px; align-items: baseline; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; cursor: pointer; }
.change-row input { accent-color: var(--ink); }
.change-label { font-weight: 500; }
.change-old { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-2); }
.change-arrow { color: var(--ink-3); }
.change-new { color: var(--ok); }
.import-item { border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; background: var(--paper); }
.import-item > summary { padding: 9px 12px; cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.import-item > summary::-webkit-details-marker { display: none; }
.import-item > .field-grid { padding: 4px 12px 12px; }
.import-update { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.bulk-row { display: flex; gap: 6px; margin-bottom: 8px; }
@media (max-width: 700px) { .change-row { grid-template-columns: 18px 1fr; } .change-old, .change-arrow, .change-new { grid-column: 2; } }

/* ── Toast, activity dock and progress ──────────────────────── */

.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 300; max-width: calc(100vw - 32px);
  transform: translate(-50%, 10px); opacity: 0; pointer-events: none; transition: all .2s;
  background: var(--ink); color: var(--paper); padding: 9px 16px; border-radius: 6px; font-size: 13.5px; box-shadow: var(--lift);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Activity: a small status tag in the corner; opens into this session's log */
.activity-dock { position: fixed; right: 16px; bottom: 16px; width: 300px; max-width: calc(100vw - 32px); z-index: 80; background: var(--sheet); color: var(--ink); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--lift); }
.activity-dock-header { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 13px; border: 0; background: none; color: inherit; cursor: pointer; text-align: left; font: 500 11.5px/1.3 var(--mono); letter-spacing: .04em; }
.activity-dock .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex-shrink: 0; box-shadow: 0 0 0 3px var(--ok-bg); }
.activity-dock.busy .dot { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-bg); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.activity-dock-body { padding: 0 13px 12px; max-height: 260px; overflow: auto; }
.activity-dock.collapsed .activity-dock-body { display: none; }
.activity-log { display: grid; gap: 6px; margin-top: 6px; }
.activity-item { padding: 6px 8px; border-radius: 4px; background: var(--paper); border-left: 2px solid var(--info); }
.activity-item.success { border-left-color: var(--ok); }
.activity-item.error { border-left-color: var(--pen); }
.activity-item-header { display: flex; justify-content: space-between; font: 10.5px var(--mono); color: var(--ink-3); text-transform: uppercase; }
.activity-item-title { font-size: 12.5px; font-weight: 500; }
.activity-dock.collapsed { width: auto; max-width: 260px; color: var(--ink-2); box-shadow: var(--shadow); opacity: .85; }
.activity-dock.collapsed:hover { opacity: 1; }
.activity-dock.collapsed .activity-dock-header { padding: 5px 10px; font-size: 10.5px; }
.activity-dock.collapsed .activity-dock-header > :not(.dot) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

/* Progress: task tray, top hairline, filling buttons (progress.js) */
.task-line { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 120; background: var(--pen); box-shadow: 0 0 8px color-mix(in srgb, var(--pen) 45%, transparent); opacity: 0; transition: width .25s ease-out, opacity .3s; pointer-events: none; }
.task-line.on { opacity: 1; }
.task-tray { position: fixed; right: 16px; bottom: 64px; width: 320px; max-width: calc(100vw - 32px); z-index: 85; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.task-card { pointer-events: auto; background: var(--sheet); color: var(--ink); border: 1px solid var(--line-2); border-left: 3px solid var(--pen); border-radius: var(--r); box-shadow: var(--lift); padding: 10px 12px 9px; animation: settle .2s ease-out; }
.task-card.done { border-left-color: var(--ok); }
.task-card.failed { border-left-color: var(--pen); background: var(--pen-bg); }
.task-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.task-title { flex: 1; min-width: 0; font: 600 13px/1.3 var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-pct { font: 600 12px/1.3 var(--mono); color: var(--pen); font-variant-numeric: tabular-nums; }
.task-card.done .task-pct { color: var(--ok); }
.task-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 2px; font: 11px/1.35 var(--mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.task-foot:empty, .task-detail:empty { display: none; }
.task-time { white-space: nowrap; margin-left: auto; }
.task-bar { height: 6px; margin: 7px 0 6px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.task-bar span { display: block; height: 100%; width: 0; background: repeating-linear-gradient(-45deg, var(--pen) 0 6px, color-mix(in srgb, var(--pen) 80%, var(--sheet)) 6px 12px); background-size: 17px 17px; border-radius: 3px; transition: width .25s ease-out; animation: task-stripes .8s linear infinite; }
.task-card.done .task-bar span { background: var(--ok); animation: none; }
.task-card.failed .task-bar span { background: var(--ink-3); animation: none; }
@keyframes task-stripes { to { background-position: 17px 0; } }
.task-stage { font: 12.5px/1.35 var(--sans); color: var(--ink-2); }
.btn.btn-progress { position: relative; overflow: hidden; font-variant-numeric: tabular-nums; }
.btn.btn-progress::after { content: ''; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--p, 0%); background: var(--pen); transition: width .25s ease-out; }
.btn-primary.btn-progress::after { background: var(--amber); }
@media (max-width: 720px) { .task-tray { left: 16px; right: 16px; width: auto; } }

/* ── Phone view: bottom tabs, no sidebar, only the phone pages ─ */

.phone-tabs, .phone-switch { display: none; }
body.phone-capable:not(.phone) .phone-switch { display: inline-flex; margin-left: auto; }
body.phone .sidebar, body.phone .topbar, body.phone .workflow-strip { display: none !important; }
body.phone .shell { display: block; }
body.phone .main { padding: 14px 14px calc(78px + env(safe-area-inset-bottom)); }
body.phone .page-header { margin-bottom: 12px; }
body.phone .page-title { font-size: 26px; }
body.phone .card { padding: 14px; }
body.phone .phone-tabs { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 140; background: var(--paper); border-top: 1px solid var(--line-2); padding-bottom: env(safe-area-inset-bottom); }
.phone-tab { font: inherit; font-size: 11.5px; color: var(--ink-3); background: none; border: 0; padding: 8px 0 9px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; min-height: 56px; }
.phone-tab span { font-size: 19px; line-height: 1; }
.phone-tab.active { color: var(--ink); font-weight: 600; }
.phone-row { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; text-align: left; font: inherit; color: inherit; background: none; border: 0; border-bottom: 1px dashed var(--line); padding: 12px 0; min-height: 48px; cursor: pointer; }
.phone-row > span:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.phone-row > :last-child:not(:first-child) { flex-shrink: 0; max-width: 42%; text-align: right; }
.phone-app .phone-row { border-bottom: 0; padding: 4px 0; }
.phone-app.open .phone-row { border-bottom: 1px dashed var(--line); margin-bottom: 10px; padding-bottom: 10px; }
.phone-copy, .phone-proc { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.phone-proc { flex-wrap: wrap; }
.phone-proc > span:first-child { display: flex; flex-direction: column; gap: 2px; }
/* Everything tappable is at least 44px tall on a phone */
body.phone .btn, body.phone .subtab { min-height: 44px; }
body.phone .btn-xs { padding-left: 12px; padding-right: 12px; }
body.phone input, body.phone textarea, body.phone select { font-size: 16px; } /* stops iOS zooming into fields */
.phone-foot { display: flex; gap: 8px; justify-content: center; margin-top: 18px; }
body.phone .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }

/* ── Small screens ──────────────────────────────────────────── */

@media (max-width: 960px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 150; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--lift); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ''; position: fixed; inset: 0; z-index: 140; background: rgba(18, 25, 42, .35); }
  .topbar { flex-wrap: wrap; }
  .topbar .nav-toggle { display: inline-flex; }
  .main { padding: 16px 16px 90px; }
  .page-title { font-size: 28px; }
  .split, .cols-2, .fg-2, .fg-3, .review-grid, .toggle-grid, .cv-workbench { grid-template-columns: 1fr; }
  .cv-viewer { position: static; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(odd) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .card, .review-pane { padding: 16px 16px 16px 26px; }
  .card::before, .review-pane::before { left: 12px; }
  .table { display: block; overflow-x: auto; }
  .crit { grid-template-columns: 22px 1fr; }
  .crit-evidence { grid-column: 2; }
  .entity-head { flex-direction: column; align-items: flex-start; }
  .workflow-strip { overflow-x: auto; flex-wrap: nowrap; width: 100%; }
  .workflow-step { flex-shrink: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Print: only the CV pages ───────────────────────────────── */

@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; }
  .sidebar, .topbar, .toast, .activity-dock, .no-print, .page-header, dialog { display: none !important; }
  .main { padding: 0 !important; }
  .page { display: none !important; }
  #pg-cv { display: block !important; max-width: none; }
  .cv-workbench { display: block; }
  .cv-viewer { position: static; }
  .cv-pages-wrap { padding: 0; border: 0; background: none; max-height: none; overflow: visible; }
  #cv-pages { zoom: 1 !important; }
  .cv-sheet { margin: 0; box-shadow: none; break-after: page; }
  .cv-sheet:last-child { break-after: auto; }
}
.btn-quiet.danger-link { color: var(--pen); text-decoration-color: color-mix(in srgb, var(--pen) 40%, transparent); }

/* Job sources picker */
.sources-field { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; }
.source-country { border-bottom: 1px dashed var(--line); padding: 6px 0; }
.source-country:last-child { border-bottom: 0; }
.source-country > summary { cursor: pointer; display: flex; align-items: center; gap: 8px; list-style: none; }
.source-country > summary::-webkit-details-marker { display: none; }
.source-country > summary .btn { margin-left: auto; }
.source-option { align-items: flex-start; padding: 4px 0 4px 4px; }
.source-option input { margin-top: 3px; }
.job-links summary { cursor: pointer; color: var(--info); margin-top: 6px; }

/* Photo editor (profile and CV builder) */
.photo-editor { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: start; }
.photo-editor.empty { display: block; }
.photo-drop { border: 1.5px dashed var(--line-2); border-radius: var(--r); padding: 16px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.photo-stage-wrap { display: grid; justify-items: center; gap: 6px; max-width: 180px; text-align: center; }
.photo-stage.cv-photo { width: 150px; height: 180px; cursor: grab; touch-action: none; border: 1px solid var(--line-2); box-shadow: var(--shadow); outline-offset: 3px; }
.photo-stage.cv-photo.square, .photo-stage.cv-photo.circle { width: 170px; height: 170px; }
.photo-stage.cv-photo:active { cursor: grabbing; }
.photo-controls .field { margin-bottom: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; }
.seg-btn { font: inherit; font-size: 12.5px; padding: 5px 11px; border: 0; border-left: 1px solid var(--line-2); background: var(--sheet); color: var(--ink-2); cursor: pointer; }
.seg-btn:first-child { border-left: 0; }
.seg-btn.on { background: var(--ink); color: var(--sheet); }
@media (max-width: 560px) { .photo-editor { grid-template-columns: 1fr; } }
.seg { flex-wrap: wrap; max-width: 100%; }
.photo-guide { border: 1px solid var(--line); border-left: 3px solid var(--info); border-radius: var(--r); padding: 8px 12px; margin-bottom: 14px; background: var(--info-bg); font-size: 13.5px; }
.photo-guide-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.photo-guide-head .btn, .photo-guide-head .badge { margin-left: auto; }
.photo-guide details { margin-top: 4px; }
.photo-guide summary { cursor: pointer; color: var(--info); }
.photo-guide ul { margin: 6px 0 0 18px; }
