/* ============================================================================
   ResumeD — application composites

   What is NOT in design-system.css, and why: everything below names a thing
   from the product (a resume card, the resume grid) rather than a thing from
   the system (a button, a menu, an alert). The design system stays the single
   source of truth for the vocabulary; this file only assembles it.

   Rule of thumb for adding here: if the class would still make sense in a
   different product, it belongs in design-system.css instead.

   Every value below comes from a token. No literal colour, no literal spacing.
   ========================================================================= */


/* ---------- Page heading row ----------
   Title on the left, primary action on the right. */

.page-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.page-header > h1 { margin: 0; }

/* A page whose title is its tab bar (/applications): the design system's
   tabs, in the titles' typeface. On a phone the action goes to the next line
   and a long tab name wraps inside its tab, the two tabs staying side by side. */
.page-header:has(> .page-tabs) { flex-wrap: wrap; }

.page-tabs {
  min-width: 0;
  margin-bottom: 0;
}

.page-tabs .tab {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-align: left;
  padding-top: 0;
}

@media (max-width: 640px) {
  .page-tabs .tab { font-size: var(--text-lg); }
  .page-tabs .tab .icon { display: none; }
}


/* ---------- Two-column application layout ----------
   Content on the left, side panel on the right. */

.app-layout {
  display: grid;
  /* minmax(0, 1fr), not 1fr: a grid column is min-content-sized by default,
     so the left one would refuse to shrink below the intrinsic width of the
     card grid inside it and the page would overflow instead of reflowing. */
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: var(--space-5);
  align-items: start;
}

/* Stays in view down a long list of resumes. */
.app-aside { position: sticky; top: var(--space-4); }

/* One column before the cards get too narrow to read. The panel then comes
   FIRST: on a phone, the library and the job search would otherwise sit under
   every resume, a long scroll away. Not sticky any more: in one column it
   would slide over the list. */
@media (max-width: 800px) {
  .app-layout { grid-template-columns: minmax(0, 1fr); }
  .app-aside { order: -1; position: static; }
}

/* A grid item's automatic minimum size is its content, and the grid of cards
   inside is what would otherwise refuse to shrink. Declared here as well as
   on the track above: two different mechanisms, same overflow to prevent. */
.app-main { min-width: 0; }


/* ---------- Library panel ----------
   One line per kind of reusable item: what it is on the left, how many on the
   right. No icons: half of these have no honest icon in the sprite, and five
   approximate ones would say less than the words do. */

.library-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.library-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: var(--border-width) solid var(--c-border);
}

.library-item:last-child { border-bottom: none; }

/* Pushed right whatever the label's length. */
.library-count { margin-left: auto; }


/* ---------- Resume grid ---------- */

.resume-grid {
  display: grid;
  /* auto-fill, not auto-fit: a single resume keeps a card-sized card instead
     of stretching across the whole row. */
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--space-5);
}

.resume-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border: var(--border-width) solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition), opacity var(--transition);
}

.resume-card:hover {
  border-color: var(--c-border-strong);
  box-shadow: var(--shadow-md);
}

/* Stretched link: one real link in the markup — so its text is the card's
   accessible name — with a transparent overlay making the whole card
   clickable. The actions menu is lifted above it by its own z-index. */
.resume-open {
  color: inherit;
  font-weight: inherit;
  text-decoration: none;
}

.resume-open::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
}

.resume-open:hover { text-decoration: none; }

/* The ring belongs around the card, not around the two words of the title. */
.resume-open:focus-visible { outline: none; }

.resume-card:has(.resume-open:focus-visible) {
  outline: var(--focus-width) solid var(--c-focus);
  outline-offset: var(--focus-offset);
}

/* A4 proportions, before there is anything inside: the waiting glyph takes the
   space the document will, and the card does not move when it arrives.

   No rule on `img` here: this frame holds a RENDERED DOCUMENT, not an image of
   one, and a rule written for that image sized every image in the resume — link
   icons spread across the whole column. */
.resume-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1.414;
  overflow: hidden;
  border-bottom: var(--border-width) solid var(--c-border);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--c-surface-sunken);
  color: var(--c-border-strong);
}

/* Once the thumbnail is drawn, the frame is no longer a glyph box: the document
   sits top-left and whatever overflows the A4 is clipped. */
.resume-preview.has-preview {
  display: block;
  align-items: initial;
  justify-content: initial;
  background: #fff;
}

/* The miniature document reacts to nothing: it is a picture, and the click
   belongs to the link covering the card. */
.resume-preview .rd-doc { pointer-events: none; }

.resume-body {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  padding: var(--space-3);
}

/* min-width: 0 is what lets .truncate work on a flex child. */
.resume-meta { flex: 1; min-width: 0; }

.resume-title {
  margin: 0;
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
}

.resume-date { margin: 0; }

/* Above the stretched link, otherwise the overlay would swallow the clicks. */
.resume-body .dropdown { z-index: 1; }

/* Every resume wears the brand's stripes along its top edge; an archived one
   fades with its card: the opacity of .archived (below) applies to it too. */
.resume-card::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto;
  height: 6px;
  z-index: 1;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--stripes);
  pointer-events: none;
}

/* Archived: set aside, still legible, and readable again on hover. Not hidden
   — the whole point of the section below the separator is that it is found. */
.resume-card.archived { opacity: 0.6; }
.resume-card.archived:hover { opacity: 1; }

/* The "Archived" rule between the two sections. */
.archived-section { margin-top: var(--space-6); }


/* ---------- Job search panel ----------
   Under the library, in the same column: both answer "what do I have to work
   with", one for building a resume, the other for sending it somewhere. */

.job-search-list {
  display: grid;
  /* minmax(0, …): an auto track grows to the longest name and defeats .truncate. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Its own outline rather than a rule underneath: the row is a target, and a
   target reads better with an edge all the way round. */
.job-search-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-inline: var(--space-2);
  border: var(--border-width) solid var(--c-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), background var(--transition);
}

.job-search-item:hover {
  border-color: var(--c-border-strong);
  background: var(--c-surface-hover);
}

/* The whole line opens the search for editing: a saved search has one action,
   and a menu for one action is a menu too many. */
.job-search-open {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.job-search-open:hover { color: var(--c-primary-text); }

.job-search-open:focus-visible {
  outline: var(--focus-width) solid var(--c-focus);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-sm);
}

/* Maybes and likes side by side, under the applications button. */
.job-kept-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

/* "3 / 5" — quiet until it is the reason the + button is disabled. */
.job-search-quota { margin-left: auto; }
.job-search-quota.full { color: var(--c-warning-text); }


/* ---------- New search: where, then which source ----------
   Two big targets for the question that decides everything else, then the
   sources of the chosen side as a list — one of each today, more later. */

.provider-zones {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.provider-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  border: var(--border-width) solid var(--c-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.provider-zone:hover { border-color: var(--c-border-strong); background: var(--c-surface-hover); }

.provider-options { display: grid; gap: var(--space-2); }

.provider-option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  border: var(--border-width) solid var(--c-border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.provider-option-body { display: grid; gap: var(--space-1); }

.provider-option input { margin-top: 3px; accent-color: var(--c-primary); }

/* The checked state is the whole target, not only its radio. */
.provider-zone:has(input:checked),
.provider-option:has(input:checked) {
  border-color: var(--c-primary);
  background: var(--c-primary-subtle);
  color: var(--c-primary-text);
}

.provider-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.provider-zone:has(input:focus-visible),
.provider-option:has(input:focus-visible) {
  outline: var(--focus-width) solid var(--c-focus);
  outline-offset: var(--focus-offset);
}

.provider-option.disabled { color: var(--c-text-muted); cursor: not-allowed; }


/* ---------- The search form ----------
   Forty filters in one dialog. The essential ones are always visible; the
   rest live behind a summary, closed by default, so the form opens as short
   as the common case. */

/* The dialog is wide, so the fields sit in as many columns as fit rather
   than in one very long strip. auto-fit, not auto-fill: with three fields
   left they share the row instead of leaving an empty column. */
.filter-group {
  display: grid;
  gap: var(--space-3) var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  align-items: start;
}

/* What has no business being a column: the search's name, the keywords, and
   anything built out of pills — a chip row reflows on its own and reads
   badly squeezed into a third of the width. */
.filter-group > .field-full { grid-column: 1 / -1; }

.filter-more {
  margin-top: var(--space-4);
  border-top: var(--border-width) solid var(--c-border);
  padding-top: var(--space-3);
}

.filter-more > summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-weight: var(--weight-medium);
  color: var(--c-primary-text);
  list-style: none;
}

.filter-more > summary::-webkit-details-marker { display: none; }

.filter-more[open] > summary { margin-bottom: var(--space-3); }

/* A row of small toggles that reads as one control: contract types,
   experience levels — sets where picking three is as normal as picking one. */
.chip-set {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip-set .choice {
  position: relative;
  margin: 0;
  padding: var(--space-1) var(--space-3);
  border: var(--border-width) solid var(--c-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.chip-set .choice:has(input:checked) {
  border-color: var(--c-primary);
  background: var(--c-primary-subtle);
  color: var(--c-primary-text);
}

.chip-set .choice:has(input:focus-visible) {
  outline: var(--focus-width) solid var(--c-focus);
  outline-offset: var(--focus-offset);
}

/* The checkbox itself says nothing the pill does not. Pinned inside the pill:
   positioned against the dialog instead, it overflowed it on a phone, and
   focusing it scrolled the dialog down to an empty area. */
.chip-set .choice input {
  position: absolute;
  inset: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Two fields that only make sense together (amount + period, min + max).
   Equal columns with a zero minimum: "auto" let the second field be squeezed
   to nothing by the first one's label, which is how two labelled controls
   end up printed on top of each other. Below the width where two labels fit,
   they stack. */
.field-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: var(--space-2) var(--space-3);
  align-items: end;
}


/* ---------- The picker dialog ----------
   For lists too long to be a row of pills: the 600 ROME jobs, the hundred
   departments. A search box, and a scrolling list of checkboxes under it. */

/* A stack of cards, not a ruled table: these rows are ticked one by one and
   moved one by one, so they stand apart. The small inset leaves room for the
   focus ring, which the scrolling area's edge would clip. */
.picker-list {
  display: grid;
  gap: var(--space-2);
  max-height: min(50vh, 420px);
  overflow-y: auto;
  padding: var(--space-1);
}

.picker-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: var(--border-width) solid var(--c-border);
  border-radius: var(--radius-md);
  background: var(--c-surface);
  cursor: pointer;
}

.picker-row:hover { background: var(--c-surface-hover); }

/* Picked, and spottable while scrolling fast. Background and border only: the
   ticked box already carries the meaning. */
.picker-row:has(input:checked) {
  border-color: var(--c-success);
  background: var(--c-success-subtle);
}

.picker-row:has(input:checked) .picker-code { color: var(--c-success-text); }

/* Marked with Ctrl or Shift + click: an outline of its own, since a marked row
   is not a picked one — the green already says that. */
.picker-row.is-selected {
  outline: 2px solid var(--c-focus);
  outline-offset: 1px;
}

/* "3 selected · 2 marked · Unmark": one line, the button included. */
.picker-counter {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-height-sm);
}

/* The code, in a fixed column so the labels line up down the list. */
.picker-code {
  flex: none;
  width: 4.5ch;
  color: var(--c-text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

/* The search box takes what the counter and the clear button leave. */
.picker-list + *, .row > .input[type="search"] { min-width: 0; }
.row > .input[type="search"] { flex: 1; }

/* The flags at the end of "more filters": one per line, each with its
   explanation marker, rather than spread across the grid's columns where a
   tooltip would sit on top of the next field. */
.filter-flags {
  display: grid;
  gap: var(--space-2);
}

/* The explanation marker now lives inside each label, so a flag is just a
   .choice on its own line. */
.filter-flags .choice { margin: 0; }


/* What a rejected form lists in its banner: one line per field the server
   refused, named as the form names it. */
.alert-list {
  margin: var(--space-1) 0 0;
  padding-left: var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
}

.alert-list li { margin-top: var(--space-1); }


/* A wrapper that exists only to show or hide its children together: it takes
   no place in the grid, so the fields inside it get their own cells like
   everything else. [hidden] still wins over display: contents. */
.field-contents { display: contents; }

/* ============================================================
   Library (/library)

   One row per item, the same shape for the five kinds: what it says, what
   it says it in, and what can be done to it. The kind-specific part is a
   line of text under the label, never a different layout — five layouts
   for five lists that are read the same way would only slow the eye down.
   ============================================================ */

.lib-list {
  display: grid;
  gap: var(--space-2);
}

.lib-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: var(--border-width) solid var(--c-border);
  border-radius: var(--radius-md);
  background: var(--c-surface);
}

/* Archived: still readable, visibly set aside. Not display:none — the
   fold above it says how many there are, and hiding them would make the
   count a riddle. */
.lib-row.is-archived { background: var(--c-surface-sunken); }

.lib-main {
  flex: 1;
  min-width: 0;
}

.lib-label {
  margin: 0;
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
}

.lib-meta {
  margin: var(--space-1) 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
}

/* The languages an item is written in. A missing one is shown struck
   through rather than omitted: "no English version" is the fact worth
   seeing on a list you are about to build an English resume from. */
.lib-langs {
  flex: none;
  display: flex;
  gap: var(--space-1);
}

.lib-lang {
  text-transform: uppercase;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--c-success-subtle);
  color: var(--c-success-text);
}

.lib-lang.is-missing {
  background: transparent;
  color: var(--c-text-muted);
  text-decoration: line-through;
}

.lib-actions {
  flex: none;
  display: flex;
  gap: var(--space-1);
}

/* Pinned: the same filled yellow star as the editor's current version. */
.lib-pin.is-pinned { --btn-fg: #eab308; }
.lib-pin.is-pinned .icon { fill: currentColor; }

/* The two language blocks of the item form, each fenced so a label and its
   description read as one language rather than as four fields in a row. */
.lib-lang-block {
  border: var(--border-width) solid var(--c-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-top: var(--space-3);
}

.lib-lang-block > h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  color: var(--c-text-muted);
}

/* Alternative descriptions (V44): the arrows either side of the field, the
   chosen one outlined in green — and said in its button, since the focus ring
   is green too and hue must not be the only cue. */
.lib-alt {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.lib-alt > .textarea { flex: 1; }

.lib-alt-arrow { --btn-fg: var(--c-text); }

.lib-alt.is-chosen > .textarea {
  border-color: var(--c-success);
  box-shadow: 0 0 0 3px var(--c-success-subtle);
}

/* The one in use: a state, not an action left to take. */
.lib-alt-choose[aria-pressed="true"] {
  --btn-fg: var(--c-success-text);
  --btn-bg: var(--c-success-subtle);
  --btn-border: var(--c-success);
  pointer-events: none;
}

.lib-alt-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.lib-alt-count {
  margin-right: auto;
  font-size: var(--text-sm);
  color: var(--c-text-muted);
}

/* Two dates on one line: they are one piece of information. */
.lib-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

/* Month and year are one date: they touch, and the meeting corners are square
   to say so — like the filename and its format on export. The year takes only a
   year's width. */
.month-year {
  display: flex;
  align-items: stretch;
}

.month-year .select {
  flex: 1;
  min-width: 0;
  width: auto;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

/* Without the number field's arrows: a year is typed, not incremented — nobody
   goes from 2024 back to 1998 by clicking. `type="number"` stays, for the
   bounds and for the phone's numeric keyboard. */
.month-year .input {
  flex: none;
  width: 7ch;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: calc(var(--border-width) * -1);
  appearance: textfield;
  -moz-appearance: textfield;
}

.month-year .input::-webkit-outer-spin-button,
.month-year .input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* The end date, switched off by "ongoing". Greyed and not removed: the field
   keeps its place, so ticking and unticking does not make half the form jump
   under the cursor. */
.field.is-disabled { opacity: 0.55; }

@media (max-width: 640px) {
  .lib-dates { grid-template-columns: 1fr; }
  .lib-row { flex-wrap: wrap; }
}

/* A row of the item picker: the box, which alone ticks, then the words, which
   open the item's form like the rest of the row, then the grip. The box's label
   is padded so the tick target is not just the 16 px square. */
.picker-check {
  display: flex;
  align-items: center;
  margin: calc(-1 * var(--space-2));
  padding: var(--space-2);
  cursor: pointer;
}

.picker-pick {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

/* ---------- Picker lanes (V17) ----------
   The skill picker is no longer a list but a stack: the untitled lane, then one
   box per category. The four other kinds have only one, and get exactly the
   list they had before. */

.picker-lanes {
  display: grid;
  gap: var(--space-3);
  max-height: min(50vh, 420px);
  overflow-y: auto;
  padding: var(--space-1);
}

/* The whole stack scrolls. A height per lane would turn the last category into
   a three-row porthole under another — and both ends of a drag have to be
   visible to make it. */
.picker-lanes .picker-list {
  max-height: none;
  overflow: visible;
  padding: 0;
}

/* In a tall dialog the stack does not cap itself at all: the dialog's body
   scrolls, once, for everything it holds. Two nested scrollbars meant aiming at
   the right one, and scrolling one to reach the start of the other. */
.modal-tall .picker-lanes {
  max-height: none;
  overflow: visible;
}

/* A category reads as a box: that is what says a row is INSIDE it, and so that
   it can be taken out. */
.picker-group {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-2);
  border: var(--border-width) solid var(--c-border);
  border-radius: var(--radius-md);
  background: var(--c-surface-sunken);
}

.picker-group-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* The two titles share the line equally: they are two answers to the same
   question, and one is not the translation of the other. */
.picker-group-name {
  flex: 1;
  min-width: 0;
}

/* An empty category is not an error: it is the one just created, and the only
   thing to tell it is that things get dropped in. */
.picker-group-empty {
  margin: 0;
  padding: var(--space-3);
  border: var(--border-width) dashed var(--c-border);
  border-radius: var(--radius-md);
  color: var(--c-text-muted);
  font-size: var(--text-xs);
  text-align: center;
}

/* What the resume does not print yet, below everything else (V21).

   It used to sit under the untitled lane, so ABOVE the categories: forty
   tickable rows pushed the filing just done out of view. The two halves do not
   read the same way — above, what the resume prints; below, what could be added
   — and the rule says which one is being looked at. Without it, an unticked row
   under a category reads as one just taken out of it. */

.picker-offered {
  display: grid;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: var(--border-width) solid var(--c-border);
}

.picker-offered-title {
  margin: 0;
  color: var(--c-text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Drag and drop and its grip live in the design system: two lists use them, and
   nothing justifies ordering differently. */

/* ============================================================
   Profile page (/profile)

   Cards of uneven size: the counters do not all have the same number of lines,
   and forcing one height would leave empty space under the short ones. The grid
   arranges them, it does not uniform them.
   ============================================================ */

.profile-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.profile-identity { flex: 1; min-width: 0; }

.profile-identity h2 {
  margin: 0;
  font-size: var(--text-lg);
}

.profile-identity p { margin: 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
  align-items: start;
}

.stat-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  font-size: var(--text-md);
}

.stat-figures {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
}

/* A figure and what it counts. Clickable when it leads somewhere, and only
   then: an underlined figure that goes nowhere is a promise not kept. */
.stat-figure {
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
}

a.stat-figure:hover .stat-number { color: var(--c-primary-text); }

.stat-number {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  line-height: 1.1;
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--c-text-muted);
}

.stat-lead {
  margin: 0 0 var(--space-2);
  font-weight: var(--weight-medium);
}

.stat-gauge { margin-top: var(--space-3); }

/* One card per monthly chart, as many per row as fit. */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: var(--space-4);
}

.chart-card { display: flex; flex-direction: column; margin: 0; }

/* Chart.js sizes its canvas from this box: the height is set here, the width
   follows the card. */
.moderation-chart {
  position: relative;
  height: 260px;
}

/* The range toggle, bottom right of its chart. */
.chart-footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.chart-footer .hint { flex: 1; margin: 0; }

.account-filters { margin-bottom: var(--space-4); }
.account-filters > .grow { flex: 1; min-width: min(100%, 220px); }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
}

/* A contact message as it was typed: its line breaks are part of it. */
.contact-body { white-space: pre-wrap; overflow-wrap: anywhere; }

.stat-gauge p { margin: 0 0 var(--space-1); }

/* ============================================================
   ATS bench (/moderator/ats-bench)
   ============================================================ */

/* The document being exported, shown small. Scaled by a transform: the PDF
   writer measures through it (its zoom), so the export is full size. */
.bench-stage {
  height: 280px;
  overflow: hidden;
  margin-top: var(--space-3);
  border: var(--border-width) solid var(--c-border);
  border-radius: var(--radius-sm);
}

.bench-stage:empty { display: none; }

.bench-stage > .rd-doc {
  transform: scale(0.35);
  transform-origin: top left;
}

/* A success rate. The figure always says it; the colour only helps scan the table. */
.bench-rate { font-variant-numeric: tabular-nums; font-weight: var(--weight-medium); }
.bench-rate.is-good { color: var(--c-success-text); }
.bench-rate.is-fair { color: var(--c-warning-text); }
.bench-rate.is-bad  { color: var(--c-danger-text); }

.bench-raw {
  max-height: 60vh;
  overflow: auto;
  white-space: pre-wrap;
  font-size: var(--text-sm);
}

/* ============================================================
   Le choix d'une forme pour un lien

   Une grille de boutons plutôt qu'une liste déroulante : on choisit une
   forme en la voyant. Le choix est marqué par une bordure ET un fond — la
   couleur seule ne porte jamais un sens dans ce système.
   ============================================================ */

.icon-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: var(--space-1);
  margin-top: var(--space-1);
}

.icon-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0;
  border: var(--border-width) solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-text);
  cursor: pointer;
  transition: background var(--transition);
}

.icon-choice:hover { background: var(--c-surface-hover); }

.icon-choice.is-chosen {
  border-color: var(--c-primary);
  background: var(--c-primary-subtle);
  color: var(--c-primary-text);
}

.icon-choice:focus-visible {
  outline: var(--focus-width) solid var(--c-focus);
  outline-offset: var(--focus-offset);
}

/* The tab bar and the button that creates in the open tab. The tabs carry their
   own separator line: the bottom margin moves to the row so the button stays
   aligned on it. */
.tabs-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.tabs-row .tabs {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
  overflow-x: auto;
}

/* Two fields of the same business card on one row. The address needs the space
   the phone does not take, hence the two thirds. */
.profile-pair {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-4);
}

/* The warning sits above the fields it concerns: so it needs the look of a
   preamble, not of a footnote. */
.profile-note {
  margin: calc(var(--space-2) * -1) 0 var(--space-3);
}

/* A key field and its buttons on one line: find it, save it, remove it. */
.connection-intro { margin: 0 0 var(--space-4); }

.connection-key {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.connection-key .input { flex: 1; min-width: 0; }

.connection-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-top: var(--space-4);
  border-top: var(--border-width) solid var(--c-border);
}

/* Each sentence faces its button; the buttons share the widest one's width. */
.connection-guides {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--space-2) var(--space-4);
}

.connection-text { flex: 1; min-width: 0; }

.connection-text h3 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-md);
}

@media (max-width: 640px) {
  .profile-pair { grid-template-columns: 1fr; }
  .connection-key,
  .connection-row { flex-wrap: wrap; }
  .connection-key .input,
  .connection-text { flex-basis: 100%; }
  .connection-guides { grid-template-columns: 1fr; }
  .connection-guides .btn { justify-self: start; }
}

/* ============================================================
   Guides (Tutorial dialogs opened from the profile)
   ============================================================ */

/* Things to type to Claude: they read as quotations, not as a to-do list. */
.guide-examples {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-examples li {
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid var(--c-primary);
  border-radius: var(--radius-sm);
  background: var(--c-surface-sunken);
  font-style: italic;
}

/* The second create button, at the foot of the active list. Right-aligned like
   the "+" in the tab bar: they do the same thing, so they sit on the same
   vertical. */
.lib-add-row {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-3);
}


/* ============================================================
   Les modèles

   Un modèle est une apparence sans contenu, et on ne le reconnaît qu'à
   l'œil : la grille ci-dessous est donc faite de vignettes, pas d'une liste
   de noms. Chacune est un vrai CV vide dessiné par le moteur de rendu — le
   même que celui de l'éditeur — de sorte que ce qu'on choisit est exactement
   ce qu'on obtient.

   Les deux boutons d'une carte sont à cheval sur le bord du cadre : à
   l'intérieur ils auraient recouvert l'aperçu qu'ils servent à gérer, à
   l'extérieur ils auraient appartenu à la grille plutôt qu'à la carte.
   ============================================================ */

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-4);
}

.template-card { position: relative; }

/* Between the built-in themes and the account's own templates. */
.template-separator { margin: var(--space-4) 0; }

/* The whole card is the button: a template is picked by pointing at it, not by
   aiming at a box. */
.template-pick {
  display: block;
  width: 100%;
  padding: 0;
  border: var(--border-width) solid var(--c-border);
  border-radius: var(--radius-md);
  background: var(--c-surface);
  color: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.template-pick:hover {
  border-color: var(--c-primary);
  box-shadow: var(--shadow-md);
}

/* The frame keeps A4 proportions before being filled: the thumbnail arriving
   displaces nothing around it. */
.template-preview {
  aspect-ratio: 1 / 1.414;
  overflow: hidden;
  background: #fff;
  border-bottom: var(--border-width) solid var(--c-border);
}

/* A picture, nothing more: the click belongs to the card. */
.template-preview .rd-doc { pointer-events: none; }

.template-name {
  display: block;
  padding: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}

/* In the save dialog the preview is not a choice: it shows what is being
   named. */
.template-card.is-static .template-preview {
  border: var(--border-width) solid var(--c-border);
  border-radius: var(--radius-md);
}

.template-bubbles {
  --bubble-size: 26px;
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  /* Straddling, and straddling ONE bubble: the vertical offset is half a
     bubble, not 40% of the column — which holds two, and so pulled the bin well
     above the frame with the second bubble taking its place on the edge. */
  transform: translate(40%, calc(var(--bubble-size) / -2));
}

.template-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--bubble-size);
  height: var(--bubble-size);
  padding: 0;
  border: var(--border-width) solid var(--c-border);
  border-radius: var(--radius-pill);
  background: var(--c-surface);
  color: var(--c-text-muted);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.template-bubble:hover { color: var(--c-text); border-color: var(--c-border-strong); }

/* The bin is first, and the only one that changes colour: it is the one there
   is no coming back from. */
.template-bubble:first-child:hover { color: var(--c-danger); border-color: var(--c-danger); }


/* ---------- Application tracker (/applications) ----------
   A table that uses the whole width of the screen: six columns of short
   values read better side by side than wrapped. */

.page-wide { max-width: none; }

/* On a phone the table scrolls sideways rather than squeezing its columns. */
.table-scroll { overflow-x: auto; }

.application-table td { vertical-align: middle; }
.application-table .col-appliedOn,
.application-table .col-commute { white-space: nowrap; }
.application-table .col-attachments { white-space: nowrap; }
.attachments { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); }
.attachments :is(a, .link-button),
.application-attachments :is(a, .link-button) { display: inline-flex; align-items: center; gap: var(--space-1); }
.application-attachments {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  margin: 0 0 var(--space-3);
}

/* Attaching a resume: one section per document, its versions as cards. */
.attach-resume + .attach-resume { margin-top: var(--space-4); }
.attach-resume-title { margin: 0 0 var(--space-2); font-size: var(--text-md); }

.attach-versions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-2);
}

.attach-version {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  border: var(--border-width) solid var(--c-border);
  border-radius: var(--radius-md);
  background: var(--c-surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.attach-version:hover { background: var(--c-surface-hover); }

.attach-version.is-attached {
  border-color: var(--c-success);
  background: var(--c-success-subtle);
}

.attach-version-name { max-width: 100%; font-weight: 600; }

.attach-preview {
  border: var(--border-width) solid var(--c-border);
  border-radius: var(--radius-md);
}

/* The whole header is the sort control, not an arrow next to it. */
.sort-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.sort-button:hover { color: var(--c-text); }

.sort-button:focus-visible,
.grade-button:focus-visible,
.notation-view:focus-visible {
  outline: var(--focus-width) solid var(--c-focus);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-sm);
}

.application-table a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.grade-button {
  display: block;
  min-width: 200px;
  padding: var(--space-1);
  border: none;
  background: none;
  cursor: pointer;
}

.grade-button:hover .rating-step { --fill-color: var(--c-border-strong); }

/* ---------- Rating bar ----------
   Ten steps, filled up to the value. */

.rating-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.rating-steps {
  flex: 1;
  display: flex;
  gap: 2px;
}

.rating-step {
  flex: 1;
  height: 16px;
  min-width: 8px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 var(--border-width) var(--c-border);
  /* --fill is set per step by applications.js: 7.25 fills a quarter of the eighth. */
  --fill: 0%;
  --fill-color: var(--c-primary);
  background: linear-gradient(to right,
    var(--fill-color) var(--fill), var(--c-surface-sunken) var(--fill));
}

.rating-bar.editable .rating-step { cursor: pointer; }

/* The grade is computed, never set: grey says so. */
.rating-bar:not(.editable) .rating-step {
  --fill-color: color-mix(in srgb, var(--c-border-strong) 55%, var(--c-surface));
}

/* Nothing rated yet: the whole line is hatched rather than looking like a zero. */
.rating-bar.unrated:not(.editable) .rating-steps {
  border-radius: var(--radius-sm);
  background: repeating-linear-gradient(-45deg,
    var(--c-border) 0 2px, transparent 2px 6px);
}

.rating-bar.unrated:not(.editable) .rating-step { background: transparent; }
.rating-bar.editable .rating-step:hover { --fill-color: var(--c-primary-hover); --fill: 100%; }

.rating-bar.editable .rating-step:focus-visible {
  outline: var(--focus-width) solid var(--c-focus);
  outline-offset: 1px;
}

.rating-value {
  min-width: 4.5em;
  text-align: right;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
}

/* ---------- Notation ----------
   Pros and cons side by side, then the grade and the four criteria. */

.application-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 var(--space-4);
}

.notation-title { margin: var(--space-4) 0 var(--space-3); }

.notation {
  display: grid;
  gap: var(--space-3);
}

.notation-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
}

.notation-column { margin: 0; }

.notation-heading {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
}

.notation-sign {
  display: inline-grid;
  place-items: center;
  width: 1.5em;
  height: 1.5em;
  border-radius: var(--radius-pill);
  font-weight: var(--weight-bold);
}

.notation-column.positive .notation-sign { background: var(--c-success-subtle); color: var(--c-success-text); }
.notation-column.negative .notation-sign { background: var(--c-danger-subtle);  color: var(--c-danger-text); }

/* Same height read or edited: the Save button must not move under the
   pointer when the textarea closes on blur. */
.notation-box,
.notation-view { min-height: 132px; }

.notation-box .textarea { width: 100%; min-height: 132px; }

.notation-notes { margin: 0; }

.notation-notes .notation-box,
.notation-notes .notation-view,
.notation-notes .notation-box .textarea { min-height: 72px; }

.notation-text { margin: 0; white-space: pre-wrap; }

.notation-view {
  padding: var(--space-2) var(--space-3);
  border: var(--border-width) dashed var(--c-border);
  border-radius: var(--radius-md);
  cursor: text;
}

.notation-view:hover { border-color: var(--c-border-strong); }
.notation-view ul { margin: 0; padding-left: var(--space-4); }

.notation-criterion {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
}

.notation-grade {
  padding-block: var(--space-3);
  border-block: var(--border-width) solid var(--c-border);
}

/* ---------- Status ----------
   The cell's colour is the status: grey to do, purple applied, blue interview,
   red rejected, green accepted, muted abandoned. Its border takes the colour
   of its text, softened except in the contrast theme. */

.status-select {
  min-width: 9em;
  font-weight: var(--weight-medium);
  /* Half the text colour: 1px is already the thinnest a screen draws, so a
     lighter line is what makes it finer. */
  border-color: color-mix(in srgb, currentColor 50%, transparent);
}

/* The contrast theme keeps a full-strength border: its whole point is lines that cannot be missed. */
[data-theme="daltonism"] .status-select { border-color: currentColor; }

.status-TODO      { background-color: var(--c-surface-sunken); }
.status-APPLIED   { background-color: var(--c-accent-subtle);  color: var(--c-accent-text); }
.status-INTERVIEW { background-color: var(--c-info-subtle);    color: var(--c-info-text); }
.status-REJECTED  { background-color: var(--c-danger-subtle);  color: var(--c-danger-text); }
.status-ACCEPTED  { background-color: var(--c-success-subtle); color: var(--c-success-text); }
.status-ABANDONED { background-color: var(--c-surface-sunken);  color: var(--c-text-muted); }

/* ---------- Salary input ---------- */

.salary-input {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.salary-input .input { flex: 1; min-width: 0; }

.input.is-warning { border-color: var(--c-warning); }

.field-warning {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin: var(--space-1) 0 0;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--c-warning-text);
}

.field-warning .icon { width: 15px; height: 15px; flex: none; }

/* What a prefill could not fill in, until the user types there. */
.field-missing .input {
  border-color: var(--c-info);
  background: var(--c-info-subtle);
}

/* ============================================================
   ATS matching (/ats-match, and the editor's action)
   ============================================================ */

.atsmatch-head {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

/* The score as a ring: a conic gradient filled to --score percent. The figure
   in the middle says it exactly; the colour only gives the band. */
.atsmatch-score {
  --tone: var(--c-primary);
  flex: none;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: conic-gradient(var(--tone) calc(var(--score) * 1%), var(--c-surface-hover) 0);
}

.atsmatch-score > span {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--c-surface);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
}

.atsmatch-score.is-high { --tone: var(--c-success); }
.atsmatch-score.is-medium { --tone: var(--c-warning); }
.atsmatch-score.is-low { --tone: var(--c-danger); }

.atsmatch-result .progress-bar.is-high { background: var(--c-success); }
.atsmatch-result .progress-bar.is-medium { background: var(--c-warning); }
.atsmatch-result .progress-bar.is-low { background: var(--c-danger); }

/* The public page: wide, the offer and the result need the room. */
.atsmatch-page { max-width: 90%; }

/* The way to the rules: green, so it is seen under the conclusion. */
.atsmatch-rules { color: var(--c-primary-text); }

/* Name over its weight, bar, figure: one line per category. */
.atsmatch-category {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) 3.5rem;
  align-items: center;
  gap: var(--space-3);
}

.atsmatch-percent {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-medium);
}

@media (max-width: 600px) {
  .atsmatch-page { max-width: none; }
  .atsmatch-head { flex-direction: column; align-items: flex-start; }
  .atsmatch-category { grid-template-columns: minmax(0, 1fr) auto; }
  .atsmatch-category .progress { grid-column: 1 / -1; }
  .atsmatch-percent { grid-row: 1; grid-column: 2; }
}


/* ============================================================
   Automation setup (AutomationSetup, on /app): the saved offers to
   tick, the resumes a template can be made from, and the template
   grid's "+".
   ============================================================ */

.automation-choices { margin: 0; padding: 0; list-style: none; }

.automation-choice {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: none;
  border-bottom: var(--border-width) solid var(--c-border);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.automation-choice:hover { background: var(--c-surface-hover); }
.automation-choice:has(input:disabled) { cursor: not-allowed; opacity: 0.6; }

.automation-choice-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.automation-warning { color: var(--c-warning-text); }

.automation-choices-title {
  margin: var(--space-3) 0 var(--space-1);
  font-size: var(--text-sm);
  color: var(--c-text-muted);
}

/* The offer's application already has a resume: ticking it replaces that one. */
.automation-choice-resume {
  display: flex;
  margin-left: auto;
  color: var(--c-success-text);
}

.template-add .template-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-surface-sunken);
  color: var(--c-text-muted);
}
