@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --app-bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #eef4f8;
  --surface-strong: #102331;
  --text: #17212b;
  --muted: #627386;
  --line: #dbe3ea;
  --brand: #0f766e;
  --brand-strong: #115e59;
  --accent: #f59e0b;
  --info: #2563eb;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 8px;
  --shadow-sm: 0 6px 18px rgba(16, 35, 49, 0.08);
  --shadow-md: 0 18px 45px rgba(16, 35, 49, 0.12);
  --page-max: 1180px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 34rem),
    linear-gradient(180deg, #fbfcfd 0%, var(--app-bg) 42%, #f2f5f8 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.theme-indigo {
  --brand: #4f46e5;
  --brand-strong: #3730a3;
  --info: #2563eb;
}

body.theme-slate {
  --brand: #334155;
  --brand-strong: #0f172a;
  --info: #475569;
}

body.theme-rose {
  --brand: #be123c;
  --brand-strong: #881337;
  --info: #e11d48;
}

img,
video,
iframe,
embed,
object {
  max-width: 100%;
}

video,
iframe,
embed,
object {
  border-radius: var(--radius);
}

a {
  color: var(--brand);
}

a:hover {
  color: var(--brand-strong);
}

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

.home-shell {
  display: flex;
  min-height: 100svh;
  flex-direction: column;
  background-image:
    linear-gradient(180deg, rgba(16, 35, 49, 0.28), rgba(16, 35, 49, 0.54)),
    var(--home-bg);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  border-bottom: 1px solid rgba(219, 227, 234, 0.8);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 24px rgba(16, 35, 49, 0.05);
}

.app-navbar {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0.75rem 1rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.brand-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-soft);
}

.brand-fallback {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), #1d4ed8);
  color: #fff;
  font-weight: 800;
}

.platform-settings-form,
.settings-console {
  display: grid;
  gap: 1rem;
}

.settings-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.settings-nav-button {
  display: inline-flex;
  min-height: 2.8rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.62rem 0.85rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.settings-nav-button:hover,
.settings-nav-button.active {
  border-color: color-mix(in srgb, var(--brand) 28%, #cbd5e1);
  background: color-mix(in srgb, var(--brand) 10%, #fff);
  color: var(--brand-strong);
}

.settings-panel {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.settings-panel[hidden] {
  display: none;
}

.settings-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.settings-section {
  display: grid;
  gap: 1rem;
}

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

.responsive-form-grid > div {
  min-width: 0;
}

.responsive-form-grid textarea {
  min-height: 9rem;
}

.settings-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.settings-rich-field {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.settings-rich-editor {
  min-height: 23rem;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface);
}

.settings-rich-editor-sm {
  min-height: 16rem;
}

.settings-rich-editor .ql-editor {
  min-height: inherit;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.settings-save-bar {
  position: sticky;
  bottom: 1rem;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px);
}

.demo-guide-formset {
  display: grid;
  gap: 1rem;
}

.demo-guide-form {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.demo-guide-form-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.demo-guide-form .form-check {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.05;
}

.brand-name {
  max-width: 42vw;
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.navbar-nav .nav-link,
.dropdown-item {
  font-weight: 600;
}

.app-nav-list {
  font-size: 1.02rem;
  font-weight: 700;
}

.navbar-nav .nav-link {
  border-radius: 8px;
  color: #334155;
  padding-inline: 0.75rem;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus {
  background: var(--surface-soft);
  color: var(--brand-strong);
}

.avatar {
  width: 38px;
  height: 38px;
  border: 2px solid #fff;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.page-wrap {
  width: min(100% - 2rem, var(--page-max));
  margin: 0 auto;
  padding: 1.5rem 0 4.5rem;
}

.home-page-wrap {
  display: grid;
  flex: 1 0 auto;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.page-hero {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 1.25rem;
  padding: 1.25rem;
  border: 1px solid rgba(219, 227, 234, 0.9);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.1), rgba(37, 99, 235, 0.08)), var(--surface);
  box-shadow: var(--shadow-sm);
}

.page-kicker {
  margin: 0;
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.65rem, 3vw, 2.55rem);
  font-weight: 800;
  line-height: 1.08;
}

.page-subtitle {
  max-width: 70ch;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.app-card,
.card,
.module,
.contents,
.course-info,
.content-ccb {
  border: 1px solid rgba(219, 227, 234, 0.95);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-header {
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.app-card {
  padding: 1rem;
}

.app-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.course-card {
  display: flex;
  min-height: 180px;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
}

.course-card h3,
.course-card h4 {
  margin-bottom: 0.4rem;
  font-weight: 800;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 30px;
  padding: 0.32rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: #334155;
  font-size: 0.82rem;
  font-weight: 700;
}

.btn,
button,
input[type="submit"] {
  border-radius: 8px;
  font-weight: 700;
}

.btn-primary,
input[type="submit"] {
  border-color: var(--brand);
  background: var(--brand);
}

.btn-primary:hover,
input[type="submit"]:hover {
  border-color: var(--brand-strong);
  background: var(--brand-strong);
}

.btn-success {
  border-color: var(--success);
  background: var(--success);
}

.btn-warning {
  border-color: var(--accent);
  background: var(--accent);
  color: #17212b;
}

.btn-soft {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.btn-soft:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.form-control,
.form-select,
textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
select {
  border-radius: 8px;
  border-color: var(--line);
}

.form-control:focus,
.form-select:focus,
textarea:focus,
input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.16);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: var(--radius);
}

.table thead th {
  border-bottom: 0;
  background: var(--surface-soft);
  color: #334155;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.responsive-table {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.responsive-table .table {
  margin-bottom: 0;
}

.responsive-table th,
.responsive-table td {
  min-width: 0;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.table-actions form {
  display: inline-flex;
  margin: 0;
}

.table-actions .btn {
  white-space: nowrap;
}

.profile-photo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-soft);
}

.user-management-card {
  min-width: 0;
}

.user-management-table {
  min-width: 1060px;
}

.responsive-list {
  display: grid;
  gap: 0.75rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.responsive-list-item,
.list-group-item.d-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.list-item-main {
  min-width: min(100%, 16rem);
}

.responsive-list-item {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.user-filter-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(6rem, 9rem) auto;
  gap: 0.85rem;
  align-items: end;
  margin-bottom: 1rem;
}

.filter-field {
  min-width: 0;
}

.filter-field label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.filter-field .input-group {
  min-width: 0;
}

.filter-field-search .form-control {
  min-width: 0;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.user-filter-alert {
  margin-bottom: 1rem;
}

.student-record-toolbar {
  gap: 1rem;
  margin-bottom: 1rem;
}

.student-record-top-actions {
  justify-content: flex-end;
}

.student-record-filter-bar {
  grid-template-columns: minmax(14rem, 1.3fr) minmax(9rem, 0.7fr) minmax(9rem, 0.7fr) auto;
}

.student-record-card,
.student-record-chart-card,
.student-record-table-wrap {
  min-width: 0;
}

.student-record-chart-frame {
  position: relative;
  width: 100%;
  height: clamp(220px, 34vw, 340px);
  min-width: 0;
}

.student-record-chart-frame canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.student-record-table {
  table-layout: auto;
}

.student-record-table th,
.student-record-table td {
  max-width: 14rem;
}

.student-record-table td[data-label="Actions"] {
  max-width: none;
}

.pagination-shell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
}

.pagination-summary {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.user-pagination {
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  margin: 0;
}

.user-pagination .page-link {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-weight: 800;
}

.user-pagination .page-item.active .page-link {
  border-color: var(--brand);
  background: var(--brand);
}

.user-pagination .page-item.disabled .page-link {
  color: var(--muted);
  background: var(--surface-soft);
}

.alert {
  position: relative;
  padding-right: 2.75rem;
  border-radius: var(--radius);
  transition: opacity 0.42s ease, transform 0.42s ease, max-height 0.42s ease, margin 0.42s ease, padding 0.42s ease;
}

.platform-alert-close {
  position: absolute;
  top: 0.45rem;
  right: 0.65rem;
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: currentColor;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  opacity: 0.72;
}

.platform-alert-close:hover,
.platform-alert-close:focus-visible {
  background: rgba(15, 23, 42, 0.08);
  opacity: 1;
  outline: 0;
}

.platform-alert-exit {
  max-height: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-0.35rem);
}

.messages {
  width: min(100% - 2rem, 820px);
  margin: 1rem auto;
}

.alert-error {
  --bs-alert-color: #842029;
  --bs-alert-bg: #f8d7da;
  --bs-alert-border-color: #f5c2c7;
}

.empty-state {
  padding: 2rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  text-align: center;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.34fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.contents {
  position: sticky;
  top: 5.8rem;
  max-height: calc(100vh - 7rem);
  overflow: auto;
  padding: 1rem;
}

.contents h3 {
  margin-bottom: 0.8rem;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 800;
}

#modules,
.module-list,
.subject-list {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

#modules li,
.module-list li,
.subject-list li {
  border-radius: 8px;
}

#modules a,
.module-list a,
.subject-list a {
  display: block;
  padding: 0.75rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}

#modules a:hover,
.module-list a:hover,
.subject-list a:hover,
#modules .selected a,
#modules li.selected a,
.module-list .selected a,
.subject-list .selected a {
  border-color: rgba(15, 118, 110, 0.24);
  background: rgba(15, 118, 110, 0.1);
  color: var(--brand-strong);
}

.order {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.lecture-player {
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.lecture-sidebar {
  position: sticky;
  top: 5.8rem;
  max-height: calc(100vh - 7rem);
  overflow: auto;
  padding: 1rem;
}

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

.lecture-stage {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.lecture-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.lecture-title-row h1,
.lecture-title-row h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
}

.lecture-progress-widget {
  display: grid;
  grid-template-columns: auto minmax(8rem, 12rem);
  gap: 0.75rem;
  align-items: center;
  min-width: min(100%, 15rem);
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.progress-ring {
  --progress: 0;
  display: grid;
  width: 3.25rem;
  height: 3.25rem;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface) 58%, transparent 60%),
    conic-gradient(var(--brand) calc(var(--progress) * 1%), rgba(15, 23, 42, 0.12) 0);
  color: var(--brand-strong);
  font-size: 0.82rem;
  font-weight: 900;
}

.progress-widget-copy {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.progress-widget-copy small {
  color: var(--muted);
  font-weight: 700;
}

.inline-progress {
  overflow: hidden;
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.12);
}

.inline-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 0.24s ease;
}

.content-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.content-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}

.content-tab:hover,
.content-tab.active {
  border-color: var(--brand);
  background: rgba(15, 118, 110, 0.1);
  color: var(--brand-strong);
}

.lesson-panel {
  display: none;
}

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

.lesson-stack {
  display: grid;
  gap: 0.85rem;
}

.lesson-card {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
}

.lesson-toggle {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  text-align: left;
}

.lesson-toggle:hover,
.lesson-toggle[aria-expanded="true"] {
  border-color: rgba(15, 118, 110, 0.28);
  background: rgba(15, 118, 110, 0.08);
  color: var(--brand-strong);
}

.lesson-toggle-main {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.55rem;
}

.lesson-toggle-main span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.lesson-toggle small {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 800;
}

.lesson-card.completed .lesson-toggle small {
  color: var(--brand-strong);
}

.lecture-content-panel[hidden] {
  display: none;
}

.lecture-content-panel:not([hidden]) {
  display: block;
}

.content-end-sentinel {
  display: block;
  width: 100%;
  height: 1px;
}

.content-item {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.content-item + .content-item {
  margin-top: 1rem;
}

.content-item h3,
.content-item h4 {
  margin-bottom: 0.85rem;
  font-weight: 800;
}

.module-builder-main {
  min-width: 0;
}

.module-builder-sidebar {
  padding: 1rem;
}

.content-toolbox,
.module-content-card,
.question-builder-card {
  min-width: 0;
}

.content-toolbox {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
}

.content-type-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.module-content-stack,
.question-stack {
  display: grid;
  gap: 0.85rem;
}

.module-content-card,
.question-builder-card {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.module-content-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.module-content-card h4,
.module-content-card p {
  margin: 0;
  overflow-wrap: anywhere;
}

.question-card-header,
.exam-builder-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.choice-option {
  display: grid;
  min-width: 0;
  gap: 0.35rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.choice-option > span:first-child {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.exam-rich-editor.ql-container {
  min-height: 180px;
}

.exam-rich-editor .ql-editor,
.exam-rich-editor.ql-container .ql-editor {
  min-height: 160px;
}

.content-body {
  color: #263443;
  line-height: 1.7;
  min-width: 0;
  overflow-wrap: anywhere;
}

.content-body img,
.image-content img {
  width: 100%;
  height: auto;
  max-height: 70vh;
  border-radius: var(--radius);
  object-fit: contain;
}

.video-content {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: #0f172a;
}

.video-content iframe,
.video-content video {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 320px;
  border: 0;
}

.file-content a,
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--brand);
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.code-panel,
pre {
  overflow-x: auto;
  padding: 1rem;
  border-radius: var(--radius);
  background: #0f172a;
  color: #e5edf5;
}

.sticky-actions {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1040;
  display: grid;
  gap: 0.55rem;
}

.sticky-action {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(219, 227, 234, 0.92);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  box-shadow: var(--shadow-md);
}

.sticky-action[data-nav="back"]::before {
  content: "\2190";
  font-size: 1.25rem;
}

.sticky-action[data-nav="top"]::before {
  content: "\2191";
  font-size: 1.25rem;
}

.sticky-action[data-nav] > i,
.sticky-action[data-nav] > .sticky-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.sticky-action:hover {
  background: var(--brand);
  color: #fff;
}

.dashboard,
.grid {
  width: min(100% - 2rem, var(--page-max));
  margin-inline: auto;
}

.dashboard {
  padding-block: 1.25rem;
}

.header,
.role-header {
  margin-bottom: 1.25rem;
  text-align: center;
}

.role-header h1,
.header h1 {
  margin: 0;
  color: var(--text);
  font-weight: 800;
}

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

.dashboard .card,
.grid .card {
  padding: 1rem;
  text-align: center;
}

.dashboard .card a,
.grid .card a {
  font-weight: 800;
  text-decoration: none;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem max(1rem, calc((100vw - var(--page-max)) / 2));
  background: var(--surface-strong);
  color: #fff;
}

.dashboard-header h1,
.dashboard-header p {
  margin: 0;
}

.dashboard-section {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.dashboard-section h2 {
  margin-bottom: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid rgba(15, 118, 110, 0.2);
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 800;
}

.dashboard-stat-grid,
.dashboard-action-grid,
.dashboard-two-column {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dashboard-stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.dashboard-action-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.dashboard-two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.stat-card {
  display: grid;
  min-width: 0;
  gap: 0.35rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stat-card strong {
  color: var(--text);
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  font-weight: 800;
  line-height: 1;
}

.stat-card span:last-child {
  color: var(--muted);
  font-weight: 800;
}

.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--brand);
}

.secondary-header {
  display: flex;
  gap: 1rem;
  width: min(100% - 2rem, var(--page-max));
  margin: 1rem auto;
}

.side-bar,
.menu {
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.side-bar {
  width: 34%;
}

.menu {
  width: 66%;
}

.side-bar .row-1a,
.side-bar .row-2a,
.side-bar .row-3a,
.side-bar .row-4a,
.menu .row-1b {
  display: flex;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.side-bar .row-1a {
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface-strong), var(--brand));
}

.dashboard-badge .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 280px);
  min-height: 72px;
  border-radius: var(--radius) !important;
}

.dashboard-text {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.card-box,
.card-learn {
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-box {
  flex: 1 1 0;
  min-height: 112px;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.card-learn {
  width: 100%;
  min-height: 54px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
}

.card-learn a {
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.menu .row-1b {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.menu .row-1b .card {
  min-height: 130px;
}

.dashboard-card-header {
  background: var(--brand) !important;
  color: #fff;
  text-align: center;
}

.dashboard-card-count,
.dashboard-card-title {
  color: #fff !important;
}

.dashboard-card-icon {
  display: inline-flex;
  justify-content: center;
  width: 4.5rem;
  margin-left: 0.6rem;
  color: var(--accent);
}

.menu .row-2b {
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.racing-car-image {
  width: 100%;
  max-height: 430px;
  object-fit: cover;
}

.back-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

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

.role-header,
.form-shell {
  width: min(100% - 2rem, 760px);
  margin-inline: auto;
}

.btn-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.btn-editor {
  border-color: var(--info);
  background: var(--info);
  color: #fff;
}

.btn-create {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.btn-list {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.btn-detail {
  border-color: var(--accent);
  background: var(--accent);
  color: #17212b;
}

.formset-card {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.rich-editor {
  min-height: 220px;
  background: var(--surface);
}

.ql-toolbar.ql-snow,
.ql-container.ql-snow,
.rich-editor.ql-container {
  max-width: 100%;
}

.rich-editor.ql-container,
.quill-editor.ql-container {
  min-height: 240px;
  height: auto;
  margin-bottom: 0.5rem;
  overflow: visible;
}

.ql-editor {
  min-height: 220px;
  overflow-wrap: anywhere;
}

.quill-editor,
#editor-container {
  min-height: 220px;
}

.hidden-field,
.visually-hidden-field {
  position: absolute;
  left: -9999px;
}

.editor-preview {
  height: 500px;
  overflow-y: auto;
  padding: 1rem;
}

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

.code-sidebar {
  grid-column: 1 / -1;
}

.code-sidebar,
.code-editor-panel,
.code-preview-panel {
  min-width: 0;
}

.code-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.85rem;
}

.code-tabs {
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
}

.code-tab-content {
  padding-top: 0.85rem;
}

.code-editor-surface {
  --code-accent: #38bdf8;
  position: relative;
  min-height: 58vh;
  overflow: hidden;
  border: 1px solid #263244;
  border-radius: var(--radius);
  background: #050816;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08);
}

.code-highlight,
.code-textarea {
  position: absolute;
  inset: 0;
  min-height: 56vh;
  margin: 0;
  padding: 1rem;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.94rem;
  line-height: 1.55;
  tab-size: 4;
  white-space: pre;
}

.code-highlight {
  z-index: 1;
  color: #cbd5e1;
  display: none;
  pointer-events: none;
}

.code-highlight code {
  display: block;
  min-width: max-content;
}

.code-textarea {
  z-index: 2;
  resize: none;
  caret-color: var(--code-caret, var(--code-accent));
  color: #e2e8f0;
  outline: 0;
  -webkit-text-fill-color: #e2e8f0;
}

.code-textarea::selection {
  background: rgba(59, 130, 246, 0.48);
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}

.code-textarea:focus {
  border-color: transparent;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--code-accent) 68%, transparent),
    inset 0 0 24px color-mix(in srgb, var(--code-accent) 13%, transparent);
}

.code-language-html {
  --code-accent: #fb923c;
  --code-caret: #fdba74;
}

.code-language-html .code-textarea {
  color: #fed7aa;
  -webkit-text-fill-color: #fed7aa;
}

.code-language-css {
  --code-accent: #38bdf8;
  --code-caret: #7dd3fc;
}

.code-language-css .code-textarea {
  color: #bae6fd;
  -webkit-text-fill-color: #bae6fd;
}

.code-language-js {
  --code-accent: #facc15;
  --code-caret: #fde047;
}

.code-language-js .code-textarea {
  color: #fde68a;
  -webkit-text-fill-color: #fde68a;
}

.code-language-python {
  --code-accent: #60a5fa;
  --code-caret: #93c5fd;
}

.code-language-python .code-textarea {
  color: #bfdbfe;
  -webkit-text-fill-color: #bfdbfe;
}

.syntax-plain {
  color: #cbd5e1;
}

.syntax-comment {
  color: #64748b;
}

.syntax-tag,
.syntax-punctuation {
  color: #94a3b8;
}

.syntax-element {
  color: #fb923c;
}

.syntax-attr,
.syntax-property {
  color: #38bdf8;
}

.syntax-string {
  color: #86efac;
}

.syntax-selector,
.syntax-function {
  color: #facc15;
}

.syntax-js-keyword {
  color: #facc15;
}

.syntax-python-keyword {
  color: #60a5fa;
}

.syntax-number {
  color: #fda4af;
}

.code-preview-frame {
  width: 100%;
  min-height: 58vh;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.code-python-output,
.code-snippet-card pre {
  min-height: 110px;
  max-height: 360px;
  margin: 0.85rem 0 0;
  padding: 0.85rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f172a;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.code-python-output:empty {
  display: none;
}

.code-project-list {
  max-height: 22rem;
  overflow: auto;
}

.snippet-send-box {
  padding: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.snippet-student-check-list {
  max-height: 18rem;
  overflow: auto;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.snippet-student-check-list > div,
.snippet-student-check-list li {
  padding: 0.45rem 0.25rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.snippet-student-check-list > div:last-child,
.snippet-student-check-list li:last-child {
  border-bottom: 0;
}

.snippet-student-check-list label {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin: 0;
  color: var(--text);
  font-weight: 700;
}

.snippet-student-check-list input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.15rem;
  accent-color: var(--brand);
}

.rendered-output,
#output {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.profile-photo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-edit-card {
  width: min(100%, 620px);
}

.profile-edit-form {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.profile-edit-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: center;
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.profile-edit-image {
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
}

.profile-field,
.profile-field p {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.profile-field > label,
.profile-field a {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.profile-field input[type="checkbox"] {
  margin-inline: 0.35rem;
}

.profile-field input[type="file"] {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.progress-compact {
  height: 18px;
}

.tenant-logo {
  width: auto;
  max-width: 120px;
  max-height: 72px;
  object-fit: contain;
}

.certificate-logo {
  max-width: 120px;
  margin-right: 1rem;
}

.certificate-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  margin-bottom: 1rem;
  color: #475569;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
}

.certificate-meta span {
  padding: 0.35rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
}

.certificate-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: end;
  justify-content: space-between;
  margin-top: 2rem;
}

.certificate-signature-line {
  min-width: min(100%, 220px);
  padding-top: 0.7rem;
  border-top: 1px solid #0f172a;
  color: #334155;
  font-family: Inter, system-ui, sans-serif;
  font-weight: 800;
}

.certificate-seal-frame,
.certificate-seal-preview {
  display: grid;
  width: 128px;
  height: 128px;
  place-items: center;
  overflow: hidden;
  border: 2px solid #94a3b8;
  border-radius: 50%;
  background: #f8fafc;
  color: #64748b;
  font-family: Inter, system-ui, sans-serif;
  font-weight: 800;
}

.certificate-seal-frame img,
.certificate-seal-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tenant-bg-preview {
  overflow: hidden;
  width: min(100%, 520px);
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

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

.fixed-height-card {
  min-height: 420px;
}

.action-footer {
  margin-left: 1.25rem;
  margin-bottom: 1.25rem;
}

.home-landing {
  min-height: 100vh;
  background-image:
    linear-gradient(180deg, rgba(16, 35, 49, 0.4), rgba(16, 35, 49, 0.52)),
    var(--home-bg);
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  color: #fff;
}

.home-landing .container {
  display: flex;
  min-height: calc(100vh - 112px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.home-landing header {
  padding: 1rem;
  background: var(--tenant-color, rgba(16, 35, 49, 0.8));
  box-shadow: 0 8px 24px rgba(16, 35, 49, 0.18);
}

.home-landing header img {
  max-height: 52px;
  vertical-align: middle;
}

.home-landing header span {
  margin-left: 0.75rem;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 800;
}

.welcome-text {
  max-width: 900px;
  font-size: clamp(2rem, 6vw, 4.25rem);
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 4px 22px rgba(0, 0, 0, 0.35);
}

.home-landing .btn-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.home-landing .btn-group a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.65rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.home-landing .btn-group a:hover {
  background: rgba(255, 255, 255, 0.3);
}

.home-landing footer {
  padding: 0.75rem;
  background: rgba(16, 35, 49, 0.76);
  color: #fff;
  text-align: center;
}

.home-hero {
  display: grid;
  min-height: 100%;
  place-items: center;
  padding: clamp(1.25rem, 5vw, 4rem);
  border-radius: 0;
  background:
    radial-gradient(circle at 18% 48%, rgba(15, 118, 110, 0.22), transparent 18rem),
    radial-gradient(circle at 82% 44%, rgba(37, 99, 235, 0.2), transparent 18rem);
  color: #fff;
  text-align: center;
  box-shadow: none;
}

.home-hero-content {
  display: grid;
  gap: 1rem;
  width: min(100%, 880px);
  justify-items: center;
}

.home-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4.25rem);
  font-weight: 800;
  line-height: 1.02;
}

.home-hero p {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.home-hero .page-kicker {
  color: #fff;
}

.home-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.home-hero .btn-soft {
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.home-shell .app-footer {
  border-top: 0;
  background: rgba(16, 35, 49, 0.72);
  color: rgba(255, 255, 255, 0.92);
}

.home-shell .app-footer a {
  color: #fff;
}

.library-page {
  width: min(100% - 2rem, 1840px);
  min-height: calc(100vh - 86px);
}

.library-shell .app-navbar {
  max-width: 1840px;
}

.library-shell .navbar-collapse {
  min-width: 0;
}

.library-shell .brand-name {
  max-width: 26vw;
}

.library-shell .navbar-nav {
  flex-wrap: wrap;
  justify-content: flex-end;
  row-gap: 0.35rem;
}

.library-shell .nav-link {
  white-space: nowrap;
}

.library-layout {
  display: grid;
  grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.library-sidebar,
.sidebar {
  position: sticky;
  top: 5.8rem;
  max-height: calc(100vh - 7rem);
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.library-main,
.main-content {
  min-width: 0;
}

.book-covers,
.library,
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.9rem;
  align-items: stretch;
}

.book-covers,
.book-catalogue-grid {
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 0.75rem;
}

.book-card,
.action-card {
  display: flex;
  min-width: 0;
  min-height: 100%;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.action-card {
  border-color: rgba(100, 116, 139, 0.55);
  background:
    linear-gradient(145deg, rgba(241, 245, 249, 0.98), rgba(203, 213, 225, 0.96) 52%, rgba(226, 232, 240, 0.98));
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.action-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--brand) 38%, rgba(100, 116, 139, 0.55));
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

.action-card .pill {
  border-color: rgba(100, 116, 139, 0.4);
  background: rgba(255, 255, 255, 0.78);
}

.action-card .btn-soft {
  border-color: color-mix(in srgb, var(--brand) 38%, #cbd5e1);
  background: rgba(255, 255, 255, 0.88);
  color: var(--brand-strong);
}

.action-card .btn-soft:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.dashboard-panel-card {
  border-color: color-mix(in srgb, var(--brand) 18%, #38bdf8);
  background:
    linear-gradient(145deg, rgba(224, 242, 254, 0.98), rgba(186, 230, 253, 0.96) 48%, rgba(240, 249, 255, 0.98)),
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 10%, transparent), transparent 58%);
  box-shadow: 0 18px 42px rgba(14, 116, 144, 0.14);
}

.dashboard-panel-card:hover {
  border-color: color-mix(in srgb, var(--brand) 30%, #0284c7);
  box-shadow: 0 22px 48px rgba(14, 116, 144, 0.18);
}

.dashboard-panel-card .pill {
  border-color: rgba(2, 132, 199, 0.24);
  background: rgba(255, 255, 255, 0.84);
  color: var(--brand-strong);
}

.dashboard-welcome-card {
  border-color: rgba(100, 116, 139, 0.55);
  background:
    linear-gradient(145deg, rgba(241, 245, 249, 0.98), rgba(203, 213, 225, 0.96) 52%, rgba(226, 232, 240, 0.98));
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
}

.dashboard-welcome-card .page-title {
  color: #1d4ed8;
}

.action-card h2,
.action-card h3 {
  color: #1d4ed8;
}

.stat-card span:last-child {
  color: #1d4ed8;
}

.book-cover-img,
.book-cover {
  width: 100%;
  height: clamp(140px, 14vw, 220px);
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--surface-soft);
}

.book-covers .book-card {
  padding: 0.65rem;
}

.book-covers .book-cover-img,
.book-catalogue-grid .book-cover-img {
  height: clamp(108px, 9vw, 164px);
}

.book-covers h2,
.book-covers h3 {
  font-size: 0.95rem;
  line-height: 1.2;
}

.book-covers .info p,
.book-covers .book-meta p {
  font-size: 0.78rem;
}

.book-covers .btn {
  min-height: 36px;
  padding: 0.45rem 0.55rem;
  font-size: 0.82rem;
}

.book-covers > .empty-state,
.book-grid > .empty-state {
  grid-column: 1 / -1;
}

.book-detail-hero .page-title {
  overflow-wrap: anywhere;
}

.book-detail-layout {
  display: grid;
  grid-template-columns: minmax(220px, 340px) minmax(0, 1fr);
  gap: clamp(0.8rem, 2vw, 1.25rem);
  align-items: start;
  width: min(100%, 1180px);
  margin-inline: auto;
}

.book-detail-media,
.book-detail-info {
  min-width: 0;
}

.book-detail-media {
  display: grid;
  justify-items: center;
}

.book-detail-cover-frame {
  width: min(100%, 320px);
}

.book-detail-cover {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(62vh, 480px);
  border-radius: var(--radius);
  object-fit: contain;
  background: var(--surface-soft);
}

.book-cover-placeholder {
  display: grid;
  min-height: 360px;
  place-items: center;
  padding: 1rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #0f766e, #2563eb);
  color: #fff;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
}

.book-detail-info {
  display: grid;
  gap: 1rem;
}

.book-detail-info h2,
.book-detail-author {
  overflow-wrap: anywhere;
}

.book-detail-author {
  margin: 0;
  color: var(--muted);
}

.book-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem;
  margin: 0;
}

.book-facts div {
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.book-facts dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.book-facts dd {
  margin: 0.2rem 0 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.book-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.book-detail-actions form,
.book-detail-actions .btn {
  min-width: min(100%, 130px);
}

.book-detail-actions form .btn {
  width: 100%;
}

.book-detail-actions .btn {
  justify-content: center;
}

.book-card .info,
.book-meta {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  margin-top: 0.75rem;
}

.book-card h2,
.book-card h3,
.book-card p,
.book-card a,
.action-card h2,
.action-card p {
  min-width: 0;
  overflow-wrap: anywhere;
}

.book-card .info p,
.book-meta p {
  margin: 0;
  color: var(--muted);
}

.library-page .pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.library-page .list-group-item {
  min-width: 0;
  overflow-wrap: anywhere;
}

.library-page .list-group-item.d-flex,
.library-page .list-group-item .d-flex {
  flex-wrap: wrap;
  gap: 0.55rem;
}

.library-page .list-group-item > div {
  min-width: 0;
}

.library-page .list-group-item > div:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.library-page form.d-inline,
.library-page .book-card form {
  min-width: 0;
}

.responsive-table .table {
  min-width: 760px;
  margin-bottom: 0;
}

.container-book-preview,
.reader-shell {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.toc-section {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.chapter-link {
  min-width: 0;
  color: var(--brand);
  font-weight: 800;
  text-decoration: none;
}

.chapter-link:hover {
  color: var(--brand-strong);
  text-decoration: underline;
}

.library-content-panel,
.text-content,
.table-content,
.chart-content,
.image-content {
  max-width: 100%;
  overflow-x: auto;
}

.library-content-panel,
.text-content {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.book-search-form {
  display: grid;
  grid-template-columns: minmax(14rem, 1fr) minmax(10rem, 0.45fr) minmax(10rem, 0.4fr) auto;
  gap: 0.85rem;
  align-items: end;
}

.book-list-rows {
  display: grid;
  gap: 0.75rem;
}

.catalogue-rows {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.book-row-card {
  display: grid;
  grid-template-columns: clamp(72px, 9vw, 112px) minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.book-row-cover {
  display: block;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.book-row-cover .real-book-cover,
.book-row-cover .real-book-image {
  width: 100%;
  max-width: 112px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18), inset 6px 0 12px rgba(15, 23, 42, 0.16);
}

.book-row-body {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.book-row-body h2,
.book-row-body p {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.book-row-body p {
  color: var(--muted);
}

.book-row-actions {
  display: grid;
  gap: 0.5rem;
  justify-items: end;
  min-width: min(100%, 9rem);
}

.book-shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: clamp(0.75rem, 1.4vw, 1.15rem);
  align-items: stretch;
}

.admin-book-grid {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.book-shelf-grid > .empty-state {
  grid-column: 1 / -1;
}

.textbook-card {
  display: grid;
  min-width: 0;
  grid-template-rows: auto 1fr auto;
  gap: 0.65rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.textbook-cover-link {
  display: block;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.real-book-cover,
.real-book-image {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.2), inset 8px 0 16px rgba(15, 23, 42, 0.18);
}

.real-book-image {
  object-fit: cover;
  background: var(--surface-soft);
}

.real-book-cover {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #155e75 0%, #0f766e 48%, #f59e0b 100%);
  color: #fff;
}

.book-spine {
  position: absolute;
  inset: 0 auto 0 0;
  width: 16%;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.42), rgba(255, 255, 255, 0.08));
  border-right: 1px solid rgba(255, 255, 255, 0.28);
}

.book-face {
  position: relative;
  z-index: 1;
  display: grid;
  height: 100%;
  align-content: space-between;
  gap: 0.75rem;
  padding: 12% 10% 10% 22%;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.35);
}

.book-cover-title {
  display: block;
  font-size: clamp(0.9rem, 1.45vw, 1.35rem);
  font-weight: 900;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.book-cover-subtitle,
.book-cover-author {
  display: block;
  font-size: clamp(0.68rem, 1vw, 0.9rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.book-cover-author {
  align-self: end;
  font-weight: 800;
}

.textbook-meta {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.textbook-meta h2,
.textbook-meta h3,
.textbook-meta p {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.textbook-meta p {
  color: var(--muted);
  font-size: 0.83rem;
}

.book-access-pill {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 999px;
  padding: 0.2rem 0.48rem;
  background: #ecfeff;
  color: #155e75;
  font-size: 0.73rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.book-access-pill.free {
  border-color: rgba(22, 163, 74, 0.35);
  background: #f0fdf4;
  color: #166534;
}

.book-preview-layout,
.book-reader-layout,
.book-page-editor-layout,
.book-builder-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.34fr) minmax(0, 1fr);
  gap: clamp(0.9rem, 2vw, 1.35rem);
  align-items: start;
}

.book-price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.85rem;
  align-items: end;
  min-width: 0;
}

.book-check {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  min-height: 38px;
  margin: 0;
}

.borrow-action-form {
  display: grid;
  grid-template-columns: minmax(5rem, 7rem) auto;
  gap: 0.5rem;
  align-items: end;
}

.borrow-action-form .form-label {
  grid-column: 1 / -1;
  margin: 0;
}

.borrow-action-form .form-control {
  min-width: 0;
}

.book-preview-cover,
.book-builder-preview,
.reader-toc,
.book-page-preview {
  position: sticky;
  top: 5.8rem;
  min-width: 0;
}

.book-builder-preview .real-book-cover,
.book-preview-cover .real-book-cover,
.book-preview-cover .real-book-image,
.book-detail-cover-frame .real-book-cover,
.book-detail-cover-frame .real-book-image {
  max-width: 320px;
  margin-inline: auto;
}

.book-preview-actions {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}

.book-preview-actions form,
.book-preview-actions .btn {
  width: 100%;
}

.book-preview-pages,
.book-reader-pages {
  display: grid;
  gap: clamp(0.9rem, 1.8vw, 1.25rem);
  min-width: 0;
}

.book-page,
.paper-page {
  min-width: 0;
  padding: clamp(1rem, 2.4vw, 2rem);
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fffdf7;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.11);
}

.book-page-header,
.book-page-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.book-page-header {
  padding-bottom: 0.7rem;
  border-bottom: 1px solid #e5e7eb;
}

.book-page-footer {
  padding-top: 0.7rem;
  border-top: 1px solid #e5e7eb;
}

.book-page-body {
  display: grid;
  gap: 0.85rem;
  min-height: clamp(18rem, 46vh, 34rem);
  padding-block: clamp(1rem, 2vw, 1.5rem);
  color: #1f2937;
  overflow-wrap: anywhere;
}

.book-page-body img,
.content-body img,
.table-content img,
.chart-content img,
.image-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.book-page-body table,
.table-content table {
  width: 100%;
  border-collapse: collapse;
}

.book-page-body th,
.book-page-body td,
.table-content th,
.table-content td {
  padding: 0.5rem;
  border: 1px solid #cbd5e1;
  vertical-align: top;
}

.title-page-body {
  place-content: center;
  text-align: center;
}

.book-toc-list {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding-left: 1.25rem;
}

.book-toc-list li {
  min-width: 0;
}

.book-toc-list a,
.locked-chapter {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

.book-toc-list a:hover {
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--brand);
}

.book-toc-list .active a,
.book-toc-list .active .locked-chapter {
  border-color: rgba(15, 118, 110, 0.45);
  background: #ecfeff;
}

.book-toc-list span,
.book-toc-list small {
  color: var(--muted);
}

.locked-chapter {
  background: #f8fafc;
  color: var(--muted);
}

.reader-chapter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: space-between;
}

.book-quill-page,
.quill-editor {
  min-height: 14rem;
  background: #fff;
}

.book-quill-page .ql-editor,
.quill-editor .ql-editor {
  min-height: 14rem;
  font-size: 1rem;
  line-height: 1.65;
}

.content-mode-panel[hidden] {
  display: none !important;
}

.visually-hidden-field {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.book-outline,
.book-outline-chapter,
.book-page-list {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.book-outline-chapter {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.book-outline-heading,
.book-page-list li {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: space-between;
}

.book-page-list {
  margin: 0;
  padding-left: 1.2rem;
}

.book-page-list li {
  padding: 0.55rem;
  border-radius: var(--radius);
  background: var(--surface);
}

.math-toolbox {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px dashed rgba(15, 118, 110, 0.35);
  border-radius: var(--radius);
  background: #f8fafc;
}

.math-tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.math-chip {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.math-size-input {
  width: 4.5rem;
}

.math-expression {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-inline: 0.12rem;
  font-family: Georgia, "Times New Roman", serif;
}

.math-fraction {
  display: inline-grid;
  grid-template-rows: auto auto;
  vertical-align: middle;
  text-align: center;
  line-height: 1.05;
}

.math-fraction span:first-child {
  border-bottom: 1px solid currentColor;
  padding-inline: 0.25rem;
}

.math-fraction span:last-child {
  padding-inline: 0.25rem;
}

.math-root {
  border-top: 1px solid currentColor;
  padding-left: 0.15rem;
}

.math-matrix {
  display: inline-table;
  border-collapse: collapse;
  margin-inline: 0.2rem;
  vertical-align: middle;
}

.math-matrix td {
  padding: 0.1rem 0.3rem;
  border: 0;
  text-align: center;
}

.coordinate-plane {
  display: inline-grid;
  width: min(100%, 320px);
  aspect-ratio: 1;
  border: 1px solid #94a3b8;
  background-image:
    linear-gradient(#e2e8f0 1px, transparent 1px),
    linear-gradient(90deg, #e2e8f0 1px, transparent 1px),
    linear-gradient(#64748b 2px, transparent 2px),
    linear-gradient(90deg, #64748b 2px, transparent 2px);
  background-position: 0 0, 0 0, 0 50%, 50% 0;
  background-size: 10% 10%, 10% 10%, 100% 100%, 100% 100%;
}

.payment-admin-grid,
.checkout-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  align-items: start;
}

.checkout-layout {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 340px);
}

.payment-form-card {
  width: min(100%, 860px);
  margin-inline: auto;
}

.payment-config-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.payment-config-form .table-actions,
.payment-config-form .form-check,
.payment-config-form p,
.payment-config-form ul.errorlist {
  grid-column: 1 / -1;
}

.payment-config-form label {
  font-weight: 800;
}

.payment-check-grid ul,
.payment-check-grid > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
}

.payment-check-grid label {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.payment-approval-actions {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.payment-history-filter {
  display: grid;
  gap: 0.5rem;
}

.payment-history-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.payment-history-filter-grid label {
  font-weight: 800;
}

.checkout-summary {
  position: sticky;
  top: 5.8rem;
}

.payment-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin: 0;
}

.payment-summary-grid div {
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.payment-summary-grid dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.payment-summary-grid dd {
  margin: 0.2rem 0 0;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.app-footer a {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 1rem;
  width: 100%;
  max-width: calc(1080px + 3rem);
  margin-inline: auto;
}

.pricing-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.pricing-card h2 {
  margin: 0.75rem 0 0.35rem;
  font-size: 1.15rem;
}

.pricing-price {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 900;
}

.pricing-features {
  flex: 1;
  margin-top: 0.75rem;
  color: var(--muted);
}

.demo-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.demo-video-grid article {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.demo-video-grid video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: #111827;
  object-fit: cover;
}

.demo-video-grid strong {
  font-weight: 900;
}

.demo-video-grid span {
  color: var(--muted);
  font-size: 0.9rem;
}

.legal-copy {
  display: grid;
  gap: 0.75rem;
  overflow-wrap: anywhere;
}

.legal-copy p,
.legal-copy ul,
.legal-copy ol,
.legal-copy blockquote {
  margin-bottom: 0.75rem;
}

.legal-copy h1,
.legal-copy h2,
.legal-copy h3 {
  color: var(--brand-strong);
}

.image-content img,
.chart-content img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: normal;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1rem;
  background-image:
    linear-gradient(180deg, rgba(16, 35, 49, 0.44), rgba(16, 35, 49, 0.58)),
    var(--auth-bg, linear-gradient(135deg, #102331, #0f766e));
  background-position: center;
  background-size: cover;
}

.auth-card {
  width: min(100%, 460px);
  padding: 1.25rem;
  border: 1px solid rgba(219, 227, 234, 0.86);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-md);
}

.auth-card-wide {
  width: min(100%, 640px);
}

.auth-card h1,
.auth-card h2 {
  margin-bottom: 0.75rem;
  text-align: center;
  font-weight: 800;
}

.password-field {
  position: relative;
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 0.65rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
}

.social-login {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.facebook-btn,
.google-btn {
  width: 100%;
  border: 0;
  color: #fff;
}

.facebook-btn {
  background: #1877f2;
}

.google-btn {
  background: #dc2626;
}

.certificate-page {
  box-sizing: border-box;
  width: min(100%, 210mm);
  min-height: 297mm;
  margin-inline: auto;
  padding: clamp(0.75rem, 2vw, 1rem);
  background: var(--tenant-color, var(--app-bg));
  font-family: Georgia, "Times New Roman", serif;
}

.certificate {
  box-sizing: border-box;
  display: flex;
  width: 100%;
  min-height: calc(297mm - 2rem);
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.25rem, 5vw, 3rem);
  border: 8px solid var(--info);
  background: #fff;
  box-shadow: 0 12px 34px rgba(37, 99, 235, 0.2);
  overflow: hidden;
}

.certificate h1 {
  margin-bottom: 1.25rem;
  text-align: center;
  font-size: clamp(1.8rem, 4vw, 2.55rem);
}

.certificate p {
  font-size: 1.08rem;
}

.result-sheet {
  justify-content: flex-start;
  gap: 0.75rem;
  padding: clamp(1rem, 3vw, 1.6rem);
  font-family: Inter, system-ui, sans-serif;
}

.result-sheet h1 {
  margin-bottom: 0.35rem;
  font-family: Georgia, "Times New Roman", serif;
}

.result-student-summary,
.result-overall {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0;
}

.result-student-summary div,
.result-overall span {
  padding: 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
}

.result-student-summary dt {
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.result-student-summary dd {
  margin: 0.2rem 0 0;
  color: #0f172a;
  font-weight: 800;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.result-table th,
.result-table td {
  padding: 0.48rem 0.55rem;
  border: 1px solid #94a3b8;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

.result-table th {
  background: #e2e8f0;
  color: #0f172a;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.result-table th:nth-child(2),
.result-table th:nth-child(3),
.result-table td:nth-child(2),
.result-table td:nth-child(3) {
  width: 18%;
  text-align: center;
}

.result-overall {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  font-weight: 900;
}

.result-remarks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 0.25rem;
}

.result-remarks > div {
  min-height: 86px;
  padding: 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

.result-remarks span {
  display: block;
  margin-bottom: 0.75rem;
  color: #334155;
  font-weight: 900;
}

.remark-line {
  height: 1.2rem;
  border-bottom: 1px solid #94a3b8;
}

.certificate-date {
  margin: 0.75rem 0 0;
  text-align: center;
  color: #475569;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 800;
}

.help-guide h4,
.modal-body h4 {
  color: var(--info);
}

@media (max-width: 575.98px) {
  .pricing-grid {
    grid-template-columns: 1fr;
    max-width: 28rem;
  }

  .modal-dialog {
    width: 94%;
    margin-inline: auto;
  }

  .modal-content {
    width: 100%;
  }
}

@media (max-width: 1199.98px) {
  .page-wrap {
    width: min(100% - 1.5rem, var(--page-max));
  }

  .home-page-wrap {
    width: 100%;
  }

  .page-wrap.library-page {
    width: min(100% - 1.5rem, 1320px);
  }

  .library-shell .nav-link {
    padding-inline: 0.55rem;
    font-size: 0.92rem;
  }

  .book-covers,
  .book-catalogue-grid {
    grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  }

  .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }

  .book-search-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .book-search-form .filter-actions {
    grid-column: 1 / -1;
  }

  .catalogue-rows .book-row-card {
    grid-template-columns: 82px minmax(0, 1fr);
    align-items: start;
  }

  .catalogue-rows .book-row-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-items: stretch;
    width: 100%;
  }

  .catalogue-rows .book-row-actions .btn {
    width: 100%;
  }

  .student-record-filter-bar {
    grid-template-columns: minmax(0, 1fr) minmax(8rem, 0.7fr);
  }

  .student-record-filter-bar .filter-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .student-record-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .student-record-top-actions {
    justify-content: flex-start;
  }

  .stack-table-lg {
    min-width: 0;
  }

  .stack-table-lg,
  .stack-table-lg thead,
  .stack-table-lg tbody,
  .stack-table-lg th,
  .stack-table-lg td,
  .stack-table-lg tr {
    display: block;
  }

  .stack-table-lg thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .stack-table-lg tbody {
    display: grid;
    gap: 0.85rem;
  }

  .stack-table-lg tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }

  .stack-table-lg td {
    display: grid;
    grid-template-columns: minmax(8rem, 34%) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: center;
    max-width: none;
    border: 0;
    border-bottom: 1px solid var(--line);
    padding: 0.75rem;
    text-align: left;
  }

  .stack-table-lg td:last-child {
    border-bottom: 0;
  }

  .stack-table-lg td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .stack-table-lg .table-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 991.98px) {
  .code-project-list {
    max-height: none;
  }

  .split-layout,
  .lecture-player,
  .library-layout,
  .dashboard-two-column,
  .secondary-header {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

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

  .contents,
  .lecture-sidebar,
  .library-sidebar,
  .sidebar {
    position: static;
    max-height: none;
  }

  .brand-name {
    max-width: 58vw;
  }

  .side-bar,
  .menu {
    width: 100%;
  }

  .library-shell .brand-name {
    max-width: 54vw;
  }

  .book-covers,
  .book-catalogue-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }

  .book-preview-layout,
  .book-reader-layout,
  .book-page-editor-layout,
  .book-builder-layout {
    grid-template-columns: 1fr;
  }

  .book-preview-cover,
  .book-builder-preview,
  .reader-toc,
  .book-page-preview {
    position: static;
  }

  .book-shelf-grid {
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  }

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

@media (max-width: 899.98px) {
  .dashboard-count-cards {
    display: none;
  }
}

@media (max-width: 767.98px) {
  .code-workspace {
    grid-template-columns: 1fr;
  }

  .app-navbar {
    padding-inline: 0.75rem;
  }

  .page-wrap {
    width: min(100% - 1rem, var(--page-max));
    padding-top: 1rem;
  }

  .home-page-wrap {
    width: 100%;
    padding-top: 0;
  }

  .page-hero,
  .lecture-stage,
  .app-card,
  .content-item {
    padding: 0.85rem;
  }

  .app-card-header,
  .lecture-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .code-toolbar {
    grid-template-columns: 1fr;
  }

  .code-editor-surface,
  .code-highlight,
  .code-textarea {
    min-height: 42vh;
  }

  .lecture-progress-widget {
    grid-template-columns: auto minmax(0, 1fr);
    width: 100%;
  }

  .responsive-form-grid {
    grid-template-columns: 1fr;
  }

  .settings-editor-grid {
    grid-template-columns: 1fr;
  }

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

  .settings-nav-button {
    width: 100%;
  }

  .settings-save-bar {
    bottom: 0.75rem;
    justify-content: stretch;
  }

  .settings-save-bar .btn {
    flex: 1 1 9rem;
  }

  .video-content iframe,
  .video-content video {
    min-height: 220px;
  }

  .sticky-actions {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .library-page {
    width: min(100% - 1rem, var(--page-max));
  }

  .book-covers,
  .book-catalogue-grid,
  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
  }

  .catalogue-rows,
  .choice-grid,
  .module-content-card {
    grid-template-columns: 1fr;
  }

  .content-toolbox,
  .content-type-actions,
  .content-type-actions .btn {
    width: 100%;
  }

  .book-cover-img,
  .book-covers .book-cover-img,
  .book-catalogue-grid .book-cover-img {
    height: clamp(130px, 38vw, 190px);
  }

  .book-card {
    padding: 0.7rem;
  }

  .book-search-form {
    grid-template-columns: 1fr;
  }

  .book-shelf-grid,
  .admin-book-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .textbook-card {
    padding: 0.6rem;
  }

  .book-page {
    padding: 0.9rem;
  }

  .book-page-body {
    min-height: 16rem;
  }

  .reader-chapter-nav,
  .reader-chapter-nav .btn {
    width: 100%;
  }

  .book-row-card {
    grid-template-columns: 78px minmax(0, 1fr);
    align-items: start;
  }

  .book-row-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-items: stretch;
    width: 100%;
  }

  .book-row-actions .btn,
  .book-row-actions form,
  .book-row-actions form .btn {
    width: 100%;
  }

  .book-detail-cover {
    max-height: 380px;
  }

  .book-detail-layout {
    grid-template-columns: 1fr;
  }

  .book-detail-cover-frame {
    width: min(100%, 260px);
  }

  .book-detail-media {
    padding: 0.85rem;
  }

  .book-cover-placeholder {
    min-height: 300px;
  }

  .user-filter-bar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .filter-actions {
    justify-content: flex-start;
  }

  .responsive-list-item,
  .list-group-item.d-flex {
    align-items: stretch;
    flex-direction: column;
  }

  .responsive-list-item .table-actions,
  .list-group-item.d-flex .table-actions,
  .list-group-item.d-flex .btn,
  .responsive-list-item .btn {
    width: 100%;
  }

  .pagination-shell {
    align-items: stretch;
    flex-direction: column;
  }

  .user-pagination {
    justify-content: flex-start;
  }

  .responsive-stack-table {
    min-width: 0;
  }

  .responsive-stack-table,
  .responsive-stack-table thead,
  .responsive-stack-table tbody,
  .responsive-stack-table th,
  .responsive-stack-table td,
  .responsive-stack-table tr {
    display: block;
  }

  .responsive-stack-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .responsive-stack-table tbody {
    display: grid;
    gap: 0.85rem;
  }

  .responsive-stack-table tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }

  .responsive-stack-table td {
    display: grid;
    grid-template-columns: minmax(7.5rem, 38%) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: center;
    border: 0;
    border-bottom: 1px solid var(--line);
    padding: 0.75rem;
    text-align: left;
  }

  .responsive-stack-table td:last-child {
    border-bottom: 0;
  }

  .responsive-stack-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .responsive-stack-table .table-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 575.98px) {
  .brand-subtitle {
    display: none;
  }

  .brand-logo,
  .brand-fallback {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .brand-name {
    max-width: 50vw;
    font-size: 0.92rem;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .profile-edit-preview {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-edit-image {
    width: 64px;
    height: 64px;
    flex-basis: 64px;
  }

  .content-tabs {
    flex-direction: column;
  }

  .content-tab,
  .btn,
  input[type="submit"] {
    width: 100%;
    justify-content: center;
  }

  .table {
    min-width: 620px;
  }

  .responsive-stack-table.table {
    min-width: 0;
  }

  .library-shell .brand-name {
    max-width: 42vw;
  }

  .library-page form.d-inline {
    width: 100%;
  }

  .library-page .list-group-item > div:last-child {
    width: 100%;
  }

  .book-covers,
  .book-catalogue-grid,
  .book-grid {
    gap: 0.6rem;
  }

  .book-shelf-grid,
  .admin-book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .book-builder-preview {
    display: none;
  }

  .book-page-preview {
    display: none;
  }

  .book-price-grid {
    grid-template-columns: 1fr;
  }

  .book-outline-heading,
  .book-page-list li,
  .math-tool-row {
    align-items: stretch;
    flex-direction: column;
  }

  .book-page-list .btn,
  .math-chip {
    width: 100%;
  }

  .borrow-action-form {
    grid-template-columns: 1fr;
  }

  .checkout-layout,
  .payment-config-form,
  .payment-approval-actions,
  .payment-history-filter-grid {
    grid-template-columns: 1fr;
  }

  .checkout-summary {
    position: static;
  }

  .book-cover-title {
    font-size: 0.78rem;
  }

  .book-cover-subtitle,
  .book-cover-author,
  .textbook-meta p,
  .book-access-pill {
    font-size: 0.68rem;
  }

  .book-page-header,
  .book-page-footer {
    flex-direction: column;
    gap: 0.25rem;
  }

  .book-card h2,
  .book-card h3 {
    font-size: 0.92rem;
  }

  .book-facts {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .book-detail-actions,
  .book-detail-actions form,
  .book-detail-actions .btn {
    width: 100%;
  }

  .responsive-stack-table td {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .responsive-stack-table .table-actions,
  .responsive-stack-table .table-actions form,
  .responsive-stack-table .table-actions .btn {
    width: 100%;
  }

  .user-filter-bar .input-group,
  .user-filter-bar .input-group .form-control,
  .user-filter-bar .input-group .btn,
  .filter-actions,
  .filter-actions .btn,
  .filter-actions .pill,
  .user-pagination,
  .user-pagination .page-item,
  .user-pagination .page-link {
    width: 100%;
  }

  .user-pagination .page-link {
    justify-content: center;
  }

  .book-cover-placeholder {
    min-height: 220px;
  }

  .book-meta p,
  .book-card .info p {
    font-size: 0.78rem;
  }

  .home-landing header span {
    display: block;
    margin: 0.5rem 0 0;
  }

  .certificate-page {
    min-height: auto;
    padding: 0.5rem;
  }

  .certificate {
    min-height: auto;
    padding: 1rem;
    border-width: 4px;
  }

  .certificate-meta,
  .result-student-summary,
  .result-overall,
  .result-remarks,
  .certificate-footer {
    grid-template-columns: 1fr;
  }

  .certificate-footer {
    align-items: stretch;
  }
}

@media (max-width: 379.98px) {
  .library-page form.d-inline {
    width: 100%;
  }

  .library-page .list-group-item > div:last-child {
    width: 100%;
  }

  .book-covers,
  .book-catalogue-grid,
  .book-grid {
    grid-template-columns: 1fr;
  }

  .book-catalogue-grid {
    grid-template-columns: 1fr;
  }

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

  .book-row-card {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 0.65rem;
    padding: 0.65rem;
  }

  .book-row-cover .real-book-cover,
  .book-row-cover .real-book-image {
    max-width: 72px;
  }

  .book-cover-img,
  .book-covers .book-cover-img,
  .book-catalogue-grid .book-cover-img {
    height: auto;
    max-height: 260px;
    object-fit: contain;
  }

  .book-catalogue-grid .book-cover-img {
    height: clamp(112px, 42vw, 150px);
    object-fit: cover;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  html,
  body {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    background: #fff !important;
  }

  .app-topbar,
  .sticky-actions,
  .certificate-page .btn {
    display: none !important;
  }

  .app-shell,
  .page-wrap {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  .certificate-page {
    width: 190mm;
    height: 277mm;
    min-height: 277mm;
    margin: 0 auto !important;
    padding: 0 !important;
    background: #fff !important;
    page-break-after: avoid;
  }

  .certificate {
    box-sizing: border-box;
    width: 190mm;
    height: 277mm;
    min-height: 277mm;
    padding: 9mm;
    border-width: 4px;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  .certificate h1 {
    font-size: 24pt;
  }

  .result-sheet {
    gap: 3.5mm;
    padding: 6mm;
  }

  .result-table {
    font-size: 8.5pt;
  }

  .result-table th,
  .result-table td {
    padding: 2mm 2.25mm;
  }

  .result-student-summary,
  .result-overall {
    gap: 3mm;
  }

  .result-remarks {
    gap: 5mm;
  }

  .result-remarks > div {
    min-height: 19mm;
    padding: 3mm;
  }

  .certificate-footer {
    margin-top: auto;
  }

  .certificate-seal-frame {
    width: 28mm;
    height: 28mm;
  }
}
