:root {
  color-scheme: light;
  --ink: #22252b;
  --muted: #65707d;
  --line: #d9e0e8;
  --surface: #ffffff;
  --soft: #f6f8fb;
  --sidebar: #f2f0ea;
  --blue: #2f6f9f;
  --blue-dark: #1f4f72;
  --green: #4e7f65;
  --amber: #a0642a;
  --danger: #a84242;
  --shadow: 0 10px 28px rgba(34, 37, 43, 0.08);
}

body[data-theme="classic"] {
  color-scheme: light;
  --ink: #22252b;
  --muted: #65707d;
  --line: #d9e0e8;
  --surface: #ffffff;
  --soft: #f6f8fb;
  --sidebar: #f2f0ea;
  --blue: #2f6f9f;
  --blue-dark: #1f4f72;
  --green: #4e7f65;
  --amber: #a0642a;
  --danger: #a84242;
  --shadow: 0 10px 28px rgba(34, 37, 43, 0.08);
}

body[data-theme="sakura"] {
  color-scheme: light;
  --ink: #37252c;
  --muted: #80606d;
  --line: #ead2dc;
  --surface: #fffafa;
  --soft: #fff4f7;
  --sidebar: #f9dce7;
  --blue: #b85d7b;
  --blue-dark: #80364f;
  --green: #5f8d84;
  --amber: #b16d4e;
  --danger: #b13f55;
  --shadow: 0 12px 30px rgba(128, 54, 79, 0.12);
}

body[data-theme="fuji"] {
  color-scheme: light;
  --ink: #2c2527;
  --muted: #765f62;
  --line: #ead3c8;
  --surface: #fffaf5;
  --soft: #fff2ea;
  --sidebar: #c75b42;
  --blue: #a94736;
  --blue-dark: #6f241f;
  --green: #4f746f;
  --amber: #c8753f;
  --danger: #9f3030;
  --shadow: 0 12px 30px rgba(111, 36, 31, 0.14);
}

body[data-theme="redfinch"] {
  color-scheme: light;
  --ink: #2f1e18;
  --muted: #7b5a4a;
  --line: #eed0ad;
  --surface: #fffaf0;
  --soft: #fff2dc;
  --sidebar: #7a2418;
  --blue: #b84a24;
  --blue-dark: #6e2015;
  --green: #687c55;
  --amber: #c57a28;
  --danger: #a92d25;
  --shadow: 0 12px 30px rgba(110, 32, 21, 0.16);
}

body[data-theme="chrysanthemum"] {
  color-scheme: light;
  --ink: #1f2f3f;
  --muted: #60758c;
  --line: #c9d9e8;
  --surface: #fbfdff;
  --soft: #eef6fb;
  --sidebar: #dbeaf5;
  --blue: #3f789b;
  --blue-dark: #214966;
  --green: #657d68;
  --amber: #b28438;
  --danger: #a94848;
  --shadow: 0 12px 30px rgba(33, 73, 102, 0.14);
}

body[data-theme="fox"] {
  color-scheme: light;
  --ink: #2c241b;
  --muted: #776854;
  --line: #ead4aa;
  --surface: #fffaf0;
  --soft: #fff4df;
  --sidebar: #6f5635;
  --blue: #ad7430;
  --blue-dark: #6b4119;
  --green: #6f7b52;
  --amber: #cf8b2e;
  --danger: #a34232;
  --shadow: 0 12px 30px rgba(107, 65, 25, 0.16);
}

body[data-theme="phoenix"] {
  color-scheme: light;
  --ink: #301b17;
  --muted: #7d5a4d;
  --line: #edcf9b;
  --surface: #fffaf0;
  --soft: #fff1d8;
  --sidebar: #6f1e18;
  --blue: #b66a22;
  --blue-dark: #6d2419;
  --green: #5f806c;
  --amber: #d0962f;
  --danger: #a5352e;
  --shadow: 0 12px 30px rgba(109, 36, 25, 0.16);
}

body[data-theme="dunhuang"] {
  color-scheme: light;
  --ink: #172d30;
  --muted: #5c716e;
  --line: #d6c49a;
  --surface: #fffaf0;
  --soft: #f3efe2;
  --sidebar: #123438;
  --blue: #24706d;
  --blue-dark: #123f43;
  --green: #5e896f;
  --amber: #b88430;
  --danger: #a94a3b;
  --shadow: 0 12px 30px rgba(18, 63, 67, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--soft);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  letter-spacing: 0;
}

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

button,
a.secondary-button {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

a.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  text-decoration: none;
}

.primary-button {
  padding: 0 16px;
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
  font-weight: 700;
}

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

.secondary-button,
.ghost-button,
.danger-button {
  padding: 0 12px;
  color: var(--blue-dark);
  background: #fff;
  border-color: var(--line);
  font-weight: 650;
}

.secondary-button:hover,
.ghost-button:hover {
  border-color: var(--blue);
}

.disabled-button,
.disabled-button:hover {
  opacity: 0.58;
  cursor: not-allowed;
  border-color: var(--line);
}

.danger-button {
  color: var(--danger);
}

.danger-button:hover {
  border-color: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

input,
select {
  min-height: 38px;
  padding: 0 10px;
}

textarea {
  resize: vertical;
  padding: 10px;
  line-height: 1.5;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.app-shell {
  display: grid;
  height: 100vh;
  min-height: 0;
  grid-template-columns: 300px minmax(0, 1fr);
  overflow: hidden;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell.sidebar-collapsed .sidebar {
  display: none;
}

.sidebar {
  position: relative;
  display: flex;
  height: 100vh;
  min-height: 0;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  padding: 22px;
  background: var(--sidebar);
  border-right: 1px solid #ddd7ca;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

body[data-theme="sakura"] .sidebar {
  background:
    linear-gradient(180deg, rgba(255, 250, 252, 0.66), rgba(255, 232, 241, 0.58)),
    url("/assets/themes/sakura.jpg");
  background-attachment: scroll;
  background-position: center top;
  background-repeat: no-repeat;
  background-size: auto 100vh;
  border-right-color: #efc7d5;
}

body[data-theme="sakura"] .sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 245, 249, 0.06);
  pointer-events: none;
}

body[data-theme="fuji"] .sidebar {
  background:
    linear-gradient(180deg, rgba(46, 24, 22, 0.34), rgba(255, 235, 218, 0.5)),
    url("/assets/themes/fuji.jpg");
  background-attachment: scroll;
  background-position: center top;
  background-repeat: no-repeat;
  background-size: auto 100vh;
  border-right-color: #d69a86;
}

body[data-theme="fuji"] .sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 241, 230, 0.06);
  pointer-events: none;
}

body[data-theme="redfinch"] .sidebar {
  background:
    linear-gradient(180deg, rgba(58, 18, 12, 0.28), rgba(255, 224, 170, 0.48)),
    url("/assets/themes/redfinch.jpg");
  background-attachment: scroll;
  background-position: center top;
  background-repeat: no-repeat;
  background-size: auto 100vh;
  border-right-color: #d18a55;
}

body[data-theme="redfinch"] .sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 225, 175, 0.04);
  pointer-events: none;
}

body[data-theme="chrysanthemum"] .sidebar {
  background:
    linear-gradient(180deg, rgba(237, 247, 255, 0.54), rgba(210, 228, 241, 0.42)),
    url("/assets/themes/chrysanthemum.jpg");
  background-attachment: scroll;
  background-position: center top;
  background-repeat: no-repeat;
  background-size: auto 100vh;
  border-right-color: #b7ccdc;
}

body[data-theme="chrysanthemum"] .sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(241, 248, 255, 0.04);
  pointer-events: none;
}

body[data-theme="fox"] .sidebar {
  background:
    linear-gradient(180deg, rgba(38, 31, 24, 0.28), rgba(255, 232, 178, 0.46)),
    url("/assets/themes/fox.png");
  background-attachment: scroll;
  background-position: center top;
  background-repeat: no-repeat;
  background-size: auto 100vh;
  border-right-color: #d3a45f;
}

body[data-theme="fox"] .sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 238, 194, 0.04);
  pointer-events: none;
}

body[data-theme="phoenix"] .sidebar {
  background:
    linear-gradient(180deg, rgba(64, 17, 14, 0.24), rgba(255, 225, 166, 0.48)),
    url("/assets/themes/phoenix.jpg");
  background-attachment: scroll;
  background-position: center top;
  background-repeat: no-repeat;
  background-size: auto 100vh;
  border-right-color: #cf8b4b;
}

body[data-theme="phoenix"] .sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 232, 184, 0.04);
  pointer-events: none;
}

body[data-theme="dunhuang"] .sidebar {
  background:
    linear-gradient(180deg, rgba(6, 16, 17, 0.3), rgba(225, 202, 151, 0.42)),
    url("/assets/themes/dunhuang.jpg");
  background-attachment: scroll;
  background-position: center top;
  background-repeat: no-repeat;
  background-size: auto 100vh;
  border-right-color: #b99b55;
}

body[data-theme="dunhuang"] .sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(245, 224, 176, 0.04);
  pointer-events: none;
}

.sidebar-collapse-button {
  width: 100%;
}

.sidebar-restore-button {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 30;
  min-height: 34px;
  padding: 0 12px;
  color: var(--blue-dark);
  background: #fff;
  border-color: var(--line);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 800;
}

.app-shell.sidebar-collapsed .sidebar-restore-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-block h1,
.topbar h2,
.panel h2 {
  margin: 0;
}

.brand-block {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.brand-block h1 {
  font-size: 24px;
  line-height: 1.15;
}

.brand-copy {
  min-width: 0;
}

.brand-version {
  display: grid;
  gap: 2px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
  line-height: 1.25;
}

body[data-theme="sakura"] .sidebar .brand-block h1,
body[data-theme="fuji"] .sidebar .brand-block h1,
body[data-theme="redfinch"] .sidebar .brand-block h1,
body[data-theme="chrysanthemum"] .sidebar .brand-block h1,
body[data-theme="fox"] .sidebar .brand-block h1,
body[data-theme="phoenix"] .sidebar .brand-block h1,
body[data-theme="dunhuang"] .sidebar .brand-block h1 {
  color: #fff;
  text-shadow:
    0 2px 4px rgba(0, 0, 0, 0.42),
    0 0 12px rgba(0, 0, 0, 0.28);
}

body[data-theme="sakura"] .sidebar .brand-version,
body[data-theme="fuji"] .sidebar .brand-version,
body[data-theme="redfinch"] .sidebar .brand-version,
body[data-theme="chrysanthemum"] .sidebar .brand-version,
body[data-theme="fox"] .sidebar .brand-version,
body[data-theme="phoenix"] .sidebar .brand-version,
body[data-theme="dunhuang"] .sidebar .brand-version {
  color: rgba(255, 255, 255, 0.78);
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.5),
    0 0 10px rgba(0, 0, 0, 0.22);
}

.feature-menu {
  display: grid;
  flex: 1 1 auto;
  gap: 8px;
  min-height: 0;
  align-content: start;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.menu-button {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: flex-start;
  padding: 0 14px;
  color: var(--ink);
  background: transparent;
  border-color: transparent;
  font-weight: 800;
  text-align: left;
}

.menu-toggle {
  justify-content: space-between;
}

.toggle-indicator {
  flex: 0 0 auto;
  color: var(--muted);
}

body[data-theme="sakura"] .sidebar .menu-button:not(:hover):not(.active),
body[data-theme="fuji"] .sidebar .menu-button:not(:hover):not(.active),
body[data-theme="redfinch"] .sidebar .menu-button:not(:hover):not(.active),
body[data-theme="chrysanthemum"] .sidebar .menu-button:not(:hover):not(.active),
body[data-theme="fox"] .sidebar .menu-button:not(:hover):not(.active),
body[data-theme="phoenix"] .sidebar .menu-button:not(:hover):not(.active),
body[data-theme="dunhuang"] .sidebar .menu-button:not(:hover):not(.active),
body[data-theme="sakura"] .sidebar .submenu-button:not(:hover):not(.active),
body[data-theme="fuji"] .sidebar .submenu-button:not(:hover):not(.active),
body[data-theme="redfinch"] .sidebar .submenu-button:not(:hover):not(.active),
body[data-theme="chrysanthemum"] .sidebar .submenu-button:not(:hover):not(.active),
body[data-theme="fox"] .sidebar .submenu-button:not(:hover):not(.active),
body[data-theme="phoenix"] .sidebar .submenu-button:not(:hover):not(.active),
body[data-theme="dunhuang"] .sidebar .submenu-button:not(:hover):not(.active) {
  color: rgba(255, 255, 255, 0.92);
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.54),
    0 0 10px rgba(0, 0, 0, 0.28);
}

body[data-theme="sakura"] .sidebar .submenu-button:not(:hover):not(.active),
body[data-theme="fuji"] .sidebar .submenu-button:not(:hover):not(.active),
body[data-theme="redfinch"] .sidebar .submenu-button:not(:hover):not(.active),
body[data-theme="chrysanthemum"] .sidebar .submenu-button:not(:hover):not(.active),
body[data-theme="fox"] .sidebar .submenu-button:not(:hover):not(.active),
body[data-theme="phoenix"] .sidebar .submenu-button:not(:hover):not(.active),
body[data-theme="dunhuang"] .sidebar .submenu-button:not(:hover):not(.active) {
  background: rgba(0, 0, 0, 0.08);
}

body[data-theme="sakura"] .sidebar .menu-button:not(:hover):not(.active) .toggle-indicator,
body[data-theme="fuji"] .sidebar .menu-button:not(:hover):not(.active) .toggle-indicator,
body[data-theme="redfinch"] .sidebar .menu-button:not(:hover):not(.active) .toggle-indicator,
body[data-theme="chrysanthemum"] .sidebar .menu-button:not(:hover):not(.active) .toggle-indicator,
body[data-theme="fox"] .sidebar .menu-button:not(:hover):not(.active) .toggle-indicator,
body[data-theme="phoenix"] .sidebar .menu-button:not(:hover):not(.active) .toggle-indicator,
body[data-theme="dunhuang"] .sidebar .menu-button:not(:hover):not(.active) .toggle-indicator {
  color: rgba(255, 255, 255, 0.86);
}

.menu-button:hover,
.menu-button.active {
  background: #fff;
  border-color: #ddd7ca;
}

body[data-theme="sakura"] .sidebar .ghost-button,
body[data-theme="sakura"] .menu-button:hover,
body[data-theme="sakura"] .menu-button.active,
body[data-theme="sakura"] .submenu-button:hover,
body[data-theme="sakura"] .submenu-button.active {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(184, 93, 123, 0.28);
  backdrop-filter: blur(5px);
}

body[data-theme="fuji"] .sidebar .ghost-button,
body[data-theme="fuji"] .menu-button:hover,
body[data-theme="fuji"] .menu-button.active,
body[data-theme="fuji"] .submenu-button:hover,
body[data-theme="fuji"] .submenu-button.active {
  background: rgba(255, 250, 245, 0.8);
  border-color: rgba(169, 71, 54, 0.32);
  backdrop-filter: blur(5px);
}

body[data-theme="redfinch"] .sidebar .ghost-button,
body[data-theme="redfinch"] .menu-button:hover,
body[data-theme="redfinch"] .menu-button.active,
body[data-theme="redfinch"] .submenu-button:hover,
body[data-theme="redfinch"] .submenu-button.active {
  background: rgba(255, 247, 232, 0.82);
  border-color: rgba(184, 74, 36, 0.34);
  backdrop-filter: blur(5px);
}

body[data-theme="chrysanthemum"] .sidebar .ghost-button,
body[data-theme="chrysanthemum"] .menu-button:hover,
body[data-theme="chrysanthemum"] .menu-button.active,
body[data-theme="chrysanthemum"] .submenu-button:hover,
body[data-theme="chrysanthemum"] .submenu-button.active {
  background: rgba(250, 253, 255, 0.82);
  border-color: rgba(63, 120, 155, 0.3);
  backdrop-filter: blur(5px);
}

body[data-theme="fox"] .sidebar .ghost-button,
body[data-theme="fox"] .menu-button:hover,
body[data-theme="fox"] .menu-button.active,
body[data-theme="fox"] .submenu-button:hover,
body[data-theme="fox"] .submenu-button.active {
  background: rgba(255, 250, 238, 0.82);
  border-color: rgba(173, 116, 48, 0.34);
  backdrop-filter: blur(5px);
}

body[data-theme="phoenix"] .sidebar .ghost-button,
body[data-theme="phoenix"] .menu-button:hover,
body[data-theme="phoenix"] .menu-button.active,
body[data-theme="phoenix"] .submenu-button:hover,
body[data-theme="phoenix"] .submenu-button.active {
  background: rgba(255, 248, 232, 0.82);
  border-color: rgba(182, 106, 34, 0.34);
  backdrop-filter: blur(5px);
}

body[data-theme="dunhuang"] .sidebar .ghost-button,
body[data-theme="dunhuang"] .menu-button:hover,
body[data-theme="dunhuang"] .menu-button.active,
body[data-theme="dunhuang"] .submenu-button:hover,
body[data-theme="dunhuang"] .submenu-button.active {
  background: rgba(250, 247, 235, 0.82);
  border-color: rgba(36, 112, 109, 0.34);
  backdrop-filter: blur(5px);
}

.menu-button.active {
  color: var(--blue-dark);
  box-shadow: var(--shadow);
}

.submenu {
  display: grid;
  gap: 6px;
  padding-left: 16px;
}

.collapsed-submenu {
  display: none;
}

.submenu-button {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  justify-content: flex-start;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.45);
  border-color: transparent;
  font-size: 14px;
  font-weight: 750;
  text-align: left;
}

.submenu-button:hover,
.submenu-button.active {
  color: var(--blue-dark);
  background: #fff;
  border-color: #ddd7ca;
}

.logout-button {
  flex: 0 0 auto;
  width: 100%;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: #edf4f1;
}

.auth-shell {
  display: grid;
  grid-template-columns: 220px minmax(360px, 420px);
  gap: 18px;
  align-items: center;
  width: min(680px, calc(100vw - 32px));
}

.auth-panel {
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.auth-content {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.auth-qr-panel {
  display: grid;
  place-items: center;
}

.auth-logo {
  width: 112px;
  height: 112px;
  justify-self: center;
  object-fit: contain;
}

.auth-panel h1 {
  margin: 0;
  font-size: 28px;
}

.auth-qr {
  width: 200px;
  height: 200px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.auth-hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.workspace {
  display: flex;
  min-height: 0;
  min-width: 0;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.page-view {
  min-width: 0;
}

.hidden {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar h2 {
  font-size: 24px;
}

.topbar-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(2, 44px);
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segment-button {
  min-height: 32px;
  padding: 0;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.segment-button.active {
  color: #fff;
  background: var(--blue);
}

.inline-field {
  min-width: 260px;
}

.calendar-semester-field {
  min-width: 320px;
}

.entry-band {
  padding: 22px 28px;
  background: #edf4f1;
  border-bottom: 1px solid #d2ded8;
}

.settings-band {
  display: grid;
  max-width: 720px;
  gap: 12px;
  padding: 22px 28px;
}

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

.lesson-form,
.stack-form {
  display: grid;
  gap: 12px;
}

.collapsed-form {
  display: none;
}

.import-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.field-row {
  display: grid;
  grid-template-columns: 160px 140px minmax(170px, 1fr) minmax(220px, 1fr);
  gap: 12px;
}

.topic-board-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(220px, 0.38fr);
  gap: 12px;
  align-items: end;
}

.session-prep-link-panel {
  display: flex;
  min-width: 0;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid #dbe7f1;
  border-radius: 8px;
  background: #f8fbfd;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 850;
}

.session-prep-link-panel.empty {
  justify-content: flex-start;
  color: var(--muted);
  font-weight: 700;
}

.session-prep-link-panel span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.board-link-panel {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.board-link-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.small-button {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
}

.board-link-display {
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-link-display a {
  display: block;
  width: 100%;
  overflow: hidden;
  color: var(--blue-dark);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-link-editor {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.three-col {
  display: grid;
  grid-template-columns: 72px 90px minmax(0, 1fr);
  gap: 8px;
}

.user-form-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) 112px;
  gap: 8px;
  align-items: center;
}

.user-form-grid select {
  white-space: nowrap;
}

.group-form-row {
  grid-template-columns: minmax(120px, 1fr) 64px 92px;
}

.form-section-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.checkbox-pill input {
  width: auto;
}

.checkbox-pill small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-text {
  min-height: 20px;
  color: var(--green);
  font-weight: 700;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  padding: 22px 28px 34px;
}

.content-grid.summary-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.content-grid.summary-hidden .side-column {
  display: none;
}

.placeholder-band,
.calendar-band,
.prep-band,
.stats-band,
.grades-band,
.admin-band {
  padding: 22px 28px 34px;
}

.admin-band {
  overflow: hidden;
}

.admin-band.tree-hidden {
  overflow-x: visible;
}

.admin-band.tree-hidden .admin-tree-scroll {
  display: none;
}

.admin-tree-scroll {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid #cfd9e4;
  border-radius: 8px;
  background: #f8fafc;
}

.hierarchy-strip {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.hierarchy-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 10pt;
  font-weight: 700;
}

.hierarchy-tab {
  display: inline-flex;
  min-width: 150px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--blue-dark);
  cursor: pointer;
  font-weight: 850;
}

.hierarchy-tab:hover,
.hierarchy-tab.active {
  border-color: var(--blue);
  background: #eef7fb;
}

.hierarchy-tab.active {
  box-shadow: inset 0 -3px 0 var(--blue);
}

.admin-grid {
  display: block;
}

.admin-panel {
  display: none;
  gap: 14px;
  align-content: start;
}

.admin-panel.active {
  display: grid;
}

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

.panel:not(.compact) {
  padding: 18px;
}

.panel.compact {
  padding: 14px;
  box-shadow: none;
}

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

.panel h2 {
  font-size: 18px;
}

.context-label {
  display: inline-flex;
  margin-left: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.class-list,
.student-list,
.session-list {
  display: grid;
  gap: 8px;
}

.class-item,
.student-item,
.session-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.class-item {
  padding: 12px;
  text-align: left;
}

.class-item.active {
  border-color: var(--blue);
  background: #eef7fb;
}

.summary-grid {
  display: grid;
  gap: 10px;
}

.summary-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  cursor: grab;
  user-select: none;
}

.summary-card.dragging {
  opacity: 0.45;
}

.summary-card.drag-over {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.summary-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.drag-handle {
  color: #94a3b8;
  font-weight: 900;
  letter-spacing: 1px;
}

.summary-card strong {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}

.calendar-band {
  display: grid;
  gap: 8px;
}

.calendar-lock-toggle {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.calendar-lock-toggle input {
  width: auto;
  min-height: 0;
  margin: 0;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.calendar-weekdays span {
  padding: 8px;
}

.calendar-grid {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  gap: 1px;
}

.calendar-grid.week-mode {
  min-height: 560px;
}

.calendar-day {
  display: grid;
  min-height: 132px;
  align-content: start;
  gap: 6px;
  padding: 8px;
  background: #fff;
}

.calendar-grid.week-mode .calendar-day {
  min-height: 560px;
}

.calendar-day.outside-month {
  background: #f2f5f8;
}

.calendar-day.today {
  box-shadow: inset 0 0 0 2px var(--blue);
}

.calendar-day.drag-over {
  box-shadow: inset 0 0 0 3px #58a6d6;
  background: #eef8ff;
}

.calendar-date {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 850;
}

.calendar-day.today .calendar-date {
  color: #fff;
  background: var(--blue);
}

.calendar-events {
  display: grid;
  gap: 5px;
}

.calendar-event {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  min-height: 0;
  gap: 4px;
  align-items: start;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--event-color);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: grab;
  text-align: left;
  touch-action: none;
}

.calendar-locked .calendar-event {
  cursor: default;
}

.calendar-event.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.calendar-pointer-dragging .calendar-event.dragging {
  pointer-events: none;
}

.calendar-event-main {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.calendar-event-main span,
.calendar-event-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event-main span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.calendar-event-main strong {
  font-size: 12px;
}

.calendar-event-delete {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #9aa9b8;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.calendar-event-delete:hover {
  background: #fee2e2;
  color: #b91c1c;
}

.calendar-drag-preview {
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  display: grid;
  width: min(220px, 58vw);
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--event-color);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(32, 50, 68, 0.18);
  color: var(--ink);
  pointer-events: none;
}

.calendar-drag-preview span,
.calendar-drag-preview strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-drag-preview span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.calendar-drag-preview strong {
  font-size: 13px;
}

.prep-band {
  display: grid;
  gap: 12px;
}

.prep-editor-panel {
  display: grid;
  gap: 14px;
}

.prep-workspace {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(230px, 1fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.prep-workspace.prep-topic-sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.prep-workspace.prep-topic-sidebar-collapsed .prep-topic-sidebar {
  display: none;
}

.prep-main-column,
.prep-topic-sidebar {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.prep-topic-sidebar {
  align-self: start;
}

.prep-note-list {
  display: grid;
  gap: 12px;
}

.prep-topic-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.prep-topic-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.prep-topic-title div,
.prep-topic-card-header div {
  min-width: 0;
}

.prep-topic-title strong,
.prep-topic-card-header strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.prep-topic-title span,
.prep-topic-card-header p,
.prep-topic-empty,
.prep-note-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.prep-topic-title span {
  display: block;
  margin-top: 2px;
}

.prep-topic-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 8px;
}

.prep-topic-sidebar .prep-topic-list {
  grid-template-columns: 1fr;
}

.prep-panel-actions {
  flex: 0 0 auto;
}

.prep-topic-sidebar .prep-topic-title {
  align-items: flex-start;
}

.prep-topic-title-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.prep-topic-manage-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid #dbe5ec;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: linear-gradient(180deg, #f7fafc, #edf4f8);
}

.prep-topic-manage-item .item-actions {
  justify-content: flex-end;
  white-space: nowrap;
}

.prep-topic-manage-summary {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.prep-topic-manage-summary strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prep-topic-manage-summary span,
.prep-topic-manage-summary small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prep-topic-chip {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  min-height: 30px;
  padding: 5px 9px;
  border: 0;
  border-radius: 999px;
  background: #eef3f7;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.prep-topic-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prep-topic-chip small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}

.prep-topic-board {
  display: grid;
  grid-template-columns: repeat(var(--prep-topic-columns, 3), minmax(260px, 330px));
  grid-auto-flow: dense;
  grid-auto-rows: 8px;
  gap: 12px;
  align-items: start;
  width: max-content;
  min-width: 100%;
  padding: 2px;
  overflow: visible;
}

.prep-topic-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  padding: 2px 2px 14px;
  outline: none;
  overscroll-behavior-inline: contain;
  scrollbar-color: color-mix(in srgb, var(--accent) 58%, #c8d4df) #edf2f7;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
}

.prep-topic-scroll:focus-visible {
  border-radius: 8px;
  box-shadow: 0 0 0 3px rgba(47, 111, 159, 0.15);
}

.prep-topic-scroll::-webkit-scrollbar {
  height: 12px;
}

.prep-topic-scroll::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #edf2f7;
}

.prep-topic-scroll::-webkit-scrollbar-thumb {
  border: 3px solid #edf2f7;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 62%, #c8d4df);
}

.prep-topic-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.prep-topic-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(38, 48, 66, 0.05);
}

.prep-topic-card.dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.prep-topic-card[draggable="true"] {
  cursor: grab;
}

.prep-topic-pointer-dragging .prep-topic-card.dragging {
  pointer-events: none;
}

.prep-topic-card.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
}

.prep-topic-card.drag-over-note {
  background: #f1f8ff;
  outline: 2px solid rgba(47, 111, 159, 0.58);
  outline-offset: 3px;
}

.prep-topic-card.system-topic {
  border-style: dashed;
  background: #f8fafc;
  box-shadow: none;
}

.prep-topic-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.prep-topic-card-header small {
  display: inline-flex;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.prep-topic-card-header p {
  margin: 4px 0 0;
}

.prep-topic-card-menu {
  position: relative;
  flex: 0 0 auto;
}

.prep-topic-card-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.prep-topic-card-menu summary::-webkit-details-marker {
  display: none;
}

.prep-topic-card-menu[open] summary {
  border-color: var(--accent);
  background: #eef6fb;
  color: var(--accent);
}

.prep-topic-card-menu-actions {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  gap: 6px;
  min-width: 118px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(38, 48, 66, 0.16);
}

.prep-topic-card-menu-actions button {
  justify-content: center;
}

.prep-topic-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 4px;
  border-radius: 5px;
  color: var(--muted);
  cursor: grab;
  vertical-align: top;
}

.prep-topic-drag-preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  display: grid;
  gap: 3px;
  width: 210px;
  max-width: 60vw;
  min-height: 0;
  padding: 8px 10px;
  overflow: hidden;
  border: 1px solid #cfe0ef;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #fbfcfe;
  pointer-events: none;
  opacity: 0.96;
  transform: translate(-9999px, -9999px);
  box-shadow: 0 18px 38px rgba(32, 50, 68, 0.24);
}

.prep-topic-drag-preview strong,
.prep-topic-drag-preview span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prep-topic-drag-preview strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.prep-topic-drag-preview span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.prep-topic-resize-handle {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 18px;
  height: 18px;
  border-right: 3px solid rgba(47, 111, 159, 0.45);
  border-bottom: 3px solid rgba(47, 111, 159, 0.45);
  border-radius: 2px;
  cursor: ew-resize;
  touch-action: none;
}

.prep-topic-notes {
  display: grid;
  gap: 9px;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
}

.prep-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.prep-note-table {
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13px;
}

.prep-note-table > thead > tr > th,
.prep-note-table > tbody > tr > td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.prep-note-table > thead > tr > th {
  background: #eef3f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.prep-note-table > thead > tr > th:nth-child(2),
.prep-note-table > thead > tr > th:nth-child(3),
.prep-note-table > tbody > tr.prep-note-row > td:nth-child(2),
.prep-note-table > tbody > tr.prep-note-row > td:nth-child(3) {
  width: 168px;
  white-space: nowrap;
}

.prep-note-table > thead > tr > th:last-child,
.prep-note-table > tbody > tr.prep-note-row > td:last-child {
  width: 132px;
  white-space: nowrap;
}

.prep-note-table > thead > tr > th:first-child,
.prep-note-table > tbody > tr.prep-note-row > td:first-child {
  min-width: 0;
}

.prep-note-row {
  cursor: pointer;
}

.prep-note-row:hover,
.prep-note-row.expanded {
  background: #f7fbfd;
}

.prep-note-row strong {
  display: inline-block;
  max-width: calc(100% - 26px);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
}

.prep-expand-indicator {
  display: inline-flex;
  width: 20px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
}

.prep-note-table > tbody > tr.prep-note-detail-row > td {
  padding: 14px 16px 16px 34px;
  background: #fbfdff;
  white-space: normal;
}

.prep-note-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.prep-note-card[draggable="true"] {
  cursor: grab;
}

.prep-note-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.prep-note-card.drag-over-note {
  outline: 2px solid rgba(47, 111, 159, 0.64);
  outline-offset: 3px;
  background: #f1f8ff;
}

.prep-note-pointer-dragging .prep-note-card.dragging {
  pointer-events: none;
}

.prep-note-cover {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #eef3f7;
  cursor: pointer;
  text-align: left;
}

.prep-note-cover:hover,
.prep-note-cover:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 16%, transparent);
}

.prep-note-cover img,
.prep-note-cover iframe {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.prep-note-cover iframe {
  aspect-ratio: 16 / 9;
  border: 0;
}

.prep-note-cover iframe[data-video-aspect="portrait"],
.prep-html-canvas iframe[data-video-aspect="portrait"],
.prep-note-content iframe[data-video-aspect="portrait"] {
  max-width: 360px;
  aspect-ratio: 9 / 16;
}

.prep-note-cover iframe[data-video-aspect="portrait"] {
  margin-right: auto;
  margin-left: auto;
}

.prep-note-cover-iframe iframe {
  pointer-events: auto;
}

.prep-note-cover-iframe {
  cursor: default;
}

.prep-drive-open-link {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  margin: 6px 0 8px;
  padding: 5px 10px;
  border: 1px solid #bdd3e6;
  border-radius: 7px;
  background: #f3f8fc;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.25;
  text-decoration: none;
}

.prep-drive-open-link:hover,
.prep-drive-open-link:focus-visible {
  border-color: var(--primary);
  background: #e9f4fb;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prep-drive-cover-link {
  margin-top: -2px;
}

.prep-note-detail {
  display: grid;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.prep-note-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.prep-note-toggle strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 20pt;
  line-height: 1.18;
}

.prep-note-drag-handle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  color: #9aa9b8;
  cursor: grab;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.prep-note-drag-preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  display: grid;
  gap: 3px;
  width: 190px;
  max-width: 56vw;
  min-height: 0;
  padding: 7px 9px;
  overflow: hidden;
  border: 1px solid #cfe0ef;
  border-radius: 8px;
  background: #fbfcfe;
  pointer-events: none;
  opacity: 0.95;
  transform: translate(-9999px, -9999px);
  box-shadow: 0 18px 38px rgba(32, 50, 68, 0.24);
}

.prep-note-drag-preview strong,
.prep-note-drag-preview span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prep-note-drag-preview strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.prep-note-drag-preview span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.prep-note-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  min-width: 0;
  max-width: 100%;
}

.prep-note-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.prep-note-header h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
}

.prep-note-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.prep-asset-panel {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.prep-search-field {
  min-width: 220px;
}

.prep-search-field input {
  width: min(260px, 100%);
}

.prep-html-source {
  display: none;
  min-height: 280px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.prep-source-mode .prep-html-source {
  display: block;
}

.prep-source-mode .prep-html-canvas {
  display: none;
}

.prep-html-editor {
  position: relative;
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.prep-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: #f6f8fb;
}

.prep-editor-toolbar button,
.prep-editor-toolbar select,
.prep-editor-color {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.prep-editor-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  white-space: nowrap;
}

.prep-editor-toolbar select {
  width: auto;
  min-width: 92px;
  padding: 0 8px;
}

.prep-editor-toolbar button:hover,
.prep-editor-toolbar select:focus,
.prep-editor-color:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(47, 111, 159, 0.12);
}

.prep-source-mode [data-prep-editor-action="source"] {
  color: #fff;
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.prep-editor-color {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 0 7px;
  color: var(--muted);
}

.prep-editor-color input {
  width: 26px;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
}

.prep-html-canvas {
  min-height: 320px;
  max-height: min(62vh, 720px);
  overflow: auto;
  padding: 14px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.65;
  outline: none;
  overflow-wrap: anywhere;
  -webkit-overflow-scrolling: touch;
}

.prep-html-canvas:empty::before {
  content: "輸入或貼上備課內容，也可以拖曳圖片到這裡。";
  color: var(--muted);
  font-weight: 750;
}

.prep-html-editor.drag-over {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 2px rgba(47, 111, 159, 0.18);
}

.prep-html-editor.drag-over::after {
  content: "放開以插入圖片";
  position: absolute;
  inset: 54px 10px 10px;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(47, 111, 159, 0.55);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--blue-dark);
  font-size: 14px;
  font-weight: 900;
  pointer-events: none;
}

.prep-html-canvas h1,
.prep-html-canvas h2,
.prep-html-canvas h3,
.prep-html-canvas h4,
.prep-html-canvas h5 {
  margin: 0.45em 0 0.25em;
  line-height: 1.25;
}

.prep-html-canvas p,
.prep-html-canvas ul,
.prep-html-canvas ol,
.prep-html-canvas blockquote,
.prep-html-canvas pre {
  margin: 0 0 0.65em;
}

:is(.prep-html-canvas, .prep-note-content) :is(ol, ul) {
  padding-inline-start: 1.8em;
  list-style-position: outside;
}

:is(.prep-html-canvas, .prep-note-content) :is(ol, ul) :is(ol, ul) {
  margin-block: 0.15em;
}

:is(.prep-html-canvas, .prep-note-content) li {
  white-space: normal;
  overflow-wrap: anywhere;
}

.prep-html-canvas img {
  max-width: 100%;
  height: auto;
}

.prep-html-canvas img.html-editor-selected-image,
.prep-html-canvas iframe.html-editor-selected-image {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.html-editor-image-resize-handle {
  position: absolute;
  z-index: 8;
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 6px;
  background: var(--blue);
  box-shadow: 0 4px 12px rgba(38, 69, 91, 0.24);
  cursor: nwse-resize;
  transform: translate(-50%, -50%);
  touch-action: none;
}

.html-editor-image-resize-handle::before {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
}

.prep-html-canvas iframe {
  width: 100%;
  max-width: 720px;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
  border-radius: 8px;
}

.prep-html-canvas table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.prep-html-canvas th,
.prep-html-canvas td {
  min-width: 56px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.prep-asset-panel.drag-over {
  border-color: var(--blue);
  background: #eef8ff;
  box-shadow: inset 0 0 0 2px rgba(47, 111, 159, 0.18);
}

.prep-asset-panel.drag-over::after {
  content: "放開以上傳檔案";
  position: absolute;
  inset: 8px;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(47, 111, 159, 0.55);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--blue-dark);
  font-size: 14px;
  font-weight: 900;
  pointer-events: none;
}

.prep-asset-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.prep-asset-header div {
  display: grid;
  gap: 2px;
}

.prep-asset-header strong {
  color: var(--ink);
  font-size: 14px;
}

.prep-asset-header span,
.prep-asset-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.prep-upload-button {
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.prep-upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.prep-asset-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.prep-attachment-list {
  display: grid;
  gap: 10px;
}

.prep-asset-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.prep-attachment-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.prep-attachment-icon {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #eef3f7;
  object-fit: contain;
}

.prep-asset-card img {
  width: 92px;
  height: 92px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: contain;
  background: #f5f8fb;
}

.prep-asset-meta {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.prep-asset-meta strong,
.prep-asset-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prep-asset-meta strong {
  color: var(--ink);
  font-size: 13px;
}

.prep-asset-meta span,
.prep-asset-meta label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.prep-asset-meta label {
  display: grid;
  gap: 3px;
}

.prep-asset-meta input {
  width: 100%;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-size: 11px;
}

.prep-note-content {
  display: grid;
  gap: 8px;
  min-width: 0;
  width: min(100%, 920px);
  max-width: 100%;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.65;
  overflow-x: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  word-break: break-word;
}

.prep-html-canvas span[style*="font-size"],
.prep-note-content span[style*="font-size"] {
  line-height: inherit;
}

.prep-topic-card .item-actions,
.prep-note-card .item-actions {
  flex-wrap: wrap;
  min-width: 0;
}

.prep-topic-card .item-actions button,
.prep-note-card .item-actions button {
  flex: 0 1 auto;
  white-space: nowrap;
}

.prep-note-content p,
.prep-note-content ul,
.prep-note-content ol,
.prep-note-content blockquote,
.prep-note-content pre {
  margin: 0;
}

.prep-note-content a {
  color: var(--blue-dark);
  font-weight: 850;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prep-note-content img {
  max-width: 100%;
  height: auto;
}

.prep-note-content iframe {
  width: 100%;
  max-width: 720px;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
  border-radius: 8px;
}

.prep-note-content table {
  display: table;
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  white-space: normal;
}

.prep-note-content th,
.prep-note-content td {
  padding: 6px 8px;
  border: 1px solid var(--line);
  height: auto;
  line-height: 1.55;
  vertical-align: top;
  overflow-wrap: anywhere;
  overflow: visible;
  white-space: normal;
  word-break: break-word;
}

.prep-note-content th {
  background: #eef3f7;
  color: var(--muted);
  font-weight: 900;
}

.prep-note-content blockquote {
  padding: 8px 10px;
  border-left: 4px solid #9fc6df;
  background: #f7fbfd;
}

.prep-note-content code,
.prep-note-content pre {
  padding: 2px 5px;
  border-radius: 5px;
  background: #eef3f7;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.prep-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.prep-pager span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

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

.stats-band {
  display: grid;
  gap: 14px;
}

.grades-band {
  display: grid;
  gap: 16px;
}

.stats-filter-field {
  min-width: 240px;
}

.stats-overview {
  display: grid;
  grid-template-columns: repeat(9, minmax(112px, 1fr));
  gap: 8px;
}

.stats-card {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.stats-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stats-card strong {
  font-size: 18px;
}

.stats-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  font-size: 13px;
}

.stats-table th,
.stats-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.stats-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.stats-table td.stats-value-danger {
  color: #dc2626;
  font-weight: 900;
}

.stats-table td.stats-value-good {
  color: #16a34a;
  font-weight: 900;
}

.stats-table td:nth-child(2),
.stats-table td:nth-child(n + 4):nth-child(-n + 14) {
  white-space: nowrap;
}

.stats-student-row {
  cursor: pointer;
}

.stats-student-row:hover {
  background: #f8fafc;
}

.stats-detail-row td {
  padding: 0 8px 12px;
  background: #f8fafc;
}

.stats-detail-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dbe4ed;
  border-radius: 8px;
  background: #fff;
}

.stats-detail-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stats-detail-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stats-record-list {
  display: grid;
  gap: 8px;
}

.stats-record-item {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.stats-record-main {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.stats-record-meta {
  min-width: 0;
}

.stats-record-meta strong,
.stats-record-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-record-meta span,
.stats-record-item p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.stats-record-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.stats-detail-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 2px;
}

.stats-detail-pager span {
  min-width: 88px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.stats-detail-pager button {
  min-height: 32px;
  padding: 0 10px;
}

.stats-detail-pager button:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.grade-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13px;
}

.grade-table th,
.grade-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.grade-table th {
  background: #eef3f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.grade-table input {
  width: 100%;
  min-width: 82px;
}

.grade-table .homework-label-input {
  min-width: 96px;
  min-height: 28px;
  padding: 4px 6px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.grade-table .homework-label-input:focus {
  border-color: #9fb3c8;
  background: #fff;
}

.daily-total-cell,
.final-total-cell {
  color: var(--blue-dark);
  font-weight: 900;
  white-space: nowrap;
}

.daily-total-cell.grade-total-low,
.final-total-cell.grade-total-low {
  color: #dc2626;
}

.weight-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.grade-tools-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.grade-tools-row strong {
  min-width: 24px;
  color: var(--ink);
  text-align: center;
}

.compact-button {
  min-height: 30px;
  padding: 5px 10px;
}

.weight-row label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.sortable-grade-heading {
  white-space: nowrap;
}

.sort-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  width: 18px;
  height: 22px;
  margin-left: 4px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #9aa9b8;
  cursor: pointer;
  font-size: 9px;
  line-height: 0.9;
  vertical-align: middle;
}

.sort-toggle:hover {
  background: #dfe8f1;
  color: var(--ink);
}

.sort-toggle.sort-asc [data-arrow="up"],
.sort-toggle.sort-desc [data-arrow="down"] {
  color: var(--blue-dark);
}

.weight-row input {
  width: 58px;
  min-height: 28px;
  padding: 4px 6px;
}

.inline-import-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-import-form input[type="file"] {
  max-width: 260px;
}

.paste-grade-box {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.paste-grade-box label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.paste-grade-box .paste-target-field {
  max-width: 320px;
}

.paste-grade-box select {
  min-height: 34px;
}

.paste-grade-box textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.paste-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef3f7;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.status-danger {
  background: #fff1f2;
  color: #b4232f;
}

.status-good {
  background: #ecfdf3;
  color: #117a3d;
}

.status-neutral {
  background: #eef3f7;
  color: var(--muted);
}

.compact-empty {
  padding: 10px;
}

.item-title {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-weight: 800;
}

.item-subtitle {
  color: var(--muted);
  font-size: 12px;
}

.student-form {
  display: grid;
  grid-template-columns: 72px 90px minmax(0, 1fr) 64px;
  gap: 8px;
  margin-bottom: 14px;
}

.student-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px;
  padding: 9px 10px;
  align-items: center;
}

.management-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}

.admin-table th,
.admin-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.admin-table td {
  min-width: 0;
}

.student-admin-table th.select-column,
.student-admin-table td.select-column {
  width: 42px;
  padding-left: 12px;
  padding-right: 6px;
  text-align: center;
}

.student-admin-table th:nth-child(2) {
  width: 64px;
}

.student-admin-table th:nth-child(4) {
  width: 110px;
}

.student-admin-table th:nth-child(6) {
  width: 104px;
}

.student-admin-table td:nth-child(5) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-admin-table input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

.student-admin-table tr.selected td {
  background: #fff7ed;
}

.student-admin-table .student-select-cell {
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.student-admin-table .student-select-cell:hover {
  background: #f8fafc;
}

.student-admin-table tr.selected .student-select-cell {
  background: #ffedd5;
}

.student-admin-table .student-select-cell input[type="checkbox"] {
  cursor: pointer;
}

.user-table th:first-child,
.user-table td:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-table th:nth-child(1) {
  width: 30%;
}

.user-table th:nth-child(2),
.user-table th:nth-child(3) {
  width: 72px;
}

.user-table th:nth-child(6) {
  width: 92px;
}

.admin-table th {
  color: var(--muted);
  font-size: 12px;
  background: #f8fafc;
}

.admin-table tr {
  cursor: pointer;
}

.admin-table tbody tr:hover,
.admin-table tbody tr.active {
  background: #eef7fb;
}

.table-actions {
  display: flex;
  gap: 6px;
}

.table-actions button {
  min-height: 32px;
  white-space: nowrap;
}

.management-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.management-item:hover,
.management-item.active {
  border-color: var(--blue);
  background: #eef7fb;
}

.management-item.active {
  box-shadow: inset 3px 0 0 var(--blue);
}

.item-actions {
  display: flex;
  gap: 6px;
}

.item-actions button {
  min-height: 32px;
}

.item-actions .admin-student-class-select {
  width: min(220px, 36vw);
  min-height: 32px;
  padding: 0 8px;
}

.seat-badge {
  display: inline-flex;
  min-width: 34px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #eef7fb;
  color: var(--blue-dark);
  font-weight: 800;
}

.session-item {
  padding: 10px;
  text-align: left;
}

.session-item.active {
  border-color: var(--green);
  background: #f0f7f2;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.classroom-tool-tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(130px, auto));
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.classroom-tool-tabs button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.classroom-tool-tabs button.active {
  background: var(--blue);
  color: #fff;
}

.classroom-tool-panel.hidden {
  display: none;
}

.record-panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.record-panel-actions .segmented-control {
  grid-template-columns: repeat(3, minmax(72px, auto));
}

.record-panel-actions .segmented-control button {
  min-height: 32px;
  padding: 0 10px;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.record-panel-actions .segmented-control button.active {
  background: var(--blue);
  color: #fff;
}

.record-view {
  width: 100%;
}

.draw-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.draw-panel {
  display: grid;
  gap: 14px;
}

.draw-control-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(120px, 180px);
  gap: 12px;
}

.draw-stage {
  display: grid;
  gap: 12px;
  min-height: 210px;
  padding: 18px;
  border: 1px solid #cfe0ef;
  border-radius: 8px;
  background: #f7fbfd;
}

.draw-stage h3,
.draw-pool h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}

.draw-result-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.draw-result-card {
  display: grid;
  min-height: 128px;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 16px;
  border: 1px solid #b9d4e8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 22px rgba(44, 74, 105, 0.08);
}

.draw-result-card strong {
  color: var(--blue-dark);
  font-size: 26px;
  line-height: 1.2;
}

.draw-result-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.draw-pool {
  display: grid;
  gap: 10px;
}

.draw-pool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.draw-pool-header span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.draw-pool-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.draw-student-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.draw-student-chip strong {
  display: inline-flex;
  min-width: 28px;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #eef7fb;
  color: var(--blue-dark);
}

.draw-student-chip small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.group-draw-panel {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(260px, 1.05fr);
  gap: 16px;
  align-items: stretch;
}

.dartboard-stage,
.group-draw-result,
.group-draw-exclusion {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border: 1px solid #cfe0ef;
  border-radius: 8px;
  background: #f7fbfd;
}

.group-draw-exclusion {
  grid-column: 1 / -1;
  background: #fff;
}

.draw-exclusion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.draw-exclusion-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.draw-exclusion-toggle input,
.draw-exclusion-chip input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.draw-exclusion-summary {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.draw-exclusion-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.draw-exclusion-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.draw-exclusion-chip small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.draw-exclusion-chip.excluded,
.group-draw-legend-item.excluded {
  border-color: #f3b6b6;
  background: #fff4f4;
  color: #a12f2f;
}

.group-draw-legend-item.excluded {
  opacity: 0.72;
}

.dartboard {
  position: relative;
  width: min(100%, 360px);
  aspect-ratio: 1;
  justify-self: center;
  border: 10px solid #203244;
  border-radius: 50%;
  background: conic-gradient(#4f8fcf 0 25%, #22a06b 25% 50%, #f59e0b 50% 75%, #ef6f6c 75% 100%);
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.78), 0 18px 30px rgba(32, 50, 68, 0.15);
}

.dartboard::before,
.dartboard::after {
  position: absolute;
  inset: 12%;
  content: "";
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  pointer-events: none;
}

.dartboard::after {
  inset: 31%;
}

.dartboard-inner {
  position: absolute;
  inset: 38%;
  display: grid;
  place-items: center;
  border: 6px solid #203244;
  border-radius: 50%;
  background: #fff;
  color: var(--blue-dark);
  font-size: 18px;
  font-weight: 950;
  box-shadow: 0 8px 18px rgba(32, 50, 68, 0.16);
}

.dart-pointer {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46%;
  height: 4px;
  border-radius: 999px;
  background: #111827;
  transform: rotate(var(--dart-angle, 20deg));
  transform-origin: 0 50%;
  transition: transform 2.6s cubic-bezier(0.16, 0.84, 0.18, 1);
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.25);
}

.dart-pointer::after {
  position: absolute;
  right: -11px;
  top: 50%;
  width: 0;
  height: 0;
  content: "";
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 16px solid #111827;
  transform: translateY(-50%);
}

.group-draw-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.group-draw-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.group-draw-legend-item i {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.group-draw-legend-item small {
  color: var(--muted);
  font-size: 11px;
}

.group-draw-result h3 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
}

.group-draw-result-card {
  display: grid;
  min-height: 240px;
}

.group-draw-winner {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--winner-color) 55%, #fff);
  border-left: 8px solid var(--winner-color);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(44, 74, 105, 0.08);
}

.group-draw-winner > strong {
  color: var(--blue-dark);
  font-size: 32px;
  line-height: 1.2;
}

.group-draw-members {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.record-table-wrap {
  max-height: min(62vh, 640px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.record-table {
  width: 100%;
  min-width: 1260px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.record-table th,
.record-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.record-table td.record-cell-danger {
  background: #fff1f2;
  box-shadow: inset 3px 0 0 #f87171;
}

.record-table td.record-cell-good {
  background: #ecfdf3;
  box-shadow: inset 3px 0 0 #4ade80;
}

.record-table td.record-cell-danger select,
.record-table td.record-cell-danger .stepper input {
  border-color: #fca5a5;
  background: #fff7f7;
}

.record-table td.record-cell-good select,
.record-table td.record-cell-good .stepper input {
  border-color: #86efac;
  background: #f7fff9;
}

.record-control-field.record-cell-danger select,
.record-control-field.record-cell-danger .stepper input {
  border-color: #fca5a5;
  background: #fff7f7;
}

.record-control-field.record-cell-good select,
.record-control-field.record-cell-good .stepper input {
  border-color: #86efac;
  background: #f7fff9;
}

.record-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  background: #f8fafc;
}

.record-table th:nth-child(1),
.record-table td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
}

.record-table th:nth-child(2),
.record-table td:nth-child(2) {
  position: sticky;
  left: 86px;
  z-index: 3;
  background: #fff;
}

.record-table th:nth-child(3),
.record-table td:nth-child(3) {
  position: sticky;
  left: 144px;
  z-index: 3;
  background: #fff;
  box-shadow: 1px 0 0 var(--line);
}

.record-table th:nth-child(1),
.record-table th:nth-child(2),
.record-table th:nth-child(3) {
  z-index: 5;
  background: #f8fafc;
}

.record-table tbody td:nth-child(1),
.record-table tbody td:nth-child(2),
.record-table tbody td:nth-child(3) {
  font-weight: 800;
}

.record-table th:nth-child(1) {
  width: 86px;
}

.record-table th:nth-child(2) {
  width: 58px;
}

.record-table th:nth-child(3) {
  width: 120px;
}

.record-table th:nth-child(4),
.record-table th:nth-child(5) {
  width: 118px;
}

.record-table th:nth-child(6),
.record-table th:nth-child(7) {
  width: 94px;
}

.record-table th:nth-child(8) {
  width: 118px;
}

.record-table th:nth-child(10) {
  width: 64px;
}

.record-layout-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.record-layout-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.layout-toolbar-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.layout-lock-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.layout-lock-toggle input {
  width: auto;
  min-height: 0;
  margin: 0;
}

.layout-lock-hint {
  margin: -2px 0 10px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 850;
}

.layout-locked .record-card[draggable="true"] {
  cursor: default;
}

.compact-number-field {
  width: 64px;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.compact-number-field input {
  min-height: 32px;
  padding: 0 8px;
}

.layout-workspace {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(220px, 3fr);
  gap: 12px;
  align-items: start;
}

.layout-workspace.pending-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.layout-main-board {
  min-width: 0;
}

.layout-pending-zone {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px dashed #b8c7d6;
  border-radius: 8px;
  background: #f8fafc;
}

.layout-pending-zone.drag-over,
.layout-slot.drag-over {
  border-color: var(--blue);
  background: #eef7fb;
}

.layout-pending-zone header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.layout-pending-zone header strong {
  color: var(--blue-dark);
  font-size: 14px;
}

.layout-pending-zone header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.layout-pending-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  max-height: min(62vh, 640px);
  overflow: auto;
}

.seating-board {
  display: grid;
  grid-template-columns: repeat(var(--seat-columns, 6), minmax(150px, 1fr));
  gap: 10px;
  max-height: min(62vh, 640px);
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.lab-group-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  direction: rtl;
  gap: 12px;
  align-items: start;
  grid-auto-flow: dense;
  grid-auto-rows: 8px;
  overflow: visible;
  min-width: 0;
}

#recordLabView .layout-pending-list {
  max-height: min(58vh, 560px);
  overflow: auto;
}

#recordLabView .layout-pending-zone {
  position: sticky;
  top: max(92px, calc(50vh - 280px));
  align-self: start;
  max-height: min(72vh, 680px);
  box-shadow: 0 12px 30px rgba(44, 74, 105, 0.12);
  z-index: 7;
}

.lab-group {
  display: grid;
  direction: ltr;
  align-self: start;
  height: max-content;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.lab-group.dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.lab-group.drag-over {
  outline: 2px dashed var(--blue);
  outline-offset: 4px;
  background: #f7fbff;
}

.lab-group-pointer-dragging .lab-group.dragging {
  pointer-events: none;
}

.lab-group-toggle {
  display: flex;
  width: 100%;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px;
  border: 1px solid #dbe7f1;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--blue-dark);
  font-size: 14px;
  font-weight: 900;
  text-align: left;
}

.lab-group-drag-handle {
  display: inline-grid;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid #cfe0ef;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.lab-group-drag-handle:active {
  cursor: grabbing;
}

.lab-group-toggle small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.lab-group-members {
  display: grid;
  gap: 8px;
}

.lab-group-board {
  grid-template-columns: repeat(4, minmax(168px, 1fr));
}

.lab-group.collapsed {
  gap: 6px;
  padding: 8px;
}

.lab-group.collapsed .lab-group-members {
  gap: 5px;
}

.lab-group.collapsed .layout-slot {
  min-height: 44px;
  padding: 3px;
}

.lab-group.collapsed .layout-slot-empty {
  min-height: 36px;
  font-size: 11px;
}

.layout-slot {
  position: relative;
  min-height: 176px;
  padding: 8px;
  border: 1px dashed #c8d5e2;
  border-radius: 8px;
  background: #f8fafc;
}

.layout-slot.filled {
  padding: 4px;
  border-style: solid;
  background: #fff;
}

.layout-slot.filled .layout-slot-label {
  display: none;
}

.layout-slot-label {
  position: absolute;
  top: 6px;
  right: 8px;
  color: #9aa9b8;
  font-size: 10px;
  font-weight: 850;
}

.layout-slot-empty {
  display: grid;
  height: 100%;
  min-height: 150px;
  place-items: center;
  color: #9aa9b8;
  font-size: 12px;
  font-weight: 850;
}

.record-card {
  display: grid;
  gap: 8px;
  height: 100%;
  min-width: 0;
  padding: 8px;
  border: 1px solid #dbe4ed;
  border-radius: 8px;
  background: #fbfcfe;
}

.record-card-absent {
  border-color: #f7b4b4;
  background: #fff1f2;
}

.record-card-compact {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 38px;
  padding: 5px 6px;
}

.record-card-compact .record-card-main {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
}

.record-card-compact .record-card-main strong {
  font-size: 20pt;
}

.record-card-toggle {
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid #cfe0ef;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 850;
}

.record-card-toggle.collapse-toggle {
  justify-self: end;
}

.record-card[draggable="true"] {
  cursor: grab;
}

.record-card.dragging {
  opacity: 0.48;
  cursor: grabbing;
}

.layout-pointer-dragging .record-card.dragging {
  pointer-events: none;
}

.layout-drag-preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: 176px;
  max-width: 46vw;
  height: auto;
  min-height: 0;
  max-height: 42px;
  padding: 6px 7px;
  overflow: hidden;
  border: 1px solid #cfe0ef;
  border-radius: 8px;
  background: #fbfcfe;
  pointer-events: none;
  opacity: 0.94;
  transform: translate(-9999px, -9999px);
  box-shadow: 0 18px 38px rgba(32, 50, 68, 0.24);
}

.layout-drag-preview-absent {
  border-color: #f7b4b4;
  background: #fff1f2;
}

.layout-drag-preview-main {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  line-height: 1;
}

.layout-drag-preview-main strong {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layout-drag-preview-seat {
  display: inline-grid;
  min-width: 25px;
  height: 20px;
  padding: 0 5px;
  place-items: center;
  border-radius: 999px;
  background: #e9f2fb;
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 900;
}

.layout-drag-preview-meta {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lab-group-drag-preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  width: auto;
  min-width: 104px;
  max-width: 42vw;
  min-height: 0;
  padding: 7px 10px;
  border: 1px solid #cfe0ef;
  border-radius: 8px;
  background: #fff;
  color: var(--blue-dark);
  pointer-events: none;
  opacity: 0.95;
  transform: translate(-9999px, -9999px);
  box-shadow: 0 18px 38px rgba(32, 50, 68, 0.24);
}

.lab-group-drag-preview strong {
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.lab-group-drag-preview span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.record-card-editor {
  display: grid;
  gap: 8px;
}

.record-card-editor summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.record-card-editor summary::-webkit-details-marker {
  display: none;
}

.record-card-main {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  touch-action: none;
  user-select: none;
}

.record-card-drag-handle {
  color: #9aa9b8;
  cursor: grab;
  font-size: 12px;
  font-weight: 900;
  touch-action: none;
}

.record-card-main strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 20pt;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-card-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.2;
  white-space: normal;
}

.record-card-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 2px 5px;
  border-radius: 5px;
  background: #eef3f7;
  color: #64748b;
}

.record-card-chip span {
  color: #8a96a3;
  font-weight: 850;
}

.record-card-chip strong {
  color: inherit;
  font-size: inherit;
  font-weight: 900;
  line-height: inherit;
}

.record-card-chip-good {
  background: #ecfdf3;
  color: #15803d;
}

.record-card-chip-danger {
  background: #fff5f5;
  color: #dc2626;
}

.record-card-chip-good span {
  color: #15803d;
}

.record-card-chip-danger span {
  color: #dc2626;
}

.record-card-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.record-card .record-control-field {
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.record-card .record-control-field select,
.record-card .record-control-field input {
  min-height: 32px;
  padding: 0 8px;
}

.record-card .stepper {
  grid-template-columns: 26px 32px 26px;
}

.record-card .stepper button {
  min-height: 32px;
}

.record-card .stepper input {
  width: 32px;
  min-height: 32px;
  padding: 0 2px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checkbox-field input {
  width: auto;
  min-height: 0;
}

@media (max-width: 760px) {
  .layout-workspace {
    grid-template-columns: 1fr;
  }

  .prep-workspace {
    grid-template-columns: 1fr;
  }

  .lab-group-board {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 520px) {
  .lab-group-board {
    grid-template-columns: 1fr;
  }
}

.stepper {
  display: grid;
  grid-template-columns: 28px 34px 28px;
  gap: 4px;
  align-items: center;
  justify-content: center;
}

.stepper button {
  min-height: 28px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--blue-dark);
  font-weight: 900;
}

.stepper input {
  display: inline-flex;
  width: 34px;
  min-width: 0;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  text-align: center;
}

.class-cell,
.seat-cell,
.name-cell {
  font-weight: 800;
}

.follow-cell {
  text-align: center;
}

.follow-cell input {
  width: 20px;
  min-height: 20px;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  margin: 16px 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.google-login-button {
  width: 100%;
}

.student-page {
  background: #eef3f7;
}

.student-shell {
  display: grid;
  gap: 18px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px;
}

.student-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.student-header .brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.student-header h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.student-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.student-hero {
  display: grid;
  gap: 6px;
  padding: 18px 0 4px;
}

.student-hero h2 {
  margin: 0;
  font-size: 28px;
}

.student-hero p {
  margin: 0;
  color: var(--muted);
}

.student-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 16px;
}

.student-record-list,
.student-grade-list {
  display: grid;
  gap: 10px;
}

.student-record-item,
.student-grade-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.student-record-item strong,
.student-grade-item strong {
  color: var(--ink);
}

.student-record-item span,
.student-grade-item span {
  color: var(--muted);
  font-size: 13px;
}

.student-record-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.student-record-tags span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef3f7;
  color: var(--blue-dark);
  font-weight: 800;
}

.student-grade-item {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.student-grade-item span small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.5;
}

.student-grade-total {
  border-color: #9fc6df;
  background: #f7fbfd;
}

.student-grade-total span,
.student-grade-total strong {
  color: var(--blue-dark);
  font-weight: 950;
}

.student-grade-total strong {
  font-size: 24px;
}

.student-record-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-top: 4px;
}

.student-record-pager span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

@media (max-width: 1100px) {
  .app-shell,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .sidebar {
    display: grid;
    height: auto;
    max-height: min(42vh, 430px);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    border-right: 0;
    border-bottom: 1px solid #ddd7ca;
  }

  .textarea-grid,
  .field-row,
  .topic-board-row,
  .draw-control-grid,
  .group-draw-panel {
    grid-template-columns: 1fr;
  }

  .prep-topic-board {
    grid-template-columns: repeat(var(--prep-topic-columns, 3), minmax(240px, 310px));
  }
}

@media (max-width: 860px) {
  .prep-topic-board {
    grid-template-columns: repeat(var(--prep-topic-columns, 3), minmax(220px, 290px));
  }
}

@media (max-width: 680px) {
  .sidebar {
    max-height: min(88vw, 430px);
    gap: 10px;
    padding: 12px;
  }

  body[data-theme="sakura"] .sidebar {
    background-size: 100% auto;
  }

  body[data-theme="fuji"] .sidebar {
    background-size: 100% auto;
  }

  body[data-theme="redfinch"] .sidebar {
    background-size: 100% auto;
  }

  body[data-theme="chrysanthemum"] .sidebar {
    background-size: 100% auto;
  }

  body[data-theme="fox"] .sidebar {
    background-size: 100% auto;
  }

  body[data-theme="phoenix"] .sidebar {
    background-size: 100% auto;
  }

  body[data-theme="dunhuang"] .sidebar {
    background-size: 100% auto;
  }

  .brand-block {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 8px;
  }

  .brand-logo {
    width: 42px;
    height: 42px;
  }

  .brand-block h1 {
    font-size: 18px;
  }

  .brand-version {
    font-size: 7px;
  }

  .feature-menu {
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
    scrollbar-width: thin;
  }

  .menu-button {
    min-height: 38px;
    padding: 0 10px;
    font-size: 14px;
  }

  .submenu {
    gap: 4px;
    padding-left: 10px;
  }

  .submenu-button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
  }

  .prep-editor-toolbar {
    gap: 5px;
    padding: 6px;
  }

  .prep-editor-toolbar button,
  .prep-editor-toolbar select,
  .prep-editor-color {
    min-height: 30px;
    font-size: 11px;
  }

  .prep-editor-toolbar button {
    padding: 0 7px;
  }

  .prep-editor-toolbar select {
    flex: 1 1 104px;
    min-width: 0;
  }

  .prep-html-canvas {
    min-height: 260px;
    max-height: 54vh;
    padding: 10px;
  }

  .sidebar-collapse-button,
  .logout-button {
    min-height: 34px;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-qr {
    width: 160px;
    height: 160px;
  }

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

  .content-grid,
  .calendar-band,
  .entry-band,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .calendar-band {
    overflow-x: auto;
  }

  .classroom-tool-tabs {
    display: grid;
    grid-template-columns: 1fr;
  }

  .draw-result-list {
    grid-template-columns: 1fr;
  }

  .calendar-weekdays,
  .calendar-grid {
    min-width: 760px;
  }

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

  .stats-record-main {
    grid-template-columns: 1fr;
  }

  .stats-record-tags {
    justify-content: flex-start;
  }

  .student-shell {
    padding: 16px;
  }

  .student-header,
  .student-grid {
    grid-template-columns: 1fr;
  }

  .student-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .student-form {
    grid-template-columns: 1fr;
  }

  .topbar-actions,
  .form-actions,
  .import-form {
    align-items: stretch;
    flex-direction: column;
  }

  .import-form {
    grid-template-columns: 1fr;
  }

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

  .three-col {
    grid-template-columns: 1fr;
  }

  .user-form-grid {
    grid-template-columns: 1fr;
  }

  .management-item {
    grid-template-columns: 1fr;
  }

  .item-actions {
    justify-content: flex-start;
  }
}
