/* commission-tier-form — Add Commission Tier page (HMS-1636 layout pass,
   re-test 2026-11-18). Scoped under .commission-tier-form so the shared
   .contract-form rules the contract wizard and sibling admin forms rely on
   stay untouched. Every override keeps >= (0,2,0) specificity: this file
   loads before contract_form.css alphabetically, so a bare class would
   lose to the shared rule on source order. */

/* The page is a two-field form, not the room-type matrix — cap it well
   under the shared 80rem so the fields and the schedule table read as a
   compact form instead of stretching across the content column. */
.contract-form.commission-tier-form {
  max-width: 54rem;
}

/* Header: QA's re-test wants the back button ABOVE the title, aligned left
   — the stacked header the sibling Add rate page already uses. The shared
   column flex + 8px gap does the work; only the bottom margin tightens. */
.commission-tier-form .contract-form__header {
  margin-block-end: var(--wa-space-s);
}

/* Tighter rhythm between the intro note and the schedule section. */
.commission-tier-form > p.contract-form__note {
  margin-block-end: var(--wa-space-s);
}

/* Section groups keep their divider border but drop the 24px top/bottom
   padding to 16px — the border alone marks the section break. */
.commission-tier-form .contract-form__group {
  padding-block-start: var(--wa-space-m);
  padding-block-end: var(--wa-space-m);
}

/* The schedule heading sits closer to its content. */
.commission-tier-form__schedule .contract-form__heading {
  margin-block-end: var(--wa-space-s);
}

/* Base commission reads as a stat, not another quiet note line: label,
   rate and scope in one quiet surface so the section's hierarchy is
   title → base rate → tier table. */
.commission-tier-form__base {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--wa-space-2xs) var(--wa-space-s);
  padding: var(--wa-space-s) var(--wa-space-m);
  margin-block-end: var(--wa-space-m);
  background: var(--wa-color-neutral-fill-quiet);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-m);
}

.commission-tier-form__base-label {
  font-size: var(--wa-font-size-s);
  font-weight: var(--wa-font-weight-heading);
  color: var(--wa-color-text-quiet);
}

.commission-tier-form__base-value {
  font-size: var(--wa-font-size-l);
  font-weight: var(--wa-font-weight-heading);
}

.commission-tier-form__base-scope {
  font-size: var(--wa-font-size-s);
  color: var(--wa-color-text-quiet);
}

/* The two tier inputs share one row — a compact form layout instead of
   two full-width fields. The live preview notes and the bands list span
   both columns so they read as form-level readouts under the pair. */
.commission-tier-form form > .contract-form__group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--wa-space-m) var(--wa-space-l);
}

.commission-tier-form form > .contract-form__group > .contract-form__note,
.commission-tier-form form > .contract-form__group > .contract-form__review-rooms {
  grid-column: 1 / -1;
}

/* Web Awesome's native reset gives every p:has(+*) a 24px bottom margin —
   inside the grid that would double-space the saved-threshold and preview
   notes, so the grid gap alone spaces them. */
.commission-tier-form form .contract-form__note {
  margin-block-end: 0;
}

/* The band list collapses while empty so it can't leave a phantom row, and
   reads as quiet helper text once the preview fills it. */
.commission-tier-form .contract-form__review-rooms:empty {
  display: none;
}

.commission-tier-form .contract-form__review-rooms {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--wa-color-text-quiet);
  font-size: var(--wa-font-size-s);
}

.commission-tier-form__band--conflict {
  padding: var(--wa-space-3xs) var(--wa-space-xs);
  margin-inline: calc(var(--wa-space-xs) * -1);
  border: 1px solid var(--wa-color-danger-border-normal);
  border-radius: var(--wa-border-radius-s);
  background: var(--wa-color-danger-fill-quiet);
  color: var(--wa-color-danger-on-quiet);
  font-weight: var(--wa-font-weight-heading);
}

/* Buttons hug the form instead of floating under dead chrome. */
.commission-tier-form .contract-form__actions {
  margin-block-start: var(--wa-space-s);
}

/* One column on narrow screens — half of ~350px is too tight for the
   labels and hints. */
@media (max-width: 40rem) {
  .commission-tier-form form > .contract-form__group {
    grid-template-columns: 1fr;
  }
}
