/* ================================================================
   user-styles.css — McGheeLab User System
   Dashboard, Story Editor, Admin Panel, Auth Forms, Opportunities
   ── Dark theme to match main site (--bg, --surface, --accent, etc.)
   ================================================================ */

/* ─── Global select styling ─────────────────────────────────── */
select {
  background: var(--surface, #121620);
  color: var(--text, #eef2f7);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  padding: .5rem .6rem;
  font-family: inherit;
  font-size: .9rem;
}
select option {
  background: var(--surface, #121620);
  color: var(--text, #eef2f7);
}
select:focus {
  outline: none;
  border-color: var(--accent, #5baed1);
  box-shadow: 0 0 0 3px rgba(91,174,209,.2);
}

/* ─── Auth Page ──────────────────────────────────────────────── */
.user-auth-page {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 1rem;
  min-height: 50vh;
}

.auth-cards-row {
  display: flex;
  gap: 2rem;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  width: 100%;
  max-width: 900px;
}

.auth-card {
  background: var(--surface, #121620);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius, 12px);
  padding: 2rem;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow, 0 10px 30px rgba(0,0,0,.25));
}

.auth-card-guest {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.auth-card h2 {
  margin: 0 0 .5rem;
  color: var(--text, #eef2f7);
}

.auth-subtitle {
  color: var(--muted, #a8b3c7);
  margin-bottom: 1.5rem;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  width: 100%;
  padding: .85rem 1.5rem;
  background: #fff;
  color: #3c4043;
  font-weight: 500;
  font-size: 1rem;
  border: 1px solid #dadce0;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
}
.btn-google:hover {
  background: #f7f8f8;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.btn-google:disabled {
  opacity: .6;
  cursor: not-allowed;
}
.google-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
}

.auth-form .form-group {
  margin-bottom: 1rem;
}

.auth-error {
  background: rgba(185,28,28,.15);
  color: #fca5a5;
  padding: .75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: .9rem;
}

/* ─── Forms (shared) ─────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.form-group label {
  font-weight: 600;
  font-size: .875rem;
  color: var(--text, #eef2f7);
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: .6rem .75rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  font-size: .95rem;
  font-family: inherit;
  background: rgba(255,255,255,.04);
  color: var(--text, #eef2f7);
  transition: border-color .15s;
}

.form-group select option {
  background: var(--surface, #121620);
  color: var(--text, #eef2f7);
}

/* Page-level text colors */
.dashboard-page,
.story-editor-page,
.admin-page,
.user-auth-page,
.guide-page,
.opportunities-page {
  color: var(--text, #eef2f7);
}

.dash-card h3,
.editor-header h2,
.admin-page h2 {
  color: var(--text, #eef2f7);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent, #5baed1);
  box-shadow: 0 0 0 3px rgba(91,174,209,.2);
}

.form-status {
  margin-top: .75rem;
  padding: .5rem .75rem;
  border-radius: 6px;
  font-size: .875rem;
}

.form-status.success {
  background: rgba(22,101,52,.2);
  color: #86efac;
}

.form-status.error {
  background: rgba(185,28,28,.15);
  color: #fca5a5;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: .9rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s, filter .15s;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--accent, #5baed1);
  color: #031a16;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.15);
}

.btn-secondary {
  background: var(--surface-2, #1a2030);
  color: var(--text, #eef2f7);
  border: 1px solid rgba(255,255,255,.1);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255,255,255,.08);
}

.btn-danger {
  background: rgba(185,28,28,.15);
  color: #fca5a5;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(185,28,28,.25);
}

.btn-small {
  padding: .35rem .75rem;
  font-size: .8rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  background: var(--surface-2, #1a2030);
  color: var(--text, #eef2f7);
  cursor: pointer;
  font-size: 1rem;
  transition: background .15s;
}

.btn-icon:hover {
  background: rgba(255,255,255,.08);
}

.btn-danger-icon {
  color: #fca5a5;
  border-color: rgba(185,28,28,.3);
}

.btn-danger-icon:hover {
  background: rgba(185,28,28,.15);
}

/* ─── Dashboard ──────────────────────────────────────────────── */
.dashboard-page {
  padding: 1.5rem 1rem;
  max-width: 1000px;
  margin: 0 auto;
  overflow: hidden;
  box-sizing: border-box;
}

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.dash-header h2 {
  margin: 0;
}

.profile-alert {
  background: rgba(251,191,36,.12);
  border: 1px solid rgba(251,191,36,.3);
  color: #fbbf24;
  padding: .75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: .9rem;
}
.profile-alert strong { display: block; margin-bottom: .25rem; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 100%;
  overflow: hidden;
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.dash-card {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius, 12px);
  padding: 1.5rem;
  box-shadow: var(--shadow, 0 10px 30px rgba(0,0,0,.25));
  min-width: 0;
  overflow: hidden;
}

.dash-card-full {
  grid-column: 1 / -1;
}

.dash-card h3 {
  margin: 0 0 1rem;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: .5rem;
}

.card-head h3 {
  margin: 0;
}

.card-head-actions {
  display: flex;
  gap: .35rem;
  align-items: center;
}

/* Profile */
.profile-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-photo-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.profile-photo-preview {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2, #1a2030);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-placeholder {
  font-size: .75rem;
  color: var(--muted, #a8b3c7);
  text-align: center;
}

.upload-label {
  cursor: pointer;
}

/* Stories list */
.stories-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.story-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px;
  gap: .5rem;
}

.story-item-info {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}

.story-item-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text, #eef2f7);
}

.story-item-actions {
  display: flex;
  gap: .35rem;
  flex-shrink: 0;
}

.published-section-label {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted, #a8b3c7);
  margin: .75rem 0 .25rem;
  padding-bottom: .25rem;
  border-bottom: 1px solid var(--border, #2a3040);
}
.published-section-label:first-child { margin-top: 0; }

.empty-state {
  color: var(--muted, #a8b3c7);
  text-align: center;
  padding: 2rem 1rem;
}

.loading-text {
  color: var(--muted, #a8b3c7);
  text-align: center;
}

.error-text {
  color: #fca5a5;
}

/* ─── Status Badges ──────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 9999px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-draft    { background: rgba(255,255,255,.06); color: var(--muted, #a8b3c7); }
.status-pending  { background: rgba(234,179,8,.15); color: #fde68a; }
.status-published { background: rgba(34,197,94,.15); color: #86efac; }
.status-active   { background: rgba(34,197,94,.15); color: #86efac; }
.status-used     { background: rgba(255,255,255,.04); color: rgba(168,179,199,.5); }
.status-expired  { background: rgba(185,28,28,.15); color: #fca5a5; }

/* ─── Story Editor ───────────────────────────────────────────── */
.story-editor-page {
  padding: 1.5rem 1rem;
  max-width: 800px;
  margin: 0 auto;
}

.editor-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.editor-header h2 {
  margin: 0;
}

.story-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.story-form h3 {
  margin: 1rem 0 0;
  color: var(--text, #eef2f7);
}

.hint {
  color: var(--muted, #a8b3c7);
  font-size: .85rem;
  margin: 0;
}

.page-subtitle {
  color: var(--muted, #a8b3c7);
  margin-bottom: 1.5rem;
}

/* Section blocks */
.sections-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section-block {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 1rem;
  background: rgba(255,255,255,.02);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
}

.section-label {
  font-weight: 600;
  font-size: .875rem;
  color: var(--muted, #a8b3c7);
}

.section-controls {
  display: flex;
  gap: .25rem;
}

.section-image-area,
.section-media-area {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-top: .5rem;
}

.image-upload-zone,
.media-upload-zone {
  border: 2px dashed rgba(255,255,255,.15);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-upload-zone:hover,
.image-upload-zone.drag-over,
.media-upload-zone:hover,
.media-upload-zone.drag-over {
  border-color: var(--accent, #5baed1);
  background: rgba(91,174,209,.06);
}

.upload-hint {
  color: var(--muted, #a8b3c7);
  font-size: .85rem;
  margin: 0;
}

.section-img-preview {
  max-width: 100%;
  max-height: 240px;
  border-radius: 6px;
  object-fit: contain;
}

.section-video-preview,
.preview-video {
  max-width: 100%;
  max-height: 300px;
  border-radius: 6px;
}

.story-video {
  width: 100%;
  max-height: 400px;
  border-radius: 6px;
  object-fit: contain;
}

.image-progress,
.media-progress {
  font-size: .85rem;
  color: var(--accent, #5baed1);
}

/* Editor actions bar */
.editor-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,.08);
}

/* ─── Preview Modal ──────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.7);
  padding: 1rem;
}

.modal[hidden] {
  display: none;
}

.modal-content {
  background: var(--surface, #121620);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius, 12px);
  max-width: 800px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem;
}

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

.modal-header h3 {
  margin: 0;
  color: var(--text, #eef2f7);
}

.preview-media {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
  align-items: start;
}

.preview-media.text-only {
  grid-template-columns: 1fr;
}

.preview-img {
  max-width: 100%;
  border-radius: 8px;
}

@media (max-width: 600px) {
  .preview-media {
    grid-template-columns: 1fr;
  }
}

/* ─── Admin Panel ────────────────────────────────────────────── */
.admin-page {
  padding: 1.5rem 1rem;
  max-width: 1000px;
  margin: 0 auto;
}

.admin-page h2 {
  margin: 0 0 1rem;
}

.admin-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid rgba(255,255,255,.08);
  padding-bottom: 0;
  overflow-x: auto;
}

.tab-btn {
  padding: .5rem 1.25rem;
  border: none;
  background: none;
  font-size: .9rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted, #a8b3c7);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text, #eef2f7);
}

.tab-btn.active {
  color: var(--accent, #5baed1);
  border-bottom-color: var(--accent, #5baed1);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.admin-table th {
  text-align: left;
  padding: .5rem .75rem;
  border-bottom: 2px solid rgba(255,255,255,.08);
  font-weight: 600;
  color: var(--muted, #a8b3c7);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.admin-table td {
  padding: .6rem .75rem;
  border-bottom: 1px solid rgba(255,255,255,.04);
  vertical-align: middle;
}

.admin-table tr.row-used td,
.admin-table tr.row-expired td {
  opacity: .5;
}
.admin-guest-badge{
  display: inline-block;
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .1rem .4rem;
  border-radius: 4px;
  background: rgba(91,174,209,.15);
  color: var(--accent, #5baed1);
  vertical-align: middle;
  margin-left: .3rem;
}
.admin-chat-toggle{
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  cursor: pointer;
  font-size: .8rem;
}
.admin-chat-label{
  font-size: .7rem;
  font-weight: 600;
  color: var(--muted, #8a94a6);
}
.admin-edit-row td{
  padding: .5rem .75rem;
  background: rgba(255,255,255,.02);
}
.admin-edit-bio{
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.admin-edit-bio label{
  font-size: .8rem;
  color: var(--muted, #a8b3c7);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.admin-edit-bio textarea{
  width: 100%;
  background: var(--surface, #121620);
  color: var(--text, #eef2f7);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  padding: .5rem;
  font-family: inherit;
  font-size: .85rem;
  resize: vertical;
}

/* ─── Admin Edit Panel (full profile editor) ─────────────── */
.admin-edit-panel{
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: .75rem 0;
}
.admin-edit-section{
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.admin-edit-section > label{
  font-size: .8rem;
  color: var(--muted, #a8b3c7);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.admin-edit-section input[type="text"],
.admin-edit-section input[type="url"],
.admin-edit-section textarea{
  width: 100%;
  background: var(--surface, #121620);
  color: var(--text, #eef2f7);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  padding: .5rem;
  font-family: inherit;
  font-size: .85rem;
}
.admin-edit-section textarea{
  resize: vertical;
  min-height: 4rem;
}
.admin-photo-row{
  display: flex;
  align-items: center;
  gap: .75rem;
}
.admin-photo-preview{
  width: 60px;
  height: 60px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.admin-photo-preview img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.admin-photo-preview .hint{
  font-size: .65rem;
  color: var(--muted, #a8b3c7);
}
.admin-assoc-add{
  display: flex;
  gap: .4rem;
  align-items: center;
  flex-wrap: wrap;
}
.admin-assoc-add input{
  flex: 1;
  min-width: 100px;
}
.admin-edit-status{
  font-size: .85rem;
  padding: .4rem .6rem;
  border-radius: 6px;
}

.role-select {
  padding: .3rem .5rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 4px;
  font-size: .85rem;
  font-family: inherit;
  background: rgba(255,255,255,.04);
  color: var(--text, #eef2f7);
}

.role-select option {
  background: var(--surface, #121620);
}

/* Invitation form */
.inv-form-section {
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.inv-form-section h3 {
  margin: 0 0 .75rem;
}

.inline-form {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.inline-form input,
.inline-form select {
  padding: .5rem .6rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  font-size: .85rem;
  font-family: inherit;
  background: rgba(255,255,255,.04);
  color: var(--text, #eef2f7);
}

.inline-form select option {
  background: var(--surface, #121620);
}

.inline-form input[type="email"] {
  min-width: 180px;
}

.copy-row {
  display: flex;
  gap: .5rem;
  margin-top: .5rem;
}

.copy-row input {
  flex: 1;
  padding: .5rem .75rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  font-size: .85rem;
  font-family: monospace;
  background: rgba(255,255,255,.04);
  color: var(--text, #eef2f7);
}

/* Pending stories */
.pending-card {
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.pending-info strong {
  font-size: 1.05rem;
  color: var(--text, #eef2f7);
}

.pending-author {
  color: var(--muted, #a8b3c7);
  font-size: .85rem;
  margin-left: .5rem;
}

.pending-sections {
  margin: .75rem 0;
}

.pending-section-preview {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  margin-bottom: .5rem;
}

.pending-section-preview p {
  flex: 1;
  font-size: .85rem;
  color: var(--muted, #a8b3c7);
  margin: 0;
}

.pending-section-preview img {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.pending-actions {
  display: flex;
  gap: .5rem;
  margin-top: .75rem;
}

/* Opportunity form in admin */
.opp-form {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

/* ─── Guide Page ─────────────────────────────────────────────── */
.guide-page {
  padding: 1.5rem 1rem;
  max-width: 760px;
  margin: 0 auto;
}

.guide-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.guide-header h2 {
  margin: 0;
}

.guide-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  padding-bottom: 0;
}

.guide-tab {
  background: none;
  border: none;
  color: var(--muted, #a8b3c7);
  font-size: .9rem;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}

.guide-tab:hover {
  color: var(--text, #eef2f7);
}

.guide-tab-active {
  color: var(--accent, #5bd199);
  border-bottom-color: var(--accent, #5bd199);
}

.guide-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.guide-section {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: var(--shadow, 0 10px 30px rgba(0,0,0,.25));
}

.guide-section h3 {
  margin: 0 0 .75rem;
  color: var(--text, #eef2f7);
  font-size: 1.15rem;
}

.guide-section p {
  margin: .5rem 0;
  line-height: 1.6;
}

.guide-section ul {
  margin: .5rem 0;
  padding-left: 1.5rem;
}

.guide-section li {
  margin-bottom: .4rem;
  line-height: 1.5;
}

.guide-section .highlight {
  background: rgba(91,174,209,.15);
  color: var(--accent, #5baed1);
  padding: .1rem .4rem;
  border-radius: 4px;
  font-weight: 600;
}

.guide-tip {
  background: rgba(34,197,94,.1);
  border-left: 3px solid #22c55e;
  padding: .75rem 1rem;
  border-radius: 0 6px 6px 0;
  margin-top: .75rem;
  font-size: .9rem;
  line-height: 1.5;
  color: #86efac;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: .75rem;
  font-size: .9rem;
}

.guide-table th {
  text-align: left;
  padding: .5rem .75rem;
  border-bottom: 2px solid rgba(255,255,255,.08);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted, #a8b3c7);
}

.guide-table td {
  padding: .6rem .75rem;
  border-bottom: 1px solid rgba(255,255,255,.04);
  vertical-align: top;
}

.guide-checklist {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.guide-checklist label {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  font-size: .9rem;
  line-height: 1.5;
  cursor: default;
}

.guide-checklist input[type="checkbox"] {
  margin-top: .25rem;
  flex-shrink: 0;
}

.guide-cta {
  text-align: center;
  background: rgba(91,174,209,.08);
  border: 1px solid rgba(91,174,209,.2);
}

.guide-cta p {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.guide-cta .btn {
  margin: 0 .35rem;
}

/* ─── Opportunities Page ─────────────────────────────────────── */
.opportunities-page {
  padding: 1.5rem 1rem;
  max-width: 900px;
  margin: 0 auto;
}

.opportunities-page h2 {
  margin: 0 0 .25rem;
}

.opportunities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 1.25rem;
}

.opportunity-card {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius, 12px);
  padding: 1.5rem;
  box-shadow: var(--shadow, 0 10px 30px rgba(0,0,0,.25));
}

.opportunity-card h3 {
  margin: .5rem 0;
  color: var(--text, #eef2f7);
}

.opp-type-badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 4px;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  background: var(--accent, #5baed1);
  color: #031a16;
}

.opp-requirements {
  font-size: .9rem;
  color: var(--muted, #a8b3c7);
  margin: .5rem 0;
  line-height: 1.5;
}

.opp-deadline {
  font-size: .85rem;
  color: var(--muted, #a8b3c7);
}

.opp-contact a {
  color: var(--link, #7cc4ff);
  text-decoration: underline;
  font-weight: 600;
}

.empty-state-card {
  text-align: center;
  padding: 3rem 1.5rem;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius, 12px);
  grid-column: 1 / -1;
}

.empty-state-card h3 {
  color: var(--text, #eef2f7);
  margin: 0 0 .5rem;
}

.empty-state-card p {
  color: var(--muted, #a8b3c7);
}

/* ─── Responsive adjustments ─────────────────────────────────── */
@media (max-width: 600px) {
  .inline-form {
    flex-direction: column;
  }

  .inline-form input,
  .inline-form select {
    width: 100%;
  }

  .admin-table {
    font-size: .8rem;
  }

  .admin-table th,
  .admin-table td {
    padding: .4rem .5rem;
  }

  .story-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .story-item-actions {
    width: 100%;
  }
}

/* ================================================================
   ASSOCIATIONS EDITOR (dashboard) — accordion
   ================================================================ */
.assoc-accordion{
  display: flex;
  flex-direction: column;
}
details.assoc-section{
  border-top: 1px solid rgba(255,255,255,.06);
}
details.assoc-section:first-of-type{ border-top: none; }
summary.assoc-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: color .15s;
}
summary.assoc-header::-webkit-details-marker{ display: none; }
summary.assoc-header::after{
  content: '\25B6';
  font-size: .6rem;
  color: var(--muted, #a8b3c7);
  transition: transform .2s;
  margin-left: auto;
  padding-left: .5rem;
}
details.assoc-section[open] > summary.assoc-header::after{
  transform: rotate(90deg);
}
summary.assoc-header:hover{ color: var(--accent, #60a5fa); }
summary.assoc-header h4{
  font-size: .85rem;
  margin: 0;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.assoc-count{
  color: var(--muted, #a8b3c7);
  font-weight: normal;
}
.assoc-check{
  color: #34d399;
  font-weight: bold;
}
.assoc-body{
  padding: 0 0 .75rem;
}
.assoc-item{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .3rem .5rem;
  border-radius: 6px;
  background: rgba(255,255,255,.03);
  margin-bottom: .25rem;
  font-size: .85rem;
}
.assoc-item a{
  color: var(--accent, #60a5fa);
  text-decoration: none;
}
.assoc-item a:hover{ text-decoration: underline; }
.assoc-remove-btn{
  background: none;
  border: none;
  color: var(--muted, #a8b3c7);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 .3rem;
  line-height: 1;
  transition: color .15s;
}
.assoc-remove-btn:hover{ color: #f87171; }
.assoc-form{
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: .5rem;
  border-radius: 8px;
  background: rgba(255,255,255,.03);
  margin-top: .35rem;
}
.assoc-form input{
  background: var(--surface, #121620);
  color: var(--text, #eef2f7);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  padding: .4rem .5rem;
  font-size: .85rem;
}
.assoc-form-actions{
  display: flex;
  gap: .4rem;
}
.assoc-empty{
  font-size: .8rem;
  margin: 0;
}

/* ================================================================
   STORY TEAM SECTION (expanded view in research/projects)
   ================================================================ */

.story-team {
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 1rem;
}

.story-team-heading,
.story-refs-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent, #5baed1);
  margin: 0 0 .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.story-team-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.story-team-member {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px;
  padding: .5rem .75rem;
  min-width: 160px;
}

.story-team-photo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.story-team-photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent, #5baed1);
  color: #031a16;
  font-weight: 700;
  font-size: 1.1rem;
}

.story-team-info {
  display: flex;
  flex-direction: column;
}

.story-team-name {
  font-weight: 600;
  font-size: .9rem;
  color: var(--text, #eef2f7);
}

.story-team-role {
  font-size: .75rem;
  color: var(--muted, #a8b3c7);
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* ================================================================
   STORY REFERENCES (expanded view)
   ================================================================ */

.story-refs {
  padding: 1rem 0 0;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: 1rem;
}

.story-refs-category {
  margin-bottom: .75rem;
}

.story-refs-category h5 {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text, #eef2f7);
  margin: 0 0 .35rem;
}

.story-refs-category ul {
  list-style: disc;
  margin: 0;
  padding-left: 1.25rem;
}

.story-refs-category li {
  font-size: .85rem;
  line-height: 1.5;
  margin-bottom: .25rem;
}

.story-refs-category a {
  color: var(--link, #7cc4ff);
  text-decoration: underline;
}

.ref-detail {
  color: var(--muted, #a8b3c7);
  font-size: .8rem;
}

/* ================================================================
   REF BADGES (on unopened cards)
   ================================================================ */

.ref-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin: .5rem 0;
}

.ref-badge {
  display: inline-block;
  padding: .2rem .6rem;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-radius: 4px;
  background: var(--accent, #5baed1);
  color: #031a16;
  text-decoration: none;
  transition: opacity .15s;
}

.ref-badge:hover {
  opacity: .8;
}

/* ================================================================
   STORY EDITOR — TEAM FIELDS & REFERENCE BLOCKS
   ================================================================ */

.team-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.team-fields .form-group {
  flex: 1 1 200px;
}

.team-readonly {
  background: rgba(255,255,255,.02) !important;
  color: var(--muted, #a8b3c7) !important;
  cursor: default;
}

.contributor-select-row {
  display: flex;
  gap: .5rem;
}

.contributor-select-row select {
  flex: 1;
}

.contributor-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .5rem;
}

.contributor-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--accent, #5baed1);
  color: #031a16;
  padding: .25rem .6rem;
  border-radius: 16px;
  font-size: .8rem;
  font-weight: 600;
}

.chip-remove {
  background: none;
  border: none;
  color: #031a16;
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: .7;
}

.chip-remove:hover {
  opacity: 1;
}

/* Reference blocks in editor */
.refs-container {
  margin-bottom: 1rem;
}

.ref-block {
  margin-bottom: .5rem;
}

.ref-block-row {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}

.ref-block-row select {
  width: 140px;
  flex-shrink: 0;
}

.ref-block-row input[type="text"],
.ref-block-row input[type="url"] {
  flex: 1;
  min-width: 120px;
}

/* Story checkboxes in project editor */
.stories-pool {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  padding: .75rem;
}

.story-checkbox {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  cursor: pointer;
  padding: .35rem;
  border-radius: 4px;
  transition: background .1s;
}

.story-checkbox:hover {
  background: rgba(255,255,255,.04);
}

.story-checkbox input {
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .story-team-grid {
    flex-direction: column;
  }

  .ref-block-row {
    flex-direction: column;
    align-items: stretch;
  }

  .ref-block-row select {
    width: 100%;
  }

  .team-fields {
    flex-direction: column;
  }

  .wizard-steps {
    flex-wrap: wrap;
  }

  .wizard-step {
    font-size: .75rem;
    padding: .4rem .6rem;
  }

  .proj-story-row {
    flex-wrap: wrap;
  }

  .proj-story-add-row {
    flex-direction: column;
  }
}

/* ================================================================
   PROJECT WIZARD
   ================================================================ */

.project-wizard .wizard-steps {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid rgba(255,255,255,.08);
  padding-bottom: 0;
  overflow-x: auto;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1rem;
  border: none;
  background: none;
  font-size: .85rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted, #a8b3c7);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}

.wizard-step:hover {
  color: var(--text, #eef2f7);
}

.wizard-step.active {
  color: var(--accent, #5baed1);
  border-bottom-color: var(--accent, #5baed1);
}

.wizard-step.completed {
  color: #86efac;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  font-size: .7rem;
  font-weight: 700;
}

.wizard-step.active .step-num {
  background: var(--accent, #5baed1);
  color: #031a16;
}

.wizard-step.completed .step-num {
  background: rgba(34,197,94,.2);
  color: #86efac;
}

.wizard-panel {
  display: none;
}

.wizard-panel.active {
  display: block;
}

.wizard-panel h3 {
  margin: 0 0 1rem;
  color: var(--text, #eef2f7);
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,.08);
}

.wizard-nav-right {
  display: flex;
  gap: .5rem;
}

/* ── Assigned stories list (Step 3) ── */

.proj-story-add-row {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
  align-items: flex-end;
}

.proj-story-add-row select {
  flex: 1;
  padding: .5rem .6rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  font-size: .85rem;
  font-family: inherit;
  background: rgba(255,255,255,.04);
  color: var(--text, #eef2f7);
}

.proj-story-add-row select option {
  background: var(--surface, #121620);
}

.proj-story-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.proj-story-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .75rem;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px;
}

.proj-story-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent, #5baed1);
  color: #031a16;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.proj-story-title {
  flex: 1;
  font-weight: 600;
  color: var(--text, #eef2f7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proj-story-controls {
  display: flex;
  gap: .2rem;
  flex-shrink: 0;
}

/* ── Review summary (Step 5) ── */

.review-summary {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.review-row {
  padding: .5rem 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: .9rem;
  line-height: 1.5;
}

.review-row strong {
  color: var(--accent, #5baed1);
  margin-right: .3rem;
}

.review-row a {
  color: var(--link, #7cc4ff);
}

/* ================================================================
   STORY FEED (Research page)
   ================================================================ */
.page-subtitle {
  color: var(--muted, #a8b3c7);
  margin: -.25rem 0 1.5rem;
}

.story-feed-card {
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.story-feed-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
}

.story-feed-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.story-feed-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent, #5baed1);
  color: #031a16;
  font-weight: 700;
  font-size: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.story-feed-meta {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.story-feed-author {
  font-weight: 600;
  font-size: .95rem;
}

.story-feed-date {
  font-size: .8rem;
  color: var(--muted, #a8b3c7);
}

.story-feed-project {
  font-size: .7rem;
  margin-top: .15rem;
  width: fit-content;
}

.story-feed-title {
  margin: 0 0 .5rem;
  font-size: 1.2rem;
}

.story-feed-desc {
  color: var(--muted, #a8b3c7);
  margin: 0 0 .75rem;
}

/* ── News cover image: horizontal grid layout ── */
.news-has-cover {
  padding: 0;
  overflow: hidden;
}
.news-cover-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 200px;
}
.news-cover-image {
  overflow: hidden;
}
.news-cover-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.news-cover-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.news-has-cover .story-feed-actions {
  margin: 0;
  padding: .75rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.06);
}
.news-has-cover .comments-section {
  padding: 0 1.5rem 1rem;
}
.news-has-cover .expandable-details {
  padding: 0 1.5rem 1rem;
}
@media (max-width: 600px) {
  .news-cover-layout {
    grid-template-columns: 1fr;
  }
  .news-cover-image {
    max-height: 200px;
  }
}

.story-feed-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: .75rem;
  border-top: 1px solid rgba(255,255,255,.06);
}

/* ================================================================
   NEWS CATEGORY BADGE
   ================================================================ */
.news-cat-badge {
  font-size: .7rem;
  margin-top: .15rem;
  width: fit-content;
  background: rgba(91, 174, 209, .15);
  color: var(--accent, #5baed1);
}

/* ================================================================
   REACTIONS
   ================================================================ */
.reaction-bar {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .3rem .6rem;
  border-radius: 100px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: var(--text, #eef2f7);
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.reaction-btn:hover:not([disabled]) {
  background: rgba(255,255,255,.08);
}

.reaction-btn.reacted {
  border-color: var(--accent, #5baed1);
  background: rgba(91,174,209,.15);
}

.reaction-btn[disabled] {
  opacity: .5;
  cursor: default;
}

.reaction-count {
  font-size: .75rem;
  color: var(--muted, #a8b3c7);
}

/* Reaction picker */
.reaction-picker-wrap {
  position: relative;
  display: inline-flex;
}
.reaction-add-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px dashed rgba(255,255,255,.2);
  background: transparent;
  color: var(--muted, #a8b3c7);
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s, border-color .15s;
}
.reaction-add-btn:hover:not([disabled]) {
  background: rgba(255,255,255,.06);
  border-color: var(--accent, #5baed1);
  color: var(--accent, #5baed1);
}
.reaction-add-btn[disabled] {
  opacity: .4;
  cursor: default;
}
.reaction-picker {
  position: absolute;
  bottom: calc(100% + .5rem);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: .25rem;
  padding: .4rem .5rem;
  background: var(--surface, #121620);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
  z-index: 50;
  white-space: nowrap;
}
.reaction-picker[hidden] { display: none; }
.reaction-picker-item {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .1s, transform .1s;
}
.reaction-picker-item:hover {
  background: rgba(255,255,255,.1);
  transform: scale(1.2);
}
.reaction-picker-item.reacted {
  background: rgba(91,174,209,.2);
}

/* ================================================================
   COMMENTS
   ================================================================ */
.comment-toggle {
  background: transparent;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 100px;
  padding: .3rem .6rem;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .85rem;
  color: var(--text, #eef2f7);
  cursor: pointer;
}

.comment-toggle:hover {
  background: rgba(255,255,255,.08);
}

.comments-section {
  padding: .75rem 0 0;
  margin-top: .75rem;
  border-top: 1px solid rgba(255,255,255,.06);
}

.comments-section[hidden] {
  display: none;
}

.comment-item {
  padding: .5rem 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .25rem;
}

.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent, #5baed1);
  color: #031a16;
  font-weight: 700;
  font-size: .75rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.comment-author-btn{
  display: flex;
  align-items: center;
  gap: .4rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
  position: relative;
}
.comment-author-btn:hover strong{
  color: var(--accent, #5baed1);
}

/* Author profile popover */
.author-popover{
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 500;
  min-width: 220px;
  max-width: 300px;
  background: var(--surface, #121620);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  padding: .75rem;
  animation: popFadeIn .15s ease-out;
}
@keyframes popFadeIn{
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.author-popover-content{
  display: flex;
  gap: .6rem;
  align-items: flex-start;
}
.author-popover-photo{
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.author-popover-placeholder{
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent, #5baed1);
  color: #031a16;
  font-weight: 700;
  font-size: 1.1rem;
  width: 48px;
  height: 48px;
  border-radius: 10px;
}
.author-popover-info{
  min-width: 0;
}
.author-popover-info strong{
  display: block;
  font-size: .9rem;
  margin-bottom: .15rem;
}
.author-popover-info p{
  margin: 0;
  font-size: .8rem;
  color: var(--muted, #a8b3c7);
  line-height: 1.4;
  /* clamp to 3 lines */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.comment-date {
  font-size: .75rem;
  color: var(--muted, #a8b3c7);
  margin-left: auto;
}

.comment-text {
  margin: 0;
  font-size: .9rem;
  line-height: 1.5;
}

.comment-form {
  display: flex;
  gap: .5rem;
  margin-top: .75rem;
  align-items: flex-start;
}

.comment-input {
  flex: 1;
  min-height: 40px;
  resize: vertical;
  background: var(--surface, #121620);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  padding: .5rem .75rem;
  color: var(--text, #eef2f7);
  font: inherit;
}

.comment-input:focus {
  outline: none;
  border-color: var(--accent, #5baed1);
}

/* ================================================================
   PROJECT STACK CARDS (Projects page)
   ================================================================ */
.project-stack-card {
  padding: 0;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.project-stack-layout {
  display: grid;
  grid-template-columns: minmax(200px, 360px) 1fr;
  gap: 0;
}

.project-stack-image {
  aspect-ratio: 16/10;
  overflow: hidden;
}

.project-stack-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-stack-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.project-stack-body h3 {
  margin: 0;
  font-size: 1.3rem;
}

.project-stack-metrics {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.project-expanded-section {
  padding: .75rem 1.5rem;
}

.project-expanded-section h4 {
  margin: 0 0 .5rem;
  color: var(--accent, #5baed1);
  font-size: .95rem;
}

.project-stories-section {
  padding: .75rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.06);
}

.project-stories-section h4 {
  margin: 0 0 .75rem;
  color: var(--accent, #5baed1);
  font-size: .95rem;
}

.project-stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: .75rem;
}

.project-story-mini-card {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px;
  padding: .75rem;
}

.project-story-mini-card strong {
  display: block;
  margin-bottom: .25rem;
}

.project-story-mini-card .hint {
  font-size: .8rem;
  color: var(--muted, #a8b3c7);
}

.project-story-mini-card p {
  margin: .25rem 0 0;
  font-size: .85rem;
  color: var(--muted, #a8b3c7);
}

.project-stack-card > .expandable-details {
  padding: 0 1.5rem 1.5rem;
}

@media (max-width: 700px) {
  .project-stack-layout {
    grid-template-columns: 1fr;
  }
  .project-stack-image {
    aspect-ratio: 16/9;
  }
  .project-stack-body {
    padding: 1rem;
  }
  .project-expanded-section,
  .project-stories-section,
  .project-stack-card > .expandable-details {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* ================================================================
   PROJECT COVER IMAGE UPLOAD (editor)
   ================================================================ */
.project-cover-upload {
  margin: .5rem 0;
}

.project-cover-preview {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 16/10;
  background: rgba(255,255,255,.04);
  border: 2px dashed rgba(255,255,255,.12);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .15s;
}

.project-cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-cover-preview:hover {
  border-color: var(--accent, #5baed1);
}

.upload-hint {
  color: var(--muted, #a8b3c7);
  font-size: .85rem;
}

/* ================================================================
   CROP MODAL — square crop overlay for profile photos
   ================================================================ */
.crop-overlay{
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.crop-modal{
  background: var(--surface, #121620);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 1.25rem;
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.crop-modal h3{
  margin: 0;
  font-size: 1.1rem;
  color: var(--text, #eef2f7);
}
.crop-container{
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 60vh;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  touch-action: none;
}
.crop-source{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  user-select: none;
}
.crop-box{
  position: absolute;
  border: 2px solid var(--accent, #5baed1);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.55);
  cursor: move;
  touch-action: none;
}
.crop-box::after{
  /* resize handle — bottom-right corner */
  content: '';
  position: absolute;
  right: 0; bottom: 0;
  width: 18px; height: 18px;
  border-right: 3px solid #fff;
  border-bottom: 3px solid #fff;
  border-radius: 0 0 10px 0;
  cursor: nwse-resize;
}
.crop-actions{
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
}
@media (max-width: 480px){
  .crop-modal{ max-width: 100%; padding: 1rem; }
  .crop-container{ max-height: 50vh; }
}

/* ================================================================
   CLASS SCHEDULER — BME 295C
   ================================================================ */

/* ─── Class Page Layout ─────────────────────────────────────── */
.class-page { padding-bottom: 3rem; }
.class-header { padding: 1.5rem; }
.class-back-link {
  font-size: .85rem;
  color: var(--muted, #a8b3c7);
  text-decoration: none;
  display: inline-block;
  margin-bottom: .5rem;
}
.class-back-link:hover { color: var(--text, #eef2f7); }
.class-subtitle {
  color: var(--muted, #a8b3c7);
  font-size: 1rem;
  margin: .25rem 0 .75rem;
}
.muted-text { color: var(--muted, #a8b3c7); }

/* ─── View Badges ──────────────────────────────────────────── */
.view-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-weight: 700;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.view-badge-admin {
  background: var(--accent, #5baed1);
  color: #031a16;
}

/* ─── Admin Stats Bar ──────────────────────────────────────── */
.admin-stats-bar { margin-bottom: 0; }
.admin-stat-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-stat {
  font-size: .8rem;
  color: var(--muted, #a8b3c7);
  background: rgba(255,255,255,.04);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.06);
}

/* ─── View Switcher Bar (admin preview) ────────────────────── */
.view-switcher-bar {
  margin-bottom: 4px;
  padding: .75rem 0;
}

/* ─── Speaker Progress Indicators ──────────────────────────── */
.speaker-progress {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: .85rem;
  color: var(--text, #eef2f7);
}
.progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
}
.progress-pill--done {
  background: rgba(76,175,80,.15);
  color: #66bb6a;
}
.progress-pill--pending {
  background: rgba(255,255,255,.06);
  color: var(--muted, #a8b3c7);
}

/* ─── Guest Instructions Block ─────────────────────────────── */
.guest-instructions {
  background: rgba(91,174,209,.08);
  border: 1px solid rgba(91,174,209,.15);
  border-radius: 8px;
  padding: .75rem 1rem;
  margin: .75rem 0;
  font-size: .85rem;
  line-height: 1.6;
  color: var(--text, #eef2f7);
}
.guest-instructions p { margin: 0; }
.guest-assignment { margin: .25rem 0 .75rem; }
.guest-assignment--pending {
  color: var(--muted, #a8b3c7);
  font-size: .9rem;
}
.guest-assignment--assigned {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Admin Grid: Names in Availability Cells ──────────────── */
.schedule-avail-names {
  font-size: .7rem;
  color: var(--text, #eef2f7);
  line-height: 1.3;
  word-break: break-word;
}
.schedule-avail-more {
  font-size: .65rem;
  opacity: .7;
}
.schedule-slot-avail {
  cursor: default;
}

/* ─── Schedule Grid ─────────────────────────────────────────── */
.schedule-grid, .availability-grid {
  display: grid;
  grid-template-columns: 140px repeat(5, 1fr);
  gap: 1px;
  background: rgba(255,255,255,.06);
  border-radius: var(--radius, 12px);
  overflow: hidden;
  margin-bottom: 1rem;
}
.schedule-cell {
  background: var(--surface, #121620);
  padding: 10px 8px;
  text-align: center;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
}
.schedule-corner {
  background: var(--bg, #0b0d12);
}
.schedule-day-header {
  background: var(--bg, #0b0d12);
  font-weight: 700;
  color: var(--text, #eef2f7);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.schedule-time-header {
  background: var(--bg, #0b0d12);
  font-weight: 600;
  color: var(--muted, #a8b3c7);
  font-size: .8rem;
  text-align: right;
  padding-right: 12px;
  justify-content: flex-end;
}

/* Slot states */
.schedule-slot-filled {
  background: rgba(91,174,209,.12);
  border: 1px solid rgba(91,174,209,.25);
}
.schedule-speaker-name {
  color: var(--accent, #5baed1);
  font-weight: 600;
  font-size: .8rem;
}
.schedule-slot-available {
  background: rgba(91,209,185,.08);
}
.schedule-avail-count {
  color: rgba(91,209,185,.8);
  font-size: .75rem;
}
.schedule-empty {
  color: var(--muted, #a8b3c7);
  opacity: .5;
  font-size: .8rem;
}

/* ─── Calendar Day Picker ──────────────────────────────────── */
.sched-calendar {
  max-width: 340px;
  margin: 12px 0;
}
.sched-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.sched-cal-header span {
  font-weight: 700;
  font-size: .95rem;
  color: var(--text, #eef2f7);
}
.sched-cal-prev,
.sched-cal-next {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--text, #eef2f7);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: background .15s;
}
.sched-cal-prev:hover,
.sched-cal-next:hover {
  background: rgba(255,255,255,.12);
}
.sched-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.sched-cal-dow {
  text-align: center;
  font-size: .7rem;
  font-weight: 600;
  color: var(--muted, #a8b3c7);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 4px 0;
}
.sched-cal-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: .85rem;
}
.sched-cal-empty {
  background: transparent;
}
.sched-cal-day {
  background: rgba(255,255,255,.04);
  color: var(--text, #eef2f7);
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
  font-weight: 500;
}
.sched-cal-day:hover {
  background: rgba(91,174,209,.15);
}
.sched-cal-selected {
  background: var(--accent, #5baed1) !important;
  color: #031a16;
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(91,174,209,.35);
}
.sched-cal-saved {
  cursor: pointer;
}
.sched-cal-cell {
  position: relative;
}
.sched-cal-dots {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
}
.sched-cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

/* ─── Unified Builder: Side-by-side Calendar + Day Grid ──────── */
.sb-unified {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}
.sb-left {
  flex: 0 0 auto;
}
.sb-right {
  flex: 1;
  min-width: 0;
}
.sb-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.sb-toolbar select {
  font-size: .85rem;
  padding: 4px 8px;
}
#sb-daygrid-wrap {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
}
.sb-daygrid-inner {
  display: grid;
  grid-template-rows: auto;
  grid-auto-rows: 18px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.sb-dg-corner {
  background: var(--bg, #0b0d12);
  position: sticky;
  top: 0;
  z-index: 2;
}
.sb-dg-dayhead {
  background: var(--bg, #0b0d12);
  font-weight: 700;
  font-size: .75rem;
  text-align: center;
  padding: 6px 4px;
  color: var(--text, #eef2f7);
  border-left: 1px solid rgba(255,255,255,.1);
  position: sticky;
  top: 0;
  z-index: 2;
}
.sb-dg-time {
  font-size: .7rem;
  color: var(--muted, #a8b3c7);
  text-align: right;
  padding: 0 6px;
  min-height: 18px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.sb-dg-time.sb-dg-hour {
  border-top: 1px solid rgba(255,255,255,.06);
}
.sb-dg-cell {
  min-height: 18px;
  border-left: 1px solid rgba(255,255,255,.1);
  border-bottom: 1px solid rgba(255,255,255,.02);
  cursor: pointer;
  transition: background .08s;
}
.sb-dg-cell.sb-dg-hour-cell {
  border-top: 1px solid rgba(255,255,255,.06);
}
.sb-dg-cell:hover {
  background: rgba(255,255,255,.06);
}
.sb-dg-cell.sb-dg-block {
  border-left-width: 3px;
  cursor: pointer;
}
.sb-dg-cell.sb-dg-selected {
  background: rgba(91,209,153,.3);
}

/* ─── Settings Toggle Checkboxes ─────────────────────────────── */
.sched-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: .9rem;
  color: var(--text, #eef2f7);
  cursor: pointer;
}
.sched-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent, #5baed1);
  cursor: pointer;
}

/* ─── Session Builder: Session List ──────────────────────────── */
.sb-sessions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sb-session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  gap: 12px;
}
.sb-session-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sb-session-info strong {
  font-size: .9rem;
}

/* ─── Schedule Slot Disabled ─────────────────────────────────── */
.schedule-slot-disabled {
  background: rgba(255,255,255,.02);
  opacity: .3;
}

/* ─── Availability Voting Checkboxes ────────────────────────── */
.schedule-slot-vote { cursor: pointer; }
.vote-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.vote-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.vote-check {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.04);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
}
.vote-label input:checked + .vote-check {
  background: var(--accent, #5baed1);
  border-color: var(--accent, #5baed1);
}
.vote-label input:checked + .vote-check::after {
  content: '\2713';
  color: #031a16;
  font-weight: 700;
  font-size: .9rem;
}
.vote-label:hover .vote-check {
  border-color: var(--accent, #5baed1);
  background: rgba(91,174,209,.12);
}

/* ─── Speaker Form ──────────────────────────────────────────── */
.speaker-form { display: grid; gap: 16px; }
.speaker-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.speaker-form label {
  font-weight: 600;
  font-size: .9rem;
  color: var(--text, #eef2f7);
}
.speaker-form textarea,
.speaker-form input[type="text"],
.speaker-form input[type="url"] {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text, #eef2f7);
  font-size: .9rem;
}
.speaker-form textarea:focus,
.speaker-form input:focus {
  outline: none;
  border-color: var(--accent, #5baed1);
  box-shadow: 0 0 0 3px rgba(91,174,209,.15);
}
.save-status {
  display: inline-block;
  margin-left: 8px;
  font-size: .85rem;
  color: rgba(91,209,185,.9);
}

/* ─── Admin Speaker Table ───────────────────────────────────── */
.scheduler-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.scheduler-table th,
.scheduler-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.scheduler-table th {
  color: var(--muted, #a8b3c7);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .75rem;
}
.scheduler-table td { color: var(--text, #eef2f7); }
.scheduler-table select {
  font-size: .8rem;
  padding: .3rem .4rem;
}

/* ─── Confirmed Speakers Cards ──────────────────────────────── */
.confirmed-speaker-card {
  padding: 1.25rem;
  margin-bottom: 12px;
}
.confirmed-speaker-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: .5rem;
}
.confirmed-speaker-header strong { font-size: 1.05rem; }
.confirmed-speaker-summary {
  color: var(--text, #eef2f7);
  font-size: .9rem;
  line-height: 1.6;
  margin: .5rem 0;
}
.confirmed-speaker-questions {
  margin: .75rem 0;
  padding: .75rem 1rem;
  background: rgba(255,255,255,.03);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.06);
}
.confirmed-speaker-questions h5 {
  margin: 0 0 .5rem;
  font-size: .85rem;
  color: var(--muted, #a8b3c7);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.confirmed-speaker-questions ol {
  margin: 0;
  padding-left: 1.25rem;
}
.confirmed-speaker-questions li {
  margin-bottom: .35rem;
  font-size: .9rem;
  line-height: 1.5;
}

/* ─── Mode Toggle ──────────────────────────────────────────── */
.mode-toggle {
  display: inline-flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
}
.mode-btn {
  padding: 6px 16px;
  font-size: .85rem;
  font-weight: 600;
  background: rgba(255,255,255,.04);
  color: var(--muted, #a8b3c7);
  border: none;
  cursor: pointer;
  transition: all .15s ease;
}
.mode-btn:hover {
  background: rgba(255,255,255,.08);
  color: var(--text, #eef2f7);
}
.mode-btn.mode-active {
  background: var(--accent, #5baed1);
  color: #031a16;
}

/* ─── Slot Definition Rows (Setup Form) ────────────────────── */
.slot-def-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.slot-def-row input[type="time"] {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--text, #eef2f7);
  font-size: .85rem;
}
.slot-def-row input[type="time"]:focus {
  outline: none;
  border-color: var(--accent, #5baed1);
  box-shadow: 0 0 0 3px rgba(91,174,209,.15);
}
.slot-def-row .slot-remove {
  padding: 4px 8px;
  font-size: .9rem;
}

/* ─── Freeform Grid & Heatmap ──────────────────────────────── */
.freeform-grid {
  display: grid;
  gap: 1px;
  background: rgba(255,255,255,.06);
  border-radius: var(--radius, 12px);
  overflow: hidden;
  margin-bottom: 1rem;
}
.ff-cell {
  background: var(--surface, #121620);
  padding: 4px;
  text-align: center;
  font-size: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  user-select: none;
}
.ff-corner { background: var(--bg, #0b0d12); }
.ff-day-header {
  background: var(--bg, #0b0d12);
  font-weight: 700;
  color: var(--text, #eef2f7);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.ff-time-label {
  background: var(--bg, #0b0d12);
  font-weight: 600;
  color: var(--muted, #a8b3c7);
  font-size: .7rem;
  text-align: right;
  padding-right: 6px;
  justify-content: flex-end;
}
.ff-block {
  cursor: pointer;
  transition: background .12s ease;
  position: relative;
  touch-action: none;
}
.ff-block:hover { filter: brightness(1.2); }
.ff-block.ff-selected {
  background: var(--accent, #5baed1) !important;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
}
.ff-count {
  font-size: .65rem;
  font-weight: 700;
  color: rgba(255,255,255,.85);
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}

/* ─── Freeform Legend ──────────────────────────────────────── */
.ff-legend {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.ff-legend-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 18px;
  border-radius: 3px;
  font-size: .6rem;
  font-weight: 600;
  color: rgba(255,255,255,.8);
}

/* ─── Responsive: Schedule Grid ─────────────────────────────── */
@media (max-width: 600px) {
  .schedule-grid, .availability-grid {
    grid-template-columns: 90px repeat(5, 1fr);
    font-size: .75rem;
  }
  .schedule-cell { padding: 6px 4px; min-height: 44px; }
  .schedule-time-header { font-size: .7rem; padding-right: 6px; }
  .schedule-day-header { font-size: .7rem; }
  .vote-check { width: 22px; height: 22px; }
  .scheduler-table { font-size: .75rem; }
  .scheduler-table th, .scheduler-table td { padding: 6px; }
  .freeform-grid { font-size: .65rem; }
  .ff-cell { min-height: 26px; padding: 2px; }
  .ff-time-label { font-size: .6rem; }
  .ff-day-header { font-size: .6rem; }
  .mode-toggle { width: 100%; }
  .mode-btn { flex: 1; text-align: center; }
  .sched-calendar { max-width: 100%; }
  .sched-cal-cell { font-size: .75rem; }
  .sb-unified { flex-direction: column; }
  .sb-left { flex: none; }
  .sb-dg-time { font-size: .6rem; padding: 0 3px; }
  .sb-dg-dayhead { font-size: .65rem; padding: 4px 2px; }
  .sb-dg-cell { min-height: 16px; }
  .sb-session-item { padding: 8px; }
  .sb-session-info strong { font-size: .8rem; }
}

/* ================================================================
   Course Builder — Tabs, sections, nested widgets, DnD, autosave
   ================================================================ */

/* ─── Page wrapper ─────────────────────────────────────────── */
.class-page {
  padding: 0 1rem 2rem;
}
.class-header {
  margin-bottom: .5rem;
}
.cb-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.class-back-link {
  font-size: .85rem;
  color: var(--accent, #5baed1);
  text-decoration: none;
}
.class-back-link:hover { text-decoration: underline; }
.class-subtitle {
  color: var(--muted, #a8b3c7);
  margin: .25rem 0 0;
  font-size: .95rem;
}
.cb-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Autosave status ─────────────────────────────────────── */
.cb-autosave-status {
  font-size: .75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.cb-status-saved {
  color: #5bd19b;
  background: rgba(91,209,155,.1);
}
.cb-status-dirty {
  color: #d1a85b;
  background: rgba(209,168,91,.1);
}
.cb-status-saving {
  color: var(--accent, #5baed1);
  background: rgba(91,174,209,.1);
}
.cb-status-error {
  color: #d15b5b;
  background: rgba(209,91,91,.1);
}

/* ─── Preview banner ──────────────────────────────────────── */
.cb-preview-banner {
  background: rgba(91,174,209,.1);
  border: 1px solid rgba(91,174,209,.2);
  border-radius: 8px;
  padding: .5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: .85rem;
  color: var(--accent, #5baed1);
  font-weight: 500;
}

/* ─── Tab Bar ─────────────────────────────────────────────── */
.cb-tab-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cb-tab-bar::-webkit-scrollbar { display: none; }
.cb-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: .6rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted, #a8b3c7);
  font-family: inherit;
  font-size: .9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color .12s, border-color .12s;
  user-select: none;
}
.cb-tab:hover {
  color: var(--text, #eef2f7);
}
.cb-tab-active {
  color: var(--text, #eef2f7);
  border-bottom-color: var(--accent, #5baed1);
  font-weight: 600;
}
.cb-tab-name {
  pointer-events: auto;
}
.cb-tab-delete {
  background: none;
  border: none;
  color: var(--muted, #a8b3c7);
  cursor: pointer;
  font-size: .8rem;
  padding: 0 2px;
  line-height: 1;
  opacity: 0;
  transition: opacity .12s, color .12s;
}
.cb-tab:hover .cb-tab-delete {
  opacity: 1;
}
.cb-tab-delete:hover {
  color: #d15b5b;
}
.cb-tab-add {
  padding: .6rem .75rem;
  background: none;
  border: none;
  color: var(--muted, #a8b3c7);
  font-size: 1.1rem;
  cursor: pointer;
  transition: color .12s;
  line-height: 1;
}
.cb-tab-add:hover {
  color: var(--accent, #5baed1);
}

/* ─── Add Section Bar ─────────────────────────────────────── */
.cb-add-section-bar {
  display: flex;
  gap: 8px;
  margin-bottom: .75rem;
}

/* ─── Canvas (drop zone) ─────────────────────────────────── */
.cb-canvas {
  min-height: 200px;
  padding: .5rem;
  border-radius: var(--radius, 12px);
  border: 2px dashed rgba(255,255,255,.08);
  transition: border-color .15s;
}
.cb-canvas:empty,
.cb-canvas-readonly {
  border-color: transparent;
  padding: 0;
}
.cb-empty-hint {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted, #a8b3c7);
  font-size: .9rem;
}

/* ─── Section Blocks ──────────────────────────────────────── */
.cb-section {
  background: var(--surface, #121620);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius, 12px);
  margin-bottom: .75rem;
  overflow: visible;
  transition: box-shadow .15s, opacity .15s;
}
.cb-section:hover {
  border-color: rgba(255,255,255,.1);
}
.cb-section.cb-dragging {
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
}
.cb-section-readonly {
  border-color: transparent;
  background: transparent;
}
.cb-section-readonly .cb-section-body {
  padding: .75rem 0;
}
.cb-section-title-readonly {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text, #eef2f7);
  margin: .75rem 0 .25rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.cb-section-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: .4rem .75rem;
  background: rgba(255,255,255,.02);
  border-bottom: 1px solid rgba(255,255,255,.04);
  border-radius: var(--radius, 12px) var(--radius, 12px) 0 0;
  font-size: .8rem;
}
.cb-section-handle {
  cursor: grab;
  color: var(--muted, #a8b3c7);
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  user-select: none;
}
.cb-section-handle:hover {
  background: rgba(255,255,255,.06);
  color: var(--text, #eef2f7);
}
.cb-section-label {
  font-weight: 600;
  color: var(--text, #eef2f7);
}
.cb-section-body {
  padding: 1rem;
}

/* ─── Shared chrome pieces ────────────────────────────────── */
.cb-block-type-badge {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted, #a8b3c7);
  background: rgba(255,255,255,.04);
  padding: 1px 6px;
  border-radius: 4px;
}
.cb-block-actions {
  margin-left: auto;
  display: flex;
  gap: 2px;
}
.cb-block-actions button {
  background: none;
  border: none;
  color: var(--muted, #a8b3c7);
  cursor: pointer;
  font-size: .85rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
  transition: background .12s, color .12s;
}
.cb-block-actions button:hover {
  background: rgba(255,255,255,.06);
  color: var(--text, #eef2f7);
}
.cb-section-remove:hover,
.cb-widget-remove:hover {
  color: #d15b5b !important;
  background: rgba(209,91,91,.1) !important;
}

/* ─── Widget Blocks (nested inside sections) ──────────────── */
.cb-widgets-area {
  padding: 0 1rem .25rem;
  min-height: 8px;
}
.cb-widget {
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.04);
  border-radius: 8px;
  margin-bottom: .5rem;
  overflow: hidden;
}
.cb-widget:hover {
  border-color: rgba(255,255,255,.08);
}
.cb-widget-readonly {
  background: transparent;
  border-color: transparent;
}
.cb-widget-chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: .3rem .6rem;
  background: rgba(255,255,255,.01);
  border-bottom: 1px solid rgba(255,255,255,.03);
  font-size: .75rem;
}
.cb-widget-handle {
  cursor: grab;
  color: var(--muted, #a8b3c7);
  font-size: .85rem;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 3px;
  user-select: none;
}
.cb-widget-handle:hover {
  background: rgba(255,255,255,.06);
  color: var(--text, #eef2f7);
}
.cb-widget.cb-dragging {
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.cb-widget-label {
  font-weight: 500;
  color: var(--muted, #a8b3c7);
  font-size: .75rem;
}
.cb-widget-body {
  padding: .75rem;
}
.cb-widget-readonly .cb-widget-body {
  padding: .5rem 0;
}

/* ─── Add Widget Bar (inside each section) ────────────────── */
.cb-add-widget-bar {
  padding: .35rem 1rem .75rem;
}
.btn-ghost {
  background: transparent;
  border: 1px dashed rgba(255,255,255,.12);
  color: var(--muted, #a8b3c7);
  font-size: .8rem;
}
.btn-ghost:hover {
  border-color: var(--accent, #5baed1);
  color: var(--accent, #5baed1);
  background: rgba(91,174,209,.05);
}

/* ─── Content styles ──────────────────────────────────────── */
.cb-textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px;
  color: var(--text, #eef2f7);
  font-family: inherit;
  font-size: .9rem;
  padding: .6rem .75rem;
  resize: vertical;
  transition: border-color .15s;
}
.cb-textarea:focus {
  outline: none;
  border-color: var(--accent, #5baed1);
}
.cb-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,.08);
  margin: 1rem 0;
}
.cb-link-list {
  padding-left: 1.5rem;
  margin: 0;
}
.cb-link-list li {
  margin-bottom: .4rem;
}
.cb-link-list a {
  color: var(--accent, #5baed1);
}

/* ─── Simulation widget ──────────────────────────────────── */
.cb-sim-view-title {
  margin: 0 0 .75rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text, #eef2f7);
}
.cb-sim-container {
  position: relative;
  border-radius: 10px;
  overflow: visible;
  background: #111;
}
.cb-sim-container:fullscreen,
.cb-sim-container:-webkit-full-screen {
  background: #000;
  padding: 0;
}
.cb-sim-container:fullscreen .cb-sim-iframe,
.cb-sim-container:-webkit-full-screen .cb-sim-iframe {
  height: 100vh !important;
  border: none !important;
  border-radius: 0 !important;
}
.cb-sim-container:fullscreen .cb-sim-toolbar,
.cb-sim-container:-webkit-full-screen .cb-sim-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  opacity: 0;
  transition: opacity .25s;
}
.cb-sim-container:fullscreen .cb-sim-toolbar:hover,
.cb-sim-container:-webkit-full-screen .cb-sim-toolbar:hover {
  opacity: 1;
}
.cb-sim-container:fullscreen .cb-sim-code-panel,
.cb-sim-container:-webkit-full-screen .cb-sim-code-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  max-height: 40vh;
  overflow: auto;
}
.cb-sim-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(0,0,0,.55);
  border-bottom: 1px solid rgba(255,255,255,.08);
  border-radius: 10px 10px 0 0;
}
.cb-sim-toolbar .btn {
  font-size: .78rem;
  padding: 4px 10px;
}
.cb-sim-code-panel {
  border-top: 1px solid rgba(255,255,255,.1);
}
.cb-sim-student-code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: .82rem;
  line-height: 1.5;
  tab-size: 2;
  border-radius: 0;
  border: none;
  background: rgba(0,0,0,.4);
  color: #c5e1a5;
  resize: vertical;
}
.cb-sim-code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: .82rem;
  line-height: 1.5;
  tab-size: 2;
}
.cb-sim-iframe {
  display: block;
  border: none;
  resize: vertical;
  overflow: auto;
  min-height: 150px;
}

/* ─── Text editor & preview ───────────────────────────────── */
.text-preview {
  line-height: 1.7;
  color: var(--text, #eef2f7);
  font-size: .95rem;
}
.text-preview p { margin: 0 0 .75rem; }
.text-preview a { color: var(--accent, #5baed1); text-decoration: underline; }

/* ─── File upload area ────────────────────────────────────── */
.file-upload-area {
  background: rgba(255,255,255,.02);
  border: 1px dashed rgba(255,255,255,.12);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

/* ─── Confirmed speaker cards ─────────────────────────────── */
.confirmed-speaker-card { padding: 1.25rem; margin-bottom: 1rem; }
.confirmed-speaker-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; flex-wrap: wrap; }
.confirmed-speaker-header h4 { margin: 0; }
.confirmed-speaker-summary { color: var(--muted, #a8b3c7); font-size: .9rem; margin: .5rem 0; }
.confirmed-speaker-questions { margin-top: .75rem; font-size: .9rem; }
.confirmed-speaker-questions h5 { margin: 0 0 .35rem; font-size: .85rem; color: var(--accent, #5baed1); }
.confirmed-speaker-questions ol { margin: 0; padding-left: 1.25rem; }
.confirmed-speaker-questions li { margin-bottom: .25rem; }

/* ─── Drop indicator ──────────────────────────────────────── */
.cb-drop-indicator {
  height: 3px;
  background: var(--accent, #5baed1);
  border-radius: 2px;
  margin: 4px 0;
  animation: cb-pulse .8s ease infinite alternate;
}
@keyframes cb-pulse {
  from { opacity: .6; }
  to   { opacity: 1; }
}

/* ─── Dropdowns ───────────────────────────────────────────── */
.cb-mobile-dropdown {
  position: relative;
}
.cb-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  min-width: 180px;
  background: var(--surface, #121620);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  padding: 4px;
  margin-top: 4px;
}
.cb-dropdown-menu.cb-dropdown-open {
  display: flex;
  flex-direction: column;
}
.cb-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: .5rem .75rem;
  background: none;
  border: none;
  color: var(--text, #eef2f7);
  font-family: inherit;
  font-size: .85rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background .12s;
}
.cb-dropdown-item:hover:not(:disabled) {
  background: rgba(255,255,255,.06);
}
.cb-dropdown-item:disabled,
.cb-dropdown-used {
  opacity: .4;
  cursor: default;
}

/* ─── Section Collapse ───────────────────────────────────── */
.cb-section-collapse-toggle {
  background: none;
  border: none;
  color: var(--muted, #a8b3c7);
  cursor: pointer;
  font-size: .75rem;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color .12s, background .12s;
  flex-shrink: 0;
}
.cb-section-collapse-toggle:hover {
  color: var(--text, #eef2f7);
  background: rgba(255,255,255,.06);
}
.cb-section-collapsible {
  transition: opacity .2s ease;
}
.cb-section-collapsible.cb-collapsed {
  display: none;
}

/* ─── Section Header Row (readonly) ──────────────────────── */
.cb-section-header-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: .75rem 0 .25rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.cb-section-header-row .cb-section-title-readonly {
  margin: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* ─── Section Type Styling Hooks ─────────────────────────── */
.cb-section-type-simulations {
  border-left: 3px solid #4fc3f7;
}
.cb-section-type-overview {
  border-left: 3px solid #81c784;
}
.cb-section-type-syllabus {
  border-left: 3px solid #ce93d8;
}
.cb-section-type-schedule {
  border-left: 3px solid #ffb74d;
}
.cb-section-type-speakers {
  border-left: 3px solid #f06292;
}
.cb-section-type-files {
  border-left: 3px solid #90a4ae;
}
.cb-section-type-lectures {
  border-left: 3px solid #aed581;
}
.cb-section-type-homeworks {
  border-left: 3px solid #ffd54f;
}
.cb-section-type-exams {
  border-left: 3px solid #ef5350;
}

/* ─── Settings modal ──────────────────────────────────────── */
.cb-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.cb-modal {
  background: var(--bg, #0b0d12);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius, 12px);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}
.cb-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.cb-modal-header h3 { margin: 0; }
.cb-modal-close {
  background: none;
  border: none;
  color: var(--muted, #a8b3c7);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.cb-modal-close:hover { color: var(--text, #eef2f7); }
.cb-modal-body {
  padding: 1.25rem;
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .cb-header-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .cb-header-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .cb-tab-bar {
    gap: 0;
  }
  .cb-tab {
    padding: .5rem .6rem;
    font-size: .8rem;
  }
}

/* ================================================================
   Lab Apps Hub
   ================================================================ */

.lab-apps-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.lab-apps-header {
  text-align: center;
  margin-bottom: 2.5rem;
}
.lab-apps-header h2 {
  font-size: 2rem;
  margin: 0 0 .4rem;
  color: var(--text, #eef2f7);
}
.lab-apps-subtitle {
  color: var(--muted, #8a94a6);
  font-size: 1rem;
  margin: 0;
}

.lab-apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.lab-app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1.5rem 1.5rem;
  background: var(--surface, #121620);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text, #eef2f7);
  transition: border-color .2s, box-shadow .2s, transform .15s;
  cursor: pointer;
}
.lab-app-card:hover {
  border-color: var(--accent, #5baed1);
  box-shadow: 0 4px 24px rgba(91,174,209,.12);
  transform: translateY(-2px);
}

.lab-app-icon {
  color: var(--accent, #5baed1);
  margin-bottom: 1rem;
}
.lab-app-icon svg {
  width: 40px;
  height: 40px;
}

.lab-app-name {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 .5rem;
}

.lab-app-desc {
  font-size: .85rem;
  color: var(--muted, #8a94a6);
  margin: 0 0 1rem;
  line-height: 1.5;
  flex: 1;
}

.lab-app-status {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .25rem .75rem;
  border-radius: 999px;
}
.lab-app-status--coming-soon {
  background: rgba(255,193,7,.12);
  color: #ffc107;
}
.lab-app-status--active {
  background: rgba(76,175,80,.12);
  color: #4caf50;
}

.lab-app-badge-admin {
  position: absolute;
  top: .75rem;
  right: .75rem;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .15rem .5rem;
  border-radius: 4px;
  background: rgba(233,30,99,.15);
  color: #e91e63;
}

/* ── Embedded App — fills viewport with split-view support ── */

.lab-apps-page--embedded {
  max-width: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: var(--banner-height, 64px);
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: 10;
}

/* ── Pane container (horizontal flex for split view) ──────── */
.lab-app-panes {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* Each pane holds one iframe */
.lab-app-pane {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: var(--bg, #0b0e14);
}
.lab-app-pane--left {
  flex: 100; /* single pane = full width; overridden inline for split */
}
.lab-app-pane--right {
  flex: 50;
}

.lab-app-iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
}

/* Close button on the right pane */
.lab-app-pane-close {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 5;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface, #121620);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  color: var(--muted, #8a94a6);
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s;
}
.lab-app-pane--right:hover .lab-app-pane-close {
  opacity: 1;
}
.lab-app-pane-close:hover {
  color: var(--text, #eef2f7);
  background: var(--surface2, #1a1f2e);
}

/* ── Draggable divider between panes ─────────────────────── */
.lab-app-divider {
  width: 6px;
  background: var(--surface, #121620);
  border-left: 1px solid rgba(255,255,255,.08);
  border-right: 1px solid rgba(255,255,255,.08);
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
  z-index: 2;
}
.lab-app-divider:hover,
.lab-app-divider--active {
  background: rgba(91,174,209,.15);
}
.lab-app-divider-grip {
  width: 2px;
  height: 32px;
  border-radius: 1px;
  background: rgba(255,255,255,.2);
}
.lab-app-divider:hover .lab-app-divider-grip,
.lab-app-divider--active .lab-app-divider-grip {
  background: var(--accent, #5baed1);
}

/* ── Bottom nav bar ──────────────────────────────────────── */
.lab-app-bottom-nav {
  display: flex;
  align-items: center;
  background: rgba(18,22,32,.95);
  border-top: 1px solid rgba(255,255,255,.08);
  padding: .35rem .75rem;
  flex-shrink: 0;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.lab-app-bottom-apps {
  display: flex;
  align-items: center;
  gap: .25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
}
.lab-app-bottom-apps::-webkit-scrollbar { display: none; }

.lab-app-bottom-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .75rem;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--muted, #8a94a6);
  font-size: .8rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.lab-app-bottom-item:hover {
  background: rgba(255,255,255,.06);
  color: var(--text, #eef2f7);
}
.lab-app-bottom-item--active {
  color: var(--accent, #5baed1);
  background: rgba(91,174,209,.1);
  font-weight: 600;
}
/* Second pane highlight */
.lab-app-bottom-item--split {
  color: var(--success, #4caf50);
  background: rgba(76,175,80,.1);
  font-weight: 600;
}

.lab-app-bottom-icon {
  display: flex;
  align-items: center;
}
.lab-app-bottom-icon svg {
  width: 20px;
  height: 20px;
}
.lab-app-bottom-label {
  line-height: 1;
}

/* Split toggle button */
.lab-app-split-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .4rem;
  background: none;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  color: var(--muted, #8a94a6);
  cursor: pointer;
  flex-shrink: 0;
  margin-left: .5rem;
  transition: color .15s, border-color .15s;
}
.lab-app-split-btn:hover {
  color: var(--accent, #5baed1);
  border-color: var(--accent, #5baed1);
}
.lab-apps-page--split .lab-app-split-btn {
  color: var(--accent, #5baed1);
  border-color: var(--accent, #5baed1);
  background: rgba(91,174,209,.08);
}

/* ── Mobile: single pane, bottom nav restyled as mobile tab bar ── */
@media (max-width: 700px) {
  .lab-apps-page--embedded { top: 0; }

  /* Force single-pane on mobile */
  .lab-app-pane--right,
  .lab-app-divider,
  .lab-app-split-btn { display: none !important; }
  .lab-app-pane--left { flex: 100 !important; }

  /* Restyle bottom nav to match mobile bottom bar */
  .lab-app-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 80;
    padding: .4rem
             calc(.75rem + env(safe-area-inset-right, 0px))
             calc(.4rem + env(safe-area-inset-bottom, 0px))
             calc(.75rem + env(safe-area-inset-left, 0px));
    min-height: calc(48px + env(safe-area-inset-bottom, 0px));
  }
  .lab-app-bottom-apps {
    gap: .15rem;
  }
  .lab-app-bottom-item {
    flex-direction: column;
    gap: 2px;
    padding: .25rem .45rem;
    font-size: .6rem;
    min-width: 48px;
    flex: 1;
    justify-content: center;
  }
  .lab-app-bottom-label { display: none; }
  .lab-app-bottom-icon svg {
    width: 22px;
    height: 22px;
  }

  /* Pad iframe content above bottom nav */
  .lab-app-panes {
    padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
  }
}
@media (max-width: 600px) {
  .lab-apps-grid {
    grid-template-columns: 1fr;
  }
  .lab-apps-header h2 {
    font-size: 1.5rem;
  }
}

/* ═══════════════════════════════════════════════════════════════
   MODULE VIEWER — iframe wrapper for learning module pages
   ═══════════════════════════════════════════════════════════════ */
.cb-module-viewer-page {
  margin: -16px;  /* counteract #app padding to go full-width */
}

.cb-module-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .6rem 1.25rem;
  background: var(--surface, #121620);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.cb-module-back {
  display: flex;
  align-items: center;
  gap: .35rem;
  color: var(--accent, #5baed1);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.cb-module-back:hover { text-decoration: underline; }
.cb-module-back svg { width: 14px; height: 14px; flex-shrink: 0; }

.cb-module-center {
  text-align: center;
  min-width: 0;
  flex: 1;
}
.cb-module-progress {
  font-size: .7rem;
  color: var(--muted, #8a94a6);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-right: 8px;
}
.cb-module-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text, #eef2f7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-module-nav {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-shrink: 0;
}
.cb-module-nav-btn {
  display: inline-flex;
  align-items: center;
  padding: .3rem .65rem;
  font-size: .78rem;
  font-weight: 500;
  border-radius: 20px;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.1);
  color: var(--text, #eef2f7);
  background: transparent;
  transition: background .2s, border-color .2s;
  white-space: nowrap;
}
.cb-module-nav-btn:hover {
  background: rgba(255,255,255,.06);
  border-color: var(--accent, #5baed1);
  color: var(--accent, #5baed1);
}
.cb-module-nav-hw {
  background: var(--accent, #5baed1);
  color: #fff;
  border-color: var(--accent, #5baed1);
}
.cb-module-nav-hw:hover {
  background: var(--accent2, #4a9dc0);
  color: #fff;
}
.cb-module-nav-disabled {
  opacity: .3;
  pointer-events: none;
}

.cb-module-iframe-wrap {
  background: #fff;
}
.cb-module-iframe {
  display: block;
  width: 100%;
  min-height: calc(100vh - 120px);
  border: none;
  background: #fff;
}

@media (max-width: 600px) {
  .cb-module-nav-bar {
    flex-wrap: wrap;
    padding: .5rem .75rem;
    gap: .4rem;
  }
  .cb-module-center {
    order: 3;
    flex-basis: 100%;
    text-align: center;
  }
  .cb-module-nav {
    margin-left: auto;
  }
}

/* ═══════════════════════════════════════════════════════════════
   MODULE ADMIN — Card list + file picker modal
   ═══════════════════════════════════════════════════════════════ */

/* ─── Module Cards ────────────────────────────────────────── */
.cb-mod-card {
  display: flex;
  align-items: stretch;
  gap: 8px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.cb-mod-card-handle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  flex-shrink: 0;
}
.cb-mod-card-body {
  flex: 1;
  min-width: 0;
}
.cb-mod-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cb-mod-card-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(91,174,209,.15);
  color: #5baed1;
  font-size: .75rem;
  font-weight: 600;
  flex-shrink: 0;
}
.cb-mod-card-title {
  font-size: .88rem;
  color: var(--text, #eef2f7);
}
.cb-mod-card-file {
  font-size: .75rem;
}
.cb-mod-card-pub {
  margin-left: auto;
  font-size: .75rem;
  color: var(--muted, #8a94a6);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.cb-mod-card-bottom {
  margin-top: 4px;
}
.cb-mod-card-bottom .btn {
  font-size: .75rem;
  padding: 3px 8px;
}
.cb-mod-card > .cb-mod-delete {
  align-self: center;
  flex-shrink: 0;
}

/* ─── File Picker Modal ──────────────────────────────────── */
.cb-fp-modal {
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.cb-fp-search-wrap {
  padding: 0 16px 12px;
}
.cb-fp-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  background: rgba(255,255,255,.06);
  color: var(--text, #eef2f7);
  font-size: .88rem;
}
.cb-fp-search:focus {
  outline: none;
  border-color: var(--accent, #5baed1);
}
.cb-fp-list {
  overflow-y: auto;
  flex: 1;
  padding: 0 16px 16px;
}
.cb-fp-group-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted, #8a94a6);
  padding: 8px 0 4px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  margin-bottom: 2px;
}
.cb-fp-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
.cb-fp-item:hover {
  background: rgba(91,174,209,.1);
}
.cb-fp-item-folder {
  font-size: .7rem;
  font-weight: 600;
  color: var(--accent, #5baed1);
  background: rgba(91,174,209,.1);
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.cb-fp-item-name {
  font-size: .84rem;
  font-weight: 500;
  color: var(--text, #eef2f7);
}
.cb-fp-item-title {
  font-size: .78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ─── Add Module Modal ───────────────────────────────────── */
.cb-addmod-modal {
  max-width: 520px;
}
.cb-addmod-modal .form-group {
  margin-bottom: 14px;
}
.cb-addmod-modal .form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text, #eef2f7);
  margin-bottom: 4px;
}
.cb-addmod-modal select,
.cb-addmod-modal input[type="text"] {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  background: rgba(255,255,255,.06);
  color: var(--text, #eef2f7);
  font-size: .88rem;
}
.cb-addmod-modal select:focus,
.cb-addmod-modal input[type="text"]:focus {
  outline: none;
  border-color: var(--accent, #5baed1);
}
.cb-addmod-results {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 6px;
  border-radius: 6px;
}
.cb-addmod-results:empty {
  display: none;
}
.cb-addmod-noresult {
  padding: 8px;
  text-align: center;
}
.cb-addmod-selected {
  padding: 8px 12px;
  background: rgba(91,174,209,.08);
  border: 1px solid rgba(91,174,209,.2);
  border-radius: 6px;
  font-size: .84rem;
  margin: 0 16px 12px;
}
.cb-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
