/* ==========================================================================
   教学管理系统 · shared interface refresh
   Loaded after app.css and page-specific CSS, before themes.css.
   ========================================================================== */

[hidden] {
  display: none !important;
}

html {
  background: var(--canvas);
}

body {
  font-family: var(--font-ui);
  color: var(--text);
  background-color: var(--canvas);
  background-image: var(--body-art);
  background-size: var(--body-art-size);
  background-attachment: fixed;
  font-size: 14px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  color: var(--text);
  background: var(--selection);
}

a {
  color: var(--primary-600);
}

a:hover {
  color: var(--primary-700);
}

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

button {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Shell / sidebar
   -------------------------------------------------------------------------- */

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 16px 0 44px -40px rgba(0, 0, 0, 0.6);
}

.sidebar::after {
  background: none;
}

.brand {
  gap: 13px;
  padding: 24px 20px 17px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--brand-radius);
  color: var(--brand-fg);
  background: var(--brand-bg);
  box-shadow: 0 8px 22px -14px rgba(0, 0, 0, 0.5);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
}

.brand-name {
  color: var(--sidebar-text);
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: var(--heading-weight);
  letter-spacing: 0.01em;
}

.brand-sub {
  margin-top: 4px;
  color: var(--sidebar-accent);
  font-family: var(--font-ui);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.nav {
  padding: 8px 14px 26px;
}

.nav-group-title {
  padding: 19px 11px 7px;
  color: var(--sidebar-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.nav-link {
  min-height: 40px;
  gap: 11px;
  margin-bottom: 3px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-muted);
  font-size: 13.5px;
  font-weight: 550;
}

.nav-link svg {
  width: 17px;
  height: 17px;
  opacity: 0.8;
}

.nav-link:hover {
  color: var(--sidebar-text);
  background: var(--sidebar-hover);
}

.nav-link:focus-visible {
  outline-color: var(--sidebar-accent);
}

.nav-link.active {
  color: var(--sidebar-active-text);
  background: var(--sidebar-active);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.045);
  font-weight: 650;
}

.nav-link.active::before {
  left: -14px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--sidebar-accent);
}

.nav-link.active svg {
  opacity: 1;
}

.nav-badge {
  min-width: 19px;
  height: 19px;
  margin-left: auto;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--danger);
  color: var(--on-primary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.sidebar-foot {
  padding: 13px 14px 17px;
  border-top-color: rgba(255, 255, 255, 0.07);
}

.user-card {
  min-height: 51px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--sidebar-card);
}

.avatar {
  width: 33px;
  height: 33px;
  border-radius: calc(var(--radius-sm) - 1px);
  color: var(--avatar-fg);
  background: var(--avatar-bg);
  font-size: 12.5px;
}

.user-name {
  color: var(--sidebar-text);
  font-size: 12.5px;
}

.user-role {
  color: var(--sidebar-muted);
  font-size: 10.5px;
}

.logout-btn {
  color: var(--sidebar-muted);
  border-radius: var(--radius-sm);
}

.logout-btn:hover {
  color: var(--sidebar-text);
  background: var(--sidebar-hover);
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 35;
  visibility: hidden;
  opacity: 0;
  background: var(--overlay);
  backdrop-filter: blur(2px);
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

.sidebar-scrim.is-visible {
  visibility: visible;
  opacity: 1;
}

body.nav-open {
  overflow: hidden;
}

.main {
  margin-left: var(--sidebar-w);
}

/* --------------------------------------------------------------------------
   Topbar / theme switcher
   -------------------------------------------------------------------------- */

.topbar {
  height: var(--topbar-h);
  gap: 14px;
  padding: 0 30px;
  color: var(--topbar-text);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px) saturate(1.20);
}

.menu-btn {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
}

.topbar-context {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-kicker {
  color: var(--text-faint);
  font-family: var(--font-ui);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.15em;
  white-space: nowrap;
}

.topbar-sep {
  width: 1px;
  height: 14px;
  background: var(--border);
}

.topbar-title {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.topbar-date {
  gap: 6px;
  color: var(--text-muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.topbar-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 9px;
  color: var(--warning-text);
  font-size: 11px;
  font-weight: 650;
  background: var(--warning-soft);
  border: 1px solid color-mix(in srgb, var(--warning) 24%, transparent);
  border-radius: var(--radius-sm);
}

.topbar-chip:hover {
  color: var(--warning-text);
  border-color: color-mix(in srgb, var(--warning) 42%, transparent);
}

.topbar-chip strong {
  font-family: var(--font-mono);
  font-size: 11px;
}

.theme-switcher {
  position: relative;
  flex-shrink: 0;
}

.theme-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 9px;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.theme-trigger:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-raised);
}

.theme-current-swatch {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.theme-trigger-chevron {
  width: 11px;
  height: 11px;
  opacity: 0.5;
  transform: rotate(90deg);
  transition: transform 0.15s ease;
}

.theme-trigger[aria-expanded="true"] .theme-trigger-chevron {
  transform: rotate(-90deg);
}

.theme-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 90;
  width: 316px;
  padding: 9px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: themeMenuIn 0.16s ease both;
}

@keyframes themeMenuIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.theme-menu-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 6px 8px 8px;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 700;
}

.theme-menu-head small {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.09em;
}

.theme-option {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  color: var(--text-soft);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.theme-option:hover {
  background: var(--surface-2);
  border-color: var(--border-soft);
}

.theme-option.is-active {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 22%, transparent);
}

.theme-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 12px 12px;
  gap: 2px;
  width: 50px;
  height: 26px;
  padding: 3px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.10);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.theme-preview i {
  display: block;
  border-radius: 1px;
}

.theme-preview i:nth-child(1) {
  grid-row: 1 / 3;
}

.theme-option-copy {
  min-width: 0;
}

.theme-option-copy strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.theme-option-copy small {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-option-check {
  color: var(--primary-600);
  opacity: 0;
}

.theme-option.is-active .theme-option-check {
  opacity: 1;
}

.theme-menu-foot {
  margin-top: 6px;
  padding: 8px 8px 3px;
  color: var(--text-faint);
  font-size: 9.5px;
  border-top: 1px solid var(--border-soft);
}

/* --------------------------------------------------------------------------
   Page headers / content rhythm
   -------------------------------------------------------------------------- */

.content {
  max-width: 1600px;
  padding: 28px 32px 54px;
}

.page-head {
  align-items: flex-end;
  margin-bottom: 24px;
  padding-bottom: 19px;
  border-bottom: 1px solid var(--border-soft);
}

.page-head > div:first-child {
  min-width: 0;
}

.page-title {
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(27px, 2.45vw, 38px);
  font-weight: var(--heading-weight);
  line-height: 1.18;
  letter-spacing: var(--title-tracking);
}

.page-subtitle {
  max-width: 850px;
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.65;
}

.page-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.page-kicker::before {
  content: "";
  width: 18px;
  height: 2px;
  background: currentColor;
}

.page-actions {
  gap: 8px;
}

.page-head .badge {
  vertical-align: middle;
}

/* --------------------------------------------------------------------------
   Statistics strip
   -------------------------------------------------------------------------- */

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 20px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

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

.stat-card {
  min-width: 0;
  min-height: 108px;
  padding: 18px 20px;
  gap: 14px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.stat-card:not(:last-child) {
  border-right: 1px solid var(--border-soft);
}

.stat-card::after {
  display: none;
}

.stat-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: var(--radius-sm);
  color: var(--tone, var(--primary));
  background: color-mix(in srgb, var(--tone, var(--primary)) 11%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tone, var(--primary)) 15%, var(--border));
}

.stat-value {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: var(--heading-weight);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-value small {
  margin-left: 2px;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 550;
  letter-spacing: 0;
}

.stat-label {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.stat-card--primary { --tone: var(--primary); }
.stat-card--info { --tone: var(--info); }
.stat-card--success { --tone: var(--success); }
.stat-card--warning { --tone: var(--warning); }
.stat-card--danger { --tone: var(--danger); }
.stat-card--neutral { --tone: var(--text-muted); }
.stat-card--accent { --tone: var(--accent); }

.quick-grid {
  gap: 10px;
}

.quick-link {
  min-height: 56px;
  padding: 11px 13px;
  color: var(--text-soft);
  background: var(--surface-2);
  border-color: var(--border-soft);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

.quick-link:hover {
  color: var(--text);
  background: var(--surface-raised);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.quick-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--primary-600);
  background: var(--primary-soft);
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-head {
  padding: 17px 21px 15px;
  border-bottom: 1px solid var(--border-soft);
}

.card-title {
  color: var(--text);
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.45;
}

.card-sub {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.card-body {
  padding: 18px 21px;
}

.card-body.tight {
  padding: 8px 12px;
}

.card-pad {
  padding: 21px;
}

.section-divider {
  background: var(--border-soft);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  height: 38px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.btn-primary {
  color: var(--on-primary);
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

.btn-primary:hover {
  color: var(--on-primary);
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-secondary {
  color: var(--text-soft);
  background: var(--surface);
  border-color: var(--border);
}

.btn-secondary:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn-ghost {
  color: var(--text-muted);
  background: transparent;
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--surface-2);
}

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

.btn-accent:hover {
  color: var(--on-accent);
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  color: var(--on-primary);
  background: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  color: var(--on-primary);
  background: color-mix(in srgb, var(--danger) 82%, #000);
  border-color: color-mix(in srgb, var(--danger) 82%, #000);
}

.btn-soft-danger {
  color: var(--danger-text);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 18%, transparent);
}

.btn-soft-danger:hover {
  color: var(--danger-text);
  background: color-mix(in srgb, var(--danger) 18%, var(--surface));
}

.btn-sm {
  height: 31px;
  padding: 0 10px;
  font-size: 11.5px;
  border-radius: calc(var(--radius-sm) - 1px);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn[disabled] {
  opacity: 0.48;
}

/* --------------------------------------------------------------------------
   Badges / tags
   -------------------------------------------------------------------------- */

.badge {
  min-height: 23px;
  height: auto;
  padding: 3px 8px;
  border-radius: var(--badge-radius);
  color: var(--text-muted);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.4;
}

.badge-primary {
  color: var(--primary-700);
  background: var(--primary-soft);
}

.badge-success {
  color: var(--success-text);
  background: var(--success-soft);
}

.badge-warning {
  color: var(--warning-text);
  background: var(--warning-soft);
}

.badge-danger {
  color: var(--danger-text);
  background: var(--danger-soft);
}

.badge-info {
  color: var(--info-text);
  background: var(--info-soft);
}

.badge-dot::before {
  width: 5px;
  height: 5px;
}

.badge-tone {
  color: color-mix(in srgb, var(--tone, var(--primary)) 74%, var(--text));
  background: color-mix(in srgb, var(--tone, var(--primary)) 11%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tone, var(--primary)) 18%, transparent);
}

.tag {
  padding: 2px 7px;
  color: color-mix(in srgb, var(--tag-color, var(--text-muted)) 72%, var(--text));
  background: color-mix(in srgb, var(--tag-color, var(--text-muted)) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--tag-color, var(--text-muted)) 18%, var(--border));
  border-radius: var(--badge-radius);
  font-size: 11px;
}

.subject-mark {
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.table-wrap::-webkit-scrollbar {
  height: 9px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 2px solid var(--surface);
  border-radius: 99px;
}

.table {
  color: var(--text-soft);
  font-size: 12.8px;
}

.table th {
  padding: 11px 15px;
  color: var(--text-muted);
  background: var(--table-head);
  border-bottom: 1px solid var(--border);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.table td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-soft);
}

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

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

.cell-main {
  color: var(--text);
  font-size: 12.8px;
  font-weight: 650;
}

.cell-sub {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--primary-700);
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 10%, transparent);
  font-size: 11.5px;
  font-weight: 750;
}

.table .actions {
  gap: 4px;
}

/* --------------------------------------------------------------------------
   Toolbars / filters / controls
   -------------------------------------------------------------------------- */

.toolbar {
  gap: 9px;
  padding: 13px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
}

.toolbar .spacer {
  flex: 1;
}

.toolbar > form {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.toolbar .select-sm {
  flex: 1 1 120px;
  width: auto !important;
  min-width: 104px;
  max-width: 200px;
}

.toolbar .search-box {
  flex: 2 1 200px;
  max-width: 330px;
}

.toolbar .btn-sm {
  flex-shrink: 0;
}

.toolbar .spacer {
  flex: 1 1 16px;
}

.input,
.select,
.textarea {
  min-height: 40px;
  padding: 8px 11px;
  color: var(--text);
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.025);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-faint);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.input-sm,
.select-sm {
  min-height: 34px;
  height: 34px;
  padding: 6px 9px;
  font-size: 12px;
}

.select:disabled,
.input:disabled,
.textarea:disabled {
  color: var(--text-faint);
  background: var(--surface-2);
  opacity: 0.7;
}

.select option {
  color: var(--text);
  background: var(--surface);
}

.search-box {
  min-width: 220px;
}

.search-box .input {
  padding-left: 33px;
}

.search-box svg {
  color: var(--text-faint);
}

input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  color-scheme: inherit;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--primary);
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.form-card {
  max-width: 1040px;
}

.form-grid {
  gap: 18px 20px;
}

.field {
  gap: 6px;
}

.field-label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.field-help {
  color: var(--text-muted);
  font-size: 11px;
}

.field-error {
  color: var(--danger-text);
  font-size: 11.5px;
}

.checkbox,
.checkbox-list label {
  color: var(--text-soft);
  font-size: 12.5px;
}

.checkbox-card {
  background: var(--surface-2);
  border-color: var(--border-soft);
  border-radius: var(--radius-sm);
}

.form-section-title {
  color: var(--text-muted);
  border-top-color: var(--border-soft);
}

.inline-form {
  display: inline;
}

.form-actions {
  gap: 9px;
}

/* --------------------------------------------------------------------------
   Messages / empty / pagination / timeline
   -------------------------------------------------------------------------- */

.message {
  gap: 9px;
  padding: 11px 13px;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

.message-success {
  color: var(--success-text);
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 24%, transparent);
}

.message-error {
  color: var(--danger-text);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 24%, transparent);
}

.message-warning {
  color: var(--warning-text);
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 26%, transparent);
}

.message-info {
  color: var(--info-text);
  background: var(--info-soft);
  border-color: color-mix(in srgb, var(--info) 24%, transparent);
}

.empty {
  color: var(--text-muted);
}

.empty-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
}

.empty-title {
  color: var(--text-soft);
  font-size: 13.5px;
}

.empty-text {
  color: var(--text-muted);
  font-size: 12px;
}

.pagination {
  padding: 13px 18px;
  color: var(--text-muted);
  border-top-color: var(--border-soft);
  font-size: 11.5px;
}

.pager a,
.pager span {
  min-width: 30px;
  height: 30px;
  color: var(--text-soft);
  background: var(--surface);
  border-color: var(--border);
  border-radius: var(--radius-sm);
}

.pager a:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.pager .current {
  color: var(--on-primary);
  background: var(--primary);
  border-color: var(--primary);
}

.timeline::before {
  background: var(--border);
}

.timeline-item::before {
  background: var(--surface);
  border-color: var(--primary-600);
}

.timeline-time {
  color: var(--text-faint);
  font-size: 10.5px;
}

.timeline-text {
  color: var(--text-soft);
  font-size: 12.5px;
}

.tabs {
  border-bottom-color: var(--border);
}

.tab {
  color: var(--text-muted);
  font-size: 12.5px;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--primary-700);
  border-bottom-color: var(--primary);
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 650; }
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-warning { color: var(--warning-text); }
.text-danger { color: var(--danger-text); }

/* --------------------------------------------------------------------------
   Layout helpers
   -------------------------------------------------------------------------- */

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

.layout-split--narrow {
  grid-template-columns: minmax(0, 1fr) 300px;
}

.calendar-scroll {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.conflict-banner {
  border-color: color-mix(in srgb, var(--danger) 26%, var(--border));
}

.conflict-banner-head {
  background: var(--danger-soft);
  border-radius: var(--radius) var(--radius) 0 0;
}

.conflict-banner-head .card-title,
.conflict-banner-head .card-sub,
.conflict-banner-head > svg,
.conflict-line {
  color: var(--danger-text);
}

.conflict-line {
  padding: 4px 0;
  font-size: 12px;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Calendar / timetable
   -------------------------------------------------------------------------- */

.week-switch {
  gap: 7px;
}

.calendar-head {
  color: var(--text-muted);
  background: var(--table-head);
  border-bottom-color: var(--border);
}

.calendar-head div {
  padding: 9px 10px;
  font-size: 10.5px;
  letter-spacing: 0.03em;
}

.calendar-grid {
  background: var(--border-soft);
}

.calendar-day {
  min-height: 138px;
  padding: 8px;
  background: var(--surface);
  border-right-color: var(--border-soft);
  border-bottom-color: var(--border-soft);
}

.calendar-day.is-outside {
  background: var(--surface-sunken);
}

.calendar-day.is-today {
  background: color-mix(in srgb, var(--primary) 5%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 17%, transparent);
}

.calendar-day.is-rest {
  background: var(--surface-2);
}

.calendar-date {
  color: var(--text-soft);
  font-size: 11.5px;
}

.calendar-date.is-outside {
  color: var(--text-faint);
}

.calendar-date .today-dot {
  background: var(--primary);
}

.session-chip {
  padding: 5px 7px;
  background: color-mix(in srgb, var(--chip-color, var(--primary)) 10%, var(--surface));
  color: var(--text-soft);
  border-left-color: color-mix(in srgb, var(--chip-color, var(--primary)) 82%, var(--text));
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.session-chip strong {
  color: color-mix(in srgb, var(--chip-color, var(--primary)) 58%, var(--text));
  font-size: 11.2px;
}

.session-chip span {
  color: var(--text-muted);
  opacity: 1;
  font-size: 10px;
}

.session-chip:hover {
  background: color-mix(in srgb, var(--chip-color, var(--primary)) 16%, var(--surface));
}

.day-note {
  background: var(--warning-soft);
  color: var(--warning-text);
  border-radius: var(--badge-radius);
  font-size: 10px;
}

.day-empty {
  color: var(--text-faint);
}

/* --------------------------------------------------------------------------
   Progress + plan workbench
   -------------------------------------------------------------------------- */

.progressbar {
  height: 6px;
  background: var(--surface-sunken);
}

.progressbar span {
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.plan-summary {
  padding: 14px 18px;
  margin-bottom: 14px;
}

.plan-summary-avatar {
  width: 42px;
  height: 42px;
  font-size: 15px;
}

.plan-summary-name .tiny {
  color: var(--text-muted);
}

.plan-tools {
  margin-bottom: 14px;
}

.plan-tools-summary {
  padding: 12px 17px;
}

.plan-tools-body {
  background: var(--surface-2);
  border-top-color: var(--border-soft);
}

.plan-tool {
  background: var(--surface);
  border-color: var(--border-soft);
  border-radius: var(--radius-sm);
}

.plan-tool-title {
  color: var(--text);
  font-size: 12.5px;
}

.plan-tool-notes {
  color: var(--text-soft);
}

.plan-board-card {
  border-radius: var(--radius);
}

.plan-board-toolbar {
  padding: 12px 17px;
  background: var(--surface);
  border-bottom-color: var(--border);
}

.plan-board-legend {
  color: var(--text-muted);
}

.plan-board-scroll {
  background: var(--border);
  scrollbar-color: var(--border-strong) transparent;
}

.plan-board-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-color: var(--surface);
}

.plan-board {
  gap: 1px;
  background: var(--border);
}

.plan-day {
  background: var(--surface);
}

.plan-day.is-weekend {
  background: var(--surface-2);
}

.plan-day.is-today {
  background: color-mix(in srgb, var(--primary) 4%, var(--surface));
}

.plan-day-head {
  background: var(--table-head);
  border-bottom-color: var(--border);
}

.plan-day.is-today .plan-day-head {
  background: color-mix(in srgb, var(--primary) 7%, var(--surface));
  border-top-color: var(--primary);
}

.plan-day.is-weekend .plan-day-head {
  background: var(--surface-2);
}

.plan-day.is-rest .plan-day-head {
  background: var(--surface-sunken);
}

.plan-day.is-exam .plan-day-head {
  background: color-mix(in srgb, var(--danger) 7%, var(--surface));
}

.plan-day-name {
  color: var(--text);
  font-size: 12.5px;
}

.plan-day-date {
  color: var(--text-muted);
}

.plan-today-chip {
  color: var(--warning-text);
  background: var(--warning-soft);
  border-radius: var(--badge-radius);
}

.plan-day-count {
  color: var(--text-muted);
  font-size: 10.5px;
}

.plan-day-form,
.plan-course-panel,
.plan-task-panel {
  color: var(--text);
  background: var(--surface-raised);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

.plan-event {
  color: var(--warning-text);
  background: var(--warning-soft);
}

.plan-course {
  background: color-mix(in srgb, var(--course-color, var(--primary)) 9%, var(--surface));
  border-color: color-mix(in srgb, var(--course-color, var(--primary)) 20%, var(--border-soft));
  border-left-color: var(--course-color, var(--primary));
  border-radius: var(--radius-sm);
  font-size: 11.5px;
}

.plan-course-time {
  color: color-mix(in srgb, var(--course-color, var(--primary)) 60%, var(--text));
  font-size: 10px;
}

.plan-course-name {
  color: var(--text);
  font-size: 11.8px;
}

.plan-course-meta {
  color: var(--text-muted);
  font-size: 10px;
}

.plan-course-status {
  color: var(--warning-text);
  background: var(--warning-soft);
}

.plan-task-list.is-drop-target {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 24%, transparent);
}

.plan-task {
  background: var(--surface);
  border-color: var(--border-soft);
  border-left-color: var(--subject-color, var(--primary));
  border-radius: var(--radius-sm);
  font-size: 11.8px;
}

.plan-task:hover,
.plan-task:focus-within {
  border-color: var(--border-strong);
}

.plan-task[data-task-status="DONE"] {
  background: color-mix(in srgb, var(--success) 6%, var(--surface));
}

.plan-task[data-task-status="IN_PROGRESS"] {
  background: color-mix(in srgb, var(--info) 6%, var(--surface));
}

.plan-task[data-task-status="INCOMPLETE"] {
  background: color-mix(in srgb, var(--danger) 5%, var(--surface));
}

.plan-task-title {
  color: var(--text);
  font-size: 12px;
}

.plan-task-meta {
  color: var(--text-muted);
  font-size: 10.2px;
}

.plan-task-type {
  color: var(--text-faint);
  font-size: 9.8px;
}

.plan-task-status {
  border-radius: var(--badge-radius);
  font-size: 9.5px;
}

.plan-task-status.is-done {
  color: var(--success-text);
  background: var(--success-soft);
}

.plan-task-status.is-progress {
  color: var(--info-text);
  background: var(--info-soft);
}

.plan-task-status.is-incomplete {
  color: var(--danger-text);
  background: var(--danger-soft);
}

.plan-task-status.is-adjusted {
  color: var(--warning-text);
  background: var(--warning-soft);
}

.plan-task-note {
  color: var(--text-muted);
  background: var(--surface-2);
}

.plan-task-empty {
  color: var(--text-faint);
  border-color: var(--border);
}

.plan-drop-placeholder {
  border-color: var(--primary-600);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.plan-toast {
  color: var(--text);
  background: var(--surface-raised);
  border-color: var(--border);
}

.plan-toast.is-error {
  color: var(--danger-text);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 24%, transparent);
}

.plan-toast.is-success {
  color: var(--success-text);
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 24%, transparent);
}

/* --------------------------------------------------------------------------
   Feedback center
   -------------------------------------------------------------------------- */

.fb-view-switch {
  background: var(--surface);
  border-color: var(--border);
  border-radius: var(--radius-sm);
}

.fb-kpis {
  gap: 10px;
}

.fb-kpis .stat-card {
  min-height: 88px;
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.fb-kpi-sub {
  color: var(--text-muted);
  font-size: 10.5px;
}

.fb-kpi-sub.is-alert {
  color: var(--danger-text);
}

.fb-kpi-text {
  font-size: 23px !important;
}

.fb-donut {
  background: var(--donut-bg, var(--surface-sunken));
}

.fb-donut::after {
  background: var(--surface);
}

.fb-legend li {
  color: var(--text-muted);
}

.fb-legend-label {
  color: var(--text-soft);
}

.fb-chart-legend {
  color: var(--text-muted);
}

.fb-legend-bar.is-created,
.fb-trend-bar.is-created {
  background: var(--info);
}

.fb-legend-bar.is-resolved,
.fb-trend-bar.is-resolved {
  background: var(--success);
}

.fb-trend-day {
  border-bottom-color: var(--border-soft);
}

.fb-trend-label {
  color: var(--text-faint);
  font-size: 9px;
}

.fb-dist-track {
  background: var(--surface-sunken);
}

.fb-filter-card {
  margin-bottom: 14px;
}

.fb-filter-chip {
  color: var(--primary-700);
  background: var(--primary-soft);
  border-radius: var(--badge-radius);
}

.fb-board {
  gap: 10px;
}

.fb-column {
  background: var(--surface);
  border-color: var(--border);
  border-top-color: var(--status-tone, var(--primary));
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.fb-column-head {
  background: color-mix(in srgb, var(--status-tone, var(--primary)) 7%, var(--surface));
  border-bottom-color: var(--border-soft);
}

.fb-column-title h2 {
  color: var(--text);
  font-size: 13px;
}

.fb-column-count {
  color: var(--on-primary);
  background: var(--status-tone, var(--primary));
  border-radius: var(--badge-radius);
  font-size: 10px;
}

.fb-column-meta {
  color: var(--text-muted);
  font-size: 10.5px;
}

.fb-column-body {
  gap: 7px;
}

.fb-column-empty {
  color: var(--text-faint);
  border-color: var(--border);
}

.fb-column-more {
  color: var(--primary-700);
  background: var(--primary-soft);
}

.fb-card {
  background: var(--surface);
  border-color: var(--border-soft);
  border-left-color: var(--status-tone, var(--primary));
  border-radius: var(--radius-sm);
}

.fb-card:hover {
  border-color: var(--border-strong);
}

.fb-card.is-overdue {
  background: color-mix(in srgb, var(--danger) 4%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 22%, var(--border));
  border-left-color: var(--danger);
}

.fb-person .cell-main {
  color: var(--text);
  font-size: 12px;
}

.fb-person .cell-sub {
  color: var(--text-muted);
  font-size: 10.5px;
}

.fb-age {
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: var(--badge-radius);
}

.fb-age.is-overdue {
  color: var(--danger-text);
  background: var(--danger-soft);
}

.fb-card-badges .badge {
  font-size: 9.5px;
}

.fb-card-content {
  color: var(--text-soft);
  font-size: 11.8px;
}

.fb-card-linked {
  color: var(--text-muted);
  font-size: 10.5px;
}

.fb-linked-tag {
  color: var(--primary-700);
  background: var(--primary-soft);
}

.fb-linked-missing {
  color: var(--danger-text);
}

.fb-card-footer {
  background: var(--surface-2);
  border-top-color: var(--border-soft);
}

.fb-card-handler {
  color: var(--text-muted);
  font-size: 10px;
}

.fb-card-actions .btn-sm {
  font-size: 10.5px;
}

.fb-step-label {
  color: var(--text-muted);
  font-size: 10px;
}

.fb-step.is-active .fb-step-label {
  color: var(--primary-700);
}

.fb-step.is-done .fb-step-label {
  color: var(--success-text);
}

.fb-step.is-done:not(:last-child)::after {
  background: color-mix(in srgb, var(--success) 38%, transparent);
}

.fb-drawer-overlay {
  background: var(--overlay);
}

.fb-drawer {
  background: var(--surface-raised);
  border-left: 1px solid var(--border);
}

.fb-drawer-close {
  color: var(--text-muted);
  background: var(--surface-2);
  border-color: var(--border);
}

.fb-drawer-close:hover {
  color: var(--text);
  background: var(--surface);
}

.fb-drawer-body {
  background: var(--surface-raised);
}

.fb-panel-head {
  background: var(--surface-raised);
  border-bottom-color: var(--border);
}

.fb-panel-person .avatar-sm {
  width: 36px;
  height: 36px;
}

.fb-panel-meta {
  color: var(--text-muted);
  font-size: 11px;
}

.fb-panel-block {
  border-bottom-color: var(--border-soft);
}

.fb-panel-block h3 {
  color: var(--text);
  font-size: 12.5px;
}

.fb-panel-content {
  color: var(--text-soft);
  font-size: 13px;
}

.fb-resolution {
  background: color-mix(in srgb, var(--success) 5%, var(--surface-raised));
}

.fb-hint {
  color: var(--text-muted);
  border-color: var(--border);
}

.fb-form-target {
  background: var(--surface-2);
  border-color: var(--border-soft);
}

.fb-choice-grid .radio-list label {
  color: var(--text-soft);
  background: var(--surface);
  border-color: var(--border);
}

.fb-missing {
  background: var(--surface-2);
  border-color: var(--border);
}

.fb-detail-head {
  background: var(--surface);
}

.fb-detail-wait {
  color: var(--text-muted);
  background: var(--surface-2);
}

.fb-detail-content {
  color: var(--text-soft);
}

.fb-overdue-text {
  color: var(--danger-text);
}

/* --------------------------------------------------------------------------
   Student weekly plans
   -------------------------------------------------------------------------- */

.sp-day-cell {
  min-height: 45px;
  padding: 5px 3px;
  color: var(--text-soft);
  background: var(--surface-2);
  border-color: var(--border-soft);
  border-radius: var(--radius-sm);
}

.sp-day-cell.is-today {
  border-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 8%, var(--surface));
}

.sp-day-cell.is-rest {
  background: var(--surface-sunken);
}

.sp-day-cell.is-complete {
  border-color: color-mix(in srgb, var(--success) 28%, var(--border));
  background: color-mix(in srgb, var(--success) 7%, var(--surface));
}

.sp-day-cell.is-partial {
  border-color: color-mix(in srgb, var(--warning) 28%, var(--border));
  background: color-mix(in srgb, var(--warning) 7%, var(--surface));
}

.sp-day-cell.is-empty {
  color: var(--text-faint);
}

.sp-day-name {
  color: var(--text-muted);
  font-size: 10px;
}

.sp-day-date {
  color: var(--text-faint);
  font-size: 9.5px;
}

.sp-day-count {
  color: var(--text-soft);
  font-size: 10.5px;
}

.sp-day-cell.is-complete .sp-day-count {
  color: var(--success-text);
}

.sp-day-cell.is-partial .sp-day-count {
  color: var(--warning-text);
}

.sp-day-status {
  font-size: 8.5px;
}

.sp-no-plan {
  background: var(--surface-2);
  border-color: var(--border);
}

.sp-panel-head {
  background: var(--surface-raised);
  border-bottom-color: var(--border);
}

.sp-panel-week {
  color: var(--text-muted);
}

.sp-panel-day {
  border-bottom-color: var(--border-soft);
}

.sp-course {
  color: var(--text-soft);
  background: color-mix(in srgb, var(--info) 7%, var(--surface));
  border-left-color: var(--info);
}

.sp-course-time {
  color: var(--info-text);
}

.sp-task {
  background: var(--surface);
  border-color: var(--border-soft);
  border-left-color: var(--subject-color, var(--primary));
}

.sp-task[data-sp-status="DONE"] {
  background: color-mix(in srgb, var(--success) 6%, var(--surface));
}

.sp-task[data-sp-status="INCOMPLETE"] {
  background: color-mix(in srgb, var(--danger) 5%, var(--surface));
}

.sp-task[data-sp-status="IN_PROGRESS"] {
  background: color-mix(in srgb, var(--info) 5%, var(--surface));
}

.sp-task-name {
  color: var(--text);
  font-size: 12px;
}

.sp-task-meta {
  color: var(--text-muted);
  font-size: 10px;
}

.sp-task-status {
  border-radius: var(--badge-radius);
  font-size: 9.5px;
}

.sp-task[data-sp-status="DONE"] .sp-task-status {
  color: var(--success-text);
  background: var(--success-soft);
}

.sp-task[data-sp-status="INCOMPLETE"] .sp-task-status {
  color: var(--danger-text);
  background: var(--danger-soft);
}

.sp-task[data-sp-status="IN_PROGRESS"] .sp-task-status {
  color: var(--info-text);
  background: var(--info-soft);
}

.sp-status-btn[data-sp-set-status="DONE"].is-active {
  color: var(--success-text);
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 25%, transparent);
}

.sp-status-btn[data-sp-set-status="INCOMPLETE"].is-active {
  color: var(--danger-text);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}

.sp-day-empty,
.sp-hint {
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  background: var(--login-panel, var(--canvas));
}

.login-brand {
  position: relative;
  padding: clamp(36px, 4.2vw, 64px);
  background: var(--login-brand-bg);
  color: var(--login-brand-text);
}

.login-brand::before {
  width: 620px;
  height: 620px;
  right: -260px;
  top: -260px;
  border-color: rgba(255, 255, 255, 0.10);
}

.login-brand::after {
  width: 340px;
  height: 340px;
  left: -140px;
  bottom: -150px;
  background: radial-gradient(circle, color-mix(in srgb, var(--login-accent) 26%, transparent), transparent 68%);
}

.login-brand-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.login-brand .brand {
  padding: 0;
}

.login-brand .brand-name {
  color: var(--login-brand-text);
}

.login-brand .brand-sub {
  color: var(--login-accent);
}

.login-system-label {
  color: var(--login-brand-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.login-copy {
  max-width: 620px;
  margin: auto 0;
  padding: 58px 0;
}

.login-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--login-accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.login-kicker::before {
  content: "";
  width: 20px;
  height: 2px;
  background: currentColor;
}

.login-copy h1 {
  max-width: 620px;
  margin: 16px 0 18px;
  color: var(--login-brand-text);
  font-family: var(--font-display);
  font-size: clamp(36px, 4vw, 58px);
  font-weight: var(--heading-weight);
  line-height: 1.2;
  letter-spacing: var(--title-tracking);
}

.login-copy h1 em {
  color: var(--login-accent);
  font-style: normal;
}

.login-copy p {
  max-width: 520px;
  color: var(--login-brand-muted);
  font-size: 14px;
  line-height: 1.8;
}

.login-points {
  gap: 10px;
  margin-top: 30px;
}

.login-point {
  gap: 7px;
  padding: 7px 10px;
  color: var(--login-brand-muted);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
}

.login-point .dot {
  width: 5px;
  height: 5px;
  background: var(--login-accent);
}

.login-brand-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--login-brand-muted);
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.login-brand-line {
  width: 28px;
  height: 1px;
  background: color-mix(in srgb, var(--login-brand-muted) 42%, transparent);
}

.login-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 70px 42px 36px;
  background:
    radial-gradient(600px 400px at 100% 0%, color-mix(in srgb, var(--primary) 5%, transparent), transparent 65%),
    var(--login-panel, var(--canvas));
}

.login-theme-slot {
  position: absolute;
  top: 24px;
  right: 28px;
  z-index: 5;
}

.login-card {
  width: 100%;
  max-width: 398px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.login-card-head {
  margin-bottom: 23px;
}

.login-card-head h2 {
  margin: 10px 0 5px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: var(--heading-weight);
  letter-spacing: var(--title-tracking);
}

.login-card .lead {
  margin: 0;
  color: var(--text-muted);
  font-size: 12.5px;
}

.login-card .field {
  margin-bottom: 15px;
}

.login-card .btn {
  width: 100%;
  height: 43px;
  margin-top: 7px;
}

.login-hint {
  margin-top: 21px;
  padding-top: 15px;
  color: var(--text-muted);
  border-top-color: var(--border-soft);
  font-size: 10.5px;
}

.login-panel-foot {
  margin-top: 20px;
  color: var(--text-faint);
  font-size: 10px;
}

/* --------------------------------------------------------------------------
   Dashboard
   -------------------------------------------------------------------------- */

.dashboard-hero .page-subtitle {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.dashboard-warm-note {
  color: var(--accent);
  font-weight: 650;
}

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

.dash-courses { grid-column: span 8; }
.dash-progress { grid-column: span 4; }
.dash-feedback { grid-column: span 4; }
.dash-classes { grid-column: span 4; }
.dash-math { grid-column: span 4; }
.dash-quick { grid-column: span 7; }
.dash-logs { grid-column: span 5; }

.dash-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dash-card .card-body {
  flex: 1;
}

.agenda {
  display: grid;
}

.agenda-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border-soft);
}

.agenda-row:last-child {
  border-bottom: 0;
  padding-bottom: 2px;
}

.agenda-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 4px 3px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}

.agenda-day {
  color: var(--text-muted);
  font-size: 9.5px;
  line-height: 1.3;
}

.agenda-md {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: var(--heading-weight);
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

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

.agenda-title {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-title:hover {
  color: var(--primary-700);
}

.agenda-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10.5px;
}

.agenda-meta .dot {
  width: 3px;
  height: 3px;
  background: var(--text-faint);
  border-radius: 50%;
}

.agenda-row .badge {
  font-size: 10px;
}

.dash-progress-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.dash-progress-number {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: var(--heading-weight);
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.dash-progress-number small {
  margin-left: 2px;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
}

.dash-progress-caption {
  color: var(--text-muted);
  font-size: 10.5px;
  text-align: right;
}

.dash-progress-caption strong {
  display: block;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.dash-progress-list {
  margin-top: 15px;
  border-top: 1px solid var(--border-soft);
}

.dash-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border-soft);
}

.dash-list-row:last-child {
  border-bottom: 0;
}

.dash-list-row:hover {
  color: var(--primary-700);
}

.dash-list-main {
  display: block;
  min-width: 0;
}

.dash-list-title {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-list-sub {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-list-tail {
  flex-shrink: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.dash-feedback-item {
  display: block;
  padding: 10px 0;
  color: var(--text);
  border-bottom: 1px solid var(--border-soft);
}

.dash-feedback-item:last-child {
  border-bottom: 0;
}

.dash-feedback-item:hover {
  color: var(--primary-700);
}

.dash-feedback-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dash-feedback-head .strong {
  color: var(--text);
}

.dash-feedback-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.dash-supplement {
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px dashed var(--border);
}

.dash-supplement-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.dash-math-row {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}

.dash-math-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-muted);
  font-size: 10.5px;
}

.dash-math-head strong {
  color: var(--text-soft);
  font-weight: 650;
}

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

.dash-quick-grid .quick-link {
  min-height: 50px;
}

.dash-empty {
  padding: 22px 8px;
  color: var(--text-muted);
  font-size: 11.5px;
  text-align: center;
}

.dash-log {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
}

.dash-log:last-child {
  border-bottom: 0;
}

.dash-log-time {
  flex: 0 0 42px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.7;
}

.dash-log-text {
  min-width: 0;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.6;
}

.dash-card-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 11px;
  color: var(--primary-600);
  font-size: 11px;
  font-weight: 650;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1300px) {
  .topbar-kicker {
    display: none;
  }
  .topbar-sep {
    display: none;
  }
}

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat-card:nth-child(2n) {
    border-right: 0;
  }
  .stat-card:nth-child(n + 3) {
    border-top: 1px solid var(--border-soft);
  }
  .stat-card:nth-child(2n + 1) {
    border-right: 1px solid var(--border-soft);
  }
  .stats-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .stats-grid--3 .stat-card {
    border-top: 0;
  }
  .stats-grid--3 .stat-card:nth-child(2n + 1) {
    border-right: 1px solid var(--border-soft);
  }
  .stats-grid--3 .stat-card:last-child {
    border-right: 0;
  }
  .layout-split,
  .layout-split--narrow {
    grid-template-columns: 1fr;
  }
  .dashboard-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .dash-courses {
    grid-column: span 6;
  }
  .dash-progress {
    grid-column: span 3;
  }
  .dash-feedback {
    grid-column: span 3;
  }
  .dash-classes {
    grid-column: span 3;
  }
  .dash-math {
    grid-column: span 3;
  }
  .dash-quick {
    grid-column: span 6;
  }
  .dash-logs {
    grid-column: span 6;
  }
}

@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 16px 0 44px rgba(0, 0, 0, 0.28);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
  }
  .menu-btn {
    display: inline-flex;
  }
  .topbar {
    padding: 0 18px;
  }
  .content {
    padding: 22px 18px 42px;
  }
  .page-head {
    align-items: flex-start;
  }
  .plan-summary {
    grid-template-columns: 1fr auto;
  }
  .plan-summary-progress {
    grid-column: 1 / -1;
  }
  .plan-tools-forms {
    grid-template-columns: 1fr;
  }
  .plan-board-scroll {
    --plan-col: 172px;
  }
  .login-page {
    grid-template-columns: 1fr;
  }
  .login-brand {
    display: none;
  }
  .login-panel {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 84px 24px 28px;
  }
  .login-theme-slot {
    top: 18px;
    right: 18px;
  }
}

@media (max-width: 720px) {
  .content {
    padding: 18px 13px 36px;
  }
  .page-head {
    margin-bottom: 17px;
    padding-bottom: 15px;
    gap: 13px;
  }
  .page-title {
    font-size: 27px;
  }
  .page-subtitle {
    font-size: 12px;
  }
  .page-actions {
    width: 100%;
  }
  .page-actions .btn {
    flex: 1 1 auto;
  }
  .topbar {
    padding: 0 13px;
    gap: 9px;
  }
  .topbar-actions {
    gap: 6px;
  }
  .topbar-date,
  .topbar-chip {
    display: none;
  }
  .theme-trigger {
    width: 32px;
    padding: 0;
    justify-content: center;
  }
  .theme-trigger-label,
  .theme-trigger-chevron {
    display: none;
  }
  .theme-current-swatch {
    width: 15px;
    height: 15px;
    flex-basis: 15px;
  }
  .theme-menu {
    position: fixed;
    top: calc(var(--topbar-h) + 8px);
    left: 12px;
    right: 12px;
    width: auto;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stats-grid--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stats-grid--3 .stat-card {
    border-top: 1px solid var(--border-soft);
  }
  .stats-grid--3 .stat-card:nth-child(-n + 2) {
    border-top: 0;
  }
  .stats-grid--3 .stat-card:nth-child(3) {
    border-right: 0;
  }
  .stat-card {
    min-height: 91px;
    padding: 14px;
    gap: 10px;
  }
  .stat-icon {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
  .stat-icon svg {
    width: 18px;
    height: 18px;
  }
  .stat-value {
    font-size: 25px;
  }
  .stat-label {
    font-size: 10.5px;
  }
  .toolbar {
    align-items: stretch;
    padding: 12px;
  }
  .toolbar .select,
  .toolbar .input,
  .toolbar .search-box,
  .toolbar .field-inline {
    width: 100% !important;
    min-width: 0;
  }
  .toolbar .spacer {
    display: none;
  }
  .toolbar .btn {
    flex: 1 1 auto;
  }
  .toolbar .btn-sm {
    min-height: 34px;
  }
  .table {
    font-size: 12px;
  }
  .table th {
    font-size: 10px;
    padding: 10px 12px;
  }
  .table td {
    padding: 11px 12px;
  }
  .calendar-scroll .calendar-head,
  .calendar-scroll .calendar-grid {
    min-width: 760px;
  }
  .calendar-day {
    min-height: 112px;
  }
  .plan-summary {
    grid-template-columns: 1fr;
  }
  .plan-summary-actions {
    justify-content: flex-start;
  }
  .plan-tools-grid {
    grid-template-columns: 1fr;
  }
  .plan-board-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 13px;
  }
  .dash-courses,
  .dash-progress,
  .dash-feedback,
  .dash-classes,
  .dash-math,
  .dash-quick,
  .dash-logs {
    grid-column: 1;
  }
  .dash-progress-number {
    font-size: 42px;
  }
  .agenda-row {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 10px;
  }
  .agenda-row .badge {
    grid-column: 2;
    justify-self: start;
    margin-top: -3px;
  }
  .fb-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .fb-breakdowns,
  .fb-board {
    grid-template-columns: 1fr;
  }
  .fb-donut-layout {
    flex-direction: column;
    align-items: flex-start;
  }
  .fb-filter-class,
  .fb-filter-type,
  .fb-filter-source,
  .fb-filter-date,
  .fb-filters .search-box {
    width: 100% !important;
    min-width: 0;
  }
  .sp-grid {
    grid-template-columns: 1fr;
  }
  .sp-filter-cohort,
  .sp-filter-class,
  .sp-search {
    width: 100% !important;
  }
  .sp-week {
    gap: 3px;
  }
  .sp-day-cell {
    min-height: 49px;
  }
  .login-panel {
    padding: 76px 14px 24px;
  }
  .login-card {
    padding: 22px;
    border-radius: var(--radius);
  }
  .login-card-head h2 {
    font-size: 25px;
  }
}

@media (max-width: 480px) {
  .stat-card {
    min-height: 82px;
    padding: 13px 12px;
    gap: 10px;
  }
  .stat-icon {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }
  .stat-value {
    font-size: 23px;
  }
  .dash-quick-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid--3 .stat-card:last-child {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border-soft);
    border-right: 0;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .sidebar-scrim,
  .theme-trigger-chevron,
  .theme-menu {
    transition: none;
    animation: none;
  }
}

/* Overflow hardening for dense response layouts */
.fb-dashboard,
.fb-kpis,
.fb-overview,
.fb-breakdowns,
.fb-chart-card,
.fb-board,
.fb-column,
.fb-kpis .stat-card,
.fb-kpis .stat-card > div {
  min-width: 0;
}

.fb-kpis .stat-card {
  overflow: hidden;
}

.fb-kpi-sub {
  max-width: 100%;
}

@media (max-width: 720px) {
  .toolbar > form,
  .toolbar form.flex-center,
  .toolbar form[method="get"] {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    min-width: 0;
  }

  .toolbar form > .select,
  .toolbar form > .input,
  .toolbar form > .search-box,
  .toolbar form > .field-inline,
  .toolbar form > .btn {
    width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 100%;
  }

  .toolbar .week-switch {
    flex-wrap: wrap;
  }

  .fb-kpi-sub {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* Weekly board: fit the full week at common desktop widths, keep scroll on smaller screens */
.plan-board-scroll {
  --plan-col: 158px;
}

@media (min-width: 1600px) {
  .plan-board-scroll {
    --plan-col: 176px;
  }
}

@media (max-width: 960px) {
  .plan-board-scroll {
    --plan-col: 164px;
  }
}

.plan-task-title {
  font-size: 12.2px;
}

.plan-task-meta {
  font-size: 10.4px;
}

.plan-course-name {
  font-size: 12px;
}

.plan-course-meta {
  font-size: 10.2px;
}

.fb-person .cell-main {
  font-size: 12.2px;
}

.fb-person .cell-sub {
  font-size: 10.6px;
}

.fb-card-badges .badge {
  font-size: 10px;
}

.fb-card-content {
  font-size: 12px;
}

.fb-column-meta {
  font-size: 10.8px;
}

.sidebar-close {
  display: none;
  position: absolute;
  top: 18px;
  right: 14px;
  z-index: 3;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--sidebar-muted);
  background: var(--sidebar-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.sidebar-close:hover {
  color: var(--sidebar-text);
  background: var(--sidebar-hover);
}

html[data-theme="breeze"] .sidebar-close {
  border-color: var(--border);
}

@media (max-width: 960px) {
  .sidebar-close {
    display: inline-flex;
  }
}

/* Weekly-plan export format picker */
.export-format-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.export-format-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  min-height: 86px;
  padding: 11px 12px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: border-color 0.16s, background-color 0.16s, transform 0.16s;
}

.export-format-card:hover {
  color: var(--text);
  background: var(--surface);
  border-color: color-mix(in srgb, var(--primary) 38%, var(--border));
  transform: translateY(-1px);
}

.export-format-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 19px;
  padding: 0 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.export-format-badge.is-png {
  color: var(--primary-700);
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
}

.export-format-badge.is-pdf {
  color: var(--warning-text);
  background: var(--warning-soft);
  border: 1px solid color-mix(in srgb, var(--warning) 20%, transparent);
}

.export-format-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.export-format-copy strong {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.4;
}

.export-format-copy small {
  color: var(--text-muted);
  font-size: 9.5px;
  line-height: 1.45;
}

.export-fillable-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 10.5px;
  text-decoration: none;
}

.export-fillable-link:hover {
  color: var(--primary-600);
}

html[data-theme="blocks"] .export-format-card {
  border-width: 2px;
  border-color: var(--border);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.045);
}

html[data-theme="blocks"] .export-format-badge {
  border-radius: 2px;
  font-family: var(--font-pixel);
  font-size: 7px;
}

@media (max-width: 480px) {
  .export-format-grid {
    grid-template-columns: 1fr;
  }
  .export-format-card {
    flex-direction: row;
    align-items: center;
    min-height: 62px;
  }
}

/* Documentation sub-navigation in the sidebar */
.nav-sub-link {
  min-height: 31px;
  margin-left: 15px;
  padding: 5px 9px 5px 8px;
  color: var(--sidebar-muted);
  font-size: 12px;
  border-radius: calc(var(--radius-sm) - 1px);
}

.nav-sub-link .nav-sub-corner {
  width: 12px;
  color: var(--sidebar-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.55;
}

.nav-sub-link.active {
  color: var(--sidebar-active-text);
  background: var(--sidebar-active);
  box-shadow: none;
}

.nav-sub-link.active::before {
  display: none;
}

.nav-sub-tag {
  margin-left: auto;
  padding: 1px 4px;
  color: var(--sidebar-accent);
  font-family: var(--font-ui);
  font-size: 7.5px;
  font-weight: 650;
  line-height: 1.5;
  border: 1px solid color-mix(in srgb, var(--sidebar-accent) 35%, transparent);
  border-radius: 3px;
}

html[data-theme="blocks"] .nav-sub-link.active {
  border: 2px solid #0a1208;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
