:root {
  --bg: #eef0f3;
  --card: #fff;
  --ink: #1a1d23;
  --muted: #6b7280;
  --line: #e3e6ea;
  --red: #c8323b;
  --red-soft: #f6d5d7;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-family: Inter, system-ui, sans-serif; color: var(--ink); }
button { white-space: nowrap; font: inherit; padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); cursor: pointer; }
button:hover { background: #f5f6f8; }
button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
button.small { padding: 3px 9px; font-size: .78rem; color: var(--muted); }
button.small:hover { color: var(--ink); }
button.danger:hover { color: var(--red); border-color: var(--red-soft); }
input, textarea { font: inherit; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; width: 100%; background: #fff; color: var(--ink); }
input:focus, textarea:focus { outline: 2px solid #c7d2fe; border-color: #818cf8; }
textarea { resize: vertical; }

main { max-width: 760px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.card[hidden] { display: none; }
.row { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.card.row { flex-direction: row; }

#list { display: flex; flex-direction: column; gap: 12px; }
.teacher h2 { margin: 0; font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.teacher h2 .name { margin-right: auto; }
.teacher.hidden h2 .name { color: var(--muted); text-decoration: line-through; }
.teacher ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.teacher li { display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px; background: #f6f7f9; border-radius: 10px;
              border-left: 3px solid #c7d2fe; white-space: pre-wrap; line-height: 1.45; }
.teacher li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.teacher li .row { flex: none; }
.empty { color: var(--muted); text-align: center; padding: 24px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff;
         padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 500; z-index: 10; }
#toast.err { background: var(--red); }
#toast[hidden] { display: none; }

@media (max-width: 600px) {
  main { padding: 8px; gap: 8px; }
  .teacher li { flex-direction: column; }
  .teacher li .row { align-self: flex-end; }
}
