:root {
  color-scheme: light;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: #172e31;
  background: #e9eee9;
  --ink: #172e31;
  --muted: #506561;
  --edge: #d7e2db;
  --main: #f9fbf7;
  --accent: #cceea4;
  --deep: #172d31;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; display: flow-root; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .56; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid #49896f;
  outline-offset: 3px;
}
a { color: #125c45; }
.layout {
  max-width: 1264px; min-height: min(810px, calc(100dvh - 64px));
  height: calc(100dvh - 64px);
  margin: 32px auto; width: calc(100% - 64px);
  display: grid; grid-template-columns: 268px minmax(0, 1fr);
  border: 1px solid #cbd9d0; border-radius: 25px; overflow: hidden;
  box-shadow: 0 16px 70px #163c2a15;
}
.sidebar {
  display: flex; flex-direction: column; min-width: 0; color: #edf5ef;
  background: var(--deep);
  padding: 27px 19px 21px;
}
.brand {
  display: flex; gap: 12px; align-items: center;
  font-size: 19px; line-height: 1.15; font-weight: 500; margin: 0 7px 38px;
}
.brand strong { display: block; font-weight: 700; }
.brand-mark {
  flex: none; display: grid; place-items: center;
  width: 43px; height: 43px; border-radius: 13px;
  background: var(--accent); color: #1d4431; font: bold 26px Georgia, serif;
}
nav { display: grid; gap: 7px; }
.topic, .sound {
  border: 0; background: transparent; color: inherit; text-align: left;
  border-radius: 11px; min-height: 46px; width: 100%; padding: 9px 10px;
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600;
}
.topic:hover, .sound:hover { background: #284146; }
.topic[aria-current="page"] { color: #eaffd0; background: #314d48; box-shadow: inset 3px 0 #cceea4; }
.topic-icon { text-align: center; font-size: 17px; color: #c2dacd; }
.count { font-size: 13px; font-variant-numeric: tabular-nums; min-width: 22px; text-align: center;
  padding: 2px 6px; border-radius: 9px; color: #1c3e30; background: var(--accent); }
.sidebar-footer { margin-top: auto; padding-top: 20px; }
.sidebar-footer p { padding: 0 10px; margin: 8px 0 0; font-size: 13px; color: #b7ccc2; }
.sound { font-size: 14px; border: 1px solid #476351; }
.room { background: var(--main); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.room-header { display: flex; justify-content: space-between; align-items: center; gap: 14px;
  min-height: 108px; padding: 22px clamp(20px, 4vw, 55px); border-bottom: 1px solid var(--edge); background: #fff; }
h1 { margin: 0; color: var(--ink); font: 700 clamp(25px, 3.2vw, 38px)/1.12 Georgia, serif; letter-spacing: -.025em; }
.room-header p { color: var(--muted); font-size: 15px; margin: 8px 0 0; }
.chat { min-height: 0; overflow-x: hidden; overflow-y: scroll; scrollbar-gutter: stable;
  overscroll-behavior: contain; scroll-padding: 30px; padding: 24px clamp(20px, 4vw, 55px); }
.chat::-webkit-scrollbar { width: 10px; }
.chat::-webkit-scrollbar-track { background: #e8eee8; }
.chat::-webkit-scrollbar-thumb { background: #8ca398; border: 2px solid #e8eee8; border-radius: 8px; }
.entries { display: grid; justify-items: start; gap: 19px; max-width: 800px; margin-inline: auto; }
.entry { max-width: min(100%, 630px); min-width: 120px; }
.entry p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.53; }
.entry .bubble { padding: 13px 17px; border-radius: 15px; border: 1px solid var(--edge); background: #fff; }
.entry.student { justify-self: end; }
.entry.student .bubble { color: #1a3b2c; background: #e5f1de; border-color: #d5e5ce; border-bottom-right-radius: 4px; }
.entry.assistant .bubble { border-bottom-left-radius: 4px; }
.entry.alert { width: min(100%, 590px); }
.entry.alert .bubble { border-left: 4px solid #7fa68c; background: #edf4eb; }
.entry.target .bubble { outline: 2px solid #579475; }
.entry.progress, .entry.system { color: var(--muted); font-size: 14px; }
.entry.progress .bubble, .entry.system .bubble { border: 0; padding: 2px 0; background: transparent; }
.entry.progress { margin: -5px 0; min-width: 0; }
.entry-meta { display: flex; gap: 9px; align-items: baseline; margin: 0 0 5px 2px; font-size: 13px; color: var(--muted); }
.entry-meta strong { color: #294d44; font-size: 14px; }
.student .entry-meta { justify-content: end; margin-right: 2px; }
.file-link { display: inline-block; margin: 6px 12px 0 0; overflow-wrap: anywhere; }
.chat-photo { margin: 9px 0; max-width: min(100%, 340px); }
.photo-preview { display: block; position: relative; width: 100%; padding: 0; border: 1px solid var(--edge);
  border-radius: 9px; overflow: hidden; background: #edf4eb; }
.photo-preview img { display: block; width: 100%; max-height: 240px; object-fit: contain; }
.photo-mark { position: absolute; right: 7px; bottom: 7px; padding: 4px 8px; border-radius: 7px;
  color: #fff; background: #173a32; font-size: 15px; }
.image-viewer { width: min(1050px, calc(100% - 24px)); max-height: calc(100dvh - 24px); }
.image-viewer .dialog-header { margin-bottom: 12px; }
.viewer-frame { min-height: 0; max-height: 73dvh; overflow: auto; background: #edf4eb;
  border-radius: 9px; overscroll-behavior: contain; }
.viewer-frame img { display: block; width: var(--preview-width, auto); height: auto; margin: auto; cursor: zoom-in;
  transition: width 150ms ease-out; }
@media (prefers-reduced-motion: reduce) { .viewer-frame img { transition: none; } }
.citation { color: #3d6254; font-size: 14px; }
.empty { padding: 40px 0 12px; color: var(--muted); line-height: 1.5; }
.earlier { display: block; margin: 0 auto 18px; }
.compose-area { padding: 12px clamp(20px, 4vw, 55px) 25px; background: var(--main); }
#compose { max-width: 800px; margin: 0 auto; border: 1px solid #cadbd0; background: #fff;
  border-radius: 15px; padding: 12px 13px; box-shadow: 0 5px 18px #3b65460b; }
#compose:focus-within { border-color: #608977; }
textarea { display: block; width: 100%; border: 0; background: #fff; resize: vertical; min-height: 55px;
  padding: 7px; color: var(--ink); line-height: 1.45; }
textarea::placeholder { color: #58716a; }
textarea:focus-visible { outline-offset: 0; }
.actions, .dialog-actions, .dialog-header, .attachments, .submit {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px; }
.primary, .quiet { min-height: 41px; border-radius: 9px; padding: 8px 12px; font-size: 14px; font-weight: 650; }
.primary { border: 1px solid #194c3c; color: #fff; background: #235b4a; padding-inline: 16px; }
.primary:hover { background: #194538; }
.quiet { color: #28483d; background: #fff; border: 1px solid #cfddd4; }
.quiet:hover { background: #eaf3ea; }
.room-header .quiet { flex: 0 0 auto; }
.alert .quiet { background: transparent; border-color: #a7c3af; margin-top: 8px; }
.form-status { max-width: 800px; color: #465e51; font-size: 14px; margin: 0 auto 6px; }
.form-status:empty { display: none; }
.uploads, .scans { display: flex; flex-wrap: wrap; gap: 8px; }
.uploads:not(:empty) { padding: 1px 5px 9px; }
.uploads button { border: 1px solid var(--edge); border-radius: 8px; padding: 5px 9px; color: var(--ink); background: #edf4eb; overflow-wrap: anywhere; }
dialog { width: min(675px, calc(100% - 26px)); border: 1px solid var(--edge); border-radius: 17px; padding: 19px; }
dialog::backdrop { background: #152c2cc9; }
h2 { margin: 0; font: 700 25px Georgia, serif; }
video { display: block; width: 100%; max-height: 47vh; margin: 12px 0; border-radius: 8px; background: #182b29; }
#scan-preview { display: block; width: 100%; max-height: 52vh; object-fit: contain; margin: 12px 0; background: #edf4eb; }
.scans { margin-bottom: 12px; max-height: 23vh; overflow: auto; }
.scan-page { width: 102px; max-width: 100%; }
.scan-page img { width: 100%; height: 68px; object-fit: contain; background: #e3ebe5; border-radius: 5px; }
.scan-page .inspect { padding: 2px; min-height: 0; }
.scan-page button { width: 100%; margin-top: 3px; }
.signin { max-width: 390px; margin: min(15vh, 105px) auto; width: calc(100% - 36px);
  background: #fff; border: 1px solid var(--edge); padding: 32px; border-radius: 22px; }
.signin h1 { margin: 18px 0 25px; }
.signin input, .signin label { display: block; width: 100%; }
.signin input { padding: 12px; border: 1px solid var(--edge); border-radius: 9px; margin: 7px 0 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 780px) {
  .layout { margin: 0; width: 100%; height: 100dvh; min-height: 0; border: 0; border-radius: 0; grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr); }
  .sidebar { padding: 11px 13px; gap: 8px; position: relative; }
  .brand { margin: 0; font-size: 16px; }
  .brand strong { display: inline; }
  .brand-mark { width: 33px; height: 33px; font-size: 19px; }
  nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .topic { width: auto; min-height: 34px; grid-template-columns: auto auto; padding: 5px 8px; font-size: 14px; }
  .topic .topic-icon { display: none; }
  .sidebar-footer { position: absolute; right: 12px; top: 11px; padding: 0; }
  .sidebar-footer p { display: none; }
  .sound { min-height: 32px; padding: 3px 6px; display: flex; }
  .sound .topic-icon { display: none; }
  .room-header { min-height: 0; padding: 12px 14px; }
  .room-header p { font-size: 14px; }
  .chat, .compose-area { padding-inline: 13px; }
  .compose-area { padding-bottom: 10px; }
}
