:root {
  --black: #2e2e2e;
  --red: #5a1f2b;
  --red-dark: #451822;
  --gold: #ffd76a;
  --gold-light: #ffebb8;
  --primary: #5a1f2b;
  --primary-hover: #451822;
  --primary-light: #f8ebe9;
  --sidebar-bg: #2e2e2e;
  --sidebar-text: rgba(255, 255, 255, 0.65);
  --body-bg: #f8f9fa;
  --card-bg: #ffffff;
  --surface-muted: #f4f6f8;
  --surface-subtle: #f9fafb;
  --input-bg: #ffffff;
  --day-item-bg: #ffffff;
  --text-dark: #2e2e2e;
  --text-muted: #6c757d;
  --text-gray-600: #495057;
  --border: #e9ecef;
  --border-input: #dee2e6;
  --success: #198754;
  --success-light: #d1e7dd;
  --font: "Poppins", "Segoe UI", sans-serif;
  --sidebar-width: 265px;
  --header-height: 70px;
  --radius: 12px;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--text-dark);
  background: var(--body-bg);
  font-size: 13px;
}

.hidden { display: none !important; }
.w-100 { width: 100%; }
.fw-bold { font-weight: 700; }
.show-mobile-only { display: none !important; }

@media (max-width: 767px) {
  .show-mobile-only { display: inline-flex !important; }
}

/* ===== AUTH (Sculin split login) ===== */
.auth-root {
  min-height: 100vh;
  background: var(--card-bg);
}

.auth-split {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.auth-visual {
  display: none;
  flex: 1;
  background: linear-gradient(160deg, #2e2e2e 0%, #3d3d3d 55%, #2e2e2e 100%);
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}

.auth-visual::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--black) 33%, var(--red) 33%, var(--red) 66%, var(--gold) 66%);
}

.auth-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(200, 16, 46, 0.25) 0%, transparent 45%),
    radial-gradient(circle at 80% 20%, rgba(212, 175, 55, 0.2) 0%, transparent 40%);
  pointer-events: none;
}

.auth-brand-panel {
  position: absolute;
  bottom: 48px;
  left: 48px;
  right: 48px;
  color: #fff;
  z-index: 1;
}

.auth-brand-panel img {
  height: 56px;
  margin-bottom: 20px;
}

.auth-brand-panel h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.auth-brand-panel p {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.95rem;
  max-width: 360px;
}

.auth-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  position: relative;
}

.auth-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--black) 33%, var(--red) 33%, var(--red) 66%, var(--gold) 66%);
}

.auth-lang {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10;
}

.auth-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.theme-toggle-btn {
  color: var(--text-muted);
}

.theme-toggle-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.auth-lang img {
  border-radius: 4px;
}

.auth-form-wrap {
  width: 100%;
  max-width: 500px;
  padding: 20px;
}

.auth-heading {
  text-align: center;
  margin-bottom: 44px;
}

.auth-logo {
  height: 52px;
  width: auto;
  margin: 0 auto 20px;
  display: block;
}

.auth-heading h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.auth-heading p {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 600;
}

.auth-form .fv-row { margin-bottom: 24px; }

.form-control {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  font-family: var(--font);
  font-size: 1rem;
  color: var(--text-dark);
  background: transparent;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--primary);
}

.auth-forgot {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 32px;
}

.auth-forgot a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
  height: 48px;
  font-size: 1rem;
  box-shadow: 0 4px 16px rgba(200, 16, 46, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--red-dark), var(--red));
}

.btn-custom-btn {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
  font-weight: 700;
  padding: 10px 18px;
  font-size: 0.85rem;
  border-radius: 8px;
  float: right;
  box-shadow: 0 2px 10px rgba(200, 16, 46, 0.2);
}

.btn-custom-btn:hover { background: linear-gradient(135deg, var(--red-dark), var(--red)); }

.btn-icon {
  background: transparent;
  border: none;
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
}

.btn-icon:hover { background: var(--primary-light); }

.btn-header {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.btn-header:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.btn-sm { padding: 6px; }

.alert-danger {
  background: #fde8ec;
  color: var(--red);
  border: 1px solid rgba(200, 16, 46, 0.25);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

@media (min-width: 992px) {
  .auth-split { flex-direction: row; }
  .auth-visual {
    display: block;
    width: 50%;
    flex: none;
  }
  .auth-panel {
    width: 50%;
    flex: none;
  }
}

/* ===== APP LAYOUT ===== */
.app-root { min-height: 100vh; }

.app-page {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 105;
  transition: transform 0.3s ease, width 0.3s ease;
}

.app-sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  min-height: var(--header-height);
}

.app-sidebar-logo-default {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.sidebar-emblem {
  width: 32px;
  height: 32px;
}

.logo-text {
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
}

.logo-accent {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 2px;
}

.sidebar-toggle {
  background: rgba(255,255,255,0.05);
  border: none;
  color: #565674;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}

.sidebar-toggle svg {
  display: block;
  transition: transform 0.2s ease;
}

.app-sidebar.collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

@media (min-width: 992px) {
  .sidebar-toggle { display: none; }
}

.app-sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}

.menu { list-style: none; }
.menu-item { margin-bottom: 4px; }

.menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 0.475rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s;
}

.menu-link .menu-icon {
  display: flex;
  align-items: center;
  width: 22px;
  opacity: 0.85;
}

.menu-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.menu-link.active {
  background: linear-gradient(135deg, var(--red), var(--red-dark)) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(200, 16, 46, 0.3);
}

.menu-link.active .menu-icon { color: #fff; opacity: 1; }

.app-sidebar-footer {
  padding: 16px 24px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.app-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left 0.3s ease;
}

.app-header {
  height: var(--header-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-greeting {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-flag { padding: 4px 8px; }

.avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f1f1f4 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b5b5c3'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E") center/60% no-repeat;
  display: block;
}

.avatar-placeholder.avatar-lg {
  width: 50px;
  height: 50px;
  border-radius: 12px;
}

.profile-menu { position: relative; }

.btn-profile {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 260px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 0 50px 0 rgba(82, 63, 105, 0.15);
  padding: 8px 0;
  z-index: 200;
  border: 1px solid var(--border);
}

.profile-dropdown-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 20px;
}

.separator {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.profile-link {
  display: block;
  width: 100%;
  color: var(--text-gray-600);
  padding: 10px 20px;
  text-decoration: none;
  font-weight: 600;
  background: transparent;
  border: none;
  text-align: left;
  font-family: var(--font);
  font-size: 0.95rem;
  cursor: pointer;
}

.profile-link:hover {
  background: var(--surface-muted);
  color: var(--primary);
}

.logout-link { color: var(--text-dark); }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-light-success {
  background: var(--success-light);
  color: #1b7e4b;
}

.badge-light-primary {
  background: var(--primary-light);
  color: var(--red);
}

.badge-light-info {
  background: #fff8e6;
  color: #8a6d12;
}

/* ===== CONTENT ===== */
.app-content {
  padding: 24px 28px 40px;
  flex: 1;
}

.page-title-wrap { margin-bottom: 24px; }

.page-title,
.courses-table-title,
.profile-section-title,
.card-body > h3,
.calendar-top h3,
.week-widget-head h3,
.av-card h3,
.pkg-card h3,
.lesson-card h3,
.modal-title {
  border-left: none;
  padding-left: 0;
}

.page-title::before,
.page-title::after,
.courses-table-title::before,
.courses-table-title::after,
.profile-section-title::before,
.profile-section-title::after,
.card-body > h3::before,
.card-body > h3::after,
.calendar-top h3::before,
.calendar-top h3::after,
.week-widget-head h3::before,
.week-widget-head h3::after,
.av-card h3::before,
.av-card h3::after,
.pkg-card h3::before,
.pkg-card h3::after,
.lesson-card h3::before,
.lesson-card h3::after,
.modal-title::before,
.modal-title::after {
  content: none;
  display: none;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.page-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.breadcrumb-line {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.breadcrumb-line a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
}

.breadcrumb-line a:hover {
  color: var(--red);
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  border: 0;
}

.card-body { padding: 24px; }
.card-flush .card-body { padding: 0; }

.row { display: flex; flex-wrap: wrap; margin: 0 -12px; }
.col-6 { width: 50%; padding: 0 12px; }
.col-12 { width: 100%; padding: 0 12px; }
.col-md-4 { width: 33.333%; padding: 0 12px; }
.col-md-6 { width: 50%; padding: 0 12px; }

@media (max-width: 768px) {
  .col-6, .col-md-4, .col-md-6 { width: 100%; }
}

.calendar-card.calendar-home {
  margin-top: 0;
}

.dashboard-extras {
  margin-top: 24px;
}

.calendar-card .card-body { padding: 28px; }

.calendar-card.calendar-home .card-body {
  padding: 32px;
}

.calendar-home .calendar-top h3 {
  font-size: 1.35rem;
}

.calendar-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.calendar-top h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.calendar-top p { color: var(--text-muted); font-weight: 500; }

.calendar-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-light {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-gray-600);
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-cal-primary {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
  border: none;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius);
}

.btn-cal-icon {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.day-strip-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.day-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex: 1;
  padding-bottom: 4px;
}

.day-nav {
  background: var(--primary-light);
  border: none;
  color: var(--red);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.day-item {
  min-width: 56px;
  text-align: center;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px dashed var(--border-input);
  cursor: pointer;
  flex-shrink: 0;
  background: var(--day-item-bg);
  font-family: var(--font);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.day-item span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
}

.day-item strong {
  font-size: 1rem;
  color: var(--text-dark);
}

.day-item.active {
  background: var(--day-item-bg);
  border: 2px solid var(--primary);
  border-style: solid;
  box-shadow: 0 4px 14px rgba(90, 31, 43, 0.12);
}

.day-item.has-lessons strong { color: var(--primary); }

.day-item.active span {
  color: var(--text-muted);
}

.day-item.active strong {
  color: var(--primary);
}

.day-lesson-count {
  display: block;
  margin-top: 2px;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.day-item.active .day-lesson-count {
  color: var(--primary);
}

.apt-people-line { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.apt-meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--surface-muted);
  color: var(--text);
}
.apt-meta-pill-teacher { background: rgba(90, 31, 43, 0.08); color: var(--primary); }
.apt-meta-pill-student { background: rgba(201, 162, 39, 0.14); }

.empty-text {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
  font-size: 0.95rem;
  font-weight: 500;
}

/* Stats */
.stat-widget {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  margin-bottom: 24px;
}

.stat-widget-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--red);
}

.stat-widget-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.2;
}

.stat-widget-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Lessons */
.lesson-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.search-input-wrap {
  position: relative;
  width: min(320px, 100%);
}

.search-input-wrap input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9rem;
  background: var(--input-bg);
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.lesson-card { padding: 22px; }

.lesson-card-rich {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lesson-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.lesson-card-head h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-dark);
  line-height: 1.35;
}

.lesson-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.lesson-card-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.lesson-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8f9fc;
}

.lesson-detail-label {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
}

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

.lesson-detail-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8f9fc;
}

.lesson-detail-icon {
  display: inline-flex;
  color: var(--primary);
  flex-shrink: 0;
}

.lesson-detail-icon svg {
  width: 18px;
  height: 18px;
}

.lesson-detail-item strong {
  display: block;
  font-size: 1rem;
  line-height: 1.2;
  color: var(--text-dark);
}

.lesson-detail-item span {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.lesson-next-box {
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed #e2e6ef;
  background: var(--input-bg);
}

.lesson-next-head {
  margin-bottom: 8px;
}

.lesson-next-empty {
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
}

.lesson-next-wait {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.lesson-join-btn {
  margin-top: 4px;
}

.lesson-detail-overview .lesson-detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.lesson-sections { display: flex; flex-direction: column; gap: 28px; }
.lesson-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.lesson-section-title { margin: 0; font-size: 1.1rem; font-weight: 700; color: var(--text-dark); }
.lesson-section-count { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; background: #f4f6fa; color: var(--text-muted); font-size: 12px; font-weight: 700; }
.lesson-card-past .lesson-past-box { background: #faf7f8; border-style: solid; border-color: #efe4e7; }
.lesson-recordings-box { padding: 12px; border-radius: 10px; background: #f8f9fc; }
.lesson-recordings-box .lesson-detail-label { margin-bottom: 8px; }
.lesson-recording-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lesson-recording-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--card-bg); border: 1px solid var(--border); text-decoration: none; color: inherit; transition: border-color .15s ease, box-shadow .15s ease; }
.lesson-recording-link:hover { border-color: #d8dee8; box-shadow: 0 4px 12px rgba(20, 24, 40, 0.06); text-decoration: none; }
.lesson-recording-link svg { color: var(--primary); flex-shrink: 0; }
.lesson-recording-link strong { display: block; font-size: 0.92rem; color: var(--text-dark); }
.lesson-recording-link small { display: block; margin-top: 2px; color: var(--text-muted); font-size: 11px; }

.lesson-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 20px;
  min-height: 40px;
  line-height: 1.5;
}

.lesson-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lesson-card-foot small {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.teacher-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f1f1f4;
  border: 2px solid #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.teacher-dot svg { width: 16px; height: 16px; fill: #b5b5c3; }

/* Filters */
.filter-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.filter-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-gray-600);
  margin-bottom: 6px;
}

.filter-group input,
.filter-group select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  padding: 0 14px;
  font-family: var(--font);
  font-size: 0.9rem;
  background: var(--input-bg);
}

/* Table */
.table-responsive { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  padding: 14px 24px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}

.table td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:hover { background: var(--surface-subtle); }

.user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f1f1f4 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b5b5c3'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E") center/60% no-repeat;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--primary);
}

.user-avatar.has-photo {
  background-color: #e8e8ed;
  background-size: cover;
  background-position: center;
  color: transparent;
}

.user-cell strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text-dark);
}

.user-cell small {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.status-active {
  color: var(--success);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Messages */
.messages-card .card-body { padding: 0; }

.messages-wrap {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 560px;
}

.contacts-panel {
  border-right: 1px solid var(--border);
  padding: 20px;
}

.contacts-panel input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  padding: 0 14px;
  margin-bottom: 12px;
  font-family: var(--font);
}

.contact-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
}

.contact-item:hover,
.contact-item.active { background: #f9f9f9; }

.contact-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f1f1f4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-muted);
  position: relative;
  flex-shrink: 0;
}

.status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid #fff;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  gap: 12px;
  min-height: 400px;
}

.chat-empty svg { width: 200px; max-width: 80%; }

.chat-empty h3 {
  font-size: 1.1rem;
  color: var(--text-dark);
  font-weight: 700;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.chat-bubble {
  max-width: 65%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.chat-bubble.mine {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble.theirs {
  align-self: flex-start;
  background: #f1f1f4;
  color: var(--text-dark);
  border-bottom-left-radius: 4px;
}

.chat-form {
  display: flex;
  gap: 10px;
}

.chat-form input {
  flex: 1;
  height: 44px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  padding: 0 14px;
  font-family: var(--font);
}

/* Courses page — Sculin-style layout */
.courses-page { margin-bottom: 24px; }

.courses-stats-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

.courses-stats-left {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.courses-stats-right {
  display: flex;
}

.course-donut-card {
  padding: 28px 32px;
  min-height: 220px;
}

.course-donut-body {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 100%;
}

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

.course-donut-label {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.course-donut-total {
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-dark);
  margin-bottom: 16px;
}

.course-donut-body .donut {
  width: 120px;
  height: 120px;
}

.course-donut-body .donut::after {
  inset: 22px;
}

.course-legend {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

.course-legend div {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.course-legend strong {
  margin-left: auto;
  color: var(--text-dark);
  font-weight: 700;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-in-progress { background: #1b84ff; }
.legend-completed { background: #50cd89; }
.legend-suspended { background: #f1416c; }

.course-count-card {
  padding: 28px 32px;
  min-height: 140px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.course-count-card--tall {
  flex: 1;
  width: 100%;
  min-height: 100%;
}

.course-count-label {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.course-count-value {
  font-size: 2.75rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.1;
}

.btn-course-action {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: #1b84ff;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-course-action:hover {
  background: #1570db;
  color: #fff;
}

.courses-table-section {
  margin-top: 8px;
}

.courses-table-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 16px;
}

.courses-table thead th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
}

.courses-table tbody td {
  padding: 16px 20px;
  vertical-align: middle;
}

.course-status {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

.course-status-active {
  background: #e8f3ff;
  color: #1b84ff;
}

.course-status-completed {
  background: #e8fff3;
  color: #50cd89;
}

.course-status-suspended {
  background: #fff0f3;
  color: #f1416c;
}

.lesson-plan-list { display: flex; flex-direction: column; gap: 12px; }
.lesson-plan-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafbfc;
}
.badge-light-success { background: #e8fff3; color: #50cd89; }
.badge-light-danger { background: #fff5f8; color: #f1416c; }
.badge-light-warning { background: #fff8dd; color: #b78103; }
.text-danger { color: #f1416c; }
.generated-password code {
  display: inline-block;
  margin-left: 8px;
  padding: 6px 10px;
  background: #f4f6f8;
  border-radius: 6px;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.course-view-btn {
  border-radius: 8px;
  font-weight: 600;
}

@media (max-width: 991px) {
  .courses-stats-grid {
    grid-template-columns: 1fr;
  }

  .course-count-card--tall {
    min-height: 140px;
  }
}

/* Courses (legacy helpers) */
.course-stat-card {
  padding: 24px;
  margin-bottom: 24px;
  min-height: 160px;
  position: relative;
}

.course-stat-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.course-stat-head .label {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.course-stat-head h2 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-dark);
}

.course-stat-card .btn-custom-btn {
  position: absolute;
  bottom: 24px;
  right: 24px;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
}

.donut {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 18px;
  background: var(--card-bg);
  border-radius: 50%;
}

.legend { font-size: 0.82rem; color: var(--text-muted); font-weight: 600; }
.legend div { margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.legend span { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Profile */
.profile-banner {
  height: 150px;
  background: linear-gradient(135deg, var(--black) 0%, var(--red) 50%, var(--gold) 100%);
  border-radius: var(--radius) var(--radius) 0 0;
  position: relative;
  overflow: hidden;
}

.profile-banner::before,
.profile-banner::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
}

.profile-banner::before {
  width: 120px;
  height: 120px;
  top: 20px;
  right: 80px;
}

.profile-banner::after {
  width: 80px;
  height: 80px;
  top: 60px;
  right: 200px;
  background: rgba(255,199,0,0.4);
}

.profile-head {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  padding: 0 28px;
  margin-top: -40px;
}

.profile-avatar-box {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  background: #fff;
  border: 4px solid #fff;
  box-shadow: 0 0 20px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-card { overflow: hidden; }

.profile-head-meta {
  margin-top: 48px;
}

.profile-head-meta h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.profile-verified {
  color: var(--red);
  font-size: 1.1rem;
}

.profile-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 20px;
}

.profile-settings-body {
  padding-top: 8px;
}

.profile-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 24px;
}

.profile-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.profile-field-value {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  background: #f9f9f9;
  color: var(--text-dark);
  font-weight: 500;
}

@media (max-width: 768px) {
  .profile-settings-grid { grid-template-columns: 1fr; }
}

.profile-head h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 48px;
}

.profile-tabs {
  display: flex;
  gap: 24px;
  padding: 20px 28px 0;
  border-bottom: 1px solid var(--border);
}

.profile-tabs a {
  padding-bottom: 14px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 2px solid transparent;
}

.profile-tabs a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* AV Test */
.av-card h3 {
  color: var(--primary);
  font-size: 1.25rem;
  margin-bottom: 12px;
  font-weight: 700;
}

.av-preview {
  margin-top: 20px;
  background: var(--black);
  border-radius: var(--radius);
  min-height: 200px;
}

@media (max-width: 767px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.open { transform: translateX(0); }
  .app-wrapper { margin-left: 0; }
  .messages-wrap { grid-template-columns: 1fr; }
  .filter-row { grid-template-columns: 1fr; }
}

.app-sidebar.collapsed {
  width: 80px;
}

.app-sidebar.collapsed .logo-text,
.app-sidebar.collapsed .menu-title,
.app-sidebar.collapsed .app-sidebar-footer { display: none; }

.app-sidebar.collapsed + .app-wrapper { margin-left: 80px; }

/* Notifications */
.notif-menu { position: relative; }
.notif-badge {
  position: absolute; top: 4px; right: 4px; background: var(--red); color: #fff;
  font-size: 0.65rem; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.notif-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); width: 320px; max-height: 400px;
  overflow-y: auto; background: #fff; border-radius: var(--radius);
  box-shadow: 0 0 50px rgba(82,63,105,0.15); z-index: 200;
}
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.btn-link { background: none; border: none; color: var(--primary); font-weight: 600; cursor: pointer; font-family: var(--font); font-size: 0.8rem; }
.notif-item { display: block; padding: 12px 16px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--border); }
.notif-item.unread { background: var(--primary-light); }
.notif-item p { font-size: 0.85rem; color: var(--text-muted); margin: 4px 0; }
.notif-item small { color: var(--text-muted); font-size: 0.75rem; }

/* Forms */
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.inline-form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.inline-form select { height: 42px; border: 1px solid var(--border-input); border-radius: var(--radius); padding: 0 12px; font-family: var(--font); flex: 1; min-width: 140px; }
.inline-form-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  background: var(--card-bg, #fff);
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
  white-space: nowrap;
}
.inline-form-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--primary);
  cursor: pointer;
}
.inline-form-option span { line-height: 1.2; }
.material-list { list-style: none; padding: 0; }
.material-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.material-list a { color: var(--primary); font-weight: 600; text-decoration: none; }
.apt-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.apt-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); gap: 16px; }
.apt-time { color: var(--red); font-weight: 600; font-size: 0.95rem; }

.apt-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 12px;
}

.apt-timeline-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 16px;
  align-items: stretch;
}

.apt-timeline-time {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 18px;
}

.apt-timeline-time span {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--red);
  background: var(--primary-light);
  padding: 6px 10px;
  border-radius: 8px;
  min-width: 56px;
  text-align: center;
}

.apt-timeline-line {
  display: block;
  width: 2px;
  flex: 1;
  min-height: 24px;
  margin: 8px 0;
  background: linear-gradient(var(--red), var(--border));
  border-radius: 2px;
}

.apt-timeline-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 16px 18px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.apt-timeline-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.apt-timeline-side {
  flex: 0 0 280px;
  max-width: 300px;
  margin-left: auto;
}

.apt-timeline-side-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.apt-meta-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.apt-meta-wrap .apt-meta {
  display: block;
  width: 100%;
}

.apt-timeline-main strong {
  font-size: 1rem;
  color: var(--text-dark);
}

.apt-timeline-main .apt-time {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

@media (max-width: 767px) {
  .apt-timeline-item { grid-template-columns: 56px 1fr; gap: 10px; }
  .apt-timeline-card { flex-direction: column; align-items: stretch; }
  .apt-timeline-side { flex: 1 1 auto; max-width: none; width: 100%; margin-left: 0; margin-top: 12px; }
}
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.note-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.lang-opt { background: none; border: 2px solid transparent; border-radius: 6px; padding: 4px; cursor: pointer; margin-left: 4px; }
.lang-opt.active { border-color: var(--primary); }
.assign-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 16px; }
.assign-item { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }
.advisor-select { height: 36px; border: 1px solid var(--border-input); border-radius: 8px; padding: 0 8px; font-family: var(--font); min-width: 140px; }
.inline-form .hidden { display: none; }

.user-add-form { display: flex; flex-direction: column; gap: 16px; }
.user-add-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 16px; }
.user-add-field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.user-add-field .form-control { width: 100%; }
.user-add-student-fields { padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-muted, #f8f9fc); }
.field-hint { margin: 8px 0 0; font-size: 0.82rem; color: var(--text-muted); line-height: 1.45; }
.user-add-submit { align-self: flex-start; }

.teacher-month-hours-banner { margin-bottom: 20px; border: 1px solid rgba(90, 31, 43, 0.14); background: linear-gradient(135deg, rgba(90, 31, 43, 0.06), rgba(201, 162, 39, 0.08)); }
.teacher-month-hours-banner .card-body { display: flex; flex-direction: column; gap: 6px; padding: 20px 24px; }
.teacher-month-hours-value { font-size: 2rem; font-weight: 800; color: var(--primary); line-height: 1.1; }
.teacher-month-hours-value span { font-size: 1rem; font-weight: 600; color: var(--text-muted); margin-left: 4px; }
.teacher-month-hours-title { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.teacher-month-hours-range { font-size: 0.82rem; color: var(--text-muted); }

@media (max-width: 768px) {
  .inline-form { flex-direction: column; align-items: stretch; }
  .notif-dropdown { width: min(320px, 90vw); }
}

/* Phase 2 */
.level-progress { margin: 16px 0; }
.level-progress-labels { display: flex; justify-content: space-between; margin-bottom: 8px; }
.level-step { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.level-step.active { color: var(--primary); }
.level-step.done { color: var(--gold); }
.level-progress-track { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.level-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--gold)); border-radius: 99px; }
.level-progress-meta { display: block; margin-top: 6px; color: var(--text-muted); font-size: 0.8rem; }
.progress-card-subtitle { margin: 0 0 8px; font-size: 0.9rem; font-weight: 600; color: var(--text-muted); }
.user-filter-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.user-filter-tab { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 8px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.user-filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.user-detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-top: 12px; }
.user-detail-item span { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; }
.user-detail-item strong, .user-detail-item code.user-password { font-size: 0.95rem; }
.user-account-card .profile-settings-grid { margin-top: 8px; }
.week-widget-head h3 { margin: 0 0 4px; font-size: 1.1rem; }
.week-widget-head p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.advisor-quick .quick-msg-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.homework-list { list-style: none; padding: 0; margin: 0; }
.homework-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.hw-feedback { margin-top: 8px; color: var(--text-muted); }
.recording-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.export-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.pkg-card h3 { margin: 0 0 8px; }
.progress-card .mini-stat { text-align: center; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.progress-card .mini-stat strong { display: block; font-size: 1.2rem; color: var(--primary); }
.progress-card .mini-stat span { font-size: 0.8rem; color: var(--text-muted); }
.teacher-report-section { margin-bottom: 20px; }
.teacher-report-section .report-section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 1.05rem; }
.report-section-num { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 0.85rem; font-weight: 700; flex-shrink: 0; }
.report-mini-stats { margin-bottom: 16px; }
.report-mini-stats .mini-stat { text-align: center; padding: 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; }
.report-mini-stats .mini-stat strong { display: block; font-size: 1.2rem; color: var(--primary); }
.report-mini-stats .mini-stat span { font-size: 0.8rem; color: var(--text-muted); }
.report-subheading { margin-top: 20px; }
.apt-meta { display: block; color: var(--text-muted); font-size: 0.8rem; margin-top: 4px; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 20px; }
.modal-overlay.hidden { display: none; }
.modal-box { background: var(--card-bg); border-radius: 12px; padding: 24px; max-width: 520px; width: 100%; max-height: 90vh; overflow: auto; box-shadow: 0 12px 40px rgba(0,0,0,.15); border: 1px solid var(--border); }
.modal-title { margin: 0 0 8px; font-size: 1.15rem; }
.modal-desc { color: var(--text-muted); margin: 0 0 16px; font-size: 0.9rem; }
.modal-form .modal-field { display: block; margin-bottom: 12px; }
.modal-form .modal-field span { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 4px; color: var(--text-muted); }
.modal-form input, .modal-form select, .modal-form textarea { width: 100%; border: 1px solid var(--border-input); border-radius: 8px; padding: 10px 12px; font-family: var(--font); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

.announcement-modal-box {
  position: relative;
  max-width: 560px;
  padding: 28px 28px 24px;
}

.announcement-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.announcement-modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: var(--text);
}

.announcement-modal {
  padding-right: 28px;
}

.announcement-modal-title {
  margin: 0 0 12px;
  font-size: 1.25rem;
  line-height: 1.35;
  padding-right: 24px;
}

.announcement-modal-body {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
}
.portal-toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.portal-toast { background: var(--black); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 0.9rem; box-shadow: 0 8px 24px rgba(0,0,0,.2); opacity: 0; transform: translateY(8px); transition: all .25s ease; max-width: 320px; }
.portal-toast.show { opacity: 1; transform: translateY(0); }
.portal-toast-success { background: #0f7a3a; }
.portal-toast-error { background: var(--red); }
.portal-toast-info { background: var(--black); }
.page-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; color: var(--text-muted); }
.page-loading-spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: portal-spin .8s linear infinite; margin-bottom: 12px; }
@keyframes portal-spin { to { transform: rotate(360deg); } }
.profile-password-form .form-control { width: 100%; border: 1px solid var(--border-input); border-radius: 8px; padding: 10px 12px; font-family: var(--font); }
.homework-overdue {
  background: rgba(200, 16, 46, 0.06);
  border-radius: 8px;
  padding: 10px 12px;
}
.pkg-level { color: var(--text-muted); margin: 0 0 4px; }
.pkg-hours { margin: 0; color: var(--primary); }
.pkg-progress-wrap { margin-top: 14px; }
.pkg-progress-label { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.pkg-progress-track { height: 10px; background: #eef0f4; border-radius: 999px; overflow: hidden; }
.pkg-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #f5b400); border-radius: 999px; }
.pkg-progress-meta { display: block; margin-top: 6px; color: var(--text-muted); font-size: 12px; }
.status-passive { color: #78829d; font-weight: 600; }
.status-pending { color: #f5b400; font-weight: 600; }
.apt-student-panel { margin-top: 0; width: 100%; }
.apt-status-box { text-align: center; padding: 14px 12px; border-radius: 12px; font-weight: 600; margin-bottom: 10px; border: 1px solid var(--border); background: #f9fafb; }
.apt-status-wait { color: #5e6278; }
.apt-status-ready { color: var(--primary); background: rgba(200, 16, 46, 0.06); border-color: rgba(200, 16, 46, 0.2); }
.apt-student-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.apt-student-actions .btn { width: 100%; margin: 0; font-size: 12px; padding: 10px 6px; border-radius: 10px; }
.btn-apt-late { background: #f5b400 !important; color: #111 !important; border: none !important; }
.btn-apt-attend { background: #111 !important; color: #fff !important; border: none !important; }
.btn-apt-absent { background: var(--red) !important; color: #fff !important; border: none !important; }
.student-lesson-group { margin-bottom: 24px; }
.student-group-title { margin-bottom: 12px; font-size: 1.05rem; }
.availability-list { margin: 0; padding-left: 18px; }
.student-summary-card .pkg-progress-wrap { margin-top: 8px; }
.lesson-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.avatar-upload-input { display: block; margin-top: 8px; font-size: 12px; }
.absence-list { margin: 0; padding-left: 18px; }
.absence-list li { margin-bottom: 8px; }
.attendance-tabs .att-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.hours-taught-value { font-size: 28px; font-weight: 700; color: var(--primary); margin: 0; }
.lang-menu { position: relative; }
.lang-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  padding: 6px;
  z-index: 120;
}
.lang-opt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}
.lang-opt-row:hover, .lang-opt-row.active { background: #f4f6fa; }
.library-toolbar { margin-bottom: 16px; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.library-card h3 { font-size: 1rem; margin-bottom: 8px; }
.library-card-actions { margin-top: 12px; }
.library-embed, .recording-embed { margin-top: 10px; position: relative; padding-top: 56.25%; border-radius: 10px; overflow: hidden; background: #111; }
.library-embed iframe, .recording-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.hw-audio-player { display: block; width: 100%; max-width: 360px; margin-top: 8px; }
.hw-voice-feedback { margin-top: 8px; }
.form-hint { display: block; color: var(--text-muted); font-size: 11px; margin: 4px 0 8px; }
.teacher-hours-card { border-left: 4px solid var(--primary); }
.pkg-detail-card { border: 1px solid var(--border); }
.pkg-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.pkg-detail-head h3 { margin: 0; font-size: 1.1rem; }
.pkg-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; margin-bottom: 16px; }
.pkg-detail-item span { display: block; color: var(--text-muted); font-size: 12px; margin-bottom: 4px; }
.pkg-detail-item strong { font-size: 14px; }
.homework-share-list .homework-item { border-left: 3px solid var(--primary); padding-left: 12px; }
.homework-item-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.homework-desc { margin: 8px 0 0; color: var(--text-muted); line-height: 1.5; }
.homework-meta { margin-top: 6px; color: var(--text-muted); }
.homework-detail-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 16px; }
.homework-detail-meta span { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; }
.homework-detail-meta strong { font-size: 0.92rem; }
.homework-detail-grid { margin-top: 8px; }
.homework-detail-grid .mini-stat { text-align: center; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.homework-detail-grid .mini-stat strong { display: block; font-size: 1.2rem; color: var(--primary); }
.homework-detail-grid .mini-stat span { font-size: 0.8rem; color: var(--text-muted); }
.student-overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.student-info-card-wide { grid-column: 1 / -1; }
.student-info-card h3 { margin-bottom: 12px; font-size: 1rem; }
.lesson-card-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.lesson-stat { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; background: #f4f6fa; color: var(--text-muted); font-size: 12px; font-weight: 600; }
.library-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.library-desc { color: var(--text-muted); margin-bottom: 12px; line-height: 1.5; }
@media (max-width: 767px) {
  .student-overview-grid { grid-template-columns: 1fr; }
}

/* ===== DARK THEME ===== */
html[data-theme="dark"] {
  color-scheme: dark;
  --body-bg: #0d0f13;
  --card-bg: #171b23;
  --surface-muted: #1e232d;
  --surface-subtle: #242a35;
  --input-bg: #1c212b;
  --day-item-bg: #1a1f28;
  --text-dark: #eceef3;
  --text-muted: #98a1b0;
  --text-gray-600: #b4bcc8;
  --border: #2b3240;
  --border-input: #3a4354;
  --primary-light: rgba(212, 120, 132, 0.14);
  --success-light: #173528;
  --shadow-card: 0 10px 36px rgba(0, 0, 0, 0.42);
  --sidebar-bg: #101318;
  --red: #d4727f;
  --red-dark: #a84354;
  --primary: #d4727f;
  --primary-hover: #e48a95;
  --gold: #e8c96a;
  --gold-light: #f0dfa0;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(ellipse 80% 50% at 100% -10%, rgba(90, 31, 43, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(212, 175, 55, 0.08) 0%, transparent 50%),
    var(--body-bg);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .stat-widget,
html[data-theme="dark"] .week-widget,
html[data-theme="dark"] .calendar-card,
html[data-theme="dark"] .student-info-card,
html[data-theme="dark"] .teacher-month-hours-banner,
html[data-theme="dark"] .recording-card,
html[data-theme="dark"] .homework-item,
html[data-theme="dark"] .lesson-card,
html[data-theme="dark"] .progress-card .mini-stat,
html[data-theme="dark"] .report-mini-stats .mini-stat,
html[data-theme="dark"] .homework-detail-grid .mini-stat {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

html[data-theme="dark"] .app-header {
  background: rgba(23, 27, 35, 0.92);
  backdrop-filter: blur(10px);
  border-bottom-color: var(--border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .auth-root,
html[data-theme="dark"] .auth-panel,
html[data-theme="dark"] .profile-dropdown,
html[data-theme="dark"] .notif-dropdown,
html[data-theme="dark"] .lang-dropdown,
html[data-theme="dark"] .modal-box,
html[data-theme="dark"] .search-input-wrap input,
html[data-theme="dark"] .inline-form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
html[data-theme="dark"] .inline-form select,
html[data-theme="dark"] .inline-form-option,
html[data-theme="dark"] .modal-form input,
html[data-theme="dark"] .modal-form select,
html[data-theme="dark"] .modal-form textarea,
html[data-theme="dark"] .library-toolbar select,
html[data-theme="dark"] .lesson-recording-link,
html[data-theme="dark"] .filter-group input,
html[data-theme="dark"] .filter-group select,
html[data-theme="dark"] .messages-compose,
html[data-theme="dark"] .user-add-student-fields,
html[data-theme="dark"] .apt-status-box {
  background: var(--card-bg);
  color: var(--text-dark);
  border-color: var(--border);
}

html[data-theme="dark"] .form-control {
  background: var(--input-bg);
  color: var(--text-dark);
  border-color: var(--border-input);
}

html[data-theme="dark"] .profile-link:hover,
html[data-theme="dark"] .lang-opt-row:hover,
html[data-theme="dark"] .lang-opt-row.active,
html[data-theme="dark"] .table tbody tr:hover,
html[data-theme="dark"] .contact-item.active,
html[data-theme="dark"] .lang-opt-row:hover {
  background: var(--surface-subtle);
}

html[data-theme="dark"] .table th {
  background: var(--surface-muted);
  color: var(--text-muted);
}

html[data-theme="dark"] .btn-light {
  background: var(--surface-muted);
  color: var(--text-dark);
  border-color: var(--border);
}

html[data-theme="dark"] .btn-light:hover {
  background: var(--surface-subtle);
  color: var(--text-dark);
}

html[data-theme="dark"] .btn-header:hover,
html[data-theme="dark"] .btn-icon:hover,
html[data-theme="dark"] .theme-toggle-btn:hover {
  background: var(--primary-light);
  color: var(--gold);
}

html[data-theme="dark"] .badge-light-info {
  background: rgba(232, 201, 106, 0.16);
  color: var(--gold);
}

html[data-theme="dark"] .badge-light-success {
  background: rgba(80, 205, 137, 0.14);
  color: #7dcea0;
}

html[data-theme="dark"] .badge-light-primary {
  background: rgba(212, 120, 132, 0.16);
  color: #f0b0b8;
}

html[data-theme="dark"] .lesson-stat,
html[data-theme="dark"] .lesson-section-count {
  background: var(--surface-muted);
  color: var(--text-muted);
}

html[data-theme="dark"] .lesson-card-past .lesson-past-box,
html[data-theme="dark"] .lesson-recordings-box {
  background: var(--surface-muted);
  border-color: var(--border);
}

html[data-theme="dark"] .apt-timeline-time,
html[data-theme="dark"] .chat-bubble.other,
html[data-theme="dark"] .profile-field-value,
html[data-theme="dark"] .pkg-progress-track {
  background: var(--surface-muted);
}

html[data-theme="dark"] .apt-timeline-card {
  background: var(--card-bg);
  border-color: var(--border);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .apt-meta-pill {
  background: var(--surface-muted);
  color: var(--text-gray-600);
}

html[data-theme="dark"] .apt-meta-pill-teacher {
  background: rgba(212, 120, 132, 0.14);
  color: #f0b0b8;
}

html[data-theme="dark"] .apt-meta-pill-student {
  background: rgba(232, 201, 106, 0.14);
  color: var(--gold);
}

html[data-theme="dark"] .day-nav {
  background: var(--primary-light);
  color: var(--gold);
}

html[data-theme="dark"] .day-item {
  background: var(--day-item-bg);
  border-color: var(--border-input);
}

html[data-theme="dark"] .day-item:hover {
  background: var(--surface-subtle);
  border-color: rgba(232, 201, 106, 0.35);
}

html[data-theme="dark"] .day-item.active {
  background: linear-gradient(180deg, rgba(212, 120, 132, 0.18) 0%, var(--day-item-bg) 100%);
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(232, 201, 106, 0.18), 0 8px 22px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .day-item.has-lessons strong,
html[data-theme="dark"] .day-item.active strong,
html[data-theme="dark"] .day-item .day-lesson-count,
html[data-theme="dark"] .day-item.active .day-lesson-count {
  color: var(--gold);
}

html[data-theme="dark"] .day-item span {
  color: var(--text-muted);
}

html[data-theme="dark"] .day-item strong {
  color: var(--text-dark);
}

html[data-theme="dark"] .apt-time,
html[data-theme="dark"] .stat-widget-value,
html[data-theme="dark"] .report-mini-stats .mini-stat strong,
html[data-theme="dark"] .progress-card .mini-stat strong {
  color: var(--gold);
}

html[data-theme="dark"] .stat-widget-icon {
  background: var(--primary-light);
  color: var(--gold);
}

html[data-theme="dark"] .breadcrumb-line a,
html[data-theme="dark"] .page-desc,
html[data-theme="dark"] .empty-text {
  color: var(--text-muted);
}

html[data-theme="dark"] .alert-danger {
  background: rgba(90, 31, 43, 0.28);
  color: #f5b5bf;
  border-color: rgba(212, 120, 132, 0.35);
}

html[data-theme="dark"] .page-loading {
  color: var(--text-muted);
}

html[data-theme="dark"] .auth-logo {
  filter: brightness(0.95);
}

html[data-theme="dark"] .donut::after {
  background: var(--card-bg);
}

html[data-theme="dark"] .user-avatar {
  background-color: var(--surface-muted);
}

html[data-theme="dark"] .user-avatar.has-photo {
  background-color: var(--surface-muted);
}

html[data-theme="dark"] .portal-toast {
  background: #242a35;
  border: 1px solid var(--border);
}

html[data-theme="dark"] .apt-status-ready {
  background: rgba(212, 120, 132, 0.12);
  border-color: rgba(212, 120, 132, 0.28);
  color: #f0b0b8;
}

html[data-theme="dark"] .homework-list .homework-item,
html[data-theme="dark"] .material-list li {
  border-color: var(--border);
}

html[data-theme="dark"] .menu-link:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .menu-link.active {
  box-shadow: 0 6px 18px rgba(168, 67, 84, 0.35);
}
