/* Page composition for the midterms instrument.
   Corners match square panels (--radius-none). Dots stay round.
   Spacing uses the foundation scale only. Type uses foundation roles. */

[hidden] {
  display: none !important;
}

.wrap {
  max-width: 92rem;
}

.panel,
.masthead-hero,
.tabs {
  border-radius: var(--radius-none);
}

.wrap > .utility-row {
  margin-bottom: var(--section-gap);
}

.utility-actions {
  display: flex;
  align-items: stretch;
  gap: var(--compare-gap);
}

/* Matches the theme toggle's label type and height beside it. */
.sign-out {
  display: flex;
  margin: 0;
}

.sign-out button {
  appearance: none;
  font-family: var(--font-base);
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
  line-height: var(--lh-label);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  padding: 0 var(--compare-gap);
  border: 1px solid var(--border-ui);
  border-radius: var(--radius-none);
  background: var(--theme-toggle-track);
  color: var(--w50);
  cursor: pointer;
}

.sign-out button:hover {
  background: var(--theme-toggle-hover);
  color: var(--w72);
}

.sign-out button:focus-visible {
  outline: 2px solid var(--w100);
  outline-offset: 1px;
}

.midterms-hero {
  --masthead-hero-copy-width: 100%;
  margin-bottom: var(--section-gap);
}

/* Solid heroes zero .subtitle margin, and .label-tag uses a 7px literal.
   One column gap keeps eyebrow, title, and subtitle on the spacing scale.
   Margin-bottom stays 0 so the green line still ends with the last line. */
.midterms-hero .masthead-left > div:last-child {
  gap: var(--compare-gap);
}

.midterms-hero .label-tag {
  margin-bottom: 0;
}

.midterms-hero .subtitle {
  max-width: 65ch;
}

.instrument {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--grid-gap);
  padding: var(--panel-head-pad-block) 0;
  margin-bottom: var(--section-gap);
  border-top: 1px solid var(--border-default);
  border-bottom: 1px solid var(--border-default);
}

.toolbar {
  display: flex;
  gap: var(--compare-gap);
  flex-wrap: wrap;
}

.instrument button,
.choice,
.next,
.seat-line button,
.setting input,
.setting select,
.execution-pop select,
.sentence input,
.sentence select,
#alternatives,
.leg-chip,
.execution-pop,
.settlement-totals {
  font-family: var(--font-base);
  border-radius: var(--radius-none);
}

.instrument button,
.choice,
.next,
.seat-line button {
  font: inherit;
  font-family: var(--font-base);
  cursor: pointer;
}

.instrument button:focus-visible,
.choice:focus-visible,
.next:focus-visible,
.seat-line button:focus-visible,
.setting input:focus-visible,
.setting select:focus-visible,
.execution-pop select:focus-visible,
.sentence input:focus-visible,
.sentence select:focus-visible,
#alternatives:focus-visible {
  outline: 2px solid var(--w100);
  outline-offset: -2px;
}

.toolbar button {
  padding: var(--panel-head-pad-block) var(--panel-head-pad-inline);
  border: 1px solid var(--border-stronger);
  background: var(--bg-surface);
  color: var(--fg-secondary);
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
}

.toolbar #global-scan {
  color: var(--green-text);
  border-color: var(--green-border);
  background: var(--green-bg);
}

.toolbar button[aria-pressed="true"] {
  background: var(--orange-bg);
  border-color: var(--orange-border);
  color: var(--orange-text);
}

.book-monitor {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--grid-gap);
  flex-wrap: wrap;
  margin-left: auto;
}

.badge {
  font-size: var(--fs-body-sm);
  color: var(--fg-muted);
  white-space: nowrap;
}

#status::before {
  content: "●";
  margin-right: var(--compare-gap);
}

#status[data-health="live"] {
  color: var(--green-text);
}

#status[data-health="frozen"],
#status[data-health="delayed"] {
  color: var(--orange-text);
}

#status[data-health="error"] {
  color: var(--red-text);
}

.layout {
  display: grid;
  grid-template-columns: minmax(22rem, 0.9fr) minmax(0, 1.35fr);
  gap: var(--section-gap);
  align-items: start;
}

.builder .tabs {
  margin-bottom: var(--section-gap);
}

.builder h2,
.sentence {
  font-size: var(--fs-title-sm);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  margin: 0 0 var(--panel-pad-block);
  color: var(--fg-primary);
}

.builder p,
.review p {
  line-height: var(--lh-body);
  color: var(--fg-secondary);
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--compare-gap);
}

.choice {
  background: var(--bg-surface);
  border: 1px solid var(--border-stronger);
  padding: var(--panel-pad-block) var(--panel-pad-inline);
  color: var(--fg-primary);
  text-align: left;
}

.choice strong {
  display: block;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-title-sm);
  margin: var(--compare-gap) 0;
}

.choice small {
  font-size: var(--fs-body-sm);
  color: var(--fg-muted);
}

.choice[aria-pressed="true"] {
  border-color: var(--blue-border);
  background: var(--blue-bg);
  color: var(--blue-text);
}

.choice.rep[aria-pressed="true"] {
  border-color: var(--red-border);
  background: var(--red-bg);
  color: var(--red-text);
}

.dot {
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  border-radius: var(--radius-round);
  background: var(--blue);
}

.rep .dot {
  background: var(--red);
}

.hint {
  font-size: var(--fs-body-sm);
  color: var(--fg-muted);
  margin-top: var(--compare-gap);
}

.setting {
  margin-top: var(--panel-pad-block);
}

.setting label,
.execution-pop label,
.alt-label {
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-semibold);
  display: block;
  margin-bottom: var(--compare-gap);
  color: var(--fg-secondary);
}

.setting p,
.execution-pop p {
  font-size: var(--fs-body-sm);
  color: var(--fg-muted);
  margin-top: var(--compare-gap);
}

.setting input,
.setting select,
.execution-pop select,
.sentence input,
.sentence select,
#alternatives {
  color: var(--fg-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-stronger);
  padding: var(--panel-head-pad-block) var(--compare-gap);
  font: inherit;
  font-size: var(--fs-body);
}

.setting select,
.setting input,
.execution-pop select,
#alternatives {
  width: 100%;
}

.select-field {
  position: relative;
  display: block;
}

.sentence .select-field {
  display: inline-block;
  width: auto;
}

.select-field select,
.select-field #alternatives {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: calc(var(--panel-pad-inline) + var(--grid-gap));
}

.select-field::after {
  content: "";
  position: absolute;
  right: var(--panel-pad-inline);
  top: 50%;
  width: 0.45em;
  height: 0.45em;
  border-right: 1px solid var(--fg-secondary);
  border-bottom: 1px solid var(--fg-secondary);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.setting input,
.sentence input,
.result-head strong,
.cost-row strong,
.return-table th,
.return-table td,
.seat-line button {
  font-variant-numeric: tabular-nums;
}

/* Route, fill, and quantity tune the decision above, so they share one
   block under a hairline. The flex gap skips fields app.js hides. */
.trade-params {
  display: flex;
  flex-direction: column;
  gap: var(--panel-pad-block);
  margin-top: var(--section-gap);
  padding-top: var(--section-gap);
  border-top: 1px solid var(--border-default);
}

.trade-params .setting {
  margin-top: 0;
}

.commit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--compare-gap);
  align-items: end;
}

.sentence {
  line-height: var(--lh-loose);
  margin-bottom: 0;
}

.sentence select,
.sentence input {
  margin-bottom: var(--compare-gap);
}

.sentence input {
  width: 4.5em;
  text-align: center;
}

.seat-line {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--compare-gap);
  margin-top: var(--panel-pad-block);
}

.seat-line button {
  padding: var(--panel-head-pad-block) 0;
  font-size: var(--fs-body-sm);
  color: var(--fg-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-stronger);
}

.seat-line button.covered {
  background: var(--blue-bg);
  color: var(--blue-text);
  border-color: var(--blue-border);
}

.seat-line[data-party="R"] button.covered {
  background: var(--red-bg);
  color: var(--red-text);
  border-color: var(--red-border);
}

.seat-line button.selected {
  outline: 1px solid currentColor;
  outline-offset: 2px;
}

.next {
  padding: var(--panel-head-pad-block) var(--panel-pad-inline);
  background: transparent;
  border: 1px solid var(--green-border);
  color: var(--green-text);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-body);
  white-space: nowrap;
}

.review .panel-title {
  margin: 0;
}

.outcome {
  font-size: var(--fs-title);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-title);
  margin-bottom: var(--compare-gap);
  color: var(--fg-primary);
}

#initial-description {
  font-size: var(--fs-body-sm);
  color: var(--fg-muted);
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--grid-gap);
  margin-top: var(--section-gap);
  padding-top: var(--panel-pad-block);
  border-top: 1px solid var(--border-stronger);
}

.result-head h2 {
  font-size: var(--fs-body-sm);
  color: var(--fg-secondary);
  font-weight: var(--fw-semibold);
  margin: 0;
}

.result-head strong {
  font-size: var(--fs-display);
  font-weight: var(--fw-light);
  letter-spacing: var(--ls-display);
  white-space: nowrap;
}

.positive {
  color: var(--green-text);
}

.negative {
  color: var(--red-text);
}

#metrics {
  font-size: var(--fs-body-sm);
  color: var(--fg-muted);
  margin-top: var(--compare-gap);
}

.alt-label {
  margin-top: var(--section-gap);
}

#alternatives {
  font-size: var(--fs-body-sm);
}

.leg-group {
  margin-top: var(--section-gap);
}

.leg-group h3 {
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  margin: 0 0 var(--compare-gap);
  color: var(--fg-primary);
}

.leg-axis,
.contract-row {
  display: flex;
  gap: var(--compare-gap);
  flex-wrap: wrap;
}

.contract-row {
  width: 100%;
  margin-bottom: var(--compare-gap);
}

.leg-chip {
  padding: var(--panel-head-pad-block) var(--compare-gap);
  font-size: var(--fs-body-sm);
  color: var(--fg-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-none);
  font-variant-numeric: tabular-nums;
}

.leg-chip.active.D {
  background: var(--blue-bg);
  border-color: var(--blue-border);
  color: var(--blue-text);
  font-weight: var(--fw-semibold);
}

.leg-chip.active.R {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red-text);
  font-weight: var(--fw-semibold);
}

.settlement-details {
  margin-top: var(--section-gap);
  padding-top: var(--panel-pad-block);
  border-top: 1px solid var(--border-stronger);
}

.settlement-details h3 {
  font-size: var(--fs-title-sm);
  font-weight: var(--fw-semibold);
  margin: 0 0 var(--compare-gap);
  color: var(--fg-primary);
}

.cost-row {
  display: flex;
  justify-content: space-between;
  gap: var(--grid-gap);
  padding: var(--panel-head-pad-block) 0;
  font-size: var(--fs-body-sm);
  border-bottom: 1px solid var(--border-default);
  color: var(--fg-secondary);
}

.cost-row strong {
  white-space: nowrap;
  color: var(--fg-primary);
  font-weight: var(--fw-semibold);
}

.fill-detail {
  font-size: var(--fs-body-sm);
  color: var(--fg-muted);
  line-height: var(--lh-body);
  margin: var(--compare-gap) 0;
  overflow-wrap: anywhere;
}

.settlement-totals {
  margin-top: var(--panel-pad-block);
  padding: var(--panel-pad-block) var(--panel-pad-inline);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  border-radius: var(--radius-none);
}

.settlement-totals .cost-row {
  font-size: var(--fs-body);
}

.settlement-totals .cost-row:last-child {
  border: 0;
}

.footnote {
  font-size: var(--fs-body-sm);
  color: var(--fg-muted);
  margin: var(--section-gap) 0 0;
}

.context-footer {
  margin-top: var(--section-gap);
  padding-top: var(--panel-pad-block);
  border-top: 1px solid var(--border-default);
  font-size: var(--fs-body-sm);
  color: var(--fg-muted);
}

.disclaimer {
  font-size: var(--fs-body-sm);
  font-style: normal;
  line-height: var(--lh-loose);
  color: var(--fg-secondary);
  margin-top: var(--section-gap);
  max-width: none;
}

.return-table-wrap {
  overflow-x: auto;
  width: 100%;
}

.return-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body);
}

.return-table caption {
  text-align: left;
  color: var(--fg-secondary);
  margin-bottom: var(--compare-gap);
}

.return-table th,
.return-table td {
  padding: var(--panel-head-pad-block) var(--compare-gap);
  border-bottom: 1px solid var(--border-default);
  text-align: right;
  vertical-align: top;
}

.return-table th {
  font-weight: var(--fw-bold);
  color: var(--fg-secondary);
}

.return-table th:first-child,
.return-table td:first-child {
  text-align: left;
  min-width: 14ch;
}

.return-table td:not(:first-child) {
  white-space: nowrap;
}

.return-table th:last-child,
.return-table td:last-child {
  font-weight: var(--fw-bold);
}

/* Sign-in sits in the masthead column so the green line runs from the
   eyebrow to the field. The form keeps a field-length measure. */
.login-form,
.login-status {
  max-width: 32rem;
}

.login-form {
  width: 100%;
  margin-top: var(--panel-pad-block);
}

.login-form .setting {
  margin-top: 0;
}

.login-status {
  font-size: var(--fs-body-sm);
  margin: var(--panel-pad-block) 0 0;
}

.login-status::before {
  content: "●";
  margin-right: var(--compare-gap);
}

.login-status[data-health="error"] {
  color: var(--red-text);
}

.login-status[data-health="delayed"] {
  color: var(--orange-text);
}

@media (hover: hover) and (pointer: fine) {
  .instrument button,
  .choice,
  .next,
  .seat-line button {
    transition:
      background-color 140ms ease-out,
      border-color 140ms ease-out,
      color 140ms ease-out;
  }

  .toolbar button:hover,
  .next:hover,
  .choice:hover,
  .seat-line button:hover {
    border-color: var(--border-ui);
  }

  .toolbar #global-scan:hover,
  .next:hover {
    border-color: var(--green-text);
  }
}

@media (prefers-reduced-motion: reduce) {
  .instrument button,
  .choice,
  .next,
  .seat-line button {
    transition: none;
  }
}

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

  .book-monitor {
    margin-left: 0;
    justify-content: flex-start;
  }

  .badge {
    white-space: normal;
  }
}

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

@media (max-width: 420px) {
  .cost-row {
    flex-direction: column;
    gap: var(--compare-gap);
  }

  .result-head strong {
    font-size: var(--fs-title);
  }
}
