/* ============================================================
   Component Library — ~25 reusable component classes
   ============================================================ */

/* --- PageHeader --- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.page-header h1 {
  font-size: var(--t-h1);
  color: var(--parchment);
  letter-spacing: -0.02em;
}
.page-header-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--t-breadcrumb);
  color: var(--text-faint);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.breadcrumbs a {
  color: var(--text-dim);
  transition: color var(--transition-fast);
}
.breadcrumbs a:hover {
  color: var(--gold-bright);
}
.breadcrumbs .sep {
  color: var(--text-faint);
  font-size: 12px;
}
.breadcrumbs .current {
  color: var(--gold-bright);
  font-weight: 600;
}

/* --- StatCard --- */
.stat-card {
  padding: var(--space-6) var(--space-5);
  border-radius: var(--radius-m);
  border: 1px solid var(--panel-line);
  background: linear-gradient(165deg, var(--panel), var(--ink-2));
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.15;
}
.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--panel-line-strong);
  box-shadow: var(--shadow-md);
}
.stat-card .icon {
  width: 34px; height: 34px;
  border-radius: var(--radius-s);
  background: var(--panel-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}
.stat-card .icon svg {
  width: 17px; height: 17px;
  stroke: var(--gold-bright);
}
.stat-card .num {
  font-family: var(--font-mono);
  font-size: var(--t-kpi);
  font-weight: 600;
  color: var(--parchment);
  letter-spacing: -0.03em;
  line-height: 1;
}
.stat-card .lbl {
  font-size: var(--t-kpi-label);
  color: var(--text-dim);
  margin-top: var(--space-2);
}
.stat-card .trend {
  font-size: var(--t-caption);
  font-family: var(--font-mono);
  margin-top: var(--space-3);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--radius-full);
  background: rgba(74,156,126,0.14);
  color: var(--emerald);
}
.stat-card .trend.warn {
  background: rgba(201,138,75,0.14);
  color: var(--amber);
}
.stat-card.clickable { cursor: pointer; }
.stat-card.mini { padding: var(--space-4); }
.stat-card.mini .num { font-size: 22px; }
.stat-card.mini .icon { width: 28px; height: 28px; margin-bottom: var(--space-2); }
.stat-card.mini .icon svg { width: 14px; height: 14px; }

/* --- DataTable --- */
.data-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-m);
  border: 1px solid var(--panel-line);
  position: relative;
  background:
    linear-gradient(90deg, var(--ink) 0%, transparent 8px) 0 0 / 20px 100% no-repeat,
    linear-gradient(90deg, transparent calc(100% - 8px), var(--ink) 100%) 100% 0 / 20px 100% no-repeat;
  background-attachment: local, local;
}
.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 14px 20px;
  font-size: var(--t-text);
  border-bottom: 1px solid var(--panel-line);
}
.data-table th {
  font-family: var(--font-mono);
  font-size: var(--t-table-head);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 600;
  background: var(--panel);
}
.data-table tr:last-child td {
  border-bottom: none;
}
.data-table tr:hover td {
  background: rgba(255,255,255,0.015);
}
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.data-table th.sortable:hover {
  color: var(--text-dim);
}
.data-table .bulk-cell {
  width: 40px;
}
.data-table .bulk-cell input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
  cursor: pointer;
}
.data-table .actions-cell {
  display: flex;
  gap: var(--space-2);
}
.data-table .expand-row {
  display: none;
}
.data-table .expand-row.open {
  display: table-row;
}
.data-table .expand-row td {
  background: var(--ink-2);
  padding: var(--space-5);
}
.data-table-row-enter {
  opacity: 0;
  transform: translateX(-8px);
}

/* --- ActionCard --- */
.action-card {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-m);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
  cursor: pointer;
}
.action-card:hover,
.action-card:active {
  border-color: var(--gold);
  transform: translateY(-2px);
}
.action-card .icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--panel-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.action-card .icon svg {
  width: 22px; height: 22px;
  stroke: var(--gold-bright);
}
.action-card span {
  font-size: var(--t-label);
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.action-card.list {
  flex-direction: row;
  justify-content: flex-start;
  padding: 16px 20px;
}
.action-card.list span { text-align: left; }

/* --- FormField --- */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-field label {
  font-size: var(--t-label);
  font-weight: 600;
  color: var(--text-dim);
}
.form-field .helper {
  font-size: var(--t-tooltip);
  color: var(--text-faint);
}
.form-field .error {
  font-size: var(--t-tooltip);
  color: var(--red);
  display: none;
}
.form-field.has-error .error { display: block; }
.form-field.has-error input,
.form-field.has-error select,
.form-field.has-error textarea {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(201,75,75,0.12);
}
.form-field input,
.form-field select,
.form-field textarea {
  font-family: var(--font-body);
  font-size: var(--t-input);
  color: var(--text);
  background: var(--ink-2);
  border: 1px solid var(--panel-line-strong);
  border-radius: var(--radius-s);
  padding: 12px 16px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  width: 100%;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(198,161,91,0.12);
}
.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--text-faint);
}
.form-field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%23a9b8b0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--panel-line-strong);
  border-radius: var(--radius-l);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9);
  transition: transform 0.3s var(--ease);
}
.modal-overlay.open .modal {
  transform: scale(1);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--panel-line);
}
.modal-header h3 {
  font-size: var(--t-modal-title);
  color: var(--parchment);
}
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-s);
  border: 1px solid var(--panel-line);
  background: transparent;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
.modal-close:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}
.modal-close svg { width: 16px; height: 16px; }
.modal-body {
  padding: var(--space-6);
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--panel-line);
}
.modal.fullscreen {
  max-width: 90vw;
  max-height: 90vh;
}
.modal.confirm { text-align: center; }
.modal.confirm .modal-body { padding: var(--space-8) var(--space-6); }

/* --- Drawer --- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer);
  background: var(--overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}
.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: calc(var(--z-drawer) + 1);
  background: var(--panel);
  border-left: 1px solid var(--panel-line-strong);
  width: 420px;
  max-width: 90vw;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s var(--ease);
}
.drawer.right {
  right: 0;
  transform: translateX(100%);
}
.drawer.right.open {
  transform: translateX(0);
}
.drawer.bottom {
  left: 0;
  right: 0;
  top: auto;
  bottom: 0;
  width: 100%;
  max-width: 100vw;
  max-height: 70vh;
  border-left: none;
  border-top: 1px solid var(--panel-line-strong);
  border-radius: var(--radius-l) var(--radius-l) 0 0;
  transform: translateY(100%);
}
.drawer.bottom.open {
  transform: translateY(0);
}
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--panel-line);
}
.drawer-header h3 {
  font-size: var(--t-modal-title);
  color: var(--parchment);
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}

/* --- Toast (JS-enhanced) --- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast-container .toast {
  pointer-events: auto;
}
.toast {
  padding: 14px 20px;
  border-radius: var(--radius-s);
  font-size: var(--t-toast);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 380px;
  box-shadow: var(--shadow-md);
  opacity: 1;
}
.toast.show {
  opacity: 1;
}
.toast-icon { width: 18px; height: 18px; flex: none; }
.toast-success { background: var(--emerald-soft); border: 1px solid var(--emerald); color: var(--emerald); }
.toast-error { background: var(--red-soft); border: 1px solid var(--red); color: var(--red); }
.toast-warning { background: rgba(201,138,75,0.14); border: 1px solid var(--amber); color: var(--amber); }
.toast-info { background: var(--panel-soft); border: 1px solid var(--gold); color: var(--gold-bright); }

/* --- EmptyState --- */
.empty-state {
  padding: 60px 24px;
  text-align: center;
}
.empty-state .empty-icon {
  width: 56px; height: 56px;
  margin: 0 auto var(--space-4);
  opacity: 0.3;
}
.empty-state .empty-icon svg {
  width: 100%; height: 100%;
  stroke: var(--text-faint);
}
.empty-state h3 {
  font-size: var(--t-modal-title);
  color: var(--text-dim);
  margin-bottom: var(--space-2);
}
.empty-state p {
  color: var(--text-faint);
  font-size: 14px;
  line-height: 1.6;
  max-width: 400px;
  margin: 0 auto var(--space-5);
}
.empty-state.has-action p { margin-bottom: var(--space-5); }

/* --- Skeleton --- */
.skeleton {
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-soft) 50%, var(--panel) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s linear infinite;
  border-radius: var(--radius-s);
}
.skeleton-card {
  height: 120px;
  border-radius: var(--radius-m);
}
.skeleton-table-row {
  height: 48px;
  margin-bottom: 2px;
}
.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}
.skeleton-text:last-child { width: 55%; }
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: var(--t-badge);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.badge-ok { background: rgba(74,156,126,0.14); color: var(--emerald); }
.badge-warn { background: rgba(201,138,75,0.14); color: var(--amber); }
.badge-err { background: rgba(201,75,75,0.14); color: var(--red); }
.badge-gold { background: rgba(198,161,91,0.16); color: var(--gold-bright); }
.badge-count {
  min-width: 18px; height: 18px;
  padding: 0 5px;
  font-size: 10px;
  border-radius: 50%;
  justify-content: center;
}
.badge-dot {
  width: 7px; height: 7px;
  padding: 0;
  border-radius: 50%;
}
.badge-dot.ok { background: var(--emerald); }
.badge-dot.warn { background: var(--amber); }
.badge-dot.err { background: var(--red); }

/* --- ProgressBar --- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--panel-soft);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: var(--gold);
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease);
}
.progress-bar .fill.success { background: var(--emerald); }
.progress-bar .fill.warn { background: var(--amber); }
.progress-bar.indeterminate .fill {
  width: 30% !important;
  animation: progress-indeterminate 1.5s var(--ease) infinite;
}
@keyframes progress-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}
.tabs .tab {
  padding: 10px 18px;
  font-size: var(--t-tab);
  font-weight: 600;
  color: var(--text-dim);
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.tabs .tab:hover {
  color: var(--parchment);
  border-color: var(--panel-line);
}
.tabs .tab.active {
  color: var(--gold-bright);
  border-color: var(--gold);
  background: rgba(198,161,91,0.08);
}
.tabs.pills .tab {
  border-radius: var(--radius-full);
}
.tabs.underline .tab {
  border-radius: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 4px;
  margin-bottom: -1px;
}
.tabs.underline .tab.active {
  border-bottom-color: var(--gold);
  color: var(--gold-bright);
  background: transparent;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-5) 0;
}
.pagination .page-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-s);
  border: 1px solid var(--panel-line);
  background: transparent;
  color: var(--text-dim);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.pagination .page-btn:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}
.pagination .page-btn.active {
  background: var(--gold);
  color: var(--color-on-primary);
  border-color: var(--gold);
}
.pagination .page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.pagination .page-nav svg {
  width: 16px; height: 16px;
  stroke: currentColor;
}

/* --- FilterBar --- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: var(--space-4) 0;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--ink);
}
.filter-bar .filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--panel-line);
  background: var(--panel);
  font-size: var(--t-text-sm);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.filter-bar .filter-chip:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}
.filter-bar .filter-chip.active {
  border-color: var(--gold);
  background: rgba(198,161,91,0.08);
  color: var(--gold-bright);
}
.filter-bar .filter-chip svg {
  width: 14px; height: 14px;
  stroke: currentColor;
}
.filter-bar .filter-search {
  position: relative;
  flex: 1;
  max-width: 300px;
}
.filter-bar .filter-search input {
  padding-left: 36px;
}
.filter-bar .filter-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  stroke: var(--text-faint);
  pointer-events: none;
}

/* --- BottomNav (Teacher portal) --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  background: var(--ink-2);
  border-top: 1px solid var(--panel-line);
  display: flex;
  justify-content: space-around;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
  height: 64px;
}
.bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 12px;
  border: none;
  background: none;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity var(--transition-fast);
  min-width: 48px;
  min-height: 44px;
  position: relative;
}
.bottom-nav .nav-item.active {
  opacity: 1;
}
.bottom-nav .nav-item svg {
  width: 22px; height: 22px;
  stroke: var(--gold-bright);
}
.bottom-nav .nav-item span {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 600;
}
.bottom-nav .nav-indicator {
  position: absolute;
  top: -1px;
  height: 2px;
  background: var(--gold);
  border-radius: 0 0 2px 2px;
  transition: left 0.25s var(--ease), width 0.25s var(--ease);
}

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  z-index: var(--z-nav);
  background: var(--ink-2);
  border-right: 1px solid var(--panel-line);
  display: flex;
  flex-direction: column;
  transition: width 0.35s var(--ease);
  overflow: hidden;
}
.sidebar.collapsed { width: 64px; }
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) 0;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.sidebar-item:hover {
  color: var(--parchment);
  background: rgba(255,255,255,0.02);
}
.sidebar-item.active {
  color: var(--gold-bright);
  background: rgba(198,161,91,0.08);
  border-right: 2px solid var(--gold);
}
.sidebar-item svg {
  width: 20px; height: 20px;
  flex: none;
  stroke: currentColor;
}
.sidebar-item .label {
  opacity: 1;
  transition: opacity 0.2s ease;
}
.sidebar.collapsed .sidebar-item { padding: 12px 22px; }
.sidebar.collapsed .sidebar-item .label { opacity: 0; width: 0; overflow: hidden; }
.sidebar-toggle {
  border: none;
  background: none;
  padding: 16px 20px;
  color: var(--text-faint);
  cursor: pointer;
  border-top: 1px solid var(--panel-line);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  transition: color var(--transition-fast);
}
.sidebar-toggle:hover { color: var(--parchment); }
.sidebar-toggle svg { width: 18px; height: 18px; stroke: currentColor; }

/* --- Avatar --- */
.avatar {
  width: 48px; height: 48px;
  border-radius: 14px;
  flex: none;
  background: linear-gradient(150deg, var(--gold-bright), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: #241a08;
  position: relative;
}
.avatar-sm { width: 36px; height: 36px; font-size: 14px; border-radius: 10px; }
.avatar-lg { width: 62px; height: 62px; font-size: 24px; border-radius: 16px; }
.avatar .badge-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  border: 2px solid var(--panel);
}

/* --- SearchInput --- */
.search-input {
  position: relative;
}
.search-input input {
  padding-left: 38px;
  padding-right: 38px;
  font-family: var(--font-body);
  font-size: var(--t-input);
  color: var(--text);
  background: var(--ink-2);
  border: 1px solid var(--panel-line-strong);
  border-radius: var(--radius-full);
  transition: border-color var(--transition-fast);
  width: 100%;
  height: 44px;
}
.search-input input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(198,161,91,0.12);
}
.search-input input::placeholder { color: var(--text-faint); }
.search-input .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  stroke: var(--text-faint);
  pointer-events: none;
}
.search-input .clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--panel-soft);
  color: var(--text-faint);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}
.search-input .clear-btn.visible { display: flex; }
.search-input .clear-btn svg { width: 14px; height: 14px; stroke: currentColor; }

/* --- StepIndicator --- */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-4);
}
.step-indicator .step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.step-indicator .step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--panel-line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-faint);
  transition: all var(--transition-base);
  flex: none;
}
.step-indicator .step.active .step-num {
  border-color: var(--gold);
  background: rgba(198,161,91,0.12);
  color: var(--gold-bright);
}
.step-indicator .step.done .step-num {
  border-color: var(--emerald);
  background: rgba(74,156,126,0.14);
  color: var(--emerald);
}
.step-indicator .step-label {
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 600;
  display: none;
}
.step-indicator .step.active .step-label,
.step-indicator .step.done .step-label {
  display: block;
}
.step-indicator .step-line {
  width: 32px;
  height: 1px;
  background: var(--panel-line-strong);
}
.step-indicator .step.done + .step-line {
  background: var(--emerald);
}
.step-indicator.dots .step-num { display: none; }
.step-indicator.dots .step {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--panel-line-strong);
  transition: background var(--transition-base);
}
.step-indicator.dots .step.active { background: var(--gold); }
.step-indicator.dots .step.done { background: var(--emerald); }
.step-indicator.dots .step-line { display: none; }

/* --- Tag --- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-s);
  font-size: 12px;
  font-weight: 600;
  background: var(--panel-soft);
  color: var(--text-dim);
  transition: all var(--transition-fast);
}
.tag .remove {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
  padding: 0;
}
.tag .remove:hover { opacity: 1; }
.tag .remove svg { width: 12px; height: 12px; stroke: currentColor; }
.tag-gold { background: rgba(198,161,91,0.14); color: var(--gold-bright); }
.tag-emerald { background: rgba(74,156,126,0.14); color: var(--emerald); }
.tag-amber { background: rgba(201,138,75,0.14); color: var(--amber); }

/* --- Tooltip --- */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  padding: 6px 12px;
  border-radius: var(--radius-s);
  background: var(--surface-elevated);
  border: 1px solid var(--panel-line-strong);
  color: var(--text);
  font-size: var(--t-tooltip);
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all var(--transition-fast);
  z-index: var(--z-dropdown);
}
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
[data-tooltip].tooltip-bottom::after {
  top: calc(100% + 6px);
  bottom: auto;
}
[data-tooltip].tooltip-rich::after {
  white-space: normal;
  max-width: 240px;
  text-align: left;
  line-height: 1.4;
}

/* --- Timeline --- */
.timeline { display: flex; flex-direction: column; }
.timeline-item {
  display: flex;
  gap: var(--space-4);
  padding: 15px 0;
  position: relative;
}
.timeline-item:not(:last-child) { border-bottom: 1px solid var(--panel-line); }
.timeline-time {
  font-family: var(--font-mono);
  font-size: var(--t-activity-sub);
  color: var(--text-faint);
  width: 56px;
  flex: none;
  padding-top: 2px;
}
.timeline-dot-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: none;
}
.timeline-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--panel-soft);
  border: 2px solid var(--gold);
}
.timeline-body .t1 { font-size: var(--t-activity-title); color: var(--text); font-weight: 600; }
.timeline-body .t2 { font-size: var(--t-activity-sub); color: var(--text-faint); margin-top: 3px; }

/* --- NotificationPanel --- */
.notif-panel { display: flex; flex-direction: column; }
.notif-panel .head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
}
.notif-panel .head h4 {
  font-size: var(--t-section-lg);
  color: var(--parchment);
  display: flex;
  align-items: center;
  gap: 9px;
}
.notif-panel .notif-list { display: flex; flex-direction: column; gap: 10px; }
.notif-panel .notif-item {
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  transition: border-color var(--transition-base), background var(--transition-base);
  cursor: pointer;
}
.notif-panel .notif-item:hover {
  border-color: var(--panel-line-strong);
  background: rgba(255,255,255,0.02);
}
.notif-panel .notif-item.unread {
  border-color: var(--panel-line-strong);
  background: rgba(198,161,91,0.045);
}
.notif-panel .notif-item .ic {
  width: 30px; height: 30px;
  border-radius: var(--radius-s);
  background: var(--panel-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.notif-panel .notif-item .ic svg { width: 14px; height: 14px; stroke: var(--gold-bright); }
.notif-panel .notif-item .t1 { font-size: var(--t-text); color: var(--text); font-weight: 600; }
.notif-panel .notif-item .t2 { font-size: var(--t-caption); color: var(--text-faint); margin-top: 3px; }
.notif-panel .notif-item .dot-new {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold-bright);
  flex: none;
  margin-left: auto;
  margin-top: 5px;
}

/* --- Text utilities --- */
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.line-clamp-1,
.line-clamp-2,
.line-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.line-clamp-1 { -webkit-line-clamp: 1; }
.line-clamp-2 { -webkit-line-clamp: 2; }
.line-clamp-3 { -webkit-line-clamp: 3; }

/* --- Stack helpers --- */
.stack-gap { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-gap-lg { display: flex; flex-direction: column; gap: var(--space-6); }

/* --- Card header --- */
.card-head,
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--panel-line);
}
.card-head h3,
.card-header h3 {
  font-size: var(--t-section-lg);
  color: var(--parchment);
}
.card-head.flush,
.card-header.flush { border-bottom: none; }

/* --- StatTile (compact KPI card, replaces emoji tiles) --- */
.stat-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-m);
  background: linear-gradient(165deg, var(--panel), var(--ink-2));
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--gold-hairline);
  text-decoration: none;
  color: var(--text);
  transition: transform var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}
.stat-tile:hover {
  transform: translateY(-3px);
  border-color: var(--panel-line-strong);
  box-shadow: var(--shadow-md), inset 0 1px 0 var(--gold-hairline);
}
.stat-tile .st-icon {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: var(--panel-soft); border: 1px solid var(--panel-line);
  display: flex; align-items: center; justify-content: center;
}
.stat-tile .st-icon svg { width: 20px; height: 20px; stroke: var(--gold-bright); }
.stat-tile .st-body { min-width: 0; }
.stat-tile .st-num {
  font-family: var(--font-mono); font-size: 22px; font-weight: 600;
  color: var(--parchment); line-height: 1.1; white-space: nowrap;
}
.stat-tile .st-lbl { font-size: var(--t-text-sm); color: var(--text-dim); margin-top: 3px; }
.stat-tile.warn .st-icon { background: rgba(201,138,75,0.14); border-color: rgba(201,138,75,0.3); }
.stat-tile.warn .st-icon svg { stroke: var(--amber); }
.stat-tile.warn .st-num { color: var(--amber); }

/* --- TaskBanner (bulk-entry task header) --- */
.task-banner {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 22px;
  border: 1px solid var(--panel-line-strong);
  border-radius: var(--radius-m);
  background: linear-gradient(165deg, var(--panel), var(--ink-2));
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--gold-hairline);
}
.task-banner .tb-icon {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  background: rgba(198,161,91,0.12); border: 1px solid var(--panel-line-strong);
  display: flex; align-items: center; justify-content: center;
}
.task-banner .tb-icon svg { width: 22px; height: 22px; stroke: var(--gold-bright); }
.task-banner .tb-body { flex: 1; min-width: 0; }
.task-banner .tb-title { font-size: var(--t-card-title); font-weight: 700; color: var(--parchment); }
.task-banner .tb-desc { font-size: var(--t-card-desc); color: var(--text-dim); margin-top: 4px; line-height: 1.5; }
.task-banner .tb-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* --- TaskLink (chip-style row link) --- */
.task-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--panel-line-strong);
  background: rgba(255,255,255,0.02);
  color: var(--text-dim);
  font-size: var(--t-btn-sm);
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
}
.task-link:hover { border-color: var(--gold); color: var(--gold-bright); background: rgba(198,161,91,0.06); }
.task-link svg { width: 15px; height: 15px; stroke: currentColor; flex: none; }
.task-link.active { border-color: var(--gold); color: var(--gold-bright); background: rgba(198,161,91,0.08); }

/* --- ExamDutyCard (teacher portal session/duty cards) --- */
.exam-duty-card {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-m);
  padding: 14px 16px;
}
.exam-duty-card + .exam-duty-card { margin-top: 12px; }
.exam-duty-card .duty-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.exam-duty-card .duty-title { font-size: 14px; font-weight: 700; color: var(--parchment); }
.exam-duty-card .duty-meta { font-size: var(--t-activity-sub); color: var(--text-faint); margin-top: 6px; font-family: var(--font-mono); }

/* --- Button disabled state --- */
.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-gold:disabled {
  background: var(--panel);
  color: var(--text-faint);
  box-shadow: none;
  border-color: var(--panel-line);
}

/* --- Empty state --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 24px;
  text-align: center;
}
.empty-state .es-icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--panel-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-bright); margin-bottom: 6px;
}
.empty-state .es-icon svg { width: 19px; height: 19px; stroke: currentColor; fill: none; }
.empty-state p { margin: 0; font-size: var(--t-text); color: var(--text-dim); }
.empty-state .es-sub { font-size: var(--t-caption); color: var(--text-faint); }
.empty-state.compact { padding: 28px 16px; }

/* --- Print --- */
@media print {
  .sidebar, .sidebar-overlay, .app-topbar, .about-header, .about-footer,
  .btn, .no-print, header.nav, footer, .skip-link, #scrollProgress { display: none !important; }
  .app-content { margin-left: 0 !important; }
  body { background: #fff; color: #000; }
  .wrap { max-width: 100%; padding: 0; }
}
