/* Responsive wrappers for admin tables that would otherwise clip on mobile. */

.admin-table-wrap {
  overflow-x: auto;
  width: 100%;
  /* Subtle right-edge shadow hints that wide tables scroll horizontally on
     narrow viewports. Pure CSS (no JS); rendered beneath the table so it
     never covers or blocks clickable content. */
  box-shadow: inset -10px 0 10px -10px var(--wa-color-neutral-border-quiet);
}

.admin-table-wrap table {
  min-width: max-content;
}

/* HMS-271 — VIP verification queue. Same scroll-inside-the-wrap contract as
   .admin-table-wrap: the admin shell's 1fr column expands past the viewport
   between the 1167px breakpoint and ~1205px without it, scrolling the whole
   document. No `min-width: max-content` on the table — auto layout still
   fills the wrap when it fits. */
.vip-verifications__table-wrap {
  overflow-x: auto;
  width: 100%;
  box-shadow: inset -10px 0 10px -10px var(--wa-color-neutral-border-quiet);
}

/* Booking overrides results: same scroll-inside-the-wrap contract as
   .vip-verifications__table-wrap — auto layout fills the wrap when the table
   fits (desktop keeps its wrapped cells) and scrolls only when it cannot. */
.admin-overrides__table-wrap {
  overflow-x: auto;
  width: 100%;
  box-shadow: inset -10px 0 10px -10px var(--wa-color-neutral-border-quiet);
}

.admin-events__table th,
.admin-events__table td {
  white-space: nowrap;
  vertical-align: top;
}

/* UI review (HMS-385): the Actions cell holds up to 12 links for writers. The
   generic .admin-table-wrap rule gives the table min-width:max-content, which
   forced that cell onto one ~1030px line and clipped links mid-word at 1440.
   Let this table shrink to the wrap width so the links wrap as units instead;
   the nowrap Event/Starts/Ends cells keep its min-content wide enough that it
   still scrolls (rather than crushing) on very narrow screens. */
/* Specificity: must outrank `.admin-table-wrap table { min-width: max-content }`
   above (0,1,1) — plain `.admin-events__table` (0,1,0) loses. */
.admin-table-wrap .admin-events__table {
  min-width: 0;
}

.admin-events__table td:last-child {
  white-space: normal;
}

/* HMS-780 — each action is its own outlined button; flex-wrap tiles them
   onto extra rows instead of running them together as one sentence. */
.admin-events__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wa-space-xs);
}

/* HMS-257 — event settings form. Same field rhythm as the overflow-rule /
   OTA-partner / bulk-adjustment forms below; without it the field divs stack
   with 0px between them and the number inputs run the full content width. */
.admin-events__field {
  margin-block-end: 1rem;
  max-width: 32rem;
}

.admin-events__field label {
  display: block;
  margin-block-end: 0.25rem;
  font-weight: 600;
  color: var(--wa-color-text-normal);
}

.admin-events__errors {
  margin-block-end: 1rem;
  padding: 0.75rem 1rem;
  color: var(--wa-color-danger-on-quiet);
  background: var(--wa-color-danger-fill-quiet);
  border: 1px solid var(--wa-color-danger-border-normal);
  border-radius: var(--wa-border-radius-m);
}

.admin-events__errors ul {
  margin: 0;
  padding-inline-start: 1.25rem;
}

/* HMS-1171 — per-field error under a dates/cutoff input: the box above the
   form lists every message; this marks the specific control that failed. */
.admin-events__error {
  margin-block: 0.25rem 0;
  font-size: var(--wa-font-size-s);
  color: var(--wa-color-danger-on-quiet);
}

.admin-events__shift {
  display: flex;
  align-items: center;
  gap: var(--wa-space-s);
  margin-block-start: 0.5rem;
}

.admin-events__shift input[type="number"] {
  width: 5rem;
}

/* HMS-1176 — rooming-list delivery form: wa-checkbox is inline, so bare
   siblings ran together on one line; a column stack puts each on its own. */
.admin-rooming-lists__checks {
  display: flex;
  flex-direction: column;
  gap: var(--wa-space-xs);
  margin-block-end: 1rem;
}

/* HMS-1176 — rejected rows in a confirmation-import preview. The tint goes
   on the cells: a tr background loses wherever a td sets its own, and the
   first attempt used --wa-color-danger-quiet, a token that does not exist. */
.admin-rooming-lists__row--rejected td {
  background: var(--wa-color-danger-fill-quiet);
}

/* HMS-1201 — confirmation-import upload and apply forms: the file input,
   checkbox and button sat flush against each other and against the table
   above. A column stack with the portal-form gap separates them. */
.admin-rooming-lists__form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--wa-space-m);
  margin-block: var(--wa-space-m);
}

.admin-rooming-lists__form wa-textarea {
  align-self: stretch;
  max-width: 36rem;
}

.admin-table__empty {
  padding: var(--wa-space-m);
  text-align: center;
  color: var(--wa-color-text-quiet);
}

/* HMS-247 — overflow rules + OTA partners admin. Native Web Awesome table
   styles already cover row separators and cell padding; these rules add the
   card treatment + flex header the other admin index pages get, so the new
   screens don't sit visibly below the convention. The form pages get basic
   field rhythm for the same reason. */

.admin-overflow-rules__header,
.admin-ota-partners__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-block-end: 1.5rem;
}

.admin-overflow-rules__title,
.admin-ota-partners__title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--wa-color-text-normal);
}

.admin-overflow-rules__intro {
  margin: 0 0 1.5rem;
  max-width: 60ch;
  color: var(--wa-color-text-quiet);
}

.admin-overflow-rules__table,
.admin-ota-partners__table {
  width: 100%;
  border-collapse: collapse;
  background: var(--wa-color-surface-default);
  border: 1px solid var(--wa-color-surface-border);
  border-radius: 0.5rem;
}

.admin-overflow-rules__table th,
.admin-overflow-rules__table td,
.admin-ota-partners__table th,
.admin-ota-partners__table td {
  padding: 0.875rem 1rem;
  text-align: start;
  border-block-end: 1px solid var(--wa-color-surface-border);
}

.admin-overflow-rules__table thead th,
.admin-ota-partners__table thead th {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--wa-color-text-quiet);
  background: var(--wa-color-neutral-fill-quiet);
}

.admin-overflow-rules__table tbody tr:last-child td,
.admin-ota-partners__table tbody tr:last-child td {
  border-block-end: none;
}

.admin-overflow-rules__actions {
  white-space: nowrap;
}

.admin-overflow-rules__actions a,
.admin-ota-partners__table td a {
  margin-inline-end: 0.5rem;
}

.admin-overflow-rules__actions form,
.admin-ota-partners__table td form {
  display: inline;
}

.admin-overflow-rules__empty {
  color: var(--wa-color-text-quiet);
}

/* The new/edit forms: plain stacked fields, but with rhythm. */
.overflow-rule-form__field,
.ota-partner-form__field {
  margin-block-end: 1rem;
  max-width: 32rem;
}

.overflow-rule-form__field label,
.ota-partner-form__field label {
  display: block;
  margin-block-end: 0.25rem;
  font-weight: 600;
  color: var(--wa-color-text-normal);
}

.overflow-rule-form__field input,
.overflow-rule-form__field select,
.ota-partner-form__field input,
.ota-partner-form__field select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--wa-color-text-normal);
  background: var(--wa-color-surface-default);
  border: 1px solid var(--wa-color-neutral-border-normal);
  border-radius: var(--wa-border-radius-m);
}

.overflow-rule-form__destination {
  margin: 0 0 1rem;
  padding: 1rem;
  border: 1px solid var(--wa-color-surface-border);
  border-radius: var(--wa-border-radius-m);
}

.overflow-rule-form__destination legend {
  padding: 0 0.5rem;
  font-weight: 600;
  color: var(--wa-color-text-normal);
}

.overflow-rule-form__hint,
.ota-partner-form__hint {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

/* Error box mirrors .ad-banner-form__errors — the established pattern. */
.overflow-rule-form__errors,
.ota-partner-form__errors {
  margin-block-end: 1rem;
  padding: 0.75rem 1rem;
  color: var(--wa-color-danger-on-quiet);
  background: var(--wa-color-danger-fill-quiet);
  border: 1px solid var(--wa-color-danger-border-normal);
  border-radius: var(--wa-border-radius-m);
}

.overflow-rule-form__errors ul,
.ota-partner-form__errors ul {
  margin: 0;
  padding-inline-start: 1.25rem;
}

.overflow-rule-form__submit,
.ota-partner-form__submit {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: var(--wa-border-radius-m);
  background: var(--wa-color-brand-fill-normal);
  color: var(--wa-color-brand-on-normal);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* HMS-252 — bulk inventory adjustment form. Same field rhythm as the
   overflow-rule / OTA-partner forms above: the view declares
   bulk-adjustment-form__* classes, and without these rules the hint, fields
   and submit button render with 0px gaps between them. */
.bulk-adjustment-form__field {
  margin-block-end: 1rem;
  max-width: 32rem;
}

.bulk-adjustment-form__field label {
  display: block;
  margin-block-end: 0.25rem;
  font-weight: 600;
  color: var(--wa-color-text-normal);
}

.bulk-adjustment-form__field input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--wa-color-text-normal);
  background: var(--wa-color-surface-default);
  border: 1px solid var(--wa-color-neutral-border-normal);
  border-radius: var(--wa-border-radius-m);
}

.bulk-adjustment-form__hint {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

.bulk-adjustment-form__submit {
  display: inline-block;
  margin-inline-end: 0.75rem;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: var(--wa-border-radius-m);
  background: var(--wa-color-brand-fill-normal);
  color: var(--wa-color-brand-on-normal);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* HMS-254 — block optimization admin. Web Awesome's native table styles cover
   padding and row separators; these rules cover what the view declares on top:
   the rate-alert badge line, the room-type subtitle inside the Room block cell,
   the hotel subheadings, and side-by-side Approve/Deny forms (matching the
   ota-partners `td form { display: inline }` convention above). */
.admin-block-optimization__alerts {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  color: var(--wa-color-text-quiet);
}

.admin-block-optimization__section-title {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  color: var(--wa-color-text-normal);
}

.admin-block-optimization__hotel {
  margin: 1.25rem 0 0.375rem;
  font-size: 1rem;
  color: var(--wa-color-text-normal);
}

.admin-block-optimization__sub {
  display: block;
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

.admin-block-optimization__table td form {
  display: inline;
}

.admin-block-optimization__table td form + form {
  margin-inline-start: 0.5rem;
}

.admin-block-optimization__empty,
.admin-block-optimization__note {
  margin: 0.5rem 0;
  color: var(--wa-color-text-quiet);
}

/* HMS-302 — AI comm drafts review screens. Field rhythm + action row matching
   the other admin tool pages; the <pre> body needs wrapping since drafted text
   is plain text with hard newlines. */

.admin-ai-comms__field {
  margin-block-end: 1rem;
}

.admin-ai-comms__field label {
  display: block;
  font-weight: 600;
  margin-block-end: 0.25rem;
}

.admin-ai-comms__field input[type="text"],
.admin-ai-comms__field textarea,
.admin-ai-comms__field select,
.admin-ai-comms__field wa-select {
  width: 100%;
  max-width: 42rem;
}

/* HMS-1150 — keep the Booking list compact: about five rows, then scroll. */
.admin-ai-comms__booking::part(form-control-label) {
  font-weight: 600;
}

.admin-ai-comms__booking::part(listbox) {
  max-height: min(12rem, var(--auto-size-available-height, 12rem));
  overflow-y: auto;
}

.admin-ai-comms__hint {
  margin: 0.25rem 0;
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

.admin-ai-comms__status {
  color: var(--wa-color-text-quiet);
}

.admin-ai-comms__errors {
  max-width: 42rem;
  margin-block-end: 1rem;
  padding: 0.75rem 1rem;
  color: var(--wa-color-danger-on-quiet);
  background: var(--wa-color-danger-fill-quiet);
  border: 1px solid var(--wa-color-danger-border-normal);
  border-radius: var(--wa-border-radius-m);
}

/* HMS-412 — the Current stage line is a status readout, not prose: quiet
   text with a semibold stage name, matching .admin-ai-comms__status. */
.admin-ai-settings__status {
  margin-block-end: 1rem;
  color: var(--wa-color-text-quiet);
}

.admin-ai-settings__stage {
  color: var(--wa-color-text-normal);
}

/* UI review: the AI settings screens (event + hotel) reuse the same
   role="alert" danger callout as .admin-ai-comms__errors — auto-pause
   banner and form validation errors. Without this rule they rendered as
   plain body text. */
.admin-ai-settings__errors {
  max-width: 42rem;
  margin-block-end: 1rem;
  padding: 0.75rem 1rem;
  color: var(--wa-color-danger-on-quiet);
  background: var(--wa-color-danger-fill-quiet);
  border: 1px solid var(--wa-color-danger-border-normal);
  border-radius: var(--wa-border-radius-m);
}

/* HMS-1068 — consistent gaps between the form's submit, the sign-off
   section, and Usage; the sections previously ran together. */
.admin-ai-settings__submit { margin-block: var(--wa-space-m) 0; }
.admin-ai-settings__usage { margin-block-start: var(--wa-space-xl); }

/* HMS-1068 — the five usage metrics as one scannable card row on desktop,
   wrapping on narrow screens. */
.admin-ai-settings__metric-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--wa-space-s);
  margin-block: var(--wa-space-m);
}
.admin-ai-settings__metric-card {
  display: flex; flex-direction: column; gap: var(--wa-space-2xs);
  padding: var(--wa-space-s) var(--wa-space-m);
  background: var(--wa-color-surface-raised);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-m);
}
.admin-ai-settings__metric-label {
  font-size: 0.75rem; color: var(--wa-color-text-quiet);
}
.admin-ai-settings__metric-value {
  font-size: 1.25rem; font-weight: var(--wa-font-weight-semibold);
}

.admin-ai-comms__actions {
  display: flex;
  gap: 0.75rem;
  margin-block: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

/* HMS-1106 — draft details layout */
.admin-ai-comms__back {
  margin-block: 0 var(--wa-space-s);
  font-size: 0.875rem;
}

.admin-ai-comms__back a {
  color: var(--wa-color-text-link);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--wa-space-2xs);
}

.admin-ai-comms__back a:hover {
  text-decoration: underline;
}

.admin-ai-comms__header {
  margin-block-end: var(--wa-space-xl);
}

.admin-ai-comms__header .admin-ai-comms__title {
  margin-block: 0 var(--wa-space-xs);
}

.admin-ai-comms__header p {
  margin-block: var(--wa-space-2xs) 0;
}

.admin-ai-comms__section {
  margin-block-end: var(--wa-space-xl);
  max-width: 60rem;
}

.admin-ai-comms__section h2 {
  margin-block: 0 var(--wa-space-s);
}

.admin-ai-comms--detail .admin-ai-comms__field input[type="text"],
.admin-ai-comms--detail .admin-ai-comms__field textarea,
.admin-ai-comms--detail .admin-ai-comms__field select,
.admin-ai-comms--detail .admin-ai-comms__body,
.admin-ai-comms--detail .admin-ai-comms__errors {
  max-width: 60rem;
}

.admin-ai-comms--detail .admin-ai-comms__recipients {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--wa-space-2xs) var(--wa-space-m);
  padding-inline-start: 1.25rem;
}

.admin-ai-comms--detail .admin-ai-comms__recipients li {
  overflow-wrap: anywhere;
}

/* HMS-1103 — New AI Draft is the page's primary action. */
.admin-ai-comms__toolbar {
  margin-block: 1rem 1.25rem;
}

/* HMS-1102 — a disabled Draft with AI must not look clickable. */
.admin-ai-comms__actions input[type="submit"]:disabled,
.admin-ai-comms__actions button:disabled { cursor: not-allowed; }

.admin-ai-comms__body {
  max-width: 42rem;
  white-space: pre-wrap;
  font-family: inherit;
}

/* HMS-303 — AI report summary page. Same field rhythm as the AI comms
   screens; the figures tables reuse the plain admin table look. */

.admin-ai-report__meta,
.admin-ai-report__summary {
  max-width: 42rem;
}

.admin-ai-report__meta {
  color: var(--wa-color-text-quiet);
}

.admin-ai-report__summary {
  margin-block: 1rem;
  padding: 1rem 1.25rem;
  background: var(--wa-color-neutral-fill-quiet);
  border: 1px solid var(--wa-color-border-quiet);
  border-radius: var(--wa-border-radius-m);
}

.admin-ai-report__errors {
  max-width: 42rem;
  margin-block-end: 1rem;
  padding: 0.75rem 1rem;
  color: var(--wa-color-danger-on-quiet);
  background: var(--wa-color-danger-fill-quiet);
  border: 1px solid var(--wa-color-danger-border-normal);
  border-radius: var(--wa-border-radius-m);
}

.admin-ai-report__figures {
  margin-block-end: 1.25rem;
}

.admin-ai-report__figures dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1.5rem;
  max-width: 42rem;
}

.admin-ai-report__figures dt {
  font-weight: 600;
}

.admin-ai-report__figures dd {
  margin: 0;
}

.admin-ai-report__action {
  margin: 0.5rem 0 1.25rem;
}
