:root {
  color-scheme: dark;
  --navy: #8cbfd1;
  --teal: #59b3c7;
  --teal-deep: #1f3840;
  --gold: #ebb359;
  --gold-text: #f2c772;
  --danger: #f28c80;
  --card: #1c2124;
  --screen: #0d1214;
  --ink: #f4f7f8;
  --muted: #a7b3b8;
  --line: rgba(255, 255, 255, 0.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  --nav: 248px;
  --radius: 16px;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --navy: #123d4a;
    --teal: #176678;
    --teal-deep: #e7f1f1;
    --gold: #d99a36;
    --gold-text: #8c5912;
    --danger: #a63d33;
    --card: #ffffff;
    --screen: #f4f6f5;
    --ink: #142226;
    --muted: #5d6b70;
    --line: rgba(18, 61, 74, 0.1);
    --shadow: 0 10px 24px rgba(18, 61, 74, 0.08);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--screen); color: var(--ink); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal); }

.boot, .gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(900px 420px at 20% -10%, rgba(89, 179, 199, 0.18), transparent 60%),
    var(--screen);
}
.gate-card, .boot {
  width: min(440px, 100%);
}
.gate-card {
  background: linear-gradient(180deg, #123d4a, #176678);
  color: white;
  border-radius: 28px;
  padding: 36px 28px;
  box-shadow: var(--shadow);
}
.mark {
  width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.12);
  color: #ebb359;
  margin-bottom: 12px;
}
.gate-card h1 { margin: 0; font-size: 2rem; letter-spacing: -0.03em; }
.gate-card .sub { opacity: 0.78; margin: 4px 0 16px; }
.gate-card p.fine { font-size: 0.82rem; line-height: 1.45; opacity: 0.86; }
.gate-card .policy-link { margin: 18px 0 0; text-align: center; }
.gate-card .policy-link a { color: #fff; font-weight: 650; text-decoration: underline; text-underline-offset: 2px; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.btn {
  border: 0; border-radius: 14px; padding: 13px 16px;
  background: white; color: #123d4a; font-weight: 700;
}
.btn.ghost { background: rgba(255, 255, 255, 0.14); color: white; }
.btn.teal { background: var(--teal); color: white; }
.btn.danger { background: transparent; color: var(--danger); }
.btn.secondary { background: var(--teal-deep); color: var(--teal); }
.btn.gold { background: var(--gold); color: #123d4a; }
.btn:disabled { opacity: 0.45; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.field span { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
input, textarea, select {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
textarea { min-height: 110px; resize: vertical; }
.err { color: #f2c772; font-size: 0.92rem; }

.shell { min-height: 100vh; display: grid; grid-template-columns: var(--nav) 1fr; }
.nav {
  position: sticky; top: 0; height: 100vh; padding: 22px 14px;
  background: #10262c; color: white; display: flex; flex-direction: column; gap: 8px;
}
@media (prefers-color-scheme: light) {
  .nav { background: #123d4a; }
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; }
.brand strong { display: block; font-size: 1.05rem; }
.brand small { opacity: 0.72; }
.nav button.item, .nav a.item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; text-decoration: none;
  background: transparent; color: white; border: 0; border-radius: 12px;
  padding: 10px 12px; font-weight: 650;
}
.nav { overflow: auto; }
.nav button.item[aria-current="page"] { background: rgba(89, 179, 199, 0.22); color: white; }
.nav .soon-label { margin-left: auto; font-size: 0.68rem; opacity: 0.7; }
.nav .grow { flex: 1; }
.who { padding: 10px 12px; font-size: 0.85rem; opacity: 0.85; }
.who strong { display: block; }
.owner-dot {
  display: inline-block; width: 9px; height: 9px; margin-left: 6px; vertical-align: 0.1em;
  border-radius: 50%; background: #0a84ff; box-shadow: 0 0 0 1px #10262c;
}
@media (prefers-color-scheme: light) {
  .owner-dot { background: #007aff; box-shadow: 0 0 0 1px #123d4a; }
}
.content { min-width: 0; padding: 28px 32px 64px; text-align: left; }
.content p, .content li, .content h1, .content h2, .content h3, .content td, .content th { text-align: left; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 18px; }
.top h1 { margin: 0; font-size: 1.8rem; letter-spacing: -0.03em; }
.eyebrow { margin: 0 0 4px; color: var(--teal); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.card {
  background: var(--card); border-radius: var(--radius); padding: 16px 16px 14px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.card h2, .card h3 { margin: 0 0 8px; font-size: 1rem; }
.meta { color: var(--muted); font-size: 0.86rem; }
.ticket-notes { color: var(--muted); white-space: pre-wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 3px 8px; font-size: 0.75rem; font-weight: 750;
  background: var(--teal-deep); color: var(--teal);
}
.pill.warn { background: rgba(235, 179, 89, 0.16); color: var(--gold-text); }
.pill.bad { background: rgba(242, 140, 128, 0.15); color: var(--danger); }
.list { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr); gap: 16px; align-items: start; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check {
  display: flex; align-items: center; gap: 6px;
  background: var(--screen); border-radius: 10px; padding: 8px 10px; font-weight: 650;
}
.check.on { background: var(--teal-deep); }
#schedule-host { min-width: 0; display: block; }
.shell.schedule-full {
  grid-template-columns: 1fr;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}
.shell.schedule-full > .nav { display: none; }
.shell.schedule-full > .content {
  padding: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.shell.schedule-full > .content > [data-schedule-chrome] { display: none; }
.shell.schedule-full #schedule-host {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}
body:has(.shell.schedule-full) { overflow: hidden; height: 100%; }
.letter { font-size: 0.75rem; font-weight: 800; color: var(--teal); margin: 14px 0 6px; }
.alpha { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.alpha a { text-decoration: none; font-size: 0.75rem; font-weight: 800; padding: 2px 4px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.banner {
  border-left: 4px solid var(--gold); background: var(--card); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px;
}
.thread { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow: auto; padding-right: 4px; }
.bubble { background: var(--screen); border-radius: 14px; padding: 10px 12px; }
.bubble.mine { background: var(--teal-deep); }
.bubble[data-copy-all] { user-select: text; -webkit-user-select: text; }
.message-copy-menu {
  position: fixed; z-index: 30; min-width: 9rem; margin: 0; padding: 4px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow);
}
.message-copy-menu button {
  display: block; width: 100%; text-align: left; background: transparent; border: 0;
  border-radius: 8px; padding: 8px 10px; font-weight: 650; cursor: pointer;
}
.message-copy-menu button:hover,
.message-copy-menu button:focus-visible { background: var(--screen); }
.bubble .sender-name {
  display: inline-block; max-width: 100%;
  font-size: 12px; font-weight: 600; line-height: 16px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom;
}
.note-title, .thread-title {
  display: block; max-width: 100%;
  font-size: 17px; font-weight: 700; line-height: 22px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.note-line {
  max-width: 100%; font-size: 15px; line-height: 20px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.note-row { width: 100%; min-width: 0; overflow: hidden; }
.split > .list, .split > div { min-width: 0; }
.card h2.thread-title { margin: 0 0 8px; font-size: 17px; }
.composer { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tabs button { background: transparent; border: 0; color: var(--muted); font-weight: 750; padding: 6px 2px; }
.tabs button[aria-current="page"] { color: var(--teal); box-shadow: inset 0 -2px 0 var(--teal); }
.nav svg { width: 18px; height: 18px; flex: 0 0 auto; }
.search { width: min(360px, 100%); }
.table-wrap { overflow: auto; }
.alpha a.off { opacity: 0.35; pointer-events: none; }
.mark-btn { min-width: 96px; text-align: center; }
.gate-card .field span { color: rgba(255, 255, 255, 0.82); }
.gate-card input { background: rgba(255, 255, 255, 0.14); border-color: transparent; color: white; }
.gate-card input::placeholder { color: rgba(255, 255, 255, 0.65); }
.flash { color: var(--gold-text); font-weight: 650; }
.soon-card { max-width: 640px; }
.day-wrap { max-width: 720px; }
.day-label {
  margin: 0 0 6px; padding: 0 4px; color: var(--teal);
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
}
.day-card {
  background: var(--card); border-radius: 22px; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--day-accent, var(--line)) 35%, transparent);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--day-accent, #123d4a) 16%, transparent);
}
.day-hero {
  padding: 16px 16px 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--day-accent) 22%, transparent), color-mix(in srgb, var(--day-accent) 4%, transparent)),
    linear-gradient(180deg, color-mix(in srgb, var(--day-accent) 10%, var(--card)), var(--card));
  border-bottom: 1px solid color-mix(in srgb, var(--day-accent) 22%, transparent);
}
.day-hero-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.day-kicker {
  margin: 0; color: var(--day-accent, var(--teal));
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
}
.day-kicker.gold { color: var(--gold-text); }
.day-range { color: var(--muted); font-size: 0.78rem; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.day-hero-main { display: flex; gap: 14px; align-items: center; margin-top: 12px; }
.day-badge {
  width: 52px; height: 52px; border-radius: 16px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--day-accent); color: white;
  font-size: 1.25rem; font-weight: 750;
}
.day-hero-copy { min-width: 0; }
.day-hero h3 { margin: 0; font-size: 1.45rem; letter-spacing: -0.03em; line-height: 1.15; }
.day-grade { margin: 2px 0 0; color: var(--day-accent); font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-detail { margin: 1px 0 0; color: var(--muted); font-weight: 600; }
.day-list { padding: 8px 12px 12px; }
.day-nowline { display: flex; align-items: center; gap: 6px; margin: 2px 0 2px 7.5rem; }
.day-nowline i { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); display: block; flex: 0 0 auto; }
.day-nowline span { flex: 1; height: 1.5px; background: color-mix(in srgb, var(--teal) 55%, transparent); }
.day-row {
  display: grid; grid-template-columns: 7.5rem 3px minmax(0, 1fr) auto;
  column-gap: 10px; align-items: center; min-height: 46px;
  padding: 3px 6px 3px 0; border-radius: 10px;
}
.day-row.current { background: color-mix(in srgb, var(--row-accent) 12%, transparent); }
.day-row.past { opacity: 0.42; }
.day-time {
  text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap;
  font-size: 0.78rem; font-weight: 650; color: var(--muted);
}
.day-row.current .day-time { color: var(--teal); font-weight: 800; }
.day-rail { width: 3px; height: 22px; border-radius: 2px; background: var(--row-accent, var(--teal)); justify-self: center; }
.day-row.past .day-rail { opacity: 0.5; }
.day-copy { min-width: 0; }
.day-subject { display: block; font-weight: 650; line-height: 1.2; }
.day-row.current .day-subject { font-weight: 800; }
.day-sub {
  margin: 1px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.day-now {
  background: var(--teal); color: white; font-size: 0.68rem; font-weight: 800;
  letter-spacing: 0.05em; border-radius: 999px; padding: 2px 7px;
}
.day-foot {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; padding-top: 10px;
  border-top: 1px solid var(--line); color: var(--teal); font-weight: 700;
  font-size: 0.86rem; text-decoration: none;
}
.day-foot.solo { border-top: 0; margin-top: 10px; padding-top: 0; }
.day-foot .grow { margin-left: auto; color: var(--muted); font-weight: 650; font-size: 0.78rem; }
.day-empty { padding: 14px 16px 12px; border-color: var(--line); box-shadow: var(--shadow); }
.day-empty h3 { margin: 8px 0 2px; font-size: 1.15rem; }
.day-empty .day-kicker { margin-bottom: 2px; }
.unread-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--gold);
  display: inline-block; margin-left: auto; flex: 0 0 auto;
}
.unread-dot.messages-dot { background: #0a84ff; }
.nav-badge {
  margin-left: auto; min-width: 1.2rem; padding: 1px 6px; border-radius: 999px;
  background: var(--gold); color: #123d4a; font-size: 0.72rem; font-weight: 800; text-align: center;
}
button.item-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  width: 100%; text-align: left; color: inherit;
}
button.item-card .row { width: 100%; }
button.item-card[aria-current="page"] { outline: 2px solid var(--teal); }
.bubble.team { background: var(--card); }
.shot { max-width: min(100%, 360px); border-radius: 12px; }
.composer textarea { min-height: 72px; }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .nav .grow, .who { display: none; }
  .split { grid-template-columns: 1fr; }
  .content { padding: 18px 14px 48px; }
  .day-hero h3 { font-size: 1.28rem; }
  .day-range { white-space: normal; text-align: right; }
  .day-row { grid-template-columns: minmax(6.6rem, 7.4rem) 3px minmax(0, 1fr) auto; column-gap: 8px; }
  .day-nowline { margin-left: 6.6rem; }
}

/* Homework: grade sections, own posts, and required fields */
.hw-grade { margin: 18px 0 8px; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.card.hw-mine { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--teal) 45%, transparent); background-image: linear-gradient(color-mix(in srgb, var(--teal) 7%, transparent), color-mix(in srgb, var(--teal) 7%, transparent)); }
.card.hw-draft { box-shadow: inset 4px 0 0 var(--gold); }
button.draft-open { font: inherit; font-weight: 650; color: inherit; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
button.draft-open:hover { color: var(--teal); }
.draft-hint { color: var(--teal); font-weight: 650; }
.pill.yours { background: color-mix(in srgb, var(--teal) 16%, transparent); color: var(--teal); font-size: 0.72rem; vertical-align: middle; }
.field.missing > span { color: var(--danger); }
.field.missing input, .field.missing select, .field.missing textarea, .field.missing .checks { border-color: var(--danger); outline: 1px solid var(--danger); }
.missing-note { color: var(--danger); font-size: 0.8rem; }

/* Pinned preset message groups */
.preset-rows { display: grid; gap: 6px; margin-bottom: 12px; }
.card.note-row.preset-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; text-align: left; }
.preset-row .dot { width: 8px; height: 8px; border-radius: 50%; background: #0a84ff; }
.note-row:not(.preset-row) > .dot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: #0a84ff; vertical-align: middle; }

/* Permissions editor */
.perm-table th.perm-role { font-size: 0.78rem; text-align: center; white-space: nowrap; }
.perm-table td.perm-cell { text-align: center; }
.perm-table th.perm-key { font-weight: 650; min-width: 260px; }
.perm-table th.perm-key code { font-size: 0.72rem; }
.perm-table tr.perm-group th { color: var(--teal); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 14px; }
.preset-item { display: grid; gap: 2px; }
.preset-members { padding: 0 12px; }
.preset-members summary { cursor: pointer; width: fit-content; }
.preset-members ul { margin: 4px 0 6px; padding-left: 18px; columns: 2; font-size: 0.88rem; }

/* Feedback attachments: picked tiles with a remove button, and sent files on a thread. */
.att-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.att-fieldset legend { padding: 0; margin-bottom: 6px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.att-picker { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.att-add { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; cursor: pointer; }
.att-add:focus-within { outline: 2px solid var(--teal); outline-offset: 2px; }
.att-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.att-pending, .att-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.att-list { margin-top: 8px; }
.att-tile {
  position: relative; display: flex; align-items: center; gap: 8px; width: 196px; min-height: 56px;
  padding: 6px 10px 6px 6px; border-radius: 12px; background: var(--card); border: 1px solid var(--line);
}
.att-tile.image { flex-direction: column; align-items: stretch; width: 132px; padding: 6px; }
.att-tile.image img, .att-wait {
  display: block; width: 100%; height: 88px; object-fit: cover; border-radius: 8px; background: var(--screen);
}
.att-tile.sent.image { width: 168px; }
.att-tile.sent.image img, .att-tile.sent .att-wait { height: 108px; }
.att-wait { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.8rem; }
.att-badge {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 8px; background: var(--teal-deep); color: var(--teal); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.03em;
}
.att-text { display: flex; flex-direction: column; min-width: 0; }
.att-name { font-size: 0.82rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { font-size: 0.74rem; color: var(--muted); }
.att-remove {
  position: absolute; top: -7px; right: -7px; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--card); background: var(--danger); color: white; font-size: 0.95rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
}
.att-chip {
  display: flex; align-items: center; gap: 8px; width: 196px; min-height: 56px; text-align: left;
  padding: 6px 10px 6px 6px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); cursor: pointer;
}
.att-chip:hover { border-color: var(--teal); }

.pinned-home { margin-bottom: 14px; padding: 0; overflow: hidden; border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.pinned-ann { padding: 12px 16px; background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 14%, transparent), color-mix(in srgb, var(--teal) 10%, transparent)); }
.pinned-ann + .pinned-ann { border-top: 1px solid color-mix(in srgb, var(--gold) 30%, transparent); }
.pinned-ann .eyebrow { color: var(--gold-text); margin: 0; }
.pinned-ann h3 { margin: 4px 0 2px; }
.pinned-ann p { margin: 2px 0 0; }
.pinned-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pinned-actions { display: flex; gap: 6px; flex-shrink: 0; }
.pin-unpin, .pin-archive { padding: 4px 12px; min-height: 30px; font-size: 13px; }
.earlier-announcements { margin-top: 12px; }
.earlier-announcements > summary { cursor: pointer; font-weight: 700; }
.earlier-ann { margin-top: 10px; }
.earlier-ann summary { cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.earlier-until { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-top: 10px; }
.earlier-until .field { min-width: 160px; }
.ann-links { margin: 4px 0 0; }
.ann-links a { display: block; width: fit-content; overflow-wrap: anywhere; font-weight: 600; }
