:root {
  --ink: #17332f;
  --ink-soft: #526965;
  --forest: #0d4036;
  --forest-deep: #082d27;
  --mint: #dff2e8;
  --lime: #cde96b;
  --sun: #f4c96b;
  --paper: #f7f5ee;
  --white: #ffffff;
  --line: #d9dfd5;
  --rose: #ffe4df;
  --danger: #a6382b;
  --shadow: 0 20px 50px rgba(13, 64, 54, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(205, 233, 107, 0.21), transparent 27rem),
    radial-gradient(circle at 96% 22%, rgba(244, 201, 107, 0.18), transparent 25rem),
    var(--paper);
  font-family: Aptos, "Segoe UI", Candara, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

a {
  color: inherit;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(300px, 1.1fr) minmax(430px, 0.9fr);
}

.auth-story {
  position: relative;
  overflow: hidden;
  display: flex;
  min-height: 620px;
  flex-direction: column;
  justify-content: space-between;
  padding: 54px clamp(32px, 7vw, 110px);
  color: var(--white);
  background: var(--forest);
}

.auth-story::before,
.auth-story::after {
  position: absolute;
  border-radius: 999px;
  content: "";
  pointer-events: none;
}

.auth-story::before {
  width: 420px;
  height: 420px;
  top: -230px;
  right: -160px;
  border: 2px solid rgba(205, 233, 107, 0.34);
  box-shadow: 0 0 0 44px rgba(205, 233, 107, 0.07), 0 0 0 88px rgba(205, 233, 107, 0.05);
}

.auth-story::after {
  width: 300px;
  height: 300px;
  bottom: -168px;
  left: -100px;
  background: rgba(244, 201, 107, 0.22);
}

.brand,
.topbar-brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  font-family: Cambria, Constantia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: normal;
}

.brand-logo {
  display: block;
  width: 190px;
  height: auto;
  filter: brightness(0) invert(1);
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px 11px 11px 2px;
  color: var(--forest);
  background: var(--lime);
  font-family: Aptos, sans-serif;
  font-size: 16px;
  font-weight: 800;
}

.auth-copy {
  position: relative;
  z-index: 1;
  max-width: 620px;
  padding: 70px 0;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--lime);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.auth-copy h1 {
  max-width: 600px;
  margin: 0;
  font-family: Cambria, Constantia, "Times New Roman", serif;
  font-size: clamp(42px, 5vw, 72px);
  font-weight: 500;
  letter-spacing: normal;
  line-height: 0.98;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 38px;
}

.auth-card {
  width: min(100%, 440px);
  animation: rise-in 0.56s ease-out both;
}

.auth-card h2 {
  margin: 0;
  font-family: Cambria, Constantia, "Times New Roman", serif;
  font-size: 36px;
  font-weight: 500;
  letter-spacing: normal;
}

.auth-card > p {
  margin: 10px 0 28px;
  color: var(--ink-soft);
}

.form-stack {
  display: grid;
  gap: 17px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: #31534c;
  font-size: 14px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  padding: 13px 14px;
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 4px rgba(13, 64, 54, 0.11);
}

.form-note {
  margin: -4px 0 3px;
  color: var(--ink-soft);
  font-size: 13px;
}

.primary-button,
.secondary-button,
.text-button,
.danger-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 12px;
  padding: 11px 17px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.primary-button {
  color: var(--white);
  background: var(--forest);
  box-shadow: 0 10px 20px rgba(13, 64, 54, 0.2);
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--forest-deep);
  box-shadow: 0 14px 24px rgba(13, 64, 54, 0.25);
}

.secondary-button {
  color: var(--forest);
  background: var(--mint);
}

.secondary-button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: #ccebdc;
}

.text-button {
  min-height: auto;
  padding: 4px 0;
  color: var(--forest);
  background: transparent;
}

.text-button:hover {
  text-decoration: underline;
}

.danger-button {
  color: var(--danger);
  background: var(--rose);
}

.auth-switch {
  margin: 24px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.auth-switch button {
  border: 0;
  padding: 0;
  color: var(--forest);
  background: transparent;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
}

.demo-note {
  margin-top: 26px;
  border: 1px solid #d5e7df;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: #31534c;
  background: #edf8f1;
  font-size: 13px;
}

.demo-note strong {
  display: block;
  margin-bottom: 5px;
  color: var(--forest);
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(217, 223, 213, 0.82);
  padding: 14px max(24px, calc((100vw - 1280px) / 2));
  color: var(--white);
  background: rgba(8, 45, 39, 0.95);
  backdrop-filter: blur(13px);
}

.topbar-brand .brand-logo {
  width: 148px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.year-select {
  min-width: 132px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 10px;
  padding: 9px 34px 9px 11px;
  color: var(--white);
  background-color: rgba(255, 255, 255, 0.1);
}

.year-select option {
  color: var(--ink);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: var(--forest);
  background: var(--sun);
  font-size: 13px;
  font-weight: 900;
}

.logout-button {
  min-height: auto;
  padding: 6px 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 13px;
}

.page {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding: 42px 0 64px;
  animation: rise-in 0.42s ease-out both;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 27px;
}

.page-heading h1,
.course-heading h1 {
  margin: 0;
  font-family: Cambria, Constantia, "Times New Roman", serif;
  font-size: clamp(31px, 4vw, 48px);
  font-weight: 500;
  letter-spacing: normal;
  line-height: 1;
}

.page-heading p {
  margin: 10px 0 0;
  color: var(--ink-soft);
}

.role-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--forest);
  background: var(--mint);
  font-size: 12px;
  font-weight: 800;
}

.progress-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  min-height: 245px;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: stretch;
  border-radius: var(--radius-lg);
  color: var(--white);
  background: linear-gradient(115deg, var(--forest) 0%, #176354 100%);
  box-shadow: var(--shadow);
}

.progress-hero::after {
  position: absolute;
  width: 440px;
  height: 440px;
  top: -250px;
  right: -126px;
  border: 42px solid rgba(205, 233, 107, 0.15);
  border-radius: 50%;
  content: "";
}

.progress-main,
.progress-aside {
  position: relative;
  z-index: 1;
  padding: 34px;
}

.progress-main {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.progress-main p {
  max-width: 400px;
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
}

.hour-value {
  margin: 12px 0 0;
  color: var(--lime);
  font-family: Cambria, Constantia, "Times New Roman", serif;
  font-size: clamp(64px, 8vw, 94px);
  font-weight: 500;
  letter-spacing: normal;
  line-height: 0.9;
}

.hour-value small {
  margin-left: 7px;
  color: rgba(255, 255, 255, 0.72);
  font-family: Aptos, "Segoe UI", sans-serif;
  font-size: 17px;
  letter-spacing: 0;
}

.progress-aside {
  display: grid;
  gap: 14px;
  align-content: center;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.metric {
  border-radius: var(--radius-md);
  padding: 15px 17px;
  background: rgba(255, 255, 255, 0.1);
}

.metric span {
  display: block;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 25px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 40px 0 17px;
}

.section-heading h2 {
  margin: 0;
  font-family: Cambria, Constantia, "Times New Roman", serif;
  font-size: 27px;
  font-weight: 500;
  letter-spacing: normal;
}

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

.course-card {
  position: relative;
  display: flex;
  min-height: 268px;
  flex-direction: column;
  border: 1px solid rgba(217, 223, 213, 0.9);
  border-radius: var(--radius-md);
  padding: 22px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 22px rgba(18, 64, 54, 0.04);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.course-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 17px 34px rgba(18, 64, 54, 0.12);
}

.course-card h3 {
  margin: 15px 0 9px;
  font-family: Cambria, Constantia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: normal;
  line-height: 1.08;
}

.course-card p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--ink-soft);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.course-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 20px;
  color: #45625c;
  font-size: 13px;
  font-weight: 700;
}

.course-card .text-button {
  margin-top: 13px;
  align-self: flex-start;
}

.status {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.status::before {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.status.not_started {
  color: #a6382b;
  background: #ffe6e3;
}

.status.in_progress {
  color: #8b6010;
  background: #fff2c9;
}

.status.completed {
  color: #176c4a;
  background: #def3e6;
}

.empty-state {
  border: 1px dashed #bfcfc6;
  border-radius: var(--radius-md);
  padding: 45px 24px;
  color: var(--ink-soft);
  text-align: center;
  background: rgba(255, 255, 255, 0.54);
}

.back-link {
  margin-bottom: 22px;
}

.course-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 25px;
}

.video-panel,
.detail-card,
.quiz-card,
.report-card,
.admin-card {
  border: 1px solid rgba(217, 223, 213, 0.9);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.89);
  box-shadow: 0 10px 30px rgba(18, 64, 54, 0.05);
}

.video-frame {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: #082d27;
}

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

.video-info {
  padding: 25px 28px 28px;
}

.course-heading h1 {
  font-size: clamp(32px, 4vw, 50px);
}

.course-heading p {
  max-width: 780px;
  margin: 15px 0 0;
  color: var(--ink-soft);
  font-size: 17px;
}

.inline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 19px;
}

.mini-chip {
  border-radius: 999px;
  padding: 7px 10px;
  color: #45625c;
  background: #edf3ee;
  font-size: 13px;
  font-weight: 700;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  margin-top: 25px;
}

.detail-card {
  display: grid;
  align-content: start;
  gap: 21px;
  padding: 27px;
}

.detail-card h2,
.quiz-card h1,
.report-card h2,
.admin-card h2 {
  margin: 0;
  font-family: Cambria, Constantia, "Times New Roman", serif;
  font-size: 27px;
  font-weight: 500;
  letter-spacing: normal;
}

.detail-item {
  display: grid;
  gap: 5px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.detail-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.detail-item span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-item strong {
  font-size: 15px;
}

.quiz-wrap {
  width: min(850px, 100%);
  margin: 0 auto;
}

.quiz-card {
  padding: clamp(24px, 5vw, 48px);
}

.quiz-card > p {
  margin: 9px 0 30px;
  color: var(--ink-soft);
}

.question-block {
  margin-top: 25px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.question-number {
  color: #557069;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.question-prompt {
  margin: 8px 0 16px;
  font-size: 18px;
  font-weight: 800;
}

.answers {
  display: grid;
  gap: 9px;
}

.answer {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 14px;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.answer:has(input:checked) {
  border-color: var(--forest);
  background: #edf8f1;
}

.answer input {
  margin-top: 4px;
  accent-color: var(--forest);
}

.answer span {
  flex: 1;
}

.quiz-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 31px;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 21px;
}

.stat-card {
  border: 1px solid rgba(217, 223, 213, 0.86);
  border-radius: var(--radius-md);
  padding: 20px;
  background: rgba(255, 255, 255, 0.76);
}

.stat-card span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-family: Cambria, Constantia, "Times New Roman", serif;
  font-size: 35px;
  font-weight: 500;
  letter-spacing: normal;
}

.report-card {
  overflow: hidden;
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 25px 19px;
}

.report-header p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 15px 18px;
  border-top: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: #557069;
  background: #f4f7f2;
  font-size: 11px;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

td strong {
  display: block;
}

td small {
  display: block;
  margin-top: 2px;
  color: var(--ink-soft);
}

.hours-cell {
  color: var(--forest);
  font-weight: 900;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1.06fr 0.94fr;
  gap: 19px;
  margin-bottom: 23px;
}

.admin-card {
  padding: 25px;
}

.admin-card > p {
  margin: 8px 0 21px;
  color: var(--ink-soft);
  font-size: 14px;
}

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

.form-grid .field.full {
  grid-column: 1 / -1;
}

.sync-template {
  margin: 0 0 13px;
  border-radius: 11px;
  padding: 12px;
  color: #31534c;
  background: #edf8f1;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  white-space: pre-wrap;
}

.modal-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 45, 39, 0.54);
  backdrop-filter: blur(6px);
}

.modal {
  width: min(100%, 455px);
  border-radius: var(--radius-lg);
  padding: 35px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 28px 74px rgba(0, 0, 0, 0.28);
  animation: pop-in 0.24s ease-out both;
}

.result-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  color: var(--forest);
  background: var(--lime);
  font-size: 27px;
  font-weight: 900;
}

.result-mark.failed {
  color: var(--danger);
  background: var(--rose);
}

.modal h2 {
  margin: 18px 0 8px;
  font-family: Cambria, Constantia, "Times New Roman", serif;
  font-size: 33px;
  font-weight: 500;
  letter-spacing: normal;
}

.modal p {
  margin: 0 0 23px;
  color: var(--ink-soft);
}

.toast {
  position: fixed;
  z-index: 40;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 48px));
  transform: translateY(24px);
  border-radius: 13px;
  padding: 13px 16px;
  color: var(--white);
  background: var(--forest-deep);
  box-shadow: 0 15px 30px rgba(8, 45, 39, 0.26);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.loading {
  display: grid;
  min-height: 100vh;
  place-items: center;
  color: var(--forest);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
}

@keyframes rise-in {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes pop-in {
  from {
    transform: scale(0.96);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 940px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-story {
    min-height: 430px;
    padding: 35px;
  }

  .auth-copy {
    padding: 52px 0;
  }

  .auth-panel {
    padding: 45px 28px 55px;
  }

  .course-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .course-layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar {
    min-height: 70px;
    padding: 12px 18px;
  }

  .user-chip > div,
  .logout-button {
    display: none;
  }

  .topbar-actions {
    gap: 8px;
  }

  .year-select {
    min-width: 112px;
  }

  .page {
    width: min(100% - 32px, 1280px);
    padding-top: 29px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 22px;
  }

  .progress-hero {
    grid-template-columns: 1fr;
  }

  .progress-main,
  .progress-aside {
    padding: 25px;
  }

  .progress-aside {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    border-left: 0;
  }

  .course-grid,
  .dashboard-stats,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .course-card {
    min-height: 235px;
  }

  .report-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-card h2 {
    font-size: 31px;
  }

  .quiz-card {
    border-radius: var(--radius-md);
  }
}
