:root {
  --bg: #f3f7ff;
  --panel: #ffffff;
  --ink: #152643;
  --muted: #617390;
  --primary: #236ab8;
  --primary-2: #4f8ad0;
  --accent: #ef9646;
  --mint: #4cb989;
  --lavender: #8f80dc;
  --danger: #af3040;
  --line: #dbe5f7;
  --soft: #f7faff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 6%, #ffe9d3, transparent 26%),
    radial-gradient(circle at 93% 8%, #dfe9ff, transparent 24%),
    radial-gradient(circle at 78% 92%, #e0f5ec, transparent 20%),
    var(--bg);
}

.shell {
  width: min(1200px, 96vw);
  margin: 18px auto 28px;
  display: grid;
  gap: 14px;
}

.hero {
  background: linear-gradient(135deg, #fffaf4, #eef4ff, #ebf9ef);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
}

.hero h1 {
  margin: 0;
  font-size: 1.35rem;
}

.hero p {
  margin: 4px 0 0;
  color: var(--muted);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

.hidden {
  display: none;
}

form {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 5px;
  font-weight: 600;
  color: #30466f;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 9px 11px;
  color: var(--ink);
}

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

button {
  border: none;
  border-radius: 999px;
  padding: 9px 15px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.03);
}

button.ghost {
  background: #e9f0ff;
  color: #26497f;
}

button.danger {
  background: #f8dce0;
  color: #8f2a36;
}

button.secondary {
  background: #eef3fc;
  color: #294577;
}

button.mint {
  background: linear-gradient(135deg, #3aa772, #58c894);
}

button.orange {
  background: linear-gradient(135deg, #eb8e45, #f2ad67);
}

button.subtle-danger {
  background: #fff2f4;
  color: #b43b4d;
}

.hint {
  margin: 0 0 3px;
  color: var(--muted);
}

.error {
  color: var(--danger);
  min-height: 19px;
  margin: 6px 0 0;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.toolbar h2 {
  margin: 0;
}

#school-badge {
  margin: 4px 0 0;
  color: var(--muted);
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.tabs {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tabs button {
  background: #ecf2ff;
  color: #2f487a;
}

.tabs button.active {
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: #fff;
}

.content {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.mini-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--soft);
}

.mini-card h3 {
  margin: 0 0 8px;
  font-size: 1.03rem;
}

.mini-card p {
  margin: 0;
}

.metric {
  display: grid;
  gap: 4px;
}

.metric-value {
  font-size: 1.6rem;
  line-height: 1;
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

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

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

.pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 9px;
  background: #edf3ff;
  color: #2f4b7f;
  font-size: 0.78rem;
  font-weight: 700;
}

.pill.green {
  background: #e8f8f1;
  color: #1b7f58;
}

.pill.orange {
  background: #fff2e3;
  color: #9b5a1b;
}

.pill.purple {
  background: #f0ebff;
  color: #5f4dba;
}

.split {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
}

.class-list,
.student-list,
.timeline,
.message-list,
.post-list,
.doc-list,
.assessment-list,
.event-list {
  display: grid;
  gap: 8px;
}

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

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

.item small {
  color: var(--muted);
}

.timeline .item {
  border-left: 4px solid #8ab4e6;
}

.event-card {
  border-left: 4px solid #8a9df3;
}

.event-card.critical {
  border-left-color: #e46f7d;
}

.event-card.action {
  border-left-color: #ef9646;
}

.event-card.info {
  border-left-color: #4cb989;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  background: #f1f6ff;
  color: #425a84;
}

.check-grid {
  display: grid;
  gap: 6px;
  max-height: 200px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: #fff;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-item input {
  width: auto;
}

.file-list {
  display: grid;
  gap: 6px;
}

.file-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 9px;
  background: #fff;
}

.badge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.template-chip {
  border: 1px solid #dce8ff;
  background: #f2f7ff;
  color: #2f4d83;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.82rem;
  cursor: pointer;
}

.message-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 10px;
}

.thread-list {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  max-height: 460px;
  overflow: auto;
}

.thread-btn {
  width: 100%;
  text-align: left;
  border-radius: 10px;
  border: 1px solid transparent;
  background: #fff;
  color: var(--ink);
  margin-bottom: 6px;
}

.thread-btn.active {
  border-color: #c9daf8;
  background: #f2f7ff;
}

.chat {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 460px;
}

.chat-messages {
  padding: 10px;
  overflow: auto;
  display: grid;
  gap: 8px;
  align-content: start;
}

.bubble {
  max-width: 86%;
  border-radius: 14px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  background: #fff;
}

.bubble.teacher {
  justify-self: end;
  background: #ecf4ff;
}

.bubble.parent {
  justify-self: start;
  background: #fff;
}

.bubble small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

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

.notice {
  border: 1px solid #ffe4b8;
  background: #fff8ec;
  color: #7b4f12;
  border-radius: 12px;
  padding: 8px 10px;
}

.success {
  border: 1px solid #cbeedb;
  background: #f1fbf6;
  color: #1d7c55;
  border-radius: 12px;
  padding: 8px 10px;
}

.danger-note {
  border: 1px solid #f4c5cb;
  background: #fff5f6;
  color: #9b2e3c;
  border-radius: 12px;
  padding: 8px 10px;
}

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

@media (max-width: 760px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}
