:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #eef4f0;
  --ink: #17211b;
  --muted: #65736a;
  --line: #dbe2dd;
  --primary: #146c5c;
  --primary-strong: #0b4e43;
  --accent: #d98f34;
  --danger: #b8332f;
  --warn: #a76512;
  --ok: #16724b;
  --blue: #2f66b0;
  --shadow: 0 12px 32px rgba(23, 33, 27, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans Thai", system-ui, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px clamp(14px, 4vw, 28px);
  background: rgba(246, 247, 244, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 700;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--primary);
}

.brand span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.layout {
  width: min(1380px, 100%);
  margin: 0 auto;
  padding: 18px clamp(14px, 4vw, 28px) 28px;
}

.teacher-workspace {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  transition: grid-template-columns .2s ease;
}

.teacher-workspace.sidebar-collapsed {
  grid-template-columns: 86px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 76px;
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(23, 33, 27, .04);
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.sidebar-title {
  min-width: 0;
  flex: 1;
}

.sidebar-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-link {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 700;
}

.side-link:hover,
.side-link.active {
  color: var(--primary-strong);
  background: var(--surface-soft);
}

.side-link span {
  overflow-wrap: anywhere;
}

.sidebar-toggle {
  margin-left: auto;
  flex: 0 0 auto;
}

.sidebar-collapsed .sidebar {
  padding-inline: 12px;
}

.sidebar-collapsed .sidebar-head {
  justify-content: center;
  padding: 8px 0 14px;
}

.sidebar-collapsed .sidebar-title,
.sidebar-collapsed .side-link span {
  display: none;
}

.sidebar-collapsed .sidebar-head .brand-mark {
  display: none;
}

.sidebar-collapsed .sidebar-toggle {
  margin: 0;
}

.sidebar-collapsed .side-link {
  justify-content: center;
  padding-inline: 0;
}

.teacher-main {
  min-width: 0;
}

.title-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: end;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.field.compact {
  width: min(260px, 100%);
}

.year-field {
  min-width: 160px;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: 24px 14px;
}

.login-panel {
  width: min(980px, 100%);
  margin: auto;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-art {
  min-height: 560px;
  padding: 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: white;
  background:
    linear-gradient(rgba(12, 75, 64, .72), rgba(12, 75, 64, .72)),
    url("https://images.unsplash.com/photo-1509062522246-3755977927d7?auto=format&fit=crop&w=1200&q=80") center/cover;
}

.login-art h1 {
  margin: 0;
  font-size: clamp(34px, 7vw, 64px);
  line-height: 1.05;
}

.login-art p {
  max-width: 480px;
  margin: 16px 0 0;
  color: rgba(255,255,255,.9);
  font-size: 18px;
}

.login-form {
  padding: 30px;
  display: grid;
  align-content: center;
  gap: 16px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 14px;
}

.section-title h2, .section-title h1 {
  margin: 0;
  font-size: clamp(24px, 5vw, 36px);
  line-height: 1.15;
}

.section-title p, .subtle {
  margin: 4px 0 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 14px;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 20px rgba(23, 33, 27, .04);
}

.stat {
  min-height: 100px;
  display: grid;
  align-content: space-between;
  gap: 8px;
}

.stat .value {
  font-size: 30px;
  font-weight: 700;
}

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

.course-card {
  width: 100%;
  min-height: 238px;
  padding: 0;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto;
  grid-template-areas:
    "media main enter"
    "stats stats stats";
  gap: 0;
  align-items: stretch;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(23, 33, 27, .04);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.course-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--course-color, var(--primary)) 38%, var(--line));
  box-shadow: var(--shadow);
}

.course-media {
  grid-area: media;
  min-height: 152px;
  display: flex;
  align-items: end;
  padding: 12px;
  background-position: center;
  background-size: cover;
}

.course-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--course-color, var(--primary));
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}

.course-main {
  grid-area: main;
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  padding: 16px 14px;
}

.course-main strong {
  font-size: 24px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.course-main small {
  color: var(--muted);
  font-weight: 700;
}

.course-kicker {
  width: fit-content;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--course-color, var(--primary));
  background: color-mix(in srgb, var(--course-color, var(--primary)) 10%, white);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.course-progress {
  height: 8px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.course-progress i {
  display: block;
  height: 100%;
  width: var(--pct, 0%);
  border-radius: inherit;
  background: var(--course-color, var(--primary));
}

.course-stats {
  grid-area: stats;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 0 14px 14px;
}

.course-stats span {
  min-height: 64px;
  padding: 10px 8px;
  display: grid;
  align-content: center;
  gap: 2px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #f8faf8;
  color: var(--muted);
  font-size: 13px;
}

.course-stats span:first-child {
  border-radius: 8px 0 0 8px;
}

.course-stats span:last-child {
  border-right: 0;
  border-radius: 0 8px 8px 0;
}

.course-stats b {
  color: var(--ink);
  font-size: 20px;
}

.course-enter {
  grid-area: enter;
  align-self: start;
  padding: 16px 14px 0 0;
  color: var(--course-color, var(--primary));
}

.tabs, .segmented {
  display: flex;
  gap: 6px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.tab, .segment {
  min-height: 38px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
  font-weight: 600;
}

.tab.active, .segment.active {
  color: var(--primary-strong);
  background: white;
  box-shadow: 0 2px 8px rgba(23, 33, 27, .08);
}

.btn {
  min-height: 40px;
  padding: 9px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-weight: 700;
}

.btn:hover { background: var(--primary-strong); }
.btn.secondary { background: #e8eee9; color: var(--ink); }
.btn.secondary:hover { background: #dbe5df; }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.danger { background: var(--danger); }
.btn.icon { width: 40px; padding: 0; }

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

.field label {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}

.hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.input, .textarea, .select {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

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

.student-register-list {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.student-register-list table {
  margin: 0;
}

.student-register-list th:first-child,
.student-register-list td:first-child {
  width: 48px;
  text-align: center;
}

.list {
  display: grid;
  gap: 10px;
}

.check-list {
  max-height: 320px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.check-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 9px;
  padding: 9px;
  border-radius: 8px;
}

.check-row:hover {
  background: var(--surface-soft);
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.assignment-row {
  cursor: grab;
}

.assignment-row.dragging {
  opacity: .58;
  border-color: var(--primary);
}

.drag-handle {
  cursor: grab;
}

.order-badge {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  margin-right: 6px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 800;
}

.row-title {
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.row-meta {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e8eee9;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.ok { color: var(--ok); background: #e2f2ea; }
.pill.warn { color: var(--warn); background: #f8ead8; }
.pill.danger { color: var(--danger); background: #f7dfde; }
.pill.blue { color: var(--blue); background: #e4edf8; }
.pill.muted { color: var(--muted); background: var(--surface-soft); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th, td {
  padding: 11px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  font-size: 13px;
  color: var(--muted);
  background: #f0f4f1;
}

tr:last-child td { border-bottom: 0; }

.drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  background: rgba(23, 33, 27, .36);
}

.drawer.open { display: grid; }

.drawer-panel {
  width: min(680px, 100%);
  max-height: 100vh;
  margin-left: auto;
  overflow-y: auto;
  padding: 18px;
  background: var(--bg);
}

.work-actions-sticky {
  position: sticky;
  bottom: 0;
  z-index: 3;
  padding: 10px;
  margin: 0 -4px -4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(246, 247, 244, .96);
  backdrop-filter: blur(12px);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.empty {
  padding: 26px 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: rgba(255,255,255,.6);
}

.video-box {
  display: grid;
  gap: 10px;
}

.video-screen {
  aspect-ratio: 16/9;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background:
    linear-gradient(rgba(20, 108, 92, .76), rgba(20, 108, 92, .76)),
    url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1000&q=80") center/cover;
  text-align: center;
  padding: 20px;
}

.video-player {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 8px;
  background: #000;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe2dd;
}

.progress span {
  display: block;
  height: 100%;
  width: var(--pct, 0%);
  background: var(--primary);
}

.notice {
  padding: 12px;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #fff5e8;
  color: #68410f;
}

.question-builder {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf9;
}

.question-list {
  display: grid;
  gap: 12px;
}

.question-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.textarea.compact {
  min-height: 70px;
}

.question-review {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.score-cell {
  display: grid;
  gap: 8px;
  min-width: 180px;
}

.grade-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.grade-levels.compact {
  gap: 4px;
}

.grade-chip {
  min-width: 42px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid #c8d8d1;
  border-radius: 999px;
  background: #eef5f1;
  color: var(--primary);
  font-weight: 800;
  cursor: pointer;
}

.grade-chip:hover {
  background: #dcebe5;
  border-color: var(--primary);
}

.grade-levels.compact .grade-chip {
  min-width: 38px;
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.grading-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.grading-summary article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.grading-summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.grading-summary b {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.hidden { display: none !important; }

@media (max-width: 860px) {
  .login-panel { grid-template-columns: 1fr; }
  .login-art { min-height: 280px; padding: 26px; }
  .teacher-workspace { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
  }
  .side-nav {
    display: flex;
    overflow-x: auto;
  }
  .side-link {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .title-actions {
    justify-content: stretch;
  }
  .year-field {
    min-width: 100%;
  }
  .course-grid { grid-template-columns: 1fr; }
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .grading-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-title { align-items: stretch; flex-direction: column; }
  .row { grid-template-columns: 1fr; }
  .row > .actions { justify-content: start; }
}

@media (max-width: 560px) {
  .topbar { align-items: start; }
  .top-actions { flex-wrap: wrap; justify-content: end; }
  .login-form { padding: 22px; }
  .drawer-panel {
    width: 100%;
    min-height: 100vh;
    padding: 14px;
  }
  .drawer-head {
    position: sticky;
    top: 0;
    z-index: 4;
    padding-bottom: 10px;
    background: var(--bg);
  }
  .table-wrap.mobile-card table,
  .table-wrap.mobile-card thead,
  .table-wrap.mobile-card tbody,
  .table-wrap.mobile-card tr,
  .table-wrap.mobile-card th,
  .table-wrap.mobile-card td {
    display: block;
    min-width: 0;
  }
  .table-wrap.mobile-card thead { display: none; }
  .table-wrap.mobile-card tr {
    padding: 10px;
    border-bottom: 1px solid var(--line);
  }
  .table-wrap.mobile-card td {
    padding: 7px 0;
    border: 0;
  }
  .btn { width: 100%; }
  .btn.icon { width: 40px; }
  .actions .btn { width: auto; }
  .course-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "media"
      "main"
      "stats";
    min-height: 0;
  }
  .course-media {
    min-height: 150px;
  }
  .course-enter {
    display: none;
  }
  .course-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 12px 12px;
  }
  .course-stats span,
  .course-stats span:first-child,
  .course-stats span:last-child {
    border-radius: 0;
    border-right: 1px solid var(--line);
  }
.course-stats span:nth-child(2n) {
    border-right: 0;
  }
}

/* Modern product polish */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #eef5f2;
  --ink: #111827;
  --muted: #667085;
  --line: #d9e2df;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --accent: #d97706;
  --danger: #c2410c;
  --warn: #b45309;
  --ok: #15803d;
  --blue: #2563eb;
  --shadow: 0 18px 45px rgba(15, 23, 42, .09);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, .06);
  --radius: 8px;
}

body {
  background:
    linear-gradient(180deg, #eef4f7 0, #f7f8f5 340px, #f4f6f8 100%);
}

.topbar {
  padding-block: 14px;
  background: rgba(255, 255, 255, .82);
  border-bottom: 1px solid rgba(217, 226, 223, .82);
  box-shadow: 0 8px 30px rgba(15, 23, 42, .04);
}

.brand {
  font-size: 17px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #0f766e, #2563eb);
  box-shadow: 0 10px 22px rgba(15, 118, 110, .22);
}

.layout {
  padding-top: 22px;
}

.teacher-workspace {
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 22px;
}

.teacher-workspace.sidebar-collapsed {
  grid-template-columns: 88px minmax(0, 1fr);
}

.sidebar {
  top: 82px;
  padding: 16px;
  border-color: rgba(217, 226, 223, .8);
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.sidebar-head {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(15, 118, 110, .09), rgba(37, 99, 235, .08));
}

.side-nav {
  gap: 8px;
}

.side-link {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid transparent;
  color: #475467;
}

.side-link:hover {
  color: var(--primary-strong);
  border-color: rgba(15, 118, 110, .12);
  background: rgba(15, 118, 110, .06);
}

.side-link.active {
  color: var(--primary-strong);
  border-color: rgba(15, 118, 110, .18);
  background: linear-gradient(135deg, rgba(15, 118, 110, .11), rgba(37, 99, 235, .07));
  box-shadow: 0 8px 18px rgba(15, 118, 110, .08);
}

.section-title {
  margin-bottom: 18px;
}

.section-title h1 {
  font-size: clamp(30px, 5vw, 44px);
  letter-spacing: 0;
}

.section-title h2 {
  font-size: clamp(22px, 4vw, 32px);
}

.card,
.row,
.table-wrap,
.question-builder,
.question-item,
.student-register-list,
.login-panel,
.drawer-panel {
  border-color: rgba(217, 226, 223, .92);
  box-shadow: var(--shadow-soft);
}

.card {
  padding: 18px;
}

.stat {
  min-height: 116px;
  border-top: 3px solid rgba(15, 118, 110, .55);
}

.stat .value {
  color: #0b1220;
  font-size: 34px;
  line-height: 1;
}

.btn {
  min-height: 42px;
  border: 1px solid rgba(15, 118, 110, .08);
  box-shadow: 0 8px 16px rgba(15, 118, 110, .12);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 118, 110, .16);
}

.btn.secondary {
  border-color: rgba(217, 226, 223, .9);
  background: #f3f7f5;
  box-shadow: none;
}

.btn.danger {
  border-color: rgba(194, 65, 12, .1);
  box-shadow: 0 8px 16px rgba(194, 65, 12, .12);
}

.input,
.textarea,
.select {
  min-height: 46px;
  border-color: #d7e0dd;
  background: #fbfdfc;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: 0;
  border-color: rgba(15, 118, 110, .55);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, .1);
}

.pill {
  min-height: 28px;
  border: 1px solid rgba(102, 112, 133, .08);
}

.tabs,
.segmented {
  padding: 6px;
  background: rgba(255, 255, 255, .72);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5);
}

.tab,
.segment {
  min-height: 42px;
  padding-inline: 14px;
}

.tab.active,
.segment.active {
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}

.course-grid {
  grid-template-columns: repeat(auto-fit, minmax(390px, 1fr));
  gap: 18px;
}

.course-card {
  min-height: 270px;
  grid-template-columns: 156px minmax(0, 1fr) auto;
  border: 0;
  background: linear-gradient(180deg, #fff, #fbfdfc);
  box-shadow: 0 18px 38px rgba(15, 23, 42, .09);
}

.course-card::after {
  content: "";
  grid-column: 1 / -1;
  height: 3px;
  background: var(--course-color, var(--primary));
}

.course-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 58px rgba(15, 23, 42, .13);
}

.course-media {
  min-height: 172px;
  padding: 14px;
}

.course-icon {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255,255,255,.35);
}

.course-main {
  padding: 18px 16px 14px;
  gap: 8px;
}

.course-main strong {
  font-size: 27px;
}

.course-kicker {
  padding: 5px 9px;
  background: color-mix(in srgb, var(--course-color, var(--primary)) 12%, white);
}

.course-progress {
  height: 9px;
  background: #e8eef0;
}

.course-stats {
  padding: 0 16px 16px;
}

.course-stats span {
  min-height: 70px;
  background: #f8fafc;
}

.course-stats b {
  font-size: 22px;
}

.row {
  background: rgba(255,255,255,.92);
}

.row:hover {
  border-color: rgba(15, 118, 110, .18);
  box-shadow: 0 12px 28px rgba(15, 23, 42, .07);
}

th {
  background: #f3f7f5;
  color: #475467;
}

tbody tr:hover td {
  background: #fbfdfc;
}

.drawer {
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(6px);
}

.drawer-panel {
  background: #f7f9f8;
}

.login-panel {
  width: min(1040px, 100%);
  box-shadow: 0 28px 70px rgba(15, 23, 42, .14);
}

.login-art {
  background:
    linear-gradient(135deg, rgba(15, 118, 110, .88), rgba(37, 99, 235, .56)),
    url("https://images.unsplash.com/photo-1509062522246-3755977927d7?auto=format&fit=crop&w=1200&q=80") center/cover;
}

.notice {
  border-left-color: var(--accent);
  background: #fff7ed;
}

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

.metric-card {
  border: 1px solid rgba(15, 23, 42, .08);
  background: rgba(255, 255, 255, .94);
  border-radius: 12px;
  padding: 18px;
  display: grid;
  gap: 8px;
  min-height: 150px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .06);
}

.metric-card strong {
  font-size: 34px;
  line-height: 1;
  color: #111827;
}

.metric-card small {
  color: #667085;
}

.metric-icon,
.course-mini-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--metric-color, #0f766e);
  background: color-mix(in srgb, var(--metric-color, #0f766e) 12%, white);
}

.metric-card.teal,
.ring-chart.teal { --metric-color: #0f766e; }
.metric-card.blue,
.ring-chart.blue { --metric-color: #2563eb; }
.metric-card.violet,
.ring-chart.violet { --metric-color: #7c3aed; }
.metric-card.amber,
.ring-chart.amber { --metric-color: #d97706; }

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

.chart-card {
  border: 1px solid rgba(15, 23, 42, .08);
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.ring-chart {
  --pct: 0;
  width: 86px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--metric-color, #0f766e) calc(var(--pct) * 1%), #e7ecea 0);
  position: relative;
}

.ring-chart::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: #fff;
}

.ring-chart span {
  position: relative;
  z-index: 1;
  font-weight: 800;
  color: #111827;
}

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

.dashboard-panel {
  min-height: 100%;
}

.status-bars {
  display: grid;
  gap: 14px;
}

.status-bar-row {
  display: grid;
  gap: 8px;
}

.status-bar-row > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #344054;
}

.status-bar-row span {
  color: #667085;
}

.status-track {
  height: 10px;
  border-radius: 999px;
  background: #edf2f0;
  overflow: hidden;
}

.status-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.status-track .ok { background: #10b981; }
.status-track .warn { background: #f59e0b; }
.status-track .blue { background: #3b82f6; }
.status-track .violet { background: #8b5cf6; }
.status-track .danger { background: #ef4444; }

.course-health-list {
  display: grid;
  gap: 10px;
}

.course-health-row {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, .08);
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}

.course-health-row:hover {
  border-color: color-mix(in srgb, var(--course-color, #0f766e) 32%, #d6dedb);
  box-shadow: 0 12px 24px rgba(15, 23, 42, .06);
}

.course-mini-icon {
  --metric-color: var(--course-color, #0f766e);
}

.course-health-row small {
  display: block;
  color: #667085;
  margin-top: 3px;
}

.course-health-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mini-activity {
  display: grid;
  gap: 14px;
}

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

.activity-summary span {
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 10px;
  padding: 12px;
  background: #f8fbfa;
}

.activity-summary b {
  display: block;
  font-size: 24px;
}

.activity-summary small {
  color: #667085;
}

.compact-list .row {
  padding: 12px;
}

.auto-assist-box {
  border: 1px solid rgba(15, 118, 110, .18);
  background: linear-gradient(135deg, rgba(240, 253, 250, .96), rgba(239, 246, 255, .94));
  border-radius: 12px;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.auto-assist-box b {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #0f766e;
}

.auto-assist-result {
  display: none;
  grid-column: 1 / -1;
  border: 1px solid rgba(15, 118, 110, .16);
  background: rgba(255, 255, 255, .78);
  border-radius: 10px;
  padding: 12px;
  color: #344054;
  line-height: 1.65;
}

.auto-assist-result.show {
  display: block;
}

@media (max-width: 860px) {
  .teacher-workspace {
    gap: 18px;
  }
  .teacher-workspace,
  .teacher-workspace.sidebar-collapsed {
    grid-template-columns: 1fr;
  }
  .sidebar {
    top: auto;
  }
  .sidebar-title,
  .sidebar-collapsed .sidebar-title,
  .sidebar-collapsed .side-link span {
    display: block;
  }
  .sidebar-collapsed .sidebar-head .brand-mark {
    display: grid;
  }
  .sidebar-toggle {
    display: none;
  }
  .side-nav {
    padding-bottom: 4px;
  }
  .course-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-metrics,
  .dashboard-charts,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .course-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "media"
      "main"
      "stats";
  }
}

@media (min-width: 861px) and (max-width: 1180px) {
  .course-grid {
    grid-template-columns: 1fr;
  }
  .course-card {
    min-height: 248px;
    grid-template-columns: 210px minmax(0, 1fr) auto;
  }
}

@media (max-width: 560px) {
  body {
    background: #f6f8f7;
  }
  .layout {
    padding-inline: 10px;
  }
  .topbar {
    padding: 10px;
  }
  .sidebar {
    padding: 12px;
  }
  .section-title h1 {
    font-size: 28px;
  }
  .course-card {
    min-height: 0;
  }
  .course-main strong {
    font-size: 25px;
  }
  .course-stats span {
    min-height: 62px;
  }
  .metric-card {
    min-height: 0;
  }
  .chart-card {
    grid-template-columns: 78px minmax(0, 1fr);
  }
  .ring-chart {
    width: 78px;
  }
  .course-health-row {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .course-health-stats {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .activity-summary {
    grid-template-columns: 1fr;
  }
  .auto-assist-box {
    grid-template-columns: 1fr;
  }
  .auto-assist-box .btn {
    width: 100%;
  }
}
