/* Shared design tokens and component finish. Load after page-specific CSS.
   Layout and decorative animations remain owned by their existing files. */
:root {
  color-scheme: dark;
  --canvas: #09090c;
  --panel: #141419;
  --surface-raised: #202025;
  --ink: #f2f2f5;
  --muted: #a5a5b3;
  --line: rgba(255,255,255,.12);
  --violet: #a294ff;
  --violet-light: #29233f;
  --green: #55d2a2;
  --green-bg: #14382f;
  --amber: #ffc86b;
  --amber-bg: #453719;
  --orange: #ff927a;
  --orange-bg: #48271f;
  --focus-ring: rgba(162,148,255,.28);
  --radius-control: 10px;
  --radius-panel: 16px;
  --text-small: 12px;
  --text-body: 14px;
  --text-reading: 16px;
  --font-ui: Manrope, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --primary-fill: #7563cf;
  --primary-hover: #6654bf;
  --shadow: inset 0 1px 0 #ffffff0a, 0 8px 24px #0003;
  --shadow-overlay: 0 24px 64px #0008;
}
:root, [data-bs-theme=dark] {
  --tblr-body-bg: var(--canvas);
  --tblr-body-bg-rgb: 9,9,12;
  --tblr-body-color: var(--ink);
  --tblr-bg-surface: var(--panel);
  --tblr-bg-surface-secondary: var(--surface-raised);
  --tblr-bg-forms: var(--canvas);
  --tblr-border-color: var(--line);
  --tblr-secondary-color: var(--muted);
  --tblr-primary: var(--primary-fill);
  --tblr-primary-rgb: 117,99,207;
  --tblr-font-sans-serif: var(--font-ui);
}
body { background-color: var(--canvas); font-family: var(--font-ui); font-size: var(--text-body); }
body[data-bs-theme=dark] { background-color: var(--canvas); }
.card, .course-card, .home-next, .cta-card, .module, .metric-card, .admin-info-card {
  background: var(--panel);
  border-color: var(--line);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow);
}
.module.locked-module { background: var(--panel); }
.profile-menu, .workspace-header .notifications-panel,
.rector-account-menu, .rector-notifications-panel {
  background: var(--surface-raised);
  box-shadow: var(--shadow-overlay);
  border-radius: var(--radius-panel);
}
.admin-sidebar, .admin-topbar { background: var(--panel); border-color: var(--line); }
.btn, .auth-form .btn, .test-login-actions .btn.secondary,
.turn-dialog button, .form-control, .form-select {
  border-radius: var(--radius-control);
  font-family: var(--font-ui);
}
/* Preserve semantic success/danger buttons and quiet navigation links. */
.btn:not(.secondary):not(.warning):not(.success):not(.course-link):not([class*="btn-"]),
.btn-primary, .turn-dialog .turn-dialog-primary {
  background: var(--primary-fill);
  color: #fff;
  border: 1px solid transparent;
  box-shadow: none;
}
.btn:not(.secondary):not(.warning):not(.success):not(.course-link):not([class*="btn-"]):hover,
.btn-primary:hover, .turn-dialog .turn-dialog-primary:hover {
  background: var(--primary-hover);
  color: #fff;
  border-color: transparent;
  transform: none;
}
.btn.secondary, .test-login-actions .btn.secondary, .turn-dialog button {
  background: var(--surface-raised);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn.secondary:hover, .turn-dialog button:hover { background: #2b2b33; transform: none; }
.auth-form input:not([type=checkbox]):not([type=radio]),
.form-control, .form-select, .course-search input,
.turn-dialog input, .cr-toolbar select, .cr-dialog textarea {
  box-sizing: border-box;
  background: var(--canvas);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  font-family: var(--font-ui);
  font-size: var(--text-body);
}
.auth-form input:not([type=checkbox]):not([type=radio]) {
  width: 100%; min-height: 46px; padding: 12px 14px;
}
.auth-form input:focus, .form-control:focus, .form-select:focus,
.turn-dialog input:focus, .cr-dialog textarea:focus {
  border-color: var(--violet);
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.btn:focus-visible, .turn-dialog button:focus-visible, .cr-dialog button:focus-visible {
  outline: 2px solid var(--violet); outline-offset: 3px;
}
.auth-page {
  background: radial-gradient(ellipse at 12% 5%,rgba(130,110,180,.11),transparent 48%),var(--canvas);
}
.auth-page:not(.login-page) {
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 24px;
}
.auth-page > .auth-card { margin: 0; padding: 32px; }
.auth-page .public-footer { margin: 0; }
.login-page .public-footer { margin-top: 22px; }
.login-shell { border-radius: var(--radius-panel); background: var(--panel); border-color: var(--line); }
.login-card { background: var(--panel); border-radius: 0; box-shadow: none; }
.login-intro { background: linear-gradient(155deg,var(--surface-raised),var(--panel)); }
.login-card .auth-form .btn::after { display: none; }
.auth-page h1 { overflow-wrap: anywhere; }
.turn-dialog, .cr-dialog {
  background: var(--surface-raised);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-overlay);
  font: var(--text-body)/1.6 var(--font-ui);
  padding: 24px;
}
.turn-dialog::backdrop, .cr-dialog::backdrop { background: #09090cb3; }
.turn-dialog h2, .cr-dialog h2 { margin: 0 0 16px; font-size: 22px; line-height: 1.3; }
.turn-dialog p, .cr-help { color: var(--muted); opacity: 1; }
.cr-actions { background: var(--surface-raised); gap: 10px; }
.cr-entry, .cr-content section, .cr-history article { border-color: var(--line); border-radius: var(--radius-control); }
.article, .article p, .article li, .task-box p, .student-answer {
  font-size: var(--text-reading); line-height: 1.7;
}
.article p, .task-box p { color: #d0d0d8; }
.notification-item time { color: var(--muted); }
.notification-toggle b { min-width: 22px; height: 22px; line-height: 22px; }
.status { font-size: var(--text-small); border-radius: 999px; }
@media (max-width: 640px) {
  .auth-page > .auth-card { padding: 24px; }
  .turn-dialog, .cr-dialog { padding: 20px; }
  .auth-page:not(.login-page) { padding: 20px 16px; }
}

.btn, .auth-form .btn, .login-card .auth-form .btn { font-size: var(--text-body); }
.btn-sm, .test-login-actions .btn { font-size: var(--text-small); }

/* Published courses expose several actions; keep the toolbar inside mobile screens. */
.editor-actions { flex-wrap: wrap; align-items: center; }
.editor-actions > .btn { max-width: 100%; white-space: normal; }
.editor-actions > .status { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .topbar .editor-actions { width: 100%; }
  .editor-actions > .status { flex-basis: 100%; }
}

/* Native list options should follow the same subdued palette as the field. */
select option, select optgroup {
  background-color: var(--panel);
  color: var(--ink);
}
select option:checked {
  background-color: var(--violet-light);
  color: var(--ink);
}

.turn-select { position: relative; min-width: 0; }
.turn-select > select[hidden], .turn-select-list[hidden] { display: none; }
.turn-select-trigger { width: 100%; text-align: left; cursor: pointer; }
.turn-select-list {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  padding: 5px; max-height: 260px; overflow-y: auto;
  background: var(--surface-raised); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-control);
  box-shadow: var(--shadow-overlay);
}
.turn-select-list [role=option] {
  padding: 9px 12px; border-radius: 6px; cursor: pointer; overflow-wrap: anywhere;
}
.turn-select-list [aria-selected=true] { background: var(--violet-light); }
.turn-select-list [role=option]:hover, .turn-select-list [role=option]:focus {
  background: var(--violet-light); outline: 1px solid var(--violet); outline-offset: -1px;
}
