body {
  background: var(--surface-bg);
  color: var(--surface-text);
  min-height: 100vh;
  transition: background 0.15s ease, color 0.15s ease;
}

/* ---------- login gate ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 22rem;
  background: var(--surface-panel);
  border: 1px solid var(--surface-line);
  border-radius: 10px;
  padding: 2rem 1.75rem;
}

.login-card .on-air {
  margin-bottom: 1rem;
}

.login-card h1 {
  font-size: 1.15rem;
  margin: 0 0 1.4rem;
  font-weight: 600;
}

.login-card input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--surface-line);
  background: var(--surface-input);
  color: var(--surface-text);
  font-size: 0.95rem;
  margin-bottom: 0.9rem;
}

.login-card button {
  width: 100%;
  padding: 0.75rem;
  border-radius: 6px;
  border: none;
  background: var(--signal);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.login-card .login-label {
  display: block;
  font-size: 0.78rem;
  color: var(--surface-mist);
  margin: 0 0 0.35rem;
}

.login-card .err {
  color: var(--signal);
  font-size: 0.82rem;
  margin-top: 0.7rem;
  min-height: 1.1em;
}

.login-mode-toggle {
  display: block;
  width: 100%;
  margin-top: 1.1rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--surface-mist);
  font-size: 0.82rem;
  text-decoration: underline;
  cursor: pointer;
  text-align: center;
}

.login-mode-toggle:hover {
  color: var(--surface-text);
}

/* ---------- shell ---------- */
.shell {
  display: none;
  grid-template-columns: 17rem 1fr;
  min-height: 100vh;
}

.shell.active {
  display: grid;
}

/* Desktop: pinned to the viewport so the list scrolls inside it and the
   account footer stays put however many rooms there are. */
.sidebar {
  border-right: 1px solid var(--surface-line);
  padding: 1.25rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 0;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.brand .name {
  font-weight: 650;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.ui-theme-toggle {
  border: 1px solid var(--surface-line);
  background: var(--surface-panel);
  color: var(--surface-mist);
  border-radius: 999px;
  width: 1.9rem;
  height: 1.9rem;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  flex: none;
}

.room-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.room-list li button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--surface-mist);
  padding: 0.6rem 0.7rem;
  border-radius: 6px;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.room-list li button:hover {
  background: var(--surface-overlay);
}

.room-list li button.active {
  background: rgba(255, 93, 58, 0.12);
  color: var(--surface-text);
}

.room-list .code {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  opacity: 0.7;
}



.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Login screen only (fixed corner); once signed in, the sidebar-footer
   toggle takes over so nothing floats over the room header's buttons. */
.login-theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
}

body.signed-in .login-theme-toggle {
  display: none;
}

/* Desktop: not part of the layout at all (display:none also keeps them
   out of the .shell grid's columns). */
.mobile-bar,
.sidebar-backdrop {
  display: none;
}



.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--surface-line);
  border-radius: 8px;
  margin-top: 0.4rem;
  font-size: 0.85rem;
}

.admin-row .you-tag {
  color: var(--surface-mist);
  font-size: 0.75rem;
  margin-left: 0.4rem;
}

.new-room-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.new-room-form label {
  font-size: 0.78rem;
  color: var(--surface-mist);
  margin-top: 0.3rem;
}

.new-room-form input,
.new-room-form textarea {
  padding: 0.6rem 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--surface-line);
  background: var(--surface-input);
  color: var(--surface-text);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
}

.new-room-form .modal-submit {
  margin-top: 0.75rem;
  width: 100%;
  text-align: center;
  border-radius: 8px;
  padding: 0.75rem;
}

.new-room-form select {
  padding: 0.6rem 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--surface-line);
  background: var(--surface-input);
  color: var(--surface-text);
  font-size: 0.85rem;
}

/* ---------- theme toggle (shared: sidebar form + room header) ---------- */
.theme-toggle {
  display: flex;
  gap: 0.4rem;
}

.theme-toggle button {
  flex: 1;
  padding: 0.55rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--surface-line);
  background: var(--surface-input);
  color: var(--surface-mist);
  cursor: pointer;
  font-size: 0.82rem;
}

.theme-toggle button.active {
  background: rgba(255, 93, 58, 0.14);
  border-color: rgba(255, 93, 58, 0.4);
  color: var(--surface-text);
}

/* Top-level switch between the two fully separate sections (rooms vs
   polls) — deliberately bolder than .theme-toggle since this changes the
   entire sidebar/main content, not just one field. */
.section-toggle {
  display: flex;
  gap: 0.4rem;
  padding: 0.3rem;
  border-radius: 10px;
  background: var(--surface-overlay);
}

.section-toggle button {
  flex: 1;
  padding: 0.5rem;
  border-radius: 7px;
  border: none;
  background: none;
  color: var(--surface-mist);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.section-toggle button.active {
  background: var(--surface-panel);
  color: var(--signal);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Self-contained preview of a ROOM's own theme — intentionally NOT driven
   by the admin's personal UI theme (--surface-*), since its whole purpose
   is to show both possible room states regardless of how the admin has
   their own dashboard set up. Deliberately hardcoded, not tokens. */
.appearance-preview {
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.45;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.appearance-preview[data-theme="dark"] {
  background: var(--ink);
  color: #f3f2f8;
  border: 1px solid var(--ink-line);
}

.appearance-preview[data-theme="light"] {
  background: var(--paper);
  color: var(--paper-ink);
  border: 1px solid var(--paper-line);
}

/* ---------- room settings tab ---------- */
.settings-form,
.settings-block {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 28rem;
  margin-bottom: 2rem;
}

.settings-form label,
.settings-block label {
  font-size: 0.8rem;
  color: var(--surface-mist);
}

.settings-form input,
.settings-form textarea,
.settings-form select {
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--surface-line);
  background: var(--surface-input);
  color: var(--surface-text);
  font-size: 0.9rem;
  resize: vertical;
}

.settings-form button {
  align-self: flex-start;
}

.field-hint {
  font-size: 0.78rem;
  color: var(--surface-mist);
  margin: -0.2rem 0 0;
  line-height: 1.4;
}

.settings-block select {
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--surface-line);
  background: var(--surface-input);
  color: var(--surface-text);
  font-size: 0.85rem;
}

.danger-zone {
  max-width: 28rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid rgba(255, 93, 58, 0.35);
  border-radius: 10px;
  background: var(--signal-dim);
}

.danger-zone label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--signal);
}

.danger-zone p {
  font-size: 0.8rem;
  color: var(--surface-mist);
  line-height: 1.5;
  margin: 0.4rem 0 0.8rem;
}

.danger-zone-row {
  display: flex;
  gap: 0.6rem;
}

.danger-zone-row input {
  flex: 1;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 93, 58, 0.35);
  background: var(--surface-input);
  color: var(--surface-text);
  font-size: 0.85rem;
}

.danger-zone-row .pill-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.status-line {
  min-height: 1.2rem;
  font-size: 0.82rem;
  color: var(--surface-mist);
}

.status-line.error {
  color: var(--signal);
}

/* ---------- main ---------- */
.main {
  padding: 1.75rem 2.25rem 2.5rem;
  overflow-y: auto;
  max-height: 100vh;
}

.no-room {
  color: var(--surface-mist);
  padding-top: 4rem;
  text-align: center;
}

.room-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--surface-line);
  margin-bottom: 1.5rem;
}

.room-header h1 {
  font-size: 1.3rem;
  margin: 0 0 0.3rem;
  font-weight: 650;
}

.room-header .topic {
  color: var(--surface-mist);
  font-size: 0.9rem;
  margin: 0;
  max-width: 48ch;
  /* Full detail now lives in the Settings-tab textarea — the header is
     just a glance, so a long, detailed topic (which is the whole point of
     this field for AI moderation accuracy) doesn't take over the room
     header visually. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}

.room-header .meta {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  margin-top: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--surface-mist);
}

.header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
  flex: none;
}

.qr-box {
  background: #fff;
  padding: 0.5rem;
  border-radius: 8px;
  width: 108px;
  height: 108px;
}

.pill-btn {
  border: 1px solid var(--surface-line);
  background: var(--surface-panel);
  color: var(--surface-text);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
}

.pill-btn.danger {
  border-color: rgba(255, 93, 58, 0.4);
  color: var(--signal);
}

.pill-btn.on {
  background: var(--jade-dim);
  border-color: rgba(34, 179, 120, 0.4);
  color: var(--jade);
}

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  gap: 1.5rem;
  border-bottom: 1px solid var(--surface-line);
  margin-bottom: 1.25rem;
  /* 8 room tabs don't fit on mid-width screens — scroll sideways rather
     than breaking labels onto two lines */
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs button {
  flex: none;
  white-space: nowrap;
  background: none;
  border: none;
  color: var(--surface-mist);
  font-size: 0.88rem;
  padding: 0 0 0.75rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tabs button.active {
  color: var(--surface-text);
  border-bottom-color: var(--signal);
}

.tabs .count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--amber);
  margin-left: 0.3rem;
}

/* ---------- queue ---------- */
.queue {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.msg-card {
  background: var(--surface-panel);
  border: 1px solid var(--surface-line);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  scroll-margin: 1rem;
}

/* Only freshly-arrived cards animate — the queue re-renders on every
   event, and re-dropping every card each time is just visual noise. */
.msg-card.is-new {
  animation: drop 0.3s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.msg-card.focused {
  border-color: var(--signal);
  box-shadow: 0 0 0 1px var(--signal);
}

.msg-card.selected {
  background: var(--surface-overlay);
}

.msg-select {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.msg-select input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--signal);
}

.queue-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.queue-select-all {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--surface-mist);
  cursor: pointer;
}

.queue-select-all input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--signal);
}

.queue-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.queue-bulk .pill-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.queue-shortcuts {
  margin: 0 0 0.9rem;
  font-size: 0.72rem;
  color: var(--surface-mist);
}

.queue-shortcuts kbd {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--surface-line);
  border-bottom-width: 2px;
  border-radius: 4px;
}

/* Touch devices have no keyboard — hide the shortcut hint there. */
@media (hover: none) {
  .queue-shortcuts {
    display: none;
  }
}

@keyframes drop {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg-card .top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.msg-card .nickname {
  font-weight: 600;
  font-size: 0.85rem;
}

.msg-card time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--surface-mist);
}

.msg-card .content {
  font-size: 1.02rem;
  line-height: 1.55;
  margin: 0 0 0.7rem;
}

.msg-card .ai-line {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--surface-mist);
  margin-bottom: 0.8rem;
}

/* Not checked by the AI at all (messages.ai_unchecked) — deliberately the
   loudest thing on the card, in both themes. */
.ai-unchecked-tag {
  display: inline-block;
  margin-bottom: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  background: #ff1f3d;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 0 0 2px rgba(255, 31, 61, 0.25);
}

.msg-card.unchecked {
  border-color: #ff1f3d;
}

/* same levels as .ai-detail-badge (txtbScoreLevel in queue.js) */
.msg-card .ai-line .score.good {
  color: var(--jade);
}
.msg-card .ai-line .score.warn {
  color: var(--amber);
}
.msg-card .ai-line .score.bad {
  color: var(--signal);
}

.ai-detail-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.ai-detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.2rem 0.55rem 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.ai-detail-badge .dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  flex: none;
}

.ai-detail-badge.good {
  background: var(--jade-dim);
  color: var(--jade);
}

.ai-detail-badge.good .dot {
  background: var(--jade);
}

.ai-detail-badge.warn {
  background: var(--amber-dim);
  color: var(--amber);
}

.ai-detail-badge.warn .dot {
  background: var(--amber);
}

.ai-detail-badge.bad {
  background: var(--signal-dim);
  color: var(--signal);
}

.ai-detail-badge.bad .dot {
  background: var(--signal);
}

.msg-card .actions {
  display: flex;
  gap: 0.6rem;
}

.btn-approve,
.btn-reject {
  flex: 1;
  padding: 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.1s ease;
}

.btn-approve:active,
.btn-reject:active {
  transform: scale(0.97);
}

.btn-approve {
  background: var(--jade-dim);
  color: var(--jade);
  border-color: rgba(34, 179, 120, 0.35);
}

.btn-edit {
  flex: 0 0 auto;
  width: 2.6rem;
  border-radius: 6px;
  border: 1px solid var(--surface-line);
  background: var(--surface-overlay);
  color: var(--surface-mist);
  cursor: pointer;
  font-size: 0.95rem;
}

.btn-edit:hover {
  color: var(--surface-text);
  border-color: var(--surface-mist);
}

.msg-edit {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.msg-edit-input {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--signal);
  background: var(--surface-input);
  color: var(--surface-text);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  resize: vertical;
}

.msg-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.msg-edited-note {
  font-size: 0.75rem;
  color: var(--amber);
  margin: -0.4rem 0 0.7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-reject {
  flex: 0 0 auto;
  min-width: 6.5rem;
  background: var(--surface-overlay);
  color: var(--surface-mist);
  border-color: var(--surface-line);
}

.approved-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--surface-line);
  font-size: 0.9rem;
}

.approved-row .nickname {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--surface-mist);
}

.approved-row .pill-btn {
  flex: none;
}

.approved-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
  flex: none;
}

.approved-row.pinned {
  background: var(--signal-dim);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  border-bottom-color: transparent;
}

.pin-tag {
  color: var(--signal);
}

.approved-hint {
  margin: 0 0 0.6rem;
}

.empty-queue {
  color: var(--surface-mist);
  text-align: center;
  padding: 3rem 1rem;
  font-size: 0.9rem;
}

/* ---------- team ---------- */
.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.8rem;
}

.mod-card {
  background: var(--surface-panel);
  border: 1px solid var(--surface-line);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.mod-name {
  font-size: 0.8rem;
  color: var(--surface-mist);
  margin-bottom: 0.5rem;
}

.mod-code {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  letter-spacing: 0.12em;
  font-weight: 600;
}

.mod-reset-btn {
  margin-top: 0.6rem;
  border: 1px solid var(--surface-line);
  background: none;
  color: var(--surface-mist);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.72rem;
  cursor: pointer;
}

.mod-reset-btn:hover {
  color: var(--signal);
  border-color: var(--signal);
}

/* ---------- audit log ---------- */
.audit-list {
  display: flex;
  flex-direction: column;
}

.audit-row {
  display: grid;
  grid-template-columns: 8.5rem 8rem 7rem 1fr;
  gap: 0.8rem;
  align-items: baseline;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--surface-line);
  font-size: 0.85rem;
}

.audit-row time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--surface-mist);
}

.audit-actor {
  font-weight: 600;
}

.audit-action {
  font-size: 0.78rem;
  font-weight: 600;
}

.audit-action-approve {
  color: var(--jade);
}

.audit-action-unapprove,
.audit-action-reject {
  color: var(--signal);
}

.audit-action-room_open,
.audit-action-room_close {
  color: var(--amber);
}

.audit-detail {
  color: var(--surface-mist);
  overflow-wrap: anywhere; /* full text: AI reasons / edits must be readable */
}

.audit-row.with-room {
  grid-template-columns: 8.5rem 9rem 6rem 7rem 1fr;
}

.audit-room {
  font-size: 0.78rem;
  color: var(--surface-mist);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-action-ai_reject {
  color: #ff1f3d;
}

.audit-row.audit-ai .audit-actor {
  color: #ff1f3d;
}

/* ---------- summary ---------- */
.summary-box {
  background: var(--surface-panel);
  border: 1px solid var(--surface-line);
  border-radius: 8px;
  padding: 1.5rem;
}

.summary-box p {
  line-height: 1.7;
  font-size: 0.98rem;
}

.theme-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.theme-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--surface-overlay);
  border: 1px solid var(--surface-line);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
}

/* ---------- modals ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 18, 0.6);
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 200;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 26rem;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface-panel);
  border: 1px solid var(--surface-line);
  border-radius: 14px;
  padding: 1.5rem;
  animation: modal-in 0.18s ease both;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}

.modal-head h2 {
  font-size: 1.05rem;
  margin: 0;
  font-weight: 650;
}

.modal-close {
  border: none;
  background: none;
  color: var(--surface-mist);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}

.modal-close:hover {
  color: var(--surface-text);
}

/* ---------- room info (QR + links) ----------
   Shared between the create-room success modal and the always-visible
   panel at the top of a room's dashboard — same renderRoomInfoBlock() call
   either way, so the two can never show different data. Row layout (QR
   beside the links) on wide viewports, stacks on narrow ones (including
   inside the modal, which is deliberately narrow). */
.room-info-block {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 1rem 0 1.5rem;
  border-bottom: 1px solid var(--surface-line);
  margin-bottom: 1.5rem;
}

.room-info-qr {
  flex: none;
  line-height: 0;
  background: #fff;
  padding: 0.6rem;
  border-radius: 12px;
}

.room-info-links {
  flex: 1;
  min-width: 16rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* the modal is narrow enough that QR + links always stack — center the
   QR on its own row instead of leaving it flush left */
.modal-card .room-info-block {
  justify-content: center;
  border-bottom: none;
  padding-bottom: 0;
}

.created-link-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--surface-line);
  border-radius: 8px;
  background: var(--surface-input);
}

.created-link-row .label {
  flex: none;
  font-size: 0.72rem;
  color: var(--surface-mist);
  width: 5.5rem;
}

.created-link-row .value {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--surface-text);
  text-decoration: none;
}

.created-link-row .value:hover {
  color: var(--signal);
  text-decoration: underline;
}

.created-link-row button {
  flex: none;
  border: 1px solid var(--surface-line);
  background: none;
  color: var(--surface-mist);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  cursor: pointer;
}

.created-link-row .link-open-btn {
  flex: none;
  border: 1px solid var(--surface-line);
  color: var(--surface-mist);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  text-decoration: none;
  white-space: nowrap;
}

.created-link-row .link-open-btn:hover,
.created-link-row button:hover {
  color: var(--surface-text);
  border-color: var(--signal);
}

.created-code {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.6rem;
  letter-spacing: 0.15em;
  font-weight: 600;
  margin: 0.25rem 0 1rem;
}

/* ---------- QR customizer (settings tab) ---------- */
.qr-customizer {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.qr-preview-box {
  flex: none;
  background: #fff;
  padding: 0.6rem;
  border-radius: 12px;
}

.qr-controls {
  flex: 1;
  min-width: 14rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.provider-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

.provider-card {
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--surface-line);
  background: var(--surface-input);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.provider-card.active {
  border-color: var(--signal);
  background: rgba(255, 93, 58, 0.12);
}

.provider-name {
  font-weight: 650;
  font-size: 0.9rem;
  color: var(--surface-text);
}

.provider-desc {
  font-size: 0.76rem;
  color: var(--surface-mist);
  line-height: 1.4;
}

.qr-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.qr-preset-btn {
  padding: 0.5rem 0.4rem;
  border-radius: 8px;
  border: 1px solid var(--surface-line);
  background: var(--surface-input);
  color: var(--surface-mist);
  font-size: 0.75rem;
  cursor: pointer;
}

.qr-preset-btn.active {
  border-color: var(--signal);
  color: var(--surface-text);
  background: rgba(255, 93, 58, 0.12);
}

.qr-logo-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.qr-logo-row label.upload-btn {
  border: 1px dashed var(--surface-line);
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  font-size: 0.8rem;
  color: var(--surface-mist);
  cursor: pointer;
}

.qr-logo-row label.upload-btn:hover {
  color: var(--surface-text);
  border-color: var(--signal);
}

/* ---------- broadcast displays tab ---------- */
.broadcast-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-width: 42rem;
}

.broadcast-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--surface-line);
  border-radius: 10px;
  background: var(--surface-panel);
  flex-wrap: wrap;
}

.broadcast-card-main {
  min-width: 0;
}

.broadcast-card-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.broadcast-card-layout {
  font-size: 0.78rem;
  color: var(--surface-mist);
  margin: 0.15rem 0 0.3rem;
}

.broadcast-card-link {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--signal);
  text-decoration: none;
  word-break: break-all;
}

.broadcast-card-actions {
  flex: none;
  display: flex;
  gap: 0.5rem;
}

/* ---------- polls ---------- */

.poll-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.85rem;
  color: var(--surface-text);
  cursor: pointer;
}

.poll-toggle-row input {
  width: auto;
  accent-color: var(--signal);
}

.poll-option-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.poll-option-row input {
  flex: 1;
}

.poll-option-row button {
  flex: none;
  align-self: stretch;
  margin: 0;
  border: 1px solid var(--surface-line);
  background: none;
  color: var(--surface-mist);
  border-radius: 6px;
  padding: 0 0.7rem;
  cursor: pointer;
}

.poll-option-row button:hover:not(:disabled) {
  color: var(--signal);
  border-color: var(--signal);
}

.poll-option-row button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---------- multi poll: questions editor (pollQuestionsEditor in admin.js) ---------- */
.pq-editor,
.pq-title,
.pq-list,
.pq-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.pq-title[hidden] {
  display: none;
}

.pq-list {
  gap: 0.9rem;
}

.pq-card {
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--surface-line);
  border-radius: 10px;
}

/* one question: no card around it — looks like the old single-question form */
.pq-list > .pq-card:only-child {
  padding: 0;
  border: none;
}

.pq-card-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pq-num {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--surface-mist);
}

.pq-tools {
  margin-left: auto;
  display: flex;
  gap: 0.3rem;
}

.pq-tools button {
  border: 1px solid var(--surface-line);
  background: none;
  color: var(--surface-mist);
  border-radius: 6px;
  padding: 0.15rem 0.55rem;
  cursor: pointer;
}

.pq-tools button[hidden] {
  display: none;
}

.pq-tools button:hover:not(:disabled) {
  color: var(--signal);
  border-color: var(--signal);
}

.pq-tools button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pq-editor > .pill-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.poll-live-stamp {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 1rem;
}

.live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--jade);
  animation: live-blink 1.6s ease-in-out infinite;
}

@keyframes live-blink {
  50% {
    opacity: 0.3;
  }
}

.poll-option-votes {
  flex: none;
  align-self: center;
  min-width: 4.5rem;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--surface-mist);
}

.poll-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-width: 46rem;
}

.poll-card {
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--surface-line);
  border-radius: 10px;
  background: var(--surface-panel);
}

.poll-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.poll-card-question {
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0 0 0.3rem;
}

.poll-card-meta {
  font-size: 0.78rem;
  color: var(--surface-mist);
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.poll-status-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}

.poll-status-badge.open {
  background: var(--jade-dim);
  color: var(--jade);
}

.poll-status-badge.closed {
  background: var(--surface-overlay);
  color: var(--surface-mist);
}

.poll-card-actions {
  flex: none;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.poll-bar-row {
  margin-bottom: 0.7rem;
}

.poll-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
  gap: 0.5rem;
}

.poll-bar-label .pct {
  font-family: var(--font-mono);
  color: var(--surface-mist);
  flex: none;
}

.poll-bar-track {
  height: 0.6rem;
  border-radius: 999px;
  background: var(--surface-overlay);
  overflow: hidden;
}

.poll-bar-fill {
  height: 100%;
  background: var(--signal);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.poll-log-list {
  max-height: 14rem;
  overflow-y: auto;
  border-top: 1px solid var(--surface-line);
  margin-top: 1rem;
  padding-top: 0.75rem;
}

.poll-log-row {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.8rem;
  padding: 0.35rem 0;
  color: var(--surface-mist);
}

.poll-log-row .who {
  color: var(--surface-text);
}

/* a reset (or other poll action) between the votes */
.poll-log-row.poll-log-event {
  margin: 0.3rem 0;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: var(--signal-dim);
}

.poll-log-row.poll-log-event .who {
  color: var(--signal);
  font-weight: 600;
}

/* ---------- stage panel (poll-host.js — admin + /poll-mod) ----------
   What the big screen shows now + one big button for the next step, and a
   live preview of the real screen (a scaled iframe of /poll-display). */
.poll-stage {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  margin: 0 0 1.25rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--surface-line);
  border-left: 4px solid var(--stage-accent, var(--surface-line));
  border-radius: 12px;
  background: var(--surface-panel);
}

.poll-stage[data-kind="waiting"] {
  --stage-accent: var(--amber);
  background: var(--amber-dim);
}

.poll-stage[data-kind="live"] {
  --stage-accent: var(--signal);
}

.poll-stage[data-kind="result"],
.poll-stage[data-kind="ended"] {
  --stage-accent: var(--jade);
}

.stage-controls {
  flex: 1 1 20rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stage-now {
  margin: 0;
  font-size: 0.85rem;
  color: var(--surface-mist);
}

.stage-now b {
  color: var(--surface-text);
  font-size: 1rem;
}

.stage-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--surface-mist);
}

.stage-primary-row {
  margin-top: 0.6rem;
}

.stage-primary {
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.7rem;
  background: #178a5c; /* darker than --jade so white text reads */
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(34, 179, 120, 0.3);
}

.stage-primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.stage-primary:disabled,
.stage-secondary .pill-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.stage-done {
  display: inline-block;
  padding: 0.6rem 0;
  font-weight: 650;
  color: var(--jade);
}

.stage-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.stage-preview {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  font-size: 0.78rem;
}

.stage-preview a {
  color: var(--surface-mist);
}

/* the 1280×720 big screen at a quarter size */
.stage-frame {
  width: 320px;
  height: 180px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--surface-line);
  background: #000;
}

.stage-frame iframe {
  width: 1280px;
  height: 720px;
  border: 0;
  transform: scale(0.25);
  transform-origin: 0 0;
  pointer-events: none;
}

/* overview card of a waiting poll */
.ov-start-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--surface-line);
  font-size: 0.8rem;
  color: var(--amber);
}

/* ---------- multi poll: running it (poll-host.js — admin + /poll-mod) ---------- */
.poll-host {
  max-width: 42rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--surface-line);
  border-radius: 12px;
  background: var(--surface-panel);
}

.poll-host-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.poll-host-step {
  font-size: 0.8rem;
  color: var(--surface-mist);
}

.poll-host-state,
.poll-host-tag {
  font-size: 0.72rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--surface-line);
  color: var(--surface-mist);
  white-space: nowrap;
}

.poll-host-state.on,
.poll-host-tag.on {
  border-color: rgba(34, 179, 120, 0.4);
  color: var(--jade);
}

.poll-host-question {
  margin: 0.6rem 0 0.9rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
}

.poll-host-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.poll-host-actions .pill-btn:disabled,
.poll-host-item .pill-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.poll-host-list {
  max-width: 42rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.poll-host-item {
  padding: 0.9rem 1rem 0.4rem;
  border: 1px solid var(--surface-line);
  border-radius: 12px;
}

.poll-host-item.current {
  border-color: rgba(34, 179, 120, 0.5);
}

.poll-host-item-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.7rem;
}

.poll-host-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--surface-mist);
}

.poll-host-item-q {
  flex: 1;
  min-width: 10rem;
  font-weight: 600;
  font-size: 0.92rem;
}

/* ---------- phone / narrow tablet ---------- */
/* Sidebar becomes a slide-in drawer (opened from .mobile-bar) so the main
   panel gets the full width; header stacks; tab strip scrolls sideways. */
@media (max-width: 820px) {
  .shell.active {
    display: block;
  }

  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 0.6rem 1rem;
    background: var(--surface-bg);
    border-bottom: 1px solid var(--surface-line);
  }

  .mobile-menu-btn {
    flex: none;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 8px;
    border: 1px solid var(--surface-line);
    background: var(--surface-panel);
    color: var(--surface-text);
    font-size: 1.1rem;
    cursor: pointer;
  }

  .mobile-bar-title {
    font-weight: 600;
    font-size: 0.92rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    width: min(19rem, 86vw);
    background: var(--surface-bg);
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }

  .shell.sidebar-open .sidebar {
    transform: none;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.4);
  }

  .shell.sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, 0.5);
  }

  .main {
    padding: 1rem 1rem 2.5rem;
    max-height: none;
    overflow: visible;
  }

  .room-header {
    flex-direction: column;
    gap: 0.9rem;
  }

  .room-header h1 {
    font-size: 1.15rem;
  }

  .room-header .meta {
    flex-wrap: wrap;
    gap: 0.4rem 0.9rem;
  }

  .header-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .tabs {
    gap: 1.2rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tabs button {
    flex: none;
    white-space: nowrap;
  }

  .msg-card {
    padding: 0.9rem;
  }

  .btn-approve,
  .btn-reject {
    padding: 0.75rem; /* bigger touch target */
  }

  .queue-toolbar {
    align-items: flex-start;
  }
}

.header-actions-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.room-info-block.links-only .room-info-links {
  max-width: 44rem;
}

@media (max-width: 820px) {
  .approved-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .approved-actions {
    justify-content: flex-start;
  }
}

.export-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.poll-team-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.poll-team-row .mod-reset-btn {
  margin-top: 0;
}

/* ---------- admin overview (no room selected) ---------- */



.ov-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.ov-rooms {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 1rem;
}

.ov-room {
  background: var(--surface-panel);
  border: 1px solid var(--surface-line);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}

.ov-room-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
}

.ov-room-title {
  border: none;
  background: none;
  padding: 0;
  color: var(--surface-text);
  font-weight: 650;
  font-size: 0.98rem;
  text-align: left;
  cursor: pointer;
}

.ov-room-title:hover {
  color: var(--signal);
  text-decoration: underline;
}

.ov-status {
  flex: none;
  font-size: 0.72rem;
  color: var(--surface-mist);
}

.ov-status.open {
  color: var(--jade);
}

.ov-code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--surface-mist);
  margin: 0.2rem 0 0.8rem;
}

.ov-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.ov-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 4.2rem;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  background: var(--surface-overlay);
}

.ov-stat b {
  font-family: var(--font-mono);
  font-size: 1.15rem;
}

.ov-stat span {
  font-size: 0.68rem;
  color: var(--surface-mist);
}

.ov-stat.attn b {
  color: var(--amber);
}

.ov-stat.danger {
  background: #ff1f3d;
}

.ov-stat.danger b,
.ov-stat.danger span {
  color: #fff;
}

.ov-staff-head {
  font-size: 0.75rem;
  color: var(--surface-mist);
  margin-bottom: 0.4rem;
}

.ov-staff-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ov-staff {
  display: grid;
  grid-template-columns: 0.6rem minmax(0, 1fr) auto;
  grid-template-areas: "dot name code" ". last last";
  column-gap: 0.5rem;
  align-items: center;
  font-size: 0.82rem;
}

.ov-dot {
  grid-area: dot;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--surface-line);
}

.ov-staff.online .ov-dot {
  background: var(--jade);
  box-shadow: 0 0 0 3px var(--jade-dim);
}

.ov-staff-name {
  grid-area: name;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ov-staff-code {
  grid-area: code;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--surface-mist);
}

.ov-staff-last {
  grid-area: last;
  font-size: 0.68rem;
  color: var(--surface-mist);
}

.ov-activity h2 {
  font-size: 0.95rem;
  margin: 0 0 0.6rem;
}

.ov-activity .audit-list {
  max-height: 75vh;
  overflow-y: auto;
}

/* narrow column: time · room · who · what on one line, detail below */
.ov-activity .audit-row.with-room {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.6rem;
}

.ov-activity .audit-row.with-room .audit-room {
  max-width: 11rem;
}

.ov-activity .audit-row.with-room .audit-detail {
  flex-basis: 100%;
  font-size: 0.8rem;
}

@media (max-width: 1100px) {
  .ov-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .audit-row,
  .audit-row.with-room {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

/* event header editor */
.header-preview {
  margin: 0.6rem 0;
  border: 1px dashed var(--surface-line);
  border-radius: 10px;
  padding: 0.6rem;
  display: flex;
  justify-content: center;
  background: var(--surface-overlay);
}

.header-preview.empty {
  color: var(--surface-mist);
  font-size: 0.8rem;
  padding: 1.2rem;
}

.header-preview.mode-banner img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 6px;
}

.header-preview.mode-logo img {
  max-height: 72px;
  max-width: 280px;
  object-fit: contain;
}

/* poll overview cards */
.ov-poll-bars {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}

.ov-poll-label {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  margin-bottom: 0.2rem;
}

.ov-poll-label span:last-child {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--surface-mist);
}

.ov-poll-track {
  height: 0.45rem;
  border-radius: 999px;
  background: var(--surface-overlay);
  overflow: hidden;
}

.ov-poll-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--signal);
  opacity: 0.45;
}

.ov-poll-row.leader .ov-poll-track i {
  opacity: 1;
}

.ov-poll-row.leader .ov-poll-label span:first-child {
  font-weight: 650;
}

/* ---------- accounts page (own password + manage admins) ---------- */

.acc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
  gap: 1.5rem;
  align-items: start;
}

.acc-layout.single {
  grid-template-columns: minmax(0, 26rem);
}

.acc-main,
.acc-side {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.acc-main[hidden],
.acc-card[hidden] {
  display: none;
}

.acc-card {
  background: var(--surface-panel);
  border: 1px solid var(--surface-line);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
}

.acc-card h2 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.acc-count {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--surface-mist);
}

.acc-badge {
  font-size: 0.75rem;
  background: var(--amber);
  color: #111;
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
}

.acc-pending {
  border-color: var(--amber);
}

.acc-note {
  margin-top: 0.8rem;
  line-height: 1.6;
}

.acc-table-wrap {
  overflow-x: auto;
}

.acc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.acc-table th {
  text-align: left;
  font-weight: 500;
  font-size: 0.74rem;
  color: var(--surface-mist);
  padding: 0 0.6rem 0.5rem;
  border-bottom: 1px solid var(--surface-line);
  white-space: nowrap;
}

.acc-table td {
  padding: 0.6rem;
  border-bottom: 1px solid var(--surface-line);
  vertical-align: middle;
}

.acc-table .num {
  text-align: right;
  font-family: var(--font-mono);
}

.acc-table tr.is-me td {
  background: var(--surface-overlay);
}

.acc-name {
  font-weight: 600;
  word-break: break-word;
}

.acc-name .you-tag {
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--surface-mist);
  margin-left: 0.3rem;
}

.acc-date {
  color: var(--surface-mist);
  white-space: nowrap;
}

.acc-role {
  font-size: 0.8rem;
}

.acc-role.super {
  color: var(--signal);
}

.acc-role-select {
  font-size: 0.8rem;
  padding: 0.3rem 0.4rem;
}

.acc-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.acc-actions .pill-btn {
  margin-top: 0;
  white-space: nowrap;
}

.acc-reset-row td {
  background: var(--surface-overlay);
}

.acc-reset-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.acc-reset-form input {
  flex: 1 1 12rem;
  min-width: 0;
}

.acc-reset-form .pill-btn {
  margin-top: 0;
}

.acc-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 10rem) auto;
  gap: 0.6rem;
  align-items: end;
}

.acc-add-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--surface-mist);
}

.acc-add-form .pill-btn {
  margin-top: 0;
}

@media (max-width: 1100px) {
  .acc-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 700px) {
  .acc-add-form {
    grid-template-columns: minmax(0, 1fr);
  }
  .acc-table th:nth-child(5),
  .acc-table td:nth-child(5) {
    display: none;
  }
}

/* ---------- sidebar structure: section → overview → list → me ---------- */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--surface-mist);
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--surface-overlay);
  color: var(--surface-text);
}

/* same "you are here" look as a selected room — one active style in the sidebar */
.nav-item.active {
  background: rgba(255, 93, 58, 0.12);
  color: var(--surface-text);
}

.nav-ico {
  width: 0.9rem;
  text-align: center;
  opacity: 0.8;
}

.list-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
  min-height: 0;
  border-top: 1px solid var(--surface-line);
  padding-top: 0.9rem;
}

.list-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.2rem 0 0.7rem;
}

.list-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--surface-mist);
}

.list-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--surface-mist);
  opacity: 0.7;
}

.list-add {
  margin-left: auto;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--signal);
  background: none;
  color: var(--signal);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.list-add:hover {
  background: var(--signal);
  color: #fff;
}

.list-filter {
  font-size: 0.82rem;
  padding: 0.45rem 0.6rem;
}

.list-filter[hidden] {
  display: none;
}

.list-empty {
  color: var(--surface-mist);
  font-size: 0.82rem;
  padding: 0.5rem 0.7rem;
}

.room-list .item-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* multi poll: "3 คำถาม" */
.room-list .item-badge {
  flex: none;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--surface-line);
  color: var(--surface-mist);
  font-size: 0.7rem;
  white-space: nowrap;
}

.status-dot {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  border: 1.5px solid var(--surface-mist);
  opacity: 0.6;
}

.status-dot.open {
  background: var(--jade);
  border-color: var(--jade);
  opacity: 1;
}

.sidebar-foot {
  border-top: 1px solid var(--surface-line);
  padding-top: 0.75rem;
}

.me-item {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.55rem;
}

.me-avatar {
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-overlay);
  border: 1px solid var(--surface-line);
  color: var(--surface-text);
  font-weight: 650;
  font-size: 0.85rem;
}

.me-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.me-text b {
  color: var(--surface-text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-text small {
  font-size: 0.7rem;
  color: var(--surface-mist);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-badge {
  margin-left: auto;
  flex: none;
  min-width: 1.3rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--amber);
  color: #111;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.me-badge[hidden] {
  display: none;
}

.logout-btn {
  flex: none;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--surface-line);
  background: none;
  color: var(--surface-mist);
  font-size: 0.78rem;
  cursor: pointer;
}

.logout-btn:hover {
  color: var(--surface-text);
  border-color: var(--surface-mist);
}

/* ---------- login card: invite / forgot / reset modes ---------- */
.login-card .login-sub {
  margin: -0.8rem 0 1.2rem;
  line-height: 1.6;
}

.login-card .login-mode-toggle {
  background: none;
  color: var(--surface-mist);
  font-weight: 400;
  padding: 0;
}

.login-card .section-toggle {
  margin-bottom: 0.9rem;
}

.login-card .section-toggle button {
  width: auto;
  background: none;
  color: var(--surface-mist);
  padding: 0.5rem;
}

.login-card .section-toggle button.active {
  background: var(--surface-panel);
  color: var(--signal);
}

.login-card .err.ok {
  color: var(--jade);
}

/* ---------- sidebar: organization switcher ---------- */
.org-block {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.org-switch {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--surface-line);
  background: var(--surface-panel);
  color: var(--surface-text);
  font-size: 0.86rem;
  font-weight: 600;
  text-overflow: ellipsis;
}

/* one org: reads as a label, not a dropdown that does nothing */
.org-block.single .org-switch {
  appearance: none;
  -webkit-appearance: none;
  border-color: transparent;
  background: none;
  padding-left: 0.2rem;
  opacity: 1;
  cursor: default;
}

.org-gear {
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 1px solid var(--surface-line);
  background: none;
  color: var(--surface-mist);
  cursor: pointer;
}

.org-gear:hover,
.org-gear.active {
  color: var(--surface-text);
  border-color: var(--signal);
}

/* ---------- settings: organization tab ---------- */
.org-usage {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.9rem;
}

.org-usage-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  background: var(--surface-overlay);
}

.org-usage-row b {
  font-family: var(--font-mono);
}

.org-usage-row.full b {
  color: var(--amber);
}

.org-sub {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--surface-mist);
  margin: 1rem 0 0.5rem;
}

.org-name-static {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 0 0 0.4rem;
}

.org-suspended {
  color: var(--amber);
}

.org-max {
  color: var(--surface-mist);
}

.org-limits-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--surface-mist);
}

.org-invite-row {
  flex-wrap: wrap;
}

.org-invite-url {
  flex: 1 1 14rem;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.35rem 0.5rem;
}

.org-created {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.8rem;
  font-size: 0.84rem;
}

.acc-email {
  font-weight: 400;
  font-size: 0.74rem;
  color: var(--surface-mist);
}

.login-card .login-mode-toggle:hover {
  color: var(--surface-text);
}

/* ---------- platform console ---------- */
.platform-item[hidden] {
  display: none;
}

.pf-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.pf-stats .ov-stat {
  min-width: 0;
  padding: 0.8rem 0.6rem;
  text-align: center;
}

.pf-stats .ov-stat b {
  font-size: 1.4rem;
}

.pf-inline-btn {
  margin: 0 0 0 auto;
  font-size: 0.75rem;
}

.pf-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.pf-filters select,
.pf-filters input {
  font-size: 0.84rem;
  padding: 0.45rem 0.6rem;
  min-width: 0;
}

.pf-filters input[type="search"] {
  flex: 1 1 14rem;
}

.pf-filters .pill-btn {
  margin-top: 0;
}

.pf-log {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--surface-line);
  border-radius: 8px;
  overflow: hidden;
}

.pf-log-row {
  display: grid;
  grid-template-columns: 8.5rem 3rem minmax(0, 8rem) minmax(0, 8rem) minmax(0, 1fr);
  gap: 0.2rem 0.7rem;
  align-items: baseline;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--surface-line);
}

.pf-log-row:last-child {
  border-bottom: none;
}

.pf-log-row time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--surface-mist);
}

.pf-src {
  font-size: 0.68rem;
  font-weight: 600;
  text-align: center;
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
  background: var(--surface-overlay);
}

.src-platform .pf-src {
  color: var(--signal);
}

.src-ai .pf-src {
  color: var(--amber);
}

.pf-org,
.pf-actor,
.pf-target {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pf-org {
  color: var(--surface-mist);
}

.pf-actor {
  font-weight: 600;
}

.pf-target {
  grid-column: 5;
  color: var(--surface-mist);
}

.pf-action {
  grid-column: 5;
  grid-row: 1;
}

.pf-log-row.failed {
  background: rgba(255, 31, 61, 0.07);
}

.pf-failed {
  color: #ff1f3d;
  font-size: 0.72rem;
}

.pf-detail,
.pf-ip {
  grid-column: 2 / -1;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--surface-mist);
  word-break: break-all;
}

.pf-more {
  margin: 0.9rem auto 0;
  display: block;
}

.pf-more[hidden] {
  display: none;
}

.pf-kind {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  background: var(--surface-overlay);
}

.pf-kind.poll {
  color: var(--amber);
}

.pf-user-filter {
  margin-bottom: 0.6rem;
  width: 100%;
}

@media (max-width: 700px) {
  .pf-log-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .pf-log-row > * {
    grid-column: auto;
    grid-row: auto;
  }
  .pf-detail,
  .pf-ip {
    grid-column: 1 / -1;
  }
}

/* ---------- form controls inside cards / filter bars ----------
   Inline forms (invite role, add member, log filters, inline edit rows)
   were falling back to the browser's white controls. */
.acc-card select,
.acc-card input:not([type="checkbox"]):not([type="radio"]),
.acc-reset-form select,
.acc-reset-form input,
.pf-filters select,
.pf-filters input,
.acc-role-select,
.list-filter {
  background: var(--surface-input);
  color: var(--surface-text);
  border: 1px solid var(--surface-line);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-size: 0.84rem;
}

.acc-card select:focus,
.acc-card input:focus,
.pf-filters select:focus,
.pf-filters input:focus {
  outline: none;
  border-color: var(--signal);
}

.acc-card .field-hint + .field-hint,
#org-invites {
  margin-top: 0.6rem;
}

.org-caption {
  margin-bottom: -0.55rem;
  padding-left: 0.2rem;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--surface-mist);
}

/* sign-up forms: accept the terms of use */
.login-card .terms-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--surface-mist);
  margin: -0.2rem 0 0.9rem;
  cursor: pointer;
}

.login-card .terms-check[hidden] {
  display: none;
}

.login-card .terms-check input {
  width: auto;
  margin: 0.15rem 0 0;
  padding: 0;
  flex: none;
  accent-color: var(--signal);
}

.login-card .terms-check a {
  color: var(--surface-text);
}

/* consent notice box in room settings (not inside a .settings-form) */
.settings-block textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--surface-line);
  background: var(--surface-input);
  color: var(--surface-text);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.55;
  resize: vertical;
}

.settings-block textarea::placeholder {
  color: var(--surface-mist);
  opacity: 0.75;
}

/* poll overview card: who from the team is on this poll right now */
.ov-poll-staff {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--surface-mist);
  margin-top: 0.8rem;
}

.ov-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  border: 1.5px solid var(--surface-mist);
  opacity: 0.6;
  flex: none;
}

.ov-dot.on {
  background: var(--jade);
  border-color: var(--jade);
  opacity: 1;
}

/* ---------- org brand defaults + usage ---------- */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.6rem;
}

.brand-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--surface-mist);
}

.brand-images {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1.1rem;
}

.brand-images > div > label {
  display: block;
  font-size: 0.78rem;
  color: var(--surface-mist);
  margin-bottom: 0.4rem;
}

.brand-logo-preview {
  width: 7rem;
  height: 7rem;
  border: 1px dashed var(--surface-line);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  color: var(--surface-mist);
  background: #fff;
  overflow: hidden;
}

.brand-logo-preview img {
  max-width: 80%;
  max-height: 80%;
}

.usage-total td {
  font-weight: 700;
  border-top: 2px solid var(--surface-line);
}

@media (max-width: 700px) {
  .brand-images {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Drill (rehearsal) rooms/polls — sidebar, headers, overview cards */
.drill-tag {
  flex: none;
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--amber-dim);
  color: var(--amber);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

/* comment-log export controls (room settings, AI summary, overview) */
.export-scope {
  background: var(--surface-input);
  color: var(--surface-text);
  border: 1px solid var(--surface-line);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-size: 0.84rem;
  max-width: 100%;
}

.ov-export {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.ov-export .export-row,
.summary-export .export-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.ov-export .pill-btn,
.summary-export .pill-btn {
  margin-top: 0;
}

.summary-export {
  margin-top: 1.25rem;
}

@media (max-width: 820px) {
  .ov-export {
    align-items: flex-start;
  }
}

/* ---------- settings tabs (room + poll): cards by topic ----------
   Two columns on wide screens, one on narrow. Each card has a clear title
   and says how it saves (instant / with its button). */
.set-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
  max-width: 68rem;
}

.set-grid-after {
  margin-top: 1rem;
}

/* cards stacked in one grid cell (poll settings: beside a long questions card) */
.set-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.set-card {
  background: var(--surface-panel);
  border: 1px solid var(--surface-line);
  border-radius: 12px;
  padding: 1rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.set-card.wide,
.set-grid > .wide {
  grid-column: 1 / -1;
}

.set-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.15rem;
}

.set-card-head h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--surface-text);
}

.set-save-hint {
  flex: none;
  font-size: 0.7rem;
  color: var(--surface-mist);
  border: 1px solid var(--surface-line);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}

.set-card label {
  font-size: 0.78rem;
  color: var(--surface-mist);
}

.set-card .settings-form {
  max-width: none;
  margin: 0;
  gap: 0.5rem;
}

.set-card .field-hint {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.5;
}

.set-card textarea,
.set-card select,
.set-card input:not([type="checkbox"]):not([type="radio"]):not([type="file"]) {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--surface-line);
  background: var(--surface-input);
  color: var(--surface-text);
  font: inherit;
  font-size: 0.88rem;
}

.set-card textarea {
  resize: vertical;
  line-height: 1.55;
}

.set-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 0.6rem;
}

.set-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.theme-toggle.compact button {
  padding: 0.5rem 0.4rem;
}

.set-preview-label {
  font-size: 0.7rem;
  color: var(--surface-mist);
  margin-top: 0.2rem;
}

.set-card .appearance-preview {
  border-radius: 8px;
}

.set-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.2rem;
}

.set-actions .status-line {
  margin: 0;
  margin-right: auto;
  font-size: 0.78rem;
}

.set-actions .pill-btn {
  margin-top: 0;
}

.set-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.provider-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.provider-grid.compact .provider-card {
  padding: 0.6rem 0.7rem;
  gap: 0.2rem;
}

.provider-grid.compact .provider-desc {
  font-size: 0.72rem;
}

.set-card .export-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.set-card .export-row .export-scope {
  flex: 1 1 100%;
}

.set-card .export-row .pill-btn {
  flex: 1;
  margin-top: 0;
}

.set-card .header-preview {
  margin: 0.1rem 0;
}

.set-card .qr-logo-row {
  margin: 0;
}

/* danger zone: one compact row across the grid */
.set-card.danger-zone {
  max-width: none;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--signal-dim);
  border-color: rgba(255, 93, 58, 0.35);
}

.set-card.danger-zone p {
  margin: 0.2rem 0 0;
}

.set-card.danger-zone .danger-zone-row {
  flex: 0 1 22rem;
}

/* poll: one save bar for the whole form */
.set-savebar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--surface-line);
  border-radius: 12px;
  background: var(--surface-panel);
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.18);
}

.set-savebar .status-line {
  margin: 0 auto 0 0;
  font-size: 0.8rem;
}

.set-savebar .pill-btn {
  margin-top: 0;
}

@media (max-width: 1100px) {
  .set-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .set-row,
  .provider-grid.compact {
    grid-template-columns: minmax(0, 1fr);
  }
  .set-card.danger-zone {
    flex-direction: column;
    align-items: stretch;
  }
  .set-card.danger-zone .danger-zone-row {
    flex: none;
  }
  .set-savebar .field-hint {
    display: none;
  }
}

/* empty status lines take no room in settings cards */
.set-card .status-line:empty,
.set-savebar .status-line:empty {
  display: none;
}

/* the preview is a sample, not an input: dashed frame, centered text */
.set-card .appearance-preview {
  border-style: dashed;
  text-align: center;
  padding: 0.75rem 0.9rem;
}

/* QR shown as an image + its download buttons */
.room-info-qr-col {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.qr-img {
  display: block;
  max-width: 100%;
  height: auto;
}

.qr-download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.qr-download-row .pill-btn {
  margin-top: 0;
}

/* AI thinks it may be off topic (medium strictness) — still in the queue */
.ai-offtopic-tag {
  display: inline-block;
  margin-bottom: 0.45rem;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid rgba(240, 169, 58, 0.45);
  font-size: 0.8rem;
  font-weight: 600;
}

/* ---------- add/edit display modal: name → layout cards → settings ---------- */
.modal-card.bc-modal {
  max-width: 40rem;
  padding: 1.25rem 1.4rem 0;
}

.bc-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.bc-step {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.bc-step-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.bc-step-head label {
  font-weight: 650;
  font-size: 0.9rem;
  color: var(--surface-text);
}

.bc-step-no {
  flex: none;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--signal);
  color: #fff;
  transform: translateY(-1px);
}

.bc-step-note {
  font-size: 0.74rem;
  color: var(--surface-mist);
}

.bc-form input[type="number"],
.bc-form #broadcast-name {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--surface-line);
  background: var(--surface-input);
  color: var(--surface-text);
  font: inherit;
  font-size: 0.9rem;
}

.bc-layouts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.bc-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.4rem;
  border-radius: 10px;
  border: 1px solid var(--surface-line);
  background: var(--surface-input);
  color: var(--surface-mist);
  cursor: pointer;
  font: inherit;
}

.bc-layout.active {
  border-color: var(--signal);
  background: rgba(255, 93, 58, 0.1);
  color: var(--surface-text);
}

.bc-layout-name {
  font-size: 0.74rem;
  line-height: 1.3;
  text-align: center;
}

/* the little screen: 16:9, messages drawn as bars */
.bc-mini {
  position: relative;
  width: 100%;
  max-width: 6.5rem;
  aspect-ratio: 16 / 9;
  border-radius: 5px;
  background: #1a1d33;
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.bc-mini i {
  position: absolute;
  background: var(--signal);
  border-radius: 2px;
  opacity: 0.85;
}

.bc-mini-strip i:nth-child(1) { left: 6%; right: 6%; bottom: 6%; height: 18%; }
.bc-mini-strip i:nth-child(2) { left: 30%; right: 30%; top: 30%; height: 8%; background: rgba(255, 255, 255, 0.35); }
.bc-mini-strip i:nth-child(3) { display: none; }

.bc-mini-sidebar i:nth-child(1) { right: 5%; top: 8%; width: 24%; height: 22%; }
.bc-mini-sidebar i:nth-child(2) { right: 5%; top: 38%; width: 24%; height: 22%; opacity: 0.6; }
.bc-mini-sidebar i:nth-child(3) { right: 5%; top: 68%; width: 24%; height: 22%; opacity: 0.35; }

.bc-mini-danmaku i:nth-child(1) { left: 45%; top: 10%; width: 40%; height: 10%; }
.bc-mini-danmaku i:nth-child(2) { left: 10%; top: 24%; width: 35%; height: 10%; opacity: 0.6; }
.bc-mini-danmaku i:nth-child(3) { left: 35%; bottom: 12%; width: 45%; height: 10%; }

.bc-mini-list i:nth-child(1) { left: 6%; top: 10%; width: 40%; height: 35%; }
.bc-mini-list i:nth-child(2) { left: 54%; top: 10%; width: 40%; height: 35%; opacity: 0.6; }
.bc-mini-list i:nth-child(3) { left: 6%; top: 55%; width: 40%; height: 35%; opacity: 0.35; }

.bc-layout-desc {
  margin: 0;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  background: var(--surface-overlay);
  font-size: 0.78rem;
}

.bc-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 0.9rem;
}

.bc-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.bc-field > label {
  font-size: 0.78rem;
  color: var(--surface-mist);
}

.bc-number {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.bc-number input {
  flex: 1;
  min-width: 0;
}

.bc-unit {
  flex: none;
  font-size: 0.78rem;
  color: var(--surface-mist);
}

.bc-range {
  font-size: 0.68rem;
  color: var(--surface-mist);
  opacity: 0.8;
}

.bc-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin: 0 -1.4rem;
  padding: 0.85rem 1.4rem;
  border-top: 1px solid var(--surface-line);
  background: var(--surface-panel);
}

.bc-footer .status-line {
  margin: 0 auto 0 0;
}

.bc-footer .status-line:empty {
  display: none;
}

.bc-footer .pill-btn {
  margin-top: 0;
}

@media (max-width: 560px) {
  .bc-layouts,
  .bc-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bc-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- colour palette picker (room / poll / brand defaults) ---------- */
.palette-picker {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pal-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pal-group-title {
  font-size: 0.72rem;
  color: var(--surface-mist);
}

.pal-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.2rem, 1fr));
  gap: 0.45rem;
}

.pal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.3rem 0.4rem;
  border-radius: 10px;
  border: 1.5px solid var(--surface-line);
  background: var(--surface-input);
  color: var(--surface-mist);
  font: inherit;
  cursor: pointer;
}

.pal.active {
  border-color: var(--signal);
  color: var(--surface-text);
  box-shadow: 0 0 0 2px rgba(255, 93, 58, 0.25);
}

/* the little screen: real background, a text card, the button colour */
.pal-mini {
  position: relative;
  width: 100%;
  height: 2.6rem;
  border-radius: 6px;
  border: 1px solid rgba(127, 127, 127, 0.25);
  overflow: hidden;
}

.pal-card {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 14%;
  height: 40%;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.05rem;
  text-align: left;
  padding-left: 0.25rem;
  overflow: hidden;
}

.pal-btn {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 12%;
  height: 22%;
  border-radius: 999px;
}

.pal-name {
  font-size: 0.66rem;
  line-height: 1.25;
  text-align: center;
}

.pal-none {
  align-self: flex-start;
  flex-direction: row;
  padding: 0.35rem 0.8rem;
  font-size: 0.78rem;
}

/* the create-room modal is narrow: three cards a row */
.modal-card .pal-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* developer credit under the login card */
.login-card .login-credit {
  margin: 1.1rem 0 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--surface-mist);
  opacity: 0.8;
}

.login-card .login-credit a {
  color: inherit;
}

/* AI card: who approves; auto-approve settings */
.auto-settings[hidden],
.human-settings[hidden] {
  display: none;
}

.auto-settings,
.human-settings {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.auto-note {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: var(--amber-dim);
  color: var(--surface-text) !important;
}
