/* ==========================================================================
   Nameless — admin portal
   Builds on styles.css and portal.css (header, dialogs, tiles, pills). Kept to quiet
   lists: each item on its own dark card, one line of detail, actions on the right.
   ========================================================================== */

.admin-container { max-width: 980px; }
.admin-body[hidden], .admin-locked[hidden] { display: none; }

/* ---------------- Locked (not an admin) ---------------- */
.admin-locked {
  max-width: 620px;
  margin: 40px auto 0;
  padding: clamp(24px, 4vw, 40px);
  display: grid; gap: 14px; justify-items: start;
}
.admin-locked .eyebrow { margin-bottom: 0; }
.admin-locked-text { color: var(--text-muted); }

/* ---------------- Head and tabs ---------------- */
.admin-head { margin-bottom: 28px; }
.admin-head .eyebrow { flex-wrap: wrap; margin-bottom: 8px; }
.admin-lede { margin-top: 8px; max-width: 62ch; color: var(--text-muted); }

.admin-tabs {
  display: flex; gap: 4px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-tab {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px;
  padding: 10px 16px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-muted);
  font-family: var(--font-label); font-weight: 700;
  font-size: 1.02rem; letter-spacing: 0.06em;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.admin-tabs[hidden] { display: none; }
.admin-tab:hover { color: var(--gold-100); }
.admin-tab[aria-selected="true"] { color: var(--gold-100); border-bottom-color: var(--gold); }
.admin-tab:focus-visible { outline-offset: -2px; }
.admin-panel[hidden] { display: none; }
.admin-panel:focus { outline: none; }

/* ---------------- Toolbars and headings ---------------- */
.admin-toolbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 12px;
}
.admin-toolbar--head { margin-bottom: 6px; }
.admin-h2 {
  display: flex; align-items: center; gap: 10px;
  margin: 0;
  font-family: var(--font-display); font-weight: 400;
  font-size: 1.35rem; letter-spacing: 0.03em;
  color: var(--gold-100);
}
.admin-h2 .team-gem { width: 12px; height: 12px; }
.admin-summary { margin-bottom: 12px; font-size: 0.95rem; color: var(--text-muted); }
.admin-faint { color: var(--text-faint); }
.admin-handle { font-family: var(--font-body); font-size: 0.9rem; letter-spacing: 0; color: var(--text-muted); }

.admin-search { position: relative; flex: 1 1 260px; max-width: 420px; }
.admin-search .icon {
  position: absolute; left: 12px; top: 50%; translate: 0 -50%;
  width: 18px; height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}
.admin-search .input { padding-left: 40px; }
.admin-search--sheet { max-width: none; margin-bottom: 10px; }

.admin-sortbar { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-bottom: 12px; }
.admin-select { display: flex; align-items: center; gap: 10px; }
.admin-select label {
  font-family: var(--font-label); font-weight: 700;
  font-size: 0.85rem; letter-spacing: 0.1em;
  color: var(--text-muted);
}
.admin-select .input { width: auto; min-width: 11rem; min-height: 40px; padding-block: 6px; }

.admin-section + .admin-section, [data-waiting] + .admin-teams .admin-section:first-child { margin-top: 40px; }
.admin-teams .admin-section + .admin-section { margin-top: 40px; }
.admin-allclear {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-style: italic;
}

/* ---------------- Lists ---------------- */
/* Every item is a solid dark navy card, so lists don't show the page background through them
   (except on the Raid teams tab and a team's roster: see below) */
.admin-list { display: grid; gap: 6px; }
.admin-list > li {
  --item-bg: var(--navy-800);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--item-bg);
}
.admin-list > li.admin-empty { --item-bg: transparent; border-color: transparent; }
/* Members carry a faint wash of their raid teams' colors (set inline as --team-wash) */
.admin-list > li.admin-member { background-image: var(--team-wash, none); }
.admin-chars { border-top: 1px solid var(--line); }
.admin-chars > li { border-bottom: 1px solid var(--line); }
.admin-row {
  display: flex; align-items: center; gap: 12px 16px;
  min-height: 60px;
  padding: 10px 12px 10px 14px;
  box-shadow: inset 2px 0 0 var(--class-color, transparent);
  transition: background-color 0.2s;
}
.admin-row:hover { background-color: rgba(217, 164, 110, 0.04); }
.admin-list > li.admin-row:hover { background-color: var(--navy-700); }
/* On the Raid teams tab and a team's roster, items are the same navy at 90%, so the page shows faintly
   through (the row flash ends on --item-bg, so it fades back to this too) */
[data-panel="teams"] .admin-list > li:not(.admin-empty),
[data-teampage-roster] > li:not(.admin-empty) { --item-bg: rgba(18, 26, 58, 0.9); }
[data-panel="teams"] .admin-list > li.admin-row:hover,
[data-teampage-roster] > li.admin-row:hover { background-color: rgba(24, 34, 74, 0.9); }
.admin-row:focus-visible { outline-offset: -2px; }
.admin-row-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.admin-row-title {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px;
  font-family: var(--font-label); font-weight: 700;
  font-size: 1.05rem; letter-spacing: 0.04em;
  color: var(--gold-100);
  overflow-wrap: anywhere;
}
.admin-row-line { font-size: 0.92rem; color: var(--text-muted); }
.admin-row-line .signup-row-key { margin-right: 4px; }
.admin-row-role, .admin-spot-standing { flex: none; }
.admin-row-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.admin-row .char-teams { margin-top: 4px; }
.admin-empty { padding: 16px 8px; color: var(--text-muted); font-style: italic; }

.icon-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--gold-300);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}
.icon-btn:hover { border-color: var(--line-strong); background: rgba(217, 164, 110, 0.08); color: var(--gold-100); }
.icon-btn .icon { width: 18px; height: 18px; }
.icon-btn--danger { color: var(--text-muted); }
.icon-btn--danger:hover { border-color: rgba(255, 143, 136, 0.5); background: rgba(255, 143, 136, 0.08); color: var(--danger); }

/* A row just saved */
.is-flash { animation: admin-flash 1.6s var(--ease-out); }
@keyframes admin-flash {
  0% { background: rgba(217, 164, 110, 0.18); box-shadow: inset 2px 0 0 var(--class-color, var(--gold)), inset 0 0 0 1px var(--gold); }
  100% { background: var(--item-bg, transparent); box-shadow: inset 2px 0 0 var(--class-color, transparent), inset 0 0 0 1px transparent; }
}

/* ---------------- Members ---------------- */
.admin-member-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center; gap: 4px 14px;
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s;
}
.admin-member-toggle:hover { background: rgba(217, 164, 110, 0.04); }
.admin-member-toggle:focus-visible { outline-offset: -2px; }
.admin-member-toggle .avatar { --size: 36px; }
.admin-member-id { display: grid; min-width: 0; }
.admin-member-name {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px;
  font-family: var(--font-label); font-weight: 700;
  font-size: 1.05rem; letter-spacing: 0.04em;
  color: var(--gold-100);
}
.admin-member-name .you-tag { margin-left: 0; }
.admin-member-meta {
  display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px 8px;
  font-size: 0.92rem; color: var(--text-muted); text-align: right;
}
/* In the Members list, team labels are filled with their team's color */
.admin-member .team-chip {
  border-color: rgba(var(--team-rgb), 0.65);
  background: rgba(var(--team-rgb), 0.3);
  color: var(--text);
}
.admin-chevron { width: 18px; height: 18px; color: var(--gold-300); transition: transform 0.3s var(--ease-out); }
.admin-member.is-open .admin-chevron { transform: rotate(180deg); }
.admin-member.is-open > .admin-member-toggle { background: rgba(217, 164, 110, 0.04); }

.admin-member-panel { padding: 0 12px 14px 62px; }
.admin-member-panel[hidden] { display: none; }
.admin-chars > li:last-child { border-bottom: 0; }
.admin-chars { border-bottom: 1px solid var(--line); }
.admin-member-panel > .admin-empty { padding-left: 0; }
/* A member's availability (the same grid as the member portal, in a dialog) */
.admin-member-avail { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 12px 0 4px; }
.admin-member-avail .admin-row-line { margin: 0; }
.admin-member-foot {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px 16px;
  padding-top: 12px;
}
.admin-member-foot .btn .icon, .admin-toolbar .btn .icon { width: 16px; height: 16px; }
.admin-member-facts { font-size: 0.85rem; color: var(--text-faint); }
.admin-member-foot .admin-member-facts:first-of-type { margin-right: auto; }
.admin-member-foot .link-danger { min-height: 40px; padding: 6px 0; }
.admin-member-armory { font-size: 0.85rem; flex-basis: 100%; }

/* ---------------- Teams ---------------- */
.admin-team .admin-h2 { color: var(--team-glow); }
.admin-team .admin-list > li:not(.admin-empty) { border-color: rgba(var(--team-rgb), 0.3); }
.admin-spot-role { flex: none; width: 92px; }
.admin-spot.is-open-slot .admin-row-title { font-family: var(--font-body); font-weight: 400; font-style: italic; letter-spacing: 0; color: var(--text-faint); }
.admin-spot.is-open-slot .role-slot { border-style: dashed; background: transparent; }

/* Declined signups fold away under the waiting lists */
.admin-declined { margin-top: 28px; }
.admin-declined > summary {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px;
  font-family: var(--font-label); font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-muted);
  cursor: pointer;
}
.admin-declined > summary:hover { color: var(--gold-100); }
.admin-declined[open] > summary { margin-bottom: 8px; color: var(--gold-100); }

/* The Raid teams tab: Create New Team at the top right; each team's leaders; applicants' answers */
.admin-teams-head { align-items: flex-start; flex-wrap: nowrap; }
.admin-teams-head .admin-summary { margin: 0; max-width: 64ch; }
.admin-teams-head .btn { flex: none; }
.admin-team-actions { display: flex; align-items: center; gap: 6px; }
.admin-leaders { margin: -4px 0 12px; color: var(--team-glow, var(--text-muted)); }
[data-unlisted] > .admin-section, [data-waiting]:not(:empty) + [data-unlisted] > .admin-section { margin-top: 40px; }
[data-unlisted]:not(:empty) + .admin-teams .admin-section:first-child { margin-top: 40px; }
.admin-answers-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  justify-self: start;
  min-height: 36px;
  margin-top: 4px;
  padding: 0 10px 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  font-family: var(--font-label); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.06em;
  color: var(--text-muted);
  cursor: pointer;
}
.admin-answers-toggle:hover, .admin-answers-toggle[aria-expanded="true"] { color: var(--gold-100); border-color: var(--gold-300); }
.admin-answers-toggle .icon { width: 16px; height: 16px; color: var(--gold-300); transition: transform 0.3s var(--ease-out); }
.admin-answers-toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }
.admin-answers[hidden] { display: none; }
.admin-answers {
  display: grid; gap: 8px;
  margin-top: 8px;
  padding: 10px 12px;
  border-left: 2px solid var(--line-strong);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(7, 8, 13, 0.3);
}
.admin-answers dt {
  font-family: var(--font-label); font-weight: 700;
  font-size: 0.82rem; letter-spacing: 0.06em;
  color: var(--text-muted);
}
.admin-answers dd { margin: 2px 0 0; color: var(--text); white-space: pre-line; overflow-wrap: anywhere; }

/* The Support button at the bottom of every admin page */
.admin-support {
  display: flex; justify-content: center;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

/* ---------------- A team's page ---------------- */
.admin-teampage[hidden] { display: none; }
.admin-teampage .back-link { margin-bottom: 18px; }
.admin-teampage-head {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(var(--team-rgb), 0.35);
}
.admin-teampage-head .team-gem { width: 18px; height: 18px; }
.admin-teampage-title {
  margin: 0;
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  color: var(--team-glow);
  text-shadow: 0 0 20px rgba(var(--team-rgb), 0.45);
}
.admin-teampage-title:focus { outline: none; }
.admin-teampage .admin-section + .admin-section { margin-top: 40px; }
.admin-teampage .admin-list > li:not(.admin-empty) { border-color: rgba(var(--team-rgb), 0.3); }
.admin-teampage .btn .icon { width: 16px; height: 16px; }

.admin-team-form, .admin-options-form {
  display: grid; gap: 16px;
  max-width: 640px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--navy-800);
}
.admin-team-form .field-hint + .admin-team-form-actions { margin-top: -4px; }
.admin-team-form-actions { display: flex; justify-content: flex-end; }
.check-row {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 40px;
  font-family: var(--font-label); font-weight: 700; letter-spacing: 0.04em;
  color: var(--gold-100);
  cursor: pointer;
}
.check-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--gold); }
.check-row + .field-hint { margin-top: -12px; }
.tiles--color { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tiles--kind { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles--kind:has(> :nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* a survey's four, two by two */
.tile:has(:disabled) { opacity: 0.45; cursor: not-allowed; }
.tile:has(:disabled):hover { border-color: var(--line); color: var(--text-muted); }

.leader-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.leader-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 4px 2px 14px;
  border: 1px solid rgba(var(--team-rgb), 0.45);
  border-radius: 999px;
  background: rgba(var(--team-rgb), 0.1);
  font-family: var(--font-label); font-weight: 700; letter-spacing: 0.04em;
  color: var(--gold-100);
}
.leader-chip .icon-btn { width: 34px; height: 34px; border-radius: 999px; }
.leader-chip .icon-btn .icon { width: 15px; height: 15px; }
.leader-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.leader-add .input { width: auto; flex: 1 1 260px; max-width: 420px; min-height: 40px; padding-block: 6px; }

.admin-questions { display: grid; gap: 6px; }
[data-teampage-standard] { margin-bottom: 6px; }
.admin-question--standard {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text-muted);
}
.admin-question--standard .tag { margin-left: auto; flex: none; }
.admin-question-num {
  flex: none;
  display: grid; place-items: center;
  min-width: 28px; height: 28px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--font-label); font-weight: 700; font-size: 0.85rem;
  color: var(--gold-300);
}
.icon-btn--down .icon { transform: rotate(180deg); }
.icon-btn:disabled { opacity: 0.3; cursor: default; pointer-events: none; }

/* A survey's follow-up sits indented under its question, joined to it by a line; its question offers Add follow-up */
.admin-question--follow-up { margin-left: 40px; position: relative; }
.admin-question--follow-up::before {
  content: ""; position: absolute; left: -24px; top: -7px; width: 16px; height: calc(50% + 7px);
  border-left: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong);
  border-bottom-left-radius: 6px;
}
.admin-question--follow-up .admin-question-num { font-family: var(--font-body); letter-spacing: 0; } /* "3a", not small caps */
.admin-show-for { color: var(--gold-300); overflow-wrap: anywhere; }
.admin-follow-up-add { margin-top: 8px; }

/* Add question and Add template question, with the templates' panel under its button */
.admin-question-adds { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.admin-question-adds[hidden] { display: none; }
.template-menu { position: relative; }
.template-menu-chevron { width: 16px; height: 16px; transition: transform 0.3s var(--ease-out); }
[data-template-toggle][aria-expanded="true"] .template-menu-chevron { transform: rotate(180deg); }
.template-menu-panel {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: min(300px, calc(100vw - 2 * var(--gutter)));
  padding: 10px;
  background: rgba(11, 16, 40, 0.97);
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.85);
  z-index: 20;
}
.template-menu-panel[hidden] { display: none; }
.template-menu-title { margin: 2px 6px 8px; font-size: 0.88rem; color: var(--text-muted); }
.template-menu-list { display: grid; gap: 2px; }
.template-menu-item {
  display: grid; gap: 2px; width: 100%;
  padding: 8px 10px;
  border: 0; border-radius: var(--radius);
  background: transparent;
  font: inherit; text-align: left; color: var(--text);
  cursor: pointer;
}
.template-menu-item:hover { background: rgba(217, 164, 110, 0.08); }
.template-menu-item:disabled { cursor: default; opacity: 0.55; background: transparent; }
.template-menu-name { font-family: var(--font-label); font-weight: 700; letter-spacing: 0.04em; color: var(--gold-100); }
.template-menu-sub { font-size: 0.88rem; color: var(--text-muted); }

/* The question dialog: a template's fixed wording, a scale's two labels, a follow-up's answers to tick */
.question-template {
  padding: 12px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}
.question-template-label { margin-bottom: 4px; font-weight: 500; color: var(--gold-100); }
.question-template .field-hint { margin: 0; }
.question-scale-fields { display: grid; gap: 6px; }
.question-scale-fields[hidden] { display: none; }
.question-scale-fields .field { margin: 0; }
.check-list { display: grid; gap: 2px; }
.check-list .check-row { font-family: inherit; font-weight: 400; letter-spacing: 0; color: var(--text); overflow-wrap: anywhere; }
.check-row + .question-required-hint { margin-top: -12px; }

.admin-danger {
  padding: 18px;
  border: 1px solid rgba(255, 143, 136, 0.35);
  border-radius: var(--radius);
  background: rgba(255, 143, 136, 0.04);
}
.admin-teampage .admin-danger { margin-top: 48px; }
.admin-danger .admin-h2 { color: #FFD6D3; }

/* ---------------- Surveys ---------------- */
/* Draft, Open or Closed: the tag always says it in words */
.survey-tag { flex: none; }
.survey-tag--draft { border-color: var(--line-strong); background: rgba(217, 164, 110, 0.12); color: var(--gold-100); }
.survey-tag--open { border-color: rgba(var(--rgb-green), 0.6); background: rgba(var(--rgb-green), 0.16); color: #B9F2D6; }
.survey-tag--closed { border-color: var(--line); background: rgba(126, 135, 174, 0.14); color: var(--text-muted); }

.admin-surveypage[hidden] { display: none; }
.admin-surveypage .back-link { margin-bottom: 18px; }
.admin-surveypage-head {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-strong);
}
.admin-surveypage-title {
  margin: 0;
  min-width: 0;
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  color: var(--gold-100);
  overflow-wrap: anywhere;
}
.admin-surveypage-title:focus { outline: none; }
.admin-surveypage .admin-section { margin-top: 40px; }
.admin-surveypage .btn .icon { width: 16px; height: 16px; }
.admin-surveypage .admin-danger { margin-top: 48px; }

/* Where it stands, with Publish or Close now */
.admin-survey-state {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24, 34, 74, 0.5);
}
[data-status="open"] > .admin-survey-state { border-color: rgba(var(--rgb-green), 0.4); }
.admin-survey-state-text { flex: 1 1 320px; min-width: 0; }
.admin-survey-state .admin-summary { margin: 4px 0 0; max-width: 70ch; }
.admin-survey-state .btn { flex: none; }

/* Details: title, description and "When should the survey close?"; a closed survey's are greyed out */
.admin-survey-fields { display: grid; gap: 16px; min-width: 0; margin: 0; padding: 0; border: 0; }
.admin-survey-fields:disabled { opacity: 0.7; }
.admin-close { display: grid; gap: 12px; }
.admin-close > legend { margin-bottom: 8px; }
.admin-close .field-row { max-width: 420px; }
.admin-close select.input { max-width: 420px; }
.admin-close > .field-hint, .admin-close > .field-error { margin: 0; }

.admin-subhead {
  margin-bottom: 10px;
  font-family: var(--font-label); font-weight: 700;
  font-size: 0.95rem; letter-spacing: 0.08em;
  color: var(--gold-300);
}

/* Dropdown tallies: each answer's share as a thin bar from the left, the count beside it in plain text */
.survey-tallies { display: grid; gap: 16px; margin-bottom: 24px; }
.survey-tally {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--navy-800);
}
.survey-tally-q { margin-bottom: 8px; font-weight: 500; color: var(--gold-100); overflow-wrap: anywhere; }
.survey-tally-q .tag { margin-left: 4px; }
.survey-tally-list { display: grid; gap: 6px; }
.survey-tally-row {
  display: grid; grid-template-columns: minmax(8rem, 2fr) minmax(80px, 3fr) 6.5rem;
  align-items: center; gap: 4px 12px;
  font-size: 0.95rem;
}
.survey-tally-label { min-width: 0; color: var(--text); overflow-wrap: anywhere; }
.survey-tally-bar { height: 10px; border-radius: 0 var(--radius) var(--radius) 0; background: rgba(217, 164, 110, 0.1); overflow: hidden; }
.survey-tally-bar > span { display: block; height: 100%; border-radius: 0 var(--radius) var(--radius) 0; background: var(--gold); }
.survey-tally-row.is-stale .survey-tally-bar > span { background: var(--text-faint); }
.survey-tally-n { font-variant-numeric: tabular-nums; color: var(--text); text-align: right; white-space: nowrap; }
.survey-tally-average { margin-top: 8px; font-size: 0.92rem; color: var(--text-muted); }
.survey-tally-sub { margin: 14px 0 8px; font-family: var(--font-label); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.06em; color: var(--text-muted); }
.survey-tally-label .class-icon { vertical-align: -3px; }

/* Responses: who and when, opening onto their answers */
.admin-response-toggle {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center; gap: 4px 14px;
  width: 100%;
  min-height: 52px;
  padding: 8px 12px 8px 14px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s;
}
.admin-response-toggle:hover, .admin-response.is-open > .admin-response-toggle { background: rgba(217, 164, 110, 0.04); }
.admin-response-toggle:focus-visible { outline-offset: -2px; }
.admin-response-name {
  min-width: 0;
  font-family: var(--font-label); font-weight: 700;
  font-size: 1.02rem; letter-spacing: 0.04em;
  color: var(--gold-100);
  overflow-wrap: anywhere;
}
.admin-response-date { font-size: 0.92rem; color: var(--text-muted); text-align: right; }
.admin-response.is-open .admin-chevron { transform: rotate(180deg); }
.admin-response-panel { padding: 0 12px 12px 14px; }
.admin-response-panel[hidden] { display: none; }
.admin-response-panel .admin-answers { margin-top: 0; }
.admin-response-panel > .admin-empty { padding: 4px 0 6px; }

/* ---------------- Add-ons ---------------- */
.admin-addon-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0; }
.admin-addon .admin-row-line a { color: var(--gold-300); overflow-wrap: anywhere; }
#addon-tags-group .tiles { margin-top: 8px; }

/* ---------------- Options ---------------- */
/* The saved state in words ("Raids are hidden.") beside Save, which is what changes it */
.admin-options-actions {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.admin-options-state {
  font-family: var(--font-label); font-weight: 700; letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* ---------------- Schedule ---------------- */
.admin-zone {
  display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 32px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24, 34, 74, 0.5);
}
.admin-zone .admin-summary { margin: 4px 0 0; }
.admin-zone-label {
  font-family: var(--font-label); font-weight: 700;
  font-size: 0.78rem; letter-spacing: 0.14em;
  color: var(--text-muted);
}
.admin-zone-value { font-family: var(--font-display); font-size: 1.25rem; color: var(--gold-100); }
.admin-zone-value .admin-faint { font-family: var(--font-body); font-size: 0.9rem; }

.admin-raid-body { grid-template-columns: 10.5rem minmax(0, 1fr); align-items: baseline; column-gap: 16px; }
.admin-raid-time .tag { margin-left: 6px; vertical-align: 1px; }
.admin-raid.is-past .admin-raid-day, .admin-raid.is-past .admin-raid-time { color: var(--text-faint); }
.admin-raid-body > .admin-row-line { grid-column: 2; }
.admin-raid-day {
  font-family: var(--font-label); font-weight: 700;
  font-size: 1.05rem; letter-spacing: 0.06em;
  color: var(--gold-100);
}
.admin-raid-time { font-variant-numeric: tabular-nums; color: var(--text); }
.admin-raid-time .admin-faint { margin-left: 6px; font-size: 0.88rem; }
.admin-raid .team-chip { flex: none; }

/* ---------------- Heatmap ---------------- */
.admin-heat, .admin-advice { margin-top: 48px; }
.admin-h3 {
  margin: 28px 0 10px;
  font-family: var(--font-label); font-weight: 700;
  font-size: 1.02rem; letter-spacing: 0.08em;
  color: var(--gold-100);
}
.heat-filters { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 14px; }
.tiles--heat { display: flex; flex-wrap: wrap; gap: 6px; }
.tiles--heat .tile { min-height: 40px; padding: 6px 14px; }

.heat-wrap {
  overflow-x: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--navy-900);
}
.heat-table { width: 100%; min-width: 300px; border-collapse: separate; border-spacing: 3px; table-layout: fixed; }
.heat-table th {
  font-family: var(--font-label); font-weight: 700;
  font-size: 0.8rem; letter-spacing: 0.06em;
  color: var(--text-muted);
}
.heat-table thead th { padding-bottom: 4px; }
.heat-table thead th:first-child { width: 3.6rem; }
.heat-table abbr { text-decoration: none; }
.heat-table tbody th { padding-right: 6px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.heat-table tr.heat-gap > * { border-top: 1px dashed var(--line-strong); }
.heat-cell {
  padding: 0;
  border-radius: 2px;
  background-color: rgba(217, 164, 110, calc(0.04 + var(--heat, 0) * 0.82));
}
.heat-cell.is-raid { box-shadow: var(--raid-bars); }
.heat-btn {
  display: block;
  width: 100%; height: 26px;
  padding: 0;
  border: 0; border-radius: 2px;
  background: none;
  color: var(--text);
  font: 600 0.8rem/1 var(--font-body);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.heat-cell.is-hot .heat-btn { color: var(--gold-ink); }
.heat-btn:hover { outline: 1px solid var(--gold-300); outline-offset: -1px; }
.heat-btn[aria-pressed="true"] { outline: 2px solid var(--gold-100); outline-offset: -2px; }
.heat-btn:focus-visible { outline: 2px solid var(--violet-glow); outline-offset: -2px; }

.heat-legend {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 22px;
  margin-top: 10px;
  font-size: 0.85rem; color: var(--text-muted);
}
.heat-legend-item { display: inline-flex; align-items: center; gap: 8px; }
.heat-ramp { width: 120px; height: 10px; border-radius: 2px; background: linear-gradient(90deg, rgba(217, 164, 110, 0.06), rgba(217, 164, 110, 0.86)); }
.heat-key-raid { width: 14px; height: 14px; border-radius: 2px; background: rgba(217, 164, 110, 0.2); box-shadow: inset 3px 0 0 var(--gold-300); }

.heat-detail {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--navy-800);
}
.heat-detail-title { margin-bottom: 6px; font-family: var(--font-label); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.04em; color: var(--gold-100); }
.heat-detail > .admin-row-line { margin-bottom: 8px; }
.heat-people { display: grid; gap: 6px; margin-top: 8px; }
.heat-people li { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: 0.95rem; }
.heat-person { min-width: 8.5rem; color: var(--text); }
.heat-people .admin-faint { font-size: 0.88rem; }

/* ---------------- Analysis and suggestions ---------------- */
.admin-advice .admin-toolbar--head { justify-content: flex-start; }
.advice-points { display: grid; gap: 8px; }
.advice-points li { display: flex; align-items: baseline; gap: 10px; color: var(--text); }
.advice-points .gem { flex: none; translate: 0 -1px; }
.advice-note { margin-top: 10px; }
.advice-foot { margin-top: 28px; font-size: 0.88rem; color: var(--text-faint); }

/* Claude's take: a card under the built-in suggestions */
.advice-claude {
  margin-top: 20px;
  padding: 16px 18px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--navy-800);
}
.advice-claude-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; }
.advice-claude-head .admin-h3 { margin: 0; }
.advice-claude > .admin-summary { margin: 8px 0 0; }
.advice-claude .btn[aria-disabled="true"] { cursor: progress; opacity: 0.8; transform: none; }
.advice-claude-out { margin-top: 14px; }
.advice-claude-out:empty { display: none; }
.advice-claude-note {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--line-strong);
  background: rgba(11, 16, 40, 0.45);
  font-size: 0.95rem;
  color: var(--text-muted);
}
.advice-claude-note:last-child { margin-bottom: 0; }
.advice-claude-note--error { border-left-color: var(--danger); color: var(--text); }
.advice-claude-text { display: grid; gap: 10px; max-width: 72ch; color: var(--text); }
.advice-claude-text p { white-space: pre-line; }
.advice-claude-h4 {
  margin: 20px 0 8px;
  font-family: var(--font-label); font-weight: 700;
  font-size: 0.95rem; letter-spacing: 0.06em;
  color: var(--gold-100);
}
.advice-claude-foot { margin-top: 14px; font-size: 0.85rem; color: var(--text-faint); }
.advice-spinner {
  flex: none;
  width: 0.9em; height: 0.9em;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%;
  translate: 0 0.1em;
  animation: spin 0.8s linear infinite;
}
.btn .advice-spinner { translate: none; }

/* ---------------- Dialogs ---------------- */
.sheet--narrow { width: min(520px, calc(100vw - 32px)); }
.sheet-sub { margin-top: 10px; font-size: 0.95rem; color: var(--text-muted); }
.confirm-text { color: var(--text); }
.sheet--confirm .sheet-body { padding-top: 16px; }

.tiles--team { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles--team .team-gem { width: 10px; height: 10px; flex: none; }
.tiles--standing { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 420px; }
.tiles--day { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.tiles--day .tile { padding-inline: 4px; }

.pick-list {
  display: grid; gap: 6px;
  max-height: min(340px, 42dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 4px 2px 2px; /* room for the focus ring */
}
.pick-option { padding: 10px 12px 10px 15px; box-shadow: inset 2px 0 0 var(--class-color, transparent); }
.pick-option .option-main { flex-wrap: wrap; gap: 4px 10px; }
.pick-option .option-title { font-size: 1rem; }
.pick-option .role-slot { margin-left: auto; }
.pick-option--open .option-title { font-style: italic; }
.pick-option:has(:disabled) { opacity: 0.5; cursor: not-allowed; }
.pick-option:has(:disabled):hover { border-color: var(--line); color: inherit; }
/* A name with no member's character: its first and last name, under the list */
.spot-name { margin-top: 12px; }
.spot-name[hidden] { display: none; }

/* ---------------- Responsive ---------------- */
@media (max-width: 719px) {
  .admin-member-toggle { grid-template-columns: auto minmax(0, 1fr) auto; }
  .admin-member-meta { grid-column: 2; grid-row: 2; justify-content: flex-start; text-align: left; }
  .admin-chevron { grid-column: 3; grid-row: 1 / span 2; }
  .admin-member-panel { padding-left: 12px; }

  /* Rows become two columns: details (with the role or team under them), actions on the right */
  .admin-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px 10px; padding-left: 12px; }
  .admin-row-body { grid-column: 1; grid-row: 1; }
  .admin-row-role, .admin-raid .team-chip { grid-column: 1; grid-row: 2; justify-self: start; }
  .admin-row-actions { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .admin-spot { grid-template-columns: auto minmax(0, 1fr) auto; }
  .admin-spot-role { grid-column: 1; grid-row: 1 / span 2; align-self: center; width: auto; }
  .admin-spot .admin-row-body { grid-column: 2; }
  .admin-spot-standing { grid-column: 2; grid-row: 2; }
  .admin-spot .admin-row-actions { grid-column: 3; }
  .admin-raid-body { grid-template-columns: 1fr; }
  .admin-raid-body > .admin-row-line { grid-column: 1; }
  /* Suggestions put their wide buttons under the text */
  .admin-row--stack .admin-row-actions { grid-column: 1 / -1; grid-row: auto; justify-self: start; }
  .admin-row--stack .admin-row-role { grid-row: 2; }
  .heat-wrap { padding: 8px 6px; }
  .heat-table { border-spacing: 2px; }
  .heat-table thead th:first-child { width: 2.9rem; }
  .heat-table tbody th { padding-right: 3px; font-size: 0.72rem; }
  .heat-btn { height: 24px; font-size: 0.72rem; }
  .admin-teams-head { flex-wrap: wrap; }
  .admin-question { grid-template-columns: auto minmax(0, 1fr); }
  .admin-question .admin-row-body { grid-column: 2; }
  .admin-question .admin-row-actions { grid-column: 1 / -1; grid-row: 2; justify-self: end; }
  /* A response's date goes under the name; a tally's answer above its bar */
  .admin-response-toggle { grid-template-columns: minmax(0, 1fr) auto; }
  .admin-response-date { grid-column: 1; grid-row: 2; text-align: left; }
  .admin-response-toggle .admin-chevron { grid-column: 2; grid-row: 1 / span 2; }
  .survey-tally-row { grid-template-columns: minmax(0, 1fr) auto; }
  .survey-tally-label { grid-column: 1 / -1; }
  .admin-question--follow-up { margin-left: 24px; }
  .admin-question--follow-up::before { left: -16px; width: 10px; }
  .template-menu-panel { right: auto; left: 0; }
}
@media (max-width: 719px) {
  /* At full size the five tabs need about 660px, so below 720px they set tighter and fit with their counts */
  .admin-tabs { gap: 0; }
  .admin-tab { padding-inline: 7px; font-size: 0.88rem; letter-spacing: 0.02em; gap: 4px; }
}
@media (max-width: 519px) {
  /* The totals move out too (the waiting and open survey counts stay), so all five tabs fit down to a
     phone about 450px wide; narrower than that the strip scrolls */
  .admin-tab [data-count="members"], .admin-tab [data-count="raids"] { display: none; }
}
@media (max-width: 480px) {
  .tiles--team { grid-template-columns: 1fr; }
  .tiles--day { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tiles--color { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles--kind { grid-template-columns: 1fr; }
  .admin-toolbar .btn { flex: 1 1 auto; }
  .admin-select { flex: 1 1 100%; }
  .admin-select label { min-width: 3rem; }
  .admin-select .input { flex: 1; min-width: 0; }
  .admin-toolbar--head .btn { flex: none; }
}
