:root {
  --bg: #f3f7ff;
  --bg-strong: #eaf0ff;
  --panel: rgba(255,255,255,0.8);
  --panel-solid: #ffffff;
  --panel-strong: #eef4ff;
  --border: rgba(26,54,91,0.12);
  --text: #1d2433;
  --muted: #5d6d88;
  --primary: #4a6cf7;
  --primary-strong: #3654d3;
  --accent: #dff6ef;
  --success: #1a9d75;
  --warning: #f1b95d;
  --danger: #ef6a6a;
  --shadow: 0 18px 40px rgba(33, 59, 109, 0.08);
}

:root[data-theme="dark"] {
  --bg: #101827;
  --bg-strong: #111f34;
  --panel: rgba(18,28,46,0.82);
  --panel-solid: #182335;
  --panel-strong: #1f2d42;
  --border: rgba(138,160,194,0.18);
  --text: #ecf2ff;
  --muted: #9fb1cf;
  --primary: #90a8ff;
  --primary-strong: #738bff;
  --accent: #1f3648;
  --success: #4dd4ac;
  --warning: #f6c16d;
  --danger: #ff8787;
  --shadow: 0 18px 40px rgba(9, 14, 24, 0.5);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  margin: 0;
  min-height: 100%;
  font-family: "Inter", "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-strong) 100%);
  color: var(--text);
}

body { min-height: 100vh; min-height: 100svh; overflow-x: hidden; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

#app { min-height: 100vh; min-height: 100svh; }

.workspace-loading {
  position: relative;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  padding: 32px 20px 58px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 18% 8%, rgba(119, 151, 255, 0.18), transparent 34%),
    radial-gradient(ellipse at 88% 92%, rgba(91, 194, 165, 0.15), transparent 32%),
    linear-gradient(145deg, var(--bg) 0%, var(--bg-strong) 100%);
}
.loading-decoration { position: absolute; border: 1px solid rgba(92, 123, 219, 0.12); border-radius: 50%; pointer-events: none; }
.loading-decoration-one { width: min(66vw, 680px); aspect-ratio: 1; top: -34%; right: -14%; }
.loading-decoration-two { width: min(48vw, 500px); aspect-ratio: 1; bottom: -34%; left: -12%; }
.workspace-loading-card {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  padding: 26px 52px 30px;
  border: 1px solid rgba(255,255,255,0.82);
  border-radius: 30px;
  background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
  box-shadow: 0 32px 90px rgba(48, 69, 125, 0.13), 0 4px 18px rgba(48, 69, 125, 0.05);
  text-align: center;
  backdrop-filter: blur(18px);
}
.loading-brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-weight: 800; letter-spacing: 0.12em; }
.loading-brand .brand-mark { width: 32px; height: 32px; border-radius: 11px; font-size: 1.05rem; }
.loading-visual { position: relative; width: 146px; height: 126px; margin: 18px auto 6px; }
.loading-orbit { position: absolute; top: 50%; left: 50%; border: 1px solid rgba(74,108,247,0.17); border-radius: 50%; transform: translate(-50%, -50%); }
.loading-orbit-one { width: 130px; height: 90px; transform: translate(-50%, -50%) rotate(-24deg); }
.loading-orbit-two { width: 104px; height: 112px; transform: translate(-50%, -50%) rotate(28deg); }
.loading-book { position: absolute; top: 50%; left: 50%; display: flex; width: 62px; height: 54px; flex-direction: column; justify-content: center; gap: 6px; padding: 0 12px; border: 1px solid rgba(74,108,247,0.12); border-radius: 14px 14px 16px 16px; background: linear-gradient(145deg, #fff, #edf2ff); box-shadow: 0 14px 28px rgba(68, 96, 188, 0.18); transform: translate(-50%, -50%) rotate(-7deg); }
.loading-book::before { position: absolute; top: 8px; bottom: 8px; left: 50%; width: 1px; background: rgba(74,108,247,0.16); content: ""; }
.loading-book i { display: block; width: 28px; height: 2px; border-radius: 2px; background: #c9d5fa; }
.loading-book i:nth-child(2) { width: 20px; }
.loading-book i:nth-child(3) { width: 24px; }
.loading-spark { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #8ca3ff; box-shadow: 0 0 0 5px rgba(140,163,255,0.12); animation: loading-float 2.8s ease-in-out infinite; }
.loading-spark-one { top: 18px; right: 24px; }
.loading-spark-two { bottom: 20px; left: 16px; width: 6px; height: 6px; background: #67bca2; box-shadow: 0 0 0 5px rgba(103,188,162,0.13); animation-delay: -1s; }
.loading-spark-three { top: 30px; left: 18px; width: 4px; height: 4px; background: #f0bc63; box-shadow: 0 0 0 4px rgba(240,188,99,0.14); animation-delay: -1.7s; }
.loading-kicker { display: block; margin-top: 6px; color: var(--primary-strong); font-size: 0.65rem; font-weight: 800; letter-spacing: 0.18em; }
.workspace-loading-card h1 { margin: 9px 0 10px; font-size: clamp(1.55rem, 5vw, 2rem); line-height: 1.45; letter-spacing: 0.015em; }
.loading-mobile-break { display: none; }
.loading-description { max-width: 360px; margin: 0 auto; color: var(--muted); font-size: 0.92rem; line-height: 1.8; }
.loading-progress { height: 5px; margin: 24px 0 12px; overflow: hidden; border-radius: 99px; background: var(--panel-strong); }
.loading-progress span { display: block; width: 36%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #7893ff, #4a6cf7, #62b9a2); animation: loading-progress 1.8s ease-in-out infinite; }
.loading-status { min-height: 1.5em; margin: 0; color: var(--text); font-size: 0.85rem; font-weight: 700; }
.loading-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 20px 0 19px; padding: 0; list-style: none; }
.loading-steps li { display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); font-size: 0.76rem; white-space: nowrap; }
.loading-step-indicator { display: inline-grid; width: 21px; height: 21px; flex: none; place-items: center; border: 1px solid var(--border); border-radius: 50%; font-size: 0.68rem; font-weight: 700; }
.loading-steps li.is-active { color: var(--primary-strong); font-weight: 700; }
.loading-steps li.is-active .loading-step-indicator { border-color: var(--primary); background: rgba(74,108,247,0.1); }
.loading-steps li.is-done { color: var(--success); }
.loading-steps li.is-done .loading-step-indicator { border-color: rgba(26,157,117,0.25); background: rgba(26,157,117,0.1); }
.loading-footnote { display: flex; align-items: center; justify-content: center; gap: 8px; padding-top: 15px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.74rem; }
.loading-footnote-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(26,157,117,0.1); }
.loading-page-brand { position: absolute; bottom: 20px; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.04em; }
.loading-page-brand span { margin: 0 5px; color: var(--primary); }
@keyframes loading-progress { 0% { transform: translateX(-110%); } 50% { transform: translateX(90%); } 100% { transform: translateX(280%); } }
@keyframes loading-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

.auth-page {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  background: var(--bg);
}

.auth-brand, .auth-main {
  padding: 32px;
  min-width: 0;
}

.auth-brand {
  background: linear-gradient(180deg, #dfe8ff 0%, rgba(255,255,255,0.42) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--border);
}

.brand, .mobile-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: lowercase;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.auth-hero {
  padding: 32px 0;
}

.eyebrow {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--primary-strong);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.auth-hero h1, .page-heading h1, .welcome-row h1 {
  margin: 0 0 12px;
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  line-height: 1.06;
  letter-spacing: -0.06em;
}

.auth-hero p, .welcome-row p, .page-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.hero-illustration {
  position: relative;
  margin-top: 2rem;
  width: min(100%, 480px);
  height: 280px;
}

.hero-window {
  position: absolute;
  inset: 24px 36px 0 0;
  border-radius: 28px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(69,81,124,0.12);
  padding: 18px;
  box-shadow: var(--shadow);
}

.hero-board {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  height: 120px;
}

.hero-board span {
  display: block;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(110,130,255,0.15), rgba(110,130,255,0.04));
}

.hero-desk {
  position: absolute;
  left: 26px;
  right: 20px;
  bottom: 30px;
  height: 68px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(71,104,254,0.08), rgba(71,104,254,0.14));
}

.hero-person {
  position: absolute;
  left: 120px;
  bottom: 18px;
  width: 108px;
  height: 130px;
  border-radius: 18px 18px 20px 20px;
  background: linear-gradient(180deg, #e2ebff, #bfd2ff);
  box-shadow: inset 0 0 0 1px rgba(109,130,210,0.12);
}

.hero-dot {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #9ac7ff;
  opacity: 0.7;
}

.dot-one { top: 48px; right: 18px; }
.dot-two { top: 120px; left: 20px; background: #8fd3c5; }
.dot-three { bottom: 18px; right: 90px; background: #f4c98b; }

.auth-footer {
  color: var(--muted);
  font-size: 12px;
}

.auth-main {
  display: grid;
  place-items: center;
  align-content: center;
}

.auth-form-wrap {
  width: min(100%, 460px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-switch {
  display: inline-flex;
  gap: 4px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  padding: 6px;
  border-radius: 999px;
}

.auth-tab {
  border: none;
  background: transparent;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  color: var(--muted);
}

.auth-tab.active {
  background: white;
  color: var(--text);
  box-shadow: 0 8px 18px rgba(28,43,87,0.08);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.auth-form h2 { margin: 8px 0 0; font-size: 2rem; }
.auth-form p, .auth-form small, .muted { color: var(--muted); }

.teacher-login-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  color: var(--primary-strong);
  font-weight: 700;
  text-decoration: none;
}

.teacher-login-link:hover { text-decoration: underline; }

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
}

.auth-form input,
.auth-form textarea,
.auth-form select,
.dialog-form input,
.dialog-form textarea,
.dialog-form select,
.chat-compose input {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(99,115,143,0.24);
  background: rgba(255,255,255,0.65);
  color: var(--text);
  padding: 12px 14px;
}

.button, .text-button, .banner-link, .nav-link {
  border: none;
  transition: transform 150ms ease, opacity 150ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 700;
}

.button-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  box-shadow: 0 12px 22px rgba(74,108,247,0.24);
}

.button-secondary {
  color: var(--text);
  background: rgba(255,255,255,0.62);
  border: 1px solid var(--border);
}

.button-small { padding: 9px 12px; font-size: 0.9rem; }
.button-wide { width: 100%; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.form-error {
  min-height: 1.5rem;
  color: var(--danger);
  font-size: 0.88rem;
}

.setup-notice {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 26px;
}

.notice-symbol {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(74,108,247,0.12);
  border-radius: 12px;
  color: var(--primary-strong);
}

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

.app-shell.note-editor-active {
  display: block;
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 0;
  overflow: hidden;
}
.note-editor-active .sidebar,
.note-editor-active .topbar { display: none; }
.note-editor-active .main-area { width: 100%; min-width: 0; height: 100vh; height: 100svh; }
.note-editor-active .page-content { height: 100%; padding: 0; overflow: hidden; }
.note-editor-active #workspace { height: 100%; }
.note-editor {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: var(--bg);
}
.note-editor-toolbar {
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 76px;
  padding: 10px 22px;
  background: var(--panel-solid);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 18px rgba(37, 48, 77, 0.05);
}
.note-editor-toolbar .button-primary { margin-left: auto; }
.note-editor-title { min-width: 0; }
.note-editor-title .eyebrow { font-size: 0.68rem; }
.note-editor-title h1 { margin: 3px 0 0; overflow: hidden; font-size: 1.08rem; text-overflow: ellipsis; white-space: nowrap; }
.note-editor-status { margin-left: auto; color: var(--muted); font-size: 0.83rem; white-space: nowrap; }
.note-editor-toolbar .button-primary + .note-editor-status { margin-left: 0; }
.note-tools { z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; padding: 8px 18px; border-bottom: 1px solid var(--border); background: var(--panel-solid); }
.note-tool-group { display: flex; align-items: center; gap: 5px; }
.note-tool-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; padding: 7px 11px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); font-size: 0.83rem; font-weight: 650; white-space: nowrap; cursor: pointer; transition: background 140ms ease, color 140ms ease, border-color 140ms ease; }
.note-tool-button:hover, .note-tool-button.is-active { border-color: var(--border); background: var(--panel-strong); color: var(--primary-strong); }
.note-tool-actions { padding-left: 12px; border-left: 1px solid var(--border); }
.note-board-wrap { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.board {
  position: relative;
  width: max(100%, 1200px);
  min-width: 100%;
  min-height: max(100%, 800px);
  overflow: hidden;
  background-color: var(--bg);
  background-image: radial-gradient(rgba(99, 115, 143, 0.28) 1px, transparent 1px);
  background-size: 24px 24px;
}
.board-loading { padding: 32px; color: var(--muted); }
.note-connections { position: absolute; inset: 0 auto auto 0; z-index: 0; overflow: visible; pointer-events: none; }
.note-connections marker path { fill: #8192bd; }
.note-edge path { fill: none; stroke: #9aa8ca; stroke-width: 3; }
.note-edge circle { fill: #f7f8fc; stroke: #9aa8ca; stroke-width: 2; cursor: pointer; pointer-events: all; }
.note-edge circle:hover { fill: #ffe8e9; stroke: #cf5962; }
.note-card {
  position: absolute;
  z-index: 1;
  width: 280px;
  min-height: 150px;
  height: auto;
  padding: 16px;
  border: 1px solid rgba(61, 76, 110, 0.12);
  border-radius: 16px;
  background: var(--panel-solid);
  box-shadow: 0 10px 30px rgba(46, 58, 91, 0.12);
  overflow-wrap: anywhere;
}
.note-card h3 { margin: 0 0 10px; font-size: 0.96rem; }
.note-card p { margin: 0; color: var(--text); line-height: 1.65; white-space: pre-wrap; }
.note-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 10px; cursor: grab; }
.note-card-head .card-type { color: var(--muted); font-size: 0.75rem; }
.note-card-head .card-delete { width: 28px; height: 28px; padding: 4px; border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.note-card-head .card-delete:hover { color: var(--danger, #d44b56); background: rgba(212,75,86,0.08); }
.note-card.is-selected { outline: 3px solid rgba(74,108,247,0.78); outline-offset: 3px; }
.note-card.is-connect-source { outline: 3px solid rgba(26,157,117,0.8); outline-offset: 3px; }
.note-card.is-grouped::after { position: absolute; top: -7px; left: 17px; width: 34px; height: 5px; border-radius: 5px 5px 0 0; background: #89a0f8; content: ""; }
.note-card-title { margin: 0 0 10px; font-size: 1rem; line-height: 1.45; }
.note-card-content { min-height: 48px; outline: none; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-card-content[contenteditable="true"]:focus { border-radius: 6px; box-shadow: 0 0 0 2px rgba(74,108,247,0.15); }
.note-card-actions { display: flex; align-items: center; gap: 3px; }
.note-card-actions .card-copy { width: 27px; height: 27px; padding: 4px; border: 0; color: var(--muted); background: transparent; }
.note-card-link { display: block; color: var(--primary-strong); line-height: 1.55; overflow-wrap: anywhere; }
.note-card-image { display: block; width: 100%; max-height: 300px; border-radius: 10px; object-fit: contain; }
.note-card-resize { position: absolute; right: 3px; bottom: 3px; width: 17px; height: 17px; padding: 0; border: 0; border-right: 2px solid #91a0bf; border-bottom: 2px solid #91a0bf; border-radius: 0 0 4px; background: transparent; cursor: nwse-resize; touch-action: none; }
.board-empty { position: absolute; top: 50%; left: 50%; width: min(90%, 420px); padding: 28px; border: 1px solid var(--border); border-radius: 20px; background: var(--panel-solid); text-align: center; transform: translate(-50%, -50%); }
.board-empty p { color: var(--muted); line-height: 1.6; }
.note-card.card-question { border-top: 4px solid #e8ad4c; }
.note-card.card-answer { border-top: 4px solid #52a88c; }
.note-card.card-resource, .note-card.card-video, .note-card.card-pdf { border-top: 4px solid #6688e8; }
.note-card[draggable="true"] { cursor: grab; }
.note-card[draggable="true"]:active { cursor: grabbing; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow-y: auto;
  background: rgba(255,255,255,0.72);
  border-right: 1px solid var(--border);
  padding: 22px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.portal-student .sidebar {
  background: linear-gradient(180deg, rgba(247,250,255,0.98), rgba(235,243,255,0.96));
  border-right-color: rgba(74,108,247,0.15);
}

.portal-school .sidebar {
  background: linear-gradient(180deg, rgba(249,250,253,0.98), rgba(239,243,250,0.97));
  border-right-color: rgba(45,62,93,0.14);
}

.portal-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border-radius: 14px;
  background: rgba(74,108,247,0.08);
  color: var(--primary-strong);
  font-size: 0.88rem;
  font-weight: 700;
}

.portal-school .portal-badge {
  background: rgba(61,82,119,0.09);
  color: #435878;
}

.portal-student .school-switcher {
  background: rgba(255,255,255,0.72);
}

.portal-school .school-switcher {
  background: rgba(255,255,255,0.8);
}

.portal-school .nav-link.nav-active {
  background: linear-gradient(135deg, rgba(71,95,137,0.13), rgba(71,95,137,0.05));
  color: #435878;
}

.school-hero-banner {
  margin-bottom: 28px;
  padding: 30px 34px;
  border-radius: 26px;
  color: #fff;
  background: linear-gradient(125deg, #324767, #557297);
}

.school-hero-banner .eyebrow {
  color: #c7d7f0;
}

.school-hero-banner h2 {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.school-hero-banner p {
  margin: 0;
  color: rgba(255,255,255,0.78);
}

.school-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.school-hero-actions .button-secondary {
  color: #fff;
  border-color: rgba(255,255,255,0.26);
  background: rgba(255,255,255,0.12);
}

.student-hero-banner {
  background: linear-gradient(135deg, rgba(111,155,250,0.16), rgba(129,211,197,0.16));
}

.school-switcher {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.52);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px 14px;
}

.school-monogram {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #7b92ff, #4d6af7);
  color: white;
  font-weight: 800;
}

.school-switcher strong { display: block; }
.school-switcher small { color: var(--muted); }
.switcher-chevron { margin-left: auto; color: var(--muted); }

.main-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-label {
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
  width: 100%;
}

.nav-link:hover, .text-button:hover, .button:hover, .banner-link:hover, .list-row:hover, .task-card:hover, .class-card:hover, .note-preview:hover {
  transform: translateY(-1px);
}

.nav-link.nav-active {
  background: linear-gradient(135deg, rgba(74,108,247,0.12), rgba(74,108,247,0.04));
  color: var(--primary-strong);
  font-weight: 700;
}

.sidebar-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-help {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.52);
  border: 1px solid var(--border);
}

.help-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(74,108,247,0.12);
  border-radius: 10px;
  margin-bottom: 12px;
  color: var(--primary-strong);
}

.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  min-height: 100svh;
}

.topbar {
  padding: 18px 28px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(255,255,255,0.2);
}

.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.online-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(26,157,117,0.1);
  border: 1px solid rgba(26,157,117,0.2);
  color: var(--success);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 600;
}

.online-chip span {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(26,157,117,0.1);
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.58);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255,255,255,0.5);
  border: 1px solid var(--border);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7aa8ff, #4d6af7);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.avatar-small {
  width: 28px;
  height: 28px;
  font-size: 0.8rem;
}

.page-content {
  width: 100%;
  max-width: 1680px;
  min-width: 0;
  margin-inline: auto;
  padding: 24px 28px 40px;
}

#worskpace { display: block; }

.welcome-row, .page-heading, .section-heading, .panel-heading, .task-card, .note-tip, .school-profile-card, .live-intro, .join-room-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.welcome-row {
  margin-bottom: 24px;
}

.hero-banner {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
  padding: 26px 28px;
  background: linear-gradient(135deg, rgba(96,130,255,0.14), rgba(115,204,239,0.12));
  border: 1px solid rgba(86,114,196,0.08);
  border-radius: 28px;
  margin-bottom: 30px;
}

.banner-kicker {
  display: inline-block;
  color: var(--primary-strong);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  font-weight: 700;
  text-transform: uppercase;
}

.hero-banner h2 {
  margin: 10px 0 12px;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.1;
}

.banner-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  color: var(--primary-strong);
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 700;
}

.banner-art {
  position: relative;
  min-height: 180px;
}

.art-sun {
  position: absolute;
  width: 88px;
  height: 88px;
  background: radial-gradient(circle at center, rgba(255,208,108,0.8), rgba(255,208,108,0.2));
  border-radius: 50%;
  right: 48px;
  top: 10px;
}

.art-window {
  position: absolute;
  right: 28px;
  bottom: 0;
  width: 220px;
  height: 150px;
  border-radius: 20px;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(107,125,170,0.12);
  box-shadow: var(--shadow);
}

.art-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 18px;
}

.art-board i {
  display: block;
  width: 100%;
  height: 46px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(74,108,247,0.1), rgba(74,108,247,0.22));
}

.art-shelf {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  height: 12px;
  border-radius: 999px;
  background: rgba(112,140,230,0.2);
}

.art-plant {
  position: absolute;
  left: 40px;
  bottom: 8px;
  width: 20px;
  height: 52px;
  background: linear-gradient(180deg, rgba(32,129,102,0.1), rgba(32,129,102,0.3));
  border-radius: 12px 12px 10px 10px;
}

.art-paper {
  position: absolute;
  width: 64px;
  height: 90px;
  background: rgba(255,255,255,0.8);
  border: 1px solid rgba(107,125,170,0.14);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.paper-a { left: 26px; top: 10px; transform: rotate(-10deg); }
.paper-b { left: 68px; top: 48px; transform: rotate(8deg); }
.art-orbit { position: absolute; left: 36px; top: 110px; width: 100px; height: 100px; border: 1px dashed rgba(74,108,247,0.2); border-radius: 50%; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card, .panel-card, .class-card, .task-card, .note-preview, .school-profile-card, .resource-strip, .submit-card, .live-class-list > article, .join-room-card, .room-code-box, .filter-panel {
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 22px;
}

.stat-card {
  padding: 18px 20px;
}

.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-icon { width: 36px; height: 36px; display: inline-flex; border-radius: 12px; justify-content: center; align-items: center; background: rgba(74,108,247,0.08); color: var(--primary-strong); }
.stat-caption { color: var(--muted); font-size: 0.8rem; }
.stat-number { font-size: 2rem; font-weight: 800; margin: 14px 0 8px; }
.stat-label { color: var(--muted); }

.home-columns {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
  margin-bottom: 24px;
}

.panel-card {
  padding: 22px;
}

.panel-heading {
  margin-bottom: 14px;
}

.panel-heading h3 { margin: 0; }

.text-button {
  background: transparent;
  color: var(--primary-strong);
  font-weight: 700;
  padding: 0;
}

.list-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(109,127,181,0.12);
  background: rgba(255,255,255,0.38);
  border-radius: 16px;
  padding: 12px 14px;
}

.class-icon, .task-date {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(74,108,247,0.1);
  color: var(--primary-strong);
}

.task-date {
  flex-direction: column;
  font-size: 0.7rem;
  padding: 8px;
  line-height: 1.3;
}

.list-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.list-row-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row-main small, .list-row-tail, .class-card-meta { color: var(--muted); }
.list-row-tail { display: inline-flex; align-items: center; gap: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-soft { background: rgba(74,108,247,0.08); color: var(--primary-strong); }
.badge-warm { background: rgba(241,185,93,0.12); color: #8a651d; }
.badge-success { background: rgba(28,157,117,0.1); color: var(--success); }

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quick-actions button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(122,137,176,0.12);
  background: rgba(255,255,255,0.4);
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--text);
}

.quick-actions span { display: flex; flex-direction: column; gap: 4px; }
.quick-actions small { color: var(--muted); }

.resource-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
}

.resource-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(74,108,247,0.08);
  color: var(--primary-strong);
}

.page-heading { margin-bottom: 22px; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.page-heading h1 { margin: 0 0 6px; font-size: clamp(2.2rem, 3vw, 3rem); }

.class-grid, .note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.class-card, .note-preview {
  overflow: hidden;
}

.class-card-cover {
  height: 110px;
  position: relative;
  padding: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  color: white;
  background: linear-gradient(135deg, #7c98ff, #4a6cf7);
}

.cover-1 { background: linear-gradient(135deg, #89b0ff, #5372f5); }
.cover-2 { background: linear-gradient(135deg, #7bd4a8, #38a47a); }
.cover-3 { background: linear-gradient(135deg, #ffbf87, #ef8f59); }
.cover-0 { background: linear-gradient(135deg, #a8b6ff, #6f7cf5); }

.cover-label { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; }
.cover-symbol { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.18); border-radius: 12px; }

.class-card-body { padding: 18px; }
.class-card-body h3 { margin: 8px 0 12px; }
.class-card-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 0.82rem; margin-bottom: 14px; }
.class-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.class-card-actions .button { flex: 1 1 auto; }
.student-picker-list { display: grid; max-height: min(45vh, 360px); overflow-y: auto; border: 1px solid var(--border); border-radius: 14px; }
.student-picker-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.student-picker-row:last-child { border-bottom: 0; }
.student-picker-row input { width: 18px; height: 18px; accent-color: var(--primary); }
.student-picker-row span, .student-picker-row strong, .student-picker-row small { display: block; }
.student-picker-row small { margin-top: 3px; color: var(--muted); font-size: 0.82rem; }
.student-already-added { color: var(--muted); background: rgba(99,115,143,0.04); cursor: default; }

.note-tip {
  margin-bottom: 16px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  background: rgba(74,108,247,0.05);
  border-radius: 16px;
  color: var(--muted);
}

.note-preview {
  display: block;
  text-align: left;
  width: 100%;
  padding: 0;
  background: rgba(255,255,255,0.7);
}

.note-preview-art {
  position: relative;
  height: 120px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(74,108,247,0.08), rgba(133,170,255,0.12));
}

.preview-card {
  position: absolute;
  width: 54%;
  height: 46px;
  background: rgba(255,255,255,0.9);
  border-radius: 12px;
  border: 1px solid rgba(112,128,176,0.12);
}
.preview-a { left: 18px; top: 24px; }
.preview-b { left: 42px; top: 56px; }
.preview-c { right: 20px; top: 28px; }
.note-preview-art span { position: absolute; right: 18px; bottom: 16px; color: var(--primary-strong); }
.note-preview-info { padding: 16px 18px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.note-preview-info h3 { margin: 0 0 6px; }
.note-preview-info p { margin: 0; color: var(--muted); }

.task-list {
  display: grid;
  gap: 18px;
}

.task-card {
  align-items: flex-start;
  padding: 18px;
}

.task-card-date {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  color: var(--muted);
}

.task-card-date strong { display: block; color: var(--text); }
.task-card-main { flex: 1; min-width: 0; }
.task-card-main h3 { margin: 8px 0; }
.task-card-main p { margin: 0 0 8px; color: var(--muted); line-height: 1.7; }
.task-card-action { display: flex; align-items: center; gap: 10px; }
.resource-link { display: inline-flex; align-items: center; gap: 8px; color: var(--primary-strong); font-weight: 600; }
.teacher-feedback { margin-top: 12px; padding: 12px 14px; background: rgba(74,108,247,0.05); border-radius: 14px; }
.teacher-feedback strong { display: block; margin-bottom: 6px; }
.teacher-feedback p { margin: 0; }

.empty-state {
  text-align: center;
  padding: 28px 20px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 22px;
  background: rgba(255,255,255,0.45);
}

.empty-icon {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  border-radius: 16px;
  background: rgba(74,108,247,0.08);
  color: var(--primary-strong);
}

.live-room {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(100svh - 118px);
  min-height: 520px;
  color: var(--text);
  background: #f3f5fa;
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
}
.live-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 20px; background: var(--panel-solid); border-bottom: 1px solid var(--border); }
.live-header h1 { margin: 3px 0 0; font-size: 1.15rem; }
.live-state { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 0.82rem; }
.state-light, .participant-status { width: 9px; height: 9px; border-radius: 50%; background: #e3a73f; }
.live-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; flex: 1; min-height: 0; }
.live-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 18px; }
.video-grid { display: grid; flex: 1; min-height: 0; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); grid-auto-rows: minmax(190px, 1fr); align-content: center; gap: 14px; overflow: auto; }
.video-tile { position: relative; min-height: 190px; overflow: hidden; border: 1px solid rgba(255,255,255,0.12); border-radius: 18px; background: #20283a; }
.video-tile video { display: block; width: 100%; height: 100%; min-height: 190px; object-fit: cover; }
.video-label, .video-state { position: absolute; bottom: 12px; padding: 6px 9px; border-radius: 8px; color: #fff; background: rgba(15,21,32,0.68); font-size: 0.78rem; }
.video-label { left: 12px; }
.video-state { right: 12px; }
.live-stage-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; color: var(--muted); font-size: 0.82rem; }
.live-stage-footer strong { color: var(--text); }
.live-stage-footer p { margin: 4px 0 0; }
.limit-pill { padding: 7px 10px; border-radius: 999px; background: rgba(74,108,247,0.08); color: var(--primary-strong); white-space: nowrap; }
.live-aside { display: flex; flex-direction: column; min-width: 0; border-left: 1px solid var(--border); background: var(--panel-solid); }
.aside-tabs { display: flex; border-bottom: 1px solid var(--border); }
.aside-tab { flex: 1; padding: 13px 10px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.aside-tab.active { border-bottom-color: var(--primary); color: var(--primary-strong); font-weight: 700; }
.aside-panel { flex: 1; min-height: 0; padding: 16px; overflow: auto; }
.aside-panel h3 { margin: 0 0 12px; font-size: 0.96rem; }
.participant-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.participant-row > div { flex: 1; min-width: 0; }
.participant-row strong, .participant-row small { display: block; overflow: hidden; text-overflow: ellipsis; }
.participant-row small { margin-top: 3px; color: var(--muted); }
.participant-status { flex: none; background: #b7c1d2; }
.participant-status.online { background: #32a780; }
.room-code-box { display: grid; gap: 8px; margin-top: 20px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: rgba(74,108,247,0.04); }
.room-code-box span { color: var(--muted); font-size: 0.8rem; }
.room-code-box strong { overflow-wrap: anywhere; }
.share-requests { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.share-request-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.share-request-row > div { min-width: 0; }
.share-request-row strong, .share-request-row small { display: block; }
.share-request-row small, .share-request-status { color: var(--muted); font-size: 0.8rem; }
.share-request-status { margin-top: 18px; line-height: 1.6; }
.chat-panel { display: flex; flex-direction: column; }
.chat-messages { display: flex; flex: 1; flex-direction: column; gap: 10px; overflow: auto; }
.chat-bubble { align-self: flex-start; max-width: 95%; padding: 9px 11px; border-radius: 12px; background: rgba(74,108,247,0.07); overflow-wrap: anywhere; }
.chat-bubble strong { font-size: 0.8rem; }
.chat-bubble p { margin: 4px 0; }
.chat-bubble time { color: var(--muted); font-size: 0.7rem; }
.chat-compose { display: flex; gap: 8px; padding-top: 12px; }
.chat-compose input { min-width: 0; flex: 1; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.send-button { flex: none; }
.live-controls { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--panel-solid); }
.live-controls-left, .live-controls-right { display: flex; align-items: center; gap: 8px; }
.control-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-solid); color: var(--text); cursor: pointer; }
.control-button:hover, .device-picker-trigger:hover { background: rgba(74,108,247,0.07); }
.control-button.control-active { border-color: rgba(74,108,247,0.4); background: rgba(74,108,247,0.1); color: var(--primary-strong); }
.control-leave { border-color: rgba(220,70,80,0.25); color: #c8424b; }
.live-control-group { display: flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--border); border-radius: 14px; }
.live-control-group .control-button { border-color: transparent; }
.device-picker-trigger { min-height: 34px; padding: 5px 8px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; }
.device-picker { position: absolute; bottom: calc(100% + 8px); left: 18px; z-index: 4; display: grid; gap: 6px; min-width: 240px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel-solid); box-shadow: var(--shadow); }
.device-picker[hidden] { display: none; }
.device-picker label { color: var(--muted); font-size: 0.8rem; }
.device-picker select { width: 100%; padding: 9px; border: 1px solid var(--border); border-radius: 9px; color: var(--text); background: var(--panel-solid); }

.live-intro {
  padding: 22px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--border);
  border-radius: 28px;
  margin-bottom: 20px;
}

.live-intro-copy h1 { margin: 0 0 10px; font-size: clamp(2rem, 3vw, 3rem); }
.live-intro-copy p { margin: 0; color: var(--muted); line-height: 1.8; }
.live-limits { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.live-limits span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: rgba(74,108,247,0.06); color: var(--primary-strong); font-weight: 600; }
.live-illustration { position: relative; width: 260px; height: 180px; }
.live-circle { position: absolute; border-radius: 50%; }
.circle-a { width: 180px; height: 180px; background: rgba(74,108,247,0.08); right: 0; top: 0; }
.circle-b { width: 110px; height: 110px; background: rgba(47,180,141,0.08); left: 20px; bottom: 0; }
.live-screen { position: absolute; inset: 24px 50px 30px 40px; background: linear-gradient(180deg, rgba(22,27,45,0.9), rgba(26,27,40,0.9)); border-radius: 22px; display: flex; align-items: center; justify-content: center; color: white; gap: 18px; box-shadow: var(--shadow); }
.live-screen span { width: 12px; height: 12px; border-radius: 50%; background: rgba(255,255,255,0.18); }
.live-bubble { position: absolute; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,0.74); border: 1px solid rgba(136,153,190,0.18); }
.bubble-a { left: 0; top: 15px; }
.bubble-b { right: 8px; bottom: 14px; }

.live-section-heading { margin-bottom: 12px; }
.live-status-note { margin: -8px 0 24px; }
.live-class-list { display: grid; gap: 12px; }
.live-class-list > article { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.live-class-list > article > div { flex: 1; min-width: 0; }
.live-class-list > article > div strong, .live-class-list > article > div small { display: block; }
.live-class-list > article > div small { margin-top: 5px; color: var(--muted); }
.live-online-icon { color: #168d68; background: rgba(47,180,141,0.12); }
.classroom-heading { margin: 0 0 22px; }
.classroom-heading h1 { margin: 4px 0 6px; font-size: clamp(2rem, 3vw, 2.7rem); }
.classroom-heading p { margin: 0; color: var(--muted); }
.live-join-banner { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 30px; padding: 22px 24px; border: 1px solid rgba(47,180,141,0.25); border-radius: 20px; background: linear-gradient(110deg, rgba(47,180,141,0.12), rgba(74,108,247,0.08)); }
.live-join-copy { min-width: 0; }
.live-join-copy h2 { margin: 5px 0; }
.live-join-copy p { margin: 0; color: var(--muted); }
.classroom-section-heading { margin-top: 28px; }
.join-room-card { margin-top: 20px; padding: 18px 20px; }

.school-profile-card { padding: 18px 20px; }
.school-monogram-large { width: 56px; height: 56px; border-radius: 18px; }
.invite-panel { margin-top: 20px; }
.invite-url { display: flex; gap: 10px; margin-top: 16px; }
.invite-url input { flex: 1; }
.member-list-state { min-width: 0; margin-top: 18px; }
.member-table-wrap { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.member-table { width: 100%; min-width: 720px; border-collapse: collapse; text-align: left; }
.member-table th, .member-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.member-table th { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.member-table td strong, .member-table td small { display: block; }
.member-table td small, .member-count { margin-top: 4px; color: var(--muted); font-size: 0.84rem; }
.member-email { overflow-wrap: anywhere; }
.member-count { text-align: right; }

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17,26,38,0.5);
  display: grid;
  place-items: center;
  padding: 18px;
  overflow-y: auto;
}

.dialog {
  width: min(100%, 520px);
  max-height: calc(100vh - 36px);
  max-height: calc(100svh - 36px);
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.dialog-head h2 { margin: 0; font-size: 1.4rem; }
.dialog-body { padding: 20px 22px; overflow-y: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 22px; }
.dialog-form { display: flex; flex-direction: column; gap: 14px; }
.dialog-form textarea { resize: vertical; min-height: 120px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.submission-answer { padding: 16px; border-radius: 14px; background: rgba(74,108,247,0.04); color: var(--text); line-height: 1.8; }
.submission-list { display: grid; gap: 12px; }
.submission-list article { padding: 14px; border: 1px solid var(--border); border-radius: 16px; }

.toast-area {
  position: fixed;
  right: 18px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  max-width: 320px;
  background: rgba(17, 25, 37, 0.92);
  color: white;
  padding: 12px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.toast-success { background: rgba(26,157,117,0.92); }
.toast-error { background: rgba(239,106,106,0.92); }

@media (max-width: 980px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; height: 100vh; height: 100svh; }
  .mobile-menu { display: inline-flex; }
  .home-columns { grid-template-columns: 1fr; }
  .hero-banner { grid-template-columns: 1fr; }
  .auth-main { min-height: 100vh; min-height: 100svh; padding: 28px 20px; }
  .live-layout { grid-template-columns: minmax(0, 1fr) 260px; }
}

@media (min-width: 981px) {
  .mobile-menu { display: none; }
}

@media (max-width: 640px) {
  .workspace-loading { padding: 18px 16px 54px; }
  .workspace-loading-card { width: min(100%, 430px); padding: 20px 22px 22px; border-radius: 24px; }
  .loading-visual { width: 126px; height: 110px; margin-top: 12px; }
  .loading-mobile-break { display: initial; }
  .workspace-loading-card h1 { margin-top: 6px; font-size: 1.55rem; }
  .loading-description { max-width: 300px; font-size: 0.86rem; }
  .loading-progress { margin-top: 20px; }
  .loading-steps { gap: 2px; margin: 17px 0; }
  .loading-steps li { flex-direction: column; gap: 4px; font-size: 0.7rem; }
  .loading-footnote { font-size: 0.68rem; }
  .loading-page-brand { bottom: 14px; font-size: 0.68rem; }
  .page-content, .topbar { padding-left: 16px; padding-right: 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .hero-banner { padding: 18px; }
  .task-card { flex-direction: column; }
  .task-card-action { width: 100%; justify-content: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .live-intro { flex-direction: column; }
  .live-join-banner { align-items: stretch; flex-direction: column; padding: 18px; }
  .live-class-list > article { flex-wrap: wrap; }
  .live-class-list > article > div { flex-basis: calc(100% - 60px); }
  .live-class-list > article > .badge { margin-left: 52px; }
  .page-heading, .welcome-row, .school-profile-card { align-items: flex-start; flex-direction: column; }
  .page-heading > .button, .page-heading > .button-row { width: 100%; }
  .button-row > .button { flex: 1 1 160px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .panel-heading .button-row { width: 100%; }
  .dialog-backdrop { padding: 10px; place-items: center; }
  .dialog { max-height: calc(100vh - 20px); max-height: calc(100svh - 20px); border-radius: 20px; }
  .dialog-head, .dialog-body { padding-left: 16px; padding-right: 16px; }
  .dialog-actions { flex-wrap: wrap; padding: 0 16px 16px; }
  .dialog-actions .button { flex: 1 1 auto; }
  .auth-main { padding: 20px 16px; }
  .note-editor-toolbar { min-height: 62px; gap: 10px; padding: 8px 10px; }
  .note-editor-toolbar > .button { flex: none; padding: 8px; font-size: 0; }
  .note-editor-toolbar > .button svg { width: 18px; height: 18px; }
  .note-editor-title { flex: 1; }
  .note-editor-title .eyebrow { font-size: 0.58rem; }
  .note-editor-title h1 { font-size: 0.95rem; }
  .note-editor-status { display: inline-flex; margin-left: auto; padding: 4px 7px; font-size: 0.62rem; }
  .note-tools { justify-content: flex-start; gap: 7px; padding: 7px; overflow-x: auto; }
  .note-tool-group { flex: none; gap: 3px; }
  .note-tool-button { min-height: 32px; padding: 6px 8px; font-size: 0.74rem; }
  .note-tool-actions { padding-left: 7px; }
  .board { min-height: max(100%, 720px); }
  .note-card { width: min(280px, calc(100vw - 36px)); }
  .live-header { min-height: 60px; padding: 9px 12px; }
  .live-header h1 { font-size: 1rem; }
  .live-state { max-width: 48%; font-size: 0.68rem; }
  .live-layout { display: flex; flex-direction: column; }
  .live-stage { flex: 1; padding: 8px; }
  .video-grid { grid-auto-rows: minmax(130px, 1fr); gap: 8px; }
  .video-tile, .video-tile video { min-height: 130px; }
  .live-stage-footer { padding-top: 8px; font-size: 0.68rem; }
  .live-stage-footer .limit-pill { padding: 5px 7px; }
  .live-aside { flex: none; max-height: 180px; border-top: 1px solid var(--border); border-left: 0; }
  .aside-panel { padding: 8px 12px; }
  .aside-panel > h3 { margin-bottom: 4px; }
  .participant-row { padding: 5px 0; }
  .room-code-box { display: none; }
  .share-requests { margin-top: 8px; padding-top: 8px; }
  .share-request-row { padding: 6px 0; }
  .live-controls { flex-wrap: wrap; justify-content: center; gap: 6px; padding: 6px; }
  .live-controls-left, .live-controls-right { gap: 5px; }
  .control-button { min-height: 38px; gap: 5px; padding: 6px 8px; font-size: 0.75rem; }
  .control-button svg { width: 17px; height: 17px; }
  .live-control-group { gap: 0; padding: 2px; }
  .device-picker-trigger { min-height: 30px; padding: 4px 5px; font-size: 0.7rem; }
  .device-picker { left: 8px; }
  .auth-form-wrap { gap: 12px; }
  .auth-switch { padding: 4px; }
  .auth-tab { padding: 8px 12px; }
  .auth-form { gap: 12px; padding: 18px; border-radius: 20px; }
  .auth-form h2 { font-size: 1.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .loading-progress span, .loading-spark { animation: none; }
  .loading-progress span { width: 58%; transform: translateX(36%); }
}

.live-room { position: fixed; inset: 0; z-index: 60; width: 100%; height: 100vh; height: 100svh; min-height: 0; border: 0; border-radius: 0; }

@media (max-height: 820px) {
  .auth-brand, .auth-main { padding-top: 20px; padding-bottom: 20px; }
  .auth-hero { padding-block: 18px; }
  .hero-illustration { height: min(280px, 30vh); }
  .sidebar { padding-top: 16px; padding-bottom: 12px; gap: 12px; }
  .sidebar-help { padding: 12px; }
}

@media (max-width: 640px) and (max-height: 700px) {
  .auth-main { padding-top: 8px; padding-bottom: 8px; }
  .auth-form-wrap { gap: 6px; }
  .auth-form { gap: 6px; padding: 12px; }
  .auth-form h2 { font-size: 1.5rem; }
  .auth-form label { gap: 4px; }
  .auth-form input { padding: 8px 10px; }
  .auth-form > div:first-child p { margin: 4px 0 0; }
  .auth-switch { padding: 3px; }
  .auth-tab { padding: 6px 10px; }
  .auth-privacy { margin: 0; font-size: 0.82rem; }
}

.sidebar-open { display: flex !important; position: fixed; inset: 0 0 0 0; z-index: 40; width: 88%; max-width: 300px; background: rgba(255,255,255,0.96); }
.sidebar-scrim { display: none; }
.scrim-visible { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.18); z-index: 35; }

.note-editor { position: relative; }
.note-editor-toolbar { flex: 0 0 auto; min-width: 0; }
.note-editor-status { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; background: var(--panel-strong); font-size: 0.76rem; }
.note-editor-status::before { width: 7px; height: 7px; border-radius: 50%; background: var(--success); content: ""; }
.note-editor-status.is-error { color: var(--danger); }
.note-editor-status.is-error::before { background: var(--danger); }
.note-tools { flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-start; }
.note-tool-actions { overflow-x: auto; max-width: 100%; }
.note-view-tools { margin-left: auto; }
.note-readonly-tools { align-items: center; }
.note-board-wrap { position: relative; flex: 1 1 0; min-width: 0; min-height: 0; overflow: hidden; background: #edf4ff; touch-action: none; }
.note-editor-footer { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; min-height: 31px; padding: 4px 16px; border-top: 1px solid var(--border); color: var(--muted); background: var(--panel-solid); font-size: 0.7rem; }
.board {
  position: absolute;
  top: 0;
  left: 0;
  width: 6000px;
  height: 4000px;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  transform-origin: 0 0;
  background-color: #edf4ff;
  background-image: radial-gradient(rgba(99, 123, 164, 0.28) 1px, transparent 1px);
  background-size: 24px 24px;
  will-change: transform;
}
.board.no-grid { background-image: none; }
.note-connections { position: absolute; inset: 0; z-index: 0; overflow: visible; pointer-events: none; }
.note-connections marker path { fill: #7185bd; }
.note-edge path { fill: none; stroke-width: 3; }
.note-edge-hit { stroke: transparent !important; stroke-width: 16 !important; pointer-events: stroke; cursor: pointer; }
.note-edge circle { fill: #fff; stroke: #7185bd; stroke-width: 2; cursor: pointer; pointer-events: all; }
.note-edge.is-selected path:first-child { stroke-width: 5; }
.note-card { z-index: 1; min-width: 220px; min-height: 150px; padding: 14px 15px 34px; overflow: auto; border: 1px solid #e8ebf2; border-radius: 15px; background: #fff; box-shadow: 0 7px 22px rgba(39, 61, 105, 0.13); transition: box-shadow 120ms ease, outline-color 120ms ease; }
.note-card.card-question, .note-card.card-answer, .note-card.card-resource, .note-card.card-video, .note-card.card-pdf { border-top: 1px solid #e8ebf2; }
.note-card.card-blank { overflow: hidden; padding: 0; border-color: transparent; background: var(--card-color); }
.note-card.card-blank .note-card-head { position: absolute; top: 0; right: 0; z-index: 5; width: 42px; height: 38px; margin: 0; justify-content: flex-end; opacity: 0; }
.note-card.card-blank:hover .note-card-head, .note-card.card-blank:focus-within .note-card-head { opacity: 1; }
.note-card.card-blank .note-card-kind { display: none; }
.note-card.card-blank .card-menu { background: rgba(255,255,255,0.84); }
.note-card.card-blank .note-card-ports, .note-card.card-blank.is-grouped::after { display: none; }
.note-card.is-selected { z-index: 2; outline: 3px solid color-mix(in srgb, var(--card-accent) 80%, white); outline-offset: 3px; box-shadow: 0 12px 30px rgba(39, 61, 105, 0.2); }
.note-card.is-locked { opacity: 0.88; }
.note-card-head { min-height: 25px; margin: -5px 0 9px; cursor: grab; touch-action: none; }
.note-card-head:active { cursor: grabbing; }
.note-card-kind { color: #78849a; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em; }
.note-card-actions { margin-left: auto; }
.note-card-title { min-height: 1.4em; margin: 0 0 9px; color: #1d2c49; font-size: 1rem; line-height: 1.45; overflow-wrap: anywhere; }
.note-card-content { min-height: 48px; color: #33425f; line-height: 1.65; white-space: normal; overflow-wrap: anywhere; }
.note-card-content p { margin: 0 0 6px; color: inherit; }
.note-card-content ul, .note-card-content ol { padding-left: 22px; }
.note-card-content[contenteditable="true"] { cursor: text; user-select: text; }
.note-card-content[contenteditable="true"]:focus, .note-card-title[contenteditable="true"]:focus { border-radius: 5px; outline: 2px solid rgba(74,108,247,0.2); }
.note-card-format { position: absolute; right: 8px; bottom: 5px; display: flex; gap: 2px; opacity: 0.55; }
.note-card-format:hover, .note-card:focus-within .note-card-format { opacity: 1; }
.note-card-format button { min-width: 24px; height: 23px; padding: 2px 4px; border: 0; border-radius: 5px; background: #eef2fc; color: #53617b; font-size: 0.7rem; }
.note-card-ports { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.note-port { position: absolute; width: 13px; height: 13px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: var(--card-accent); box-shadow: 0 0 0 1px var(--card-accent); opacity: 0; pointer-events: auto; transition: opacity 120ms ease, transform 120ms ease; }
.note-card:hover .note-port, .note-card.is-selected .note-port { opacity: 1; }
.note-port:hover { transform: scale(1.35); }
.note-port[data-port="top"] { top: -8px; left: calc(50% - 6px); }
.note-port[data-port="right"] { top: calc(50% - 6px); right: -8px; }
.note-port[data-port="bottom"] { bottom: -8px; left: calc(50% - 6px); }
.note-port[data-port="left"] { top: calc(50% - 6px); left: -8px; }
.note-card-resize { position: absolute; z-index: 3; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; touch-action: none; }
.resize-top-left { top: 3px; left: 3px; cursor: nwse-resize; }
.resize-top-right { top: 3px; right: 3px; cursor: nesw-resize; }
.resize-bottom-left { bottom: 3px; left: 3px; cursor: nesw-resize; }
.resize-bottom-right { right: 3px; bottom: 3px; cursor: nwse-resize; }
.note-edge { pointer-events: all; }
.note-card-image { display: block; max-width: 100%; max-height: 440px; margin: 0 auto; border-radius: 8px; object-fit: contain; cursor: zoom-in; }
.note-card-description, .note-card-meta { color: #64728e; font-size: 0.73rem; line-height: 1.5; }
.note-card-meta { margin: -3px 0 8px; }
.note-card-meta span { display: block; }
.note-card-link { display: block; color: #3a5cc8; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.note-lock-label { color: var(--muted); font-size: 0.65rem; }
.note-checklist { margin: 0; padding: 0; list-style: none; }
.note-checklist li { margin: 7px 0; color: #33425f; }
.note-checklist input { accent-color: var(--primary); }
.note-selection-box { position: absolute; z-index: 5; border: 1px solid #5878e7; background: rgba(93,126,236,0.12); pointer-events: none; }
.note-context-menu { position: absolute; z-index: 10; display: grid; min-width: 144px; padding: 5px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-solid); box-shadow: var(--shadow); }
.note-context-menu[hidden] { display: none; }
.note-context-menu button { padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); text-align: left; }
.note-context-menu button:hover { background: var(--panel-strong); }
.note-color-choices { display: flex; flex-wrap: wrap; gap: 12px; padding: 14px 4px; }
.note-color-choices button { width: 42px; height: 42px; border: 2px solid #fff; border-radius: 12px; background: var(--choice); box-shadow: 0 0 0 1px var(--border); }
.note-color-choices button:hover, .note-color-choices button:focus-visible { transform: scale(1.08); box-shadow: 0 0 0 2px var(--primary); }
.note-color-choices button:disabled { cursor: wait; opacity: 0.65; }
.note-card-type-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.note-card-type-grid button { min-height: 62px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-solid); color: var(--text); font-weight: 700; }
.note-card-type-grid button:hover { border-color: var(--primary); background: var(--panel-strong); }
.note-image-overlay { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(11, 20, 39, 0.86); }
.note-image-overlay img { max-width: min(94vw, 1400px); max-height: 88vh; object-fit: contain; }
.note-image-overlay button { position: absolute; top: 18px; right: 18px; padding: 8px 14px; border: 0; border-radius: 8px; background: #fff; color: #16213a; }
.note-submission-list { margin: 0; padding: 0; list-style: none; }
.note-submission-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.note-submission-list time { color: var(--muted); }
@media (max-width: 700px) {
  .note-editor-toolbar { flex-wrap: wrap; }
  .note-editor-toolbar > .button:not(#notes-back) { min-height: 32px; padding: 6px 8px; font-size: 0.68rem; }
  .note-editor-status { display: inline-flex; margin-left: auto; padding: 4px 7px; font-size: 0.62rem; }
  .note-tools { flex-wrap: nowrap; overflow-x: auto; }
  .note-tool-actions { max-width: unset; }
  .note-view-tools { margin-left: 0; }
  .note-card-type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .note-editor-footer { font-size: 0.62rem; }
}
@media (prefers-reduced-motion: reduce) {
  .note-card, .note-port { transition: none; }
}
