:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #133988;
  --brand-2: #EB6E03;
  --danger: #b91c1c;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
  --radius: 18px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 268px; background: linear-gradient(180deg, #133988, #0f1f4d); color: white; padding: 20px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, #F6AC07, #EB6E03); display: grid; place-items: center; font-weight: 900; }
.brand small { display: block; color: #cbd5e1; margin-top: 3px; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar a { color: #e2e8f0; padding: 10px 12px; border-radius: 12px; }
.sidebar a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.logout-form { margin-top: auto; }
.logout-form button, button, .button-link { border: 0; border-radius: 12px; padding: 10px 14px; background: #e2e8f0; color: #0f172a; font-weight: 700; cursor: pointer; display: inline-block; }
.logout-form button { width: 100%; background: rgba(255,255,255,.1); color: white; }
.main { flex: 1; padding: 28px; max-width: 1500px; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 22px; }
.topbar h1 { margin: 0; font-size: 30px; }
.topbar p { margin: 5px 0 0; color: var(--muted); }
.network-badge, .pill { background: #dcfce7; color: #166534; border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 800; }
.pill { background: #e0f2fe; color: #075985; }
.flash { margin-bottom: 18px; padding: 12px 16px; border-radius: 14px; background: #e0f2fe; border: 1px solid #7dd3fc; }
.flash.error { background: #fee2e2; border-color: #fca5a5; }
.flash.success { background: #dcfce7; border-color: #86efac; }
.card, .auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 22px; }
.auth-card { max-width: 460px; margin: 10vh auto; }
.auth-card.wide { max-width: 760px; }
.grid { display: grid; gap: 22px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.two.uneven { grid-template-columns: 420px minmax(0, 1fr); }
.grid.mini { gap: 12px; }
.full { grid-column: 1 / -1; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: white; border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.stat span { color: var(--muted); display: block; }
.stat strong { font-size: 34px; }
.stack { display: grid; gap: 14px; }
.compact { gap: 10px; }
label { display: grid; gap: 6px; font-weight: 700; color: #334155; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; background: white; color: var(--ink); }
textarea { min-height: 82px; resize: vertical; }
button.primary { background: var(--brand); color: white; }
button.danger, .danger { background: #fee2e2; color: var(--danger); }
button.small { padding: 7px 10px; font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row.clickable { color: inherit; }
.list-row.clickable:hover { background: #f8fafc; text-decoration: none; border-radius: 12px; padding-left: 10px; padding-right: 10px; }
.list-row.unread { background: #eff6ff; margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 12px; }
.big { font-size: 22px; font-weight: 800; }
.highlight-card { border-color: #93c5fd; background: linear-gradient(180deg, #ffffff, #eff6ff); }
.lesson-card { border: 1px solid var(--line); border-radius: 16px; padding: 15px; margin: 12px 0; background: #fff; }
.lesson-card h3 { margin: 6px 0; }
.lesson-card small { color: var(--muted); }
.inline-form { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.inline-form input { flex: 1; }
.status-chip { display: inline-block; border: 2px solid var(--line); border-radius: 999px; padding: 6px 10px; margin: 4px; background: white; font-weight: 800; }
.section-head { display: flex; justify-content: space-between; align-items: center; }
.check { display: inline-flex; gap: 8px; align-items: center; margin: 4px 12px 4px 0; font-weight: 600; }
.check input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: 14px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
details { border: 1px solid var(--line); padding: 12px; border-radius: 14px; margin-bottom: 12px; }
summary { cursor: pointer; font-weight: 800; margin-bottom: 10px; }
@media (max-width: 950px) {
  .app-shell { display: block; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .sidebar nav { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 16px; }
  .grid.two, .grid.two.uneven, .stats-grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
}

/* v2 layout and usability fixes */
body.sidebar-hidden .sidebar { display: none; }
.sidebar { position: relative; min-height: 100vh; height: auto; }
.sidebar-toggle { background: #0f172a; color: white; border-radius: 12px; padding: 10px 13px; }
.topbar { justify-content: flex-start; }
.topbar-title { flex: 1; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.button-link.primary-link { background: var(--brand); color: white; }
.muted { color: var(--muted); }
.narrow-card { max-width: 900px; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.callout { border: 1px solid #bfdbfe; background: #eff6ff; padding: 12px 14px; border-radius: 14px; margin: 14px 0; }
.compact-table th, .compact-table td { padding: 7px; }
.compact-table input { padding: 8px; }
.inline-label { display: flex; align-items: center; gap: 8px; }
.inline-label input { width: auto; }
.sticky-actions { position: sticky; top: 0; z-index: 5; }
.week-card h2 small { color: var(--muted); font-size: 14px; font-weight: 600; margin-left: 8px; }
.day-grid { display: grid; gap: 10px; margin-top: 14px; }
.day-editor { background: #f8fafc; }
.day-editor summary small { color: var(--muted); margin-left: 8px; }
.tall-textarea { min-height: 150px; }
@media (max-width: 950px) {
  .grid.three { grid-template-columns: 1fr; }
  body.sidebar-hidden .sidebar { display: none; }
}

/* v3 workflow sidebar and planning upgrades */
.side-nav { gap: 14px !important; }
.nav-group { display: grid; gap: 5px; }
.nav-group > span { color: #94a3b8; text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 900; margin: 8px 8px 2px; }
.sidebar a { display: flex; align-items: center; gap: 10px; }
.sidebar a b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 10px; background: rgba(255,255,255,.08); font-style: normal; }
.sidebar a em { font-style: normal; }
.sidebar a.active { background: rgba(56,189,248,.18); color: white; }
.sidebar a.active b { background: #38bdf8; color: #082f49; }
.month-map { display: grid; gap: 14px; }
.week-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 0; }
.week-card[open] .week-summary { margin-bottom: 12px; }
.week-meta { margin-bottom: 12px; }
.day-editor summary { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.day-off { border-color: #f59e0b; background: #fffbeb; }
.warning, .warning-box { background: #fef3c7 !important; color: #92400e !important; border-color: #fcd34d !important; }
.danger-text { color: var(--danger); font-weight: 800; }
.plan-actions { justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
.holiday-banner { border-color: #f59e0b; background: linear-gradient(180deg, #fff7ed, #fffbeb); }
.daily-preview { border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 14px; padding: 12px; margin: 12px 0; }
.small-preview p { margin: 5px 0; }
.schedule-row small { color: var(--muted); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.feature-card { border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: grid; gap: 8px; color: inherit; background: #fff; box-shadow: 0 8px 22px rgba(15,23,42,.05); }
.feature-card:hover { text-decoration: none; border-color: #93c5fd; transform: translateY(-1px); }
.feature-icon { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: #e0f2fe; color: #075985; font-weight: 900; }
.wide-table { max-width: 100%; }
.grade-cell input[type="number"] { min-width: 85px; }
.note-input { margin-top: 6px; min-width: 130px; font-size: 12px; }
.daily-plan-box h3 { margin-bottom: 4px; }
@media (max-width: 950px) {
  .week-summary, .day-editor summary { align-items: flex-start; flex-direction: column; }
  .inline-form { flex-wrap: wrap; }
}

/* v4 workflow-first UX */
.workflow-hero { background: linear-gradient(135deg, #ffffff 0%, #eef6ff 55%, #f0fdfa 100%); border-color: #bfdbfe; }
.eyebrow { margin: 0 0 6px; text-transform: uppercase; letter-spacing: .12em; color: var(--brand-2); font-size: 12px; font-weight: 900; }
.workflow-nav .nav-group:first-child a:first-of-type { border: 1px solid rgba(125,211,252,.25); }
.class-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.class-card { display: grid; gap: 10px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: white; box-shadow: var(--shadow); color: inherit; }
.class-card:hover { text-decoration: none; transform: translateY(-2px); border-color: #93c5fd; }
.class-card h3 { margin: 0; }
.class-card small { color: var(--muted); line-height: 1.4; }
.class-card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.class-badge { display: inline-grid; place-items: center; min-width: 58px; height: 42px; border-radius: 14px; background: #0f172a; color: white; font-size: 18px; font-weight: 900; }
.tabs-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.tabs-nav a { color: #0f172a; background: rgba(255,255,255,.75); border: 1px solid var(--line); border-radius: 999px; padding: 9px 12px; font-weight: 800; }
.tabs-nav a:hover { text-decoration: none; border-color: #93c5fd; background: white; }
.mini-stats { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
.fit-text { font-size: 22px !important; line-height: 1.1; }
.quick-panel { position: sticky; top: 14px; align-self: start; }
.mini-counts { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin: 14px 0; }
.mini-counts span { border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; padding: 12px; }
.calendar-day-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 12px 0; background: white; }
.affected-list { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.compact-row { padding: 9px 0; }
.day-editor { border-left: 5px solid #bfdbfe; }
.day-editor.day-off { border-left-color: #f59e0b; }
.day-editor summary span:first-child { font-weight: 900; }
.sidebar-hidden .main { max-width: 1600px; }
@media (max-width: 950px) {
  .mini-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .quick-panel { position: static; }
}

/* v5 UX polish, templates, print, backup */
:root {
  --ok: #16a34a;
  --warn: #d97706;
  --soft-blue: #eef6ff;
  --soft-green: #ecfdf5;
}
.sidebar { box-shadow: 8px 0 30px rgba(15,23,42,.12); }
.brand-mark { box-shadow: inset 0 0 0 1px rgba(255,255,255,.25), 0 12px 30px rgba(34,197,94,.18); }
.sidebar a { transition: .16s ease; }
.sidebar a:hover { transform: translateX(2px); }
.main { width: 100%; }
.topbar { background: rgba(255,255,255,.75); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); }
.card { transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease; }
.feature-card strong { font-size: 17px; }
.feature-card small { color: var(--muted); }
.danger-zone { border-color: #fecaca; background: linear-gradient(180deg, #fff, #fff7f7); }
.timeline-list { display: grid; gap: 12px; }
.timeline-list > div { border-left: 5px solid #bfdbfe; background: #f8fafc; padding: 12px 14px; border-radius: 12px; }
.print-actions { display: flex; gap: 10px; justify-content: flex-end; margin: 20px auto; max-width: 1100px; }
.print-body { background: #e5e7eb; }
.print-page { max-width: 1100px; margin: 24px auto; background: white; padding: 38px; box-shadow: var(--shadow); border-radius: 18px; }
.print-header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; border-bottom: 3px solid #0f172a; padding-bottom: 18px; margin-bottom: 18px; }
.print-header h1 { margin: 0; font-size: 30px; }
.print-stamp { color: var(--muted); font-size: 13px; }
.print-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 10px; margin: 18px 0; }
.print-meta div { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #f8fafc; }
.print-section { margin-top: 22px; }
.print-table th, .print-table td { padding: 8px 9px; font-size: 12px; border: 1px solid #d1d5db; }
.print-table th { background: #f1f5f9; color: #0f172a; }
.empty-state { border: 1px dashed #cbd5e1; border-radius: 18px; padding: 20px; background: #f8fafc; color: var(--muted); }
.actions .button-link, .actions button { white-space: nowrap; }
@media print {
  body { background: white !important; }
  .no-print, .sidebar, .topbar, .flash, .button-link, button, form, details summary::-webkit-details-marker { display: none !important; }
  .app-shell, .main { display: block !important; padding: 0 !important; max-width: none !important; }
  .card, .stat { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
  .print-page { margin: 0; padding: 0; box-shadow: none; border-radius: 0; max-width: none; }
  .print-header { border-bottom: 2px solid #111827; }
  .print-table { page-break-inside: auto; }
  .print-table tr { page-break-inside: avoid; page-break-after: auto; }
  @page { margin: 14mm; }
}

/* v7 role-first polish */
.role-hero {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.25fr);
  gap: 1.25rem;
  align-items: stretch;
  margin-bottom: 1rem;
}
.role-hero > div:first-child {
  background: linear-gradient(135deg, rgba(15,23,42,.96), rgba(30,64,175,.86));
  color: #fff;
  border-radius: 24px;
  padding: 1.4rem;
  box-shadow: 0 18px 45px rgba(15,23,42,.16);
}
.role-hero h2 { margin: .15rem 0 .45rem; font-size: clamp(1.45rem, 2vw, 2.1rem); }
.role-hero p { opacity: .92; margin: 0; line-height: 1.55; }
.quick-action-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .8rem; }
.quick-action-grid.single { grid-template-columns: 1fr; }
.quick-action {
  display: block;
  min-height: 86px;
  padding: 1rem;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 18px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 10px 30px rgba(15,23,42,.07);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.quick-action:hover { transform: translateY(-2px); box-shadow: 0 16px 38px rgba(15,23,42,.12); border-color: rgba(37,99,235,.35); }
.quick-action strong { display:block; font-size: 1rem; margin-bottom:.3rem; }
.quick-action span { color:#64748b; font-size:.88rem; line-height:1.35; }
.compact-stats { margin-bottom: 1rem; }
.mini-section h3 { margin-top: 0; }
.chip-row { display:flex; flex-wrap:wrap; gap:.5rem; margin-top:.7rem; }
.chip { display:inline-flex; gap:.35rem; align-items:center; padding:.45rem .65rem; border-radius:999px; background:#eef2ff; color:#1e3a8a; border:1px solid rgba(30,64,175,.14); font-size:.88rem; }
.role-panel { position: sticky; top: 1rem; align-self: start; }
.schedule-card-row strong { color:#0f172a; }
.sidebar .nav-group a b { width: 1.5rem; text-align:center; opacity:.85; }
.inline-form select { min-width: 220px; }
@media (max-width: 920px) {
  .role-hero { grid-template-columns: 1fr; }
  .quick-action-grid { grid-template-columns: 1fr; }
  .role-panel { position: static; }
}

/* v8 drag-drop schedule board, local JS only. No CDN circus. */
.schedule-workspace { align-items: start; }
.schedule-board-card { overflow-x: auto; }
.schedule-room-line { display: flex; gap: 1rem; align-items: end; justify-content: space-between; margin: .75rem 0 1rem; flex-wrap: wrap; }
.schedule-room-line label { max-width: 280px; }
.schedule-grid { display: grid; grid-template-columns: 118px repeat(5, minmax(155px, 1fr)); gap: .45rem; min-width: 920px; }
.schedule-grid-head { background: #0f172a; color: #fff; border-radius: 14px; padding: .7rem .8rem; font-weight: 800; text-align: center; }
.schedule-grid-head.empty { background: transparent; }
.period-label { border: 1px solid #e5e7eb; background: #f8fafc; border-radius: 14px; padding: .65rem; display: grid; gap: .15rem; align-content: center; min-height: 95px; }
.period-label strong { font-size: 1.1rem; }
.period-label span, .period-label small { color: #64748b; }
.period-label.am { border-left: 5px solid #0284c7; }
.period-label.pm { border-left: 5px solid #7c3aed; }
.schedule-dropzone { border: 1.5px dashed #cbd5e1; background: #f8fafc; border-radius: 14px; min-height: 95px; padding: .55rem; display: flex; align-items: stretch; justify-content: stretch; transition: .16s ease; }
.schedule-dropzone.filled { background: #eef6ff; border-style: solid; border-color: #93c5fd; }
.schedule-dropzone.drop-ready { outline: 3px solid rgba(37,99,235,.25); background: #dbeafe; transform: translateY(-1px); }
.drop-hint { color: #94a3b8; margin: auto; font-size: .9rem; }
.scheduled-card { width: 100%; background: #fff; border: 1px solid #dbeafe; border-radius: 12px; padding: .55rem; box-shadow: 0 6px 20px rgba(15, 23, 42, .07); display: grid; gap: .2rem; }
.scheduled-card strong { font-size: .92rem; color: #0f172a; }
.scheduled-card span, .scheduled-card small { color: #475569; font-size: .8rem; }
.tiny { font-size: .72rem; padding: .25rem .45rem; border-radius: 8px; }
.break-row { background: repeating-linear-gradient(135deg, #fff7ed, #fff7ed 8px, #ffedd5 8px, #ffedd5 16px); border: 1px solid #fed7aa; color: #9a3412; border-radius: 12px; padding: .45rem .7rem; font-weight: 800; text-align: center; }
.class-subject-palette { position: sticky; top: 1rem; }
.palette-list { display: grid; gap: .65rem; max-height: 650px; overflow: auto; padding-right: .25rem; }
.drag-card { cursor: grab; user-select: none; background: linear-gradient(135deg, #111827, #334155); color: #fff; border-radius: 16px; padding: .85rem; display: grid; gap: .25rem; box-shadow: 0 10px 26px rgba(15, 23, 42, .2); }
.drag-card span, .drag-card small { color: #cbd5e1; }
.drag-card.dragging { opacity: .6; cursor: grabbing; }
.session-edit-grid { display: grid; gap: .55rem; }
.session-edit-row { display: grid; grid-template-columns: 70px 1fr 120px 120px 90px 80px 80px; gap: .5rem; align-items: center; padding: .45rem; border: 1px solid #e5e7eb; border-radius: 14px; background: #fff; }
.session-edit-row input, .session-edit-row select { min-width: 0; }
@media (max-width: 900px) { .schedule-workspace { grid-template-columns: 1fr; } .class-subject-palette { position: static; } .session-edit-row { grid-template-columns: 1fr 1fr; } }
.brand-logo { width: 48px; height: 48px; object-fit: contain; flex: 0 0 auto; filter: drop-shadow(0 10px 18px rgba(0,0,0,.18)); }
.auth-logo { display: block; width: 96px; height: 96px; object-fit: contain; margin: 0 auto 12px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.ghost-link { background: #f8fafc; color: var(--ink); border: 1px solid var(--line); }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.clean-list-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.role-tag { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; background: #eef3fb; color: #133988; font-weight: 800; font-size: 12px; margin: 2px; }

/* v10 workflow cleanup: class-first subject setup and schedule that does not devour the screen. */
.notice-card { margin-top: 1rem; padding: .9rem 1rem; border-radius: 16px; border: 1px solid var(--line); background: #f8fafc; }
.success-soft { background: #ecfdf5; border-color: #bbf7d0; color: #065f46; }
.setup-grid-balanced { grid-template-columns: minmax(340px, 1fr) minmax(300px, .85fr); align-items: start; }
.clean-form { display: grid; gap: 1rem; }
.clean-form label { display: grid; gap: .35rem; font-weight: 800; color: #172033; }
.clean-form small { font-weight: 500; }
.section-head.compact { margin-bottom: .8rem; }
.empty-state { border: 1px dashed #cbd5e1; border-radius: 18px; background: #f8fafc; padding: 1rem; display: grid; gap: .5rem; }
.action-empty { place-items: start; }
.mini-empty { padding: .85rem; }
.empty-state strong { color: #0f172a; }
.empty-state span { color: #64748b; }
.compact-cards { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.static-card { cursor: default; }
.strong-row { border-left: 4px solid var(--brand-blue); }
.subject-setup-card { border: 1px solid rgba(19,57,136,.18); box-shadow: 0 16px 38px rgba(19,57,136,.08); }

.class-subject-tray { margin-bottom: 1rem; }
.tray-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .65rem; max-height: 240px; overflow: auto; padding: .25rem; }
.class-subject-tray .drag-card { min-height: 92px; }
.compact-line { margin-bottom: .75rem; }
.full-board { width: 100%; }
.schedule-board-card { overflow-x: auto; }
.schedule-grid { grid-template-columns: 104px repeat(5, minmax(132px, 1fr)); min-width: 820px; gap: .36rem; }
.schedule-grid-head { padding: .55rem .55rem; border-radius: 12px; font-size: .88rem; }
.period-label { min-height: 82px; padding: .5rem; border-radius: 12px; }
.period-label strong { font-size: 1rem; }
.period-label span, .period-label small { font-size: .74rem; }
.schedule-dropzone { min-height: 82px; padding: .38rem; border-radius: 12px; }
.scheduled-card { padding: .42rem; border-radius: 10px; gap: .12rem; }
.scheduled-card strong { font-size: .8rem; line-height: 1.15; }
.scheduled-card span, .scheduled-card small { font-size: .72rem; line-height: 1.15; }
.break-row { padding: .32rem .5rem; border-radius: 10px; font-size: .8rem; }

.schedule-agenda { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 1rem; align-items: start; }
.agenda-day { min-height: 180px; }
.agenda-session { display: grid; grid-template-columns: 78px 1fr; gap: .7rem; padding: .7rem; border: 1px solid #e5e7eb; border-radius: 16px; background: #fff; margin-bottom: .6rem; box-shadow: 0 8px 22px rgba(15,23,42,.05); }
.agenda-session.am { border-left: 5px solid #2491d6; }
.agenda-session.pm { border-left: 5px solid #a8297c; }
.agenda-time { display: grid; align-content: center; gap: .1rem; color: #133988; }
.agenda-time strong { font-size: 1rem; }
.agenda-time span { font-size: .78rem; color: #64748b; }
.agenda-info { display: grid; gap: .15rem; }
.agenda-info strong { color: #0f172a; line-height: 1.2; }
.agenda-info span, .agenda-info small { color: #64748b; font-size: .82rem; }

@media (max-width: 980px) {
  .setup-grid-balanced { grid-template-columns: 1fr; }
  .tray-list { grid-template-columns: 1fr; max-height: 320px; }
  .schedule-grid { min-width: 760px; grid-template-columns: 92px repeat(5, 128px); }
}

/* v11: class-filtered master schedule. Because one giant timetable is not a personality. */
.schedule-filter-card { margin-bottom: 1rem; }
.filter-row { display: flex; align-items: end; gap: 1rem; flex-wrap: wrap; }
.filter-row label { display: grid; gap: .35rem; font-weight: 800; min-width: 260px; }
.filter-summary { display: grid; gap: .15rem; padding: .75rem 1rem; border: 1px solid #dbeafe; background: #eef6ff; border-radius: 16px; min-width: 280px; }
.filter-summary strong { color: #133988; }
.filter-summary span { color: #64748b; font-size: .9rem; }
.schedule-overview-cell { border: 1px solid #e5e7eb; background: #f8fafc; border-radius: 12px; min-height: 82px; padding: .38rem; display: grid; gap: .35rem; align-content: start; }
.schedule-overview-cell.filled { background: #fff; border-color: #dbeafe; }
.overview-grid .scheduled-card { box-shadow: none; border-color: #e2e8f0; }
.overview-grid .overview-item strong { font-size: .74rem; }
.overview-grid .overview-item span, .overview-grid .overview-item small { font-size: .66rem; }
.overview-grid { min-width: 940px; }
.single-class-grid { min-width: 820px; }

/* v12 staff/room editing and plan attachments */
.danger-tag { background: #fee2e2 !important; color: #991b1b !important; }
.role-checkboxes { display: grid; gap: .35rem; padding: 1rem; }
.role-checkboxes legend { font-weight: 900; color: #0f172a; padding: 0 .35rem; }
.attachments-card { border-color: #bfdbfe; background: linear-gradient(180deg, #ffffff, #f8fbff); }
.attachment-block { border: 1px solid #e2e8f0; border-radius: 16px; padding: 1rem; background: #fff; display: grid; gap: .7rem; }
.month-attachment-block { margin-bottom: 1rem; }
.weekly-attachments-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; }
.attachment-list { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.attachment-list.small-list { align-items: stretch; }
.attachment-pill { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .65rem; border-radius: 999px; background: #eef3fb; border: 1px solid #dbeafe; color: #133988; font-size: .86rem; max-width: 100%; }
.attachment-pill a:first-child { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.attachment-pill small { color: #64748b; }
.danger-link { color: #b91c1c !important; font-weight: 900; }
.attachment-upload-form input[type="file"] { font-size: .88rem; }
@media (max-width: 700px) { .weekly-attachments-grid { grid-template-columns: 1fr; } .attachment-pill { border-radius: 12px; } }

/* v13 class subject setup polish */
.subject-setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}
.subject-card {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 18px;
  padding: 16px;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  min-height: 160px;
}
.subject-card.is-active {
  border-color: rgba(19, 57, 136, .25);
  background: linear-gradient(180deg, rgba(36,145,214,.08), rgba(255,255,255,1));
}
.subject-card.is-muted {
  background: #f8fafc;
}
.subject-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px 12px;
}
.subject-checkboxes legend,
.role-checkboxes legend {
  font-weight: 800;
  margin-bottom: 6px;
}
.subject-checkboxes .muted,
.role-checkboxes .muted {
  grid-column: 1 / -1;
  margin: 0 0 6px;
}
