:root {
  --navy-950: #102a43;
  --navy-900: #153a59;
  --navy-800: #1d4c6e;
  --teal-700: #16736f;
  --teal-600: #1b827c;
  --teal-100: #e4f3f1;
  --teal-50: #f2f9f8;
  --blue-50: #eff6ff;
  --amber-700: #a65d00;
  --amber-100: #fff1cf;
  --red-700: #b42318;
  --red-100: #fee4e2;
  --green-700: #18794e;
  --green-100: #dff4e8;
  --ink-950: #16212c;
  --ink-800: #2c3b49;
  --ink-600: #5b6c7b;
  --ink-500: #71808f;
  --line: #dfe6ec;
  --line-strong: #cbd6df;
  --surface: #ffffff;
  --surface-muted: #f7f9fb;
  --canvas: #f3f6f8;
  --shadow-sm: 0 1px 2px rgba(16, 42, 67, 0.06);
  --shadow-md: 0 16px 44px rgba(16, 42, 67, 0.18);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --sidebar-width: 236px;
  --focus: #f2a93b;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  color: var(--ink-950);
  background: var(--canvas);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

a {
  color: inherit;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 82%, white);
  outline-offset: 2px;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 9px 14px;
  color: white;
  background: var(--navy-950);
  border-radius: var(--radius-sm);
  transform: translateY(-180%);
  transition: transform 120ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 24px 16px 18px;
  color: #eaf2f7;
  background: var(--navy-950);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 8px 28px;
  color: white;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--navy-950);
  background: #91ded4;
  border-radius: 12px;
  font-size: 19px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
  letter-spacing: 0.04em;
}

.brand small {
  margin-top: 1px;
  color: #aac0cf;
  font-size: 11px;
}

.primary-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  color: #c9d8e3;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.nav-item:hover {
  color: white;
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.active {
  color: white;
  background: var(--navy-800);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 15px 10px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
}

.sidebar-user .avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: white;
  background: var(--teal-600);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
}

.sidebar-user strong,
.sidebar-user small {
  display: block;
}

.sidebar-user strong {
  font-size: 13px;
}

.sidebar-user small {
  margin-top: 1px;
  color: #9eb5c5;
  font-size: 11px;
}

.mobile-header {
  display: none;
}

.main-content {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 30px 34px 48px;
}

#app {
  width: min(1280px, 100%);
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-header h1 {
  margin: 3px 0 0;
  font-size: clamp(25px, 3vw, 33px);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.page-header p {
  max-width: 700px;
  margin: 8px 0 0;
  color: var(--ink-600);
}

.eyebrow {
  margin: 0;
  color: var(--teal-700);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-actions,
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  color: var(--ink-800);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  color: white;
  background: var(--teal-700);
}

.button.primary:hover {
  background: #0f6663;
}

.button.secondary {
  background: var(--surface);
  border-color: var(--line-strong);
}

.button.secondary:hover {
  background: var(--surface-muted);
}

.button.ghost {
  color: var(--teal-700);
  background: var(--teal-50);
}

.button.danger {
  color: white;
  background: var(--red-700);
}

.button.danger-link {
  color: var(--red-700);
  padding-inline: 4px;
}

.button.small {
  min-height: 34px;
  padding-inline: 11px;
  font-size: 13px;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--ink-600);
  background: transparent;
  border-radius: 9px;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--ink-950);
  background: var(--surface-muted);
}

.content-panel {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.data-table th {
  padding: 12px 16px;
  color: var(--ink-600);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-800);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: #fbfcfd;
}

.table-primary {
  color: var(--ink-950);
  font-weight: 700;
}

.table-secondary {
  display: block;
  margin-top: 3px;
  color: var(--ink-500);
  font-size: 12px;
}

.row-action {
  color: var(--teal-700);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.row-action:hover {
  text-decoration: underline;
}

.school-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-950);
  background: transparent;
  cursor: pointer;
  font-weight: 750;
  text-align: left;
}

.school-link .school-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--navy-900);
  background: var(--teal-100);
  border-radius: 10px;
  font-weight: 800;
}

.status-tag {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.status-tag::before {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  content: "";
}

.status-tag.available {
  color: var(--green-700);
  background: var(--green-100);
}

.status-tag.processing {
  color: var(--amber-700);
  background: var(--amber-100);
}

.status-tag.failed {
  color: var(--red-700);
  background: var(--red-100);
}

.status-tag.neutral {
  color: var(--ink-600);
  background: #edf1f4;
}

.status-tag.mode::before {
  display: none;
}

.inline-status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.school-context {
  margin-bottom: 18px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 15px;
  color: var(--ink-600);
  font-size: 13px;
}

.breadcrumb a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-600);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--teal-700);
}

.school-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.school-heading h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 31px);
  letter-spacing: -0.02em;
}

.school-heading p {
  margin: 6px 0 0;
  color: var(--ink-600);
  font-size: 13px;
}

.section-nav {
  display: flex;
  gap: 4px;
  margin-top: 22px;
  border-bottom: 1px solid var(--line);
}

.section-nav a {
  position: relative;
  padding: 11px 14px;
  color: var(--ink-600);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.section-nav a.active {
  color: var(--teal-700);
}

.section-nav a.active::after {
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 3px;
  background: var(--teal-700);
  border-radius: 3px 3px 0 0;
  content: "";
}

.status-strip {
  display: flex;
  align-items: stretch;
  margin: 20px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.status-item {
  min-width: 130px;
  padding: 15px 18px;
  border-right: 1px solid var(--line);
}

.status-item:last-child {
  flex: 1;
  border-right: 0;
}

.status-item strong {
  display: block;
  font-size: 19px;
  line-height: 1.2;
}

.status-item span {
  display: block;
  margin-top: 4px;
  color: var(--ink-500);
  font-size: 12px;
}

.category-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.category-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #e9eef2;
  border-radius: 10px;
}

.category-tab {
  min-height: 34px;
  padding: 0 13px;
  color: var(--ink-600);
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.category-tab.active {
  color: var(--ink-950);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(16, 42, 67, 0.11);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  margin: 0;
  font-size: 18px;
}

.panel-heading p {
  margin: 5px 0 0;
  color: var(--ink-600);
  font-size: 13px;
}

.school-intro-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
}

.school-intro-form {
  padding: 22px;
  border-right: 1px solid var(--line);
}

.attachments-panel {
  padding: 22px;
}

.attachments-panel h3 {
  margin: 0 0 14px;
  font-size: 15px;
}

.attachment-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.attachment-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.attachment-item > svg {
  color: var(--teal-700);
}

.attachment-item strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-item small {
  display: block;
  margin-top: 2px;
  color: var(--ink-500);
  font-size: 11px;
}

.link-button {
  color: var(--teal-700);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.link-button.danger {
  color: var(--red-700);
}


.link-button:hover {
  text-decoration: underline;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--ink-800);
  font-size: 13px;
  font-weight: 750;
}

.field label span:not(.optional) {
  color: var(--red-700);
}

.field .optional {
  color: var(--ink-500);
  font-size: 11px;
  font-weight: 500;
}

.field small {
  color: var(--ink-500);
  font-size: 12px;
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--red-100);
  color: var(--red-700);
  font-size: 14px;
}

.form-error[hidden] {
  display: none;
}

.sidebar-user .icon-button {
  margin-left: auto;
  width: 32px;
  height: 32px;
}


.field input,
.field select,
.field textarea {
  width: 100%;
  color: var(--ink-950);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.field input,
.field select {
  min-height: 42px;
  padding: 0 11px;
}

.field textarea {
  min-height: 100px;
  padding: 10px 11px;
  line-height: 1.65;
  resize: vertical;
}

.field input:read-only {
  color: var(--ink-500);
  background: var(--surface-muted);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--teal-600);
  outline: 3px solid rgba(27, 130, 124, 0.14);
}

.form-stack {
  display: grid;
  gap: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field.full {
  grid-column: 1 / -1;
}

.inline-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.empty-state {
  display: grid;
  min-height: 290px;
  place-items: center;
  padding: 32px;
  color: var(--ink-600);
  text-align: center;
}

.empty-state svg {
  width: 34px;
  height: 34px;
  margin-bottom: 10px;
  color: var(--ink-500);
}

.empty-state h3 {
  margin: 0;
  color: var(--ink-950);
  font-size: 17px;
}

.empty-state p {
  max-width: 420px;
  margin: 6px 0 16px;
  font-size: 13px;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 9px;
  font-size: 13px;
}

.alert svg {
  flex: 0 0 auto;
  margin-top: 1px;
}

.alert.warning {
  color: #744000;
  background: var(--amber-100);
}

.alert.error {
  color: #7a271a;
  background: var(--red-100);
}

.alert.info {
  color: var(--navy-800);
  background: var(--blue-50);
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 640px) 1fr;
  gap: 28px;
}

.settings-form {
  padding: 24px;
}

.settings-side {
  padding: 22px 0;
  color: var(--ink-600);
  font-size: 13px;
}

.settings-side strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-950);
}

.conversation-toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
}

.conversation-toolbar .field {
  min-width: 250px;
}

.conversation-layout {
  display: grid;
  min-height: 640px;
  grid-template-columns: minmax(290px, 0.38fr) minmax(0, 0.62fr);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.conversation-list {
  border-right: 1px solid var(--line);
}

.conversation-list-header {
  padding: 16px 18px 12px;
  color: var(--ink-600);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
}

.conversation-list-items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.conversation-item {
  display: grid;
  width: 100%;
  gap: 7px;
  padding: 16px 18px;
  color: var(--ink-800);
  background: transparent;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
}

.conversation-item:hover {
  background: var(--surface-muted);
}

.conversation-item.active {
  background: var(--teal-50);
  box-shadow: inset 3px 0 0 var(--teal-700);
}

.conversation-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.conversation-item strong {
  color: var(--ink-950);
  font-size: 13px;
}

.conversation-item time,
.conversation-item p {
  margin: 0;
  color: var(--ink-500);
  font-size: 12px;
}

.conversation-item p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-detail {
  min-width: 0;
  background: #fbfcfd;
}

.conversation-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.conversation-detail-header h2 {
  margin: 0;
  font-size: 17px;
}

.conversation-detail-header p {
  margin: 5px 0 0;
  color: var(--ink-500);
  font-size: 12px;
}

.message-thread {
  display: grid;
  gap: 18px;
  max-width: 760px;
  margin: 0 auto;
  padding: 26px;
}

.message {
  display: grid;
  gap: 6px;
}

.message.user {
  justify-items: end;
}

.message-label {
  color: var(--ink-500);
  font-size: 11px;
  font-weight: 700;
}

.message-bubble {
  width: fit-content;
  max-width: min(620px, 85%);
  padding: 11px 14px;
  color: var(--ink-800);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px;
  box-shadow: var(--shadow-sm);
  line-height: 1.7;
}

.message.user .message-bubble {
  color: white;
  background: var(--navy-800);
  border-color: var(--navy-800);
  border-radius: 14px 4px 14px 14px;
}

dialog {
  color: var(--ink-950);
}

dialog::backdrop {
  background: rgba(8, 27, 43, 0.48);
  backdrop-filter: blur(2px);
}

.modal {
  width: min(560px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.import-modal {
  width: min(680px, calc(100vw - 28px));
}

.drawer {
  width: min(660px, 100vw);
  height: 100vh;
  max-height: none;
  margin: 0 0 0 auto;
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  border: 0;
  box-shadow: var(--shadow-md);
}

.drawer form,
.modal form {
  display: flex;
  max-height: inherit;
  flex-direction: column;
}

.drawer form {
  height: 100%;
}

.dialog-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin: 2px 0 0;
  font-size: 21px;
}

.dialog-body {
  overflow-y: auto;
  padding: 22px;
}

.dialog-footer {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.drawer-footer .footer-spacer {
  flex: 1;
}

.confirm-modal {
  width: min(430px, calc(100vw - 28px));
}

.upload-zone {
  display: grid;
  min-height: 170px;
  place-items: center;
  padding: 24px;
  color: var(--ink-600);
  background: var(--surface-muted);
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  text-align: center;
}

.upload-zone svg {
  width: 32px;
  height: 32px;
  margin-bottom: 8px;
  color: var(--teal-700);
}

.upload-zone strong {
  display: block;
  color: var(--ink-950);
}

.upload-zone p {
  margin: 4px 0 0;
  font-size: 12px;
}

.file-selection {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--teal-50);
  border: 1px solid #c8e6e2;
  border-radius: 9px;
}

.file-selection svg {
  color: var(--teal-700);
}

.file-selection strong,
.file-selection small {
  display: block;
}

.file-selection small {
  margin-top: 2px;
  color: var(--ink-500);
}

.progress-state {
  display: grid;
  min-height: 230px;
  place-items: center;
  text-align: center;
}

.spinner {
  width: 38px;
  height: 38px;
  border: 4px solid var(--teal-100);
  border-top-color: var(--teal-700);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.progress-state h3 {
  margin: 14px 0 4px;
  font-size: 17px;
}

.progress-state p {
  margin: 0;
  color: var(--ink-500);
  font-size: 13px;
}

.result-summary {
  display: flex;
  gap: 18px;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: var(--surface-muted);
  border-radius: 10px;
}

.result-summary strong {
  display: block;
  font-size: 20px;
}

.result-summary span {
  color: var(--ink-500);
  font-size: 12px;
}

.failure-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.failure-table th,
.failure-table td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.failure-table th {
  color: var(--ink-600);
  background: var(--surface-muted);
  font-size: 11px;
}

.form-section + .form-section {
  margin-top: 26px;
  padding-top: 23px;
  border-top: 1px solid var(--line);
}

.form-section h3 {
  margin: 0 0 16px;
  font-size: 15px;
}

.relation-list {
  display: grid;
  gap: 10px;
}

.relation-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.85fr) minmax(210px, 1.25fr) minmax(150px, 0.8fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.relation-row strong {
  display: block;
  font-size: 13px;
}

.relation-row span {
  color: var(--ink-500);
  font-size: 12px;
}

.toast-region {
  position: fixed;
  z-index: 80;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  color: white;
  background: var(--navy-950);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  animation: toast-in 180ms ease both;
}

.toast svg {
  flex: 0 0 auto;
  color: #91ded4;
}

.noscript {
  position: fixed;
  z-index: 100;
  inset: 20px;
  padding: 16px;
  color: white;
  background: var(--red-700);
  border-radius: 10px;
}

.sidebar-scrim {
  position: fixed;
  z-index: 15;
  inset: 0;
  background: rgba(8, 27, 43, 0.5);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@media (max-width: 980px) {
  .sidebar {
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-header {
    position: sticky;
    z-index: 10;
    top: 0;
    display: flex;
    height: 58px;
    align-items: center;
    gap: 9px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
  }

  .mobile-brand .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    font-size: 15px;
  }

  .mobile-brand strong {
    font-size: 14px;
  }

  .main-content {
    margin-left: 0;
    padding: 24px 20px 42px;
  }

  .school-intro-layout,
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .school-intro-form {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 740px) {
  .main-content {
    padding: 20px 14px 36px;
  }

  .page-header,
  .school-heading,
  .category-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .page-actions .button,
  .category-toolbar .toolbar-actions .button {
    flex: 1;
  }

  .section-nav {
    overflow-x: auto;
  }

  .section-nav a {
    flex: 0 0 auto;
  }

  .status-strip {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .status-item {
    min-width: 0;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .status-item:nth-child(2n) {
    border-right: 0;
  }

  .status-item:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .category-tabs {
    overflow-x: auto;
  }

  .category-tab {
    flex: 0 0 auto;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field.full {
    grid-column: auto;
  }

  .conversation-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .conversation-toolbar .field {
    min-width: 0;
  }

  .conversation-layout {
    grid-template-columns: 1fr;
  }

  .conversation-list {
    max-height: 340px;
    overflow-y: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .message-thread {
    padding: 18px 14px;
  }

  .message-bubble {
    max-width: 92%;
  }

  .dialog-header,
  .dialog-body,
  .dialog-footer {
    padding-right: 16px;
    padding-left: 16px;
  }

  .drawer-footer {
    flex-wrap: wrap;
  }

  .drawer-footer .danger-link {
    order: 3;
    width: 100%;
  }

  .relation-row {
    grid-template-columns: 1fr auto;
  }

  .relation-row > :nth-child(2),
  .relation-row > :nth-child(3) {
    grid-column: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


.conversation-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 760px;
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  border: 1px solid var(--line);
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--teal-50);
  border-color: var(--teal-100);
}

.chat-bubble.assistant {
  align-self: flex-start;
}

.chat-meta {
  font-size: 12px;
  color: var(--ink-500);
  margin-bottom: 4px;
}

.chat-content {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
}
