/* =========================================================
   components.css
   =============
   Upload, lens list, verdict card. Builds on tokens.css.
   ========================================================= */

/* ─── Dropzone ──────────────────────────────────────── */

.dropzone-form { margin-bottom: var(--spacing--medium); }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing--xsmall);
  padding: var(--spacing--2xlarge) var(--spacing--large);
  border: 2px dashed var(--color--neutral-200);
  border-radius: var(--radius--card);
  background: var(--color--neutral-050);
  text-align: center;
  cursor: pointer;
  transition:
    border-color var(--motion--fast) var(--ease--standard),
    background var(--motion--fast) var(--ease--standard);
}
.dropzone:hover,
.dropzone--hover {
  border-color: var(--color--secondary);
  background: var(--color--secondary-tint);
}

.dropzone__icon { color: var(--color--primary); opacity: 0.8; margin-bottom: var(--spacing--xsmall); }
.dropzone__title { font-size: var(--text-size--medium); font-weight: var(--fw--semibold); color: var(--color--primary); }
.dropzone__sub { font-size: var(--text-size--small); color: var(--color--neutral-500); }
.dropzone__btn { margin-top: var(--spacing--medium); }
.dropzone__formats {
  margin-top: var(--spacing--xsmall);
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-400);
  letter-spacing: 0.04em;
}

/* Upload-validation card (Commit 25b).
   Inline rgba derived from var(--color--error) at 8% / 20% so no new
   token is introduced. The card sits above the dropzone when the
   structured upload-validation envelope is bound to validation_error. */
.upload-error {
  margin-top: var(--spacing--medium);
  margin-bottom: var(--spacing--medium);
  padding: var(--spacing--medium);
  background: rgba(255, 49, 49, 0.08);
  border: 1px solid rgba(255, 49, 49, 0.2);
  color: var(--color--gray-700);
  border-radius: var(--radius--input);
  font-size: var(--text-size--small);
  position: relative;
}

.upload-error__headline + .upload-error__action,
.upload-error__headline + .upload-error__chip {
  margin-top: 12px;
}
.upload-error__action + .upload-error__chip {
  margin-top: 8px;
}

.upload-error__headline {
  margin: 0;
  font-family: 'Altone', system-ui, sans-serif;
  font-weight: var(--fw--semibold);
  font-size: var(--text-size--small);
  color: var(--color--gray-700);
  line-height: 1.45;
}

.upload-error__action {
  margin: 8px 0 0;
  font-family: 'Altone', system-ui, sans-serif;
  font-weight: 400;
  font-size: var(--text-size--small);
  color: var(--color--gray-700);
  line-height: 1.45;
}

.upload-error__what-to-do {
  color: var(--color--gray-700);
}

.upload-error__upgrade {
  font-size: var(--text-size--small);
  margin-left: 6px;
}

.upload-error__chip {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 49, 49, 0.18);
  text-align: right;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--color--gray-500);
  letter-spacing: 0.04em;
}

.upload-error__chip-label,
.upload-error__chip-value {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--color--gray-500);
}

.upload-error__chip-value {
  margin-left: 4px;
}

/* Help link (Commit 30). Sits inline on the chip row alongside the
   subcode value. Subcode-aware href comes from validation_error.help_url
   built by iadtx.upload_validation.help_url_for. */
.upload-error__help {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.04em;
  margin-left: 12px;
  color: var(--color--gray-700);
  text-decoration: underline;
}

.upload-error__help:hover {
  color: var(--color--primary);
}

/* ─── Sample tiles ──────────────────────────────────── */

.samples {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing--xsmall);
  margin-top: var(--spacing--medium);
}
@media (max-width: 479px) {
  .samples { grid-template-columns: 1fr; }
}

.sample-form { margin: 0; padding: 0; }

.sample {
  display: flex;
  align-items: center;
  gap: var(--spacing--medium);
  padding: var(--spacing--medium) var(--spacing--medium);
  background: var(--color--white);
  border: 1px solid var(--color--neutral-150);
  border-radius: var(--radius--button);
  color: var(--color--primary);
  font-size: var(--text-size--small);
  transition: border-color var(--motion--fast) var(--ease--standard);
  width: 100%;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.sample:hover {
  border-color: var(--color--secondary);
  color: var(--color--primary);
}

.sample__icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sample--green .sample__icon { background: var(--color--secondary-tint); color: var(--color--secondary-dark); }
.sample--amber .sample__icon { background: var(--color--accent-tint); color: var(--color--accent-amber); }

.sample__label { font-weight: var(--fw--semibold); font-size: var(--text-size--small); color: var(--color--primary); }
.sample__meta { font-size: var(--text-size--tiny); color: var(--color--neutral-500); margin-top: 1px; }

/* ─── File row (State B) ───────────────────────────── */

.file-row {
  display: flex;
  align-items: center;
  gap: var(--spacing--medium);
  margin-bottom: var(--spacing--large);
}

.file-badge {
  display: flex;
  align-items: center;
  gap: var(--spacing--xsmall);
  padding: var(--spacing--xsmall) var(--spacing--medium);
  background: var(--color--neutral-050);
  border: 1px solid var(--color--neutral-150);
  border-radius: var(--radius--button);
  flex: 1;
  min-width: 0;
}
.file-badge__icon { color: var(--color--neutral-500); display: flex; align-items: center; flex-shrink: 0; }
.file-badge__name { font-weight: var(--fw--semibold); font-size: var(--text-size--small); color: var(--color--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-badge__meta { font-size: var(--text-size--tiny); color: var(--color--neutral-500); margin-left: var(--spacing--xxsmall); white-space: nowrap; }

.file-row__remove {
  padding: var(--spacing--xsmall) var(--spacing--medium);
  font-size: var(--text-size--small);
  color: var(--color--neutral-500);
  border-radius: var(--radius--button);
}
.file-row__remove:hover { color: var(--color--danger); background: transparent; }

/* ─── Diagnose form ─────────────────────────────────── */

.diagnose-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing--medium);
  margin-bottom: var(--spacing--large);
}

.diagnose-form__label {
  font-size: var(--text-size--small);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
}

.diagnose-form__select {
  font-family: var(--font--primary);
  font-size: var(--text-size--base);
  padding: 10px 12px;
  border: 1px solid var(--color--neutral-200);
  border-radius: var(--radius--input);
  background: var(--color--white);
  color: var(--color--primary);
  cursor: pointer;
}

.confidence-note {
  font-size: var(--text-size--small);
  padding: var(--spacing--xsmall) var(--spacing--medium);
  border-radius: var(--radius--input);
  margin: var(--spacing--xxsmall) 0 0;
}
.confidence-note--high   { background: var(--color--secondary-tint); color: var(--color--secondary-dark); }
.confidence-note--medium { background: var(--color--accent-tint);    color: var(--color--accent-amber); }
.confidence-note--low    { background: var(--color--neutral-100);    color: var(--color--neutral-600); }

/* ─── Identifier hint and min-n hint (Commit 29) ─────── */

.identifier-hint {
  font-size: var(--text-size--small);
  color: var(--color--neutral-700);
  margin: var(--spacing--xxsmall) 0 0;
  padding: 0 var(--spacing--medium);
}

.upload__min-n-hint {
  font-size: var(--text-size--small);
  color: var(--color--neutral-700);
  background: var(--color--neutral-050);
  border-left: 3px solid var(--color--neutral-600);
  padding: var(--spacing--xsmall) var(--spacing--medium);
  border-radius: 0 var(--radius--input) var(--radius--input) 0;
  margin: var(--spacing--xsmall) 0 0;
}

.diagnose-form__submit {
  justify-content: center;
  font-size: var(--text-size--medium);
  padding: 14px 20px;
  margin-top: var(--spacing--xsmall);
}

/* ─── Lens list ─────────────────────────────────────── */

.section-break {
  margin: var(--spacing--xlarge) 0 var(--spacing--large);
}

.section-title {
  font-size: var(--text-size--medium);
  margin-bottom: var(--spacing--xxsmall);
}

.section-sub {
  font-size: var(--text-size--small);
  color: var(--color--neutral-600);
  margin-bottom: var(--spacing--medium);
}

.panel__desc {
  font-size: var(--text-size--small);
  color: var(--color--neutral-500);
  margin-top: -4px;
  margin-bottom: var(--spacing--medium);
  max-width: 64ch;
  line-height: 1.55;
}

.lens-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing--medium); /* 16px card-to-card per 4pt grid spec */
}

.lens {
  border: 1px solid var(--color--neutral-150);
  border-radius: var(--radius--card);
  background: var(--color--white);
  overflow: hidden;
}

.lens--locked { opacity: 0.72; }

.lens__body {
  padding: var(--spacing--large);  /* 24px all sides per 4pt grid spec */
  display: flex;
  align-items: flex-start;
  gap: var(--spacing--medium);     /* 16px icon tile to text */
}

.lens__icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--color--neutral-100);
  color: var(--color--neutral-600);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lens__text { flex: 1; min-width: 0; }

.lens__head {
  display: flex;
  align-items: center;
  gap: var(--spacing--xsmall);
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.lens__name {
  font-size: var(--text-size--small);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
}

.lens__tier {
  font-size: var(--text-size--tiny);
  font-weight: var(--fw--semibold);
  padding: 2px 7px;
  border-radius: var(--radius--pill);
  background: var(--color--neutral-100);
  color: var(--color--neutral-500);
}
.lens__tier--ok { background: var(--color--secondary-tint); color: var(--color--secondary-dark); }

.lens__desc {
  font-size: var(--text-size--small);
  color: var(--color--neutral-600);
  line-height: var(--line-height--body);
  margin-bottom: var(--spacing--xxsmall); /* 4px desc to best-for row */
}

.lens__hint {
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-400);
}

/* ─── Verdict card (Commit 4 stub; final in Commit 5) ─── */

.verdict-card {
  border-radius: var(--radius--card);
  padding: var(--spacing--large);
  margin-top: var(--spacing--large);
  border: 1.5px solid var(--color--secondary-edge);
  background: var(--color--secondary-soft);
}
.verdict-card--multiplicative { border-color: var(--color--secondary-edge); background: var(--color--tile-green); }
.verdict-card--additive { border-color: var(--color--error); background: #FEECEC; }
/* Commit 26: MIXED reads as a separate register from the two diagnostic
   verdicts. Gray-200 / gray-600 pair, distinct from the gray-100 /
   gray-700 pair used by MODEL_INADEQUATE and DATA_INSUFFICIENT. */
.verdict-card--mixed { border-color: var(--color--gray-200); background: var(--color--gray-200); }
.verdict-card--model_inadequate { border-color: var(--color--gray-200); background: var(--color--gray-100); }
.verdict-card--data_insufficient { border-color: var(--color--gray-200); background: var(--color--gray-100); }

.verdict-card__word {
  font-size: var(--text-size--2xlarge);
  font-weight: var(--fw--semibold);
  line-height: var(--line-height--heading);
  color: var(--color--primary);
  margin-top: var(--spacing--xxsmall);
  margin-bottom: var(--spacing--xsmall);
  letter-spacing: var(--letter-spacing--tight);
}
@media (max-width: 479px) {
  .verdict-card__word {
    font-size: var(--text-size--xlarge);
    line-height: 1.1;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}
.verdict-card--multiplicative .verdict-card__word { color: var(--color--secondary); }
.verdict-card--additive .verdict-card__word { color: var(--color--error); }
.verdict-card--mixed .verdict-card__word { color: var(--color--gray-600); }
.verdict-card--model_inadequate .verdict-card__word { color: var(--color--gray-700); }
.verdict-card--data_insufficient .verdict-card__word { color: var(--color--gray-700); }

.verdict-card__sub {
  font-size: var(--text-size--small);
  color: var(--color--neutral-600);
  line-height: var(--line-height--body);
}

/* Commit 26: improvement block. Rendered when verdict is one of the two
   diagnostic verdicts (MODEL_INADEQUATE, DATA_INSUFFICIENT). */
.improvement-block {
  margin-top: var(--spacing--medium);
  padding: var(--spacing--large);
  border: 1px solid var(--color--gray-200);
  background: var(--color--white);
  border-radius: var(--radius--card);
}

.improvement-block__title {
  font-size: var(--text-size--medium);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
  margin-bottom: var(--spacing--xsmall);
}

.improvement-block__intro {
  font-size: var(--text-size--small);
  color: var(--color--gray-600);
  line-height: var(--line-height--body);
  margin-bottom: var(--spacing--medium);
}

.improvement-block__heading {
  font-size: var(--text-size--small);
  font-weight: var(--fw--semibold);
  color: var(--color--gray-700);
  margin-top: var(--spacing--medium);
  margin-bottom: var(--spacing--xsmall);
}

.improvement-block__list {
  list-style: disc;
  padding-left: var(--spacing--large);
  font-size: var(--text-size--small);
  color: var(--color--gray-700);
  line-height: var(--line-height--body);
}

.improvement-block__list li {
  margin-bottom: var(--spacing--xxsmall);
}

/* Commit 27: disagreement strip. Rendered between the verdict masthead
   and the improvement block when the verdict is MODEL_INADEQUATE.
   Names which two of three structural readings disagree. */
.disagreement-strip {
  margin: var(--spacing--large) 0;
  padding: var(--spacing--large);
  background: var(--color--white);
  border: 1px solid var(--color--gray-200);
  border-left: 4px solid var(--color--gray-700);
  border-radius: var(--radius--card);
}

.disagreement-strip__heading {
  margin: 0 0 var(--spacing--medium) 0;
  font-size: var(--text-size--medium);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
  letter-spacing: var(--letter-spacing--tight);
}

.disagreement-strip__row {
  display: flex;
  gap: var(--spacing--large);
  margin-bottom: var(--spacing--medium);
}

.disagreement-strip__leg {
  flex: 1 1 0;
}

.disagreement-strip__eyebrow {
  font-size: var(--text-size--tiny);
  font-weight: var(--fw--semibold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing--eyebrow);
  color: var(--color--gray-500);
  margin-bottom: var(--spacing--xxsmall);
}

.disagreement-strip__reading {
  font-size: var(--text-size--base);
  line-height: var(--line-height--body);
  color: var(--color--gray-700);
  margin: 0;
}

.disagreement-strip__summary {
  font-size: var(--text-size--base);
  line-height: var(--line-height--body);
  color: var(--color--gray-700);
  margin: 0;
}

@media (max-width: 479px) {
  .disagreement-strip__row {
    flex-direction: column;
    gap: var(--spacing--medium);
  }
}

/* Commit 28a: upload-page derived-covariate warnings. Soft amber
   accent on the left, white background, peer-level visual register
   with the result-page caveat. Advisory tone, not error tone, so
   the user understands the diagnostic can still proceed. */
.upload-warnings {
  margin: var(--spacing--medium) 0;
  padding: var(--spacing--medium) var(--spacing--large);
  background: var(--color--white);
  border: 1px solid var(--color--gray-200);
  border-left: 4px solid var(--color--accent-amber);
  border-radius: var(--radius--card);
}

.upload-warnings__heading {
  margin: 0 0 var(--spacing--medium) 0;
  font-size: var(--text-size--medium);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
  letter-spacing: var(--letter-spacing--tight);
}

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

.upload-warnings__item {
  display: block;
  margin: 0 0 var(--spacing--xsmall) 0;
}

.upload-warnings__item:last-child {
  margin-bottom: 0;
}

.upload-warnings__body {
  margin: 0;
  font-size: var(--text-size--base);
  line-height: var(--line-height--body);
  color: var(--color--gray-700);
}

.upload-warnings__footnote {
  margin: var(--spacing--medium) 0 0 0;
  font-size: var(--text-size--small);
  line-height: var(--line-height--body);
  color: var(--color--gray-500);
}

/* Commit 28a: result-page derived-covariate caveat. Same visual
   register as the disagreement strip (white background, gray-700
   left accent, gray-200 border) so the two strips sit at peer level
   when both render. The caveat sits above the disagreement strip
   because the caveat is a meta-statement about diagnostic validity. */
.derived-covariate-caveat {
  margin: var(--spacing--large) 0;
  padding: var(--spacing--large);
  background: var(--color--white);
  border: 1px solid var(--color--gray-200);
  border-left: 4px solid var(--color--gray-700);
  border-radius: var(--radius--card);
}

.derived-covariate-caveat__heading {
  margin: 0 0 var(--spacing--medium) 0;
  font-size: var(--text-size--medium);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
  letter-spacing: var(--letter-spacing--tight);
}

.derived-covariate-caveat__body {
  margin: 0;
  font-size: var(--text-size--base);
  line-height: var(--line-height--body);
  color: var(--color--gray-700);
}

/* ─── KPI row ──────────────────────────── */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing--xsmall);
  margin-top: var(--spacing--medium);
}
@media (max-width: 479px) {
  .kpi-row { grid-template-columns: 1fr; }
}

.kpi {
  background: var(--color--white);
  border: 1px solid var(--color--neutral-150);
  border-left: 3px solid var(--color--neutral-200);
  border-radius: var(--radius--button);
  padding: var(--spacing--medium) var(--spacing--medium);
}
.kpi--g { border-left-color: var(--color--secondary); }
.kpi--a { border-left-color: var(--color--accent-amber); }
.kpi--r { border-left-color: var(--color--danger); }
.kpi--muted { border-left-color: var(--color--neutral-200); }

.kpi__label {
  font-size: var(--text-size--tiny);
  font-weight: var(--fw--semibold);
  color: var(--color--neutral-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--spacing--xxsmall);
}
.kpi__value {
  font-size: var(--text-size--large);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
  line-height: 1;
}
.kpi__unit {
  font-size: var(--text-size--small);
  color: var(--color--neutral-500);
  font-weight: var(--fw--regular);
  margin-left: 2px;
}
.kpi__detail {
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-500);
  margin-top: var(--spacing--xxsmall);
}

/* ─── Variable classification table ────────── */

.varstable-wrap {
  overflow-x: auto;
  border: 1px solid var(--color--neutral-150);
  border-radius: var(--radius--card);
  background: var(--color--white);
}

.varstable {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-size--small);
}

.varstable thead th {
  background: var(--color--primary);
  color: var(--color--white);
  font-size: var(--text-size--tiny);
  font-weight: var(--fw--semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  padding: var(--spacing--xsmall) var(--spacing--medium);
}
.varstable tbody td {
  padding: var(--spacing--xsmall) var(--spacing--medium);
  border-top: 1px solid var(--color--neutral-150);
  vertical-align: middle;
}
.varstable tbody tr:first-child td { border-top: none; }

.varstable__name {
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.varstable__cr {
  display: flex;
  align-items: center;
  gap: var(--spacing--xsmall);
  min-width: 180px;
}
.varstable__bar {
  flex: 1;
  height: 6px;
  background: var(--color--neutral-100);
  border-radius: var(--radius--pill);
  overflow: hidden;
  max-width: 160px;
}
.varstable__bar-fill {
  height: 100%;
  border-radius: var(--radius--pill);
  background: var(--color--neutral-200);
  transition: width var(--motion--medium) var(--ease--standard);
}
.varstable__bar-fill--multiplicative { background: var(--color--secondary); }
.varstable__bar-fill--additive       { background: var(--color--error); }

.varstable__cr-text {
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-600);
  white-space: nowrap;
}

.pill {
  display: inline-block;
  font-size: var(--text-size--tiny);
  font-weight: var(--fw--semibold);
  padding: 3px 10px;
  border-radius: var(--radius--pill);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pill--multiplicative {
  background: var(--color--secondary);
  color: var(--color--white);
}
.pill--additive {
  background: var(--color--error);
  color: var(--color--white);
}
.pill--mixed {
  background: var(--color--tile-gold);
  color: var(--color--gray-700);
}

/* ─── Findings ──────────────────────────── */

.findings {
  background: var(--color--neutral-050);
  border: 1px solid var(--color--neutral-150);
  border-radius: var(--radius--card);
  padding: var(--spacing--medium) var(--spacing--large);
  display: flex;
  flex-direction: column;
  gap: var(--spacing--xsmall);
}
.findings__item {
  font-size: var(--text-size--small);
  color: var(--color--neutral-600);
  line-height: var(--line-height--body);
  position: relative;
  padding-left: var(--spacing--medium);
}
.findings__item::before {
  content: '';
  position: absolute;
  left: 0;
  top: calc(var(--line-height--body) * 0.5em - 3px);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color--secondary);
}

/* ─── Download rows ────────────────────── */

.downloads {
  display: flex;
  flex-direction: column;
  gap: var(--spacing--xsmall);
}

.download-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing--medium);
  background: var(--color--white);
  border: 1px solid var(--color--neutral-150);
  border-radius: var(--radius--card);
  padding: var(--spacing--medium) var(--spacing--medium);
  flex-wrap: wrap;
}
.download-row__text { flex: 1; min-width: 220px; }
.download-row__title {
  font-size: var(--text-size--small);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
  margin-bottom: 2px;
}
.download-row__meta {
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-500);
}
.download-row__buttons {
  display: flex;
  gap: var(--spacing--xxsmall);
  flex-shrink: 0;
}
.download-row__hint {
  width: 100%;
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-500);
  margin-top: var(--spacing--xxsmall);
}

/* Commit 26: EU AI Act preparation line. Sits above the validation-report
   row in Downloads. Plain text, not in a legal-copy block. */
.download-row__eu-ai-act {
  font-size: var(--text-size--small);
  color: var(--color--gray-600);
  line-height: var(--line-height--body);
  margin-top: var(--spacing--medium);
  margin-bottom: var(--spacing--xsmall);
}

/* ─── Lens result panel ─────────────────────────── */
/* Replaces the lens card when the lens runs, via HTMX outerHTML swap. */

.lens-result {
  border: 1px solid var(--color--neutral-150);
  border-radius: var(--radius--card);
  background: var(--color--white);
  padding: var(--spacing--medium) var(--spacing--large);
}

.lens-result--locked {
  background: var(--color--neutral-050);
}

.lens-result__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing--medium);
  margin-bottom: var(--spacing--medium);
}
.lens-result__title {
  font-size: var(--text-size--medium);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
}
.lens-result__rerun {
  font-size: var(--text-size--tiny);
  padding: 6px 10px;
  color: var(--color--neutral-500);
}
.lens-result__rerun:hover { color: var(--color--secondary); }

.lens-result__summary {
  font-size: var(--text-size--small);
  color: var(--color--neutral-600);
  line-height: var(--line-height--body);
  margin-bottom: var(--spacing--medium);
}

.lens-result__top {
  display: flex;
  align-items: center;
  gap: var(--spacing--medium);
  background: var(--color--secondary-soft);
  border: 1px solid var(--color--secondary-edge);
  border-radius: var(--radius--button);
  padding: var(--spacing--xsmall) var(--spacing--medium);
  margin-bottom: var(--spacing--medium);
}
.lens-result__top-label {
  font-size: var(--text-size--tiny);
  font-weight: var(--fw--semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color--secondary-dark);
}
.lens-result__top-pair {
  font-size: var(--text-size--small);
  color: var(--color--primary);
}

.lens-result__table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color--neutral-150);
  border-radius: var(--radius--button);
}
.lens-result__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-size--small);
}
.lens-result__table thead th {
  background: var(--color--neutral-050);
  color: var(--color--neutral-600);
  font-size: var(--text-size--tiny);
  font-weight: var(--fw--semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  padding: var(--spacing--xsmall) var(--spacing--medium);
}
.lens-result__table tbody td {
  padding: var(--spacing--xsmall) var(--spacing--medium);
  border-top: 1px solid var(--color--neutral-150);
  vertical-align: middle;
}
.lens-result__pair-sep {
  color: var(--color--neutral-400);
  margin: 0 6px;
}
.lens-result__strengths { color: var(--color--neutral-600); }

.lens-result__surprise {
  display: flex;
  align-items: center;
  gap: var(--spacing--xsmall);
  min-width: 160px;
}
.lens-result__bar {
  flex: 1;
  height: 6px;
  background: var(--color--neutral-100);
  border-radius: var(--radius--pill);
  overflow: hidden;
  max-width: 120px;
}
.lens-result__bar-fill {
  height: 100%;
  background: var(--color--accent-amber);
  border-radius: var(--radius--pill);
  transition: width var(--motion--medium) var(--ease--standard);
}
.lens-result__surprise-text {
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-600);
  white-space: nowrap;
}

.lens-result__footnote {
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-500);
  margin-top: var(--spacing--medium);
}

.lens-result__empty {
  font-size: var(--text-size--small);
  color: var(--color--neutral-600);
  line-height: var(--line-height--body);
}

/* ─── Lens locked / limit partials ──────────────── */

.lens-result__locked {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing--medium);
}
.lens-result__locked-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--color--accent-tint);
  color: var(--color--accent-amber);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lens-result__locked-body { flex: 1; }
.lens-result__locked-title {
  font-size: var(--text-size--small);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
  margin-bottom: 4px;
}
.lens-result__locked-msg {
  font-size: var(--text-size--small);
  color: var(--color--neutral-600);
  margin-bottom: var(--spacing--medium);
  line-height: var(--line-height--body);
}

/* ─── Lens inline forms (Commit 9) ───────────────── */
/* Sits below the lens__body so the card expands vertically when the
   tier unlocks the lens and a file input is required. */

.lens__form {
  display: flex;
  align-items: center;
  gap: var(--spacing--xsmall);
  padding: var(--spacing--xsmall) var(--spacing--medium) var(--spacing--medium);
  flex-wrap: wrap;
  border-top: 1px solid var(--color--neutral-150);
}

.lens__file {
  /* Wrapper keeps the hidden input aligned to its label. */
  position: relative;
  display: inline-flex;
  align-items: stretch;
  max-width: 240px;
}
.lens__file input[type="file"] {
  /* Visually hidden but reachable by keyboard; click propagates to label. */
  position: absolute;
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  overflow: hidden;
  white-space: nowrap;
}
.lens__file-label {
  /* Secondary-button appearance so the label is clearly clickable. */
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  background: var(--color--white);
  border: 1px solid var(--color--neutral-200);
  border-radius: var(--radius--button);
  cursor: pointer;
  font-size: var(--text-size--small);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
  max-width: 240px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition:
    border-color var(--motion--fast) var(--ease--standard),
    background var(--motion--fast) var(--ease--standard);
}
.lens__file-label:hover,
.lens__file input[type="file"]:focus-visible + .lens__file-label {
  border-color: var(--color--secondary);
  background: var(--color--secondary-tint);
  outline: 2px solid var(--color--secondary);
  outline-offset: 2px;
}

.lens__form-run {
  padding: 8px 16px;
  font-size: var(--text-size--small);
  margin-left: auto;
}

.lens__sample-link {
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-500);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}
.lens__sample-link:hover { color: var(--color--secondary); }

/* ─── Commit 16: spacing audit -- strict 4pt grid ─ */

/* Section intro sits above the card stack, inside .lens-list.
   heading top-margin: 80px (3xlarge), heading to paragraph: 16px (medium),
   paragraph to first card: 24px (large, via .lens-list gap override below). */
.lens-list__intro {
  margin-top: var(--spacing--3xlarge);   /* 80px from preceding section */
  margin-bottom: var(--spacing--large);  /* 24px to first card */
}
.lens-list__heading {
  font-size: var(--text-size--medium);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
  margin-bottom: var(--spacing--medium); /* 16px heading to paragraph */
}
.lens-list__subheading {
  font-size: var(--text-size--small);
  color: var(--color--neutral-600);
  line-height: var(--line-height--body);
  max-width: 64ch;
}

/* Tinted tile: 40x40 square, 8px radius, per-lens colour */
.lens__tile {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lens__tile--amber  { background: #FEF3E0; }   /* warm amber tint */
.lens__tile--sky    { background: #E6F0FF; }   /* soft sky tint */
.lens__tile--neutral { background: #F0F2F5; }  /* neutral grey tint */
.lens__tile--blush  { background: #FCE7EA; }   /* blush pink tint */

/* Best-for row: neutral grey, middle-dot separators.
   margin-bottom 16px provides the best-for-to-button-row gap via footer padding. */
.lens__bestfor {
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-500);
  line-height: 1.45;
  margin-top: var(--spacing--xxsmall); /* 4px desc to best-for row */
}
.lens__bestfor-label {
  font-weight: var(--fw--semibold);
  color: var(--color--neutral-500);
  margin-right: 2px;
}

/* Footer area: button row + format hint.
   16px top padding creates best-for-to-button-row gap from body bottom edge. */
.lens__footer {
  padding: var(--spacing--medium) var(--spacing--large); /* 16px v, 24px h */
  border-top: 1px solid var(--color--neutral-150);
  display: flex;
  flex-direction: column;
  gap: var(--spacing--medium); /* 16px between button rows */
}
.lens__footer--no-file {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing--medium);
}
.lens__footer--onprem {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing--medium);
  flex-wrap: wrap;
}

/* Button row: Download + Upload buttons side by side.
   Gap 16px horizontally between button and format hint. */
.lens__btn-row {
  display: flex;
  align-items: center;
  gap: var(--spacing--medium); /* 16px button-to-format-hint horizontal gap */
  flex-wrap: wrap;
}

/* Download button: secondary style, small */
.lens__dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  font-size: var(--text-size--small);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
  background: var(--color--white);
  border: 1px solid var(--color--neutral-200);
  border-radius: var(--radius--button);
  text-decoration: none;
  transition:
    border-color var(--motion--fast) var(--ease--standard),
    background var(--motion--fast) var(--ease--standard);
}
.lens__dl-btn:hover {
  border-color: var(--color--secondary);
  background: var(--color--secondary-tint);
  color: var(--color--secondary-dark);
}

/* Upload button: label wrapping hidden file input */
.lens__ul-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  font-size: var(--text-size--small);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
  background: var(--color--white);
  border: 1px solid var(--color--neutral-200);
  border-radius: var(--radius--button);
  cursor: pointer;
  text-decoration: none;
  transition:
    border-color var(--motion--fast) var(--ease--standard),
    background var(--motion--fast) var(--ease--standard);
}
.lens__ul-btn:hover:not(.lens__ul-btn--disabled) {
  border-color: var(--color--secondary);
  background: var(--color--secondary-tint);
  color: var(--color--secondary-dark);
}
.lens__ul-btn--disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

/* Format hint: small grey text to the right of buttons */
.lens__format-hint {
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-400);
  white-space: nowrap;
}
.lens__format-hint--standalone {
  display: block;
  margin-top: 2px;
}

/* Missing Force: no-file banner note */
.lens__no-file-note {
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-500);
  font-style: italic;
}

/* Missing Force: Run now primary button */
.lens__run-now {
  padding: 7px 14px;
  font-size: var(--text-size--small);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Assumption Audit: On-Prem footer */
.lens__onprem-note {
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-500);
  font-style: italic;
  flex: 1;
}
.lens__upgrade-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--color--secondary-tint);
  color: var(--color--secondary-dark);
  border-radius: var(--radius--pill);
  font-size: var(--text-size--tiny);
  font-weight: var(--fw--semibold);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--motion--fast) var(--ease--standard);
}
.lens__upgrade-pill:hover {
  background: var(--color--secondary);
  color: var(--color--white);
}

/* Trailing down-arrow circle. 64px from last card per 4pt grid spec. */
.lens-list__scroll-hint {
  display: flex;
  justify-content: center;
  margin-top: var(--spacing--2xlarge); /* 64px last card to trailing arrow */
}
.lens-list__scroll-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--color--neutral-200);
  background: var(--color--white);
  color: var(--color--neutral-500);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition:
    border-color var(--motion--fast) var(--ease--standard),
    color var(--motion--fast) var(--ease--standard);
}
.lens-list__scroll-btn:hover {
  border-color: var(--color--secondary);
  color: var(--color--secondary);
}

/* ─── Lens result stats grid ─────────────────────── */

.lens-result__source {
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}

.lens-result__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--spacing--xsmall);
  margin-bottom: var(--spacing--medium);
}
.lens-result__stat {
  background: var(--color--neutral-050);
  border: 1px solid var(--color--neutral-150);
  border-radius: var(--radius--button);
  padding: var(--spacing--xsmall) var(--spacing--medium);
}
.lens-result__stat-label {
  font-size: var(--text-size--tiny);
  font-weight: var(--fw--semibold);
  color: var(--color--neutral-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.lens-result__stat-value {
  font-size: var(--text-size--small);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
}

.lens-result__callouts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing--xsmall);
  margin-bottom: var(--spacing--medium);
}
.lens-result__top--amber {
  background: var(--color--accent-tint);
  border-color: var(--color--accent-edge);
}
.lens-result__top--amber .lens-result__top-label { color: var(--color--accent-amber); }

.lens-result__bar-fill--green { background: var(--color--secondary); }

.lens-result__class-same { color: var(--color--neutral-600); }

/* ─── Substrate selector (Commit 10) ──────────────── */

.substrate-panel {
  background: var(--color--neutral-050);
  border: 1px solid var(--color--neutral-150);
  border-radius: var(--radius--card);
  padding: var(--spacing--medium) var(--spacing--large);
  margin-top: var(--spacing--medium);
}
.substrate-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing--medium);
  margin-bottom: var(--spacing--xsmall);
}
.substrate-panel__label {
  font-size: var(--text-size--tiny);
  font-weight: var(--fw--semibold);
  color: var(--color--neutral-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.substrate-panel__select {
  font-family: var(--font--primary);
  font-size: var(--text-size--small);
  padding: 6px 10px;
  border: 1px solid var(--color--neutral-200);
  border-radius: var(--radius--button);
  background: var(--color--white);
  color: var(--color--primary);
  cursor: pointer;
}
.substrate-panel__msg {
  font-size: var(--text-size--small);
  color: var(--color--neutral-600);
  line-height: var(--line-height--body);
  margin: 0;
}
.substrate-panel__msg--ok    { color: var(--color--secondary-dark); }
.substrate-panel__msg--warn  { color: var(--color--accent-amber); }

/* ─── Depth panels (Commit 10) ──────────────────── */

.depth__title {
  margin-top: var(--spacing--xlarge);
}

.depth__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--spacing--xsmall);
  margin-bottom: var(--spacing--medium);
}
.depth__stats--3 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.depth__stat {
  background: var(--color--white);
  border: 1px solid var(--color--neutral-150);
  border-left: 3px solid var(--color--neutral-200);
  border-radius: var(--radius--button);
  padding: var(--spacing--medium) var(--spacing--medium);
}
.depth__stat--warn { border-left-color: var(--color--accent-amber); }
.depth__stat--ok   { border-left-color: var(--color--secondary); }

.depth__stat-label {
  font-size: var(--text-size--tiny);
  font-weight: var(--fw--semibold);
  color: var(--color--neutral-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--spacing--xxsmall);
}
.depth__stat-value {
  font-size: var(--text-size--medium);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
  line-height: 1.1;
}
.depth__stat-detail {
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-500);
  margin-top: 2px;
}
.depth__stat-body {
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-600);
  line-height: var(--line-height--body);
  margin-top: var(--spacing--xxsmall);
}

.depth__table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color--neutral-150);
  border-radius: var(--radius--card);
  background: var(--color--white);
  margin-bottom: var(--spacing--medium);
}
.depth__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-size--small);
}
.depth__table thead th {
  background: var(--color--neutral-050);
  color: var(--color--neutral-600);
  font-size: var(--text-size--tiny);
  font-weight: var(--fw--semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  padding: var(--spacing--xsmall) var(--spacing--medium);
}
.depth__table tbody td {
  padding: var(--spacing--xsmall) var(--spacing--medium);
  border-top: 1px solid var(--color--neutral-150);
  vertical-align: middle;
}
.depth__note {
  font-size: var(--text-size--small);
  color: var(--color--neutral-600);
  line-height: var(--line-height--body);
  margin: var(--spacing--xsmall) 0 var(--spacing--medium);
}
.depth__muted { color: var(--color--neutral-400); }

.depth__locked {
  background: var(--color--neutral-050);
  border: 1px dashed var(--color--neutral-200);
  border-radius: var(--radius--card);
  padding: var(--spacing--medium) var(--spacing--large);
  margin-bottom: var(--spacing--medium);
}

/* ─── Re-test banner ────────────────────────────── */

.retest-banner {
  background: var(--color--secondary-soft);
  border: 1px solid var(--color--secondary-edge);
  border-radius: var(--radius--card);
  padding: var(--spacing--medium) var(--spacing--medium);
  text-align: center;
  margin-top: var(--spacing--xlarge);
}
.retest-banner p {
  font-size: var(--text-size--small);
  color: var(--color--secondary-dark);
  font-weight: var(--fw--semibold);
  margin: 0;
}

/* ─── Textarea (Commit 11) ─────────────────────── */

.lens__textarea,
.lens__textarea-label {
  width: 100%;
  font-family: var(--font--primary);
}
.lens__textarea-label {
  font-size: var(--text-size--tiny);
  font-weight: var(--fw--semibold);
  color: var(--color--neutral-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--spacing--xxsmall);
  display: block;
}
.lens__textarea {
  font-size: var(--text-size--small);
  padding: 10px 12px;
  border: 1px solid var(--color--neutral-200);
  border-radius: var(--radius--input);
  color: var(--color--primary);
  background: var(--color--white);
  resize: vertical;
  line-height: var(--line-height--body);
  flex: 1;
  min-width: 220px;
}
.lens__textarea:focus {
  outline: none;
  border-color: var(--color--secondary);
}

.lens__form--audit,
.lens__form--drift,
.lens__footer--audit {
  flex-direction: column;
  align-items: stretch;
}
.lens__form--audit .lens__form-run,
.lens__form--drift .lens__form-run,
.lens__footer--audit .lens__form-run {
  align-self: flex-end;
  margin-left: 0;
  margin-top: var(--spacing--xsmall);
}

/* ─── Audit findings (Commit 11) ──────────────── */

.lens-result__findings {
  display: flex;
  flex-direction: column;
  gap: var(--spacing--xsmall);
  margin-bottom: var(--spacing--medium);
}

.audit-finding {
  border: 1px solid var(--color--neutral-150);
  border-left: 3px solid var(--color--neutral-200);
  border-radius: var(--radius--button);
  background: var(--color--white);
  padding: var(--spacing--medium) var(--spacing--medium);
}
.audit-finding--supported                 { border-left-color: var(--color--secondary); }
.audit-finding--partially_supported       { border-left-color: var(--color--secondary); }
.audit-finding--partially_contradicted    { border-left-color: var(--color--accent-amber); }
.audit-finding--strongly_contradicted     { border-left-color: var(--color--danger); }
.audit-finding--insufficient_evidence     { border-left-color: var(--color--neutral-200); }

.audit-finding__head {
  display: flex;
  align-items: center;
  gap: var(--spacing--xsmall);
  margin-bottom: var(--spacing--xxsmall);
}
.audit-finding__index {
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-500);
}
.audit-finding__verdict {
  font-size: 10px;
}
.audit-finding__verdict--supported,
.audit-finding__verdict--partially_supported {
  background: var(--color--secondary-tint);
  color: var(--color--secondary-dark);
}
.audit-finding__verdict--partially_contradicted {
  background: var(--color--accent-tint);
  color: var(--color--accent-amber);
}
.audit-finding__verdict--strongly_contradicted {
  background: #FEECEC;
  color: var(--color--error);
}
.audit-finding__verdict--insufficient_evidence {
  background: var(--color--neutral-100);
  color: var(--color--neutral-500);
}
.audit-finding__score {
  margin-left: auto;
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-600);
}
.audit-finding__text {
  font-size: var(--text-size--small);
  color: var(--color--primary);
  font-weight: var(--fw--semibold);
  margin-bottom: 4px;
}
.audit-finding__vars {
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-500);
  margin-bottom: 2px;
}
.audit-finding__explanation {
  font-size: var(--text-size--small);
  color: var(--color--neutral-600);
  line-height: var(--line-height--body);
}

/* ─── Drift panel (Commit 11) ─────────────────── */

.drift-panel,
.drift-result {
  background: var(--color--white);
  border: 1px solid var(--color--neutral-150);
  border-radius: var(--radius--card);
  padding: var(--spacing--medium) var(--spacing--large);
  margin-top: var(--spacing--medium);
}
.drift-panel__desc {
  font-size: var(--text-size--small);
  color: var(--color--neutral-600);
  margin: var(--spacing--xxsmall) 0 var(--spacing--medium);
  line-height: var(--line-height--body);
}

.drift-trajectory {
  display: flex;
  align-items: flex-end;
  gap: var(--spacing--xsmall);
  padding: var(--spacing--medium) 0;
  height: 180px;
  margin-bottom: var(--spacing--medium);
  border-bottom: 1px dashed var(--color--neutral-200);
}
.drift-trajectory__bar {
  flex: 1;
  min-width: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
}
.drift-trajectory__fill {
  width: 100%;
  max-width: 48px;
  border-radius: 6px 6px 0 0;
  background: var(--color--neutral-200);
  min-height: 4px;
}
.drift-trajectory__fill--multiplicative { background: var(--color--secondary); }
.drift-trajectory__fill--mixed          { background: var(--color--accent-amber); }
.drift-trajectory__fill--additive       { background: var(--color--error); }
.drift-trajectory__fill--unknown        { background: var(--color--neutral-200); }
.drift-trajectory__score {
  font-size: var(--text-size--tiny);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
  margin-top: 4px;
}
.drift-trajectory__date {
  font-size: 10px;
  color: var(--color--neutral-500);
  margin-top: 2px;
}

.drift-result__issues {
  font-size: var(--text-size--tiny);
  color: var(--color--neutral-500);
  margin-top: var(--spacing--medium);
  padding-top: var(--spacing--medium);
  border-top: 1px dashed var(--color--neutral-150);
}

/* ─── Commit 16: mobile lens button wrap (<=640px) ─── */
@media (max-width: 640px) {
  /* Download full-width, Upload full-width, hint underneath */
  .lens__btn-row {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing--xsmall); /* 8px between stacked buttons */
  }
  .lens__dl-btn,
  .lens__ul-btn {
    width: 100%;
    justify-content: center;
  }
  .lens__format-hint {
    white-space: normal;
    width: 100%;
  }
  /* Best-for row wraps naturally on mobile */
  .lens__bestfor {
    white-space: normal;
  }
}

/* ─── Commit 17c: Lens preview grid (pre-diagnose surface) ─── */

.lens-preview {
  margin-top: var(--spacing--3xlarge); /* 80px from preceding section */
}

.lens-preview__intro {
  margin-bottom: var(--spacing--large); /* 24px intro to grid */
}

.lens-preview__heading {
  font-size: var(--text-size--medium);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
  margin-bottom: var(--spacing--medium); /* 16px heading to subheading */
}

.lens-preview__subheading {
  font-size: var(--text-size--small);
  color: var(--color--neutral-600);
  line-height: var(--line-height--body);
  max-width: 64ch;
}

/* 3x2 grid with full-width drift tile below */
/* Lens preview section: breaks out of the content column (720px) to span
   a wider interior so tiles get real breathing room on large viewports.
   Uses the viewport-centered trick so the section stays aligned with the
   rest of the page on mobile but widens on desktop. */
.lens-preview {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-left: max(24px, calc(50vw - 600px));
  padding-right: max(24px, calc(50vw - 600px));
}

@media (max-width: 767px) {
  .lens-preview {
    /* On mobile the breakout is not needed; keep the content-col padding. */
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }
}

/* Responsive grid: 1 column on small viewports, 2 columns on tablet and
   narrow desktop, 3 columns on wide desktop. Altone SemiBold 18px
   headlines need ~360px of column width to sit on one or two lines
   without fragmenting; we gate the 3-column layout to ≥1200px so each
   tile is ≈360-400px wide.

   Row heights are equalised across the 6 lens tiles via an auto row-size
   that grows to the tallest sibling in a row; the final (implicit) row
   holding the drift tile sizes to its own content using `auto`, so the
   drift tile does not inherit the 1fr equalised height of the lens rows. */
.lens-preview__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing--large);
  align-items: stretch;
}

@media (min-width: 641px) {
  .lens-preview__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1200px) {
  .lens-preview__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Tile: fully open card, no accordion.
   height: 100% ensures every tile in a row hits the same height set by
   grid-auto-rows: 1fr on the parent. min-height only kicks in on mobile
   when auto-rows collapses to content height. */
.lens-preview__tile {
  position: relative;
  border: 1px solid var(--color--neutral-150);
  border-radius: var(--radius--card);
  background: var(--color--white);
  padding: var(--spacing--large);
  min-height: 220px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--spacing--medium);
  box-sizing: border-box;
}

.lens-preview__tile--locked {
  background: var(--color--neutral-050);
}

/* Full-width drift tile spanning every column of the grid. The min-height
   floor is zero so the tile hugs its content; the drift message is short. */
.lens-preview__tile--drift {
  grid-column: 1 / -1;
  min-height: 0;
  background: var(--color--primary);
  border-color: var(--color--primary);
  color: var(--color--white);
}

.lens-preview__tile--drift .lens-preview__name {
  color: var(--color--white);
}

/* Drift tile icon sits on navy bg; use white tile so SVG reads clearly */
.lens-preview__tile--drift .lens-preview__icon {
  background: rgba(255, 255, 255, 0.15);
}

.lens-preview__tile--drift .lens-preview__desc {
  color: rgba(255, 255, 255, 0.80);
}

/* Tile head: icon + meta. Right padding reserves space for upgrade pill. */
/* Commit 20 Part A: explicit flex layout so icon and headline never
   overlap. gap: 16px matches the brief specification. */
.lens-preview__tile-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-right: 8px;
}

/* When an upgrade pill is present, push tile-head down slightly */
.lens-preview__tile--locked .lens-preview__tile-head {
  padding-top: 28px;
}

/* 40x40 tinted icon tile
   Part A (Commit 20): flex: 0 0 40px ensures the icon never grows or
   shrinks beyond its declared width, preventing headline overlap at all
   viewport widths including the drift tile at 375 px. */
.lens-preview__icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lens-preview__icon--amber   { background: var(--color--tile-gold); }  /* Missing Force, Assumption Audit */
.lens-preview__icon--sky     { background: var(--color--tile-sky); }   /* Cascade, Transfer */
.lens-preview__icon--neutral { background: var(--color--tile-grey); }  /* Cross-Model */
.lens-preview__icon--blush   { background: var(--color--tile-plum); }  /* Agent Chain */
.lens-preview__icon--navy    { background: var(--color--tile-sky); }   /* Drift tile icon on navy bg */

/* Title + tier pill
   Commit 20 Part A: flex: 1 1 auto; min-width: 0 allows the headline
   to wrap within the remaining column width, not under the icon. */
.lens-preview__meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lens-preview__name {
  font-size: 18px;
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
  line-height: 1.3;
}

.lens-preview__name--drift {
  font-size: 18px;
  font-weight: var(--fw--semibold);
  color: var(--color--white);
}

.lens-preview__tier {
  display: inline-block;
  font-size: var(--text-size--tiny);
  font-weight: var(--fw--semibold);
  padding: 2px 7px;
  border-radius: var(--radius--pill);
  background: var(--color--neutral-100);
  color: var(--color--neutral-500);
  align-self: flex-start;
}

/* Outcome sentence */
.lens-preview__desc {
  font-size: var(--text-size--small);
  color: var(--color--neutral-600);
  line-height: var(--line-height--body);
  flex: 1;
}

/* Tile footer: download buttons */
.lens-preview__footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing--xsmall);
  margin-top: auto;
}

/* Download sample button (outline style) */
.lens-preview__dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: var(--text-size--small);
  font-weight: var(--fw--semibold);
  color: var(--color--primary);
  background: var(--color--white);
  border: 1px solid var(--color--neutral-200);
  border-radius: var(--radius--button);
  text-decoration: none;
  transition:
    border-color var(--motion--fast) var(--ease--standard),
    background var(--motion--fast) var(--ease--standard);
}

.lens-preview__dl-btn:hover {
  border-color: var(--color--secondary);
  background: var(--color--secondary-tint);
  color: var(--color--secondary-dark);
}

/* Upgrade nudge pill (top-right, additive on locked tiles) */
.lens-preview__upgrade-pill {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-block;
  padding: 3px 10px;
  font-size: var(--text-size--tiny);
  font-weight: var(--fw--semibold);
  background: var(--color--secondary-tint);
  color: var(--color--secondary-dark);
  border: 1px solid var(--color--secondary);
  border-radius: var(--radius--pill);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--motion--fast) var(--ease--standard);
}

.lens-preview__upgrade-pill:hover {
  background: var(--color--secondary);
  color: var(--color--white);
}

/* Drift-tile upgrade pill variant. Same anatomy as .lens-preview__upgrade-pill
   but reposed inside the drift tile's footer (not absolutely positioned) and
   colour-inverted to read cleanly on the navy background. Single CTA only,
   no "Request monitoring" distractor. */
.lens-preview__upgrade-pill--drift {
  position: static;
  background: var(--color--secondary);
  color: var(--color--white);
  border-color: var(--color--secondary);
  padding: 8px 18px;
  font-size: var(--text-size--small);
  border-radius: var(--radius--button);
}

.lens-preview__upgrade-pill--drift:hover {
  background: var(--color--secondary-dark);
  border-color: var(--color--secondary-dark);
  color: var(--color--white);
}

/* ─── Commit 18: Verdict pill full classification palette (Design System v1.3) ─── */

/* Semantic rule: additive = RED (failure state). Never grey-navy.
   Super-multiplicative = Green Dark + amber accent border. */

.pill--additive {
  background: var(--color--error);
  color: var(--color--white);
}

.pill--weakly_multiplicative {
  background: rgba(32, 166, 93, 0.12);
  color: var(--color--secondary-dark);
}

/* .pill--multiplicative already defined above; override for clarity */
.pill--multiplicative {
  background: var(--color--secondary);
  color: var(--color--white);
}

.pill--strongly_multiplicative {
  background: var(--color--secondary-dark);
  color: var(--color--white);
}

.pill--super_multiplicative {
  background: var(--color--secondary-dark);
  color: var(--color--white);
  border: 2px solid var(--color--accent-amber);
  box-shadow: inset 0 0 0 4px rgba(243, 164, 68, 0.18);
}

.pill--unclassifiable {
  background: var(--color--gray-200);
  color: var(--color--gray-700);
}

/* Verdict-card modifier for super_multiplicative domain verdict */
.verdict-card--super_multiplicative {
  border-color: var(--color--accent-amber);
  background: var(--color--secondary-soft);
  box-shadow: 0 0 0 3px rgba(243, 164, 68, 0.15);
}

.verdict-card--super_multiplicative .verdict-card__word {
  color: var(--color--secondary-dark);
}

.verdict-card--strongly_multiplicative {
  border-color: var(--color--secondary-dark);
  background: var(--color--secondary-soft);
}

.verdict-card--strongly_multiplicative .verdict-card__word {
  color: var(--color--secondary-dark);
}

.verdict-card--weakly_multiplicative {
  border-color: var(--color--secondary-edge);
  background: var(--color--secondary-soft);
}

.verdict-card--weakly_multiplicative .verdict-card__word {
  color: var(--color--secondary);
}

.verdict-card--unclassifiable {
  border-color: var(--color--neutral-200);
  background: var(--color--neutral-050);
}

.verdict-card--unclassifiable .verdict-card__word {
  color: var(--color--neutral-500);
}

/* Self-regulating interaction pill (interaction type only, not domain verdict) */
.pill--self_regulating {
  background: var(--color--tile-teal);
  color: var(--color--gray-700);
}

/* ─── Commit 18: Table header wrap (Part G) ─── */
/* Applies globally. Individual th rules above may override specifics. */
thead th,
.varstable thead th,
.lens-result__table thead th,
.depth__table thead th {
  white-space: normal;
  line-height: 1.2;
  vertical-align: bottom;
  min-width: 0;
}

/* ─── Commit 19: Mobile KPI padding (EP2-05) ─── */
@media (max-width: 640px) {
  .kpi {
    padding: var(--spacing--xsmall) var(--spacing--medium);
  }
}

/* ─── Commit 19: Mobile upgrade pill (EP1-05) ─── */
@media (max-width: 640px) {
  .lens-preview__upgrade-pill {
    position: static;
    display: block;
    font-size: 12px;
    background: var(--color--secondary);
    color: var(--color--white);
    border-color: var(--color--secondary);
    margin-bottom: var(--spacing--xsmall);
    text-align: center;
  }
  .lens-preview__upgrade-pill:hover {
    background: var(--color--secondary-dark);
    border-color: var(--color--secondary-dark);
    color: var(--color--white);
  }
  /* Commit 20 Part A fix: the column-reverse here placed the icon below
     the headline on mobile. The upgrade pill is already position: static
     outside .lens-preview__tile-head, so no reversal is needed. Restore
     the standard row layout so icon stays left of headline at 375 px. */
  .lens-preview__tile--locked .lens-preview__tile-head {
    flex-direction: row;
    align-items: flex-start;
  }
}

/* ─── Commit 19: Upload outcome detected card (EP1-04) ─── */
.upload__outcome-detected {
  display: flex;
  align-items: center;
  gap: var(--spacing--xxsmall);
  padding: var(--spacing--xsmall) var(--spacing--medium);
  background: var(--color--secondary-tint);
  border: 1px solid var(--color--secondary-edge);
  border-radius: var(--radius--input);
  font-size: var(--text-size--small);
  color: var(--color--primary);
  margin-bottom: var(--spacing--medium);
}

/* ─── Commit 19: Lens run toast (EP1-07) ─── */
.lens-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--color--secondary);
  color: var(--color--white);
  font-size: var(--text-size--small);
  font-weight: var(--fw--semibold);
  padding: var(--spacing--xsmall) var(--spacing--medium);
  border-radius: var(--radius--button);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  pointer-events: none;
  animation: toast-in var(--motion--medium) var(--ease--standard);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Commit 20 B2 (C19-EP2-05): raise toast above iOS Safari toolbar at 375 px */
@media (max-width: 640px) {
  .lens-toast {
    bottom: 48px;
  }
}

/* ─── Motion rules ───────────────────────────────────────
   Panel-locked constraints (Commit 20 verdict):
     - NO animation on tier badge pills (.pill--*)
     - NO animation on upgrade pills (.lens-preview__upgrade-pill)
     - NO entrance animations on the tile grid
     - NO motion on result-page download buttons (.download-btn, .report-download)
   These lines exist to catch future contributors who may not know
   the review history. See docs/expert_panel_review.md Commit 20
   verdict for rationale. */

/* C1: Lens tile hover lift */
@media (prefers-reduced-motion: no-preference) {
  .lens-preview__tile {
    transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 300ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .lens-preview__tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(27, 42, 74, 0.08);
  }
  /* Drift tile is navy and visually dominant; no hover lift */
  .lens-preview__tile--drift:hover {
    transform: none;
    box-shadow: none;
  }
}

/* C2: Icon one-cycle pulse on tile hover */
@media (prefers-reduced-motion: no-preference) {
  @keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
  }
  .lens-preview__tile:hover .lens-preview__icon {
    animation: iconPulse 600ms cubic-bezier(0.4, 0, 0.2, 1);
  }
}

/* C3: liveBar idle breathing on force-classification bars
   Amplitude 0.03 on each side = 0.06 total (panel constraint: never exceed 0.06). */
@media (prefers-reduced-motion: no-preference) {
  @keyframes liveBarBreath {
    0%, 100% { transform: scaleX(0.97); }
    50%      { transform: scaleX(1.00); }
  }
  .lens-result__bar-fill,
  .varstable__bar-fill {
    transform-origin: left;
    animation: liveBarBreath 2400ms ease-in-out infinite;
  }
}

/* C4: Single barShine sweep on bar first-render */
@media (prefers-reduced-motion: no-preference) {
  @keyframes barShine {
    0%   { transform: translateX(-110%); opacity: 0; }
    30%  { opacity: 1; }
    100% { transform: translateX(110%); opacity: 0; }
  }
  .lens-result__bar-fill::before,
  .varstable__bar-fill::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.4) 50%,
      transparent 100%
    );
    animation: barShine 1400ms ease-out 1 forwards;
    pointer-events: none;
  }
  .lens-result__bar-fill,
  .varstable__bar-fill {
    position: relative;
    overflow: hidden;
  }
}
