:root {
  --bg: #0f1419;
  --bg-card: #1a2332;
  --bg-sidebar: #121a24;
  --text: #e8edf4;
  --text-muted: #8b9cb3;
  --primary: #3b82f6;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border: #2a3544;
  --radius: 12px;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { min-height: 100vh; }
a { color: inherit; text-decoration: none; }

.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f1419 0%, #1e3a5f 100%); padding: 2rem;
}
.login-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2.5rem; width: 100%; max-width: 420px;
}
.login-card__header { text-align: center; margin-bottom: 2rem; }
.login-card__icon { font-size: 3rem; display: block; margin-bottom: 0.5rem; }
.login-card__hint { text-align: center; color: var(--text-muted); font-size: 0.85rem; margin-top: 1rem; }
.login-form label { display: block; margin-bottom: 1rem; font-size: 0.9rem; color: var(--text-muted); }
.login-form input {
  display: block; width: 100%; margin-top: 0.35rem; padding: 0.75rem 1rem;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
}

.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; background: var(--bg-sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 1.5rem 0;
}
.sidebar__brand { display: flex; gap: 0.75rem; align-items: center; padding: 0 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.sidebar__logo { font-size: 1.75rem; }
.sidebar__brand small { display: block; color: var(--text-muted); font-size: 0.75rem; }
.sidebar__nav { flex: 1; padding: 1rem 0; }
.sidebar__link { display: flex; align-items: center; gap: 0.6rem; padding: 0.65rem 1.25rem; color: var(--text-muted); }
.sidebar__link:hover, .sidebar__link--active { background: rgba(59,130,246,0.15); color: var(--text); }
.sidebar__user { padding: 1rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.main-content { flex: 1; padding: 2rem; overflow-y: auto; }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 2rem; }
.page-header h1 { font-size: 1.75rem; }
.subtitle { color: var(--text-muted); margin-top: 0.25rem; }

.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.card--highlight { border-color: var(--primary); }
.card--full { grid-column: 1 / -1; }

.dashboard-grid, .operator-grid, .stats-grid, .conference-grid, .speaker-grid, .session-grid { display: grid; gap: 1.25rem; }
.dashboard-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.operator-grid { grid-template-columns: 1fr 300px; }
.conference-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.conference-card {
  display: flex; flex-direction: column; gap: 1rem;
  padding: 1.5rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
}
.conference-card__link { display: block; color: inherit; text-decoration: none; }
.conference-card__link:hover h2 { color: var(--primary); }
.conference-card__theme { color: var(--primary); }
.conference-card__desc { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.35rem; }
.conference-card__when, .conference-card__venue { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.35rem; }
.conference-card__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.form-error { display: block; color: var(--danger); font-size: 0.8rem; margin-top: 0.25rem; }
.conference-form textarea { min-height: 6rem; resize: vertical; }
.conference-days__label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.conference-days__hint { margin: 0.25rem 0 0.75rem; font-size: 0.85rem; }
.conference-days__list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
.conference-day-row { display: flex; gap: 0.5rem; align-items: center; }
.conference-day-row input[type="date"] { flex: 1; padding: 0.6rem 1rem; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.display-days { color: var(--text-muted); font-size: 1rem; margin-top: 0.35rem; }
.agenda-item__hymn-form,
.agenda-item__time-form,
.agenda-item__session-form,
.agenda-item__speakers-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.5rem; font-size: 0.85rem; }
.agenda-item__speakers { margin: 0.35rem 0 0; font-size: 0.9rem; color: var(--text); }
.agenda-item__speaker { font-weight: 600; }
.agenda-speakers-field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 160px; }
.agenda-speakers-field__select { min-width: 180px; min-height: 4.5rem; padding: 0.35rem 0.5rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.agenda-item__session-form select { padding: 0.35rem 0.5rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.agenda-session-bar,
.operator-session-bar,
.agenda-copy-card { margin-bottom: 1rem; padding: 1rem 1.25rem; }
.agenda-copy-card__title { margin: 0 0 0.35rem; font-size: 1.05rem; }
.agenda-copy-card__hint { margin: 0 0 0.85rem; font-size: 0.88rem; }
.agenda-copy-card__form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
}
.agenda-copy-card__field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 200px;
  flex: 1 1 200px;
  max-width: 320px;
}
.operator-session-bar__hint { margin: 0.75rem 0 0; font-size: 0.9rem; }
.agenda-session-bar__label { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.9rem; font-weight: 600; max-width: 360px; }
.agenda-session-bar__select {
  padding: 0.65rem 1rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 1rem; font-weight: 600;
}
.agenda-item__hymn-form label,
.agenda-item__time-form label { display: flex; align-items: center; gap: 0.35rem; }
.agenda-hymn-field { display: flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; }
.page-header__actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.conference-form { margin-bottom: 1.5rem; }
.operator-account-form { margin-top: 1.5rem; }
.operator-account-form__title { margin: 0 0 0.35rem; font-size: 1.15rem; }
.operator-account-form__hint { margin: 0 0 0.5rem; }
.operator-account-form__actions { margin-top: 0.25rem; }

.btn { padding: 0.6rem 1.2rem; border-radius: 8px; border: none; cursor: pointer; font-weight: 600; }
.btn--primary { background: var(--primary); color: white; }
.btn--success { background: var(--success); color: white; }
.btn--warning { background: var(--warning); color: #111; }
.btn--danger { background: var(--danger); color: white; }
.btn--ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn--secondary { background: var(--border); color: var(--text); }
.btn--sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn--full { width: 100%; }
.control-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem; }

.badge { display: inline-block; padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 0.75rem; text-transform: uppercase; background: var(--border); }
.badge--live { background: rgba(34,197,94,0.2); color: var(--success); }
.badge--scheduled { background: rgba(59,130,246,0.2); color: var(--primary); }

.countdown { text-align: center; font-variant-numeric: tabular-nums; }
.countdown--large .countdown__time { font-size: 3.5rem; font-weight: 700; }
.countdown--huge .countdown__time { font-size: 6rem; font-weight: 800; }
.traffic-light { text-align: center; margin-top: 1rem; }
.traffic-light__bulb { width: 24px; height: 24px; border-radius: 50%; margin: 0 auto 0.5rem; }
.traffic-light__label { font-size: 0.85rem; color: var(--text-muted); }

/* Audience display — single viewport, no page scroll */
html.display-html,
html:has(body.display-body) {
  height: 100%;
  max-height: 100%;
  overflow: clip;
  overscroll-behavior: none;
}
body.display-body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0 !important;
  margin: 0;
  overflow: clip;
  overscroll-behavior: none;
  touch-action: none;
  background: #000;
}
.display-screen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: clip;
  background: #000;
  color: #fff;
  padding: clamp(0.5rem, 1.2vh, 1rem) clamp(0.75rem, 2vw, 1.5rem);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  contain: strict;
}
.display-screen__header {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  max-height: 22vh;
  overflow: hidden;
}
.display-screen__header > div {
  min-width: 0;
  overflow: hidden;
}
.display-screen__header h1 {
  font-size: clamp(0.9rem, 2.2vh, 1.35rem);
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.display-screen__header p {
  font-size: clamp(0.75rem, 1.6vh, 0.95rem);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.display-screen__header .display-session-date {
  margin-top: 0.15rem;
}
.display-clock { font-size: clamp(1.25rem, 3vh, 2rem); flex-shrink: 0; }
.display-screen__body {
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, auto) minmax(0, 1fr) minmax(0, auto) minmax(0, auto);
  align-content: stretch;
  justify-items: center;
  text-align: center;
  gap: clamp(0.15rem, 0.8vh, 0.5rem);
  padding: 0;
  width: 100%;
}
.display-screen__main {
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.15rem, 0.8vh, 0.5rem);
  width: 100%;
}
.display-session {
  flex-shrink: 0;
  font-size: clamp(0.85rem, 2vh, 1.1rem);
  opacity: 0.75;
}
.display-speaker {
  min-height: 0;
  max-width: 100%;
  width: 100%;
  overflow: hidden;
  align-self: center;
}
.display-speaker h2 {
  font-size: clamp(1.25rem, 5vh, 2.75rem);
  line-height: 1.08;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.display-speaker p,
.display-next p,
.display-next h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(100%, 90vw);
}
.display-next h3 { font-size: clamp(1.1rem, 3.5vh, 2rem); }
.display-next { flex-shrink: 0; }
.display-timer { flex-shrink: 0; }
body.display-body .countdown--huge .countdown__time {
  font-size: clamp(1.75rem, min(10vh, 14vw), 4.5rem);
  line-height: 1;
}
body.display-body .traffic-light {
  margin-top: 0.25rem;
}
body.display-body .traffic-light__bulb {
  box-shadow: none !important;
}
.display-label { font-size: clamp(0.7rem, 1.6vh, 0.9rem); text-transform: uppercase; letter-spacing: 3px; opacity: 0.6; }

.queue-list, .alert-list, .agenda-list, .agenda-select { list-style: none; }
.queue-list__item, .alert-list__item { padding: 0.6rem 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; }
.agenda-item { display: flex; align-items: center; gap: 1rem; padding: 1rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0.5rem; }
.agenda-item__order-form { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.agenda-item__order-input {
  width: 3.5rem; padding: 0.4rem 0.5rem; text-align: center; font-weight: 700;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.agenda-item__body { flex: 1; min-width: 0; }
.agenda-item__delete-form { flex-shrink: 0; }
.form-inline__order { display: flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.agenda-select__item { display: flex; align-items: stretch; gap: 0.5rem; margin-bottom: 0.5rem; }
.agenda-select__btn { flex: 1; text-align: left; padding: 0.75rem 1rem; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text); cursor: pointer; margin-bottom: 0; }
.agenda-select__start { flex-shrink: 0; align-self: center; min-width: 4.5rem; }
.agenda-select__btn--active { border-color: var(--primary); }
.agenda-select__btn--no-time { border-style: dashed; cursor: pointer; }
.agenda-select__btn--no-time:disabled { opacity: 1; cursor: pointer; pointer-events: auto; }
.agenda-select__num { color: var(--primary); margin-right: 0.25rem; }

.operator-message-form textarea {
  width: 100%; margin: 1rem 0; padding: 0.75rem 1rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font-size: 1rem; resize: vertical; min-height: 80px;
}
.operator-message-active {
  margin-top: 1rem; padding: 0.75rem 1rem; border-radius: 8px;
  background: rgba(59, 130, 246, 0.15); border: 1px solid var(--primary);
}
#operator-message-panel:not([hidden]) { border-color: var(--danger); }

.display-operator-message {
  min-height: 0;
  max-height: 18vh;
  max-width: 900px;
  width: 100%;
  padding: clamp(0.35rem, 1vh, 0.85rem) clamp(0.75rem, 2vw, 1.25rem);
  margin: 0 auto;
  background: rgba(239, 68, 68, 0.2); border: 2px solid #ef4444;
  border-radius: 12px;
  overflow: hidden;
}
body.display-body .display-operator-message:not([hidden]) {
  animation: display-msg-pulse 1.5s ease-in-out infinite;
}
.display-operator-message p {
  font-size: clamp(1rem, 3.5vh, 2rem);
  font-weight: 700;
  line-height: 1.25;
  margin-top: 0.35rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}
.display-screen--time-up { animation: display-screen-flash 0.8s ease-in-out infinite; }
@keyframes display-msg-pulse {
  0%, 100% { border-color: #ef4444; background-color: rgba(239, 68, 68, 0.2); }
  50% { border-color: #f87171; background-color: rgba(239, 68, 68, 0.35); }
}
body.display-body .display-session-date {
  font-size: clamp(0.75rem, 1.6vh, 0.95rem);
  margin-top: 0.15rem;
  color: rgba(255, 255, 255, 0.65);
}
body.display-body .display-session-date[hidden] {
  display: none !important;
}
@keyframes display-screen-flash {
  0%, 100% { background-color: #000; }
  50% { background-color: #2a0a0a; }
}

.display-scripture-quote {
  position: fixed;
  inset: auto 2rem 2rem 2rem;
  max-width: min(960px, calc(100vw - 4rem));
  max-height: min(42vh, calc(100dvh - 6rem));
  margin: 0 auto;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 1.25rem 1.75rem 1.15rem;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(12, 35, 64, 0.97), rgba(26, 58, 92, 0.95));
  border: 2px solid #c9a84c;
  box-shadow: none;
  text-align: left;
  overflow: hidden;
  animation: display-quote-in 0.2s ease-out;
  pointer-events: auto;
}
.display-scripture-quote--prophet {
  border-color: #e8d5a3;
  background: linear-gradient(145deg, rgba(40, 24, 8, 0.96), rgba(74, 44, 12, 0.94));
}
.display-scripture-quote__close {
  position: absolute;
  top: 0.65rem;
  right: 0.85rem;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}
.display-scripture-quote__label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #e8d5a3;
  font-weight: 700;
}
.display-scripture-quote__reference {
  margin: 0 0 0.35rem;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  font-weight: 700;
  line-height: 1.15;
  color: #fff;
}
.display-scripture-quote__source {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.72);
}
.display-scripture-quote__text {
  margin: 0;
  padding: 0;
  border: none;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1rem, 1.8vw, 1.45rem);
  line-height: 1.35;
  font-style: italic;
  color: #faf8f4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  line-clamp: 6;
}
.display-scripture-quote__text::before {
  content: '“';
  color: #c9a84c;
  font-size: 1.2em;
  margin-right: 0.1em;
}
.display-scripture-quote__text::after {
  content: '”';
  color: #c9a84c;
  font-size: 1.2em;
}
@keyframes display-quote-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.operator-quote-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.operator-quote-status { margin: 0 0 0.75rem; font-size: 0.9rem; }
.operator-quote-field { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.operator-quote-field textarea,
.operator-quote-field input {
  width: 100%; padding: 0.65rem 0.85rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font-size: 0.95rem;
}
.operator-quote-reference { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 0.75rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.operator-quote-reference .operator-quote-field { flex: 1; min-width: 200px; margin-bottom: 0; }
.operator-quote-search { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 0.75rem; }
.operator-quote-search .operator-quote-field { flex: 1; min-width: 200px; margin-bottom: 0; }
.operator-quote-results { list-style: none; margin: 0; padding: 0; }
.operator-quote-results li { margin-bottom: 0.5rem; }
.operator-quote-results button {
  width: 100%; text-align: left; padding: 0.75rem 1rem;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg);
  color: var(--text); cursor: pointer;
}
.operator-quote-results button:hover { border-color: var(--primary); }
.operator-quote-results strong { display: block; color: var(--primary); }
.operator-quote-results small { color: var(--text-muted); }
.operator-quote-active {
  margin-top: 0.75rem; padding: 0.75rem 1rem; border-radius: 8px;
  background: rgba(201, 168, 76, 0.12); border: 1px solid #c9a84c;
}
#quote-listen-toggle.is-listening { background: var(--danger); }
#quote-auto-toggle {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  touch-action: manipulation;
}
#quote-auto-toggle.is-active { background: var(--success); border-color: var(--success); color: #fff; }
#quote-auto-toggle:not(.is-active) { opacity: 0.85; }

.stat-row { display: flex; justify-content: space-between; padding: 0.5rem 0; }
.progress-bar { height: 8px; background: var(--border); border-radius: 4px; margin-top: 1rem; overflow: hidden; }
.progress-bar__fill { height: 100%; background: var(--primary); }
.speaker-name { font-size: 1.5rem; font-weight: 600; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.form-inline { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.5rem; }
.form-inline input, .form-inline select, .form-grid input, .form-grid select, .form-grid textarea {
  padding: 0.6rem 1rem; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.form-grid label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: var(--text-muted); }
.form-grid__full { grid-column: 1 / -1; }
.form-grid__actions { grid-column: 1 / -1; display: flex; gap: 0.5rem; }
.speaker-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.speaker-card h3,
.speaker-card > p,
.speaker-card__edit {
  width: 100%;
  text-align: left;
}
.speaker-card__avatar {
  width: clamp(5.5rem, 22vw, 8.75rem);
  height: clamp(5.5rem, 22vw, 8.75rem);
  max-width: min(8.75rem, 40vw);
  margin: 0 auto 1rem;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(145deg, var(--bg) 0%, rgba(59, 130, 246, 0.12) 100%);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.speaker-card__avatar img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.speaker-photo-field { display: flex; flex-direction: column; gap: 0.35rem; }
.speaker-photo-field input[type='file'] { font-size: 0.85rem; }
.speaker-photo-preview {
  width: clamp(5rem, 20vw, 7.5rem);
  height: clamp(5rem, 20vw, 7.5rem);
  max-width: min(7.5rem, 36vw);
  margin-top: 0.35rem;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.speaker-photo-preview[hidden] { display: none !important; }
.speaker-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.speaker-card__actions { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; justify-content: center; }
.speaker-card__edit { margin-top: 1rem; }
.session-card__edit { margin-top: 1rem; }

/* Speakers management list */
.speakers-add-form {
  margin-bottom: 1.25rem;
}

.speaker-agenda-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: end;
}

.speaker-agenda-picker label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.speaker-agenda-picker__agenda:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.speakers-empty {
  text-align: center;
  padding: 2rem 1.5rem;
}

.speakers-panel {
  padding: 0;
  overflow: hidden;
}

.speaker-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.speaker-list__item {
  border-bottom: 1px solid var(--border);
}

.speaker-list__item:last-child {
  border-bottom: none;
}

.speaker-list__row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem 1.25rem;
  align-items: start;
  padding: 1rem 1.25rem;
}

.speaker-list__avatar {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(145deg, var(--bg) 0%, rgba(59, 130, 246, 0.12) 100%);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.speaker-list__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.speaker-list__initial {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.speaker-list__main {
  min-width: 0;
}

.speaker-list__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
}

.speaker-list__name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
}

.speaker-list__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin: 0 0 0.35rem;
}

.speaker-list__meta-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
  margin: 0;
}

.speaker-list__meta dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.speaker-list__meta dd {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.speaker-list__agenda {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.speaker-list__qr {
  margin: 0.35rem 0 0;
}

.speaker-list__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  flex-shrink: 0;
}

.speaker-list__actions .btn {
  white-space: nowrap;
}

.speaker-list__edit {
  margin: 0 1.25rem 1.25rem;
  padding: 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.speaker-list__edit-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

/* Sessions management list */
.sessions-empty {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-muted);
}

.sessions-panel {
  padding: 0;
  overflow: hidden;
}

.sessions-panel__head {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(59, 130, 246, 0.04);
}

.sessions-panel__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.sessions-panel__hint {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}

.session-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.session-list__item {
  border-bottom: 1px solid var(--border);
}

.session-list__item:last-child {
  border-bottom: none;
}

.session-list__row {
  display: grid;
  grid-template-columns: 2.5rem 5.5rem 1fr auto;
  gap: 1rem 1.25rem;
  align-items: start;
  padding: 1rem 1.25rem;
}

.session-list__order {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary);
  background: rgba(59, 130, 246, 0.12);
  border-radius: 8px;
  flex-shrink: 0;
}

.session-list__time {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.35rem 0.5rem;
  min-width: 5rem;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  line-height: 1.25;
}

.session-list__time-date {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.session-list__time-start {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
}

.session-list__time-sep {
  display: none;
}

.session-list__time-end {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.session-list__time-tba {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  font-style: italic;
}

.session-list__main {
  min-width: 0;
}

.session-list__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.25rem;
}

.session-list__name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.25;
}

.session-list__type {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
}

.session-list__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0;
}

.session-list__meta-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
  margin: 0;
}

.session-list__meta dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.session-list__meta dd {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.session-list__desc {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
  max-width: 42rem;
}

.session-list__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  flex-shrink: 0;
}

.session-list__actions .btn {
  white-space: nowrap;
}

.session-list__edit {
  margin: 0 1.25rem 1.25rem;
  padding: 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.data-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.data-table th, .data-table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
.stat-card { text-align: center; }
.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert--error { background: rgba(239,68,68,0.15); color: var(--danger); }
.alert--success { background: rgba(34,197,94,0.15); color: var(--success); }
.hidden { display: none !important; }

.vibration-banner {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: 28rem;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.95);
  color: #f8fafc;
  font-size: 0.9rem;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}
.vibration-banner[hidden] { display: none !important; }
.vibration-banner__text { margin: 0; }
/* Display page: banner overlays viewport only — must not extend document height */
body.display-body .vibration-banner {
  position: fixed;
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  max-height: 18vh;
  overflow: hidden;
}

.conferences-page { max-width: 1200px; margin: 0 auto; padding: 2rem; }

/* Mobile nav toggle (hidden on desktop) */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1100;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.mobile-nav-toggle__bar {
  display: block;
  width: 1.15rem;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.app-layout.sidebar-open .mobile-nav-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.app-layout.sidebar-open .mobile-nav-toggle__bar:nth-child(2) { opacity: 0; }
.app-layout.sidebar-open .mobile-nav-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1040;
  background: rgba(0, 0, 0, 0.55);
  -webkit-tap-highlight-color: transparent;
}
.sidebar-backdrop:not([hidden]) { display: block; }
.sidebar__close {
  display: none;
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}
.sidebar__brand { position: relative; }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 1rem;
}
.data-table { min-width: 32rem; }

.stats-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.speaker-grid { grid-template-columns: 1fr; }
.session-grid { grid-template-columns: 1fr; }

/* ─── Tablet ─── */
@media (max-width: 1024px) {
  .operator-grid { grid-template-columns: 1fr; }
  .main-content { padding: 1.5rem; }
}

/* ─── Mobile ─── */
@media (max-width: 768px) {
  .mobile-nav-toggle { display: flex; }

  .app-layout {
    position: relative;
    overflow-x: hidden;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1050;
    width: min(280px, 88vw);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.4);
    overflow-y: auto;
  }
  .app-layout.sidebar-open .sidebar { transform: translateX(0); }

  .sidebar__close { display: block; }

  .main-content {
    width: 100%;
    padding: 1rem;
    padding-top: 3.75rem;
  }

  .page-header {
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
  }
  .page-header h1 { font-size: 1.35rem; }
  .page-header__actions { width: 100%; }
  .page-header__actions .btn { flex: 1; min-width: 0; text-align: center; }

  .conferences-page { padding: 1rem; padding-top: 1.25rem; }

  .card { padding: 1rem; }

  .form-grid { grid-template-columns: 1fr; }

  .form-inline {
    flex-direction: column;
    align-items: stretch;
  }
  .form-inline input,
  .form-inline select,
  .form-inline .btn {
    width: 100%;
  }

  .agenda-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .agenda-item__order-form { justify-content: flex-start; }
  .agenda-item__delete-form { align-self: flex-end; }

  .agenda-session-bar__label,
  .operator-session-bar .agenda-session-bar__label { max-width: none; }

  .agenda-session-bar__select,
  .operator-session-bar .agenda-session-bar__select {
    width: 100%;
    max-width: 100%;
  }

  .operator-grid {
    gap: 1rem;
  }

  .operator-quote-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .operator-quote-controls .btn {
    width: 100%;
    text-align: center;
  }

  .conference-card__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .conference-card__actions .btn {
    width: 100%;
    text-align: center;
  }

  .page-header__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .page-header__actions form {
    flex: 1 1 auto;
    min-width: 0;
  }

  .page-header__actions form .btn {
    width: 100%;
  }

  .countdown--huge .countdown__time { font-size: clamp(2.75rem, 14vw, 4.5rem); }
  .countdown--large .countdown__time { font-size: clamp(2rem, 10vw, 3.5rem); }

  .control-buttons .btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 7rem;
    min-height: 2.75rem;
    font-size: 0.85rem;
    padding: 0.55rem 0.65rem;
  }
  .control-buttons--adjust .btn { flex: 1 1 calc(50% - 0.25rem); }

  .operator-quote-reference,
  .operator-quote-search {
    flex-direction: column;
    align-items: stretch;
  }
  .operator-quote-reference .operator-quote-field,
  .operator-quote-search .operator-quote-field {
    min-width: 0;
  }
  .operator-quote-reference .btn,
  .operator-quote-search .btn { width: 100%; }

  .sidebar__user {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .conference-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }

  .vibration-banner {
    left: 1rem;
    right: 1rem;
    transform: none;
    max-width: none;
    bottom: 0.75rem;
  }

  /* Audience display — stay within viewport */
  .display-screen { padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left)); }
  .display-screen__header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    max-height: none;
  }

  .display-screen__header h1,
  .display-screen__header p {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
  }

  .display-clock {
    align-self: flex-end;
    font-size: clamp(1.1rem, 5vw, 1.75rem);
  }

  .display-screen__body {
    gap: clamp(0.2rem, 1vh, 0.4rem);
  }

  .display-speaker h2 {
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }

  .display-operator-message { max-width: none; }

  .display-scripture-quote {
    inset: auto 0.75rem 0.75rem 0.75rem;
    max-width: none;
    padding: 1.15rem 1.25rem 1rem;
    padding-top: 2rem;
  }
  .display-scripture-quote__reference { font-size: clamp(1.25rem, 5vw, 1.75rem); }
  .display-scripture-quote__text { font-size: clamp(1rem, 3.8vw, 1.35rem); }

  .login-page { padding: 1rem; }
  .login-card { padding: 1.5rem; }
}

/* ─── Small phones ─── */
@media (max-width: 400px) {
  .main-content { padding: 0.75rem; padding-top: 3.5rem; }
  .control-buttons .btn { flex: 1 1 100%; }
  .speaker-list__row {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      'avatar main'
      'actions actions';
  }

  .speaker-list__avatar { grid-area: avatar; }
  .speaker-list__main { grid-area: main; }
  .speaker-list__actions {
    grid-area: actions;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .speaker-list__edit {
    margin-left: 1rem;
    margin-right: 1rem;
  }

  .speaker-agenda-picker {
    grid-template-columns: 1fr;
  }

  .session-list__row {
    grid-template-columns: 2.25rem 1fr;
    grid-template-areas:
      'order main'
      'time main'
      'actions actions';
    gap: 0.75rem 1rem;
  }

  .session-list__order { grid-area: order; }
  .session-list__time { grid-area: time; width: 100%; max-width: 10rem; }
  .session-list__main { grid-area: main; }
  .session-list__actions {
    grid-area: actions;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .session-list__edit {
    margin-left: 1rem;
    margin-right: 1rem;
  }
  .speaker-card__avatar {
    width: clamp(5rem, 32vw, 7rem);
    height: clamp(5rem, 32vw, 7rem);
    max-width: 7rem;
  }
  .queue-list__item, .alert-list__item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

/* Safe area for notched phones */
@supports (padding: max(0px)) {
  @media (max-width: 768px) {
    .mobile-nav-toggle {
      top: max(0.75rem, env(safe-area-inset-top));
      left: max(0.75rem, env(safe-area-inset-left));
    }
    .main-content {
      padding-left: max(1rem, env(safe-area-inset-left));
      padding-right: max(1rem, env(safe-area-inset-right));
    }
    .display-screen {
      padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
    }
    .display-scripture-quote {
      bottom: max(0.75rem, env(safe-area-inset-bottom));
      left: max(0.75rem, env(safe-area-inset-left));
      right: max(0.75rem, env(safe-area-inset-right));
    }
    .vibration-banner {
      bottom: max(0.75rem, env(safe-area-inset-bottom));
    }
  }
}
