/* Officer hub: admin section (President only). The seats table, its More menus, the show-once
   code dialog and the "How codes work" panel. Tokens come from app.css; .team-you from hub-team.css. */

.adm-only { max-width: 560px; }

/* ---------- seats at a glance ---------- */

.adm-stats { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.adm-stat {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 6px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: 14px;
}
.adm-stat-n { font-weight: 800; font-variant-numeric: tabular-nums; }
.adm-stat-label { color: var(--muted); }
.adm-stat.is-warn { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.adm-stat.is-warn .adm-stat-n { color: var(--warn); }

/* ---------- the seats table ---------- */

.adm-table-box {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.adm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.adm-table th {
  text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.adm-table td { padding: 11px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.adm-table tbody tr:first-child td { border-top: 0; }
.adm-table tr.is-me td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.adm-table tr.is-open td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.adm-table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius); }
.adm-table tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius); }

.adm-seat { width: 24%; }
.adm-seat-in { display: flex; align-items: center; gap: 10px; }
.adm-role { font-weight: 650; overflow-wrap: anywhere; }
.adm-first { display: inline-flex; align-items: center; font-weight: 700; overflow-wrap: anywhere; }
.adm-first .team-you { margin-left: 8px; }
.adm-full { display: block; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.adm-open { color: var(--muted); font-style: italic; }
.adm-warn { margin: 6px 0 0; max-width: 34ch; font-size: 12px; font-weight: 650; color: var(--warn); }
.adm-code-cell { white-space: nowrap; }
.adm-badge.is-on { --c: var(--ok); }
.adm-badge.is-off { --c: var(--warn); }
.adm-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.adm-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.adm-muted { color: var(--muted); }
.adm-seen { white-space: nowrap; color: var(--muted); }
.adm-seen time { color: var(--text); }
.adm-actions-h { width: 1%; }
.adm-actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.adm-actions .btn { white-space: nowrap; }

/* The More menu (a <details>). */
.adm-more { position: relative; }
.adm-more > summary { list-style: none; user-select: none; -webkit-user-select: none; }
.adm-more > summary::-webkit-details-marker { display: none; }
.adm-more > summary::after {
  content: ""; width: 6px; height: 6px; margin: -3px 2px 0 2px;
  border: solid currentColor; border-width: 0 1.6px 1.6px 0; transform: rotate(45deg);
}
.adm-more[open] > summary { border-color: var(--accent); }
.adm-more[open] > summary::after { transform: rotate(225deg); margin-top: 3px; }
.adm-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  min-width: 230px; padding: 6px; display: grid; gap: 2px;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--line-strong);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.35);
}
.adm-menu-item {
  min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: inherit; font-weight: 600; text-align: left; cursor: pointer;
}
.adm-menu-item:hover, .adm-menu-item:focus-visible { background: var(--surface-2); }
.adm-menu-item:focus-visible { outline-offset: -2px; }
.adm-menu-item.is-danger { color: var(--danger); }

/* ---------- how codes work ---------- */

.adm-how { margin-top: 18px; }
.adm-how-title { margin: 0 0 14px; font-size: 16px; }
.adm-how-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px 28px;
}
.adm-how-list li { padding-left: 14px; border-left: 2px solid var(--line-strong); }
.adm-how-point { margin: 0 0 3px; font-weight: 700; font-size: 14px; }
.adm-how-body { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- dialogs ---------- */

.adm-dialog-lede { margin: 0 0 14px; }
.adm-field-error { margin: 6px 0 0; font-size: 14px; }
.adm-field input[aria-invalid="true"] { border-color: var(--danger); }
.adm-rename-note { margin: 4px 0 0; border-left-color: var(--warn); }

.adm-code-for { margin: 0 0 10px; color: var(--muted); font-weight: 600; }
.adm-code-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 18px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line-strong);
}
.adm-code {
  font: 800 34px/1.1 ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.12em; color: var(--text); white-space: nowrap;
  user-select: all; -webkit-user-select: all;
}
.adm-copy { flex: none; }
.adm-copy-fallback { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.adm-dm-block { margin-top: 18px; }
.adm-dm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.adm-dm-head label { margin: 0; }
.adm-dm-block .hint { margin: 6px 0 0; font-size: 13px; }
.hub-dialog textarea.adm-dm { min-height: 88px; font-size: 15px; background: var(--bg); }
.adm-once { margin: 16px 0 0; border-left-color: var(--warn); }
.adm-handover { margin: 16px 0 0; border-left-color: var(--accent); }

/* ---------- phones and narrow windows: each seat becomes a card ---------- */

@media (max-width: 899px) {
  .adm-table-box { background: none; border: 0; box-shadow: none; }
  .adm-table thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .adm-table tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 10px; }
  .adm-table tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "seat code" "name name" "seen seen" "actions actions";
    grid-template-rows: auto auto auto 1fr;
    gap: 6px 12px; padding: 14px 16px;
    border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  }
  .adm-table tr.is-me { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
  .adm-table tr.is-open { background: transparent; border-style: dashed; border-color: var(--line-strong); box-shadow: none; }
  .adm-table td { display: block; padding: 0; border: 0; }
  .adm-table tr.is-me td, .adm-table tr.is-open td { background: none; }
  .adm-table tbody tr:last-child td { border-radius: 0; }
  .adm-seat { grid-area: seat; width: auto; }
  .adm-code-cell { grid-area: code; text-align: right; }
  .adm-table td.adm-name { grid-area: name; padding-left: 38px; }
  .adm-table td.adm-seen { grid-area: seen; padding-left: 38px; font-size: 13px; }
  .adm-seen:empty { display: none; }
  .adm-seen:has(time)::before { content: "Last seen "; color: var(--muted); }
  .adm-actions-cell { grid-area: actions; align-self: end; margin-top: 6px; }
  .adm-actions { justify-content: flex-start; flex-wrap: wrap; }
  .adm-table tr.is-open .adm-seen { display: none; }
}

@media (max-width: 759px) {
  .adm-stats { gap: 6px; }
  .adm-stat { padding: 5px 11px; font-size: 13px; }
  .adm-actions .btn, .adm-more > summary { min-height: 44px; }
  .adm-actions > .btn { flex: 1 1 auto; }
  .adm-menu { min-width: 240px; }
  .adm-menu-item { min-height: 44px; }
  .adm-code { font-size: 28px; letter-spacing: 0.1em; }
  .adm-code-row { padding: 14px; }
  .adm-code-row .adm-copy { width: 100%; min-height: 46px; }
  .adm-dm-head .adm-copy { flex: none; }
  .hub-dialog textarea.adm-dm { min-height: 132px; }
  .adm-dm-head .btn { min-height: 44px; }
}
