/* =============================================================================
   Shift competition — a section of Home (hub-shift-competition.js)

   Borderless, on hairlines, like the rest of Home. The table becomes stacked
   cards when ITS column is narrow (a container query), whatever the viewport:
   Home's main column is narrow on a laptop with the side column open, too.
   Every variant is a class -- the Hub's CSP allows no inline style.
   ============================================================================= */
.hub-comp { container-type: inline-size; }
/* the slot Home gives it takes no room until there is something to show */
.hub-home-comp:empty { display: none; }

.hub-comp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.hub-comp-sub { margin: 6px 0 0; font-size: 13.5px; font-weight: 600; color: #344256; }
.hub-comp-how { margin: 4px 0 0; font-size: 13px; line-height: 1.5; color: var(--text3); max-width: 70ch; }
.hub-comp-status {
  flex: none; padding: 5px 10px; border-radius: 999px; background: #eef1f5; color: #344256;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}

.hub-comp-legend {
  list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 14px 0 0; padding: 0;
  font-size: 12.5px; color: var(--text3);
}
.hub-comp-legend li { display: inline-flex; align-items: center; gap: 6px; }

/* position: relative keeps the screen-reader-only text inside from widening the page */
.hub-comp-wrap { position: relative; margin-top: 12px; }
.hub-comp-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.hub-comp-table caption { caption-side: top; padding: 0 0 10px; text-align: left; font-size: 13px; color: var(--text3); }
.hub-comp-table thead th {
  padding: 8px 6px; border-bottom: 1px solid var(--border); background: none; text-align: left;
  font-size: 12.5px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text3);
}
.hub-comp-table thead th.hub-comp-rank { width: 52px; }
.hub-comp-table thead th:nth-child(2) { width: 27%; }
.hub-comp-table thead th.hub-comp-total { width: 108px; text-align: right; }
.hub-comp-table thead th.hub-comp-wk { text-align: center; }

.hub-comp-row > td, .hub-comp-row > th { padding: 10px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.hub-comp-row.is-yours > td, .hub-comp-row.is-yours > th { background: #f4faf9; }
.hub-comp-row.is-yours > :first-child { box-shadow: inset 3px 0 0 var(--accent-2); }

.hub-comp-rank-n {
  display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 999px;
  background: #eef1f5; color: #344256; font-family: var(--font-num); font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.hub-comp-rank-n.is-first { background: var(--navy); color: #fff; }
.hub-comp-rank-n.is-none { background: none; color: var(--text3); }
.hub-comp-tied { display: block; margin-top: 3px; font-size: 11px; font-weight: 600; color: var(--text3); }

.hub-comp-shift { text-align: left; font-weight: 400; }
.hub-comp-label { font-size: 14px; font-weight: 600; color: var(--ink-900); }
.hub-comp-yours {
  display: inline-block; margin-left: 8px; padding: 2px 7px; border-radius: 999px; vertical-align: 1px;
  font-size: 11px; font-weight: 600; background: #edf7f6; color: var(--accent-2); box-shadow: inset 0 0 0 1px #d3ecea;
}
.hub-comp-members { display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.45; color: var(--text3); }
.hub-comp-member.is-you { color: var(--text); font-weight: 600; }

.hub-comp-wk { text-align: center; }
.hub-comp-none { color: var(--text3); }
.hub-comp-cell {
  appearance: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 100%; min-height: 60px; padding: 6px 4px; border: 1px solid transparent; border-radius: 10px;
  background: #f4f6f9; font: inherit; color: var(--text); cursor: pointer;
}
.hub-comp-cell:hover { border-color: #b7c0cc; }
.hub-comp-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hub-comp-cell.is-full { background: #edf7f6; }
.hub-comp-cell.is-pending { background: #fff8ec; }
.hub-comp-cell.is-today { box-shadow: inset 0 0 0 1px #9fb1c7; }
.hub-comp-cell.is-upcoming, .hub-comp-cell.is-closed { background: none; border: 1px dashed #d5dbe3; }
.hub-comp-cell.is-open { border: 1px solid var(--navy); background: #fff; }
.hub-comp-score {
  font-family: var(--font-num); font-size: 16px; font-weight: 700; line-height: 1.1; color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}
.hub-comp-word { font-size: 12.5px; color: var(--text3); }
.hub-comp-tag { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--navy); }
.hub-comp-flag { font-size: 10.5px; font-weight: 600; line-height: 1.2; color: #7c3a0b; }

.hub-comp-pips { display: inline-flex; gap: 4px; }
.hub-comp-pip {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  border: 1.5px solid #b7c0cc; background: #fff;
}
.hub-comp-pip.is-on { border-color: var(--accent-2); background: var(--accent-2); }
.hub-comp-pip.is-pending { border-color: #d97706; border-style: dashed; background: #fff8ec; }

.hub-comp-total { text-align: right; }
.hub-comp-total-n {
  display: block; font-family: var(--font-num); font-size: 22px; font-weight: 700; line-height: 1.1;
  color: var(--ink-900); font-variant-numeric: tabular-nums;
}
.hub-comp-total-of { display: block; font-size: 11.5px; color: var(--text3); }
.hub-comp-pending {
  display: inline-block; margin-top: 4px; padding: 2px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 600; line-height: 1.3; background: #fff8ec; color: #7c3a0b; box-shadow: inset 0 0 0 1px #f3d7a6;
}

/* the opened week: what counted, and -- for a supervisor -- the one point a person decides */
.hub-comp-detail > td { padding: 0 0 14px; border-bottom: 1px solid var(--border); }
.hub-comp-panel {
  margin-top: 6px; padding: 16px 18px; border-radius: 12px; text-align: left;
  background: #f7f9fb; box-shadow: inset 0 0 0 1px var(--border);
}
.hub-comp-panel-h { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--ink-900); }
.hub-comp-panel-note { margin: 0; font-size: 13.5px; color: var(--text3); }
.hub-comp-lines { list-style: none; display: grid; gap: 8px; margin: 0; padding: 0; }
.hub-comp-line {
  display: grid; grid-template-columns: 14px minmax(8.5rem, max-content) minmax(0, 1fr); gap: 10px;
  align-items: baseline; font-size: 13.5px;
}
.hub-comp-line-name { font-weight: 600; color: var(--text); }
.hub-comp-line-what { color: var(--text3); }
.hub-comp-mark { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #b7c0cc; align-self: center; }
.hub-comp-mark.is-on { border-color: var(--accent-2); background: var(--accent-2); }
.hub-comp-mark.is-pending { border-color: #d97706; border-style: dashed; }

.hub-comp-edit { display: grid; gap: 10px; max-width: 560px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.hub-comp-seg { margin: 0; padding: 0; border: 0; min-width: 0; }
.hub-comp-seg legend { margin-bottom: 8px; padding: 0; font-size: 13.5px; font-weight: 600; color: var(--text); }
.hub-comp-opts { display: inline-flex; border-radius: 10px; box-shadow: inset 0 0 0 1px #8b95a5; overflow: hidden; }
.hub-comp-opt { position: relative; display: block; }
/* the real radio stays in place, transparent, over its face: clickable, focusable, announced */
.hub-comp-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.hub-comp-opt-face {
  display: grid; place-items: center; min-width: 52px; height: 42px; padding: 0 14px;
  font-family: var(--font-num); font-size: 15px; font-weight: 700; color: var(--text);
}
.hub-comp-opt + .hub-comp-opt .hub-comp-opt-face { border-left: 1px solid #8b95a5; }
.hub-comp-opt input:checked + .hub-comp-opt-face { background: var(--navy); color: #fff; }
.hub-comp-opt input:focus-visible + .hub-comp-opt-face { outline: 2px solid var(--accent); outline-offset: -4px; }
.hub-comp-opt input:disabled + .hub-comp-opt-face { opacity: .6; }
.hub-comp-note-l { font-size: 13px; font-weight: 600; color: var(--text); }
.hub-comp-opt-l { font-weight: 400; color: var(--text3); }
.hub-comp-note { min-height: 64px; resize: vertical; }
.hub-comp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.hub-comp-msg { font-size: 13px; color: var(--accent-2); }
.hub-comp-msg.is-error { color: #b42318; }
.hub-comp-meta, .hub-comp-hint { margin: 0; font-size: 12.5px; color: var(--text3); }

.hub-comp-foot { margin: 12px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text3); max-width: 80ch; }

/* ---- a narrow column: one card per shift, its weeks on a row beneath it ---- */
@container (max-width: 640px) {
  .hub-comp-table, .hub-comp-table tbody { display: block; width: 100%; }
  .hub-comp-table caption { display: block; }
  .hub-comp-table thead {
    display: block; position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .hub-comp-table .hub-comp-row {
    display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px;
    padding: 14px 4px; border-bottom: 1px solid var(--border);
  }
  .hub-comp-table .hub-comp-row.is-yours { background: #f4faf9; box-shadow: inset 3px 0 0 var(--accent-2); padding-left: 10px; }
  .hub-comp-row > td, .hub-comp-row > th { display: block; padding: 0; border: 0; background: none; box-shadow: none; }
  .hub-comp-row.is-yours > td, .hub-comp-row.is-yours > th, .hub-comp-row.is-yours > :first-child { background: none; box-shadow: none; }
  .hub-comp-row > .hub-comp-rank { grid-row: 1; grid-column: 1 / 3; }
  .hub-comp-row > .hub-comp-shift { grid-row: 1; grid-column: 3 / 10; }
  .hub-comp-row > .hub-comp-total { grid-row: 1; grid-column: 10 / 13; }
  .hub-comp-row > .hub-comp-wk { grid-row: 2; grid-column: span 3; }
  .hub-comp-row > .hub-comp-wk::before {
    content: attr(data-l); display: block; margin-bottom: 4px; font-size: 11.5px; font-weight: 600; color: var(--text3);
  }
  .hub-comp-table .hub-comp-detail { display: block; }
  .hub-comp-detail > td { display: block; padding: 0 0 14px; }
  .hub-comp-line { grid-template-columns: 12px minmax(0, 1fr); }
  .hub-comp-line-what { grid-column: 2; }
}
/* a phone: two weeks to a row, so every cell stays tappable and readable */
@container (max-width: 440px) {
  .hub-comp-row > .hub-comp-rank { grid-column: 1 / 3; }
  .hub-comp-row > .hub-comp-shift { grid-column: 3 / 9; }
  .hub-comp-row > .hub-comp-total { grid-column: 9 / 13; }
  .hub-comp-row > .hub-comp-wk { grid-row: auto; grid-column: span 6; }
  .hub-comp-cell { min-height: 56px; }
  .hub-comp-opts { display: flex; }
  .hub-comp-opt { flex: 1 1 0; }
  .hub-comp-opt-face { min-width: 0; }
}
