@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #F6F8FA;
  --surface: #FFFFFF;
  --surface-alt: #EEF1F5;
  --text: #0A1628;
  --text-secondary: #3D4F6B;
  --text-muted: #7A8BA3;
  --accent: #002B5C;
  --accent-hover: #001D3F;
  --accent-light: #B8D4F0;
  --gold: #E8A817;
  --gold-hover: #D49A14;
  --gold-light: rgba(232, 168, 23, 0.12);
  --facilitator: #002B5C;
  --facilitator-light: rgba(0, 43, 92, 0.08);
  --border: #D8DEE8;
  --border-focus: #002B5C;
  --shadow: rgba(10, 22, 40, 0.05);
  --shadow-md: rgba(10, 22, 40, 0.09);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
}

body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
}

body.video-active {
  align-items: stretch;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  padding: 0;
}

/* ---- Screens ---- */

.screen {
  display: none;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ---- Welcome Screen ---- */

#welcome-screen {
  align-items: stretch;
  gap: 32px;
  text-align: left;
  padding: 40px;
  max-width: 1160px;
}

.welcome-shell {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(340px, 1fr);
  gap: 24px;
  align-items: start;
}

.welcome-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 28px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 40px 32px;
  box-shadow: 0 18px 44px var(--shadow);
}

#welcome-screen h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

#welcome-screen p {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 520px;
}

.workspace-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 140px); /* Allows scrolling when Recent Sessions expands */
  overflow-y: auto;
  padding-right: 12px; /* Space for scrollbar */
  scrollbar-width: thin;
}

.workspace-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 22px 20px;
  box-shadow: 0 18px 44px var(--shadow);
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.workspace-header h3,
.auth-section h4 {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.workspace-kicker {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.workspace-meta {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Collapsible workspace cards */
.workspace-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}

.workspace-toggle:hover {
  background: var(--surface-alt);
  color: var(--text-secondary);
}

.toggle-icon {
  transition: transform 0.2s ease;
  font-size: 0.9rem;
}

.workspace-card.collapsed .workspace-list {
  display: none;
}

.workspace-card.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.auth-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form-group,
.auth-form-group input,
.auth-form-group textarea,
.auth-form-group select {
  max-width: 100%;
}

.auth-btn {
  width: 100%;
}

.workspace-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.workspace-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}

/* Inline edit fields (used in expanded class card) */
.class-edit-name,
.class-edit-age {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
  width: 100%;
}

.class-edit-name:focus,
.class-edit-age:focus {
  outline: none;
  border-color: var(--accent);
}

.class-edit-desc {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--text);
  width: 100%;
  min-height: 60px;
  resize: vertical;
}

.class-edit-desc:focus {
  outline: none;
  border-color: var(--accent);
}

.workspace-item strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 4px;
}

.workspace-item-meta {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.workspace-item-tag {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.class-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  text-align: left;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input, .form-group select {
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  background: rgba(255,255,255,0.92);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 43, 92, 0.10);
  transform: translateY(-1px);
}

.btn {
  padding: 12px 22px;
  border: none;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 8px 20px rgba(10, 22, 40, 0.06);
}

.btn-primary {
  background: linear-gradient(135deg, #002B5C 0%, #001D3F 100%);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #003d7a 0%, #002a52 100%);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0, 43, 92, 0.18);
}

.btn-secondary {
  background: rgba(255,255,255,0.78);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.96);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-row {
  display: flex;
  gap: 12px;
}

/* ---- Lobby Screen ---- */

#lobby-screen {
  align-items: center;
  gap: 24px;
  padding: 60px 40px;
  text-align: center;
}

#lobby-screen h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 600;
}

.session-code {
  font-family: 'Inter', sans-serif;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--accent);
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(246,248,250,0.98));
  padding: 16px 32px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  box-shadow: 0 14px 32px rgba(0, 43, 92, 0.08);
}

.passage-preview {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: left;
  width: 100%;
  max-width: 540px;
}

.passage-preview h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: var(--text);
}

.passage-preview p {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
  font-style: italic;
}

.participant-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.participant-chip {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.88rem;
  color: var(--text);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}


/* ---- Setup Screen ---- */

#setup-screen {
  padding: 40px;
  gap: 32px;
  overflow-y: auto;
  max-height: 100vh;
  max-width: 1160px;
}

#setup-screen h2 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 600;
  text-align: left;
}

.setup-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.setup-kicker {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--facilitator);
}

.setup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(290px, 0.9fr);
  gap: 22px;
  align-items: start;
}

.setup-main,
.setup-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.setup-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 14px 32px rgba(10, 22, 40, 0.05);
}

.setup-section-featured {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,248,250,0.96));
}

.setup-section h3 {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

.helper-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.setup-context-card {
  background: linear-gradient(180deg, rgba(0, 43, 92, 0.96), rgba(0, 29, 63, 0.98));
  color: rgba(255,255,255,0.95);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 24px 48px rgba(0, 43, 92, 0.22);
  position: sticky;
  top: 24px;
}

.setup-context-kicker {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.72;
  margin-bottom: 8px;
}

.setup-context-card h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  margin-bottom: 8px;
  color: #fff;
}

.setup-context-card p {
  line-height: 1.6;
}

.setup-context-stack {
  margin: 18px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setup-context-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.12);
}

.setup-context-row span {
  color: rgba(255,255,255,0.72);
  font-size: 0.85rem;
}

.setup-context-row strong {
  text-align: right;
  font-size: 0.92rem;
}

.setup-context-note {
  color: rgba(255,255,255,0.76);
  font-size: 0.92rem;
}

.room-wait-screen,
#room-wait-screen {
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  max-width: 960px;
}

.room-wait-shell {
  width: 100%;
  display: flex;
  justify-content: center;
}

.room-wait-card {
  width: min(100%, 720px);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,248,250,0.98));
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 36px;
  box-shadow: 0 20px 48px rgba(0, 43, 92, 0.08);
}

.room-wait-kicker {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--facilitator);
}

.room-wait-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  margin-bottom: 10px;
}

.room-wait-copy {
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 60ch;
}

.room-wait-code-card {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
  background: rgba(255,255,255,0.82);
  border: 1.5px solid var(--border);
  border-radius: 18px;
}

.room-wait-code-card strong {
  font-size: 1.6rem;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.room-wait-note {
  margin-top: 18px;
  padding: 16px 18px;
  background: rgba(0, 43, 92, 0.08);
  border: 1px solid rgba(0, 43, 92, 0.16);
  border-radius: 16px;
  color: var(--facilitator);
  line-height: 1.6;
}

.room-wait-actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.join-code-helper {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 10px 0 12px;
}

.join-code-helper strong {
  color: var(--facilitator);
}

/* Upload Area */

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
}

.upload-area:hover {
  border-color: var(--accent);
  background: var(--surface);
}

.upload-area.dragover {
  border-color: var(--accent);
  background: var(--facilitator-light);
}

.upload-icon {
  font-size: 2rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.upload-area p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.upload-hint {
  font-size: 0.8rem !important;
  color: var(--text-muted) !important;
}

/* URL Input Row */

.url-input-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.url-input-row input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--text);
}

.url-input-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-small {
  padding: 10px 16px;
  font-size: 0.85rem;
}

.dashboard-grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
}

.workspace-grid.compact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.82), rgba(246,248,250,0.64)),
    radial-gradient(circle at top right, rgba(232, 168, 23, 0.18), transparent 42%);
}

.metric-card strong {
  display: block;
  margin: 4px 0;
  font-size: 1.7rem;
  color: var(--text);
}

.metric-card small,
.metric-label,
.parent-progress-note {
  color: var(--text-muted);
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inline-form.parent-child-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(150px, 1.2fr) minmax(100px, 0.8fr) auto;
  gap: 10px;
  margin-bottom: 14px;
}

.parent-child-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.parent-progress-note {
  margin: 8px 0 0;
  font-size: 0.88rem;
  line-height: 1.4;
}

.parent-child-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

@media (max-width: 860px) {
  .dashboard-grid-two,
  .workspace-grid.compact-grid,
  .inline-form.parent-child-form,
  .parent-child-card {
    grid-template-columns: 1fr;
  }

  .parent-child-stats {
    align-items: flex-start;
  }
}

/* Materials List */

.materials-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.material-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.material-icon {
  font-size: 1.1rem;
}

.material-name {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.material-remove:hover {
  color: var(--accent);
}

.material-badge {
  font-size: 0.7rem;
  background: rgba(0, 43, 92, 0.1);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 500;
}

/* Read-only transcript overlay */
.readonly-card {
  background: var(--surface);
  border-radius: 18px;
  padding: 32px;
  max-width: 700px;
  width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 60px var(--shadow);
}

.readonly-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.readonly-feed {
  overflow-y: auto;
  max-height: 50vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.readonly-feed .facilitator_message,
.readonly-feed .participant_message {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.readonly-feed .facilitator_message {
  background: rgba(0, 43, 92, 0.08);
  border-left: 3px solid var(--accent);
}

.readonly-feed .participant_message {
  background: var(--surface);
}

/* Setup Actions */

.setup-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.setup-actions .btn {
  min-width: 160px;
}

/* Primed Preview */

.primed-preview {
  background: var(--facilitator-light);
  border: 1.5px solid rgba(0, 43, 92, 0.2);
  border-radius: var(--radius);
  padding: 20px;
}

.primed-preview h4 {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--facilitator);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.primed-themes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-chip {
  background: white;
  color: var(--facilitator);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  border: 1px solid rgba(0, 43, 92, 0.3);
}

/* ---- Video Screen ---- */

#video-screen {
  max-width: none;
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  padding: 0;
  gap: 0;
  margin: 0;
}

.video-layout {
  display: flex;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.video-main {
  flex: 1;
  background: #1a1a1a;
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

#jitsi-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

#jitsi-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ---- Plato Video Tile ---- */

.plato-tile {
  position: absolute;
  bottom: 16px;
  left: 16px;
  width: 220px;
  background: rgba(20, 20, 25, 0.92);
  backdrop-filter: blur(12px);
  border-radius: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  padding: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.plato-tile.speaking {
  border-color: rgba(232, 168, 23, 0.6);
  box-shadow: 0 0 20px rgba(232, 168, 23, 0.2);
}

.plato-tile-avatar {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.plato-tile-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E8A817, #F0B830);
  color: #fff;
  font-size: 1.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  position: relative;
}

.plato-speaking-rings {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  opacity: 0;
  transition: opacity 0.3s;
}

.plato-tile.speaking .plato-speaking-rings {
  opacity: 1;
}

.plato-speaking-rings .ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  border: 2px solid rgba(232, 168, 23, 0.4);
  transform: translate(-50%, -50%);
}

.ring-1 {
  width: 72px;
  height: 72px;
  animation: plato-pulse 1.5s ease-out infinite;
}

.ring-2 {
  width: 72px;
  height: 72px;
  animation: plato-pulse 1.5s ease-out infinite 0.3s;
}

.ring-3 {
  width: 72px;
  height: 72px;
  animation: plato-pulse 1.5s ease-out infinite 0.6s;
}

@keyframes plato-pulse {
  0% {
    width: 64px;
    height: 64px;
    opacity: 0.6;
  }
  100% {
    width: 100px;
    height: 100px;
    opacity: 0;
  }
}

.plato-tile-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.plato-tile-name {
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
}

.plato-tile-status {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color 0.3s;
}

.plato-tile.speaking .plato-tile-status {
  color: #F0B830;
}

.plato-tile-text {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8rem;
  line-height: 1.4;
  text-align: center;
  max-height: 60px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s;
}

.plato-tile.speaking .plato-tile-text {
  opacity: 1;
}

/* ---- Facilitator Sidebar ---- */

.video-sidebar {
  width: clamp(330px, 28vw, 380px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1.5px solid var(--border);
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1.5px solid var(--border);
  flex-shrink: 0;
}

.sidebar-header h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.plato-avatar-small {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, #E8A817, #F0B830);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.status-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge.listening {
  background: var(--surface-alt);
  color: var(--text-muted);
}

.status-badge.speaking {
  background: var(--facilitator-light);
  color: var(--facilitator);
  animation: pulse 1.5s ease-in-out infinite;
}

.status-badge.muted {
  background: #EEF1F5;
  color: var(--text-muted);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Unified conversation feed */

.sidebar-transcript {
  flex: 1 1 0;
  overflow-y: auto;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-transcript h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
  position: sticky;
  top: 0;
  background: var(--surface);
  padding: 4px 0;
  z-index: 1;
}

.conversation-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 0;
}

.facilitator-bubble {
  background: var(--facilitator-light);
  border: 1px solid rgba(0, 43, 92, 0.15);
  border-radius: var(--radius);
  padding: 10px 14px;
  animation: fadeIn 0.3s ease;
}

.facilitator-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--facilitator);
  margin-bottom: 6px;
}

.plato-avatar-tiny {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--facilitator);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  flex-shrink: 0;
}

.facilitator-move {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.6;
  margin-left: auto;
}

.facilitator-text {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}

.transcript-entry {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.transcript-entry strong {
  color: var(--accent);
  font-weight: 600;
}

.transcript-entry.self strong {
  color: var(--text);
}

.transcript-lines {
  display: inline;
}

.transcript-line + .transcript-line::before {
  content: " ";
}

.transcript-partial {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

.transcript-system {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 4px 0;
}

/* Sidebar chat input */

.sidebar-input {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-input form {
  display: flex;
  gap: 6px;
}

.sidebar-input input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.86rem;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.sidebar-input input:focus {
  border-color: var(--accent);
}

.btn-send {
  padding: 8px 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-send:hover {
  opacity: 0.9;
}

.sidebar-voice-tools {
  padding: 8px 14px;
  border-top: 1px solid rgba(0, 43, 92, 0.08);
  flex-shrink: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.btn-mic-toggle {
  width: 100%;
  min-height: 34px;
  padding: 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-mic-toggle:hover {
  border-color: var(--accent);
}

.btn-mic-toggle.muted {
  background: #EEF1F5;
  border-color: var(--text-muted);
  color: var(--text-muted);
}

.voice-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.voice-toggle input {
  width: 16px;
  height: 16px;
}

/* Sidebar controls */

.sidebar-controls {
  padding: 8px 14px 10px;
  border-top: 1.5px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-controls-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.btn-end {
  width: 100%;
  padding: 9px 14px;
  background: none;
  color: #d63031;
  border: 1.5px solid #d63031;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-end:hover {
  background: rgba(214, 48, 49, 0.08);
}

.btn-dashboard {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 9px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-dashboard:hover {
  background: var(--accent-hover);
}

.sidebar-controls-top .btn,
.sidebar-controls-top .btn-dashboard {
  width: 100%;
}

.dash-icon {
  font-size: 0.75rem;
  letter-spacing: 1px;
}

/* Sidebar scrollbar */

.sidebar-transcript::-webkit-scrollbar {
  width: 4px;
}

.sidebar-transcript::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Join section */

#join-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* ---- Share Link ---- */

.share-link {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 420px;
  margin-top: 8px;
}

.share-url-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  background: var(--bg);
  color: var(--text-secondary);
  cursor: text;
}

/* ---- Priming Status ---- */

.priming-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--facilitator-light);
  border: 1.5px solid rgba(0, 43, 92, 0.2);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--facilitator);
  font-style: italic;
}

/* ---- Divider ---- */

.divider {
  width: 100%;
  max-width: 100%;
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ---- Setup subtitle ---- */

.setup-subtitle {
  color: var(--text-secondary);
  font-size: 0.92rem;
  text-align: left;
  max-width: 720px;
  line-height: 1.65;
}

.material-count {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---- Spinner ---- */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Textarea ---- */

.form-group textarea {
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s;
  resize: vertical;
  min-height: 80px;
}

.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
  body {
    padding: 12px;
  }

  body.video-active {
    height: 100dvh;
    min-height: 100dvh;
    padding: 0;
  }

  #welcome-screen,
  #lobby-screen {
    padding: 40px 20px;
  }

  .welcome-shell,
  .auth-grid {
    grid-template-columns: 1fr;
  }

  .welcome-main {
    padding: 28px 20px;
  }

  #setup-screen {
    padding: 20px;
  }

  .setup-layout {
    grid-template-columns: 1fr;
  }

  .setup-context-card {
    position: static;
  }

  .setup-section {
    padding: 16px;
  }

  .session-code {
    font-size: 1.5rem;
    padding: 12px 24px;
  }

  .setup-actions {
    flex-direction: column;
  }

  .setup-actions .btn {
    width: 100%;
  }

  .room-wait-card {
    padding: 24px 20px;
  }

  .room-wait-code-card {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Video layout goes vertical on mobile */
  .video-layout {
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
  }

  .video-sidebar {
    width: 100%;
    height: 40dvh;
    max-height: 40vh;
    border-left: none;
    border-top: 1.5px solid var(--border);
  }

  .video-main {
    min-height: 50vh;
  }

  .sidebar-transcript {
    max-height: 200px;
  }
}

/* ---- Modal Styles ---- */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(16px);
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: transparent; /* backdrop handled by .modal itself */
}

.modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.25);
  width: 820px;
  max-width: 90vw;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 1001;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h2 {
  margin: 0;
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s ease;
}

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

.modal-body {
  padding: 28px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Analytics loading state */
.analytics-loading {
  text-align: center;
  padding: 60px 20px;
}

.analytics-loading .spinner {
  margin: 0 auto 16px;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Analytics content */
.analytics-section {
  margin-bottom: 32px;
}

.analytics-section h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 16px 0;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent-light);
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.analytics-action-row {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 14px;
}

.analytics-tool-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 12px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.analytics-tool-strip strong,
.analytics-tool-strip span {
  display: block;
}

.analytics-tool-strip strong {
  color: var(--text);
  font-size: 0.92rem;
}

.analytics-tool-strip span {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-top: 2px;
}

.analytics-metric {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 16px;
  text-align: center;
  transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.analytics-metric-button {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  font: inherit;
}

.analytics-metric-button:focus-visible {
  outline: 3px solid var(--accent-light);
  outline-offset: 2px;
}

.analytics-metric:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -6px rgba(0, 43, 92, 0.12);
}

.analytics-metric .metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 6px;
  font-feature-settings: "tnum";
}

.analytics-metric .metric-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.metric-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1002;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.36);
}

.metric-detail-backdrop[hidden] {
  display: none;
}

.metric-detail-modal {
  position: relative;
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  padding: 28px;
}

.metric-detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
}

.metric-detail-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 12px;
  font-feature-settings: "tnum";
}

.metric-detail-modal h3 {
  margin: 0 36px 12px 0;
  padding: 0;
  border: 0;
}

.metric-detail-modal p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 18px;
}

.metric-detail-formula {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.metric-detail-formula span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.metric-detail-formula code {
  color: var(--text);
  white-space: normal;
}

.analytics-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent-light);
}

.analytics-section-header h3 {
  margin: 0;
  padding: 0;
  border: 0;
}

.analytics-section-toggle {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 10px;
}

.analytics-section-toggle:hover {
  color: var(--text);
  border-color: var(--accent-light);
}

.analytics-section-note {
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
}

.transcript-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.transcript-health-grid div {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.transcript-health-grid strong,
.transcript-health-grid span {
  display: block;
}

.transcript-health-grid strong {
  color: var(--accent);
  font-size: 1.05rem;
}

.transcript-health-grid span {
  color: var(--text-secondary);
  font-size: 0.78rem;
  margin-top: 4px;
}

.transcript-health-ok {
  color: #166534;
  font-weight: 700;
  margin: 0 0 10px;
}

.transcript-health-warnings {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.transcript-health-warnings p {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: #9a3412;
  margin: 0;
  padding: 9px 10px;
}

.transcript-health-signals {
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.5;
  margin: 0;
  padding-left: 18px;
}

.plato-replay-section {
  display: grid;
  gap: 10px;
}

.plato-replay-item {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.plato-replay-item summary {
  align-items: center;
  cursor: pointer;
  display: grid;
  gap: 8px;
  grid-template-columns: auto auto minmax(0, 1fr);
  list-style: none;
}

.plato-replay-item summary::-webkit-details-marker {
  display: none;
}

.plato-replay-item summary span:last-child {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plato-replay-state {
  border-radius: 999px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 8px;
  text-transform: uppercase;
}

.plato-replay-state.spoke {
  background: var(--accent);
}

.plato-replay-state.silent {
  background: #64748b;
}

.plato-replay-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.plato-replay-meta span {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  padding: 5px 8px;
}

.plato-replay-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 10px;
  padding: 10px 12px;
}

.plato-replay-block h4 {
  color: var(--text);
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.plato-replay-block p,
.plato-replay-block li {
  color: var(--text-secondary);
  line-height: 1.45;
}

.plato-replay-block ul {
  display: grid;
  gap: 7px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.teacher-notes-input {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  padding: 14px;
}

.teacher-notes-input:focus {
  outline: 3px solid var(--accent-light);
  border-color: var(--accent);
}

.teacher-notes-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.teacher-notes-status {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.conversation-timeline-modal {
  align-items: stretch;
  justify-content: center;
  padding: 28px;
}

.timeline-modal-content {
  width: min(1380px, 96vw);
  max-height: 92vh;
  border-radius: 16px;
}

.timeline-modal-header {
  align-items: flex-start;
}

.timeline-modal-subtitle {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.timeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.timeline-legend,
.timeline-zoom-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.timeline-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
}

.timeline-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.timeline-dot-participant { background: var(--accent); }
.timeline-dot-facilitator { background: var(--facilitator); }
.timeline-dot-self { background: #0f766e; }
.timeline-dot-anchor { background: #9f2f52; }

.timeline-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 0;
  min-height: 560px;
  overflow: hidden;
}

.timeline-scroll {
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.72), rgba(255,255,255,0)),
    var(--surface);
  border-right: 1px solid var(--border);
}

.conversation-timeline-chart {
  min-height: 560px;
}

.timeline-summary-strip {
  position: sticky;
  left: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: fit-content;
  max-width: calc(100vw - 420px);
  padding: 12px 16px 4px;
}

.timeline-summary-strip span {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 5px 9px;
}

.conversation-timeline-svg {
  display: block;
}

.timeline-bg {
  fill: var(--surface);
}

.timeline-grid-line {
  stroke: var(--border);
  stroke-width: 1;
  opacity: 0.6;
}

.timeline-lane-line {
  stroke: var(--border);
  stroke-width: 1.5;
}

.timeline-lane-line.speaker {
  stroke: var(--accent-light);
  stroke-width: 2;
}

.timeline-lane-label,
.timeline-axis-label,
.timeline-scale-label {
  fill: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.timeline-axis-label,
.timeline-scale-label {
  fill: var(--text-muted);
  font-size: 11px;
}

.timeline-point {
  cursor: pointer;
}

.timeline-point circle {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 3;
  filter: drop-shadow(0 3px 5px rgba(15, 23, 42, 0.18));
}

.timeline-point.facilitator circle {
  fill: var(--facilitator);
}

.timeline-point.self circle {
  fill: #0f766e;
  stroke: #99f6e4;
  stroke-width: 4;
}

.timeline-point.anchor circle,
.timeline-metric-point.anchor {
  stroke: #9f2f52;
  stroke-width: 3;
}

.timeline-point.favorite circle {
  stroke: #f59e0b;
  stroke-width: 4;
}

.timeline-point text {
  fill: white;
  font-size: 10px;
  font-weight: 800;
  pointer-events: none;
}

.timeline-point .timeline-star {
  fill: #f59e0b;
  font-size: 13px;
}

.timeline-point:focus-visible circle,
.timeline-point:hover circle {
  stroke: var(--text);
  stroke-width: 4;
}

.timeline-metric-point {
  cursor: pointer;
  opacity: 0.82;
  stroke: var(--surface);
  stroke-width: 2;
}

.timeline-metric-point.self {
  stroke: #0f766e;
  stroke-width: 3;
}

.timeline-anchor-marker path {
  fill: #9f2f52;
  stroke: var(--surface);
  stroke-width: 2;
}

.timeline-snippet {
  fill: var(--text-secondary);
  font-size: 11px;
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.timeline-inspector {
  background: var(--surface-alt);
  padding: 18px;
  overflow-y: auto;
}

.timeline-inspector-empty {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.5;
}

.timeline-inspector-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.timeline-inspector-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.timeline-inspector-header strong,
.timeline-inspector-header span {
  display: block;
}

.timeline-inspector-header span {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.timeline-speaker-badge {
  display: grid !important;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: white !important;
  font-size: 0.82rem !important;
  font-weight: 800;
}

.timeline-inspector-text {
  color: var(--text);
  line-height: 1.55;
  margin: 0 0 14px;
}

.timeline-score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.timeline-score-grid span {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  padding: 8px;
}

.timeline-score-grid strong {
  color: var(--text);
  display: block;
  font-size: 1rem;
  margin-top: 2px;
}

.timeline-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.timeline-flags span {
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
}

.timeline-reasoning {
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.5;
  margin: 0 0 14px;
}

.timeline-favorite-btn {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 700;
  padding: 9px 10px;
}

.timeline-favorite-btn.active {
  border-color: #f59e0b;
  background: #fff7ed;
  color: #92400e;
}

.participants-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.participants-table th,
.participants-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.participants-table th {
  background: var(--surface-alt);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}

.participants-table tr:hover {
  background: var(--surface-alt);
}

.participant-name {
  font-weight: 500;
  color: var(--text);
}

.participant-role {
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.speaking-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.speaking-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--facilitator), var(--accent));
  border-radius: 4px;
  transition: width 0.3s ease;
}

@media (max-width: 768px) {
  .analytics-modal {
    width: 95vw;
    margin: 20px;
  }

  .modal-header,
  .modal-body {
    padding: 20px;
  }

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

  .analytics-tool-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .participants-table {
    font-size: 0.9rem;
  }

  .participants-table th,
  .participants-table td {
    padding: 8px 12px;
  }

  .conversation-timeline-modal {
    padding: 10px;
  }

  .timeline-modal-content {
    width: 98vw;
    max-height: 94vh;
  }

  .timeline-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .timeline-modal-body {
    grid-template-columns: 1fr;
  }

  .timeline-inspector {
    border-top: 1px solid var(--border);
    max-height: 260px;
  }

  .timeline-summary-strip {
    max-width: 92vw;
  }
}

/* Transcript Viewer Modal */
.transcript-modal-content {
  max-width: 700px;
  max-height: 85vh;
}

.transcript-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0;
}

.transcript-msg {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.transcript-facilitator {
  background: var(--surface-alt, #f0f4f8);
  border-left: 3px solid var(--facilitator, #6366f1);
}

.transcript-participant {
  background: var(--surface, #fff);
  border-left: 3px solid var(--accent, #3b82f6);
}

.transcript-msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary, #666);
  margin-bottom: 6px;
}

.transcript-sender {
  font-weight: 600;
  color: var(--text, #111);
}

.transcript-move {
  background: var(--facilitator, #6366f1);
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.transcript-time {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted, #999);
}

.transcript-msg-text {
  color: var(--text, #111);
}

/* Session item actions row */
.session-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

/* ---- Role-Aware Auth Layout ---- */

/* Welcome Header (shown when signed out) */
.welcome-header {
  text-align: center;
  margin-bottom: 28px;
  padding: 34px 24px 30px;
  border-radius: 14px;
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(0, 43, 92, 0.10);
  box-shadow: 0 18px 46px rgba(0, 43, 92, 0.06);
  animation: fadeIn 0.4s ease;
}

.welcome-logo {
  display: block;
  width: min(320px, 82vw);
  height: auto;
  object-fit: contain;
  margin: 0 auto 18px;
}

.welcome-badge {
  display: inline-flex;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 43, 92, 0.1);
  color: var(--facilitator);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* Side-by-side columns for auth + guest panel */
.welcome-columns {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 420px);
  gap: 24px;
  align-items: start;
  justify-content: center;
}

.welcome-columns > * {
  position: relative;
  overflow: hidden;
}

.welcome-columns > *::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--facilitator), var(--gold));
  opacity: 0.72;
}

.welcome-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 12px;
}

.welcome-header p {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 520px;
  margin: 0 auto;
}

/* User Header Bar (shown when signed in) */
.user-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  margin-bottom: 28px;
  animation: fadeIn 0.4s ease;
}

.user-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.user-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-brand-mark {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.user-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 600;
  flex-shrink: 0;
}

.user-header-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.user-header-role {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--surface-alt);
  color: var(--text-secondary);
}

.btn-logout {
  padding: 8px 16px;
  background: none;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

/* Auth Card */
.auth-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: 0 18px 44px var(--shadow);
  animation: fadeIn 0.4s ease;
}

#guest-panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,248,250,0.98));
}

/* Auth Tabs */
.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1.5px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1.5px;
}

.auth-tab:hover {
  color: var(--text);
  background: var(--surface-alt);
  border-radius: 8px 8px 0 0;
}

.auth-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Auth Tab Content */
.auth-tab-content {
  display: none;
}

.auth-tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Role Selector */
.role-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.role-chip {
  flex: 1;
  padding: 10px 16px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.role-chip:hover {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--text-secondary);
}

.role-chip.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Dashboard Card (Guest Panel & Role Dashboards) */
.dashboard-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 18px 44px var(--shadow);
  animation: fadeIn 0.4s ease;
}

.paste-text-panel {
  margin-top: 18px;
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(0, 43, 92, 0.05), rgba(232, 168, 23, 0.04));
  border: 1px solid rgba(0, 43, 92, 0.14);
}

.paste-text-panel label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--facilitator);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.paste-text-panel textarea {
  width: 100%;
  min-height: 150px;
  padding: 14px 16px;
  border: 1.5px solid rgba(0, 43, 92, 0.16);
  border-radius: 14px;
  background: rgba(255,255,255,0.9);
  line-height: 1.6;
}

.paste-text-panel textarea:focus {
  outline: none;
  border-color: var(--facilitator);
  box-shadow: 0 0 0 4px rgba(0, 43, 92, 0.08);
}

.paste-text-actions {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.dashboard-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px 0;
}

.dashboard-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 20px;
}

.dashboard-card .form-group {
  max-width: 100%;
}

/* Dashboard Container */
.dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.4s ease;
}

/* Dashboard Section */
.dashboard-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dashboard-section h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.timeline-search-row {
  margin-bottom: 14px;
}

.timeline-search-row input {
  width: 100%;
}

.workspace-card#recent-sessions-card,
.dashboard-card,
.auth-card,
.user-header {
  box-shadow: 0 18px 48px rgba(0, 43, 92, 0.06);
  border-color: rgba(0, 43, 92, 0.12);
}

/* ---- Class Card Grid ---- */
.class-grid-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.class-grid-header h3 {
  margin: 0;
}

.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.class-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.9), rgba(246,248,250,0.92));
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  user-select: none;
}

.class-card:hover {
  border-color: rgba(0, 43, 92, 0.35);
  box-shadow: 0 2px 12px var(--shadow);
  transform: translateY(-1px);
}

.class-card-expanded {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 43, 92, 0.18);
}

.class-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.class-card-info {
  flex: 1;
  min-width: 0;
}

.class-card-name {
  display: block;
  font-size: 0.98rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.class-card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.class-card-live {
  background: #d63031;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.06em;
  animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.class-card-code {
  margin-top: 4px;
}

/* Drag and drop on cards */
.class-card-dragging {
  opacity: 0.5;
}

.class-card-drop-above {
  border-top: 3px solid var(--primary);
}

.class-card-drop-below {
  border-bottom: 3px solid var(--primary);
}

/* ---- Expanded Class Card ---- */
.class-expanded-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  animation: fadeIn 0.3s ease;
}

.class-expanded-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.8fr);
  gap: 24px;
  align-items: start;
}

.class-expanded-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.class-expanded-title-row h3 {
  margin: 0;
  flex: 1;
}

.class-expanded-edit-btn,
.class-expanded-close-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1rem;
  transition: background 0.15s;
}

.class-expanded-edit-btn:hover,
.class-expanded-close-btn:hover {
  background: var(--surface-alt);
}

.class-expanded-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
  margin-bottom: 14px;
}

.class-expanded-code-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.room-code-value {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  color: var(--text);
}

.class-expanded-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

/* Right side panels */
.class-start-panel,
.class-live-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.86), rgba(246,248,250,0.9));
  border: 1px solid var(--border);
}

.class-start-panel h4 {
  margin: 0 0 4px 0;
  text-align: center;
}

.class-start-help {
  margin: -2px 0 2px;
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.5;
}

.class-start-panel .form-group {
  margin: 0;
}

.class-start-panel input,
.class-start-panel textarea {
  font-size: 0.85rem;
  padding: 8px 10px;
}

.class-live-panel {
  align-items: center;
  text-align: center;
}

.class-live-panel strong {
  margin: 0;
}

.class-live-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: #d63031;
  border-radius: 50%;
  animation: livePulse 2s ease-in-out infinite;
}

.class-live-panel p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin: 0;
}

.class-start-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.class-start-actions .btn {
  flex: 1 1 180px;
}

.class-materials-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 2px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(246, 248, 250, 0.76);
  border: 1px solid rgba(0, 43, 92, 0.12);
}

.class-materials-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.class-materials-heading h5 {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
}

.upload-area-compact {
  min-height: 0;
  padding: 14px 12px;
}

.upload-area-compact .upload-icon {
  width: 34px;
  height: 34px;
  font-size: 1.1rem;
}

.upload-area-compact p {
  margin: 0;
}

.url-input-row-compact {
  gap: 8px;
}

.url-input-row-compact input {
  min-width: 0;
}

.paste-text-panel-compact {
  padding: 12px;
  border-radius: 12px;
}

.paste-text-panel-compact textarea {
  min-height: 88px;
}

.materials-list-compact {
  max-height: 188px;
  overflow: auto;
}

.empty-state-tight {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

/* Edit mode inside expanded card */
.class-expanded-edit {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.class-edit-actions {
  display: flex;
  gap: 10px;
}

/* ---- Create Class Modal ---- */
.create-class-modal-content {
  max-width: 440px;
}

.room-summary {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.room-summary-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(180px, 0.9fr);
  gap: 18px;
  align-items: stretch;
}

.room-summary-label {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--facilitator);
}

.room-summary h4 {
  font-family: 'Playfair Display', serif;
  font-size: 1.45rem;
  line-height: 1.15;
  margin-bottom: 8px;
}

.room-summary p {
  color: var(--text-secondary);
  line-height: 1.6;
}

.room-code-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 18px;
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(0, 43, 92, 0.12), rgba(232, 168, 23, 0.14)),
    var(--surface-alt);
  border: 1px solid rgba(0, 43, 92, 0.14);
}

.room-code-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.room-code-card strong {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  letter-spacing: 0.08em;
  color: var(--text);
}

.room-code-note {
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.room-summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.room-stat {
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(246,248,250,0.9));
  border: 1px solid rgba(0, 43, 92, 0.1);
}

.room-stat-label {
  display: block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.room-stat strong {
  font-size: 1rem;
  color: var(--text);
}

.room-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.timeline-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.95), rgba(246,248,250,0.98));
}

.timeline-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--facilitator), var(--accent));
  box-shadow: 0 0 0 4px rgba(0, 43, 92, 0.09);
}

.timeline-stem {
  width: 2px;
  flex: 1;
  margin-top: 8px;
  background: linear-gradient(180deg, rgba(0, 43, 92, 0.32), rgba(232, 168, 23, 0.08));
}

.timeline-stem-end {
  opacity: 0;
}

.timeline-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.timeline-subtitle {
  margin-top: 4px;
}

.timeline-stats {
  line-height: 1.55;
}

.timeline-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.timeline-search-hit {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 43, 92, 0.06);
  border: 1px solid rgba(0, 43, 92, 0.12);
}

.timeline-search-hit p {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
}

.timeline-summary {
  margin-top: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.search-hit-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(0, 43, 92, 0.12);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 600;
}

.code-badge {
  font-weight: 700;
  letter-spacing: 0.06em;
}

.code-badge-room {
  background: rgba(0, 43, 92, 0.12);
  color: var(--facilitator);
  border: 1px solid rgba(0, 43, 92, 0.14);
}

.code-badge-session {
  background: rgba(0, 43, 92, 0.11);
  color: var(--accent);
  border: 1px solid rgba(0, 43, 92, 0.14);
}

.timeline-status-tag {
  background: rgba(44, 44, 44, 0.06);
  color: var(--text-secondary);
}

.timeline-expand-icon {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 8px;
  transition: transform 0.2s;
}

.timeline-toggle-row:hover .timeline-expand-icon {
  color: var(--text-secondary);
}

.timeline-details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  animation: fadeIn 0.2s ease;
}

.workspace-item.class-item {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.workspace-item.class-item:hover,
.timeline-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(0, 43, 92, 0.08);
}

.workspace-item.class-item-selected {
  background:
    linear-gradient(135deg, rgba(0, 43, 92, 0.08), rgba(0, 43, 92, 0.05)),
    var(--surface);
  box-shadow: inset 0 0 0 1px rgba(0, 43, 92, 0.12);
}

body {
  background: linear-gradient(180deg, #F8FAFC 0%, #EEF2F6 100%);
}

.welcome-header,
.user-header {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.88), rgba(246,248,250,0.96));
  backdrop-filter: blur(10px);
}

/* Signup Role Fields */
.signup-role-fields {
  display: none;
  margin-top: 16px;
  animation: fadeIn 0.3s ease;
}

.signup-role-fields.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Sign In Prompt */
.signin-prompt {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.signin-prompt p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.btn-signin-link {
  background: none;
  border: none;
  color: var(--accent);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.btn-signin-link:hover {
  text-decoration: underline;
}

/* Auth Form in Card */
.auth-card .form-group {
  margin-bottom: 16px;
}

.auth-card .btn {
  width: 100%;
  margin-top: 8px;
}

.auth-card .btn-row {
  margin-top: 16px;
}

/* Error Messages */
.auth-error {
  background: #fee;
  border: 1px solid #fcc;
  border-radius: var(--radius);
  padding: 12px 16px;
  color: #c33;
  font-size: 0.9rem;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}

.auth-success {
  background: var(--facilitator-light);
  border: 1px solid rgba(0, 43, 92, 0.3);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--facilitator);
  font-size: 0.9rem;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}

/* Responsive Styles */
@media (max-width: 600px) {
  .welcome-header h1 {
    font-size: 1.8rem;
  }

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

  .user-header {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }

  .user-header-right {
    width: 100%;
    justify-content: space-between;
  }

  .user-header-name {
    display: none;
  }

  .auth-card {
    padding: 24px 20px;
    border-radius: 14px;
  }

  .role-selector {
    flex-direction: column;
  }

  .dashboard-card {
    padding: 20px;
  }

  .room-summary-hero,
  .room-summary-metrics,
  .timeline-card,
  .class-expanded-layout,
  .class-expanded-stats {
    grid-template-columns: 1fr;
  }

  .timeline-marker {
    display: none;
  }

  .timeline-actions,
  .room-summary-actions,
  .timeline-header {
    flex-direction: column;
    align-items: stretch;
  }

  .room-wait-actions {
    flex-direction: column;
  }

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

  .class-grid-header {
    flex-direction: column;
    gap: 12px;
  }

  .signin-prompt {
    margin-top: 16px;
    padding-top: 16px;
  }
}

@media (max-width: 480px) {
  .auth-tabs {
    gap: 4px;
  }

  .auth-tab {
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .role-chip {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
}
