/* Members → Loot, attendance tiers, the demo's member page preview and
   What's new. */

/* Members → Loot */
.ml-member-page {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
  margin: 0 0 12px;
}

.ml-member-page small {
  color: var(--text-muted);
  font-size: 12px;
}

/* Search and dates start at the left, as on the Roster tab; only the count
   sits at the right. */
.ml-filters {
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
}

.ml-filters .search-label {
  margin-left: 0;
}

.ml-date-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.ml-title {
  margin: 0 0 12px;
}

.ml-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}

.ml-row {
  display: grid;
  grid-template-columns:
    110px minmax(120px, 1fr) minmax(200px, 1.4fr) minmax(100px, 0.8fr)
    64px minmax(132px, auto);
  align-items: center;
  gap: 6px 14px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
}

.ml-row:first-child {
  border-top: 0;
}

.ml-date {
  color: var(--text-secondary);
  font-size: 13px;
}

.ml-raid,
.ml-winner {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* The six-column rows need about 815px; below that (tablets, small laptop
   windows beside the sidebar) they stack as on a phone. */
@media (max-width: 1100px) {
  .rs-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .rs-row .rs-winner {
    grid-column: 1;
  }

  .rs-row .rs-facts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    grid-column: 1;
  }

  /* Rolls and Correct side by side under the award. */
  .rs-row .rs-buttons {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-self: start;
  }

  /* Stacked: the date and raid, the item on its own line, then the winner,
     the loot type and the delivery at the right. The markup's order stays
     the reading order. */
  .ml-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
  }

  .ml-date,
  .ml-raid {
    font-size: 12px;
  }

  .ml-item {
    flex: 1 1 100%;
    min-width: 0;
  }

  .ml-delivery {
    margin-left: auto;
  }
}

@media (max-width: 760px) {
  /* Loot's filters: search on its own line, From and To side by side with
     their labels above, then the count. */
  .ml-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .ml-filters .search-label {
    grid-column: 1 / -1;
    margin-left: 0;
  }

  .ml-date-field {
    display: grid;
    gap: 4px;
    min-width: 0;
    font-size: 12px;
  }

  .ml-filters input {
    width: 100%;
    min-width: 0;
  }

  .ml-filters .members-count {
    grid-column: 1 / -1;
    margin: 0;
  }

  .rs-roller {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .rs-roller-choice {
    grid-column: 2;
  }

  .rs-roller .rs-type,
  .rs-roller .rs-roll {
    grid-column: auto;
  }

  .rs-roller-mark {
    grid-column: 3;
  }
}

/* The Soft reserves tab's and the item picker's fields: the dashboard's
   charcoal field, 42px tall, and the one select chevron. */
.sr-panel select,
.sr-panel input,
.item-picker select,
.item-picker input {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
}

.sr-panel select,
.item-picker select {
  appearance: none;
  padding-right: 34px;
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.item-picker input,
.item-picker select {
  background-color: var(--bg-primary);
}

.sr-panel .sr-search input {
  padding-left: 36px;
}

.sr-panel select:hover,
.sr-panel input:hover,
.item-picker select:hover,
.item-picker input:hover {
  border-color: var(--border-hover);
}

.sr-panel select:focus-visible,
.sr-panel input:focus-visible,
.item-picker select:focus-visible,
.item-picker input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

/* Attendance tiers: the Loot rules settings rows and the Soft reserves member line.
   The rows share one column template with the headings above them; below 540px
   of room each row is a small card with its own field labels. */
.tier-table {
  container: tiers / inline-size;
  --tier-columns: 24px minmax(120px, 1fr) 112px 112px 110px;
}

.tier-head,
.tier-row {
  display: grid;
  grid-template-columns: var(--tier-columns);
  align-items: center;
  column-gap: 10px;
}

.tier-head {
  padding: 0 13px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tier-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tier-row {
  row-gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.tier-number {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-warm);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Over .settings-card label's column and top margin. */
.tier-row .tier-name,
.tier-row .tier-field {
  display: block;
  min-width: 0;
  margin: 0;
}

.tier-name input,
.unit-input input {
  width: 100%;
}

.tier-field-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* A number with its unit inside the box, at the right. */
.unit-input {
  position: relative;
  display: block;
}

.unit-input input {
  padding-right: 46px;
  font-variant-numeric: tabular-nums;
}

.unit-input-unit {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.tier-rest {
  grid-column: span 2;
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.tier-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.tier-icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.tier-icon-button:hover:not(:disabled) {
  border-color: var(--border-hover);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.tier-icon-button.is-danger:hover:not(:disabled) {
  color: var(--danger);
}

.tier-icon-button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

.tier-icon-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.tier-errors {
  grid-column: 2 / -1;
  display: grid;
}

.tier-errors:not(:has(.field-error:not(:empty))) {
  display: none;
}

.tier-errors .field-error {
  margin-top: 0;
}

.tier-add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 12px;
}

.tier-add .button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tier-add .form-note {
  margin: 0;
}

.tier-minimum {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 160px));
  gap: 12px 16px;
}

.tier-minimum .tier-minimum-field {
  display: grid;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

@container tiers (max-width: 539px) {
  .tier-head {
    display: none;
  }

  .tier-row {
    grid-template-columns: 24px minmax(0, 1fr) minmax(0, 1fr);
    row-gap: 10px;
  }

  .tier-name {
    grid-column: 2 / -1;
  }

  .tier-row .tier-field {
    display: grid;
    gap: 4px;
  }

  /* The number keeps column 1 to itself, so the fields flow into 2 and 3. */
  .tier-number {
    grid-row: span 3;
    align-self: start;
    margin-top: 9px;
  }

  .tier-field-label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    font-size: 11px;
    color: var(--text-muted);
  }

  .tier-rest {
    grid-column: 2 / -1;
  }

  .tier-buttons {
    grid-column: 2 / -1;
    justify-content: flex-start;
    margin-left: -8px;
  }
}

.sr-tier {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 4px 0 0;
  font-size: 12px;
}

.sr-tier-pill {
  padding: 2px 8px;
  border: 1px solid var(--border-warm);
  border-radius: 999px;
  background: var(--bg-warm);
  color: var(--accent);
  font-weight: 600;
}

.sr-tier-pill.is-barred {
  border-color: var(--warning-border);
  background: transparent;
  color: var(--warning);
}

.sr-tier-why {
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

/* Priority sits on the tier line, not 10px below it like other text buttons. */
.sr-tier .text-button {
  margin: 0;
  min-height: 24px;
  padding: 0 2px;
  font-size: 12px;
}

.sr-priority-dialog [hidden] {
  display: none;
}

/* The demo's member page previews (#raid/<uuid>/member, …/member-assignments): who it is viewed
   as, above the page. */
.member-preview-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 0 0 8px;
  padding: 12px 16px;
  border: 1px solid var(--border-warm);
  border-radius: 10px;
  background: var(--bg-warm);
}

.member-preview-bar .sr-card-note {
  margin: 0;
}

.member-preview-viewer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.member-preview-viewer select {
  min-height: 40px;
  min-width: 0;
  max-width: 100%;
}

.reserves-main.member-preview,
.assignments-main.member-preview {
  margin: 0;
  padding: 16px 0 32px;
}

@media (max-width: 760px) {
  .member-preview-viewer {
    flex: 1 1 100%;
    flex-wrap: wrap;
  }

  .member-preview-viewer select {
    flex: 1 1 100%;
  }
}

/* What's new (whats-new-view.js): the entries on one card; their own styles are in site/changelog.css. */
.whats-new {
  max-width: 760px;
}

.whats-new-list {
  padding: 28px 30px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.whats-new-more {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

@media (max-width: 760px) {
  .whats-new-list {
    padding: 22px 18px;
  }

  .whats-new-more .button {
    width: 100%;
  }
}
