.calendar-wrap,
    .side {
      background: var(--white);
      border: 1px solid var(--line);
      border-radius: 8px;
      overflow: hidden;
      box-shadow: 0 8px 22px rgba(31, 41, 55, 0.08);
    }

    .calendar-wrap {
      display: flex;
      flex-direction: column;
      min-height: 0;
    }

    .brand-strip {
      display: grid;
      grid-template-columns: auto 1fr auto;
      align-items: center;
      gap: 12px;
      padding: 6px 12px;
      border-bottom: 1px solid var(--line);
    }

    .small-logo {
      width: 178px;
      height: 54px;
      object-fit: contain;
      object-position: left center;
    }

    .brand-strip .school-name {
      display: none;
    }

    .school-name {
      font-weight: 700;
      color: var(--blue);
    }

    .school-motto {
      color: var(--muted);
      font-size: 13px;
      font-style: italic;
      margin-top: 2px;
    }

    .profile-name {
      text-align: right;
      font-weight: 700;
      color: var(--blue);
    }

    .back {
      margin-top: 4px;
      border: 0;
      background: #e7edf5;
      padding: 6px 8px;
      border-radius: 6px;
      cursor: pointer;
      color: var(--ink);
      font-weight: 700;
    }

    .module-button {
      justify-self: start;
      border: 1px solid #bfd0e2;
      background: #eef5fb;
      color: var(--blue);
      padding: 8px 11px;
      border-radius: 7px;
      font-size: 12px;
      font-weight: 800;
    }

    .module-home {
      min-height: 100vh;
      display: grid;
      grid-template-rows: auto 1fr;
      background: var(--soft);
    }

    .module-main {
      padding: 10px 28px 18px;
      display: grid;
      gap: 8px;
      align-content: start;
    }

    .module-hero {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 16px;
      align-items: end;
    }

    .module-hero h2 {
      margin: 0;
      color: var(--blue);
      font-size: 30px;
    }

    .module-hero p {
      margin: 6px 0 0;
      color: var(--muted);
      line-height: 1.4;
    }

    .module-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
      gap: 8px;
    }

    .module-card {
      min-height: 180px;
      border: 1px solid #dce3ee;
      border-radius: 12px;
      background: white;
      padding: 18px;
      display: grid;
      grid-template-rows: auto 1fr auto;
      gap: 12px;
      text-align: left;
      box-shadow: 0 12px 26px rgba(31, 41, 55, 0.08);
      cursor: pointer;
    }

    .module-home .module-grid .module-card {
      min-height: 86px;
      grid-template-columns: auto 1fr auto;
      grid-template-rows: auto;
      align-items: center;
      padding: 11px;
    }

    .module-home .module-card .module-icon {
      width: 34px;
      height: 34px;
      border-radius: 8px;
      font-size: 12px;
    }

    .module-home .module-card h3 {
      font-size: 13px;
    }

    .module-home .module-card p {
      font-size: 11px;
      line-height: 1.25;
    }

    .module-card:hover {
      border-color: var(--blue);
      background: #f7fbff;
    }

    .module-card .module-icon {
      width: 48px;
      height: 48px;
      border-radius: 12px;
      display: grid;
      place-items: center;
      background: var(--blue);
      color: white;
      font-weight: 900;
    }

    .module-card h3 {
      margin: 0;
      color: var(--blue);
      font-size: 20px;
    }

    .module-card p {
      margin: 5px 0 0;
      color: var(--muted);
      line-height: 1.4;
      font-size: 14px;
    }

    .module-card .arrow {
      justify-self: end;
    }

    .module-card.compact {
      min-height: 104px;
      grid-template-columns: auto 1fr auto;
      grid-template-rows: auto;
      align-items: center;
    }

    .quick-tools {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
      gap: 8px;
    }

    .profile-calendar {
      border: 1px solid #dce3ee;
      border-radius: 12px;
      background: white;
      overflow: hidden;
      box-shadow: 0 12px 26px rgba(31, 41, 55, 0.08);
      min-height: 64vh;
    }

    .profile-calendar-head {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 12px;
      align-items: center;
      padding: 14px 16px;
      border-bottom: 1px solid var(--line);
      background: #f8fafc;
    }

    .profile-calendar-head h3 {
      margin: 0;
      color: var(--blue);
      font-size: 20px;
    }

    .profile-calendar-head p {
      margin: 4px 0 0;
      color: var(--muted);
      font-size: 13px;
    }

    .profile-calendar-head.modal-compact {
      padding: 0 0 10px;
      border-bottom: 0;
      background: transparent;
    }

    .profile-calendar-head.modal-relaxed {
      padding: 0 0 12px;
      border-bottom: 0;
      background: transparent;
    }

    .profile-month-nav {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-top: 8px;
    }

    .profile-month-nav button,
    .profile-month-label {
      min-height: 30px;
      border: 1px solid #bfd0e2;
      border-radius: 6px;
      background: #eef5fb;
      color: var(--blue);
      padding: 0 10px;
      font-size: 12px;
      font-weight: 800;
    }

    .profile-month-label {
      display: inline-flex;
      align-items: center;
      background: #fff;
      color: #203247;
      min-width: 132px;
      justify-content: center;
    }

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

    .profile-calendar-actions button.active {
      background: var(--blue);
      color: white;
    }

    .school-event-list {
      display: grid;
      gap: 8px;
      padding: 12px 16px 16px;
      max-height: 360px;
      overflow: auto;
    }

    .school-event-list.month {
      grid-template-columns: repeat(5, minmax(0, 1fr));
      gap: 0;
      border-top: 1px solid #e5edf5;
      padding: 0;
      max-height: none;
      overflow: visible;
    }

    .school-event-list.week-schedule {
      display: block;
      padding: 16px;
      max-height: none;
      overflow: visible;
      background: #fff;
    }

    .school-week-schedule {
      width: 100%;
      overflow-x: auto;
      padding: 4px 0 10px;
    }

    .school-week-title {
      text-align: center;
      color: var(--blue);
      font-size: 13px;
      font-weight: 900;
      letter-spacing: 0;
      text-transform: uppercase;
      margin: 2px 0 10px;
    }

    .school-week-grid {
      --slot-height: 30px;
      display: grid;
      grid-template-columns: 64px repeat(5, minmax(118px, 1fr));
      grid-template-rows: 54px repeat(var(--slot-count), var(--slot-height));
      min-width: 740px;
      position: relative;
    }

.school-week-corner,
.school-week-day-head {
  border-bottom: 1px solid #e7eef6;
  background: #fff;
}

.school-week-corner {
  grid-column: 1;
  grid-row: 1;
}

.school-week-day-head {
      text-align: center;
      color: #b8c2cf;
      font-size: 12px;
      line-height: 1.15;
      padding-top: 5px;
      font-weight: 700;
    }

    .school-week-day-head strong {
      display: block;
      color: #cbd5e1;
      font-size: 16px;
      font-weight: 800;
    }

    .school-week-day-head.today,
    .school-week-day-head.today strong {
      color: var(--blue);
    }

    .school-week-time {
      border-bottom: 1px solid transparent;
      color: #3b82b6;
      font-size: 13px;
      padding: 0 8px 0 0;
      text-align: right;
      transform: translateY(-8px);
    }

    .school-week-slot {
      border-bottom: 1px solid #edf2f7;
      border-left: 1px solid #f1f5f9;
      background: #fff;
      min-width: 0;
    }

    .school-week-slot.hour-line {
      border-bottom-color: #e4ebf3;
    }

    .school-week-event {
      margin: 3px 8px;
      border: 1px solid color-mix(in srgb, var(--tag) 48%, white);
      border-radius: 8px;
      background: color-mix(in srgb, var(--tag) 14%, white);
      color: var(--blue);
      padding: 7px 8px;
      overflow: hidden;
      cursor: pointer;
      box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
      z-index: 2;
      min-height: 42px;
    }

    .school-week-event:hover {
      transform: translateY(-1px);
      box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
    }

    .school-week-event-title {
      display: block;
      font-size: 12px;
      font-weight: 900;
      line-height: 1.15;
    }

    .school-week-event-time {
      display: flex;
      align-items: center;
      gap: 4px;
      margin-top: 4px;
      color: color-mix(in srgb, var(--tag) 75%, #0f172a);
      font-size: 10px;
      font-weight: 800;
    }

    .school-week-empty {
      min-width: 740px;
      border: 1px dashed #c8d8e8;
      border-radius: 10px;
      background: #f8fbff;
      color: #516070;
      padding: 18px;
      text-align: center;
      font-weight: 800;
    }

    .school-week-head,
    .school-month-cell {
      border-right: 1px solid #e5edf5;
      border-bottom: 1px solid #e5edf5;
      min-height: 122px;
      padding: 8px;
      background: #fff;
    }

    .school-month-cell.blank {
      background: #f8fafc;
      min-height: 122px;
    }

    .school-week-head {
      min-height: auto;
      background: #f8fafc;
      color: #475467;
      font-size: 11px;
      font-weight: 900;
      text-align: center;
      text-transform: uppercase;
    }

    .school-month-cell.today {
      outline: 2px solid #a9c5e8;
      outline-offset: -2px;
      background: #f8fbff;
    }

    .school-month-day {
      font-weight: 900;
      color: var(--blue);
      margin-bottom: 6px;
    }

    .school-month-event {
      margin: 4px 0;
      padding: 3px 5px;
      border-radius: 4px;
      border: 1px solid color-mix(in srgb, var(--tag, var(--blue)) 50%, white);
      background: color-mix(in srgb, var(--tag, var(--blue)) 16%, white);
      font-size: 11px;
      line-height: 1.2;
      cursor: pointer;
    }

    .test-calendar-view {
      min-height: 100vh;
      background: #eef4f9;
      padding: 0;
    }

    .test-calendar-shell {
      display: grid;
      grid-template-rows: auto auto 1fr;
      min-height: 100vh;
      background: #f5f9fd;
    }

    .test-toolbar {
      display: grid;
      grid-template-columns: repeat(4, minmax(170px, 1fr)) auto;
      gap: 10px;
      align-items: end;
      padding: 12px 16px;
      border-bottom: 1px solid #dce3ee;
      background: white;
    }

    .test-toolbar label {
      display: grid;
      gap: 4px;
      color: var(--blue);
      font-size: 12px;
      font-weight: 900;
    }

    .test-toolbar select {
      min-height: 36px;
      border: 1px solid #98b9d7;
      border-radius: 7px;
      padding: 7px 9px;
      background: #fbfdff;
      color: var(--ink);
      font-weight: 800;
    }

    .test-calendar-layout {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 320px;
      gap: 12px;
      padding: 12px;
      min-height: 0;
    }

    .test-calendar-panel,
    .test-summary-panel {
      border: 1px solid #dce3ee;
      border-radius: 10px;
      background: white;
      overflow: hidden;
      box-shadow: 0 12px 26px rgba(31, 41, 55, 0.07);
    }

    .test-calendar-title {
      background: var(--blue);
      color: white;
      text-align: center;
      font-size: 21px;
      font-weight: 900;
      padding: 11px 12px;
    }

    .test-calendar-subtitle {
      background: #dff0fb;
      color: #123d63;
      text-align: center;
      padding: 9px;
      font-size: 13px;
      font-style: italic;
    }

    .test-calendar-grid {
      display: grid;
      grid-template-columns: repeat(5, minmax(0, 1fr));
      border-top: 1px solid #c8d7e6;
    }

    .test-week-head {
      background: var(--blue);
      color: white;
      text-align: center;
      padding: 9px;
      font-size: 13px;
      font-weight: 900;
      border-right: 1px solid #c8d7e6;
    }

    .test-day {
      min-height: 118px;
      border-right: 1px solid #dce3ee;
      border-bottom: 1px solid #dce3ee;
      background: #fff5cf;
      padding: 7px;
      cursor: pointer;
    }

    .test-day.blank {
      background: #f8fafc;
      cursor: default;
    }

    .test-day-number {
      font-weight: 900;
      color: #0f172a;
      margin-bottom: 5px;
    }

    .test-pill {
      border: 1px solid color-mix(in srgb, var(--test-color, #db2777) 45%, white);
      background: color-mix(in srgb, var(--test-color, #db2777) 16%, white);
      color: #172033;
      border-radius: 5px;
      padding: 4px 5px;
      margin: 4px 0;
      font-size: 11px;
      line-height: 1.25;
    }

    .test-pill strong {
      color: #0b3f6b;
    }

    .test-summary-panel {
      display: grid;
      grid-template-rows: auto 1fr;
      min-height: 0;
    }

    .test-summary-panel h3 {
      margin: 0;
      padding: 12px;
      color: var(--blue);
      border-bottom: 1px solid #dce3ee;
      background: #f8fafc;
    }

    .test-summary-list {
      overflow: auto;
      padding: 10px;
      display: grid;
      gap: 8px;
      align-content: start;
    }

    .test-summary-item {
      border: 1px solid #dce3ee;
      border-left: 5px solid var(--test-color, #db2777);
      border-radius: 8px;
      padding: 8px;
      background: #fbfcfe;
      font-size: 12px;
    }

    .school-event-suggestions {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 6px;
    }

    .suggestion-chip {
      border: 1px solid #c8d1dc;
      border-radius: 999px;
      background: #f8fafc;
      color: #344054;
      padding: 5px 8px;
      font-size: 11px;
      font-weight: 800;
    }

    .school-event {
      display: grid;
      grid-template-columns: 88px 1fr;
      gap: 10px;
      border: 1px solid #dce3ee;
      border-left: 7px solid var(--tag, var(--blue));
      border-radius: 8px;
      padding: 10px;
      background: #fbfcfe;
    }

    .school-event-date {
      font-weight: 900;
      color: var(--blue);
      text-align: center;
      background: #eef5fb;
      border-radius: 7px;
      padding: 7px;
      align-self: start;
    }

    .school-event-date span {
      display: block;
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
      margin-top: 2px;
    }

    .school-event-title {
      font-weight: 900;
      color: var(--ink);
      margin-bottom: 3px;
    }

    .school-event-meta {
      color: var(--muted);
      font-size: 12px;
      line-height: 1.35;
    }

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
      border-radius: 999px;
      padding: 3px 8px;
      background: color-mix(in srgb, var(--tag, var(--blue)) 18%, white);
      color: #1f2937;
      font-size: 11px;
  font-weight: 800;
  margin-right: 5px;
}

.tag-pill-danger { --tag: #ef4444; }
.tag-pill-readonly { --tag: #0f4778; }

.tag-dot {
      width: 9px;
      height: 9px;
      border-radius: 999px;
      background: var(--tag, var(--blue));
    }

    .color-guide-card {
      width: min(680px, calc(100vw - 28px));
      max-height: calc(100vh - 36px);
      overflow: auto;
      border: 1px solid #d9e1ec;
      border-radius: 12px;
      background: white;
      box-shadow: 0 24px 70px rgba(15, 23, 42, 0.38);
      padding: 18px;
    }

    .color-guide-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
      gap: 8px;
      margin: 14px 0;
    }

    .color-guide-item {
      display: flex;
      gap: 8px;
      align-items: center;
      border: 1px solid #e5e7eb;
      border-radius: 8px;
      padding: 9px;
      font-size: 13px;
      background: #fbfcfe;
    }

    .modal-check {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      margin: 2px 0 14px;
      color: #344054;
      font-size: 13px;
      font-weight: 700;
    }

    .modal-check input {
      width: 16px;
      height: 16px;
      margin-top: 2px;
      accent-color: var(--blue);
    }

    .modal-check span {
      display: grid;
      gap: 2px;
    }

    .modal-check small {
      color: #667085;
      font-size: 12px;
      font-weight: 600;
      line-height: 1.35;
    }

    .event-form-card {
      width: min(820px, calc(100vw - 28px));
      max-height: calc(100vh - 36px);
      overflow: auto;
      border: 1px solid #d9e1ec;
      border-radius: 12px;
      background: white;
      box-shadow: 0 24px 70px rgba(15, 23, 42, 0.38);
      padding: 18px;
    }

    #schoolEventForm,
    #assessmentForm {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
      padding: 0;
      border-bottom: 0;
    }




    .side {
      display: grid;
      grid-template-rows: 1fr;
      min-width: 0;
      height: 240px;
      max-height: 240px;
    }

    .side > .panel-head,
    .side > .hint {
      display: none;
    }

    .app.form-modal-open .side > .panel-head {
      display: flex;
      background: white;
      color: var(--ink);
      padding: 18px 18px 4px;
      font-size: 18px;
      border-bottom: 0;
    }

    .app.form-modal-open .side > .hint {
      display: block;
    }

    .panel-head {
      background: var(--blue-2);
      color: white;
      padding: 8px 12px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      font-size: 18px;
      font-weight: 700;
    }

    .close-panel {
      display: none;
      width: 32px;
      height: 32px;
      border-radius: 999px;
      padding: 0;
      background: transparent;
      color: #667085;
      font-size: 20px;
      line-height: 1;
    }

    .app.form-modal-open .close-panel {
      display: grid;
      place-items: center;
    }

    .hint {
      background: var(--mint);
      color: #344054;
      text-align: center;
      padding: 6px 12px;
      font-size: 13px;
      border-bottom: 1px solid var(--line);
    }

    form {
      padding: 12px;
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      border-bottom: 1px solid var(--line);
    }

    #roomForm {
      display: none;
    }

    .app.form-modal-open #roomForm {
      display: grid;
      grid-template-columns: 1fr 1fr;
      padding: 10px 18px 18px;
      gap: 14px 12px;
      border-bottom: 0;
      background: white;
    }

    .app.form-modal-open #roomForm .wide {
      grid-column: 1 / -1;
    }

    .app.form-modal-open #roomForm textarea {
      min-height: 92px;
    }

    label {
      display: block;
      font-weight: 700;
      font-size: 12px;
      margin-bottom: 5px;
      color: #344054;
    }

    textarea {
      min-height: 74px;
      resize: vertical;
    }

    .wide { grid-column: 1 / -1; }

    .actions {
      grid-column: 1 / -1;
      display: flex;
      gap: 8px;
    }

    button {
      border: 0;
      border-radius: 6px;
      padding: 9px 12px;
      cursor: pointer;
      font-weight: 700;
      background: #e7edf5;
      color: var(--ink);
    }

    button.primary {
      background: var(--blue);
      color: white;
      flex: 1;
    }

    button:disabled {
      opacity: 0.6;
      cursor: wait;
    }

    .records {
      overflow: auto;
      padding: 8px 12px 12px;
    }

    table.data {
      width: 100%;
      border-collapse: collapse;
      font-size: 12px;
    }

    .data th {
      position: sticky;
      top: 0;
      background: var(--blue);
      color: white;
      text-align: left;
      padding: 7px;
      border: 1px solid var(--line);
    }

    .data td {
      padding: 7px;
      border: 1px solid var(--line);
      vertical-align: top;
    }

    .data button {
      padding: 5px 7px;
      color: var(--danger);
      background: #fee4e2;
      font-size: 11px;
    }

