/*
 * Page patterns (docs/design-system.md §13): list, detail, form and confirm
 * pages for screens that have no Figma frame. Everything here is derived from
 * the Figma screens' visual language: radius-16 panels on bg/surface, 24 px
 * between rows, the Targets/Tasks filter row (36 px controls, 8 px apart),
 * the Reports library table, the "Upload details" fields and the Overview
 * legends. Tokens only; no raw colours.
 *
 * Loaded on every page by core/partials/head.html, after layout.css.
 */


/* ===================================================================== */
/* List page: toolbar row (scope/view switch left, filters + search right) */
/* ===================================================================== */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  min-height: var(--control-height-sm);
}

.toolbar__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px; /* Targets filters: 137 + 8 = 145 */
  min-width: 0;
}

.toolbar__group--end {
  margin-left: auto;
  justify-content: flex-end;
}

/* Compact search that submits ?q= (keeps the other filters as hidden inputs). */
.toolbar-search {
  position: relative;
  width: 232px;
  min-width: 0;
}

.toolbar-search .input {
  height: var(--control-height-sm);
  padding-left: 36px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.toolbar-search .input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-right: -2px;
  background-color: var(--text-tertiary);
  -webkit-mask: url("../icons/x.f573cbb32973.svg") center / contain no-repeat;
  mask: url("../icons/x.f573cbb32973.svg") center / contain no-repeat;
  cursor: pointer;
}

/* An applied filter: the button shows the chosen value in primary text. */
.filter-btn--active {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.filter-btn--active .i:first-child {
  color: var(--brand-red);
}

.filter-btn__value {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Active-filter chips with a remove link, and "Clear all". */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 28px;
  padding: 0 4px 0 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--text-primary);
  font: var(--type-label-xs-strong);
  letter-spacing: var(--track-label-xs-strong);
  white-space: nowrap;
}

.filter-chip__key {
  color: var(--text-tertiary);
  font-weight: 500;
}

.filter-chip__value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-chip__remove {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  color: var(--text-tertiary);
  transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}

.filter-chip__remove:hover {
  background: var(--overlay-secondary);
  color: var(--text-primary);
}

.filter-chips__clear {
  padding: 0 4px;
  color: var(--text-tertiary);
  font: var(--type-label-xs-strong);
  letter-spacing: var(--track-label-xs-strong);
}

.filter-chips__clear:hover {
  color: var(--text-primary);
}

@media (max-width: 767px) {
  .toolbar__group--end {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .toolbar-search {
    flex: 1 1 100%;
    width: auto;
  }
}


/* ===================================================================== */
/* Tables: sortable headers ({% sort_th %}) and rows that open on click   */
/* ===================================================================== */

.th-sort__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -4px -6px;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-out);
}

.th-sort__icon {
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.th-sort__link:hover,
.th-sort__link:focus-visible {
  color: var(--text-secondary);
}

.th-sort__link:hover .th-sort__icon,
.th-sort__link:focus-visible .th-sort__icon {
  opacity: 0.8;
}

.th-sort[aria-sort] .th-sort__link {
  color: var(--text-secondary);
}

.th-sort[aria-sort] .th-sort__icon {
  opacity: 1;
  color: var(--brand-red);
}

/* Right-aligned numeric columns keep the arrow on the left of the label. */
.th-sort.col-num .th-sort__link,
.th-sort.text-end .th-sort__link {
  flex-direction: row-reverse;
}

/* Whole-row click target without JS: the row's title link stretches over the
   row (<a class="cell-title row-link">); other controls in the row stay on top. */
.table--linked tbody tr {
  position: relative;
}

.table--linked tbody tr:hover,
.table--linked tbody tr:focus-within {
  background: var(--overlay-hover);
}

.table--linked .row-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* Keyboard focus rings the whole row (the link's overlay), not just the title. */
.table--linked .row-link:focus-visible {
  outline: none;
}

.table--linked .row-link:focus-visible::after {
  outline: 2px solid var(--brand-red-bright);
  outline-offset: -2px;
}

.table--linked tbody :is(a, button, input, select, label, .dropdown, [tabindex]):not(.row-link) {
  position: relative;
  z-index: 1;
}

.table--linked tbody .dropdown:has([aria-expanded="true"]) {
  z-index: 3;
}

/* Footer text: "Showing 1–25 of 214 clients" ({% page_summary %}). */
.page-summary {
  color: var(--text-tertiary);
  font: var(--type-body-xs);
}

/* Empty state inside a flush panel (table replaced by the message). */
.panel--flush > .empty {
  padding: 56px 24px 60px;
}

.panel--flush > .panel__head:has(+ .empty) {
  border-bottom: 1px solid var(--border-subtle);
}


/* ===================================================================== */
/* Detail page                                                           */
/* ===================================================================== */

/* Breadcrumb: "Clients / Kestrel Pay". */
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-tertiary);
  font: var(--type-label-s);
  letter-spacing: var(--track-label-s);
}

.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%; /* a long crumb (a report filename) ellipsizes, never scrolls the page */
}

.breadcrumb li > a {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.breadcrumb li + li::before {
  content: "/";
  color: var(--border-strong);
}

.breadcrumb a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

.breadcrumb a:hover {
  color: var(--text-primary);
}

.breadcrumb [aria-current="page"] {
  overflow: hidden;
  color: var(--text-secondary);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Eyebrow-sized breadcrumb for the detail header ("CLIENTS / KESTREL PAY"). */
.breadcrumb--eyebrow ol {
  gap: 4px 6px;
  font: var(--type-eyebrow);
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
}

.breadcrumb--eyebrow li {
  gap: 6px;
}

/* Header band: tile, eyebrow, title + pills, meta line, actions. */
.detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  background: var(--bg-surface);
}

.detail-head__media {
  flex: none;
}

.detail-head__main {
  display: flex;
  /* The band wraps: when the title column would get narrower than 440 px
     (detail pages between 768 and about 1300 px), the actions drop to their
     own row, as they do on phones, instead of squeezing the title. */
  flex: 1 1 440px;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.detail-head__eyebrow {
  color: var(--text-tertiary);
  font: var(--type-eyebrow);
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
}

.detail-head__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}

.detail-head__title {
  min-width: 0;
  color: var(--text-primary);
  font: var(--type-h3);
  letter-spacing: var(--track-h3);
  overflow-wrap: anywhere;
}

.detail-head__pills {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.detail-head__main > .meta-line,
.detail-head__main > .stat-group {
  margin-top: 4px;
}

.detail-head__actions {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Large letter tile for header bands ({% letter_tile client "lg" %}). */
.letter-tile--lg {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-xl);
  font: var(--type-h4);
  letter-spacing: var(--track-h4);
}

@media (max-width: 767px) {
  .detail-head {
    flex-wrap: wrap;
    gap: 16px;
    padding: 20px;
  }

  .detail-head__main {
    flex-basis: calc(100% - 68px);
  }

  .detail-head__title {
    font: var(--type-h4);
    letter-spacing: var(--track-h4);
  }

  .detail-head__actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* Dot-separated facts: "Kestrel Pay · 3 engagements · Added Nov 14". */
.meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  /* Every item carries a leading "·" hung in the 24 px gap before it; the
     list clips its left edge, so the dot of the first item on each wrapped
     line is hidden instead of dangling. The clip margin keeps focus rings. */
  overflow: clip;
  overflow-clip-margin: 6px;
  color: var(--text-tertiary);
  font: var(--type-body-s);
  letter-spacing: var(--track-body-s);
}

.meta-line > li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.meta-line > li::before {
  content: "·";
  flex: none;
  width: 24px;
  margin-left: -24px;
  margin-right: -6px; /* cancels the li gap: the dot takes no room */
  color: var(--text-tertiary);
  text-align: center;
}

.meta-line .i {
  --i-size: 14px;
}

.meta-line strong {
  color: var(--text-secondary);
  font-weight: 500;
}

.meta-line a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

.meta-line a:hover {
  color: var(--text-primary);
}

.meta-line--sm {
  font: var(--type-body-xs);
  letter-spacing: var(--track-body-xs);
}

/* Main column + 360 px aside (Reports: 732 + 360); one column below 1200. */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--section-gap);
  align-items: start;
}

.detail-grid__main,
.detail-grid__aside {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
  min-width: 0;
}

@media (max-width: 1199px) {
  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Row of tabs (segmented role=tablist) with optional actions on the right. */
.tabs-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tabs-bar .segmented {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

/* A bar that scrolls sideways fades its clipped edges (app.js sets the classes only when it overflows). */
.segmented.is-clipped-end {
  -webkit-mask-image: linear-gradient(to left, transparent, black 32px);
  mask-image: linear-gradient(to left, transparent, black 32px);
}

.segmented.is-clipped-start {
  -webkit-mask-image: linear-gradient(to right, transparent, black 32px);
  mask-image: linear-gradient(to right, transparent, black 32px);
}

.segmented.is-clipped-start.is-clipped-end {
  -webkit-mask-image: linear-gradient(to right, transparent, black 32px, black calc(100% - 32px), transparent);
  mask-image: linear-gradient(to right, transparent, black 32px, black calc(100% - 32px), transparent);
}

/* Count inside a segment (Tasks design: "Mine 2"). */
.segmented__count {
  color: var(--text-tertiary);
  font: 500 11px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.segmented__item[aria-current="page"] .segmented__count,
.segmented__item[aria-selected="true"] .segmented__count,
.segmented__item[aria-pressed="true"] .segmented__count,
.segmented__item.is-active .segmented__count {
  color: var(--text-secondary);
}

/* Properties in an aside: label left, value right, rows divided. */
.meta-list--rows {
  display: block;
}

.meta-list--rows > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  padding: 10px 0;
}

.meta-list--rows > div + div {
  border-top: 1px solid var(--border-subtle);
}

.meta-list--rows > div:first-child {
  padding-top: 0;
  min-height: 34px;
}

.meta-list--rows > div:last-child {
  padding-bottom: 0;
  min-height: 34px;
}

.meta-list--rows dt {
  flex: none;
  padding-top: 0;
  font: var(--type-label-s);
  letter-spacing: var(--track-label-s);
}

.meta-list--rows dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin: 0;
  text-align: right;
}

@media (max-width: 560px) {
  .meta-list--rows dd {
    margin-bottom: 0;
  }
}

/* Activity timeline (audit events): marker, sentence, ago time. */
.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline__item {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  column-gap: 12px;
  padding-bottom: 20px;
}

.timeline__item:last-child {
  padding-bottom: 0;
}

/* Connector between markers. */
.timeline__item:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 34px;
  bottom: 6px;
  left: 13.5px;
  width: 1px;
  background: var(--border-subtle);
}

.timeline__marker {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
}

.timeline__icon {
  --tone: var(--text-secondary);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  background: var(--bg-raised);
  color: var(--tone);
}

.timeline__icon[class*="tone-"] {
  border-color: transparent;
  background: color-mix(in srgb, var(--tone) var(--alpha-chip), transparent);
}

.timeline__icon .i {
  --i-size: 14px;
}

.timeline__content {
  min-width: 0;
  padding-top: 3px;
}

.timeline__text {
  color: var(--text-secondary);
  font: var(--type-body-s);
  letter-spacing: var(--track-body-s);
  overflow-wrap: anywhere;
}

.timeline__text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.timeline__text a,
.timeline__object {
  color: var(--text-primary);
  font-weight: 500;
}

.timeline__text a:hover {
  color: var(--brand-red-bright);
}

.timeline__note {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font: var(--type-body-s);
  letter-spacing: var(--track-body-s);
  overflow-wrap: anywhere;
}

.timeline__time {
  display: block;
  margin-top: 2px;
  color: var(--text-tertiary);
  font: var(--type-body-xs);
}

.timeline__empty {
  color: var(--text-tertiary);
  font: var(--type-body-s);
}


/* ===================================================================== */
/* Form page (create / edit)                                             */
/* ===================================================================== */

.form-page {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
  width: 100%;
  max-width: 880px;
  margin-inline: auto;
}

.form-section__head {
  margin-bottom: 20px;
}

.form-section__title {
  color: var(--text-primary);
  font: var(--type-h5);
  letter-spacing: var(--track-h5);
}

.form-section__desc {
  margin-top: 4px;
  color: var(--text-tertiary);
  font: var(--type-body-xs);
}

/* A field spanning both columns of form-grid--2 (notes, multi-selects). */
.form-grid > .field--full {
  grid-column: 1 / -1;
}

.alert__title {
  color: var(--text-primary);
  font: var(--type-label-s-strong);
  letter-spacing: var(--track-label-s-strong);
}

.alert__body ul {
  margin: 0;
  padding-left: 18px;
}

/* Native date / time pickers. Plain inputs keep the native glyph, tinted
   tertiary. With a leading icon ({% form_field form.due icon="calendar" %})
   the native glyph becomes an invisible layer over the whole control, so
   there is one calendar icon and a click anywhere opens the picker
   (Chromium/WebKit; typing still works from the keyboard). */
.input::-webkit-calendar-picker-indicator {
  margin-right: -2px;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.input::-webkit-calendar-picker-indicator:hover {
  opacity: 0.9;
}

.control > .input:is([type="date"], [type="datetime-local"], [type="month"], [type="week"], [type="time"]) {
  position: relative;
}

.control > .input:is([type="date"], [type="datetime-local"], [type="month"], [type="week"], [type="time"])::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  margin: 0;
  opacity: 0;
}

.input:is([type="date"], [type="datetime-local"], [type="time"]) {
  font-variant-numeric: tabular-nums;
}

.input:is([type="date"], [type="datetime-local"], [type="time"]):invalid:not(:focus) {
  color: var(--text-secondary);
}

/* Read-only values in forms (e.g. a generated slug or the owner). */
.input[readonly] {
  border-color: var(--border-subtle);
  color: var(--text-secondary);
  cursor: default;
}

/* Chip multi-select (M2M fields as checkboxes; works without JS). */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  height: 32px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  color: var(--text-secondary);
  font: var(--type-label-s);
  letter-spacing: var(--track-label-s);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: border-color var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.chip-check input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.chip-check__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-check__mark {
  --i-size: 14px;
  --i-src: url("../icons/plus.3e18e3ea9c5f.svg");
  display: inline-block;
  flex: none;
  width: var(--i-size);
  height: var(--i-size);
  background-color: var(--text-tertiary);
  -webkit-mask: var(--i-src) center / contain no-repeat;
  mask: var(--i-src) center / contain no-repeat;
}

.chip-check:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.chip-check:has(input:checked) {
  border-color: color-mix(in srgb, var(--brand-red) var(--alpha-ring), transparent);
  background: color-mix(in srgb, var(--brand-red) var(--alpha-chip), transparent);
  color: var(--text-primary);
}

.chip-check input:checked ~ .chip-check__mark {
  --i-src: url("../icons/check.ec39d9ae5f39.svg");
  background-color: var(--brand-red-bright);
}

.chip-check:has(input:focus-visible) {
  outline: 2px solid var(--brand-red-bright);
  outline-offset: 2px;
}

.chip-check:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}

/* People chips: avatar first, the check mark only when selected. */
.chip-check--person {
  padding-left: 4px;
}

.chip-check--person .chip-check__mark {
  display: none;
}

.chip-check--person input:checked ~ .chip-check__mark {
  display: inline-block;
}

.chip-field[aria-invalid="true"] .chip-check:not(:has(input:checked)) {
  border-color: color-mix(in srgb, var(--brand-red) 45%, var(--border-subtle));
}

/* Sticky action bar at the bottom of the viewport (long forms). */
.form-actions {
  position: sticky;
  bottom: 16px;
  z-index: var(--z-sticky);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 20px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  background: color-mix(in srgb, var(--bg-surface) 90%, transparent);
  box-shadow: var(--elevation-float);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
}

.form-actions__hint {
  margin-right: auto;
  color: var(--text-tertiary);
  font: var(--type-body-xs);
}

.form-actions__danger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--brand-red-bright);
  font: var(--type-button-m);
  letter-spacing: var(--track-button-m);
  cursor: pointer;
}

.form-actions__danger:hover {
  color: var(--base-white);
}

.form-actions__danger + .form-actions__hint {
  margin-right: 0;
}

.form-actions__buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

@media (max-width: 559px) {
  .form-actions {
    bottom: 8px;
    padding: 12px;
  }

  .form-actions__buttons {
    width: 100%;
  }

  .form-actions__buttons .btn {
    flex: 1 1 0;
  }

  .form-actions__hint {
    display: none;
  }
}


/* ===================================================================== */
/* Confirm page (delete)                                                 */
/* ===================================================================== */

.confirm-page {
  display: flex;
  justify-content: center;
  padding: 24px 0 48px;
}

.confirm-card {
  width: 100%;
  max-width: 560px;
  padding: 32px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  background: var(--bg-surface);
}

.confirm-card__icon {
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--brand-red) 5%, transparent);
}

.confirm-card__title {
  margin-top: 24px;
  color: var(--text-primary);
  font: var(--type-h4);
  letter-spacing: var(--track-h4);
  overflow-wrap: anywhere;
}

.confirm-card__body {
  margin-top: 8px;
  color: var(--text-secondary);
  font: var(--type-body-s);
  letter-spacing: var(--track-body-s);
}

.confirm-card__body strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* What the action removes or changes, with counts of related objects. */
.impact-list {
  margin: 20px 0 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  list-style: none;
}

.impact-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 14px;
  color: var(--text-secondary);
  font: var(--type-label-s);
  letter-spacing: var(--track-label-s);
}

.impact-list li + li {
  border-top: 1px solid var(--border-subtle);
}

.impact-list .i {
  --i-size: 16px;
  color: var(--text-tertiary);
}

.impact-list strong {
  color: var(--text-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.impact-list__tone-danger .i,
.impact-list__tone-danger strong {
  color: var(--brand-red-bright);
}

.confirm-card .alert {
  margin-top: 16px;
}

.confirm-card__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 28px;
}

@media (max-width: 559px) {
  .confirm-page {
    padding: 0 0 24px;
  }

  .confirm-card {
    padding: 24px 20px;
  }

  .confirm-card__actions {
    flex-direction: column-reverse;
  }

  .confirm-card__actions .btn {
    width: 100%;
  }
}


/* ===================================================================== */
/* Small pieces                                                          */
/* ===================================================================== */

/* Copy-to-clipboard field ({% copy_field %}): read-only mono input + button. */
.copy-field {
  display: flex;
  min-width: 0;
}

.copy-field__input.input {
  flex: 1 1 auto;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  color: var(--text-primary);
  font: var(--type-mono-xs);
  letter-spacing: 0;
  text-overflow: ellipsis;
  cursor: text;
}

.copy-field__btn.btn {
  flex: none;
  margin-left: -1px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.copy-field__btn:focus-visible {
  z-index: 1;
}

@media (max-width: 420px) {
  .copy-field__btn span:not(.i) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* Monospace values: hostnames, hashes, IDs (Tasks design: 12 px mono). */
.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  font-variant-ligatures: none;
}

.mono-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  height: 22px;
  padding: 0 7px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: var(--bg-raised);
  color: var(--text-secondary);
  font: 400 12px/20px var(--font-mono);
  font-variant-ligatures: none;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Inline stats: label over value, separated by hairlines. Every stat has a
   left hairline and 24 px padding; the group's -24 px margin and clipping hide
   the hairline and indent of whichever stat starts a line, so wrapping stays
   clean at any width. */
.stat-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 0;
  margin: 0 0 0 -24px;
  overflow: hidden;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin-left: -1px;
  padding: 0 24px;
  border-left: 1px solid var(--border-subtle);
}

.stat__label {
  color: var(--text-tertiary);
  font: var(--type-body-xs);
  white-space: nowrap;
}

.stat__value {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  margin: 0;
  color: var(--text-primary);
  font: var(--type-h4);
  letter-spacing: var(--track-h4);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat__value small {
  color: var(--text-tertiary);
  font: var(--type-body-xs);
}

.stat__value.c-red { color: var(--brand-red); }
.stat__value.c-green { color: var(--status-success); }

/* Severity distribution: thin stacked bar of the four chart severities. */
.sev-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.sev-bar__track {
  display: block;
  width: 100%;
  height: 6px;
  overflow: visible;
}

.sev-bar__bg { fill: var(--bg-raised); }
.sev-bar__seg--critical { fill: var(--severity-critical); }
.sev-bar__seg--high { fill: var(--severity-high); }
.sev-bar__seg--medium { fill: var(--severity-medium); }
.sev-bar__seg--low { fill: var(--severity-low); }

.sev-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sev-legend__item {
  --tone: var(--tone-gray);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font: var(--type-body-xs);
  white-space: nowrap;
}

.sev-legend__dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 2px;
  background: var(--tone);
}

.sev-legend__value {
  color: var(--text-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sev-legend__item--critical { --tone: var(--severity-critical); }
.sev-legend__item--high { --tone: var(--severity-high); }
.sev-legend__item--medium { --tone: var(--severity-medium); }
.sev-legend__item--low { --tone: var(--severity-low); }

.sev-legend__item.is-zero .sev-legend__value {
  color: var(--text-tertiary);
  font-weight: 500;
}

.sev-bar--compact .sev-legend {
  gap: 4px 12px;
}
