:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #e3e8ef;
  --text: #101828;
  --muted: #667085;
  --dark: #0f172a;
  --gold: #c8a24a;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  padding: 0.75rem 1rem;
  cursor: pointer;
}

button:hover {
  background: var(--primary-dark);
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.portal-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    linear-gradient(120deg, rgba(15, 23, 42, 0.88), rgba(15, 118, 110, 0.72)),
    url("/assets/caberg-booking-logo.png") center/28rem no-repeat,
    #0f172a;
}

.login-panel {
  width: min(100%, 430px);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 14px;
  padding: 2rem;
  box-shadow: var(--shadow);
}

.login-panel img {
  width: 96px;
  height: auto;
  margin-bottom: 1.25rem;
}

.login-panel h1,
.portal-topbar h1,
.lesson-header h2,
.empty-state h2 {
  margin: 0;
  letter-spacing: 0;
}

.login-panel p {
  color: var(--muted);
}

.login-panel form {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  color: var(--text);
  background: #fff;
}

.form-error {
  min-height: 1.2rem;
  margin: 0;
  color: var(--danger) !important;
  font-weight: 700;
}

.portal-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}

.portal-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem;
  background: var(--dark);
  color: #fff;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-lockup img {
  width: 42px;
  height: auto;
}

.brand-lockup span,
.learner-card small,
.course-progress,
.lesson-meta {
  color: var(--muted);
}

.brand-lockup strong {
  display: block;
}

.course-list {
  display: grid;
  gap: 0.75rem;
  overflow-y: auto;
  padding-right: 0.15rem;
}

.course-button {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
}

.course-button.active,
.course-button:hover {
  background: rgba(200, 162, 74, 0.16);
  border-color: rgba(200, 162, 74, 0.55);
}

.course-button small {
  display: block;
  margin-top: 0.3rem;
  color: rgba(255, 255, 255, 0.66);
}

.secondary-button {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.portal-main {
  min-width: 0;
  padding: 1.5rem;
}

.portal-topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.learner-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.learner-card span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ecfdf3;
  color: var(--primary-dark);
  font-weight: 800;
}

.course-workspace {
  display: grid;
  grid-template-columns: minmax(250px, 340px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.lesson-outline,
.lesson-stage,
.empty-state {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.lesson-outline {
  padding: 1rem;
  max-height: calc(100vh - 8.5rem);
  overflow-y: auto;
}

.outline-module {
  margin-bottom: 1rem;
}

.outline-module > strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.outline-submodule {
  margin: 0 0 0.65rem 0.4rem;
}

.outline-submodule > span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.lesson-button {
  width: 100%;
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 0.55rem;
  align-items: start;
  text-align: left;
  background: transparent;
  color: var(--text);
  padding: 0.58rem;
  border-radius: 8px;
  font-weight: 700;
}

.lesson-button:hover,
.lesson-button.active {
  background: #ecfdf3;
  color: var(--primary-dark);
}

.lesson-button span:first-child {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 0.68rem;
}

.lesson-button.completed span:first-child {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.lesson-stage {
  overflow: hidden;
}

.lesson-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.lesson-header p {
  color: var(--muted);
}

.lesson-body {
  padding: 1.25rem;
}

.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #020617;
  border-radius: 12px;
  overflow: hidden;
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.video-actions button {
  background: #111827;
}

.video-select {
  min-height: 38px;
  max-width: 148px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font-weight: 800;
  padding: 0 0.65rem;
}

.video-actions button[aria-pressed="true"] {
  background: var(--primary);
  color: #fff;
}

.video-quality-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  margin-left: 0.35rem;
  text-transform: uppercase;
}

.text-lesson,
.quiz-card {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  line-height: 1.65;
}

.empty-state {
  padding: 3rem;
  text-align: center;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  max-width: 360px;
  background: var(--dark);
  color: #fff;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
}

@media (max-width: 980px) {
  .portal-shell,
  .course-workspace {
    grid-template-columns: 1fr;
  }

  .portal-sidebar {
    position: static;
    height: auto;
  }

  .portal-topbar,
  .lesson-header {
    align-items: stretch;
    flex-direction: column;
  }
}
