/* MN Training LMS — shared layout and components
   Layered on top of _design-system/main.css
   Thread: theory (blue) throughout */

/* ─── App bar ─────────────────────────────────────────────── */

.lms-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(251, 250, 247, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
}

.lms-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 4rem;
}

@media (min-width: 768px) {
  .lms-bar-inner { height: 5rem; }
}

.lms-logo img {
  display: block;
  height: 2.5rem;
  width: auto;
}

@media (min-width: 768px) {
  .lms-logo img { height: 3.25rem; }
}

.lms-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.lms-bar-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.lms-bar-nav a {
  font-size: var(--fs-small);
  font-weight: var(--fw-ui);
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.375rem var(--space-1);
  border-radius: var(--radius-sm);
  transition: color 150ms, background 150ms;
}

.lms-bar-nav a:hover {
  color: var(--text-primary);
  background: var(--bg-sunken);
}

.lms-bar-nav a[aria-current="page"] {
  color: var(--text-primary);
  background: transparent;
  border-bottom: 2px solid var(--thread-theory);
  border-radius: 0;
  padding-bottom: calc(0.375rem - 2px);
}

.lms-lang-btn {
  font-size: var(--fs-meta);
  font-weight: var(--fw-ui);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.625rem;
  cursor: pointer;
  transition: all 150ms;
}

.lms-lang-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.lms-signout-btn {
  font-size: var(--fs-meta);
  font-weight: var(--fw-ui);
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: color 150ms;
}

.lms-signout-btn:hover {
  color: var(--text-primary);
}

/* ─── Page shell ──────────────────────────────────────────── */

.lms-page {
  max-width: var(--max-width-text);
  margin: 0 auto;
  padding: var(--space-5) var(--gutter) var(--space-7);
}

.lms-page-wide {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-5) var(--gutter) var(--space-7);
}

.lms-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--fs-meta);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.lms-breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}

.lms-breadcrumb a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.lms-breadcrumb-sep {
  color: var(--text-muted);
}

/* ─── Status badges ───────────────────────────────────────── */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  font-size: var(--fs-meta);
  font-weight: var(--fw-ui);
  border-radius: 999px;
  white-space: nowrap;
}

.status-badge::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

.status-not-started   { background: var(--bg-sunken); color: var(--text-muted); }
.status-submitted     { background: var(--thread-theory-tint); color: var(--thread-theory); }
.status-reviewing     { background: #FFF3CD; color: #856404; }
.status-accepted      { background: var(--thread-tech-tint); color: var(--thread-tech); }
.status-revise        { background: #FFF0E0; color: #B84800; border: 1px solid #FFBE7A; font-size: var(--fs-small); padding: 0.3rem 0.9rem; font-weight: 600; }
.status-revise::before { background: #B84800; opacity: 0.8; width: 7px; height: 7px; }
.status-gate-pending  { background: var(--thread-practice-tint); color: var(--thread-practice); }
.status-gate-passed   { background: var(--thread-tech-tint); color: var(--thread-tech); }

/* ─── Assignment list ─────────────────────────────────────── */

.assignment-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: var(--space-3);
}

.assignment-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 150ms, border-color 150ms, transform 120ms;
}

.assignment-row:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.assignment-row-gate {
  border-left: 3px solid var(--thread-theory);
}

.assignment-row-info {
  flex: 1;
  min-width: 0;
}

.assignment-row-title {
  font-size: var(--fs-body);
  font-weight: var(--fw-ui);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assignment-row-meta {
  font-size: var(--fs-meta);
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.assignment-row-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ─── Assignment detail ───────────────────────────────────── */

.ebook-ref {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--thread-theory-tint);
  border-left: 3px solid var(--thread-theory);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: var(--space-3) 0;
  font-size: var(--fs-small);
  color: var(--thread-theory);
}

.ebook-ref-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.instructions-box {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin: var(--space-3) 0;
}

.instructions-box h3 {
  font-size: var(--fs-small);
  font-weight: var(--fw-ui);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  margin: 0 0 var(--space-2);
}

.instructions-box p,
.instructions-box li {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-primary);
  margin: 0 0 var(--space-1);
}

.submit-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  overflow: hidden;
  margin-top: var(--space-4);
}

.submit-tab {
  flex: 1;
  padding: 0.625rem var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  font-weight: var(--fw-ui);
  background: var(--bg-sunken);
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: background 150ms, color 150ms;
  border-bottom: 2px solid transparent;
}

.submit-tab:first-child {
  border-right: 1px solid var(--border-subtle);
}

.submit-tab[aria-selected="true"] {
  background: var(--bg-raised);
  color: var(--text-primary);
  border-bottom-color: var(--thread-theory);
}

.submit-panel {
  border: 1px solid var(--border-subtle);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: var(--space-3);
  background: var(--bg-raised);
}

.file-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-4);
  border: 1.5px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms, background 150ms;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
  border-color: var(--thread-theory);
  background: var(--thread-theory-tint);
}

.file-drop-zone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-drop-label {
  font-size: var(--fs-small);
  font-weight: var(--fw-ui);
  color: var(--text-secondary);
}

.file-drop-hint {
  font-size: var(--fs-meta);
  color: var(--text-muted);
}

.file-selected {
  font-size: var(--fs-small);
  color: var(--thread-theory);
  font-weight: var(--fw-ui);
  margin-top: var(--space-1);
}

.submit-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-3);
  gap: var(--space-2);
}

/* ─── Review panel ────────────────────────────────────────── */

.review-panel {
  margin-top: var(--space-4);
  padding: var(--space-3);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.review-panel-label {
  font-size: var(--fs-meta);
  font-weight: var(--fw-ui);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  margin-bottom: var(--space-2);
}

.review-panel-note {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-primary);
  white-space: pre-wrap;
}

/* ─── Gate card ───────────────────────────────────────────── */

.gate-card {
  position: relative;
  overflow: hidden;
  background: var(--bg-raised);
  border: 1.5px solid var(--thread-theory);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
  margin: var(--space-4) 0;
  box-shadow: var(--shadow-sm), 0 0 0 4px rgba(45,77,186,0.06);
}

.gate-belt-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--thread-theory-tint);
  color: var(--thread-theory);
  margin: 0 auto var(--space-3);
}

.gate-belt-icon.passed {
  background: var(--thread-tech-tint);
  color: var(--thread-tech);
}

.gate-title {
  font-family: var(--font-serif);
  font-size: var(--fs-h3);
  font-weight: var(--fw-heading);
  color: var(--text-primary);
  margin: 0 0 var(--space-2);
}

.gate-certifies {
  font-size: var(--fs-small);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.gate-status-msg {
  font-size: var(--fs-body);
  font-weight: var(--fw-ui);
  color: var(--text-secondary);
  margin-top: var(--space-2);
}

/* ─── Dashboard ───────────────────────────────────────────── */

.dashboard-greeting {
  font-family: var(--font-serif);
  font-size: var(--fs-h3);
  font-weight: var(--fw-heading);
  color: var(--text-primary);
  margin: 0 0 var(--space-4);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

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

.dashboard-section-label {
  font-size: var(--fs-meta);
  font-weight: var(--fw-ui);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  margin: 0 0 var(--space-2);
}

.next-assignment-card {
  display: block;
  padding: var(--space-3);
  background: var(--bg-raised);
  border: 1.5px solid var(--thread-theory);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm), 0 0 0 0 rgba(45,77,186,0);
  transition: box-shadow 150ms, transform 120ms;
}

.next-assignment-card:hover {
  box-shadow: var(--shadow-md), 0 0 0 3px rgba(45,77,186,0.08);
  transform: translateY(-1px);
}

.next-assignment-id {
  font-size: var(--fs-meta);
  font-weight: var(--fw-ui);
  color: var(--thread-theory);
  margin-bottom: var(--space-1);
}

.next-assignment-title {
  font-size: var(--fs-body);
  font-weight: var(--fw-ui);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.next-assignment-meta {
  font-size: var(--fs-meta);
  color: var(--text-muted);
}

.gates-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.gate-sidebar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  text-decoration: none;
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--border-subtle);
  color: inherit;
}
.gate-sidebar-row:last-child { border-bottom: none; }
.gate-sidebar-row:hover { opacity: 0.75; }

.gate-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-small);
}

.gate-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-subtle);
  flex-shrink: 0;
}

.gate-dot.passed {
  background: var(--thread-tech);
}

.gate-dot.pending {
  background: var(--thread-theory);
}

/* ─── Track view ──────────────────────────────────────────── */

.track-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.track-phase {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.track-phase-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  user-select: none;
}

.track-phase-header:hover {
  background: var(--bg-sunken);
}

.track-phase-title {
  font-size: var(--fs-body);
  font-weight: var(--fw-ui);
  color: var(--text-primary);
}

.track-phase-meta {
  font-size: var(--fs-meta);
  color: var(--text-muted);
}

.track-phase-body {
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-2) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.track-phase-body[hidden] {
  display: none;
}

.track-lesson-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-small);
  padding: 0.25rem 0;
  color: var(--text-secondary);
}

.track-lesson-row.is-assignment {
  color: var(--text-primary);
}

.track-lesson-row.is-gate {
  color: var(--thread-theory);
  font-weight: var(--fw-ui);
}

.track-lesson-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-subtle);
  flex-shrink: 0;
}

.track-lesson-dot.accepted { background: var(--thread-tech); }
.track-lesson-dot.submitted,
.track-lesson-dot.reviewing { background: var(--thread-theory); }
.track-lesson-dot.revise    { background: var(--thread-human); }
.track-lesson-dot.gate      {
  background: var(--thread-theory);
  box-shadow: 0 0 0 2px var(--thread-theory-tint);
}
.track-lesson-dot.gate.passed { background: var(--thread-tech); }

/* ─── Admin pages ─────────────────────────────────────────── */

.queue-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.queue-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  transition: box-shadow 150ms, border-color 150ms;
}
.queue-row:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.queue-row-info {
  flex: 1;
  min-width: 0;
}

.queue-row-title {
  font-size: var(--fs-body);
  font-weight: var(--fw-ui);
  color: var(--text-primary);
}

.queue-row-meta {
  font-size: var(--fs-meta);
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.review-workspace {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.review-pane {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.review-pane-label {
  font-size: var(--fs-meta);
  font-weight: var(--fw-ui);
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--text-muted);
}

.submission-body {
  background: var(--bg-sunken);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-primary);
  max-height: 16rem;
  overflow-y: auto;
}

.review-response-pane {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-4);
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
}

.review-actions + .review-actions {
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
}

.review-actions button:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.review-save-status {
  font-size: var(--fs-meta);
  color: var(--text-muted);
  margin-left: auto;
  align-self: center;
}

/* ─── Feedback history timeline ─────────────────────────── */

.feedback-history {
  margin-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-3);
}

.feedback-history-label {
  font-size: var(--fs-meta);
  font-weight: var(--fw-ui);
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--text-muted);
  margin: 0 0 var(--space-3);
}

.feedback-entry {
  position: relative;
  padding-left: var(--space-4);
  margin-bottom: var(--space-3);
}

.feedback-entry::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
}

.feedback-entry + .feedback-entry::after {
  content: '';
  position: absolute;
  left: 3px;
  bottom: calc(100% + var(--space-1));
  width: 2px;
  height: var(--space-3);
  background: var(--border-subtle);
}

.feedback-entry-header {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: 0.4rem;
}

.feedback-entry-date {
  font-size: var(--fs-meta);
  color: var(--text-muted);
}

.feedback-entry-note {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-primary);
  white-space: pre-wrap;
  margin: 0;
}

.feedback-entry-no-note {
  font-size: var(--fs-meta);
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}

.feedback-older {
  border-top: 1px dashed var(--border-subtle);
  margin-top: var(--space-2);
  padding-top: var(--space-1);
}

/* Learner-facing feedback panel */
.review-panel {
  margin-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-3);
}

.review-panel-label {
  font-size: var(--fs-meta);
  font-weight: var(--fw-ui);
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--text-muted);
  margin: 0 0 var(--space-3);
}

/* ─── Markdown rendered body (submission) ───────────────── */

.md-body { font-size: var(--fs-body); line-height: var(--lh-body); color: var(--text-primary); }
.md-body p  { margin: 0 0 0.75em; }
.md-body p:last-child { margin-bottom: 0; }
.md-body h1,.md-body h2,.md-body h3 { font-family: var(--font-serif); font-weight: 700; margin: 1em 0 0.4em; line-height: 1.2; }
.md-body h1 { font-size: 1.25rem; }
.md-body h2 { font-size: 1.1rem; }
.md-body h3 { font-size: 1rem; }
.md-body ul,.md-body ol { padding-left: 1.4em; margin: 0 0 0.75em; }
.md-body li { margin-bottom: 0.25em; }
.md-body strong { font-weight: var(--fw-ui); }
.md-body em { font-style: italic; }
.md-body code { font-family: monospace; font-size: 0.875em; background: var(--bg-sunken); padding: 0.1em 0.3em; border-radius: 3px; }
.md-body blockquote { border-left: 3px solid var(--border-strong); margin: 0 0 0.75em 0; padding-left: 1em; color: var(--text-muted); }
.md-body hr { border: none; border-top: 1px solid var(--border-subtle); margin: 1em 0; }
.md-body a { color: var(--thread-theory); }

/* ─── WYSIWYG review editor ───────────────────────────────── */

.review-note-editor .toastui-editor-defaultUI {
  border-color: var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
}

.review-note-editor .toastui-editor-toolbar {
  background: var(--bg-raised);
  border-bottom-color: var(--border-subtle);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.review-note-editor .toastui-editor-toolbar-icons {
  border-radius: var(--radius-sm);
}

.review-note-editor .toastui-editor-main {
  background: var(--bg-base);
}

.review-note-editor .toastui-editor-contents {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  color: var(--text-primary);
}

.review-note-editor .toastui-editor-contents h1,
.review-note-editor .toastui-editor-contents h2,
.review-note-editor .toastui-editor-contents h3 {
  font-family: var(--font-serif);
  color: var(--text-primary);
  border-bottom: none !important;
  padding-bottom: 0;
}

.review-note-editor .toastui-editor-contents h1 { font-size: 1.4em; }
.review-note-editor .toastui-editor-contents h2 { font-size: 1.2em; }
.review-note-editor .toastui-editor-contents h3 { font-size: 1.05em; }

.review-note-editor .toastui-editor-contents blockquote {
  border-left-color: var(--border-strong);
  color: var(--text-muted);
}

.review-note-editor .toastui-editor-contents hr {
  display: none;
}

/* ─── Learner detail page ────────────────────────────────── */

.learner-header-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-2);
}

.learner-avatar-lg {
  width: 52px;
  height: 52px;
  font-size: 18px;
  flex-shrink: 0;
}

.learner-header-name {
  font-family: var(--font-serif);
  font-size: var(--fs-h3);
  font-weight: var(--fw-heading);
  margin: 0 0 4px;
  color: var(--text-primary);
}

.learner-header-meta {
  font-size: var(--fs-small);
  color: var(--text-muted);
  margin: 0;
}

.learner-artifacts {
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  margin-top: var(--space-2);
}

.learner-artifact-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.75rem var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  transition: background 120ms;
}
.learner-artifact-row:last-child { border-bottom: none; }
.learner-artifact-row:hover { background: var(--bg-sunken); }
.learner-artifact-row.is-gate {
  border-left: 3px solid var(--thread-theory);
  background: var(--thread-theory-tint);
}
.learner-artifact-row.is-gate:hover { background: #d8e3f5; }

.learner-artifact-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.learner-artifact-id {
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--thread-theory);
  white-space: nowrap;
  flex-shrink: 0;
}

.learner-artifact-title {
  font-size: var(--fs-small);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.learner-artifact-date {
  font-size: var(--fs-meta);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.learner-gates {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.learner-gate-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.learner-gate-note {
  width: 100%;
  font-size: var(--fs-small);
  color: var(--text-secondary);
  margin: var(--space-1) 0 0;
  line-height: var(--lh-body);
  font-style: italic;
}

/* ─── Learner list (admin/learners.html) ─────────────────── */

.learner-list {
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-top: var(--space-3);
}

.learner-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.875rem var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  transition: background 120ms;
}

.learner-row:last-child { border-bottom: none; }
.learner-row:hover { background: var(--bg-sunken); }

.learner-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--thread-theory);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  text-transform: uppercase;
}

.learner-avatar.is-admin {
  background: var(--thread-practice);
}

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

.learner-name {
  font-size: var(--fs-base);
  font-weight: var(--fw-ui);
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.learner-email {
  font-size: var(--fs-meta);
  color: var(--text-muted);
  margin: 1px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.learner-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--bg-sunken);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.learner-role-badge.is-admin {
  background: var(--thread-theory-tint);
  color: var(--thread-theory);
  border-color: transparent;
}

/* ─── Profile menu ────────────────────────────────────────── */

.profile-menu { position: relative; }

.profile-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  cursor: pointer;
  color: var(--text-base);
  font: inherit;
}
.profile-trigger:hover { background: var(--bg-subtle); }

.profile-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--thread-theory);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.profile-chevron { color: var(--text-muted); }

.profile-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.10);
  padding: var(--space-2);
  z-index: 100;
}

.profile-name  { font-weight: 600; margin: 0 0 2px; font-size: var(--fs-base); }
.profile-email { font-size: var(--fs-small); color: var(--text-muted); margin: 0 0 4px; word-break: break-all; }
.profile-role  {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-subtle);
  color: var(--text-base);
  padding: 2px 8px;
  border-radius: 999px;
  margin: 4px 0;
}
.profile-role.is-admin { background: var(--thread-theory); color: white; }

.profile-sep { border: 0; border-top: 1px solid var(--border-subtle); margin: var(--space-2) 0; }

.profile-action {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: var(--space-1) var(--space-2);
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  color: var(--text-base);
}
.profile-action:hover { background: var(--bg-subtle); }

/* ─── Trainer dashboard ───────────────────────────────────── */

.dashboard-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--thread-theory);
  margin: 0 0 var(--space-1);
}

.trainer-stat-card {
  display: block;
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: var(--space-3);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 150ms, border-color 120ms, transform 120ms;
}
.trainer-stat-card:hover {
  border-color: var(--thread-theory);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.trainer-stat-num {
  font-family: var(--font-serif, "Libre Baskerville", serif);
  font-size: 44px;
  line-height: 1;
  margin: 0 0 var(--space-1);
  color: var(--text-base);
}
.trainer-stat-label {
  font-size: var(--fs-small);
  color: var(--text-muted);
  margin: 0;
}

.trainer-learners-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: var(--space-2);
}
.trainer-learner-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2);
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  font-size: var(--fs-small);
  box-shadow: var(--shadow-xs);
  transition: border-color 120ms, box-shadow 150ms;
}
.trainer-learner-row:hover {
  border-color: var(--thread-theory);
  box-shadow: var(--shadow-sm);
}

/* ─── Sign-in page ────────────────────────────────────────── */

/* Honor the `hidden` attribute everywhere — keep CSS display from
   overriding it. Without this, `.signin-shell { display: flex }`
   beats the UA `[hidden] { display: none }` rule. */
[hidden] { display: none !important; }

/* Page-enter fade — masks any initial render artifact on navigation.
   100ms is imperceptible as a transition but long enough to cover
   any flash between HTML parse and first JS execution. */
@keyframes lms-page-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
body {
  animation: lms-page-in 120ms ease-out both;
}

.signin-shell {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-4) var(--gutter);
  background: var(--bg-base);
}

.signin-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-shadow: var(--shadow-lg);
}

.signin-logo {
  display: block;
  width: 100px;
  height: auto;
  margin: 0 auto var(--space-1);
}

.signin-heading {
  font-family: var(--font-serif);
  font-size: var(--fs-h3);
  font-weight: var(--fw-heading);
  text-align: center;
  margin: 0;
}

.signin-sub {
  font-size: var(--fs-small);
  color: var(--text-secondary);
  text-align: center;
  margin: 0;
}

.signin-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.signin-sent-msg {
  font-size: var(--fs-small);
  color: var(--thread-tech);
  text-align: center;
  padding: var(--space-2);
  background: var(--thread-tech-tint);
  border-radius: var(--radius-md);
}

.signin-error-msg {
  font-size: var(--fs-small);
  color: var(--thread-human);
  text-align: center;
  padding: var(--space-2);
  background: var(--thread-human-tint);
  border-radius: var(--radius-md);
}

/* ─── Utilities ───────────────────────────────────────────── */

.lms-page-title {
  font-family: var(--font-serif);
  font-size: var(--fs-h2);
  font-weight: var(--fw-heading);
  color: var(--text-primary);
  margin: 0 0 var(--space-4);
  line-height: var(--lh-heading-sm);
}

.lms-section-label {
  font-size: var(--fs-meta);
  font-weight: var(--fw-ui);
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.lms-empty {
  padding: var(--space-5) var(--space-4);
  text-align: center;
  font-size: var(--fs-body);
  color: var(--text-muted);
  background: var(--bg-raised);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
}

.lms-loading {
  padding: var(--space-4);
  text-align: center;
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.field-label {
  display: block;
  font-size: var(--fs-small);
  font-weight: var(--fw-ui);
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}

/* ─── Motif system (mirrors MN website visual language) ─────── */

.lms-motif {
  display: inline-block;
  width: var(--motif-size, 96px);
  height: var(--motif-size, 96px);
  color: var(--motif-color, var(--thread-theory));
  background-color: currentColor;
  opacity: var(--motif-opacity, 0.18);
  pointer-events: none;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.lms-motif--nature {
  -webkit-mask-image: url("../../images/motifs/nature.svg");
  mask-image: url("../../images/motifs/nature.svg");
}

.lms-motif--certification {
  -webkit-mask-image: url("../../images/motifs/certification.svg");
  mask-image: url("../../images/motifs/certification.svg");
}

.lms-motif--quiet   { --motif-opacity: 0.08; }
.lms-motif--watermark { --motif-opacity: 0.045; }

.lms-motif--field {
  --motif-size: min(34vw, 360px);
  position: absolute;
  z-index: 0;
  pointer-events: none;
}

@media (max-width: 759px) {
  .lms-motif--field { --motif-size: 220px; }
}
