:root {
  --ink: #17233b;
  --muted: #65728a;
  --paper: #f5f7fb;
  --surface: #ffffff;
  --line: #e3e8f1;
  --primary: #3158d4;
  --primary-dark: #2243ad;
  --cyan: #0aa4a7;
  --orange: #f19a3e;
  --red: #d84b55;
  --green: #18865b;
  --shadow: 0 16px 42px rgba(36, 54, 92, 0.09);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  max-width: 100%;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 4% 4%, rgba(49, 88, 212, 0.08), transparent 28rem),
    var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.shell {
  width: min(1180px, calc(100% - 40px));
  min-width: 0;
  margin: 0 auto;
}

main,
section,
form,
.panel,
.panel-body,
.application-content {
  min-width: 0;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgba(227, 232, 241, 0.85);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.admin-header {
  border-top: 4px solid var(--primary);
}

.header-inner {
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
}

.brand-logo-frame {
  display: block;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  overflow: hidden;
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
}

.brand-copy {
  text-align: center;
}

.brand strong {
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.main-nav a {
  padding: 9px 12px;
  border-radius: 10px;
  color: #4f5e77;
  font-size: 14px;
  font-weight: 600;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--primary);
  background: #eef2ff;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
  font-size: 13px;
}

.admin-name {
  color: var(--muted);
}

.admin-account-menu {
  position: relative;
}

.admin-account-menu summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #dbe4ff;
  border-radius: 9px;
  color: #3157b7;
  background: #eef3ff;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.admin-account-menu summary::-webkit-details-marker {
  display: none;
}

.admin-account-menu summary:hover,
.admin-account-menu[open] summary {
  color: var(--primary);
  border-color: #c8d5ff;
  background: #e3eaff;
}

.account-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  font-size: 0;
  line-height: 1;
}

.account-chevron::before {
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  content: "";
  transform: translateY(-2px) rotate(45deg);
}

.admin-account-popover {
  display: grid;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: 150px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  box-shadow: 0 18px 48px rgba(31, 48, 88, 0.18);
}

.admin-account-popover a {
  padding: 10px 11px;
  border-radius: 8px;
  color: #4f5e77;
  font-weight: 700;
}

.admin-account-popover a:hover {
  color: var(--primary);
  background: #f1f4ff;
}

.text-link {
  color: var(--primary);
  font-weight: 700;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 12px;
  color: var(--ink);
  background: white;
}

main {
  min-height: calc(100vh - 118px);
}

.home-menu {
  display: grid;
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 118px);
  place-items: center;
  padding: 52px 0;
  background:
    linear-gradient(110deg, rgba(239, 246, 255, 0.86), rgba(244, 249, 255, 0.58) 48%, rgba(230, 242, 255, 0.72)),
    url("images/home-lab-background-v1.jpg") center / cover no-repeat;
}

.home-menu::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(circle at 48% 45%, rgba(255, 255, 255, 0.62), transparent 42%),
    linear-gradient(135deg, rgba(24, 55, 120, 0.16), rgba(244, 249, 255, 0.46) 48%, rgba(32, 107, 177, 0.14));
  backdrop-filter: saturate(0.86) contrast(0.97);
}

.home-menu-shell {
  position: relative;
  z-index: 1;
}

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

.home-menu-card {
  --card-color: #3158d4;
  --card-soft: #eaf0ff;
  display: flex;
  position: relative;
  overflow: hidden;
  min-height: 204px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 24px;
  color: var(--ink);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.84)),
    var(--surface);
  box-shadow:
    0 18px 46px rgba(37, 64, 126, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  text-align: left;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  backdrop-filter: blur(12px);
}

.home-menu-card::after {
  position: absolute;
  right: -30px;
  bottom: -42px;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  content: "";
  background: var(--card-soft);
  opacity: 0.75;
  transition: transform 180ms ease;
}

.home-menu-card-apply {
  --card-color: #3158d4;
  --card-soft: #dfe8ff;
}

.home-menu-card-modify {
  --card-color: #dc7d2a;
  --card-soft: #fff0df;
}

.home-menu-card-timetable {
  --card-color: #0097a0;
  --card-soft: #dff5f4;
}

.home-menu-card-current {
  --card-color: #13805b;
  --card-soft: #dff2e9;
}

.home-menu-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--card-color) 16%, white);
  border-radius: 16px;
  color: var(--card-color);
  background: var(--card-soft);
}

.home-menu-icon svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.home-menu-copy {
  display: block;
  position: relative;
  z-index: 1;
}

.home-menu-copy strong,
.home-menu-copy small {
  display: block;
}

.home-menu-copy strong {
  color: var(--ink);
  font-size: 21px;
  line-height: 1.25;
}

.home-menu-copy small {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.home-menu-arrow {
  display: grid;
  position: absolute;
  right: 22px;
  bottom: 20px;
  z-index: 1;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--card-color);
  font-size: 20px;
  font-weight: 700;
}

.home-menu-card:hover {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--card-color) 28%, white);
  box-shadow:
    0 26px 56px rgba(37, 64, 126, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.home-menu-card:hover::after {
  transform: scale(1.12);
}

.home-menu-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--card-color) 55%, white);
  outline-offset: 4px;
}

.form-page-shell {
  max-width: 900px;
}

.hero {
  padding: 72px 0 50px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  gap: 62px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 24px;
  height: 2px;
  content: "";
  background: currentColor;
}

.hero h1 {
  max-width: 720px;
  margin: 18px 0;
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.12;
  letter-spacing: -0.04em;
}

.hero h1 em {
  color: var(--primary);
  font-style: normal;
}

.hero-copy {
  max-width: 620px;
  color: var(--muted);
  font-size: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.hero-board {
  position: relative;
  overflow: hidden;
  min-height: 340px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 28px;
  color: white;
  background: linear-gradient(150deg, #172b62, #3158d4 60%, #1ba2a6);
  box-shadow: 0 28px 70px rgba(29, 53, 124, 0.25);
}

.hero-board::after {
  position: absolute;
  right: -65px;
  bottom: -80px;
  width: 240px;
  height: 240px;
  border: 35px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  content: "";
}

.board-label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

.board-date {
  margin: 5px 0 28px;
  font-size: 24px;
  font-weight: 800;
}

.board-stat {
  display: grid;
  position: relative;
  z-index: 1;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.board-stat div {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
}

.board-stat strong,
.board-stat span {
  display: block;
}

.board-stat strong {
  font-size: 30px;
}

.board-stat span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.quick-section {
  padding: 12px 0 80px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.section-heading h2 {
  margin: 0;
  font-size: 28px;
}

.section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.quick-card {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.quick-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 22px 48px rgba(36, 54, 92, 0.14);
}

.quick-card::after {
  position: absolute;
  right: -25px;
  bottom: -36px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  content: "";
  background: var(--card-color, var(--primary));
  opacity: 0.08;
}

.quick-number {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  color: var(--card-color, var(--primary));
  background: color-mix(in srgb, var(--card-color, var(--primary)) 12%, white);
  font-size: 13px;
  font-weight: 900;
}

.quick-card h3 {
  margin: 28px 0 6px;
  font-size: 21px;
}

.quick-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.quick-arrow {
  display: inline-block;
  margin-top: 20px;
  color: var(--card-color, var(--primary));
  font-weight: 800;
}

.page-head {
  padding: 46px 0 28px;
}

.page-head-compact {
  padding: 30px 0 22px;
}

.page-head-compact h1 {
  margin: 0;
}

.page-head-no-eyebrow h1 {
  margin-top: 0;
}

.page-head-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.application-page-head .page-head-inner {
  position: relative;
  display: block;
  text-align: center;
}

.application-page-head .badge {
  position: static;
  display: inline-flex;
  margin-top: 10px;
  transform: none;
}

.page-head h1 {
  margin: 8px 0 6px;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.2;
}

.page-head p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
}

.page-section {
  padding: 0 0 70px;
}

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

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-size: 18px;
}

.panel-body {
  padding: 24px;
}

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

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

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label,
.field-label {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
  font-weight: 700;
}

.required {
  color: var(--red);
}

.form-control {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid #ccd4e2;
  border-radius: 11px;
  outline: none;
  color: var(--ink);
  background: white;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(49, 88, 212, 0.1);
}

textarea.form-control {
  min-height: 96px;
  resize: vertical;
}

.search-select {
  position: relative;
  min-width: 0;
}

.search-select-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
}

.search-select-summary::-webkit-details-marker {
  display: none;
}

.search-select-summary::after {
  width: 9px;
  height: 9px;
  margin: -4px 3px 0 14px;
  flex: 0 0 auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  content: "";
  transform: rotate(45deg);
}

.search-select[open] .search-select-summary {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(49, 88, 212, 0.1);
}

.search-select[open] .search-select-summary::after {
  margin-top: 4px;
  transform: rotate(225deg);
}

.search-select-popover {
  position: absolute;
  z-index: 15;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  box-shadow: 0 18px 42px rgba(36, 54, 92, 0.16);
}

.search-select-options {
  display: grid;
  max-height: 260px;
  gap: 6px;
  margin-top: 10px;
  overflow-y: auto;
}

.search-select-option {
  display: flex;
  min-width: 0;
  align-items: center;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
}

.search-select-option[hidden] {
  display: none;
}

.search-select-option:hover,
.search-select-option.is-selected {
  border-color: #c8d4f8;
  background: #f2f5ff;
}

.search-select-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.search-select-option span {
  min-width: 0;
  flex: 1;
}

.search-select-option-content {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.search-select-option-content strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-select-option small {
  flex: 0 0 auto;
  color: var(--muted);
  white-space: nowrap;
}

.search-select-empty {
  margin: 8px 0;
  color: var(--muted);
  text-align: center;
}

.field-help {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.teacher-shared-field {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(260px, 1fr);
  align-items: end;
  gap: 18px;
  padding: 18px;
  border: 1px solid #cfdbfb;
  border-radius: 14px;
  background: #f4f7ff;
}

.teacher-shared-field .field-help {
  margin: 0 0 12px;
  font-size: 13px;
}

.course-request-list {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}

.course-request-card {
  overflow: visible;
  border: 1px solid #d9e0ec;
  border-radius: 16px;
  background: white;
  box-shadow: 0 8px 24px rgba(39, 61, 105, 0.06);
}

.course-request-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  border-bottom: 1px solid #d8e2fb;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, #eaf0ff, #f6f8ff);
}

.course-request-head > div {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 12px;
}

.course-request-head small,
.course-slots-heading small {
  color: var(--muted);
}

.course-number {
  color: #244fb9;
  font-weight: 900;
}

.course-request-body {
  padding: 20px 18px;
}

.course-slots-block {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.course-slots-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.course-slots-heading > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.course-slot-list {
  display: grid;
  gap: 9px;
}

.course-slot-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.course-slot-actions > .btn {
  border-color: #c8d6ff;
  background: #edf3ff;
  color: #2858c7;
}

.course-slot-actions > .btn:hover {
  border-color: #aabfff;
  background: #dfe9ff;
}

.course-slot-row {
  display: grid;
  grid-template-columns: 108px minmax(135px, 0.65fr) minmax(210px, 1fr) auto;
  min-width: 0;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid #e0e5ef;
  border-radius: 12px;
  background: #fafbfe;
}

.course-slot-row .form-control {
  min-width: 0;
}

.slot-number {
  color: #536684;
  font-size: 13px;
  font-weight: 800;
}

.course-add-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px dashed #bfcdf3;
  border-radius: 14px;
  background: #f8faff;
}

.course-add-row > .btn {
  border-color: #f2cfaa;
  background: #fff3e5;
  color: #b76316;
}

.course-add-row > .btn:hover {
  border-color: #eab77f;
  background: #ffe8cf;
}

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

.check-item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfe;
  font-size: 14px;
}

.check-item input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  color: white;
  background: var(--primary);
  font-weight: 750;
  line-height: 1.2;
  transition: transform 120ms ease, background 120ms ease;
}

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

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.btn:active {
  transform: translateY(1px);
}

.btn-secondary {
  border-color: var(--line);
  color: var(--ink);
  background: white;
}

.btn-secondary:hover {
  background: #f4f6fb;
}

.btn-danger {
  background: var(--red);
}

.btn-danger:hover {
  background: #ba3540;
}

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

.btn-success:hover {
  background: #147a50;
}

.btn-orange {
  color: white;
  background: var(--orange);
}

.btn-orange:hover {
  color: white;
  background: #d98027;
}

.btn-small {
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.notice {
  padding: 16px 18px;
  border: 1px solid #d8e2ff;
  border-radius: 12px;
  color: #31466f;
  background: #f2f5ff;
  font-size: 14px;
}

.notice.warning {
  border-color: #f0d8af;
  color: #74491f;
  background: #fff7e9;
}

.notice.danger {
  border-color: #f2c5c8;
  color: #8b2e35;
  background: #fff3f4;
}

.alert {
  margin-top: 16px;
  padding: 13px 16px;
  border: 1px solid;
  border-radius: 11px;
  font-size: 14px;
}

.alert-success {
  border-color: #b8dfcf;
  color: #126443;
  background: #effaf5;
}

.alert-danger {
  border-color: #f0c2c6;
  color: #8b2e35;
  background: #fff1f2;
}

.alert-warning {
  border-color: #f0d8af;
  color: #74491f;
  background: #fff7e9;
}

.alert-info {
  border-color: #c9d6f8;
  color: #304f9a;
  background: #f1f5ff;
}

.flash-dialog-layer {
  position: fixed;
  z-index: 2000;
  inset: 0;
  display: grid;
  padding: 22px;
  place-items: center;
  background: rgb(14 27 55 / 28%);
  backdrop-filter: blur(4px);
}

.flash-dialog {
  --dialog-accent: #df4a54;
  --dialog-border: #f0c2c6;
  --dialog-text: #8b2e35;
  position: relative;
  display: grid;
  width: min(440px, 100%);
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  padding: 26px;
  border: 1px solid var(--dialog-border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgb(32 45 78 / 25%);
}

.flash-dialog-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--dialog-accent);
  font-size: 26px;
  font-weight: 900;
}

.flash-dialog h2 {
  margin: 2px 34px 8px 0;
  font-size: 21px;
}

.flash-dialog p {
  margin: 0 0 10px;
  color: var(--dialog-text);
  line-height: 1.7;
}

.flash-dialog small {
  color: var(--muted);
}

.flash-dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  place-items: center;
  color: var(--muted);
  background: #f3f5fa;
  cursor: pointer;
  font-size: 23px;
}

.flash-dialog-success {
  --dialog-accent: #159261;
  --dialog-border: #b8dfcf;
  --dialog-text: #126443;
}

.flash-dialog-warning {
  --dialog-accent: #ed941f;
  --dialog-border: #f0d8af;
  --dialog-text: #74491f;
}

.flash-dialog-info {
  --dialog-accent: #315bd8;
  --dialog-border: #c9d6f8;
  --dialog-text: #304f9a;
}

.error-list {
  margin: 0;
  padding-left: 20px;
}

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

.side-note {
  position: sticky;
  top: 100px;
  padding: 22px;
  border-radius: var(--radius);
  color: white;
  background: linear-gradient(155deg, #24386d, #3158d4);
}

.side-note h3 {
  margin: 0 0 14px;
}

.side-note ol {
  margin: 0;
  padding-left: 19px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
}

.side-note li + li {
  margin-top: 10px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  padding: 18px;
}

.filter-bar .form-field {
  flex: 1 1 150px;
}

.filter-bar .btn {
  margin-bottom: 1px;
}

.table-wrap {
  overflow-x: auto;
}

.table-bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff8f1;
}

.table-bulk-toolbar > div {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.selection-cell {
  width: 52px;
  min-width: 52px;
  padding-left: 18px !important;
  padding-right: 8px !important;
  text-align: center;
}

.table-select-checkbox {
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.table-select-checkbox:disabled {
  cursor: not-allowed;
}

.selection-unavailable {
  color: var(--muted);
}

.btn-warning {
  color: #fff;
  border-color: #e68a24;
  background: #e68a24;
}

.btn-warning:hover {
  border-color: #cf7414;
  background: #cf7414;
}

.panel-toolbar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: #fafbfe;
}

#scheduled-courses {
  scroll-margin-top: 92px;
}

.schedule-search {
  display: flex;
  width: min(430px, 45%);
  min-width: 320px;
  align-items: center;
  flex-wrap: nowrap;
  gap: 9px;
}

.schedule-search .form-control {
  width: min(270px, 25vw);
  min-width: 190px;
  flex: 0 1 270px;
}

.schedule-search .btn {
  flex: 0 0 auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #59677d;
  background: #f8f9fc;
  font-size: 12px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge-pending {
  color: #73511e;
  background: #fff1cf;
}

.badge-success {
  color: #0f6947;
  background: #ddf5ea;
}

.badge-danger {
  color: #9c3039;
  background: #ffe2e4;
}

.badge-warning {
  color: #81501e;
  background: #ffeccc;
}

.badge-muted {
  color: #647083;
  background: #edf0f4;
}

.badge-info {
  color: #2e4e9e;
  background: #e4ebff;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.empty-state {
  padding: 58px 24px;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  place-items: center;
  border-radius: 20px;
  color: var(--primary);
  background: #edf1ff;
  font-size: 24px;
  font-weight: 900;
}

.empty-state h3 {
  margin: 0 0 6px;
}

.empty-state p {
  margin: 0 0 20px;
  color: var(--muted);
}

.manual-empty-state {
  padding: 28px 24px;
}

.manual-empty-state p {
  margin-bottom: 0;
}

.search-box {
  display: flex;
  gap: 10px;
}

.search-box .btn {
  min-width: 160px;
  white-space: nowrap;
}

.application-list {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.application-card {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
}

.create-card {
  border-color: #cbd7fb;
}

.create-card > .application-summary {
  background: #f1f5ff;
}

.batch-card {
  border-color: #f0d5b8;
}

.batch-card > .application-summary {
  background: #fff7ed;
}

.application-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 19px 22px;
  cursor: pointer;
  list-style: none;
}

.application-summary::-webkit-details-marker {
  display: none;
}

.application-summary::after {
  margin-left: auto;
  color: var(--muted);
  content: "展开";
  font-size: 12px;
  font-weight: 700;
}

details[open] .application-summary::after {
  content: "收起";
}

.application-title {
  min-width: 0;
  flex: 1;
}

.application-title strong,
.application-title small {
  display: block;
}

.application-title small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.application-content {
  padding: 22px;
  border-top: 1px solid var(--line);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

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

.summary-item {
  padding: 12px 14px;
  border-radius: 11px;
  background: #f6f8fc;
}

.summary-item span,
.summary-item strong {
  display: block;
}

.summary-item span {
  color: var(--muted);
  font-size: 11px;
}

.summary-item strong {
  margin-top: 3px;
  font-size: 14px;
}

.timetable {
  min-width: 960px;
  table-layout: fixed;
}

.timetable th:first-child {
  width: 105px;
}

.timetable td {
  height: 116px;
  padding: 9px;
  background: white;
}

.timetable-slot {
  margin-bottom: 7px;
  padding: 9px 10px;
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  background: #f1f4ff;
  font-size: 12px;
  line-height: 1.45;
}

.timetable-slot:last-child {
  margin-bottom: 0;
}

.timetable-slot strong {
  display: block;
  color: #223e9c;
}

.timetable-slot span {
  display: block;
  color: #56637a;
}

.timetable-page-shell {
  width: min(1380px, calc(100% - 40px));
}

.timetable-page-head .page-head-inner {
  justify-content: center;
  text-align: center;
}

.timetable-page-head .page-head-inner > div {
  width: 100%;
}

.timetable-page-head p {
  margin-inline: auto;
}

.teacher-timetable-filter {
  display: grid;
  grid-template-columns: minmax(260px, 365px) minmax(220px, 280px) auto auto;
  justify-content: start;
  align-items: end;
  gap: 12px;
  padding: 18px;
}

.teacher-timetable-filter .teacher-name-filter {
  min-width: 0;
}

.teacher-timetable-panel {
  margin-top: 20px;
  overflow: hidden;
}

.teacher-timetable-heading {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #fafbfe);
}

.teacher-timetable-heading > div {
  width: 100%;
  min-width: 0;
  text-align: center;
}

.teacher-timetable-heading h2,
.teacher-timetable-heading p {
  margin: 0;
}

.teacher-timetable-heading h2 {
  font-size: 23px;
  text-align: center;
}

.teacher-timetable-heading p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.teacher-course-legend {
  display: inline-flex;
  position: absolute;
  right: 24px;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  color: #8e3d45;
  font-size: 13px;
  font-weight: 700;
}

.teacher-course-legend i {
  width: 18px;
  height: 18px;
  border: 1px solid #efc5c8;
  border-radius: 5px;
  background: #fff0f1;
}

.teacher-course-legend.all-course-legend {
  color: #1f5c97;
}

.teacher-course-legend.all-course-legend i {
  border-color: #b7cee7;
  background: #eaf3ff;
}

.compact-empty-notice {
  margin: 20px;
  padding: 16px 18px;
  border: 1px solid #f0d7a8;
  border-radius: 12px;
  color: #7b5621;
  background: #fff9ee;
}

.teacher-timetable-wrap {
  position: relative;
  touch-action: pan-x pan-y;
}

.teacher-timetable {
  width: 100%;
  min-width: 1080px;
  border-spacing: 0;
  border-collapse: separate;
  table-layout: fixed;
  color: #293348;
  font-size: 12px;
}

.teacher-timetable th,
.teacher-timetable td {
  height: 34px;
  padding: 6px 8px;
  border-right: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
  vertical-align: middle;
}

.teacher-timetable tr > :first-child {
  border-left: 1px solid #cbd5e1;
}

.teacher-timetable thead th {
  position: sticky;
  z-index: 6;
  top: 0;
  height: 42px;
  border-top: 1px solid #1f3c63;
  color: #fff;
  background: #294d78;
  font-size: 13px;
  text-align: center;
}

.teacher-timetable .period-column {
  width: 116px;
  position: sticky;
  z-index: 4;
  left: 0;
  color: #23466f;
  background: #e8f1fb;
  text-align: center;
}

.teacher-timetable thead .period-column {
  z-index: 8;
  color: #fff;
  background: #1f3c63;
}

.teacher-timetable .room-column {
  width: 126px;
  position: sticky;
  z-index: 3;
  left: 116px;
  color: #33465f;
  background: #f4f7fb;
  font-weight: 650;
  text-align: center;
}

.teacher-timetable thead .room-column {
  z-index: 7;
  color: #fff;
  background: #24466f;
}

.teacher-timetable .period-group {
  border-top: 2px solid #9bb4d2;
  box-shadow: inset 4px 0 0 #4f7cab, 3px 0 0 rgba(33, 44, 66, 0.03);
}

.teacher-timetable .period-group strong,
.teacher-timetable .period-group span {
  display: block;
}

.teacher-timetable .period-group strong {
  font-size: 14px;
}

.teacher-timetable .period-group span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.teacher-timetable tbody tr:first-child > * {
  border-top: 0;
}

.back-to-top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 25;
  gap: 7px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  color: #fff;
  background: #315bd6;
  box-shadow: 0 12px 28px rgba(31, 68, 166, 0.28);
  font: inherit;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease, visibility 0.2s;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: #2448b8;
}

.back-to-top span {
  font-size: 18px;
  line-height: 1;
}

.back-to-top strong {
  font-size: 13px;
}

.teacher-empty-cell {
  background: #fdfefe;
}

.scheduled-course-cell {
  color: #214b78;
  background: #eaf3ff;
}

.teacher-course-cell {
  color: #71333a;
  background: #fff0f1;
}

.timetable-course-entry {
  display: block;
  text-align: left;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.timetable-course-entry + .timetable-course-entry {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed #e7b8bd;
}

.timetable-course-entry strong {
  color: #822d37;
}

.scheduled-course-cell .timetable-course-entry strong {
  color: #174f86;
}

.scheduled-course-cell .timetable-course-entry + .timetable-course-entry {
  border-top-color: #b8cde6;
}

.timetable-break-row td {
  height: 38px;
  border-top: 2px solid #d4b979;
  color: #76591d;
  background: #fff6df;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
}

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

.dashboard {
  padding: 38px 0 70px;
}

.dashboard-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.dashboard-top h1 {
  margin: 0;
  font-size: 32px;
}

.dashboard-top p {
  margin: 5px 0 0;
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow);
}

.metric-card span,
.metric-card strong,
.metric-card small {
  display: block;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  margin: 7px 0 4px;
  color: var(--metric-color, var(--primary));
  font-size: 34px;
  line-height: 1;
}

.metric-card small {
  color: #8c97a8;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(290px, 0.7fr);
  gap: 20px;
}

.schedule-overview-grid {
  grid-template-columns: minmax(290px, 0.7fr) minmax(0, 1.5fr);
}

.schedule-export-block {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.schedule-export-block strong,
.schedule-export-block span {
  display: block;
}

.schedule-export-block strong {
  color: #17375e;
  font-size: 14px;
}

.schedule-export-block span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.schedule-export-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.schedule-overview-grid > aside .batch-result {
  margin-top: 0;
}

.schedule-export-actions .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.schedule-export-actions .schedule-export-master {
  border-color: #315bd6;
  color: #fff;
  background: #315bd6;
  box-shadow: 0 8px 18px rgba(49, 91, 214, 0.18);
}

.schedule-export-actions .schedule-export-master:hover {
  border-color: #2448b8;
  background: #2448b8;
}

.schedule-export-actions .schedule-export-rooms {
  border-color: #0d8b78;
  color: #fff;
  background: #0d8b78;
  box-shadow: 0 8px 18px rgba(13, 139, 120, 0.18);
}

.schedule-export-actions .schedule-export-rooms:hover {
  border-color: #087262;
  background: #087262;
}

.activity-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-list li {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.activity-list li:last-child {
  border-bottom: 0;
}

.activity-list time {
  color: var(--muted);
}

.admin-shortcuts {
  display: grid;
  gap: 10px;
}

.admin-shortcut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-weight: 700;
}

.admin-shortcut:hover {
  border-color: #b9c8f5;
  color: var(--primary);
  background: #f6f8ff;
}

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

.settings-accordion {
  display: grid;
  gap: 12px;
}

[data-persist-anchor],
details[data-persist-key] {
  scroll-margin-top: 96px;
}

.settings-section {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 26px rgba(36, 54, 92, 0.07);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings-section[open] {
  border-color: #9db5fb;
  box-shadow: 0 14px 34px rgba(45, 91, 218, 0.14);
}

.settings-section-summary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  cursor: pointer;
  list-style: none;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.settings-section-summary::-webkit-details-marker {
  display: none;
}

.settings-section-summary::after {
  min-width: 30px;
  margin-left: 4px;
  color: var(--muted);
  content: "展开";
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.settings-section[open] > .settings-section-summary::after {
  content: "收起";
}

.settings-section[open] > .settings-section-summary {
  color: var(--primary-dark);
  background: linear-gradient(100deg, #dbe6ff 0%, #edf3ff 68%, #ffffff 100%);
  box-shadow: inset 5px 0 0 var(--primary);
}

.settings-section[open] > .settings-section-summary::after {
  color: var(--primary);
}

.settings-section[open] > .settings-section-summary .badge-info {
  color: #1f4cb7;
  background: #cbdafd;
}

.settings-section-heading {
  min-width: 0;
  flex: 1;
}

.settings-section-heading strong,
.settings-section-heading small {
  display: block;
}

.settings-section-heading strong {
  font-size: 18px;
}

.settings-section-heading small {
  margin-top: 1px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.settings-section-content {
  min-width: 0;
  padding: 22px;
  border-top: 1px solid var(--line);
}

.room-resource-list {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.room-resource-list > .application-card {
  --room-accent: #4f7cf3;
  --room-tint: #eef4ff;
}

.room-resource-list > .application-card > .application-summary {
  border-left: 5px solid var(--room-accent);
  background: linear-gradient(135deg, var(--room-tint), #ffffff 86%);
}

.room-resource-list > .application-card:nth-child(2) {
  --room-accent: #1fa3a3;
  --room-tint: #edfafa;
}

.room-resource-list > .application-card:nth-child(3) {
  --room-accent: #e58a33;
  --room-tint: #fff5e9;
}

.room-resource-list > .application-card:nth-child(4) {
  --room-accent: #4aa66a;
  --room-tint: #eff9f1;
}

.room-resource-list > .application-card:nth-child(5) {
  --room-accent: #8b6ad9;
  --room-tint: #f6f1ff;
}

.room-resource-list > .application-card:nth-child(6) {
  --room-accent: #d9688a;
  --room-tint: #fff1f5;
}

.room-resource-list > .application-card:nth-child(7) {
  --room-accent: #269988;
  --room-tint: #ecf9f7;
}

.room-resource-list > .application-card:nth-child(8) {
  --room-accent: #c6932f;
  --room-tint: #fff8e5;
}

.room-resource-list > .application-card:nth-child(9) {
  --room-accent: #6674d9;
  --room-tint: #f0f2ff;
}

.room-resource-list > .application-card:nth-child(10) {
  --room-accent: #7aa63c;
  --room-tint: #f4faea;
}

.room-resource-list > .application-card:nth-child(11) {
  --room-accent: #5d8797;
  --room-tint: #f2f6f8;
}

.resource-list {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.resource-item {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.resource-main {
  min-width: 0;
  flex: 1;
}

.resource-main strong,
.resource-main small {
  display: block;
}

.resource-main small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-form {
  display: flex;
  min-width: 0;
  align-items: end;
  gap: 9px;
}

.compact-form .form-field {
  min-width: 0;
  flex: 1;
}

.compact-form .form-control {
  min-width: 0;
}

.manual-assignment-form .btn {
  min-width: 68px;
  white-space: nowrap;
}

.batch-card {
  margin-top: 14px;
}

textarea.batch-input {
  min-height: 118px;
}

.semester-create-form {
  margin-top: 18px;
}

.semester-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid #cad6fb;
  border-radius: 14px;
  background: #f4f7ff;
}

.semester-suggestion-copy {
  min-width: 0;
  flex: 1;
}

.semester-suggestion .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.semester-suggestion span,
.semester-suggestion strong,
.semester-suggestion small {
  display: block;
}

.semester-suggestion span,
.semester-suggestion small {
  color: var(--muted);
  font-size: 12px;
}

.semester-suggestion strong {
  margin: 4px 0;
  color: var(--primary-dark);
  font-size: 22px;
}

.semester-list .resource-item {
  flex-wrap: wrap;
}

.resource-panel-classes {
  order: -1;
}

.danger-zone-panel {
  grid-column: 1 / -1;
}

.danger-zone-form {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-top: 18px;
}

.danger-zone-form .form-field {
  max-width: 560px;
  flex: 0 1 50%;
}

.semester-data-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.semester-data-guide > div {
  padding: 15px 16px;
  border: 1px solid #d9e3f5;
  border-radius: 14px;
  background: #f7f9fd;
}

.semester-data-guide strong,
.semester-data-guide span {
  display: block;
}

.semester-data-guide strong {
  margin-bottom: 5px;
  color: var(--primary-dark);
}

.semester-data-guide span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.semester-data-actions {
  flex-wrap: wrap;
}

.semester-data-actions .form-field {
  flex: 1 1 360px;
}

.semester-data-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-danger-strong {
  background: #ad2432;
}

.semester-import-form {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(280px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.backup-file-field input[type="file"] {
  padding: 9px 12px;
}

.period-form {
  justify-content: flex-start;
}

.period-form .period-time-control {
  width: min(240px, 24%);
  flex: 0 1 240px;
}

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

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

.software-resource-item {
  align-items: stretch;
  flex-direction: column;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fafbfe;
}

.software-resource-item .resource-main {
  width: 100%;
}

.software-resource-item .resource-item-actions {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.software-resource-item .resource-item-actions form,
.software-resource-item .resource-item-actions .btn {
  width: 100%;
}

.class-resource-item {
  align-items: stretch;
  flex-direction: column;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fafbfe;
}

.class-resource-form {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) minmax(74px, 0.34fr);
  align-items: center;
  gap: 9px;
}

.class-resource-form .class-count-control {
  width: 100%;
  max-width: none !important;
}

.class-resource-actions {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.class-resource-actions form,
.class-resource-actions .btn {
  width: 100%;
}

.class-resource-form input[name="name"] {
  min-width: 0;
  grid-column: 1;
  grid-row: 1;
}

.class-resource-form input[type="number"] {
  width: 100%;
  min-width: 0;
  max-width: none !important;
  grid-column: 2;
  grid-row: 1;
}

.class-resource-item > form:last-child .btn {
  width: 100%;
}

.semester-overview-panel {
  margin-bottom: 20px;
}

.semester-head-note {
  max-width: 820px;
  padding: 9px 13px;
  border: 1px solid #d8e2ff;
  border-radius: 10px;
  color: #40577f;
  background: #f2f5ff;
  font-size: 13px;
  line-height: 1.5;
  text-align: right;
}

.semester-overview-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 24px;
}

.semester-overview-layout .semester-create-form {
  margin-top: 0;
}

.live-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding: 22px 24px;
  border-radius: 18px;
  color: white;
  background: linear-gradient(140deg, #24386d, #3158d4);
  box-shadow: var(--shadow);
}

.live-banner h2 {
  margin: 0 0 4px;
}

.live-banner p {
  margin: 0;
  color: rgba(255, 255, 255, 0.74);
}

.live-clock {
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}

.room-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.room-card {
  padding: 21px;
  border: 1px solid #dfe4ea;
  border-top: 4px solid #a7afbc;
  border-radius: 16px;
  background: #f3f5f7;
  box-shadow: 0 8px 22px rgba(70, 80, 96, 0.06);
}

.room-card.busy {
  border-color: #b9e3cd;
  border-top-color: var(--green);
  background: #eefaf4;
  box-shadow: 0 12px 28px rgba(24, 134, 91, 0.11);
}

.room-card.idle .room-detail,
.room-card.idle h3 {
  color: #667085;
}

.room-card.offline {
  border-top-color: #a7afbc;
  opacity: 0.7;
}

.room-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.room-card h3 {
  margin: 0;
  font-size: 19px;
}

.room-detail {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 7px 10px;
  margin: 0;
  font-size: 13px;
}

.room-detail dt {
  color: var(--muted);
}

.room-detail dd {
  margin: 0;
  font-weight: 650;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 30px;
  background:
    radial-gradient(circle at 12% 15%, rgba(49, 88, 212, 0.2), transparent 30rem),
    #edf1f8;
}

.login-card {
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 30px 80px rgba(34, 56, 109, 0.18);
}

.login-card .brand {
  margin-bottom: 28px;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.login-card > p {
  margin: 0 0 26px;
  color: var(--muted);
}

.login-card .form-field + .form-field {
  margin-top: 16px;
}

.login-card .btn {
  margin-top: 22px;
}

.login-back {
  display: block;
  margin-top: 20px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.batch-result {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.batch-result div {
  padding: 15px;
  border-radius: 12px;
  background: #f6f8fc;
  text-align: center;
}

.batch-result strong,
.batch-result span {
  display: block;
}

.batch-result strong {
  font-size: 24px;
}

.batch-result span {
  color: var(--muted);
  font-size: 12px;
}

.site-footer {
  padding: 9px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.footer-inner {
  display: flex;
  justify-content: center;
  text-align: center;
}

.site-footer a:hover {
  color: var(--primary);
}

@media (max-width: 980px) {
  .main-nav {
    display: none;
    position: absolute;
    top: 67px;
    right: 20px;
    left: 20px;
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
    box-shadow: var(--shadow);
  }

  .main-nav.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .header-actions {
    margin-left: auto;
  }

  .hero-grid,
  .split-layout,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .hero-board {
    min-height: 280px;
  }

  .quick-grid,
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .home-menu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .room-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .side-note {
    position: static;
  }

  .room-resource-list {
    grid-template-columns: 1fr;
  }

  .software-resource-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .teacher-timetable-filter {
    grid-template-columns: minmax(190px, 1fr) minmax(180px, 0.7fr) auto auto;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 24px, 1180px);
  }

  .header-inner {
    min-height: 68px;
  }

  .brand-logo-frame {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .brand small,
  .admin-name {
    display: none;
  }

  .header-actions {
    padding-left: 10px;
  }

  .hero {
    padding: 45px 0 34px;
  }

  .home-menu {
    min-height: calc(100vh - 108px);
    padding: 24px 0;
    background-position: 37% center;
  }

  .home-menu-grid {
    gap: 10px;
  }

  .home-menu-card {
    min-height: 154px;
    padding: 16px;
    border-radius: 19px;
  }

  .home-menu-card::after {
    right: -38px;
    bottom: -48px;
    width: 108px;
    height: 108px;
  }

  .home-menu-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  .home-menu-icon svg {
    width: 23px;
    height: 23px;
  }

  .home-menu-copy strong {
    font-size: 17px;
  }

  .home-menu-copy small {
    display: none;
  }

  .home-menu-arrow {
    right: 13px;
    bottom: 12px;
    width: 29px;
    height: 29px;
    font-size: 17px;
  }

  .hero-grid {
    gap: 32px;
  }

  .hero h1 {
    font-size: 39px;
  }

  .hero-copy {
    font-size: 16px;
  }

  .hero-board {
    min-height: 300px;
    padding: 22px;
  }

  .quick-grid,
  .metric-grid,
  .resource-grid,
  .room-grid,
  .form-grid,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .quick-card {
    min-height: 180px;
  }

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

  .page-head {
    padding-top: 32px;
  }

  .page-head-compact {
    padding: 22px 0 18px;
  }

  .page-head-compact .page-head-inner {
    gap: 12px;
  }

  .application-page-head .badge {
    position: static;
    margin-top: 12px;
    transform: none;
  }

  .page-head-inner,
  .dashboard-top,
  .live-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-body,
  .application-content,
  .settings-section-content {
    padding: 18px;
  }

  .settings-section-summary {
    gap: 9px;
    padding: 15px 16px;
  }

  .settings-section-heading strong {
    font-size: 16px;
  }

  .settings-section-summary::after {
    min-width: 26px;
  }

  .search-box,
  .compact-form,
  .danger-zone-form,
  .panel-toolbar,
  .schedule-search {
    align-items: stretch;
    flex-direction: column;
  }

  .table-bulk-toolbar,
  .table-bulk-toolbar > div {
    align-items: stretch;
    flex-direction: column;
  }

  .table-bulk-toolbar .btn {
    width: 100%;
  }

  .schedule-search,
  .schedule-search .form-control {
    width: 100%;
    min-width: 0;
  }

  .semester-suggestion {
    align-items: stretch;
    flex-direction: column;
  }

  .semester-overview-panel .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .semester-head-note {
    max-width: none;
    text-align: left;
  }

  .semester-suggestion .btn {
    width: 100%;
  }

  .danger-zone-form .form-field {
    width: 100%;
    max-width: none;
    flex-basis: auto;
  }

  .semester-data-guide,
  .semester-import-form {
    grid-template-columns: 1fr;
  }

  .semester-data-buttons,
  .semester-data-buttons .btn,
  .semester-import-form .btn {
    width: 100%;
  }

  .period-form .period-time-control {
    width: 100%;
    flex-basis: auto;
  }

  .class-resource-grid {
    grid-template-columns: 1fr;
  }

  .software-resource-grid {
    grid-template-columns: 1fr;
  }

  .semester-overview-layout {
    grid-template-columns: 1fr;
  }

  .application-summary {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .application-summary::after {
    width: 100%;
  }

  .resource-item {
    align-items: stretch;
    flex-direction: column;
  }

  .resource-item > form {
    width: 100%;
  }

  .resource-item > form:last-child .btn {
    width: 100%;
  }

  .resource-item input[style*="max-width"] {
    max-width: none !important;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

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

  .schedule-export-block,
  .schedule-export-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .schedule-export-actions,
  .schedule-export-actions .btn {
    width: 100%;
  }

  .schedule-export-actions {
    grid-template-columns: 1fr;
  }

  .timetable-page-shell {
    width: min(100% - 24px, 1380px);
  }

  .teacher-timetable-filter {
    grid-template-columns: 1fr;
  }

  .teacher-timetable-filter .btn {
    width: 100%;
  }

  .teacher-timetable-heading {
    align-items: flex-start;
    flex-direction: column;
    padding: 17px 18px;
  }

  .teacher-timetable-heading h2 {
    font-size: 19px;
  }

  .teacher-course-legend {
    position: static;
  }

  .teacher-timetable-wrap {
    max-width: 100%;
  }

  .teacher-timetable {
    min-width: 980px;
  }
}

@media (max-width: 680px) {
  .back-to-top {
    right: 14px;
    bottom: 14px;
    min-height: 40px;
    padding: 9px 12px;
  }

  .back-to-top strong {
    font-size: 12px;
  }

  .teacher-shared-field {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 15px;
  }

  .teacher-shared-field .field-help {
    margin-bottom: 0;
  }

  .course-request-head,
  .course-slots-heading,
  .course-add-row {
    align-items: stretch;
    flex-direction: column;
  }

  .course-request-head > div,
  .course-slots-heading > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .course-request-head .btn,
  .course-slot-actions .btn,
  .course-add-row .btn {
    width: 100%;
  }

  .course-request-body {
    padding: 16px 14px;
  }

  .course-slot-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .course-slot-row .slot-number,
  .course-slot-row .slot-remove-button {
    grid-column: 1 / -1;
  }

  .course-slot-row .slot-remove-button {
    width: 100%;
  }
}
