/* Manager screen styles (DESIGN.md screens 6-10). Reuses the tokens, buttons, tables,
   tags, cards and stat tiles from app.css; adds the queue rows, filter tabs, occupancy
   chart, activity diff and settings layout that are specific to the manager UI.

   These lists aren't the calendar, so they don't carry the party-hue system - status
   here is still shown by form (solid / dashed / danger badge) rather than colour
   alone, just without a per-booking hue, matching the calendar's own "form, not hue"
   rule for status. */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- Filter tabs */

.tabs {
  display: flex;
  gap: var(--space-3);
  border-bottom: 1px solid var(--hairline);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.tabs a {
  display: inline-block;
  padding: var(--space-1) 0;
  min-height: var(--touch);
  line-height: var(--touch);
  text-decoration: none;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  font-weight: 700;
}

.tabs a.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* ---------------------------------------------------------------- Queue */

.queue-list {
  display: flex;
  flex-direction: column;
}

/* Rows, not cards: a hairline between entries and a left rule carrying the booking's
   status (in addition to its text tag - status is never colour-only). `:has()` reads
   the status tag/conflict list already in the markup, so no extra classes or template
   changes are needed to style the rule. */
.queue-row {
  border-bottom: 1px solid var(--hairline);
  border-left: 4px solid var(--border);
  padding: var(--space-2);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-2);
}

.queue-row:has(.tag--tentative) {
  border-left-style: dashed;
}

.queue-row:has(.tag--approved) {
  border-left-color: var(--accent);
}

.queue-row:has(.queue-row__conflicts) {
  border-left-color: var(--danger);
  border-left-style: solid;
  border-left-width: 5px;
}

.queue-row--confirm {
  border-left-color: var(--danger);
}

.queue-row--deleted {
  border-left-color: var(--border);
}

.queue-row__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.queue-row__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.queue-row__title strong {
  font-weight: 700;
  font-size: 1.05rem;
}

.queue-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.queue-row__conflicts {
  margin: 4px 0 0;
  padding-left: 1.2em;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 700;
}

.queue-row__actions {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.queue-row--confirm p,
.queue-row--deleted p {
  margin: 0 0 var(--space-1);
}

.queue-row--deleted {
  color: var(--muted);
}

@media (max-width: 720px) {
  .queue-row {
    flex-direction: column;
  }
  .queue-row__actions {
    width: 100%;
  }
  .queue-row__actions .btn,
  .queue-row__actions form {
    flex: 1 1 auto;
  }
}

/* ---------------------------------------------------------------- Tables (visitors,
   settings rooms, activity): the table itself is never squeezed narrower than its
   content; instead its own container scrolls sideways, and the page never does. */

.table-scroll {
  overflow-x: auto;
}

.row-actions {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  align-items: center;
}

.inline-form {
  margin: 0;
  display: inline-flex;
}

/* Settings > Rooms: each room is a CSS-grid row (name | beds | order | Save | Delete)
   with a visible header row on desktop; on phones the header is hidden and every field
   gets its own visible label instead, stacked in a single column. */

.rooms-grid__row {
  display: grid;
  grid-template-columns: 1fr 5rem 5rem 5rem 5rem;
  gap: var(--space-1) var(--space-2);
  align-items: center;
  padding: var(--space-1) var(--space-2) var(--space-1) 0;
  border-bottom: 1px solid var(--hairline);
}

.rooms-grid__row:last-child {
  border-bottom: none;
}

.rooms-grid__row--head {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  border-bottom: 2px solid var(--ink);
}

.rooms-grid__row--confirm {
  display: block;
  padding: var(--space-2);
}

.rooms-grid__row--confirm p {
  margin: 0 0 var(--space-1);
}

/* The room-edit form only groups the fields semantically; visually its children are
   grid items of the row itself. */
.room-edit-form {
  display: contents;
}

.rooms-grid__field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.rooms-grid__field-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rooms-grid__field input {
  min-height: var(--touch);
  padding: 0 var(--space-1);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-variant-numeric: tabular-nums;
  width: 100%;
}

.rooms-grid__field input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.rooms-grid__cell {
  display: flex;
}

.rooms-grid__cell--actions {
  justify-content: flex-end;
}

/* The "add a room" row sits below its own heading, detached from the rooms-grid's
   header row, so its fields need their own always-visible labels (unlike the
   existing-room rows, which rely on that header). Its button column also needs more
   room than the narrow Save/Delete columns, since "Add room" is longer text. */
.rooms-grid__row--add {
  grid-template-columns: 1fr 5rem 5rem auto;
  align-items: end;
}

.rooms-grid__row--add .rooms-grid__field-label {
  position: static;
  width: auto;
  height: auto;
  margin: 0 0 2px;
  overflow: visible;
  clip: auto;
  white-space: normal;
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.rooms-grid__row--add .btn {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .rooms-grid__row--head {
    display: none;
  }

  .rooms-grid__row:not(.rooms-grid__row--confirm) {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .rooms-grid__field-label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
  }

  .rooms-grid__cell--actions {
    justify-content: flex-start;
  }
}

/* Same 44px minimum touch target as every other button - "small" only means tighter
   padding and slightly smaller text, for a dense table row, not a shorter tap target
   (it used to be 36px, shorter than the 44px inputs it sits next to in a rooms-grid
   row). */
.btn--small {
  min-height: var(--touch);
  padding: 0 var(--space-1);
  font-size: 0.9rem;
}

.tag--guest {
  border-style: dashed;
  background: var(--surface);
}

.tag--revoked {
  color: #FFFFFF;
  border-color: var(--danger);
  background: var(--danger);
}

.confirm-actions {
  display: flex;
  gap: var(--space-1);
  align-items: center;
}

/* ---------------------------------------------------------------- Occupancy chart */

.chart {
  margin: 0;
}

.chart__scroll {
  overflow-x: auto;
  /* Extra top padding leaves room for the capacity label and the over-capacity value
     text, both of which sit just above the 100%-height line (an overflow-x container
     also clips the y-axis, so without this they'd be cut off). */
  padding: 1.6em 2rem var(--space-1);
}

.chart__bars {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 160px;
  border-bottom: 2px solid var(--ink);
}

.chart__capacity-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  border-top: 2px dashed var(--muted);
}

.chart__capacity-label {
  position: absolute;
  top: -1.4em;
  right: 0;
  font-size: 0.7rem;
  line-height: 1;
  color: var(--muted);
}

.chart__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
  flex: 1 1 0;
}

.chart__bar-track {
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
}

.chart__bar {
  position: relative;
  width: 100%;
  min-height: 2px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
}

.chart__bar--over {
  background: var(--danger);
}

.chart__bar-value {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.7rem;
  line-height: 1;
  color: var(--danger);
  font-weight: 700;
  margin-bottom: 4px;
}

@media (max-width: 480px) {
  .chart__bar-value {
    font-size: 0.6rem;
  }
}

/* Bucketed bar heights (5% steps) so no inline `style` attribute is needed (kept CSP-clean:
   style-src 'self' only). */
.chart__bar--h0 { height: 0%; }
.chart__bar--h5 { height: 5%; }
.chart__bar--h10 { height: 10%; }
.chart__bar--h15 { height: 15%; }
.chart__bar--h20 { height: 20%; }
.chart__bar--h25 { height: 25%; }
.chart__bar--h30 { height: 30%; }
.chart__bar--h35 { height: 35%; }
.chart__bar--h40 { height: 40%; }
.chart__bar--h45 { height: 45%; }
.chart__bar--h50 { height: 50%; }
.chart__bar--h55 { height: 55%; }
.chart__bar--h60 { height: 60%; }
.chart__bar--h65 { height: 65%; }
.chart__bar--h70 { height: 70%; }
.chart__bar--h75 { height: 75%; }
.chart__bar--h80 { height: 80%; }
.chart__bar--h85 { height: 85%; }
.chart__bar--h90 { height: 90%; }
.chart__bar--h95 { height: 95%; }
.chart__bar--h100 { height: 100%; }

.chart__labels {
  display: flex;
  gap: 2px;
  margin-top: 4px;
}

.chart__label {
  flex: 1 1 0;
  min-width: 0;
  overflow: visible;
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
  text-align: center;
}

/* ---------------------------------------------------------------- Conflicts list */

.conflict-list {
  margin: 0;
  padding-left: 1.2em;
}

.conflict-list li {
  margin-bottom: var(--space-1);
}

/* ---------------------------------------------------------------- Activity diff */

.diff-list {
  margin: 0;
  padding-left: 1.2em;
  font-size: 0.9rem;
}

.diff-list li {
  font-variant-numeric: tabular-nums;
}

.pager {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

/* Guest page: share-link table (Settings / Links). */
.link-url {
  width: 100%;
  min-width: 16rem;
}

