/* Field Guide components. Hand-written; references semantic tokens only.
   Load after dist/tokens.css. Class prefix: .fg-  */

/* ---------- Base ---------- */
/* Control type (Ted, Figma Components page, 2026-10-15): all control text is
   16px (--fg-font-size-lg). Labels on things you act on - buttons, links,
   checkbox/radio labels, menu rows, filter labels - are demibold.
   Values, messages and status labels - input values, filter values, message
   copy, the toggle's "Applied" - are medium.
   Minimum weight for Albert Sans (UI) text is medium; regular is Fraunces only. */
:root { color-scheme: light; }

/* The hidden attribute wins over component display rules (a hidden .fg-check stays hidden). */
.fg-page [hidden] { display: none !important; }

.fg-page {
  margin: 0;
  background: var(--fg-color-surface-page);
  color: var(--fg-color-text-primary);
  font-family: var(--fg-font-family-ui);
  font-size: var(--fg-font-size-md);
  font-weight: var(--fg-font-weight-medium); /* Albert Sans never lighter than Medium */
  line-height: var(--fg-font-line-height-body);
}

/* Fraunces moments: wordmark, editorial headlines, discovery statements. */
.fg-display {
  font-family: var(--fg-font-family-display);
  font-variation-settings: var(--fg-font-display-variation);
  font-weight: var(--fg-font-weight-regular);
  letter-spacing: var(--fg-font-letter-spacing-tight);
  line-height: var(--fg-font-line-height-tight);
  color: var(--fg-color-text-primary);
  margin: 0;
}

.fg-text-secondary { color: var(--fg-color-text-secondary); }

.fg-link {
  color: var(--fg-color-action-primary);
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-demibold);
  text-decoration: none;
}
.fg-link:hover { text-decoration: underline; }
/* A link-style action that does something on the page (not navigation) is a
   <button class="fg-link">: same look, 44px hit area. */
button.fg-link {
  min-height: var(--fg-size-touch-target);
  padding: 0;
  background: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

:where(.fg-button, .fg-input, .fg-checkbox, .fg-icon-button, .fg-link, .fg-select select, .fg-chip-remove, .fg-chip-add, .fg-wordmark):focus-visible {
  outline: 3px solid var(--fg-color-action-focus-ring);
  outline-offset: 2px;
}

/* ---------- Button ---------- */
/* Primary = Forest ("if Scout wants you to move, Forest shows you where to go").
   Secondary = quiet outlined Ink button. Ghost = Forest text, no outline
   (e.g. "Role preferences" in the dashboard header). */
.fg-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--fg-space-2);
  box-sizing: border-box;
  min-height: var(--fg-size-touch-target); /* every control is 44px tall */
  padding: var(--fg-space-2) var(--fg-space-4);
  font-family: var(--fg-font-family-ui);
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-demibold);
  line-height: var(--fg-font-line-height-tight);
  border-radius: var(--fg-radius-lg);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.fg-button--primary {
  background: var(--fg-color-action-primary);
  color: var(--fg-color-text-on-action);
}
.fg-button--primary:hover {
  background: color-mix(in srgb, var(--fg-color-action-primary) 88%, var(--fg-color-palette-ink));
}
.fg-button--secondary {
  background: transparent;
  color: var(--fg-color-text-primary);
  border-color: var(--fg-color-action-outline);
}
.fg-button--secondary:hover { background: var(--fg-color-action-secondary-fill); }
/* Suggested: the choice Scout points you to inside a quiet pair (Apply beside Hide). Same subtle
   outline as secondary, a light Forest fill and Forest text. Not a filled gray: gray fill means
   disabled, and a filled button can read as an answer already given. One per group. */
.fg-button--suggested {
  background: var(--fg-color-signal-progress-subtle);
  color: var(--fg-color-action-primary);
  border-color: var(--fg-color-action-outline);
}
.fg-button--suggested:hover {
  background: color-mix(in srgb, var(--fg-color-action-primary) 20%, transparent);
}
.fg-button--ghost {
  background: transparent;
  color: var(--fg-color-action-primary);
}
.fg-button--ghost:hover { background: var(--fg-color-signal-progress-subtle); }
.fg-button--block { width: 100%; }
/* Disabled buttons stay readable (secondary text on the secondary fill, 5.1:1)
   instead of fading the whole button; the flat fill says "not yet". */
.fg-button:disabled,
.fg-button:disabled:hover {
  background: var(--fg-color-action-secondary-fill);
  color: var(--fg-color-text-secondary);
  border-color: transparent;
  cursor: not-allowed;
}
/* Working (SC-62): a button that has started something that takes a moment. It is busy, not unavailable, so it
   keeps its own colors and width (no gray disabled look); the label says what is happening ("Sending...") and a
   spinner sits before it. Markup: aria-busy="true" and aria-disabled="true", never disabled, so focus stays put
   and a screen reader hears the new label. Reduced motion slows the spinner instead of stopping it. */
.fg-button[aria-busy="true"] { cursor: progress; }
.fg-spinner {
  box-sizing: border-box;
  flex: none;
  width: var(--fg-size-control);
  height: var(--fg-size-control);
  border-radius: var(--fg-radius-full);
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: fg-spin 0.8s linear infinite;
}
@keyframes fg-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .fg-spinner { animation-duration: 2.4s; } }
/* Disabled form controls share the button's treatment: same opacity, no pointer. */
:where(.fg-checkbox, .fg-radio, .fg-input, .fg-toggle):disabled { opacity: 0.45; cursor: not-allowed; }

/* Icon-only button with a 44px hit area. */
.fg-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--fg-size-touch-target);
  height: var(--fg-size-touch-target);
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--fg-radius-full);
  color: var(--fg-color-text-secondary);
  cursor: pointer;
}
.fg-icon-button svg { display: block; }

/* ---------- Input ---------- */
.fg-field {
  display: flex;
  flex-direction: column;
  gap: var(--fg-space-1);
}
.fg-label {
  padding: 0 var(--fg-space-3);
  font-family: var(--fg-font-family-ui);
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-demibold);
  color: var(--fg-color-text-primary);
}
.fg-input {
  width: 100%;
  box-sizing: border-box;
  padding: var(--fg-space-3);
  font-family: var(--fg-font-family-ui);
  font-size: var(--fg-font-size-lg); /* 16px keeps iOS from zooming on focus */
  font-weight: var(--fg-font-weight-medium);
  color: var(--fg-color-text-primary);
  background: var(--fg-color-surface-field);
  border: 1px solid var(--fg-color-border-strong);
  border-radius: var(--fg-radius-sm);
  min-height: var(--fg-size-touch-target);
}
.fg-input::placeholder { color: var(--fg-color-text-tertiary); }
.fg-input:focus { border-color: var(--fg-color-action-primary); }

/* ---------- Checkbox ---------- */
.fg-check {
  display: inline-flex;
  align-items: center;
  gap: var(--fg-space-2);
  min-height: var(--fg-size-touch-target);
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-demibold);
  cursor: pointer;
}
.fg-checkbox {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: var(--fg-size-control);
  height: var(--fg-size-control);
  margin: 0;
  border: 1.5px solid var(--fg-color-text-secondary);
  border-radius: var(--fg-radius-sm);
  background: transparent;
  cursor: pointer;
}
.fg-checkbox:checked {
  background: var(--fg-color-action-selected);
  border-color: var(--fg-color-action-selected);
}
.fg-checkbox:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 4px;
  height: 9px;
  border: solid var(--fg-color-text-on-action);
  border-width: 0 1.5px 1.5px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

/* ---------- Message ---------- */
/* Color supports meaning, never carries it alone: every message has text,
   and the signal color sits in the fill and left rule, not the text. */
.fg-message {
  box-sizing: border-box;
  margin: 0;
  padding: var(--fg-space-3);
  border-radius: var(--fg-radius-sm);
  border-left: 3px solid transparent;
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-medium);
  line-height: var(--fg-font-line-height-body);
  color: var(--fg-color-text-primary);
  text-align: left;
}
.fg-message--success   { background: var(--fg-color-signal-progress-subtle);  border-left-color: var(--fg-color-action-primary); }
.fg-message--attention { background: var(--fg-color-signal-attention-subtle); border-left-color: var(--fg-color-signal-attention); }
.fg-message--discovery { background: var(--fg-color-signal-discovery-subtle); border-left-color: var(--fg-color-signal-discovery); }

/* ---------- Radio ---------- */
/* Checked state is the Forest check-disc used across Scout (Figma "Radio filled"). */
.fg-radio {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1.5px solid var(--fg-color-text-secondary);
  border-radius: var(--fg-radius-full);
  background: transparent;
  cursor: pointer;
}
.fg-radio:checked {
  background: var(--fg-color-action-selected);
  border-color: var(--fg-color-action-selected);
}
.fg-radio:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 4px;
  height: 8px;
  border: solid var(--fg-color-text-on-action);
  border-width: 0 1.6px 1.6px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}
.fg-radio:focus-visible {
  outline: 3px solid var(--fg-color-action-focus-ring);
  outline-offset: 2px;
}

/* ---------- Filter (pill + dropdown menu) ---------- */
/* Built on <details>/<summary> so it opens without JS. Markup:
   <details class="fg-filter">
     <summary class="fg-filter-pill"><span class="fg-filter-label">Posted</span>
       <span class="fg-filter-value">within 24 hours</span> <svg class="fg-filter-chevron">…</svg></summary>
     <div class="fg-menu"> <label class="fg-menu-item">…</label> … </div>
   </details>
   field-guide/js/filter.js adds close-on-outside-click and Escape. */
.fg-filter { position: relative; }
.fg-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--fg-space-2);
  padding: 6px var(--fg-space-3) 6px var(--fg-space-3);
  border: 1px solid var(--fg-color-action-outline);
  border-radius: var(--fg-radius-xl);
  font-family: var(--fg-font-family-ui);
  font-size: var(--fg-font-size-lg);
  line-height: var(--fg-font-line-height-body);
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.fg-filter-pill::-webkit-details-marker { display: none; }
.fg-filter-pill:hover,
.fg-filter[open] > .fg-filter-pill { background: var(--fg-color-signal-progress-subtle); }
.fg-filter-pill:focus-visible {
  outline: 3px solid var(--fg-color-action-focus-ring);
  outline-offset: 2px;
}
.fg-filter-label { font-weight: var(--fg-font-weight-demibold); color: var(--fg-color-action-primary); }
.fg-filter-value { font-weight: var(--fg-font-weight-medium); color: var(--fg-color-action-subtle-text); }
.fg-filter-chevron {
  display: block;
  flex-shrink: 0;
  color: var(--fg-color-action-primary);
  transition: transform 120ms ease;
}
.fg-filter[open] .fg-filter-chevron { transform: rotate(180deg); }
/* Compact pill (SC-75): on a phone the label drops out and only the value shows, so a row of filters fits one line.
   The label stays in the page for a screen reader ("Work type: Remote"). `fg.filter(…, compact=True)`; wider screens
   keep the label. A value can carry a shorter wording for the phone (`short=`): "within a week" becomes "This week". */
.fg-filter-short { display: none; }
@media (max-width: 680px) {
  .fg-filter--compact .fg-filter-pill { padding-block: var(--fg-space-1); }
  .fg-filter--compact .fg-filter-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  .fg-filter--compact .fg-filter-full { display: none; }
  .fg-filter--compact .fg-filter-short { display: inline; }
  /* A menu in a scrolling row of pills would be clipped by the row, so on a phone it opens as a sheet at the foot of the
     screen, within thumb reach. The gallery's static specimens stay where they are. */
  .fg-filter:not([data-fg-static]):not(.fg-account) > .fg-menu {
    position: fixed;
    top: auto;
    bottom: var(--fg-space-4);
    left: var(--fg-space-3);
    right: var(--fg-space-3);
    min-width: 0;
    z-index: 20;
  }
}
/* A link that sits in the filter row (Viewed jobs). A plain link on a wide screen; on a phone it takes the pill shape
   and its shorter word, so it reads as one more filter. `fg.filter_link(href, label, short)`. */
.fg-filter-link-short { display: none; }
@media (max-width: 680px) {
  .fg-filter-link {
    display: inline-flex;
    align-items: center;
    padding: var(--fg-space-1) var(--fg-space-3);
    border: 1px solid var(--fg-color-action-outline);
    border-radius: var(--fg-radius-xl);
    font-size: var(--fg-font-size-lg);
    font-weight: var(--fg-font-weight-medium);
    line-height: var(--fg-font-line-height-body);
    color: var(--fg-color-text-primary);
    white-space: nowrap;
    text-decoration: none;
  }
  .fg-filter-link:hover { background: var(--fg-color-signal-progress-subtle); }
  .fg-filter-link-full { display: none; }
  .fg-filter-link-short { display: inline; }
}

.fg-menu {
  position: absolute;
  z-index: 10;
  top: calc(100% + var(--fg-space-1));
  left: 0;
  min-width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: var(--fg-space-2) var(--fg-space-4);
  background: var(--fg-color-surface-raised);
  border-radius: var(--fg-radius-md);
  box-shadow: var(--fg-shadow-raised);
}
.fg-menu-item {
  display: flex;
  align-items: center;
  gap: var(--fg-space-3);
  min-height: var(--fg-size-touch-target);
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-demibold);
  color: var(--fg-color-text-secondary);
  white-space: nowrap;
  cursor: pointer;
}
.fg-menu-item:has(:checked) { color: var(--fg-color-text-primary); }
/* Account menu (SC-75): one icon button that holds the actions a phone has no room for in the header (Role preferences,
   Sign out). A <details>, so it opens without script; js/filter.js closes it and moves focus like a menu button. The page
   decides where it shows: the Field Guide only draws it. */
.fg-account > summary { list-style: none; }
.fg-account > summary::-webkit-details-marker { display: none; }
.fg-account > summary:focus-visible { outline: 3px solid var(--fg-color-action-focus-ring); outline-offset: 2px; }
.fg-account[open] > summary { background: var(--fg-color-signal-progress-subtle); color: var(--fg-color-text-primary); }
.fg-account .fg-menu { left: auto; right: 0; min-width: 220px; }
.fg-account .fg-menu form { display: contents; }
/* Menu rows that are links or buttons look like the checkbox rows: the same height, type and spacing. */
.fg-menu a.fg-menu-item,
.fg-menu button.fg-menu-item {
  box-sizing: border-box;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  font-family: var(--fg-font-family-ui);
  text-align: left;
  text-decoration: none;
  color: var(--fg-color-text-primary);
}
.fg-menu a.fg-menu-item:focus-visible,
.fg-menu button.fg-menu-item:focus-visible { outline: 3px solid var(--fg-color-action-focus-ring); outline-offset: 2px; border-radius: var(--fg-radius-sm); }

/* ---------- Toggle ---------- */
/* A single on/off state on one item, shown as a check-disc plus a label (the
   dashboard's "Applied"). Not a checkbox: a checkbox picks items from a list;
   a toggle flips one item's status in place. Markup comes from the fg.toggle
   macro (dashboard/templates/_fg.html); aria-pressed carries the state. */
.fg-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--fg-space-1);
  height: var(--fg-size-touch-target);
  padding: 0 var(--fg-space-1);
  background: none;
  border: 0;
  border-radius: var(--fg-radius-md);
  font-family: inherit;
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-medium); /* a status, not a command: quieter than action labels */
  color: var(--fg-color-text-secondary);
  cursor: pointer;
}
.fg-toggle svg { display: block; flex-shrink: 0; }
.fg-toggle[aria-pressed="true"] svg { color: var(--fg-color-action-selected); }
.fg-toggle:focus-visible {
  outline: 3px solid var(--fg-color-action-focus-ring);
  outline-offset: 0;
}

/* ======================================================================
   Profile components (SC-46). Built for the resume and profile screens;
   usable anywhere. Every control is 44px tall (--fg-size-touch-target).
   ====================================================================== */

/* ---------- Utilities ---------- */
/* Hides an element visually but keeps it for screen readers and keyboards
   (the file input inside a dropzone's button). */
.fg-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
/* A row of actions or chips that wraps on narrow screens. */
.fg-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--fg-space-2) var(--fg-space-3);
}

/* ---------- Page shell ---------- */
/* The centered column most pages sit in. */
.fg-shell {
  box-sizing: border-box;
  width: 100%;
  max-width: 1184px;
  margin: 0 auto;
  padding: 0 var(--fg-space-8);
}
/* Page header: wordmark first, one or two actions (or a line of context) at the end of the row.
   The actions wrap under the wordmark, still right-aligned, when the row runs out of room. */
.fg-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--fg-space-3) var(--fg-space-4);
  padding: var(--fg-space-6) 0;
}
.fg-header-actions {
  display: flex;
  align-items: center;
  gap: var(--fg-space-2);
  margin-left: auto;
}
.fg-header-actions form { display: contents; }
/* A phone gives the header less room (SC-75): a 24px wordmark and 8px above and below, on every page, so the pages' headers
   still match. */
@media (max-width: 680px) {
  .fg-header { padding-block: var(--fg-space-2); }
  .fg-header .fg-wordmark { font-size: var(--fg-font-size-2xl); }
}
/* A ghost button at the end of the row lines its text up with the edge of the content below. */
.fg-header-actions > .fg-button--ghost:last-child { margin-inline-end: calc(-1 * var(--fg-space-4)); }
.fg-wordmark {
  font-family: var(--fg-font-family-display);
  font-variation-settings: var(--fg-font-display-variation);
  font-weight: var(--fg-font-weight-regular);
  font-size: var(--fg-font-size-4xl);
  letter-spacing: var(--fg-font-letter-spacing-tight);
  line-height: var(--fg-font-line-height-tight);
  color: var(--fg-color-text-primary);
  text-decoration: none;
}
.fg-header-context {
  font-size: var(--fg-font-size-md);
  color: var(--fg-color-text-secondary);
}
/* Page intro: Fraunces headline in Scout's voice, then a lede. The headline row can hold something
   on its right (the status strip in settings); it wraps under the headline on narrow screens. */
.fg-intro {
  display: flex;
  flex-direction: column;
  gap: var(--fg-space-3);
}
.fg-intro-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--fg-space-3) var(--fg-space-6);
}
.fg-intro-aside { min-width: 0; max-width: 100%; }  /* shrinks and wraps on a narrow phone */
/* The page headline (h1) is 28px, a step under the 36px wordmark above it. */
.fg-display--page { font-size: var(--fg-font-size-3xl); }
.fg-lede {
  max-width: 680px;
  margin: 0;
  font-size: var(--fg-font-size-xl);
  line-height: var(--fg-font-line-height-body);
  color: var(--fg-color-text-secondary);
  text-align: left;
}
/* Fraunces at reading size, for a sentence in Scout's voice inside a card. */
.fg-voice {
  margin: 0;
  font-family: var(--fg-font-family-display);
  font-variation-settings: var(--fg-font-display-variation);
  font-weight: var(--fg-font-weight-regular);
  font-size: var(--fg-font-size-xl);
  line-height: var(--fg-font-line-height-snug);
  color: var(--fg-color-text-primary);
}

/* Main column plus a sticky side panel; the panel drops below on narrow screens. */
.fg-split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--fg-space-8);
}
.fg-split-main {
  flex: 999 1 560px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--fg-space-5);
}
.fg-side-panel {
  flex: 1 1 300px;
  max-width: 380px;
  min-width: 0;
  position: sticky;
  top: var(--fg-space-6);
  display: flex;
  flex-direction: column;
  gap: var(--fg-space-4);
}

/* ---------- Card ---------- */
/* Card: a step lighter than the page with a hairline border, flat (no shadow;
   Ted preferred this over the raised look for long forms). Title, help, body. */
.fg-card {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--fg-space-4);
  padding: var(--fg-space-6);
  background: var(--fg-color-surface-card);
  border: 1px solid var(--fg-color-border-subtle);
  border-radius: var(--fg-radius-xl);
}
/* Something changed and not yet saved: a Forest outline marks it. */
.fg-card--emphasis { border-color: var(--fg-color-action-primary); box-shadow: inset 0 0 0 1px var(--fg-color-action-primary); }
/* Scout suggests something: Goldenrod tint (Discovery), words stay Ink. */
.fg-card--discovery {
  background-color: var(--fg-color-surface-card);
  background-image: linear-gradient(var(--fg-color-signal-discovery-subtle), var(--fg-color-signal-discovery-subtle));
}
.fg-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--fg-space-2) var(--fg-space-4);
}
.fg-card-title {
  margin: 0;
  font-size: var(--fg-font-size-xl);
  font-weight: var(--fg-font-weight-demibold);
  line-height: var(--fg-font-line-height-snug);
  color: var(--fg-color-text-primary);
}
.fg-card-help {
  margin: var(--fg-space-1) 0 0;
  font-size: var(--fg-font-size-md);
  line-height: var(--fg-font-line-height-body);
  color: var(--fg-color-text-secondary);
  text-align: left;
}
/* Group label above a run of cards: names what the next cards decide. */
.fg-group-label { margin-top: var(--fg-space-3); }
.fg-eyebrow {
  margin: 0;
  font-size: var(--fg-font-size-sm);
  font-weight: var(--fg-font-weight-demibold);
  line-height: var(--fg-font-line-height-snug);
  color: var(--fg-color-text-secondary);
}

/* ---------- Chips ---------- */
/* A chip is one saved value (a title, a skill). Sage tint, Ink words.
   Deal-breaker: Clay outline and tint. New: Goldenrod ring plus a "New" tag. */
.fg-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--fg-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.fg-chip {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: var(--fg-space-1);
  min-height: var(--fg-size-touch-target);
  padding: 0 var(--fg-space-1) 0 var(--fg-space-4);
  border: 1.5px solid transparent;
  border-radius: var(--fg-radius-full);
  background: var(--fg-color-signal-support-subtle);
  color: var(--fg-color-text-primary);
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-medium);
}
.fg-chip--avoid {
  background: var(--fg-color-signal-attention-subtle);
  border-color: var(--fg-color-signal-attention);
}
.fg-chip--new { box-shadow: 0 0 0 2px var(--fg-color-signal-discovery); }
.fg-chip-tag {
  padding: 0 var(--fg-space-1);
  border-radius: var(--fg-radius-sm);
  background: var(--fg-color-signal-discovery);
  color: var(--fg-color-text-primary);
  font-size: var(--fg-font-size-xs);
  font-weight: var(--fg-font-weight-demibold);
  line-height: var(--fg-font-line-height-body);
}
.fg-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: calc(var(--fg-size-touch-target) - var(--fg-space-2));
  height: calc(var(--fg-size-touch-target) - var(--fg-space-2));
  padding: 0;
  border: 0;
  border-radius: var(--fg-radius-full);
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.fg-chip-remove:hover { background: var(--fg-color-surface-hover); }
.fg-chip-remove svg { display: block; }
.fg-chip-add {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: var(--fg-space-1);
  min-height: var(--fg-size-touch-target);
  padding: 0 var(--fg-space-4);
  border: 1.5px dashed var(--fg-color-action-primary);
  border-radius: var(--fg-radius-full);
  background: transparent;
  color: var(--fg-color-action-primary);
  font-family: inherit;
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-demibold);
  cursor: pointer;
}
.fg-chip-add:hover { background: var(--fg-color-signal-progress-subtle); }
.fg-chip-add svg { display: block; flex: none; }

/* ---------- Select ---------- */
/* Same box as .fg-input, with a chevron, so every field on a form matches. */
.fg-select { position: relative; display: block; }
.fg-select select {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  width: 100%;
  min-height: var(--fg-size-touch-target);
  padding: var(--fg-space-3) var(--fg-space-8) var(--fg-space-3) var(--fg-space-3);
  font-family: var(--fg-font-family-ui);
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-medium);
  color: var(--fg-color-text-primary);
  background: var(--fg-color-surface-field);
  border: 1px solid var(--fg-color-action-outline);
  border-radius: var(--fg-radius-sm);
  cursor: pointer;
}
.fg-select select:focus { border-color: var(--fg-color-action-primary); }
.fg-select option { font-weight: var(--fg-font-weight-medium); }
.fg-select select:disabled { opacity: 0.45; cursor: not-allowed; }
.fg-select svg {
  position: absolute;
  right: var(--fg-space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-color-text-secondary);
  pointer-events: none;
}

/* ---------- Fieldset (checkbox or radio group) ---------- */
.fg-fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--fg-space-6);
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
}
.fg-legend {
  margin: 0 0 var(--fg-space-1);
  padding: 0;
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-demibold);
  color: var(--fg-color-text-primary);
}

/* ---------- Segmented control ---------- */
/* One choice from a short ordered set (a level). Real radio inputs, so arrow
   keys move the choice and screen readers announce a group. */
.fg-segmented {
  min-width: 0;
  max-width: 100%; /* fieldsets don't shrink to their container by default */
  margin: 0;
  padding: 0;
  border: 0;
}
.fg-segments {
  display: flex;
  flex-wrap: wrap;
  gap: var(--fg-space-2);
}
.fg-segment {
  position: relative;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  min-height: var(--fg-size-touch-target);
  padding: 0 var(--fg-space-4);
  border: 1.5px solid var(--fg-color-action-subtle-border);
  border-radius: var(--fg-radius-lg);
  color: var(--fg-color-action-primary);
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-demibold);
  cursor: pointer;
}
.fg-segment input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.fg-segment:hover { background: var(--fg-color-signal-progress-subtle); }
.fg-segment:has(:checked) {
  background: var(--fg-color-action-selected);
  border-color: var(--fg-color-action-selected);
  color: var(--fg-color-text-on-action);
}
.fg-segment:has(:focus-visible) {
  outline: 3px solid var(--fg-color-action-focus-ring);
  outline-offset: 2px;
}
.fg-segment:has(:disabled) { opacity: 0.45; cursor: not-allowed; }

/* ---------- Add row ---------- */
/* A text field with its own Add button, for adding one value to a list. */
.fg-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--fg-space-2);
}
.fg-add-row .fg-field { flex: 1 1 260px; }

/* ---------- Status strip ---------- */
/* Is Scout watching? A dot plus words; the dot never carries the state alone. */
.fg-status {
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--fg-space-3);
  padding: var(--fg-space-2) var(--fg-space-2) var(--fg-space-2) var(--fg-space-5);
  background: var(--fg-color-surface-card);
  border: 1px solid var(--fg-color-border-subtle);
  border-radius: var(--fg-radius-xl);
}
.fg-status-text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--fg-space-2);
  margin: 0;
  font-size: var(--fg-font-size-lg);
}
.fg-status-title { font-weight: var(--fg-font-weight-demibold); }
.fg-status-detail { color: var(--fg-color-text-secondary); }
.fg-status-dot {
  box-sizing: border-box;
  flex: none;
  width: var(--fg-space-3);
  height: var(--fg-space-3);
  border-radius: var(--fg-radius-full);
  background: var(--fg-color-action-primary);
}
/* Compact: no box, one line. For beside a page title. */
.fg-status--compact {
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  gap: var(--fg-space-3) var(--fg-space-4);
}
.fg-status--compact .fg-status-text { font-size: var(--fg-font-size-md); }
.fg-status--paused .fg-status-dot {
  background: transparent;
  border: 2px solid var(--fg-color-text-secondary);
}

/* ---------- Switch ---------- */
/* Turns a setting on or off, and it takes effect right away (alerts). Not the Toggle:
   a Toggle marks one item in a list (Applied); a Switch controls a setting. The whole
   row is the button; the label never changes, the detail line under it says the state
   in words ("On since Oct 1"), so color and knob position never carry it alone. */
.fg-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--fg-space-3);
  min-height: var(--fg-size-touch-target);
  padding: 0;
  background: none;
  border: 0;
  border-radius: var(--fg-radius-md);
  font-family: inherit;
  color: var(--fg-color-text-primary);
  text-align: left;
  cursor: pointer;
}
.fg-switch-track {
  position: relative;
  flex: none;
  box-sizing: border-box;
  width: calc(var(--fg-space-8) + var(--fg-space-2));  /* 40px */
  height: var(--fg-space-6);                            /* 24px */
  border: 1.5px solid var(--fg-color-text-secondary);
  border-radius: var(--fg-radius-full);
  background: transparent;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.fg-switch-thumb {
  position: absolute;
  top: 50%;
  left: 3px;
  width: var(--fg-space-4);
  height: var(--fg-space-4);
  border-radius: var(--fg-radius-full);
  background: var(--fg-color-text-secondary);
  transform: translateY(-50%);
  transition: transform 120ms ease, background-color 120ms ease;
}
.fg-switch[aria-checked="true"] .fg-switch-track {
  background: var(--fg-color-action-selected);
  border-color: var(--fg-color-action-selected);
}
.fg-switch[aria-checked="true"] .fg-switch-thumb {
  background: var(--fg-color-text-on-action);
  transform: translate(15px, -50%);  /* 3px from either end of the 40px track */
}
.fg-switch:hover .fg-switch-track { box-shadow: 0 0 0 4px var(--fg-color-signal-progress-subtle); }
.fg-switch:focus-visible {
  outline: 3px solid var(--fg-color-action-focus-ring);
  outline-offset: 2px;
}
.fg-switch[aria-busy="true"] { cursor: progress; }
.fg-switch:disabled { opacity: 0.45; cursor: not-allowed; }
.fg-switch-text { display: flex; flex-direction: column; }
.fg-switch-label {
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-demibold);
  line-height: var(--fg-font-line-height-snug);
}
.fg-switch-detail {
  font-size: var(--fg-font-size-sm);
  font-weight: var(--fg-font-weight-medium);
  line-height: var(--fg-font-line-height-snug);
  color: var(--fg-color-text-secondary);
}
@media (prefers-reduced-motion: reduce) {
  .fg-switch-track, .fg-switch-thumb { transition: none; }
}

/* ---------- Action bar ---------- */
/* Sticks to the bottom of a long form: a note on the left, actions right. */
.fg-action-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: var(--fg-color-surface-page);
  border-top: 1px solid var(--fg-color-border-subtle);
}
.fg-action-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--fg-space-3);
  padding-top: var(--fg-space-4);
  padding-bottom: var(--fg-space-4);
}
.fg-action-bar-note {
  flex: 1 1 260px;
  margin: 0;
  font-size: var(--fg-font-size-md);
  color: var(--fg-color-text-secondary);
}

/* ---------- File row ---------- */
.fg-file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--fg-space-4);
}
.fg-file {
  display: flex;
  align-items: center;
  gap: var(--fg-space-3);
  min-width: 0;
}
.fg-file-text { min-width: 0; }
.fg-file-icon { flex: none; display: block; color: var(--fg-color-action-primary); }
.fg-file-name {
  margin: 0;
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-demibold);
  overflow-wrap: anywhere;
}
.fg-file-meta {
  margin: 0;
  font-size: var(--fg-font-size-md);
  color: var(--fg-color-text-secondary);
}

/* ---------- Dropzone ---------- */
/* Where a file goes. Drop it, or use the button (a label for a hidden file input). */
.fg-dropzone {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--fg-space-5);
  padding: var(--fg-space-8);
  background: var(--fg-color-surface-card);
  border: 2px dashed var(--fg-color-action-primary);
  border-radius: var(--fg-radius-xl);
}
.fg-dropzone--inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: var(--fg-space-5);
}
.fg-dropzone.is-dragover { background: var(--fg-color-signal-progress-subtle); }
.fg-dropzone-title {
  margin: 0;
  font-size: var(--fg-font-size-xl);
  font-weight: var(--fg-font-weight-demibold);
  line-height: var(--fg-font-line-height-snug);
}
.fg-dropzone--inline .fg-dropzone-title { font-size: var(--fg-font-size-lg); }
.fg-dropzone-hint {
  margin: 0;
  font-size: var(--fg-font-size-lg);
  color: var(--fg-color-text-secondary);
}
/* The label that opens the file picker shows focus for its hidden input. */
.fg-button:has(input:focus-visible) {
  outline: 3px solid var(--fg-color-action-focus-ring);
  outline-offset: 2px;
}

/* ---------- List ---------- */
/* Rows of short records (work history, a preview of roles). */
.fg-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}
.fg-list-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--fg-space-1) var(--fg-space-4);
  padding: var(--fg-space-3) 0;
  border-top: 1px solid var(--fg-color-border-subtle);
}
.fg-list-title {
  margin: 0;
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-demibold);
}
.fg-list-meta {
  margin: 0;
  font-size: var(--fg-font-size-md);
  color: var(--fg-color-text-secondary);
}
/* Nothing yet: a dashed rule and placeholder bars where rows will appear. */
.fg-list-row--placeholder {
  flex-direction: column;
  border-top-style: dashed;
  border-top-color: var(--fg-color-border-default);
}
.fg-skeleton {
  display: block;
  height: var(--fg-space-3);
  border-radius: var(--fg-radius-sm);
  background: var(--fg-color-surface-hover);
}
.fg-list-empty {
  margin: 0;
  padding: var(--fg-space-3) 0;
  border-top: 1px solid var(--fg-color-border-subtle);
  font-size: var(--fg-font-size-md);
  color: var(--fg-color-text-secondary);
}

/* ---------- Stat ---------- */
/* A count with its label. Numbers are Ink: a stat reports, it isn't an action. */
.fg-stat {
  display: flex;
  flex-direction: column;
  gap: var(--fg-space-1);
  margin: 0;
}
.fg-stat-value {
  font-size: var(--fg-font-size-4xl);
  font-weight: var(--fg-font-weight-demibold);
  line-height: var(--fg-font-line-height-tight);
  color: var(--fg-color-text-primary);
}
.fg-stat-label {
  font-size: var(--fg-font-size-sm);
  line-height: var(--fg-font-line-height-snug);
  color: var(--fg-color-text-secondary);
}
/* Hero stat: number and sentence on one line. */
.fg-stat--inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--fg-space-2);
}
.fg-stat--inline .fg-stat-label { font-size: var(--fg-font-size-lg); color: var(--fg-color-text-primary); }
/* Several stats side by side. */
.fg-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--fg-space-3);
}
.fg-stats .fg-stat-value { font-size: var(--fg-font-size-3xl); }

/* ---------- Before and after ---------- */
.fg-compare {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--fg-space-2);
  margin: 0;
}
.fg-compare-before,
.fg-compare-after {
  font-size: var(--fg-font-size-3xl);
  font-weight: var(--fg-font-weight-demibold);
  line-height: var(--fg-font-line-height-tight);
}
.fg-compare-before { color: var(--fg-color-text-secondary); }
.fg-compare-after { color: var(--fg-color-text-primary); }
.fg-compare-arrow { display: block; align-self: center; color: var(--fg-color-text-secondary); }
.fg-compare-unit { font-size: var(--fg-font-size-lg); }

@media (max-width: 680px) {
  .fg-shell { padding: 0 var(--fg-space-4); }
  .fg-card { padding: var(--fg-space-4); }
  .fg-dropzone { padding: var(--fg-space-6); }
  .fg-side-panel { position: static; max-width: none; }
}

/* ---------- Progress ---------- */
/* Plain text that changes while something runs, over a bar that fills toward done. No box. The bar's
   fill is set by script (field-guide/js/resume.js) or inline in a specimen. */
.fg-progress {
  display: flex;
  flex-direction: column;
  gap: var(--fg-space-2);
}
.fg-progress-text {
  margin: 0;
  font-size: var(--fg-font-size-md);
  color: var(--fg-color-text-secondary);
}
.fg-progress-bar {
  box-sizing: border-box;
  height: var(--fg-space-2);
  overflow: hidden;
  border-radius: var(--fg-radius-full);
  background: var(--fg-color-signal-progress-subtle);
}
.fg-progress-bar > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--fg-color-action-primary);
  transition: width 0.4s ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .fg-progress-bar > span { transition: none; }
}

/* ---------- Tabs (SC-63) ---------- */
/* Two views of the same jobs ("Open roles", "Applications"). Selected = Ink text over a 2px Forest underline; the rest
   are secondary text. Each tab is a link to its own page, so a tab is always the current state of the server. */
.fg-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--fg-space-6);
  margin-bottom: var(--fg-space-4);
  border-bottom: 1px solid var(--fg-color-border-subtle);
}
.fg-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--fg-space-2);
  box-sizing: border-box;
  min-height: var(--fg-size-touch-target);
  margin-bottom: -1px;
  padding: var(--fg-space-2) 0;
  border-bottom: 2px solid transparent;
  font-family: var(--fg-font-family-ui);
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-demibold);
  color: var(--fg-color-text-secondary);
  text-decoration: none;
}
.fg-tab[aria-selected="true"] {
  color: var(--fg-color-text-primary);
  border-bottom-color: var(--fg-color-action-primary);
}
.fg-tab:hover { color: var(--fg-color-text-primary); }
.fg-tab:focus-visible {
  outline: 3px solid var(--fg-color-action-focus-ring);
  outline-offset: 2px;
  border-radius: var(--fg-radius-sm);
}
.fg-tab-count {
  font-size: var(--fg-font-size-sm);
  font-weight: var(--fg-font-weight-medium);
  color: var(--fg-color-text-secondary);
}

/* ---------- Toast (SC-63) ---------- */
/* Confirms something happened somewhere you can't see, and says where to find it. Bottom centre, above everything,
   never takes focus. The region is the polite live region, so it is in the page before any toast is. Text is left-aligned. */
.fg-toast-region {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--fg-space-6);
  z-index: 20;
  display: flex;
  justify-content: center;
  padding: 0 var(--fg-space-4);
  pointer-events: none;
}
/* In the gallery (and anywhere a toast should sit in the flow) the region is drawn in place instead of fixed. */
.fg-toast-region--static {
  position: static;
  padding: 0;
  justify-content: flex-start;
  pointer-events: auto;
}
.fg-toast {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--fg-space-2) var(--fg-space-4);
  box-sizing: border-box;
  max-width: 560px;
  padding: var(--fg-space-3) var(--fg-space-3) var(--fg-space-3) var(--fg-space-4);
  background: var(--fg-color-palette-ink);
  color: var(--fg-color-text-on-action);
  border-radius: var(--fg-radius-lg);
  box-shadow: var(--fg-shadow-raised);
  text-align: left;
}
.fg-toast-text {
  flex: 1 1 260px;
  margin: 0;
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-medium);
  line-height: var(--fg-font-line-height-body);
}
.fg-toast-actions { display: flex; align-items: center; gap: var(--fg-space-1); }
.fg-toast-action {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  min-height: var(--fg-size-touch-target);
  padding: 0 var(--fg-space-3);
  background: none;
  border: 0;
  border-radius: var(--fg-radius-md);
  font-family: var(--fg-font-family-ui);
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-demibold);
  color: var(--fg-color-text-on-action);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.fg-toast-action:hover { background: rgb(250 249 247 / 0.12); }
.fg-toast-action:focus-visible { outline: 3px solid var(--fg-color-palette-sage); outline-offset: 0; }
@media (max-width: 680px) {
  .fg-toast-region { bottom: var(--fg-space-4); }
}

/* ---------- Job card (SC-63) ---------- */
/* One job as its own bordered card: the job on the left (42%), its state line and one action spot on the right (58%).
   Fractions, not content, set the columns, so the state line stays aligned down a list even though each card is its
   own grid. The whole card opens the posting (the title link's ::after covers it); the action spot sits above that.
   The action is Apply, or the question that replaces it when you come back from the job. Open roles and
   Applications use the same card; Applications has no action spot. */
.fg-job-list {
  list-style: none;
  margin: var(--fg-space-2) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--fg-space-2);
}
.fg-job {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  column-gap: var(--fg-space-6);
  row-gap: var(--fg-space-3);
  padding: var(--fg-space-4);
  background: var(--fg-color-surface-card);
  border: 1px solid var(--fg-color-border-subtle);
  border-radius: var(--fg-radius-sm);
}
.fg-job[hidden] { display: none; }
.fg-job:hover { background: var(--fg-color-surface-hover); }
.fg-job:has(.fg-job-link:focus-visible) {
  outline: 3px solid var(--fg-color-action-focus-ring);
  outline-offset: -3px;
}
/* :where() keeps these card defaults at the lowest specificity, so a class on a paragraph (the serif .fg-voice question)
   always wins. A selector like ".fg-job p" outranked ".fg-voice" and set the serif at weight 500 (SC-68). */
:where(.fg-job) p {
  margin: 0;
  font-weight: var(--fg-font-weight-medium);
  line-height: var(--fg-font-line-height-snug);
}
/* The job column is a small grid: the monogram on the left spans the company and title lines and centres on them; the
   text (company, title, place, pay, fit) all sits in the second column, aligned with each other. */
.fg-job-lead {
  min-width: 0;
  display: grid;
  grid-template-columns: var(--fg-size-mono) minmax(0, 1fr);
  column-gap: var(--fg-space-3);
  row-gap: 2px;
  align-items: center;
}
.fg-job-lead > p, .fg-job-where > p { grid-column: 2; }
/* The place and the pay: two lines in the card's column. A wrapper that takes no box of its own, so the phone can put them
   on one line (below). */
.fg-job-where { display: contents; }
.fg-job-title { font-size: var(--fg-font-size-title); line-height: var(--fg-font-line-height-tight); max-width: 520px; }
.fg-job-link { color: inherit; text-decoration: none; outline: none; }
.fg-job-link::after { content: ""; position: absolute; inset: 0; }
/* The job column, top to bottom: company (a small overline), title, work type and place, then pay. Pay keeps its line
   when it is not known (a blank line, not a dash that reads as an error), so every card is the same height. */
/* The company is a small-caps overline with a little letter spacing. */
.fg-job-company {
  font-size: var(--fg-font-size-sm);
  color: var(--fg-color-text-secondary);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.05em;
}
.fg-job-subline { font-size: var(--fg-font-size-sm); color: var(--fg-color-text-secondary); }
.fg-job-pay {
  font-size: var(--fg-font-size-sm);
  color: var(--fg-color-text-secondary);
  font-variant-numeric: tabular-nums;
  min-height: calc(var(--fg-font-size-xs) * var(--fg-font-line-height-snug));
}
.fg-job-skills { font-size: var(--fg-font-size-sm); color: var(--fg-color-text-secondary); }
.fg-job-fit { margin-top: var(--fg-space-1); }
.fg-job-second {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fg-space-4);
  min-width: 0;
}
/* The middle column: where it was found, then when. After applying, one line: "Applied 3 days ago". In the hidden
   list: "Hidden 2 days ago" with the reason under it. */
.fg-job-state {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--fg-font-size-sm);
  color: var(--fg-color-text-secondary);
}
.fg-job-when { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--fg-space-1); font-variant-numeric: tabular-nums; }
/* Viewed: an eye icon plus the word, in the same quiet text as the time. Never colour alone. It has no date of its
   own: the list is sorted by when jobs were found, so the time on line two is always the discovery time. */
.fg-job-viewed { display: inline-flex; align-items: center; gap: var(--fg-space-1); }
.fg-job-viewed svg { flex: none; }
/* An application that is over (SC-73: not moving forward, closed by you, closed by the employer): the card is quieter.
   The company, title, place, pay and monogram soften (Ink at 70%, still readable); the status line, which says why in
   words, stays at full strength. */
.fg-job--closed .fg-job-company,
.fg-job--closed .fg-job-link,
.fg-job--closed .fg-job-subline,
.fg-job--closed .fg-job-pay,
.fg-job--closed .fg-mono { opacity: 0.7; }
.fg-job-action {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--fg-space-2);
}
.fg-job-action form { display: contents; }
.fg-job-question { font-size: var(--fg-font-size-lg); margin-right: var(--fg-space-1); }
/* Answers and actions are one group and never wrap apart (Apply + Hide, Yes + Not yet, the reason menu + Skip). When
   the card is narrow the question takes its own line and the whole group moves to the next one. */
.fg-job-group { display: inline-flex; flex: none; align-items: center; gap: var(--fg-space-2); }
/* Apply (suggested) and Hide (secondary) share the subtle outline. A ghost button in a group (Skip)
   is quieter still: secondary text, no Forest. */
.fg-job-group .fg-button--ghost { color: var(--fg-color-text-secondary); }
.fg-job-group .fg-button--ghost:hover { background: var(--fg-color-action-secondary-fill); color: var(--fg-color-text-primary); }
/* The reason menu in a card: a pill that is only as wide as its text. */
.fg-job-select { display: inline-block; }
.fg-job-select select {
  width: auto;
  field-sizing: content;
  border-radius: var(--fg-radius-full);
  background: var(--fg-color-surface-card);
  padding-left: var(--fg-space-3);
}
@media (max-width: 680px) {
  .fg-job {
    padding: var(--fg-space-3);
    row-gap: var(--fg-space-2);
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "lead" "state" "action";
  }
  /* SC-75: the place and the pay share one line ("Remote, US · $159,600 – $239,400"); the pay drops to its own line only
     when the two don't fit, and with no pay it is just the place. A card is then short enough for more than one to show. */
  .fg-job-lead { grid-area: lead; grid-template-columns: var(--fg-size-mono-phone) minmax(0, 1fr); }
  .fg-job-lead > .fg-job-where { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--fg-space-1); grid-column: 2; }
  .fg-job-pay::before { content: "·"; margin-right: var(--fg-space-1); content: "·" / ""; }
  .fg-job-pay--none { display: none; }
  .fg-job-second { display: contents; }
  /* On a phone the monogram sits alone on the left; the state and the action line up with the text, not under it. The
     state is one line ("Greenhouse · 7:33 PM · Viewed"); "Discovered on" stays for a screen reader. */
  .fg-job-state { grid-area: state; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0 var(--fg-space-1); padding-left: calc(var(--fg-size-mono-phone) + var(--fg-space-3)); }
  .fg-job-when::before { content: "·"; content: "·" / ""; }
  .fg-job-pre {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  .fg-job-action { grid-area: action; justify-content: flex-start; flex-direction: column; align-items: stretch; padding-left: calc(var(--fg-size-mono-phone) + var(--fg-space-3)); }
  .fg-job-action .fg-job-question { margin-right: 0; }
  /* Phone: the question on its own line, then the group fills the width with equal buttons. */
  .fg-job-group { display: flex; width: 100%; }
  /* a basis of half the group, not 0: a button's padding would otherwise make it wider than its neighbour */
  .fg-job-group .fg-button, .fg-job-group .fg-job-select { flex: 1 1 50%; min-width: 0; }
  .fg-job-group .fg-job-select select { width: 100%; }
}

/* ---------- Company monogram (SC-69) ---------- */
/* Two initials on a soft palette tint, in Ink: a mark for a company without a logo (no real logos: licensing and
   fetching). Decorative, so it is aria-hidden; the company's name is in the text beside it. One tint per company, the
   same every time. */
.fg-mono {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--fg-size-mono);
  height: var(--fg-size-mono);
  grid-column: 1;
  grid-row: 1 / 3;
  border-radius: var(--fg-radius-lg);
  font-size: var(--fg-font-size-md);
  font-weight: var(--fg-font-weight-demibold);
  letter-spacing: 0.02em;
  color: var(--fg-color-text-primary);
}
@media (max-width: 680px) {
  .fg-mono { width: var(--fg-size-mono-phone); height: var(--fg-size-mono-phone); }
}
.fg-mono--sage { background: var(--fg-color-signal-support-subtle); }
.fg-mono--gold { background: var(--fg-color-signal-discovery-subtle); }
.fg-mono--clay { background: var(--fg-color-signal-attention-subtle); }
.fg-mono--forest { background: var(--fg-color-signal-progress-subtle); }

/* ---------- Fit (SC-69) ---------- */
/* How well a job fits, as five pips and one word for the level ("Great fit"). The word carries the meaning, so the pips
   are decorative to a screen reader. Filled versus empty carries the count (shape, not colour alone); the filled pip's
   edge is a deeper Goldenrod so it clears 3:1 against the card with no black outline. Display only: it is not a
   button, and it is never called an ATS score (it is Scout's estimate). */
.fg-fit {
  display: inline-flex;
  align-items: center;
  gap: var(--fg-space-2);
  font-size: var(--fg-font-size-sm);
  font-weight: var(--fg-font-weight-medium);
  color: var(--fg-color-text-secondary);
}
.fg-pips { display: inline-flex; gap: 3px; }
.fg-pip {
  box-sizing: border-box;
  width: var(--fg-space-2);
  height: var(--fg-space-2);
  border-radius: var(--fg-radius-full);
  border: 1px solid var(--fg-color-border-strong);
}
.fg-pip--on {
  background: var(--fg-color-signal-discovery);
  border-color: color-mix(in srgb, var(--fg-color-signal-discovery) 62%, var(--fg-color-palette-ink));
}

/* ---------- Day heading (SC-69) ---------- */
/* Groups a list by when jobs were found: a small label, how many are in the group, and a hairline across. */
.fg-day-head { display: flex; align-items: center; gap: var(--fg-space-3); margin: 0 0 var(--fg-space-2); }
.fg-day-label {
  margin: 0;
  font-size: var(--fg-font-size-sm);
  font-weight: var(--fg-font-weight-demibold);
  color: var(--fg-color-text-primary);
  white-space: nowrap;
}
.fg-day-count { font-weight: var(--fg-font-weight-medium); color: var(--fg-color-text-secondary); }
.fg-day-rule { flex: 1; height: 1px; background: var(--fg-color-border-subtle); }
.fg-day + .fg-day { margin-top: var(--fg-space-6); }
.fg-day[hidden] { display: none; }

/* ---------- Motion for a card that leaves (SC-69) ---------- */
/* After Yes or a hide, the card folds closed instead of jumping away. With reduced motion it only fades. */
.fg-job.is-leaving { animation: fg-fold 240ms ease forwards; pointer-events: none; overflow: hidden; }
@keyframes fg-fold {
  0% { opacity: 1; max-height: 240px; }
  40% { opacity: 0; }
  100% { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; border-width: 0; margin-bottom: calc(var(--fg-space-2) * -1); }
}
@keyframes fg-rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.fg-toast { animation: fg-rise 220ms ease; }
@media (prefers-reduced-motion: reduce) {
  .fg-job.is-leaving { animation: fg-fade 160ms linear forwards; }
  @keyframes fg-fade { to { opacity: 0; } }
  .fg-toast { animation: none; }
}

/* ---------- Panel (SC-72) ---------- */
/* One job's detail, opened from a card and shown beside the list (it pushes the list: no modal, no scrim). Three parts:
   the head (monogram, company, title, Close), a body that scrolls on its own, and a foot that holds the actions. The
   foot always has Apply. The page decides where the panel sits and makes it a full screen sheet on a phone. */
.fg-panel {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  min-height: 0;
  overflow: hidden;
  background: var(--fg-color-surface-page);
  border: 1px solid var(--fg-color-border-default);
  border-radius: var(--fg-radius-md);
}
/* The page animates the panel it opens (a specimen on a page that is already there should not slide). */
@keyframes fg-slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.fg-panel-head {
  display: grid;
  grid-template-columns: var(--fg-size-mono) minmax(0, 1fr) auto;
  column-gap: var(--fg-space-6);
  row-gap: var(--fg-space-1);
  align-items: center;
  padding: var(--fg-space-4) var(--fg-space-4) var(--fg-space-3) var(--fg-space-6);
  border-bottom: 1px solid var(--fg-color-border-subtle);
}
.fg-panel-company {
  margin: 0;
  font-size: var(--fg-font-size-xs);
  font-weight: var(--fg-font-weight-medium);
  color: var(--fg-color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.fg-panel-title {
  margin: 0;
  font-size: var(--fg-font-size-xl);
  font-weight: var(--fg-font-weight-demibold);
  line-height: var(--fg-font-line-height-tight);
  color: var(--fg-color-text-primary);
}
.fg-panel-title:focus { outline: none; }
.fg-panel-head .fg-icon-button { grid-column: 3; grid-row: 1 / 4; align-self: start; }
.fg-panel-head .fg-mono { grid-row: 1 / 4; align-self: start; }
.fg-panel-head .fg-tip-anchor { grid-column: 2; grid-row: 3; justify-self: start; }
.fg-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: var(--fg-space-6);
  padding: var(--fg-space-4) var(--fg-space-6);
}
.fg-panel-help { margin: 0; font-size: var(--fg-font-size-sm); color: var(--fg-color-text-secondary); }
.fg-panel-sec { display: flex; flex-direction: column; gap: var(--fg-space-3); }
.fg-panel-sec-title {
  margin: 0;
  font-size: var(--fg-font-size-lg);
  font-weight: var(--fg-font-weight-demibold);
  color: var(--fg-color-text-primary);
}
.fg-panel-foot {
  display: flex;
  flex-direction: column;
  gap: var(--fg-space-3);
  padding: var(--fg-space-3) var(--fg-space-6) var(--fg-space-4);
  border-top: 1px solid var(--fg-color-border-subtle);
  background: var(--fg-color-surface-page);
}
.fg-panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--fg-space-2); }
.fg-panel-actions > form { display: contents; }
.fg-panel-sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--fg-space-2); }
@media (max-width: 680px) {
  .fg-panel-head { padding-left: var(--fg-space-4); grid-template-columns: var(--fg-size-mono-phone) minmax(0, 1fr) auto; }
  .fg-panel-body { padding: var(--fg-space-4); }
  .fg-panel-foot { padding: var(--fg-space-3) var(--fg-space-4) var(--fg-space-4); }
  .fg-panel-actions .fg-button { flex: 1 1 0; }
}

/* ---------- Text area, files and letter (SC-72) ---------- */
/* A text area is an input that grows: the same field look, free text left-aligned, taller, resized only up and down. */
.fg-textarea {
  display: block;
  min-height: calc(var(--fg-size-touch-target) * 3);
  line-height: var(--fg-font-line-height-body);
  text-align: left;
  resize: vertical;
}
/* A text area the page has fitted to its text (panel.js adds is-fitted): no scroll of its own, no handle. */
.fg-textarea.is-fitted { overflow-y: hidden; resize: none; }
/* History (SC-73): what happened to an application, newest first. A date, a dot on a thin line, then the words. The newest
   line's dot is filled Forest, the others are hollow; the words carry the meaning, the dot only marks the place. */
.fg-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.fg-history-item { display: grid; grid-template-columns: 56px 12px minmax(0, 1fr); column-gap: var(--fg-space-3); align-items: start; padding-bottom: var(--fg-space-3); }
.fg-history-item:last-child { padding-bottom: 0; }
.fg-history-date { font-size: var(--fg-font-size-sm); color: var(--fg-color-text-secondary); font-variant-numeric: tabular-nums; line-height: var(--fg-font-line-height-body); }
.fg-history-dot { position: relative; align-self: stretch; }
.fg-history-dot::before {
  content: "";
  position: absolute;
  top: var(--fg-space-1);
  left: 0;
  box-sizing: border-box;
  width: 12px;
  height: 12px;
  border-radius: var(--fg-radius-full);
  border: 1.5px solid var(--fg-color-border-strong);
  background: var(--fg-color-surface-card);
}
.fg-history-item:first-child .fg-history-dot::before { background: var(--fg-color-action-primary); border-color: var(--fg-color-action-primary); }
.fg-history-dot::after {
  content: "";
  position: absolute;
  top: calc(var(--fg-space-1) + 12px);
  bottom: calc(var(--fg-space-3) * -1);
  left: 5px;
  width: 1px;
  background: var(--fg-color-border-subtle);
}
.fg-history-item:last-child .fg-history-dot::after { display: none; }
.fg-history-text { margin: 0; line-height: var(--fg-font-line-height-body); }
.fg-files { display: flex; flex-direction: column; gap: var(--fg-space-3); }
.fg-files .fg-file-row {
  padding: var(--fg-space-3);
  background: var(--fg-color-surface-card);
  border: 1px solid var(--fg-color-border-subtle);
  border-radius: var(--fg-radius-sm);
}
.fg-letter { display: flex; flex-direction: column; gap: var(--fg-space-3); }

/* ---------- Requirement list (SC-72) ---------- */
/* What a posting asks for, one per line, each marked against the person's resume: a filled check (in your resume), a
   dashed ring (not in your resume) or a dot (not checked, because there is no resume yet). The words say it too, so
   the mark is never the only signal. */
.fg-reqs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: var(--fg-color-surface-card);
  border: 1px solid var(--fg-color-border-subtle);
  border-radius: var(--fg-radius-sm);
}
.fg-req {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: var(--fg-space-3);
  align-items: center;
  padding: var(--fg-space-3) var(--fg-space-4);
  font-size: var(--fg-font-size-md);
  font-weight: var(--fg-font-weight-medium);
  color: var(--fg-color-text-primary);
}
.fg-req + .fg-req { border-top: 1px solid var(--fg-color-border-subtle); }
.fg-req-mark { color: var(--fg-color-action-primary); }
.fg-req-mark--no { color: var(--fg-color-text-secondary); }
.fg-req-tick { stroke: var(--fg-color-text-on-action); }
.fg-req-state { font-size: var(--fg-font-size-sm); color: var(--fg-color-text-secondary); white-space: nowrap; }
@media (max-width: 680px) {
  .fg-req { grid-template-columns: 20px minmax(0, 1fr); }
  .fg-req-state { grid-column: 2; white-space: normal; }
}

/* ---------- Selected job card and the list beside a panel (SC-72) ---------- */
/* The card the panel belongs to gets the Forest edge. While a panel is open the list is narrower, so each card stacks:
   the job on top, then its state and actions in one row under it. */
.fg-job.is-selected { border-color: var(--fg-color-action-primary); box-shadow: 0 0 0 1px var(--fg-color-action-primary); }
@media (min-width: 681px) {
  .fg-has-panel .fg-job { grid-template-columns: minmax(0, 1fr); }
  .fg-has-panel .fg-job-second { padding-left: calc(var(--fg-size-mono) + var(--fg-space-3)); }
}

/* ---------- Steps (SC-72) ---------- */
/* Where the person is in applying: Prep, Tailor, Apply. The current step is Forest with aria-current; steps before it
   show a Forest outline and say "(done)" for screen readers. The first thing in the panel's body, never a navigation. */
.fg-steps {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--fg-font-size-sm);
  font-weight: var(--fg-font-weight-medium);
  color: var(--fg-color-text-secondary);
}
/* A connector line between one step and the next. */
.fg-step + .fg-step::before {
  content: "";
  flex: none;
  width: 64px;
  height: 1px;
  margin-left: var(--fg-space-2);
  background: var(--fg-color-border-default);
}
.fg-step { display: inline-flex; align-items: center; gap: var(--fg-space-2); }
.fg-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--fg-radius-full);
  border: 1px solid var(--fg-color-border-default);
  font-size: var(--fg-font-size-xs);
  font-variant-numeric: tabular-nums;
}
.fg-step[aria-current="step"] { color: var(--fg-color-text-primary); font-weight: var(--fg-font-weight-demibold); }
.fg-step[aria-current="step"] .fg-step-num {
  background: var(--fg-color-action-primary);
  border-color: var(--fg-color-action-primary);
  color: var(--fg-color-text-on-action);
}
.fg-step.is-done .fg-step-num { border-color: var(--fg-color-action-primary); color: var(--fg-color-action-primary); }
@media (max-width: 680px) { .fg-step + .fg-step::before { width: 28px; } }

/* ---------- Tooltip (SC-72) ---------- */
/* A short note on something small that is not a button, such as the fit under the panel's title. The anchor wraps the
   focusable thing and the note; the note shows on hover, on keyboard focus, and on tap (panel.js adds .is-shown), and
   Escape puts it away. The thing it explains points at it with aria-describedby. */
.fg-tip-anchor { position: relative; display: inline-flex; }
.fg-fit-tip { display: inline-flex; border-radius: var(--fg-radius-sm); cursor: default; }
.fg-tip {
  display: none;
  position: absolute;
  z-index: 5;
  left: 0;
  top: calc(100% + var(--fg-space-1));
  box-sizing: border-box;
  width: max-content;
  max-width: min(320px, 80vw);
  padding: var(--fg-space-1) var(--fg-space-2);
  background: var(--fg-color-surface-raised);
  border: 1px solid var(--fg-color-border-subtle);
  border-radius: var(--fg-radius-md);
  box-shadow: var(--fg-shadow-raised);
  font-size: var(--fg-font-size-sm);
  font-weight: var(--fg-font-weight-medium);
  line-height: var(--fg-font-line-height-snug);
  color: var(--fg-color-text-secondary);
  text-align: left;
}
.fg-tip-anchor:hover .fg-tip, .fg-tip-anchor:focus-within .fg-tip, .fg-tip.is-shown { display: block; }

/* ---------- Lead card (SC-72) ---------- */
/* What to lead with, in a Goldenrod card: the fill and edge are Goldenrod and the words are Ink, so the colour never
   carries the meaning. A real list under a Fraunces heading. */
.fg-lead {
  display: flex;
  flex-direction: column;
  gap: var(--fg-space-2);
  padding: var(--fg-space-3) var(--fg-space-4);
  background: var(--fg-color-signal-discovery-subtle);
  border: 1px solid var(--fg-color-signal-discovery);
  border-radius: var(--fg-radius-sm);
}
.fg-lead .fg-lead-title {   /* two classes: a page's own h3 rule (the gallery's .spec h3) must not outrank it */
  margin: 0;
  font-family: var(--fg-font-family-display);
  font-variation-settings: var(--fg-font-display-variation);
  font-weight: var(--fg-font-weight-regular);
  font-size: var(--fg-font-size-lg);
  line-height: var(--fg-font-line-height-snug);
  color: var(--fg-color-text-primary);
}
.fg-lead-list {
  margin: 0;
  padding-left: var(--fg-space-5);
  display: flex;
  flex-direction: column;
  gap: var(--fg-space-1);
  font-size: var(--fg-font-size-md);
  font-weight: var(--fg-font-weight-medium);
  line-height: var(--fg-font-line-height-body);
  color: var(--fg-color-text-secondary);
}

/* ---------- Change list (SC-72) ---------- */
/* What tailoring changed in the resume, one card per change: its kind and where, the text before (struck through) and
   after, why, and Undo. An undone change fades its After and says "Undone" in words; the resume keeps its Before. */
.fg-changes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--fg-space-2); }
.fg-change {
  display: flex;
  flex-direction: column;
  gap: var(--fg-space-2);
  padding: var(--fg-space-4);
  background: var(--fg-color-surface-card);
  border: 1px solid var(--fg-color-border-subtle);
  border-radius: var(--fg-radius-sm);
}
.fg-change.is-undone { background: var(--fg-color-surface-page); }
.fg-change.is-undone .fg-change-after, .fg-change.is-undone .fg-change-why { opacity: 0.55; }
.fg-change-head { display: flex; align-items: center; justify-content: space-between; gap: var(--fg-space-3); }
.fg-change-head > form { margin: 0; }
.fg-change-kind { margin: 0; font-size: var(--fg-font-size-sm); font-weight: var(--fg-font-weight-demibold); color: var(--fg-color-text-primary); }
.fg-change-state { font-weight: var(--fg-font-weight-medium); color: var(--fg-color-text-secondary); }
.fg-change-where { margin: 0; font-size: var(--fg-font-size-sm); color: var(--fg-color-text-secondary); }
.fg-change-before, .fg-change-after { margin: 0; line-height: var(--fg-font-line-height-body); }
.fg-change-before { color: var(--fg-color-text-secondary); font-weight: var(--fg-font-weight-medium); }
.fg-change-before :is(.fg-change-text, ol) { text-decoration: line-through; text-decoration-color: var(--fg-color-border-default); }
.fg-change-after { color: var(--fg-color-text-primary); font-weight: var(--fg-font-weight-medium); }
.fg-change-before ol, .fg-change-after ol { margin: var(--fg-space-1) 0 0; padding-left: var(--fg-space-5); }
.fg-change-why { margin: 0; font-size: var(--fg-font-size-sm); color: var(--fg-color-text-secondary); }
.fg-change-label {
  display: inline-block;
  margin-right: var(--fg-space-2);
  font-size: var(--fg-font-size-xs);
  font-weight: var(--fg-font-weight-demibold);
  color: var(--fg-color-text-secondary);
}

/* While a tailoring runs: grey bars where the changes will appear. */
.fg-panel-work { display: flex; flex-direction: column; gap: var(--fg-space-3); }
.fg-panel-work .fg-skeleton:nth-child(1) { width: 90%; }
.fg-panel-work .fg-skeleton:nth-child(2) { width: 75%; }
.fg-panel-work .fg-skeleton:nth-child(3) { width: 82%; }
.fg-panel-work .fg-skeleton:nth-child(4) { width: 60%; }
