/* HMS-340 — the attrition monitor. Figma 600:22870.
   Stat tiles up top, the wa-line-chart trend with its accessible table
   alternative, then the per-hotel attrition table. The contest dialog is
   class-scoped below. */

/* --- page header ---------------------------------------------------------- */

.attrition__breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

.attrition__breadcrumb a {
  color: var(--wa-color-text-quiet);
  text-decoration: none;
}

.attrition__breadcrumb a:hover {
  text-decoration: underline;
}

/* The current segment is plain text, not a link — normal weight, no underline. */
.attrition__breadcrumb [aria-current] {
  font-weight: 400;
  color: var(--wa-color-text-normal);
}

.attrition__title {
  margin: 0 0 1.5rem;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--wa-color-text-normal);
}

/* --- stat tiles ------------------------------------------------------------ */

.attrition__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
  .attrition__stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .attrition__stats {
    grid-template-columns: 1fr;
  }
}

.attrition__stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.25rem;
  border: 1px solid var(--wa-color-neutral-border-normal);
  border-radius: var(--wa-border-radius-m);
  background: var(--wa-color-surface-default);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.attrition__stat-label {
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

.attrition__stat-value {
  margin: 0.125rem 0 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--wa-color-text-normal);
}

.attrition__stat-sub {
  margin: 0.125rem 0 0;
  font-size: 0.75rem;
  color: var(--wa-color-text-quiet);
}

/* Outlined icon box — a subtle bordered square, not a filled tile. */
.attrition__stat-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--wa-color-neutral-border-normal);
  border-radius: var(--wa-border-radius-m);
  color: var(--wa-color-text-quiet);
}

/* --- trend ------------------------------------------------------------------ */

.attrition__trend {
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--wa-color-neutral-border-normal);
  border-radius: var(--wa-border-radius-m);
  background: var(--wa-color-surface-default);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.attrition__trend-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--wa-color-text-normal);
}

.attrition__trend-sub {
  margin: 0.125rem 0 1rem;
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

.attrition__chart {
  display: block;
  width: 100%;
  height: 18.75rem;
}

/* The accessible alternative to the chart: same numbers, linear reading order.
   Visually quiet, but never hidden — it renders for everyone. */
.attrition__trend-table {
  width: 100%;
  margin-top: 1rem;
  border-collapse: collapse;
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

.attrition__trend-table caption {
  text-align: left;
  padding-bottom: 0.375rem;
  color: var(--wa-color-text-quiet);
}

.attrition__trend-table th,
.attrition__trend-table td {
  text-align: left;
  padding: 0.375rem 0.5rem;
  border-bottom: 1px solid var(--wa-color-neutral-border-quiet);
}

.attrition__trend-table tfoot td,
.attrition__trend-table tfoot th {
  font-weight: 700;
  border-bottom: none;
}

/* --- attrition table --------------------------------------------------------- */

.attrition__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.attrition__table th,
.attrition__table td {
  text-align: left;
  padding: 0.625rem 0.75rem;
}

.attrition__table thead th {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--wa-color-text-quiet);
  border-bottom: 1px solid var(--wa-color-neutral-border-normal);
}

.attrition__table tbody td {
  border-bottom: 1px solid var(--wa-color-neutral-border-quiet);
  color: var(--wa-color-text-normal);
}

/* Horizontal scroll on narrow screens rather than a squeezed layout. */
@media (max-width: 760px) {
  .attrition__table {
    display: block;
    overflow-x: auto;
  }
}

/* --- footer (per-page + count + series pager) -------------------------------- */

.attrition__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

/* "Show [20▾] Per Page" reads as one line (wa-select is block-level by default). */
.attrition__footer form {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- penalty banner ---------------------------------------------------------- */

.attrition__penalty-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--wa-border-radius-m);
  background: var(--wa-color-danger-fill-quiet);
  color: var(--wa-color-danger-on-quiet);
  font-size: 0.875rem;
}

/* Only the message grows — the warning icon hugs its left edge (Figma 600:22870). */
.attrition__penalty-banner > span {
  flex: 1 1 auto;
}

/* Danger action — scoped so it reads red without touching the global theme. */
.attrition__contest::part(base) {
  background: var(--wa-color-danger-fill-loud);
  border-color: var(--wa-color-danger-fill-loud);
  color: var(--wa-color-neutral-on-loud);
}

/* --- contest dialog ---------------------------------------------------------- */

.contest-dialog__intro {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--wa-color-text-quiet);
}

/* The penalty call-out: red-ish border, soft red fill. Figma 600:19035 —
   label top-left, amount top-right, the three facts as a row underneath. */
.contest-dialog__penalty {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  column-gap: 1rem;
  row-gap: 0.75rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--wa-color-danger-border-quiet);
  border-radius: var(--wa-border-radius-m);
  background: var(--wa-color-danger-fill-quiet);
}

.contest-dialog__penalty-label {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--wa-color-text-normal);
}

.contest-dialog__penalty-amount {
  margin: 0;
  justify-self: end;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--wa-color-danger-on-quiet);
}

.contest-dialog__penalty-facts {
  grid-column: 1 / -1;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.contest-dialog__fact {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  font-size: 0.8125rem;
}

.contest-dialog__fact dt {
  color: var(--wa-color-text-quiet);
}

.contest-dialog__fact dd {
  margin: 0;
  font-weight: 600;
  color: var(--wa-color-text-normal);
}

.contest-dialog__reasons {
  margin-top: 1rem;
}

.contest-dialog__reasons-title {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--wa-color-text-normal);
}

.contest-dialog__reasons fieldset {
  margin: 0;
  padding: 0;
  border: none;
}

.contest-dialog__reasons label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0;
  font-size: 0.875rem;
  color: var(--wa-color-text-normal);
}

/* The "or" between the documentation input and the URL field — plain text,
   no rule lines (Figma 600:19035). */
.contest-dialog__divider {
  margin: 1rem 0;
  font-size: 0.75rem;
  color: var(--wa-color-text-quiet);
}

.contest-dialog__info {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--wa-border-radius-m);
  background: var(--wa-color-brand-fill-quiet);
  color: var(--wa-color-brand-on-quiet);
  font-size: 0.875rem;
}

/* Slotted into wa-dialog's footer area — pinned under the scrollable body,
   buttons centered like Figma 600:19035. */
.contest-dialog__footer {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

/* The TLD select rides inside the URL input's end slot — strip its own box
   so it reads as a ".com ▾" suffix like Figma 600:19035, not a nested field. */
.contest-dialog wa-input wa-select[slot="end"]::part(combobox) {
  border: none;
  background: transparent;
  box-shadow: none;
}

/* Soft width cap — only applies if wa-dialog honors --width; harmless if not. */
.contest-dialog {
  --width: 40rem;
}
