:root {
  color-scheme: light;
  --ink: #071a3f;
  --muted: #53627d;
  --line: #ccd6e8;
  --paper: #f6f8fc;
  --panel: #ffffff;
  --teal: #00247d;
  --teal-dark: #00184f;
  --coral: #cc142b;
  --green: #0b7a4b;
  --gold: #f2c14e;
  --sky: #e7edf8;
  --soft-surface: #eef3f7;
  --button-highlight: rgba(255, 255, 255, 0.28);
  --button-shadow: rgba(0, 24, 79, 0.26);
  --shadow: 0 16px 42px rgba(0, 24, 79, 0.13);
  --bg-grad-a: rgba(0, 36, 125, 0.06);
  --bg-grad-b: rgba(204, 20, 43, 0.04);
  --button-ink: #fff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="rose"] {
  --ink: #4a1030;
  --muted: #8a5168;
  --line: #f3cfdd;
  --paper: #fff5f8;
  --panel: #ffffff;
  --teal: #9c1648;
  --teal-dark: #7d0f3a;
  --coral: #ff6f91;
  --sky: #fde6ee;
  --soft-surface: #fdeef3;
  --button-highlight: rgba(255, 255, 255, 0.3);
  --button-shadow: rgba(125, 15, 58, 0.3);
  --shadow: 0 16px 42px rgba(125, 15, 58, 0.16);
  --bg-grad-a: rgba(156, 22, 72, 0.07);
  --bg-grad-b: rgba(255, 111, 145, 0.05);
}

:root[data-theme="forest"] {
  --ink: #0f2e1c;
  --muted: #4f6b59;
  --line: #cfe0d3;
  --paper: #f5faf6;
  --panel: #ffffff;
  --teal: #1c6b40;
  --teal-dark: #134d2e;
  --coral: #e08a2c;
  --sky: #e6f3ea;
  --soft-surface: #edf6ef;
  --button-highlight: rgba(255, 255, 255, 0.28);
  --button-shadow: rgba(19, 77, 46, 0.28);
  --shadow: 0 16px 42px rgba(19, 77, 46, 0.14);
  --bg-grad-a: rgba(28, 107, 64, 0.06);
  --bg-grad-b: rgba(224, 138, 44, 0.04);
}

:root[data-theme="ocean"] {
  --ink: #07303a;
  --muted: #4d717c;
  --line: #c9e1e7;
  --paper: #f3fafb;
  --panel: #ffffff;
  --teal: #0c647e;
  --teal-dark: #084a5c;
  --coral: #ef7b45;
  --sky: #e3f2f6;
  --soft-surface: #ecf6f8;
  --button-highlight: rgba(255, 255, 255, 0.3);
  --button-shadow: rgba(8, 74, 92, 0.28);
  --shadow: 0 16px 42px rgba(8, 74, 92, 0.14);
  --bg-grad-a: rgba(12, 100, 126, 0.07);
  --bg-grad-b: rgba(239, 123, 69, 0.04);
}

:root[data-theme="tropical"] {
  --ink: #002776;
  --muted: #4d6088;
  --line: #bfe3cb;
  --paper: #eaf7ee;
  --panel: #ffffff;
  --teal: #ffcc29;
  --teal-dark: #7a5c00;
  --coral: #002776;
  --sky: #fff6d9;
  --soft-surface: #eaf7ee;
  --button-highlight: rgba(255, 255, 255, 0.32);
  --button-shadow: rgba(122, 92, 0, 0.32);
  --shadow: 0 16px 42px rgba(4, 106, 56, 0.16);
  --bg-grad-a: rgba(4, 106, 56, 0.14);
  --bg-grad-b: rgba(255, 204, 41, 0.08);
  --button-ink: #002776;
}

:root[data-theme="slate"] {
  --ink: #1c2430;
  --muted: #5b6678;
  --line: #d4d9e2;
  --paper: #f7f8fa;
  --panel: #ffffff;
  --teal: #354459;
  --teal-dark: #232c3a;
  --coral: #6b7686;
  --sky: #eceef2;
  --soft-surface: #f0f1f4;
  --button-highlight: rgba(255, 255, 255, 0.24);
  --button-shadow: rgba(35, 44, 58, 0.26);
  --shadow: 0 16px 42px rgba(35, 44, 58, 0.12);
  --bg-grad-a: rgba(35, 44, 58, 0.05);
  --bg-grad-b: rgba(91, 102, 120, 0.03);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, var(--bg-grad-a), var(--bg-grad-b)),
    var(--paper);
  color: var(--ink);
}

/* Strong, consistent heading hierarchy: bold weight and generous line-height
   make headings easy to spot when scanning, even where a more specific rule
   below sets its own font-size. */
h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.25;
}

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

button {
  border: 0;
  cursor: pointer;
}

.primary-button {
  min-height: 46px;
  border-radius: 8px;
  color: var(--button-ink);
  background:
    linear-gradient(180deg, var(--button-highlight), rgba(255, 255, 255, 0) 45%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.08) 0 2px, rgba(255,255,255,0) 2px 5px),
    var(--teal);
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.32), 0 3px 0 var(--teal-dark), 0 8px 16px var(--button-shadow);
}

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

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

.auth-page {
  padding: 28px;
}

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

.landing-page {
  display: block;
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.landing-nav strong {
  font-size: 1.1rem;
}

.landing-nav-actions {
  display: flex;
  gap: 10px;
}

.landing-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  gap: clamp(22px, 4vw, 46px);
  align-items: center;
}

.landing-copy h1 {
  margin: 0 0 20px;
  font-size: clamp(2.8rem, 6vw, 5.4rem);
  line-height: 0.96;
}

.landing-copy p {
  max-width: 680px;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.22rem);
  line-height: 1.5;
}

.auth-card {
  padding: clamp(24px, 5vw, 42px);
}

.auth-card h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 1;
}

.auth-card h2 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.02;
}

.auth-copy {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 1.05rem;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.auth-form input,
.auth-form select {
  width: 100%;
  min-height: 54px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
}

.small-button {
  min-height: 42px;
  padding: 8px 18px;
}

@media (max-width: 820px) {
  .landing-grid {
    grid-template-columns: 1fr;
  }
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 86px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: var(--soft-surface);
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px clamp(18px, 4vw, 48px);
  border-bottom: 4px solid var(--coral);
  background: rgba(246, 248, 252, 0.93);
  backdrop-filter: blur(14px);
}

.topbar h1,
.panel h2,
.visual-copy h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.7rem, 3.2vw, 3rem);
  line-height: 1;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.date-block {
  min-width: 154px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f1f5fb);
  text-align: right;
}

.date-settings-button {
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 3px 0 #c8d3e6;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.date-settings-button:hover {
  border-color: rgba(0, 36, 125, 0.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 4px 0 #bac8de, 0 10px 18px rgba(0, 24, 79, 0.1);
}

.date-settings-button:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.75), 0 1px 0 #bac8de;
}

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

.topbar-quote {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 460px;
  text-align: center;
  padding: 0 12px;
}

.topbar-quote-text {
  margin: 0;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.topbar-quote-author {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

@media (max-width: 1080px) {
  .topbar-quote {
    display: none;
  }
}

.title-menu-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.menu-wrap {
  position: relative;
  flex: 0 0 auto;
}

.menu-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  gap: 5px;
  border: 1px solid rgba(0, 36, 125, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #eef3fb);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.86), 0 4px 0 #c8d3e6, 0 8px 16px rgba(0, 24, 79, 0.12);
}

.menu-button span {
  display: block;
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: var(--teal-dark);
}

.menu-button:hover {
  background: #ffffff;
}

.theme-mascot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  font-size: 1.9rem;
  line-height: 1;
}

.theme-mascot svg {
  width: 42px;
  height: 42px;
}

@keyframes mascot-bounce {
  0% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.25) rotate(-10deg); }
  50% { transform: scale(1.1) rotate(10deg); }
  75% { transform: scale(1.2) rotate(-6deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.mascot-celebrate {
  animation: mascot-bounce 0.7s ease;
}

@keyframes mascot-star-twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.mascot-celebrate svg polygon {
  animation: mascot-star-twinkle 0.35s ease-in-out 2;
}

.points-toast {
  position: fixed;
  top: 78px;
  right: 20px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--teal);
  color: var(--button-ink, #fff);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  font-weight: 700;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.points-toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.points-toast strong {
  font-size: 1.05rem;
}

.points-progress-track {
  height: 14px;
  border-radius: 999px;
  background: var(--soft-surface);
  overflow: hidden;
  margin: 10px 0 6px;
}

.points-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--teal);
  transition: width 0.4s ease;
}

.tutorial-checklist {
  display: grid;
  gap: 8px;
}

.tutorial-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tutorial-step:hover {
  background: var(--sky);
}

.tutorial-step-done {
  background: var(--sky);
  border-color: var(--teal);
}

.tutorial-step-check {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--line);
  color: #fff;
  font-weight: 900;
  font-size: 0.8rem;
}

.tutorial-step-done .tutorial-step-check {
  background: var(--green, var(--teal));
  border-color: var(--green, var(--teal));
}

.tutorial-step-text {
  flex: 1;
  min-width: 0;
}

.tutorial-step-text strong {
  display: block;
  font-size: 0.88rem;
}

.tutorial-step-text small {
  color: var(--muted);
  font-size: 0.74rem;
}

.tutorial-step-points {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
}

.tutorial-step-done .tutorial-step-points {
  color: var(--teal);
}

.points-ledger {
  display: grid;
  gap: 4px;
}

.points-ledger-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
}

.points-ledger-row span {
  flex: 1;
}

.points-ledger-row strong {
  color: var(--teal);
}

.points-ledger-row small {
  color: var(--muted);
  white-space: nowrap;
}

.menu-button:active,
.menu-button[aria-expanded="true"] {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 2px 0 #c8d3e6, 0 5px 12px rgba(0, 24, 79, 0.12);
}

.floating-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  z-index: 50;
  display: grid;
  gap: 8px;
  min-width: 230px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.floating-menu::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 17px;
  width: 14px;
  height: 14px;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  background: var(--panel);
  transform: rotate(45deg);
}

.floating-menu[hidden] {
  display: none;
}

.floating-menu a,
.floating-menu button {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  width: 100%;
  padding: 0 12px;
  border-radius: 8px;
  background: #f3f6fb;
  color: var(--teal-dark);
  font-weight: 900;
  text-align: left;
  text-decoration: none;
}

.floating-menu a:hover,
.floating-menu button:hover {
  background: var(--sky);
}

.floating-menu-group {
  display: grid;
  gap: 8px;
}

.floating-menu-group[hidden] {
  display: none;
}

.floating-menu-label {
  margin: 4px 4px 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.floating-menu-divider {
  height: 1px;
  margin: 2px 4px;
  background: var(--line);
}

.date-block span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.date-block strong {
  display: block;
  margin-top: 2px;
  font-size: 1rem;
}

.date-block small {
  display: block;
  margin-top: 4px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 900;
}

.date-block .room-line {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rotation-settings-card {
  width: min(640px, 94vw);
}

.rotation-settings-form {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.rotation-settings-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
}

.rotation-settings-form select,
.rotation-settings-form textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 900;
}

.rotation-settings-form textarea {
  min-height: 86px;
  padding: 12px;
  resize: vertical;
}

.rotation-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.rotation-preview {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f8fc;
  color: var(--teal-dark);
  font-weight: 900;
}

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

.compact-button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 0.82rem;
}

.lesson-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-button {
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, var(--button-highlight), rgba(255, 255, 255, 0) 42%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.08) 0 2px, rgba(255,255,255,0) 2px 5px),
    var(--teal);
  color: var(--button-ink);
  font-weight: 900;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.32), 0 4px 0 var(--teal-dark), 0 9px 18px var(--button-shadow);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
  cursor: pointer;
}

.subtle-logout-button {
  background:
    linear-gradient(180deg, var(--button-highlight), rgba(255, 255, 255, 0) 42%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.1) 0 2px, rgba(255,255,255,0) 2px 5px),
    var(--soft-surface);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.52), 0 4px 0 var(--line), 0 9px 18px rgba(20, 36, 66, 0.08);
}

.home-button:hover {
  background: var(--teal-dark);
}

.home-button:active {
  transform: translateY(3px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 1px 0 var(--teal-dark), 0 5px 11px var(--button-shadow);
}

.calendar-top-button {
  white-space: nowrap;
}

.app-shell {
  padding: 24px clamp(16px, 4vw, 48px) 46px;
}

.top-daily-strip {
  max-width: 1480px;
  margin: 0 auto 18px;
}

.planner-import {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(420px, 1.18fr);
  gap: 18px;
  max-width: 1480px;
  margin: 0 auto 18px;
  align-items: start;
}

.planner-import > .imported-day-panel {
  grid-column: 1 / -1;
}

.weekly-builder-shell {
  display: grid;
  gap: 18px;
  max-width: none;
  padding-left: 18px;
  padding-right: 18px;
  margin: 0 auto;
}

.week-tab-bar {
  display: grid;
  grid-template-columns: auto repeat(12, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 8;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
}

.tab-term-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--teal-dark);
  white-space: nowrap;
  padding: 0 6px;
}

.tab-term-picker select {
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 6px 8px;
  font-weight: 700;
}

.week-tab {
  min-height: 38px;
  padding: 0 8px;
  border-radius: 8px;
  background: #eef3fb;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 900;
}

.week-tab.active {
  background:
    linear-gradient(180deg, var(--button-highlight), rgba(255, 255, 255, 0) 42%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.08) 0 2px, rgba(255,255,255,0) 2px 5px),
    var(--teal);
  color: var(--button-ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.32), 0 3px 0 var(--teal-dark);
}

.master-week-view {
  display: grid;
  gap: 18px;
}

.rotation-table-wrap {
  overflow-x: visible;
  margin-top: 16px;
  border: 2px solid #1d4d15;
  border-radius: 8px;
  background: #1f6818;
}

.rotation-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

.rotation-table th,
.rotation-table td {
  border: 1px solid #1d4d15;
  padding: 0;
  text-align: center;
  vertical-align: middle;
}

.rotation-table th {
  background: #6aa84f;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
}

.rotation-title-cell {
  padding: 7px !important;
  background: #2e741f !important;
  color: #fff !important;
  font-size: 1.05rem !important;
  letter-spacing: 0;
}

.rotation-table tbody tr {
  height: 54px;
}

.rotation-table tbody td {
  height: 54px;
  background: #b7d7a8;
}

.rotation-table tbody tr:nth-child(even):not(.rotation-break-row) td {
  background: #d9ead3;
}

.rotation-table .rotation-block-time-cell {
  width: 128px;
  background: #6aa84f !important;
}

.block-time-fields {
  display: flex;
  height: 100%;
  min-height: 52px;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}

.rotation-table .block-time-fields input {
  height: 24px;
  min-height: 0;
  max-height: 24px;
  padding: 0 4px;
  color: #fff;
  font-size: 0.68rem;
  line-height: 1;
  overflow: hidden;
}

.rotation-table input,
.rotation-table textarea,
.rotation-table select {
  width: 100%;
  height: 52px;
  min-height: 0;
  max-height: 52px;
  border: 0;
  border-radius: 0;
  padding: 5px;
  background: transparent;
  color: #000;
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
  resize: none;
  cursor: text;
  line-height: 1.15;
  overflow: auto;
}

.rotation-table select {
  appearance: auto;
  cursor: pointer;
  padding-right: 18px;
}

.master-subject-cell {
  display: grid;
  height: 52px;
}

.master-subject-cell select,
.master-subject-cell input {
  grid-area: 1 / 1;
}

.master-subject-cell input:not(.hidden-master-custom) {
  margin-top: 26px;
  height: 26px;
  max-height: 26px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.08);
}

.master-subject-cell:has(input:not(.hidden-master-custom)) select {
  height: 26px;
  max-height: 26px;
  font-size: 0.62rem;
}

.hidden-master-custom {
  display: none;
}

.rotation-table input:focus,
.rotation-table textarea:focus,
.rotation-table select:focus {
  outline: 0;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 0 0 3px rgba(0, 36, 125, 0.22);
}

.rotation-table.is-locked input:disabled,
.rotation-table.is-locked textarea:disabled,
.rotation-table.is-locked select:disabled {
  opacity: 1;
  cursor: default;
  color: #071a3f;
  -webkit-text-fill-color: #071a3f;
}

.rotation-table.is-locked textarea:disabled {
  background: rgba(255, 255, 255, 0.18);
}

.rotation-table.is-locked .rotation-block-time-cell input:disabled,
.rotation-table.is-locked .rotation-break-row textarea:disabled,
.rotation-table.is-locked .rotation-break-row select:disabled {
  color: #fff;
  -webkit-text-fill-color: #fff;
}

.master-lock-copy {
  margin-top: 10px;
}

.rotation-break-row td {
  background: #2e741f !important;
  height: 30px !important;
}

.rotation-break-row textarea {
  height: 28px;
  max-height: 28px;
  color: #fff;
}

.rotation-break-row .block-time-fields input {
  height: 24px;
  max-height: 24px;
}

.week-controls {
  grid-template-columns: minmax(220px, 1fr) minmax(170px, 0.45fr) minmax(160px, 0.45fr) auto;
  align-items: end;
}

.weekly-builder {
  display: grid;
  grid-template-columns: repeat(5, minmax(205px, 1fr));
  gap: 10px;
  margin-top: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.weekly-day-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  overflow: hidden;
  min-width: 205px;
}

.weekly-day-card.holiday-day-card {
  background: #f6f7fb;
}

.weekly-day-card.holiday-day-card .weekly-day-heading {
  background: linear-gradient(180deg, #ffffff, #f1f3f8);
}

.weekly-day-heading {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #eef6ed);
}

.weekly-day-heading label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.weekly-day-heading select {
  min-height: 36px;
  font-size: 0.88rem;
  font-weight: 900;
}

.weekly-day-heading h3,
.lesson-editor-heading h3 {
  margin: 0;
  letter-spacing: 0;
}

.weekly-lessons {
  display: grid;
  gap: 8px;
  padding: 8px;
}

.holiday-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
  background: rgba(255, 255, 255, 0.72);
}

.lesson-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(0, 24, 79, 0.06);
}

.lesson-editor.first-half-editor {
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.95), 0 8px 20px rgba(0, 24, 79, 0.06);
}

.lesson-editor.second-half-editor {
  box-shadow: inset 0 -4px 0 rgba(0, 36, 125, 0.16), 0 8px 20px rgba(0, 24, 79, 0.06);
}

.lesson-editor.full-block-editor {
  box-shadow: inset 0 4px 0 rgba(0, 36, 125, 0.12), inset 0 -4px 0 rgba(0, 36, 125, 0.12), 0 8px 20px rgba(0, 24, 79, 0.06);
}

.lesson-editor.block-one-editor {
  background: #fff9eb;
}

.lesson-editor.block-one-editor .lesson-editor-heading {
  border-left-color: #f2b84b;
  background: #fff3d6;
}

.lesson-editor.block-two-editor {
  background: #eef8ff;
}

.lesson-editor.block-two-editor .lesson-editor-heading {
  border-left-color: #3b82d6;
  background: #e1f1ff;
}

.lesson-editor.block-three-editor {
  background: #f1f8ef;
}

.lesson-editor.block-three-editor .lesson-editor-heading {
  border-left-color: #4f9d4a;
  background: #e4f4e1;
}

.lesson-editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  border-left: 6px solid var(--teal);
}

.lesson-editor-heading .eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.half-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid rgba(0, 36, 125, 0.2);
  border-radius: 999px;
  background:
    repeating-linear-gradient(135deg, rgba(0,36,125,0.08) 0 2px, rgba(255,255,255,0) 2px 5px),
    rgba(255, 255, 255, 0.78);
  color: var(--teal-dark);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.second-half-editor .half-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 5px 0 0 currentColor;
}

.first-half-editor .half-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
}

.lesson-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lesson-editor-actions .compact-button {
  min-height: 32px;
  padding-inline: 10px;
  font-size: 0.76rem;
}

.lesson-editor-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px;
}

.lesson-editor-grid textarea {
  min-height: 58px;
  resize: vertical;
}

.lesson-tracking-block {
  display: grid;
  gap: 6px;
}

.tracking-rows {
  display: grid;
  gap: 6px;
}

.tracking-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tracking-row select {
  flex: 1;
}

.specialist-editor {
  min-height: 250px;
}

.specialist-editor .lesson-editor-grid {
  min-height: 178px;
  align-content: center;
}

.specialist-note {
  display: grid;
  min-height: 132px;
  place-items: center;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
  background: rgba(255, 255, 255, 0.72);
}

.break-editor {
  opacity: 0.82;
}

.break-editor .lesson-editor-heading {
  border-left-color: #2e741f;
  background: #eef6ed;
}

.term-week-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.35fr) minmax(150px, 0.35fr);
  gap: 12px;
  align-items: end;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f3f7fc);
}

.term-week-panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.term-week-panel .status-line {
  grid-column: 1 / -1;
  margin: 0;
}

.support-timetable-panel {
  scroll-margin-top: 82px;
}

.support-table-wrap {
  overflow-x: auto;
  margin-top: 14px;
}

.support-timetable {
  width: 100%;
  min-width: 860px;
  table-layout: fixed;
  border-collapse: collapse;
  border: 2px solid #1d4d15;
  border-radius: 8px;
  overflow: hidden;
}

.support-timetable th,
.support-timetable td {
  border: 1px solid #1d4d15;
  padding: 8px;
  vertical-align: top;
}

.support-timetable thead th {
  background: #2e741f;
  color: #fff;
  font-weight: 900;
}

.support-timetable tbody th {
  width: 150px;
  background: #6aa84f;
  color: #fff;
  text-align: center;
}

.support-timetable tbody th span,
.support-timetable tbody th strong {
  display: block;
}

.support-timetable tbody th span {
  margin-bottom: 4px;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.support-timetable td {
  background: #d9ead3;
}

.support-timetable tr:nth-child(odd) td {
  background: #eef7ea;
}

.support-cell {
  display: grid;
  width: 100%;
  min-height: 118px;
  align-content: start;
  gap: 5px;
  border: 0;
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.support-cell:hover {
  background: #fff;
  box-shadow: inset 0 0 0 2px rgba(0, 36, 125, 0.16);
}

.support-cell span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.support-cell strong {
  color: var(--teal-dark);
  font-size: 0.82rem;
  line-height: 1.25;
}

.locked-support-cell {
  display: grid;
  min-height: 118px;
  place-items: center;
  align-content: center;
  gap: 4px;
  background: #edf4e9 !important;
  color: var(--muted);
  text-align: center;
}

.locked-support-cell span,
.locked-support-cell small {
  display: block;
  font-weight: 900;
}

.support-summary {
  margin: 10px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.support-summary .eyebrow {
  margin-bottom: 6px;
}

.support-summary-row {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.support-summary-row strong {
  color: var(--teal-dark);
  font-size: 0.8rem;
}

.support-summary-row + .support-summary-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 36, 125, 0.1);
}

.support-picker-card {
  max-width: 920px;
}

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

@media (max-width: 720px) {
  .support-picker-columns {
    grid-template-columns: 1fr;
  }
}

.support-picker-columns section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbff;
}

.support-picker-columns h4 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 1.12rem;
}

.support-student-options {
  display: grid;
  gap: 8px;
  max-height: 50vh;
  overflow: auto;
}

.support-student-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.support-student-option input {
  width: 18px;
  height: 18px;
}

.support-picker-actions {
  margin-top: 14px;
}

.lesson-plan-picker-card {
  max-width: 880px;
}

.lesson-plan-picker-tools {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.lesson-plan-picker-list {
  display: grid;
  gap: 10px;
  max-height: 64vh;
  overflow: auto;
}

.lesson-plan-pick-card {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f6f9ff);
  color: var(--ink);
  text-align: left;
}

.lesson-plan-pick-card:hover {
  background: #eef4ff;
  box-shadow: inset 0 0 0 2px rgba(0, 36, 125, 0.14);
}

.lesson-plan-pick-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lesson-plan-pick-card strong {
  font-size: 1rem;
}

.lesson-plan-pick-card small {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
  white-space: pre-line;
}

.week-overview-panel {
  scroll-margin-top: 82px;
}

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

.settings-transfer-panel {
  grid-column: 1 / -1;
}

.transfer-panel h2 {
  margin-bottom: 6px;
}

.transfer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.week-overview-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.overview-download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 14px;
}

.overview-download-row .status-line {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 800;
}

.overview-download-row .status-line a {
  color: var(--teal-dark);
  font-weight: 900;
}

.overview-day {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fbfcff;
}

.overview-day-body {
  display: grid;
  align-content: start;
}

.overview-day-head {
  padding: 8px;
  background: #2e741f;
  color: #fff;
}

.overview-day-head strong,
.overview-day-head span {
  display: block;
}

.overview-day-head span {
  font-size: 0.74rem;
  font-weight: 800;
  opacity: 0.92;
}

.overview-cell {
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 7px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.overview-cell:nth-child(even) {
  background: #f5f9f3;
}

.overview-cell strong {
  font-size: 0.8rem;
  line-height: 1.15;
}

.overview-cell .overview-time {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.overview-cell p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.22;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.overview-support-cell {
  min-height: 48px;
  background: #eeeeee !important;
  border-top-color: #b9c1cf;
}

.overview-support-cell strong {
  color: var(--teal-dark);
}

.overview-support-cell p {
  display: block;
  -webkit-line-clamp: unset;
}

.overview-cell button {
  width: fit-content;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  background: #eef3fb;
  color: var(--teal-dark);
  font-size: 0.72rem;
  font-weight: 900;
}

.overview-resource-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.overview-resource-chip {
  display: inline-flex;
  min-height: 27px;
  max-width: 100%;
  align-items: center;
  padding: 0 8px;
  border-radius: 8px;
  background: #e8f2ff;
  color: var(--teal-dark);
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 2px 0 #c7d8f0;
}

.overview-resource-chip:hover {
  transform: translateY(1px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 1px 0 #c7d8f0;
}

.overview-empty {
  grid-column: 1 / -1;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
  background: #fbfcff;
}

.empty-cell {
  min-height: 54px;
  color: var(--muted);
  font-weight: 900;
}

.week-grid-wrap {
  margin-top: 14px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.week-grid-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.week-grid-table th,
.week-grid-table td {
  border: 1px solid var(--line);
  vertical-align: top;
  padding: 0;
}

.week-grid-table col.week-grid-time-col {
  width: 96px;
}

.week-grid-day-head {
  padding: 8px;
  background: #2e741f;
  color: #fff;
  font-weight: 900;
  text-align: left;
}

.week-grid-day-head span {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  opacity: 0.92;
}

.week-grid-day-select {
  width: 100%;
  margin-top: 4px;
  padding: 2px 4px;
  border-radius: 6px;
  font-size: 0.68rem;
}

.week-grid-time-label {
  padding: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  background: #fbfcff;
  white-space: nowrap;
}

.week-grid-cell {
  min-width: 0;
}

.week-grid-cell-inner {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  height: 100%;
  min-height: 60px;
  padding: 7px 8px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
}

.week-grid-cell-inner:hover {
  background: #f5f9f3;
}

.week-grid-cell-text {
  flex: 1;
  min-width: 0;
}

.week-grid-cell-text strong {
  display: block;
  font-size: 0.8rem;
  line-height: 1.15;
}

.week-grid-cell-text p {
  display: -webkit-box;
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.week-grid-edit-icon {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 13px;
}

.week-grid-cell-empty {
  color: var(--muted);
  font-weight: 800;
  font-size: 0.72rem;
}

.week-grid-cell-support {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 4px;
}

.support-tag {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: normal;
}

.support-tag-esol {
  background: var(--sky);
  color: var(--teal);
}

.support-tag-enhancement {
  background: var(--gold, var(--soft-surface));
  color: var(--ink);
}

.support-tag-ta {
  background: #cdeccd;
  color: #14532d;
}

.support-cell-ta-label,
.support-cell .support-cell-ta {
  color: #14532d;
}

.support-picker-ta {
  border-left: 3px solid #cdeccd;
  padding-left: 12px;
}

.support-ta-name {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.support-ta-name input {
  width: 100%;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
}

.week-grid-support-row .week-grid-cell-inner {
  background: #eeeeee;
}

.cell-editor-card {
  width: min(420px, 92vw);
}

.cell-editor-mode-row {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}

.cell-editor-mode-row button {
  flex: 1;
}

.cell-editor-mode-row button.active-mode {
  background: var(--teal);
  color: #fff;
}

.cell-editor-resources {
  margin-top: 12px;
}

.cell-editor-resource-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.cell-editor-resource-row input {
  flex: 1;
}

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

.detail-link-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbf4;
}

.detail-link-panel h4 {
  margin: 0;
  color: var(--teal-dark);
  font-size: 1.05rem;
  letter-spacing: 0;
}

.resource-chip {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 12px;
  border-radius: 8px;
  background: #eef6ed;
  color: var(--teal-dark);
  font-weight: 900;
  text-decoration: none;
}

.floating-detail {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 26, 63, 0.34);
}

.floating-detail[hidden] {
  display: none;
}

.floating-detail-card {
  width: min(720px, 94vw);
  max-height: 82vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

#weekDetailBody {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.page-help-card {
  width: min(480px, 92vw);
}

.page-help-body {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
}

.page-help-dismiss {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
}

.page-help-dismiss input {
  width: 18px;
  height: 18px;
}

.theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.theme-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.theme-option:has(input:checked) {
  border-color: var(--teal-dark);
  background: var(--sky);
}

.theme-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.theme-swatch {
  display: inline-block;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 50%;
}

.theme-swatch-default { background: linear-gradient(135deg, #00247d 50%, #cc142b 50%); }
.theme-swatch-rose { background: linear-gradient(135deg, #9c1648 50%, #ff6f91 50%); }
.theme-swatch-forest { background: linear-gradient(135deg, #134d2e 50%, #e08a2c 50%); }
.theme-swatch-ocean { background: linear-gradient(135deg, #084a5c 50%, #ef7b45 50%); }
.theme-swatch-tropical { background: conic-gradient(from 90deg, #ffcc29 0deg 120deg, #002776 120deg 240deg, #046a38 240deg 360deg); }
.theme-swatch-slate { background: linear-gradient(135deg, #232c3a 50%, #6b7686 50%); }

#weekDetailBody pre {
  white-space: pre-wrap;
  margin: 0;
  color: var(--muted);
  font: inherit;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.sticky-save-row {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0), var(--panel) 35%);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(420px, 1.15fr);
  gap: 18px;
  max-width: 1480px;
  margin: 0 auto;
  align-items: start;
}

.settings-grid-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.lesson-library-shell {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(460px, 1.18fr);
  gap: 18px;
  max-width: 1480px;
}

.lesson-library-form,
.lesson-library-tools,
.lesson-plan-list {
  display: grid;
  gap: 12px;
}

.lesson-library-meta,
.lesson-library-tools {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lesson-library-tools {
  align-items: end;
}

.lesson-library-tools button,
.lesson-library-search {
  grid-column: 1 / -1;
}

.lesson-plan-list {
  max-height: calc(100vh - 270px);
  overflow: auto;
  padding-right: 4px;
}

.lesson-plan-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f7f9fd);
}

.lesson-plan-card h3 {
  margin: 0 0 8px;
}

.lesson-plan-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
  white-space: pre-line;
}

.lesson-plan-card-actions {
  display: grid;
  align-content: start;
  gap: 9px;
  min-width: 110px;
}

.lesson-settings-panel,
.student-settings-panel {
  grid-column: 1 / -1;
}

.settings-form {
  display: grid;
  gap: 10px;
}

.secondary-link {
  color: var(--teal-dark);
  font-size: 0.86rem;
  font-weight: 900;
}

.daily-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.25fr) minmax(300px, 1fr);
  gap: 18px;
  max-width: 1480px;
  margin: 0 auto;
  align-items: start;
}

.conference-panel {
  grid-column: span 2;
}

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

.panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel h2,
.visual-copy h2,
.lesson-doc-form h3 {
  font-size: 1.32rem;
  line-height: 1.25;
}

.lesson-doc-form h3 {
  margin: 0;
}

.icon-button,
.text-button,
.quick-form button,
.upload-form button,
.google-form button,
.settings-form button,
.lesson-doc-form button {
  min-height: 38px;
  border-radius: 8px;
  color: var(--button-ink);
  background:
    linear-gradient(180deg, var(--button-highlight), rgba(255, 255, 255, 0) 45%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.08) 0 2px, rgba(255,255,255,0) 2px 5px),
    var(--teal);
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.32), 0 3px 0 var(--teal-dark), 0 8px 16px var(--button-shadow);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  place-items: center;
  flex: 0 0 auto;
}

.text-button {
  padding: 0 13px;
}

.icon-button:hover,
.text-button:hover,
.quick-form button:hover,
.upload-form button:hover,
.google-form button:hover,
.settings-form button:hover,
.lesson-doc-form button:hover {
  background: var(--teal-dark);
}

.icon-button:active,
.text-button:active,
.quick-form button:active,
.upload-form button:active,
.google-form button:active,
.settings-form button:active,
.lesson-doc-form button:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 0 var(--teal-dark), 0 5px 10px var(--button-shadow);
}

.secondary-button {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.84), rgba(255,255,255,0.2)),
    repeating-linear-gradient(135deg, rgba(0,36,125,0.04) 0 2px, rgba(0,36,125,0) 2px 5px),
    #e7edf8 !important;
  color: var(--teal-dark) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 3px 0 #c4d0e7, 0 8px 16px rgba(0,24,79,0.12) !important;
}

.secondary-button:hover {
  background: #dce5f5 !important;
}

.counter {
  min-width: 68px;
  padding: 7px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, var(--sky));
  color: var(--teal-dark);
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
}

.agenda-panel {
  grid-row: span 2;
}

.schedule {
  display: grid;
  gap: 10px;
}

.schedule-row {
  display: grid;
  grid-template-columns: 76px 1fr 38px;
  gap: 8px;
  align-items: center;
}

.time-input,
.block-input,
.quick-form input,
label input,
label select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.time-input,
.block-input,
.quick-form input,
label input,
label select {
  min-height: 42px;
  padding: 0 12px;
}

.time-input {
  color: var(--teal-dark);
  font-weight: 800;
}

.remove-block {
  background: #eef4f1;
  color: var(--muted);
}

.remove-block:hover {
  background: #e2e9e5;
  color: var(--ink);
}

.visual-panel {
  min-height: 372px;
}

.visual-panel img {
  display: block;
  width: 100%;
  height: 278px;
  object-fit: cover;
}

.visual-copy {
  padding: 18px;
  border-top: 1px solid var(--line);
  background: #f4f7fd;
}

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

#classroomForm,
#teacherInviteForm {
  grid-template-columns: 1fr;
}

.task-form-details {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.task-form-details label,
.task-subtasks-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.task-repeat-toggle {
  min-height: 42px;
  grid-template-columns: auto 1fr;
  align-items: center;
  align-self: end;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdfb;
  color: var(--ink);
}

.task-repeat-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.task-repeat-days {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.task-repeat-days label {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border-radius: 8px;
  background: #eef4f1;
  color: var(--ink);
  font-size: 0.78rem;
}

.task-repeat-days input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.task-subtasks-field {
  grid-column: 1 / -1;
}

.task-subtasks-field textarea {
  min-height: 58px;
  padding: 10px 12px;
}

.upload-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 10px;
  align-items: end;
}

.google-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.lesson-doc-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.lesson-doc-grid {
  display: grid;
  gap: 10px;
}

.lesson-doc-grid label {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: stretch;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.lesson-doc-grid strong {
  font-size: 0.92rem;
  font-weight: 900;
}

.lesson-doc-grid input {
  min-height: 46px;
}

.lesson-doc-grid button {
  justify-self: stretch;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.file-picker {
  min-width: 0;
}

.file-picker input {
  padding-top: 10px;
}

.status-line {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.sync-line {
  margin-top: 6px;
}

.planner-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

/* ---- Day / week timeline ------------------------------------------------ */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.view-toggle-button {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
}

.view-toggle-button.active {
  background: var(--teal);
  color: var(--button-ink);
}

.day-timeline-wrap {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.day-now-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
}

.day-now-line span:last-child {
  color: var(--muted);
  font-weight: 700;
}

.day-now-line.is-quiet {
  color: var(--muted);
  font-weight: 700;
}

.day-now-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 3px rgba(204, 20, 43, 0.18);
}

.day-timeline {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

.day-timeline-hours {
  position: relative;
  height: 15px;
  min-width: 620px;
}

.day-hour {
  position: absolute;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  white-space: nowrap;
}

.day-timeline-track {
  position: relative;
  height: 58px;
  min-width: 620px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-surface);
  overflow: hidden;
}

.day-timeline.is-compact .day-timeline-track {
  height: 30px;
}

.day-timeline-elapsed {
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(0, 36, 125, 0.09);
  pointer-events: none;
}

.day-block {
  position: absolute;
  top: 4px;
  bottom: 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  overflow: hidden;
  padding: 3px 6px;
  border: 1px solid rgba(0, 24, 79, 0.16);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  text-align: left;
}

a.day-block:hover {
  border-color: var(--teal);
  box-shadow: 0 2px 8px rgba(0, 24, 79, 0.18);
}

.day-block-title {
  overflow: hidden;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-block-time {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  white-space: nowrap;
}

.day-timeline.is-compact .day-block-title {
  font-size: 0.64rem;
}

.day-block.is-done {
  opacity: 0.55;
}

.day-block.is-now {
  border-color: var(--coral);
  box-shadow: 0 0 0 2px rgba(204, 20, 43, 0.22);
}

.day-block-break {
  border-style: dashed;
  background: repeating-linear-gradient(135deg, rgba(0, 24, 79, 0.05) 0 4px, transparent 4px 8px), var(--panel);
  color: var(--muted);
}

.day-block-maths { background: #e3f0ff; }
.day-block-reading { background: #e6f7ec; }
.day-block-writing { background: #fdf0dc; }
.day-block-integrated { background: #f0e9fb; }
.day-block-pe { background: #ffe9e9; }
.day-block-specialist { background: #eceff4; }
.day-block-tereo { background: #e9f6f8; }
.day-block-assembly { background: #f4f2e3; }
.day-block-roll { background: #f2f5fa; }

.day-timeline-now {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--coral);
  pointer-events: none;
}

.day-timeline-now span {
  position: absolute;
  top: 1px;
  left: 3px;
  padding: 0 3px;
  border-radius: 3px;
  background: var(--coral);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 900;
  white-space: nowrap;
}

/* Week view: days across the top, clock running down - same shape as the
   paper weekly planning sheet. */
.week-vertical {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 6px;
  overflow-x: auto;
}

.week-vertical-gutter {
  display: grid;
  grid-template-rows: auto 1fr;
}

.week-hours {
  position: relative;
  height: 520px;
}

.week-hour {
  position: absolute;
  right: 4px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  white-space: nowrap;
}

.week-vertical-days {
  display: grid;
  grid-template-columns: repeat(5, minmax(118px, 1fr));
  gap: 6px;
  min-width: 620px;
}

.week-vday-head {
  display: grid;
  gap: 1px;
  min-height: 34px;
  padding-bottom: 5px;
  text-align: center;
}

.week-vday-head strong {
  font-size: 0.78rem;
}

.week-vday-head small {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
}

.week-vday.is-today .week-vday-head strong {
  color: var(--coral);
}

.week-vday-track {
  position: relative;
  height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-surface);
  overflow: hidden;
}

.week-vday.is-today .week-vday-track {
  border-color: var(--coral);
}

.week-vday-elapsed {
  position: absolute;
  inset: 0 0 auto 0;
  background: rgba(0, 36, 125, 0.09);
  pointer-events: none;
}

.week-vday-now {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--coral);
  pointer-events: none;
}

.week-vblock {
  right: 4px;
  bottom: auto;
  left: 4px;
  top: 0;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 3px 5px;
}

.week-vblock .day-block-title {
  white-space: normal;
}

.day-block-support {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 2px;
  overflow: hidden;
}

.day-block-support .support-tag {
  max-width: 100%;
  overflow: hidden;
  padding: 0 4px;
  font-size: 0.58rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Names stay on one line and ellipsis away rather than spilling over the block
   below - the block's tooltip carries the full list. */
.day-block-support .support-tag {
  display: block;
  width: 100%;
}

.imported-timeline,
.resource-list {
  display: grid;
  gap: 9px;
}

.imported-item,
.resource-item {
  display: grid;
  gap: 8px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f7f9fd);
}

.imported-item {
  grid-template-columns: 78px 1fr;
}

.imported-item.break {
  background: #eef2f9;
}

.imported-item.support {
  background: #eeeeee;
  border-color: #b9c1cf;
}

.imported-item.support strong {
  color: var(--teal-dark);
}

.imported-item.support p {
  color: var(--ink);
  font-weight: 800;
}

.imported-time {
  color: var(--teal-dark);
  font-size: 0.86rem;
  font-weight: 900;
}

.imported-item strong,
.resource-item strong {
  display: block;
  margin-bottom: 4px;
}

.imported-item p,
.resource-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
  white-space: pre-line;
}

.resource-item a,
.imported-item a,
.link-button {
  justify-self: start;
  color: var(--teal-dark);
  font-size: 0.86rem;
  font-weight: 900;
  text-decoration: none;
}

.resource-item a:hover,
.imported-item a:hover,
.link-button:hover {
  text-decoration: underline;
}

.link-button {
  display: inline-flex;
  align-items: center;
  background: var(--sky);
}

.link-button:hover {
  background: #dce5f5;
}

.resource-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.resource-links a,
.resource-links span,
.missing-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #e7edf8;
}

.resource-links a,
.resource-button {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.28), rgba(255,255,255,0) 44%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.09) 0 2px, rgba(255,255,255,0) 2px 5px),
    var(--teal);
  color: var(--button-ink) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 3px 0 var(--teal-dark), 0 8px 15px rgba(0,24,79,0.18);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.resource-links a:hover,
.resource-button:hover {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0) 44%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.08) 0 2px, rgba(255,255,255,0) 2px 5px),
    var(--teal-dark);
  text-decoration: none;
}

.resource-links a:active,
.resource-button:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 0 var(--teal-dark), 0 5px 10px rgba(0,24,79,0.18);
}

.resource-links span,
.missing-link {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.lesson-plan-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-top: 9px;
  padding: 0 11px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, var(--button-highlight), rgba(255,255,255,0) 45%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.08) 0 2px, rgba(255,255,255,0) 2px 5px),
    var(--coral);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.32), 0 3px 0 #8e0f20, 0 8px 16px rgba(204,20,43,0.2);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.lesson-plan-button:hover {
  background: #a90f24;
  text-decoration: none;
}

.lesson-plan-button:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 0 #8e0f20, 0 5px 10px rgba(204,20,43,0.18);
}

.teacher-notes-panel {
  grid-column: 1 / -1;
}

.apps-script-box {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

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

.teacher-note-card {
  display: grid;
  gap: 8px;
}

.teacher-note-card textarea {
  min-height: 145px;
}

.task-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-alerts {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.task-alert {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid #f2bf76;
  border-radius: 8px;
  background: #fff2da;
  color: #5d3505;
}

.task-alert.overdue {
  border-color: #f4aaa6;
  background: #ffe1df;
  color: #7b0909;
}

.task-alert strong,
.task-alert span {
  display: block;
}

.task-alert span {
  margin-top: 2px;
  font-size: 0.84rem;
  font-weight: 800;
}

.task-alert button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}

.compact-heading {
  margin: 18px 0 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.student-form {
  margin-bottom: 10px;
}

.student-list {
  display: grid;
  gap: 7px;
}

.settings-student-list {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

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

.admin-row-actions select,
.admin-row-actions input {
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.class-student-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdfb;
}

.class-student-row.admin-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.class-student-row.admin-row.invite-edit-row {
  grid-template-columns: 1fr;
}

.invite-edit-row .admin-row-actions input {
  flex: 1 1 130px;
}

.invite-edit-row .admin-row-actions input[data-invite-email] {
  flex: 1 1 200px;
}

.class-student-row strong {
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.task-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.task-summary-bar:hover {
  border-color: rgba(0, 36, 125, 0.35);
}

.task-summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
}

.task-summary-stat {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.task-summary-stat strong {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 900;
}

.task-summary-stat.overdue strong { color: #b40d18; }
.task-summary-stat.today strong { color: #9b5200; }
.task-summary-stat.soon strong { color: #7a3a00; }
.task-summary-stat.leadership strong { color: var(--teal-dark); }

.task-summary-open {
  color: var(--teal-dark);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.task-full-card {
  width: min(1600px, 100%);
  max-height: 100%;
  overflow-y: auto;
}

.task-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  align-items: start;
}

.task-compose-card,
.task-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfdfb;
}

.task-compose-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.task-compose-card .task-form-details {
  display: none;
}

.task-compose-card.expanded {
  grid-column: span 2;
}

.task-compose-card.expanded .task-form-details {
  display: grid;
}

.task-card {
  grid-template-columns: 26px minmax(0, 1fr) 26px;
  align-items: start;
}

.task-tick {
  display: block;
  position: relative;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  padding: 0;
}

.task-tick input[type="checkbox"] {
  position: absolute;
  width: 20px;
  height: 20px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.task-tick-mark {
  display: block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--muted);
  border-radius: 50%;
}

.task-priority-urgent .task-tick-mark { border-color: #b40d18; }
.task-priority-high .task-tick-mark { border-color: #d97316; }
.task-priority-low .task-tick-mark { border-color: #7d8ba5; }
.leadership-card .task-tick-mark { border-color: var(--teal-dark); }

.task-tick input:checked + .task-tick-mark {
  border-color: var(--teal);
  background: var(--teal);
}

.task-tick input:checked + .task-tick-mark::after {
  content: "";
  display: block;
  width: 5px;
  height: 10px;
  margin: 2px auto 0;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.task-tick input:focus-visible + .task-tick-mark {
  outline: 2px solid var(--teal-dark);
  outline-offset: 2px;
}

.subtask-block summary {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
}

.leadership-tag {
  color: var(--teal-dark);
  font-weight: 900;
}

.task-parse-hint {
  margin: 0;
  padding: 6px 8px;
  border-radius: 6px;
  background: #eef4f1;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.task-parse-hint strong {
  color: var(--ink);
}

.task-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.task-tag {
  padding: 1px 7px;
  border-radius: 999px;
  background: #eef4f1;
  color: var(--teal-dark);
  font-size: 0.72rem;
  font-weight: 900;
}

.subtask-list .subtask-list {
  margin-left: 20px;
  padding-left: 8px;
  border-left: 2px solid var(--line);
}

.subtask-nest-add {
  margin-left: 22px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  box-shadow: none;
}

.subtask-nest-add:hover {
  color: var(--teal-dark);
}

.task-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.matrix-quadrant {
  padding: 12px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--muted);
  border-radius: 10px;
  background: #fcfdfb;
}

.matrix-do { border-top-color: #b40d18; }
.matrix-schedule { border-top-color: var(--teal-dark); }
.matrix-delegate { border-top-color: #d97316; }
.matrix-drop { border-top-color: #7d8ba5; }

.matrix-heading h4 {
  margin: 0;
  font-size: 0.98rem;
}

.matrix-heading span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.matrix-quadrant ul {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.matrix-quadrant li {
  display: grid;
  gap: 2px;
  padding: 7px 9px;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.matrix-quadrant li span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.matrix-empty {
  background: transparent !important;
  box-shadow: none !important;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.focus-timer {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 24px 12px;
}

.focus-timer-display {
  font-size: clamp(2.6rem, 9vw, 4.6rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.focus-timer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  justify-content: center;
}

.focus-timer-controls input {
  width: 88px;
}

.shared-lists {
  display: grid;
  gap: 12px;
}

.shared-list-create,
.shared-task-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shared-list-create input,
.shared-task-form input[type="text"] {
  flex: 1 1 200px;
  min-width: 0;
}

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

.shared-list-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfdfb;
}

.shared-list-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: start;
  justify-content: space-between;
}

.shared-list-head h4 {
  margin: 0;
}

.shared-list-head span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.shared-list-head-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.shared-list-body {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.shared-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.shared-member {
  padding: 2px 9px;
  border-radius: 999px;
  background: #eef4f1;
  color: var(--teal-dark);
  font-size: 0.76rem;
  font-weight: 900;
}

.shared-task-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shared-task-list li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 26px;
  gap: 8px;
  align-items: start;
  padding: 8px;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.shared-task-list li.done strong {
  color: var(--muted);
  text-decoration: line-through;
}

.shared-task-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.shared-comments summary {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  cursor: pointer;
}

.shared-comment {
  margin: 4px 0 0;
  font-size: 0.82rem;
}

.shared-comment-form {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.shared-comment-form input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 32px;
  font-size: 0.82rem;
}

/* --- Wheel of names --- */
.wheel-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 18px;
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
}

.wheel-panel {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.wheel-panel .panel-heading {
  width: 100%;
}

.wheel-stage {
  position: relative;
  width: min(560px, 100%);
  aspect-ratio: 1;
}

.wheel-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  border-radius: 50%;
  filter: drop-shadow(0 10px 22px rgba(0, 24, 79, 0.22));
}

.wheel-pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  z-index: 3;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-top: 30px solid var(--coral, #d92d2d);
  border-right: 15px solid transparent;
  border-left: 15px solid transparent;
  filter: drop-shadow(0 2px 3px rgba(0, 24, 79, 0.35));
}

.wheel-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 21%;
  height: 21%;
  transform: translate(-50%, -50%);
  border: 4px solid #fff;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff, #eef3fb);
  color: var(--ink);
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #c8d3e6, 0 10px 20px rgba(0, 24, 79, 0.2);
  transition: transform 120ms ease;
}

.wheel-hub:hover {
  transform: translate(-50%, -50%) scale(1.05);
}

.wheel-hub:active {
  transform: translate(-50%, -50%) scale(0.97);
}

.wheel-hub[disabled] {
  cursor: default;
  opacity: 0.65;
}

.wheel-result {
  display: grid;
  gap: 2px;
  min-height: 54px;
  margin: 0;
  text-align: center;
}

.wheel-result strong {
  font-size: clamp(1.5rem, 4vw, 2.3rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.wheel-result-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.wheel-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.wheel-result-actions:empty {
  display: none;
}

.wheel-result-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

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

.wheel-colour-list summary {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
  cursor: pointer;
}

.wheel-colour-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 5px;
  max-height: 260px;
  margin-top: 8px;
  padding: 4px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.wheel-colour-chip {
  padding: 6px 4px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  box-shadow: none;
  overflow-wrap: anywhere;
}

.wheel-colour-chip:hover {
  outline: 2px solid var(--ink);
}

.wheel-group-list {
  display: grid;
  gap: 5px;
  max-height: 240px;
  margin: 8px 0;
  overflow-y: auto;
}

.wheel-group-row {
  display: grid;
  grid-template-columns: auto 16px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdfb;
  color: var(--ink);
  font-size: 0.84rem;
  cursor: pointer;
}

.wheel-group-swatch {
  width: 16px;
  height: 16px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

.wheel-group-name {
  font-weight: 900;
  overflow-wrap: anywhere;
}

.wheel-group-detail {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

/* --- Weather --- */
.weather-widget[hidden] {
  display: none;
}

.weather-link {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f1f5fb);
  color: var(--ink);
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 3px 0 #c8d3e6;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.weather-link:hover {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 4px 0 #bac8de, 0 10px 18px rgba(0, 24, 79, 0.1);
}

.weather-link:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.75), 0 1px 0 #bac8de;
}

.weather-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.weather-readout {
  display: grid;
  gap: 1px;
  line-height: 1.15;
}

.weather-readout strong {
  font-size: 1.05rem;
}

.weather-readout small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

/* --- Field trip groups --- */
.fieldtrip-shell {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
  align-items: start;
  max-width: 1400px;
  margin: 0 auto;
}

.parent-rows {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.parent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 30px;
  gap: 8px;
  align-items: center;
}

.fieldtrip-toggle {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 850;
}

.fieldtrip-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.fieldtrip-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.fieldtrip-group {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--teal-dark);
  border-radius: 10px;
  background: #fcfdfb;
}

.fieldtrip-group-head {
  display: flex;
  gap: 8px;
  align-items: start;
  justify-content: space-between;
}

.fieldtrip-group-head h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.fieldtrip-students {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.seating-student-chip.is-pinned {
  outline: 2px solid var(--teal-dark);
  font-weight: 900;
}

@media (max-width: 980px) {
  .fieldtrip-shell {
    grid-template-columns: 1fr;
  }
}

@media print {
  .topbar,
  .parent-rows,
  .button-row,
  .compact-heading,
  .heading-actions,
  .floating-menu {
    display: none !important;
  }

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

  .fieldtrip-group {
    break-inside: avoid;
  }
}

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

.wheel-names-field textarea {
  min-height: 240px;
  font-family: inherit;
}

.wheel-edit-buttons {
  flex-wrap: wrap;
}

.danger-text {
  color: #b40d18;
}

@media (max-width: 980px) {
  .wheel-shell {
    grid-template-columns: 1fr;
  }
}

.task-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.task-title-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.task-title-line strong {
  overflow-wrap: anywhere;
}

.task-card.done .task-title-line strong {
  color: var(--muted);
  text-decoration: line-through;
}

.priority-pill {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef4f1;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.priority-pill.urgent {
  background: #ffd8d5;
  color: #b40d18;
}

.priority-pill.high {
  background: #ffe4c9;
  color: #7a3a00;
}

.priority-pill.low {
  background: #edf2fb;
  color: #51617e;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.task-due-soon {
  color: #9b5200;
}

.task-overdue {
  color: #b40d18;
}

.subtask-list {
  display: grid;
  gap: 4px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.subtask-list label {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.subtask-list input[type="checkbox"] {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
}

.subtask-list .done span {
  text-decoration: line-through;
}

.subtask-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  gap: 6px;
}

.subtask-add-row input {
  min-height: 32px;
  padding: 0 9px;
  font-size: 0.82rem;
}

.task-compose-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}

.task-link-rows {
  display: grid;
  gap: 6px;
}

.task-member-breakdown {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  margin-top: 4px;
}

.task-member-breakdown summary {
  cursor: pointer;
  color: var(--text-muted, #666);
}

.task-member-breakdown ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.task-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.task-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 2px 4px 2px 0;
}

.subtask-add-row button {
  min-height: 32px;
  border-radius: 8px;
  background: #eef4f1;
  color: var(--ink);
  font-size: 0.78rem;
  box-shadow: none;
}

.mini-remove {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.mini-remove:hover {
  background: #f0eee8;
  color: var(--ink);
}

.pulse-panel {
  grid-column: 1 / -1;
}

.message-panel {
  grid-row: span 2;
}

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

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

.conference-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f7f9fd);
}

.conference-row strong,
.conference-row span {
  display: block;
}

.conference-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.3;
}

.conference-row button {
  min-height: 36px;
  padding: 0 11px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.82), rgba(255,255,255,0.18)),
    repeating-linear-gradient(135deg, rgba(0,36,125,0.04) 0 2px, rgba(0,36,125,0) 2px 5px),
    #e7edf8;
  color: var(--teal-dark);
  font-size: 0.8rem;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.86), 0 3px 0 #c4d0e7, 0 8px 16px rgba(0,24,79,0.1);
}

.student-chip {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdfb;
}

.student-chip strong {
  font-size: 0.94rem;
}

.mood-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(66px, 1fr));
  gap: 8px;
}

.mood-row button {
  min-height: 38px;
  padding: 0 8px;
  border-radius: 8px;
  background: #edf3f0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.student-chip[data-mood="green"] .green,
.student-chip[data-mood="red"] .red,
.student-chip[data-mood="blue"] .blue,
.student-chip[data-mood="yellow"] .yellow {
  color: #fff;
}

.student-chip[data-mood="green"] .green {
  background: #22c55e;
}

.student-chip[data-mood="red"] .red {
  background: #ef4444;
}

.student-chip[data-mood="blue"] .blue {
  background: #3b82f6;
}

.student-chip[data-mood="yellow"] .yellow {
  background: #eab308;
  color: #172238;
}

.mood-key,
.mood-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.zone-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 5px;
  border-radius: 50%;
  vertical-align: -1px;
}

.zone-dot.green {
  background: #22c55e;
}

.zone-dot.red {
  background: #ef4444;
}

.zone-dot.blue {
  background: #3b82f6;
}

.zone-dot.yellow {
  background: #facc15;
}

.mood-summary {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.mood-pie {
  width: 112px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: conic-gradient(#22c55e 0 100%);
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.55);
}

.mood-legend {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mood-history-panel {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.mood-history-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.mood-history-heading h3 {
  margin: 0;
  font-size: 1.12rem;
}

.mood-history-heading label {
  min-width: 210px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.mood-history-heading select {
  width: 100%;
  min-height: 38px;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.mood-history {
  display: grid;
  gap: 9px;
}

.mood-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(240px, 0.9fr);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f8fafd);
}

.mood-history-row.compact {
  grid-template-columns: minmax(0, 1fr) auto;
}

.mood-history-row strong,
.mood-history-row span {
  display: block;
}

.mood-history-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.mood-history-counts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
}

.mood-badge {
  min-width: 88px;
  padding: 7px 10px;
  border-radius: 8px;
  color: #fff !important;
  text-align: center;
  font-size: 0.82rem !important;
  font-weight: 900 !important;
}

.mood-badge.green {
  background: #22c55e;
}

.mood-badge.red {
  background: #ef4444;
}

.mood-badge.blue {
  background: #3b82f6;
}

.mood-badge.yellow {
  background: #eab308;
  color: #172238 !important;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

textarea,
.generated-box,
.large-note {
  line-height: 1.5;
}

textarea {
  min-height: 136px;
  padding: 12px;
  resize: vertical;
}

.generated-box {
  min-height: 190px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--coral);
  border-radius: 8px;
  background: #fffaf6;
  color: #314045;
  white-space: pre-line;
}

.large-note {
  min-height: 130px;
  margin: 0;
  padding: 16px;
  border-radius: 8px;
  background: #eff7f3;
  color: #20383b;
  font-size: 1.05rem;
}

.summary-panel {
  grid-column: span 2;
}

.lesson-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 48px) 46px;
}

.lesson-main,
.lesson-side {
  display: grid;
  gap: 18px;
  align-content: start;
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.lesson-meta span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 4px 9px;
  border-radius: 8px;
  background: #eef4f1;
  color: var(--teal-dark);
  font-size: 0.8rem;
  font-weight: 900;
}

.lesson-plan-copy {
  min-height: 360px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: 8px;
  background: #fffdf8;
  color: #304146;
  line-height: 1.55;
  white-space: pre-line;
}

/* Definitions come from the school's own Year 7 tracking sheet, so the two
   ratings mean the same thing here as they do on the paper version. */
.rating-key {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-surface, #f8fafd);
}

.rating-key-item {
  display: grid;
  grid-template-columns: minmax(88px, auto) 1fr;
  gap: 4px 12px;
  align-items: baseline;
}

.rating-key dt {
  margin: 0;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
}

.rating-key dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.rating-key-scale {
  display: block;
  margin-top: 2px;
  font-size: 0.74rem;
  font-weight: 700;
  opacity: 0.85;
}

@media (max-width: 540px) {
  .rating-key-item {
    grid-template-columns: 1fr;
  }
}

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

.assessment-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(140px, 0.75fr) minmax(150px, 0.8fr);
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdfb;
}

.assessment-row strong {
  align-self: center;
  overflow-wrap: anywhere;
}

.progress-shell {
  max-width: 1680px;
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 48px) 46px;
}

.progress-controls {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(180px, 260px) minmax(260px, 1fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.progress-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 900;
}

.progress-controls select {
  width: 100%;
}

.progress-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.export-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 8px;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.09) 0 5px, rgba(255, 255, 255, 0) 5px 10px),
    #001f5b;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.35), 0 12px 24px rgba(0, 31, 91, 0.16);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.export-button:hover {
  transform: translateY(-1px);
}

.export-button.is-busy {
  opacity: 0.78;
  pointer-events: none;
}

.export-status {
  min-width: 108px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  text-align: right;
}

.export-status a {
  color: var(--teal-dark);
  text-decoration: underline;
}

.progress-board {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  max-height: 74vh;
}

.progress-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

.progress-table th,
.progress-table td {
  min-width: 124px;
  max-width: 240px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

.progress-table thead th {
  background: #eef3fb;
}

/* Rating widgets: every option sits visible at once, so setting a value is a
   single click rather than opening a menu first. Shared by the lesson page's
   assessment rows and the Progress page's table cells. */
.rating-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.rating-btn {
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafd;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.rating-btn:hover {
  border-color: var(--teal);
}

.rating-btn-mastered.is-active {
  border-color: #08733c;
  background: #dcf8d2;
  color: #08733c;
}

.rating-btn-developing.is-active {
  border-color: #6b3302;
  background: #ffd3b8;
  color: #6b3302;
}

.rating-btn-support.is-active {
  border-color: #b00000;
  background: #ffd0cd;
  color: #b00000;
}

.rating-btn-na.is-active {
  border-color: #53627d;
  background: #e8edf3;
  color: #53627d;
}

.rating-stars {
  display: flex;
  align-items: center;
  gap: 2px;
}

.star-btn {
  min-width: 26px;
  min-height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #d7dce6;
  font-size: 1.05rem;
  line-height: 1;
}

.star-btn.is-filled {
  color: #f2b705;
}

.star-btn:hover {
  color: #f2b705;
  opacity: 0.75;
}

.star-btn-na {
  min-width: auto;
  margin-left: 4px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafd;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.star-btn-na.is-active {
  border-color: #53627d;
  background: #e8edf3;
  color: #53627d;
}

.rating-field {
  display: grid;
  gap: 4px;
}

.rating-field-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.progress-date-input {
  width: 100%;
  min-width: 122px;
  min-height: 32px;
  border: 1px solid rgba(0, 36, 125, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.2)),
    #fffdf1;
  color: var(--teal-dark);
  font-size: 0.8rem;
  font-weight: 900;
}

.comment-button {
  width: 100%;
  min-width: 116px;
  min-height: 32px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, var(--button-highlight), rgba(255, 255, 255, 0) 42%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.08) 0 2px, rgba(255,255,255,0) 2px 5px),
    var(--teal);
  color: var(--button-ink);
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.32), 0 3px 0 var(--teal-dark), 0 7px 14px var(--button-shadow);
}

.comment-button:disabled {
  cursor: default;
  background: #edf1f7;
  color: #8a96aa;
  box-shadow: none;
}

.note-dialog[hidden] {
  display: none;
}

.note-dialog {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}

.note-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 26, 63, 0.44);
}

.note-dialog-panel {
  position: relative;
  width: min(680px, 92vw);
  max-height: min(680px, 82vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 24, 79, 0.28);
}

.note-dialog-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafd;
}

.note-dialog-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.note-dialog-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #edf1f7;
  color: var(--ink);
  font-weight: 900;
}

.note-dialog-body {
  padding: 18px;
  color: #253241;
  font-size: 1rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.unlock-master-card {
  width: min(620px, 94vw);
}

.unlock-master-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.matrix-table .matrix-title-row th {
  background: #434343;
  color: #fff;
  text-align: center;
  text-transform: uppercase;
}

.matrix-title-cell {
  font-size: 1rem;
  line-height: 1.25;
}

.matrix-title-main {
  font-size: 1.45rem;
  letter-spacing: 0;
}

.track-header {
  background: #c27ba0 !important;
  color: #303030;
  font-size: 0.9rem;
  line-height: 1.25;
  text-align: center;
}

.li-header {
  height: 82px;
  background: #ead1dc !important;
  color: #172238;
  font-size: 0.82rem;
  line-height: 1.25;
}

.date-taught,
.date-blank,
.notes-present,
.notes-blank {
  height: 44px;
  text-align: center;
}

.date-taught {
  background: #fff7d7 !important;
  color: var(--teal-dark);
  font-weight: 900;
}

.date-blank {
  background: #f4f6fa !important;
}

.notes-present {
  background: #e9f0ff !important;
}

.notes-blank {
  background: #f8fafd !important;
}

.progress-table tbody th,
.progress-table .student-head {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 160px;
  background: #f8fafd;
  color: var(--ink);
}

.progress-table .student-head {
  z-index: 2;
  font-weight: 900;
}

.matrix-table tbody td:empty {
  background: #fbfcff;
}

.matrix-table tbody th,
.matrix-table tbody td {
  height: 42px;
  vertical-align: middle;
}

.sequence-label,
.track-label,
.li-label,
.stars,
.performance-pill,
.empty-result {
  display: block;
}

.sequence-label {
  color: var(--teal-dark);
  font-size: 0.92rem;
  font-weight: 900;
}

.track-label,
.li-label {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.stars {
  margin-bottom: 8px;
  color: var(--teal-dark);
  font-size: 1.08rem;
  letter-spacing: 0;
}

.stars.na {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
}

.performance-pill {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 8px;
  font-weight: 900;
}

.performance-pill.mastered {
  background: #dcf8d2;
  color: #08733c;
}

.performance-pill.developing {
  background: #ffd3b8;
  color: #6b3302;
}

.performance-pill.support {
  background: #ffd0cd;
  color: #b00000;
}

.performance-pill.na {
  background: #e8edf3;
  color: #53627d;
}

.empty-result {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

@media (max-width: 1120px) {
  .planner-import,
  .lesson-library-shell,
  .settings-grid,
  .daily-grid {
    grid-template-columns: 1fr 1fr;
  }

  .resources-panel {
    grid-column: span 2;
  }

  .summary-panel {
    grid-column: span 1;
  }

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

  .assessment-row {
    grid-template-columns: 1fr 1fr;
  }

  .assessment-row strong {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .date-block {
    text-align: left;
  }

  .rotation-settings-grid {
    grid-template-columns: 1fr;
  }

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

  .calendar-top-button {
    width: 100%;
  }

  .lesson-top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .app-shell {
    padding-inline: 12px;
  }

  .daily-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .planner-import {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .lesson-library-shell,
  .settings-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .lesson-library-meta,
  .lesson-library-tools,
  .lesson-plan-card {
    grid-template-columns: 1fr;
  }

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

  .transfer-actions {
    justify-content: stretch;
  }

  .planner-controls,
  .master-controls,
  .week-controls,
  .term-week-panel,
  .upload-form,
  .button-row,
  .lesson-doc-form,
  .apps-script-box,
  .teacher-notes-list {
    grid-template-columns: 1fr;
  }

  .lesson-editor-grid {
    grid-template-columns: 1fr;
  }

  .support-picker-columns {
    grid-template-columns: 1fr;
  }

  .weekly-day-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .lesson-doc-grid label {
    grid-template-columns: 1fr;
  }

  .resources-panel {
    grid-column: span 1;
  }

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

  .visual-panel {
    min-height: 0;
  }

  .visual-panel img {
    height: 210px;
  }

  .field-row,
  .conference-list,
  .pulse-grid,
  .assessment-row {
    grid-template-columns: 1fr;
  }

.progress-controls {
  grid-template-columns: 1fr;
}
}

.file-mode-notice {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(6, 25, 65, 0.72);
  backdrop-filter: blur(8px);
}

.file-mode-card {
  width: min(760px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 22px 60px rgba(4, 17, 45, 0.28);
}

.file-mode-card h2 {
  margin: 0 0 12px;
  max-width: 680px;
  font-size: 2rem;
}

.file-mode-card p {
  max-width: 660px;
  color: var(--muted);
  font-size: 1rem;
}

.file-mode-card code {
  display: block;
  padding: 12px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f7fb;
  color: var(--ink);
}

.file-mode-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0;
}

/* ---- Seating plan ------------------------------------------------------- */
.seating-shell {
  display: grid;
  gap: 16px;
}

.counter-warning {
  background: #fde3e3 !important;
  color: #8a1f1f !important;
}

.desk-config-list,
.gender-roster-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.desk-config-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px auto;
  gap: 10px;
  align-items: center;
}

.desk-name-input {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.desk-capacity-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.desk-capacity-input {
  width: 56px;
  min-height: 36px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: center;
}

.gender-roster-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.gender-roster-name {
  font-weight: 700;
}

.gender-swatch-group {
  display: flex;
  gap: 5px;
}

.gender-swatch {
  width: 30px;
  height: 30px;
  border: 2px solid transparent;
  border-radius: 50%;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
  opacity: 0.55;
}

.gender-swatch.is-selected {
  border-color: var(--ink);
  opacity: 1;
}

.gender-swatch-f { background: #e0629b; }
.gender-swatch-m { background: #3f7fd6; }
.gender-swatch-u { background: #8a94a6; }

.seating-rule-builder {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.seating-rule-builder:last-of-type {
  border-bottom: 0;
}

.seating-rule-builder h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.rule-picker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 10px 0;
  max-height: 160px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-surface, #f8fafd);
}

.rule-picker-option {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 700;
}

.rule-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.rule-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.rule-chip-must {
  background: #dcefe0;
  color: #14532d;
}

.rule-chip-cant {
  background: #fbdede;
  color: #7a1c1c;
}

.seating-balance-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.seating-error {
  margin: 12px 0;
  padding: 10px 14px;
  border: 1px solid #e6b3b3;
  border-radius: 8px;
  background: #fdeeee;
  color: #7a1c1c;
  font-weight: 700;
}

.seating-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.seating-desk-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.seating-desk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.seating-desk-head strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.seating-desk-students {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seating-student-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
}

.gender-tag-f { background: #e0629b; }
.gender-tag-m { background: #3f7fd6; }
.gender-tag-u { background: #8a94a6; }

.seating-unseated-card {
  border-color: #e6b3b3;
  background: #fdeeee;
}

.seating-settings-link {
  margin-top: 10px;
}

/* --- Student sign-in (separate from the teacher login) --- */
.student-auth-page {
  min-height: 100vh;
  background: linear-gradient(160deg, #eef4f1, #dbe7ff 60%, #f6e6f4);
}

.student-login-shell {
  display: grid;
  gap: 14px;
  place-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.student-login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 28px 26px;
  text-align: center;
}

.student-login-card h1 {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2.1rem);
}

.student-login-mascot {
  font-size: 3rem;
  line-height: 1;
}

.student-login-card .auth-form {
  width: 100%;
  display: grid;
  gap: 12px;
  text-align: left;
}

.student-login-card input {
  min-height: 48px;
  font-size: 1.05rem;
}

.student-login-card .home-button {
  min-height: 50px;
  font-size: 1.05rem;
}

.student-login-help {
  display: grid;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  width: 100%;
}

.student-login-teacher {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-align: center;
}

/* --- Student logins (settings) --- */
.student-accounts-list {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.student-account-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, .8fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdfb;
  font-size: 0.85rem;
}

.student-account-row.is-archived {
  background: #f1f3f7;
  color: var(--muted);
  opacity: 0.85;
}

.student-account-row.is-archived .sa-name strong {
  text-decoration: line-through;
}

.sa-name {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
}

.sa-tag {
  padding: 1px 7px;
  border-radius: 999px;
  background: #dfe3ea;
  color: #4a5568;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sa-user code,
.sa-pass code {
  padding: 2px 7px;
  border-radius: 5px;
  background: #eef4f1;
  font-weight: 800;
}

.sa-pass {
  display: flex;
  gap: 6px;
  align-items: center;
}

.sa-eye {
  padding: 2px 6px;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}

.sa-eye:hover {
  background: #eef4f1;
}

.sa-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.student-audit summary {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  cursor: pointer;
}

.student-audit p {
  margin: 4px 0 0;
}

@media (max-width: 760px) {
  .student-account-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .sa-actions { justify-content: flex-start; }
}

/* --- Team chat --- */
.chat-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 16px;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
}

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

.chat-log {
  display: grid;
  gap: 8px;
  align-content: start;
  height: min(58vh, 520px);
  padding: 12px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfdfb;
}

.chat-msg {
  max-width: 82%;
  padding: 8px 11px;
  border-radius: 10px;
  background: #eef2f7;
}

.chat-msg.is-mine {
  justify-self: end;
  background: #dbe7ff;
}

.chat-msg-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 800;
}

.chat-msg-head strong { color: var(--ink); }
.chat-msg p { margin: 2px 0 0; overflow-wrap: anywhere; }

.chat-del {
  margin-left: auto;
  padding: 0 4px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  cursor: pointer;
}

.chat-del:hover { color: #b40d18; }

.chat-compose { display: flex; gap: 8px; }
.chat-compose input { flex: 1 1 auto; min-width: 0; }

.chat-state {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
}

.chat-state.is-open { background: #c9edcf; color: #14532d; }
.chat-state.is-closed { background: #e3e7ee; color: #4a5568; }

.chat-side { display: grid; gap: 10px; }

.chat-members { display: flex; flex-wrap: wrap; gap: 6px; }

.chat-member {
  padding: 3px 10px;
  border-radius: 999px;
  background: #eef4f1;
  color: var(--teal-dark);
  font-size: 0.76rem;
  font-weight: 800;
}

.chat-settings summary {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  cursor: pointer;
}

.hours-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.hours-row input { width: 120px; }

/* --- Voting --- */
.votes-shell {
  display: grid;
  grid-template-columns: minmax(300px, .8fr) minmax(0, 1.2fr);
  gap: 16px;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
}

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

.vote-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--teal-dark);
  border-radius: 10px;
  background: #fcfdfb;
}

.vote-head {
  display: flex;
  gap: 10px;
  align-items: start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.vote-head h3 { margin: 2px 0 0; overflow-wrap: anywhere; }

.vote-options { display: flex; flex-wrap: wrap; gap: 8px; }

.vote-option {
  padding: 10px 16px;
  border-radius: 999px;
  background: #eef4f1;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line);
}

.vote-option:hover:not([disabled]) { background: #dbe7ff; }
.vote-option[disabled] { opacity: .5; cursor: default; }

.vote-results { display: grid; gap: 8px; }

.vote-result-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.86rem;
  font-weight: 800;
}

.vote-bar {
  height: 10px;
  border-radius: 99px;
  background: #e6ebf3;
  overflow: hidden;
}

.vote-bar span { display: block; height: 100%; background: var(--teal-dark); }
.vote-result.is-top .vote-bar span { background: #0f9b6c; }

@media (max-width: 900px) {
  .chat-shell, .votes-shell { grid-template-columns: 1fr; }
}
