@import url("/css/themes.css");

/* base */
body.app {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
}

:is(.app, .auth-page) .avatar {
  color: #34304A;
  box-shadow: 0 0 0 3px var(--surface), 0 2px 8px rgba(0, 0, 0, .15);
}

/* sidebar */
.sidebar {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 0;
  background: var(--side-bg);
}

/* The mark is drawn inline now rather than loaded as an image, so this has to match both. It is
   also why the sidebar copy carries its own colours instead of currentColor: the disc is white at
   45% on every theme, and a mark inheriting the sidebar's text colour would be near-white on it. */
.side-logo :is(img, .mark) {
  display: block;
  margin-bottom: 14px;
  padding: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .45);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.side-link {
  width: 76px;
  padding: 10px 0;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--side-text);
  text-decoration: none;
  font: 500 12px var(--font-heading);
}

.side-link svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-link:hover {
  background: rgba(255, 255, 255, .14);
}

.side-link.on {
  background: var(--side-active-bg);
  color: var(--side-active-text);
}

.side-me {
  margin-top: auto;
}

/* page */
.dash {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 36px 48px;
}

.dash-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.dash-title {
  margin: 0;
  font: 600 clamp(24px, 3vw, 30px)/1.2 var(--heading-font);
  letter-spacing: -.01em;
}

.dash-date {
  margin: 2px 0 0;
  color: var(--muted);
}

.btn-outline {
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: 500 14px var(--font-heading);
  white-space: nowrap;
  cursor: pointer;
}

.btn-outline:hover {
  color: var(--text);
  border-color: var(--muted);
}

/* banner */
.banner {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 30px;
  border-radius: 20px;
  color: #fff;
  background: var(--banner);
}

.banner-left {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
}

.banner .avatar {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .85);
}

.banner h2 {
  margin: 0;
  font: 500 20px var(--heading-font);
}

.banner p {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, .9);
}

.fly {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #FFF1B8;
  box-shadow: 0 0 10px 4px rgba(255, 215, 122, .55);
}

/* layout */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.dash-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 24px -18px rgba(0, 0, 0, .35);
}

.panel-label {
  margin: 0;
  font: 500 14px var(--font-heading);
  color: var(--muted);
}

/* the first thing a keyboard reaches, so the sidebar is not 12 stops on every screen */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 60;
  padding: 12px 18px;
  background: var(--surface);
  color: var(--text);
  border-radius: 0 0 12px 0;
  font-weight: 700;
}

.skip:focus {
  left: 0;
}

.dash:focus {
  outline: none;
}

/* said while a panel is still waiting, so it is never blank and never a false empty */
.panel-loading {
  margin: 0;
  color: var(--muted);
}

/* a panel that could not load. Deliberately plain: it is not an alarm, it is an admission */
.panel-failed {
  margin: 0;
  color: var(--muted);
}

.panel-hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ring {
  position: relative;
  flex: none;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
}

.ring svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.ring circle {
  fill: none;
  stroke-width: 10;
}

.ring-track {
  stroke: var(--ring-track);
}

.ring-fill {
  stroke: var(--ring);
  stroke-linecap: round;
  stroke-dasharray: 364.42;
  stroke-dashoffset: 364.42;
  transition: stroke-dashoffset .6s;
}

.ring img {
  width: 42px;
  height: 42px;
  opacity: .55;
  transition: opacity .3s, filter .3s;
}

.timer {
  margin: 6px 0 8px;
  font: 600 clamp(34px, 4vw, 46px)/1 var(--heading-font);
  color: var(--number);
  font-variant-numeric: tabular-nums;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--second-soft);
  color: var(--muted);
  font: 500 13px var(--font-heading);
}

.status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  opacity: .6;
}

.btn-leaf {
  flex: none;
  display: inline-block;
  padding: 12px 24px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 15px var(--font-heading);
  text-decoration: none;
  cursor: pointer;
}

.btn-leaf:hover {
  background: var(--accent-hover);
}

.btn-leaf:disabled {
  opacity: .6;
  cursor: default;
}

.btn-small {
  margin-top: 12px;
  padding: 8px 16px;
  font-size: 14px;
}

/* week stats */
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.stat-value {
  margin-top: 8px;
  font: 600 26px/1.1 var(--heading-font);
  color: var(--number);
}

.stat-value small {
  font: 500 14px var(--font-body);
  color: var(--muted);
}

.bar {
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width .6s;
}

.bar-green { background: var(--accent-soft); }
.bar-green span { background: var(--ring); }
.bar-blue { background: var(--second-soft); }
.bar-blue span { background: var(--second); }

:is(.app, .auth-page) .tags {
  margin-top: 12px;
}

:is(.app, .auth-page) .tag {
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* online */
.pill-count {
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font: 600 12px var(--font-heading);
}

.people {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.people li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.people li:first-child {
  border-top: 0;
}

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

.person-avatar {
  position: relative;
}

.dot {
  position: absolute;
  right: -2px;
  bottom: -1px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--dot-online);
  box-shadow: 0 0 6px 1px var(--dot-online);
}

.dot.studying {
  background: var(--glow);
  box-shadow: 0 0 8px 2px var(--glow);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  50% { box-shadow: 0 0 2px 0 var(--glow); }
}

.person-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 14px var(--font-heading);
}

.person-name small {
  display: block;
  font: 400 12px var(--font-body);
  color: var(--muted);
}

/* streak */
.streak-panel {
  display: flex;
  align-items: center;
  gap: 16px;
}

.flame {
  flex: none;
  width: 48px;
  height: 48px;
  padding: 10px;
  border-radius: 14px;
  background: var(--second-soft);
  fill: var(--muted);
  opacity: .7;
}

.streak-panel.lit .flame {
  opacity: 1;
  background: var(--status-run-bg);
  fill: #F29B38;
  filter: drop-shadow(0 0 6px rgba(242, 155, 56, .55));
}

.streak-value {
  margin-top: 2px;
  font: 600 26px/1.1 var(--heading-font);
  color: var(--number);
}

.streak-hint {
  margin-top: 4px;
}

/* leaderboard */
.segmented {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--second-soft);
}

.seg {
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 500 12px var(--font-heading);
  cursor: pointer;
}

.seg.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

.board {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.board li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 10px;
}

.board li.me {
  background: var(--accent-soft);
}

.rank {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font: 600 12px var(--font-heading);
  color: var(--muted);
}

.rank.medal-1 { background: #F4D35E; color: #5A4300; }
.rank.medal-2 { background: #D7DCE2; color: #3E4650; }
.rank.medal-3 { background: #E4B38A; color: #5A3217; }

.board-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 14px var(--font-heading);
}

.board-name small {
  color: var(--muted);
  font: 400 12px var(--font-body);
}

.board-value {
  font: 600 13px var(--font-heading);
  color: var(--number);
  white-space: nowrap;
}

/* goals page */
.panel-title {
  margin: 0;
  font: 600 18px var(--heading-font);
  color: var(--text);
}

.panel-hint-top {
  margin: 2px 0 18px;
}

.progress-row {
  margin: 14px 0 16px;
}

/* profile page */
.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 20px;
  align-items: start;
}

.profile-avatar {
  margin: 20px 0 24px;
}

.theme-grid-wide {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.save-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.save-bar .form-message {
  flex: 1;
  min-height: 0;
}

.save-bar .btn-outline {
  text-decoration: none;
  padding: 11px 18px;
}

:is(.app, .auth-page) .theme-option {
  border-color: var(--border);
  background: var(--surface);
}

:is(.app, .auth-page) .theme-option:hover {
  border-color: var(--muted);
}

:is(.app, .auth-page) .theme-option.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

:is(.app, .auth-page) .theme-name {
  color: var(--text);
}

:is(.app, .auth-page) .link-btn {
  color: var(--muted);
}

@media (max-width: 900px) {
  .profile-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* chat button badge */
.side-link {
  position: relative;
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: 12px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #C4323A;
  color: #fff;
  font: 600 12px/18px var(--font-heading);
  text-align: center;
}

/* chat page */
.chat-dash {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding-bottom: 24px;
}

.chat-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
}

.chat-list {
  overflow-y: auto;
  padding: 14px 10px;
}

.convos-label {
  padding: 0 8px 8px;
}

.convo {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.convo:hover {
  background: var(--second-soft);
}

.convo.on {
  background: var(--accent-soft);
}

.convo-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.convo-name {
  font: 500 14px var(--font-heading);
}

.convo-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}

.convo.unread .convo-name,
.convo.unread .convo-preview {
  color: var(--text);
  font-weight: 700;
}

.convo-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.convo-time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.convo-unread {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 12px/18px var(--font-heading);
  text-align: center;
}

.group-avatar {
  background: var(--accent-soft);
}

.group-avatar img {
  width: 70%;
  height: 70%;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.thread-empty {
  display: none;
}

.chat-thread.no-chat .thread-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
}

.thread-empty img {
  opacity: .8;
}

.thread-empty .panel-hint {
  max-width: 280px;
  margin: 0;
}

.chat-thread.no-chat :is(.thread-head, .messages, .composer, .composer-error) {
  display: none;
}

.thread-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.thread-back {
  display: none;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px 4px 0;
}

.thread-name {
  margin: 0;
  font: 600 16px var(--heading-font);
}

.thread-sub {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.messages-empty {
  margin: auto;
  color: var(--muted);
  text-align: center;
}

.day-divider {
  display: flex;
  justify-content: center;
  margin: 14px 0 8px;
}

.day-divider span {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--second-soft);
  color: var(--muted);
  font: 500 12px var(--font-heading);
}

.msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.msg.grouped {
  margin-top: 2px;
}

.msg.mine {
  flex-direction: row-reverse;
}

.msg-avatar {
  flex: none;
  width: 32px;
  align-self: flex-start;
  padding-top: 18px;
}

.msg.mine .msg-avatar {
  display: none;
}

.msg-body {
  max-width: min(72%, 520px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.msg.mine .msg-body {
  align-items: flex-end;
}

.msg-name {
  margin: 0 0 2px 4px;
  font: 500 12px var(--font-heading);
  color: var(--muted);
}

.bubble {
  padding: 8px 12px;
  border-radius: 16px 16px 16px 4px;
  background: var(--second-soft);
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.mine .bubble {
  border-radius: 16px 16px 4px 16px;
  background: var(--accent);
  color: var(--on-accent);
}

.bubble.deleted,
.msg.mine .bubble.deleted {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-style: italic;
}

.msg-meta {
  margin: 2px 4px 0;
  font-size: 12px;
  color: var(--muted);
}

.msg-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s;
}

.msg:hover .msg-actions,
.msg:focus-within .msg-actions,
.msg-shoutout:hover .msg-actions,
.msg-shoutout:focus-within .msg-actions {
  opacity: 1;
}

@media (hover: none) {
  .msg-actions {
    opacity: 1;
  }
}

.msg-action {
  padding: 2px 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 500 12px var(--font-heading);
  cursor: pointer;
}

.msg-action:hover {
  background: var(--second-soft);
  color: var(--text);
}

.msg-action.danger {
  background: #C4323A;
  color: #fff;
}

.react-picker {
  display: flex;
  gap: 2px;
  margin-top: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .3);
}

.react-picker button {
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 18px;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.react-picker .react-more {
  color: var(--muted);
  font: 600 18px var(--font-heading);
}

.react-picker button:hover {
  background: var(--second-soft);
}

.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.reaction {
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: 500 12px var(--font-heading);
  cursor: pointer;
}

.reaction.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.msg-shoutout {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 12px 0 4px;
}

.shoutout-pill {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--status-run-bg);
  color: var(--status-run-text);
  font: 500 13px var(--font-heading);
  text-align: center;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 140px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 var(--font-body);
  resize: none;
}

.composer textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.composer-error {
  min-height: 0;
  padding: 0 16px;
}

.composer-error:not(:empty) {
  padding-bottom: 10px;
}

/* custom groups */
.new-group-btn {
  width: calc(100% - 16px);
  margin: 2px 8px 12px;
  padding: 9px 12px;
  font-size: 14px;
}

.emoji-avatar {
  font-size: 1.1em;
  line-height: 1;
}

.avatar-xl.emoji-avatar {
  font-size: 52px;
}

.thread-title {
  flex: 1;
  min-width: 0;
}

.thread-title .thread-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-settings {
  padding: 6px 12px;
  font-size: 13px;
}

.group-dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45);
}

.group-dialog::backdrop {
  background: rgba(20, 20, 25, .45);
}

.group-dialog form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 50px);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 12px;
}

.dialog-close {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 22px 12px;
  overflow-y: auto;
}

.dialog-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--border);
}

.dialog-foot .spacer {
  flex: 1;
}

.dialog-foot .btn-outline {
  padding: 11px 18px;
}

.danger-link,
:is(.app, .auth-page) .danger-link {
  color: var(--danger);
}

.group-icon-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.group-icon-options {
  flex: 1;
  min-width: 0;
}

.icon-emojis {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 10px;
}

.icon-emoji {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-size: 18px;
  cursor: pointer;
}

.icon-emoji.on {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.member-list.pick {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 6px;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  font-weight: 500;
}

label.member-row {
  cursor: pointer;
}

label.member-row:hover {
  background: var(--second-soft);
}

.member-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.member-row > span:not(.avatar):not(.role-pill) {
  flex: 1;
}

.member-row small {
  color: var(--muted);
  font-weight: 400;
}

.role-pill {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font: 600 12px var(--font-heading);
}

:is(.app, .auth-page) .field input[type="search"] {
  padding: 9px 12px;
}

/* emoji picker */
.emoji-wrap {
  position: relative;
  flex: none;
}

.emoji-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  font-size: 20px;
  cursor: pointer;
}

.emoji-toggle:hover {
  border-color: var(--accent);
}

@media (max-width: 760px) {
  .settings-label {
    display: none;
  }
}

@media (max-width: 760px) {
  .chat-dash {
    height: calc(100vh - 76px);
  }

  .chat-dash .dash-top {
    display: none;
  }

  .chat-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-layout .chat-thread,
  .chat-layout.thread-open .chat-list {
    display: none;
  }

  .chat-layout.thread-open .chat-thread {
    display: flex;
  }

  .thread-back {
    display: block;
  }

  .msg-body {
    max-width: 82%;
  }
}

/* courses */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.course-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 24px -18px rgba(0, 0, 0, .35);
  transition: transform .15s, box-shadow .15s;
}

.course-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 16px 30px -18px rgba(0, 0, 0, .45);
}

.course-cover {
  display: block;
  height: 120px;
}

.course-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px 16px;
}

.course-code {
  margin: 0;
  font: 600 12px var(--font-heading);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.course-name {
  font: 600 17px/1.3 var(--heading-font);
}

.course-tools {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
}

.course-tool svg,
.tool-tab svg,
.tool-empty-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.course-new {
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 230px;
  border-style: dashed;
  border-width: 2px;
  background: transparent;
  box-shadow: none;
  font: inherit;
  cursor: pointer;
}

.course-new-plus {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font: 400 30px/1 var(--font-heading);
}

.course-preview {
  display: flex;
  align-items: flex-end;
  height: 110px;
  padding: 12px;
  border-radius: 14px;
}

.course-preview-label {
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: 600 14px var(--heading-font);
}

.cover-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.cover-option {
  aspect-ratio: 1.3;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}

.cover-option.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* course page */
.back-link {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--muted);
  font: 500 14px var(--font-heading);
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
}

.course-banner {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  min-height: 170px;
  padding: 20px;
  border-radius: 20px;
}

.course-banner-card {
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 8px 24px -14px rgba(0, 0, 0, .4);
}

.course-banner-card .dash-title {
  margin-top: 2px;
}

.course-edit {
  align-self: flex-start;
}

.tool-tabs {
  display: flex;
  gap: 6px;
  margin: 20px 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tool-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: 500 14px var(--font-heading);
  white-space: nowrap;
  cursor: pointer;
}

.tool-tab:hover {
  color: var(--text);
}

.tool-tab.on {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.tool-panel {
  min-height: 280px;
  display: grid;
  place-items: center;
}

.tool-empty {
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.tool-empty p {
  margin: 0;
  color: var(--muted);
}

.tool-empty-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.tool-empty-icon svg {
  width: 26px;
  height: 26px;
}

.soon-pill {
  margin-top: 6px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--second-soft);
  color: var(--muted);
  font: 600 12px var(--font-heading);
}

@media (max-width: 640px) {
  .cover-picker {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  .course-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .course-edit {
    align-self: flex-end;
    order: -1;
  }
}

.mini-folder {
  position: relative;
  flex: none;
  width: 34px;
  height: 25px;
  margin-top: 6px;
  border-radius: 2px 6px 6px 6px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}

.mini-folder::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 0;
  width: 45%;
  height: 6px;
  border-radius: 4px 5px 0 0;
  background: inherit;
}

.course-mini-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.course-mini-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 600 13px/1.3 var(--heading-font);
}

.course-mini-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
}

.course-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}

.course-pick {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 30px 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.course-pick:hover {
  border-color: var(--accent);
}

.course-pick.on {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pick-check {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  color: transparent;
  font-size: 12px;
  transform: translateY(-50%);
}

.course-pick.on .pick-check {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.focus-courses {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.focus-course {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--bg);
}

.focus-course-link {
  flex: 1 1 180px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.focus-course-link:hover strong {
  text-decoration: underline;
}

.focus-hours {
  flex: 1 1 140px;
  min-width: 0;
  font: 600 14px var(--heading-font);
  color: var(--number);
}

.focus-hours small {
  font: 500 12px var(--font-body);
  color: var(--muted);
}

.focus-hours .bar {
  height: 6px;
  margin-top: 6px;
}

.focus-note {
  flex: 2 1 200px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.focus-note input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.focus-note span {
  overflow-wrap: anywhere;
}

.focus-note.done span {
  color: var(--muted);
  text-decoration: line-through;
}

.course-goals {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.course-goals .panel-hint {
  margin: 0;
}

.course-goal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px minmax(0, 1.6fr);
  align-items: center;
  gap: 8px;
}

.course-goal-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

:is(.app, .auth-page) .course-goal input {
  width: 100%;
  min-width: 0;
}

.timer-course {
  order: 1;
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

.timer-course[hidden] {
  display: none;
}

.timer-course select {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 14px var(--font-body);
}

@media (max-width: 640px) {

  .course-goal {
    grid-template-columns: minmax(0, 1fr) 84px;
  }

  .course-goal input[data-goal-note] {
    grid-column: 1 / -1;
  }

  .timer-course {
    flex: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }
}

/* folders */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px 16px;
  margin: 18px 0 6px;
}

.folder-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.folder-shape {
  position: relative;
  display: block;
  height: 92px;
  margin-top: 12px;
  border-radius: 4px 14px 14px 14px;
  box-shadow: 0 10px 18px -12px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(0, 0, 0, .06);
  transition: transform .15s;
}

.folder-shape::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 0;
  width: 45%;
  height: 14px;
  border-radius: 10px 12px 0 0;
  background: inherit;
  background-position: 0 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}

.folder-shape::after {
  content: "";
  position: absolute;
  inset: 16px 0 0;
  border-radius: 10px 10px 14px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 60%);
  box-shadow: 0 -2px 6px -3px rgba(0, 0, 0, .25);
}

.folder-card:hover .folder-shape {
  transform: translateY(-3px);
}

.folder-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.folder-label strong {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font: 500 14px/1.3 var(--font-heading);
}

.folder-label small {
  color: var(--muted);
  font-size: 12px;
}

.folder-unsorted {
  background: var(--second-soft);
}

.folder-add {
  display: grid;
  place-items: center;
  border: 2px dashed var(--border);
  background: transparent;
  box-shadow: none;
}

.folder-add::before {
  top: -12px;
  left: -2px;
  border: 2px dashed var(--border);
  border-bottom: 0;
  background: transparent;
  box-shadow: none;
}

.folder-add::after {
  display: none;
}

.folder-add span {
  color: var(--accent-text);
  font: 400 32px/1 var(--font-heading);
}

.folder-new:hover .folder-add {
  border-color: var(--accent);
}

.folder-preview-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

.folder-preview-row .field {
  flex: 1;
}

.folder-shape-lg {
  flex: none;
  width: 96px;
  height: 70px;
  margin-top: 12px;
}

.design-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.design-option {
  height: 40px;
  border: 2px solid transparent;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
  cursor: pointer;
}

.design-option.on {
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.topic-swatch {
  flex: none;
  width: 14px;
  height: 11px;
  border-radius: 2px 4px 4px 4px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
}

@media (max-width: 640px) {
  .folder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* topics */
.course-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.topic-rail {
  position: sticky;
  top: 20px;
  padding: 14px 10px;
}

.topic-heading {
  padding: 0 8px 8px;
}

.topic-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.topic-row {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: 10px;
}

.topic-row:hover {
  background: var(--second-soft);
}

.topic-row.on {
  background: var(--accent-soft);
}

.topic-item {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.topic-row.on .topic-item {
  color: var(--accent-text);
  font-weight: 700;
}

.topic-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: inherit;
  font-family: var(--font-heading);
  font-size: 14px;
}

.topic-count {
  flex: none;
  min-width: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: 600 12px/20px var(--font-heading);
  text-align: center;
}

.topic-tools {
  display: none;
  gap: 2px;
  padding-right: 6px;
}

.topic-row:hover .topic-tools,
.topic-row:focus-within .topic-tools {
  display: flex;
}

.topic-row:hover .topic-count,
.topic-row:focus-within .topic-count {
  display: none;
}

.topic-tools button {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.topic-tools button:hover:not(:disabled) {
  background: var(--surface);
  color: var(--text);
}

.topic-tools button:disabled {
  opacity: .3;
  cursor: default;
}

.topic-add {
  width: 100%;
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--accent-text);
  font: 500 14px var(--font-heading);
  text-align: left;
  cursor: pointer;
}

.topic-add:hover {
  border-color: var(--accent);
}

.topic-tip {
  margin: 10px 8px 0;
}

.topic-rename {
  margin-left: 6px;
  font-size: 13px;
  vertical-align: middle;
}

.note-topic {
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--second-soft);
  color: var(--muted);
  font: 500 12px var(--font-heading);
  vertical-align: middle;
}

.note-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 12px;
}

:is(.app, .auth-page) .field select {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 15px var(--font-body);
}

@media (max-width: 900px) {
  .course-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .topic-rail {
    position: static;
    padding: 10px;
  }

  .topic-list {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    scrollbar-width: none;
  }

  .topic-row {
    flex: none;
    border: 1px solid var(--border);
  }

  .topic-name {
    max-width: 180px;
  }

  .topic-tools {
    display: none !important;
  }

  .topic-row .topic-count {
    display: inline-block !important;
  }

  .topic-heading,
  .topic-tip {
    display: none;
  }

  .topic-add {
    width: auto;
  }
}

@media (max-width: 640px) {
  .note-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* practice test */
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.score-pill {
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  font: 600 12px var(--font-heading);
  white-space: nowrap;
}

.score-pill.pass { background: #DDF1E3; color: #235C36; }
.score-pill.fail { background: #FBE3E3; color: #8A2626; }

.test-take,
.test-results {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.test-results > .back-link,
.test-take .back-link {
  align-self: flex-start;
  margin: 0;
}

.test-questions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.test-question {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
}

.test-q-head {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.test-num {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font: 600 14px var(--font-heading);
}

.test-q-text {
  margin: 6px 0 0;
  font: 500 16px/1.45 var(--heading-font);
  overflow-wrap: anywhere;
}

.test-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-left: 42px;
}

.tf-row {
  grid-template-columns: repeat(2, minmax(0, 160px));
}

.test-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  overflow-wrap: anywhere;
  cursor: pointer;
}

.test-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.test-option:hover {
  border-color: var(--accent);
}

.test-option.on {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.test-option.on .option-key {
  background: var(--accent);
  color: var(--on-accent);
}

.test-option:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.test-short {
  width: calc(100% - 42px);
  margin-left: 42px;
}

.test-submit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.test-submit .form-message {
  min-height: 0;
  margin: 0;
}

.result-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
  padding: 20px;
  border-radius: 18px;
  background: var(--bg);
}

.result-hero .generate-actions {
  margin-top: 12px;
}

.result-score {
  flex: none;
  width: 120px;
  height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 8px solid;
}

.result-score strong {
  font: 700 30px/1 var(--heading-font);
}

.result-score span {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.result-score.pass { border-color: #7CC495; color: var(--accent-text); }
.result-score.fail { border-color: #EBA3A3; color: var(--danger); }

.test-question.review.good {
  border-color: #A9D9B7;
}

.test-question.review.good .test-num {
  background: #2D844C;
  color: #fff;
}

.test-question.review.bad {
  border-color: #EDB5B5;
}

.test-question.review.bad .test-num {
  background: var(--danger);
  color: var(--surface);
}

.review-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 42px;
  overflow-wrap: anywhere;
}

.review-lines p {
  margin: 0;
}

.review-lines .panel-label {
  display: inline;
  margin-right: 6px;
  font-size: 13px;
}

.explanation {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
}

.review-lines .link-btn {
  align-self: flex-start;
}

/* study guide */
.guide-meta {
  margin: 4px 0 0;
}

.guide-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 4px;
}

.guide-toc a {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font: 500 13px var(--font-heading);
  text-decoration: none;
}

.guide-toc a:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.guide-prose {
  max-width: 76ch;
}

.guide-prose h2 {
  scroll-margin-top: 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* the guide says its notes have moved on, and waits to be asked */
.guide-outdated {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--accent-soft);
}

.guide-outdated p {
  margin: 0;
  color: var(--text);
}

.guide-stale {
  margin-top: 8px;
  opacity: .45;
  pointer-events: none;
}

@media (max-width: 640px) {
  .test-options,
  .tf-row {
    grid-template-columns: minmax(0, 1fr);
    padding-left: 0;
  }

  .test-short {
    width: 100%;
    margin-left: 0;
  }

  .review-lines {
    padding-left: 0;
  }

  .result-hero {
    justify-content: center;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 3s;
  }
}

/* smart study */
.smart {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.smart-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.smart-top .back-link {
  margin: 0;
}

.smart-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-stat {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--second-soft);
  color: var(--muted);
  font: 600 12px var(--font-heading);
}

.type-pill {
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font: 600 12px var(--font-heading);
  letter-spacing: .02em;
}

.smart-q {
  margin: 0;
  font: 600 clamp(18px, 2.2vw, 22px)/1.35 var(--heading-font);
  overflow-wrap: anywhere;
}

.mcq-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mcq-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 16px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  background: var(--second-soft);
  color: var(--text);
  font: 500 15px/1.4 var(--font-body);
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.mcq-option:hover:not(:disabled) {
  border-color: var(--accent);
}

.option-key {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font: 600 13px var(--font-heading);
}

.mcq-option.right {
  border-color: #3E9B5F;
  background: #CDEFD7;
  color: #1E4D2E;
}

.mcq-option.right .option-key {
  background: #2D844C;
  color: #fff;
}

.mcq-option.wrong {
  border-color: var(--danger);
  background: #F9DCDC;
  color: #6B1F1F;
}

.mcq-option.wrong .option-key {
  background: var(--danger);
  color: var(--surface);
}

.mcq-option.faded {
  opacity: .55;
}

.mcq-option:disabled {
  cursor: default;
}

.tf-statement {
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--bg);
}

.tf-statement .panel-label {
  margin-bottom: 4px;
}

.tf-answer {
  margin: 0;
  font: 500 16px/1.5 var(--font-body);
  overflow-wrap: anywhere;
}

.match-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.match-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-item {
  min-height: 52px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: 500 14px/1.4 var(--font-body);
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.match-item:hover:not(:disabled) {
  border-color: var(--accent);
}

.match-item.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.match-item.matched {
  border-color: #3E9B5F;
  background: #CDEFD7;
  color: #1E4D2E;
  cursor: default;
}

.match-item.wrong {
  border-color: var(--danger);
  background: #F9DCDC;
  color: #6B1F1F;
  animation: shake .3s;
}

@keyframes shake {
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.match-hint {
  margin: 0;
}

.type-form {
  display: flex;
  gap: 10px;
}

.type-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 16px var(--font-body);
}

.type-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.smart-feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
}

.smart-feedback strong {
  font: 600 16px var(--font-heading);
}

.smart-feedback p {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.smart-feedback.good {
  background: #E3F4E8;
  color: #1E4D2E;
}

.smart-feedback.bad {
  background: #FBE7E7;
  color: #6B1F1F;
}

.smart-feedback .panel-label {
  display: inline;
  color: inherit;
  opacity: .8;
}

.smart-feedback .link-btn {
  margin-top: 4px;
  color: inherit;
}

.smart-feedback kbd {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .22);
  font: 600 12px var(--font-heading);
}

.smart-foot {
  display: flex;
  justify-content: flex-start;
}

.smart-foot .btn-outline {
  padding: 8px 14px;
}

.smart-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.smart-history li {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  overflow-wrap: anywhere;
}

.history-mark {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
}

.smart-history li.good .history-mark { background: #2D844C; }
.smart-history li.bad .history-mark { background: var(--danger); color: var(--surface); }

.smart-empty {
  margin: 20px auto;
}

.struggled {
  width: min(520px, 100%);
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--bg);
  text-align: left;
}

.struggled ul {
  margin: 8px 0 0;
  padding-left: 1.2em;
}

.struggled li + li {
  margin-top: 6px;
}

.struggled strong {
  display: block;
}

@media (max-width: 640px) {
  .mcq-grid,
  .match-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .match-grid {
    gap: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .match-item.wrong {
    animation: none;
  }
}

/* flashcards */
.deck-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  margin-bottom: 16px;
}

.deck-stats div {
  display: flex;
  flex-direction: column;
}

.deck-stats strong {
  font: 600 28px/1.1 var(--heading-font);
  color: var(--number);
}

.deck-stats span {
  font-size: 13px;
  color: var(--muted);
}

.card-list {
  display: flex;
  flex-direction: column;
  margin-top: 12px;
}

.card-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.card-row + .card-row {
  border-top-color: var(--border);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.card-row:hover {
  border-color: var(--border);
  background: var(--second-soft);
}

.card-row-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-front-text {
  font: 500 15px var(--font-heading);
  overflow-wrap: anywhere;
}

.card-back-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}

.due-pill {
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--second-soft);
  color: var(--muted);
  font: 600 12px var(--font-heading);
  white-space: nowrap;
}

.due-pill.due {
  background: var(--status-run-bg);
  color: var(--status-run-text);
}

.due-pill.new {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.card-dialog .dialog-body {
  gap: 14px;
}

.card-mode {
  align-self: flex-start;
}

#mode-one {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#mode-one[hidden] {
  display: none;
}

.card-textarea {
  min-height: 90px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font-body);
  resize: vertical;
}

.card-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.card-bulk {
  min-height: 220px;
}

/* study mode */
.study {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.study-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.study-top .back-link {
  margin: 0;
}

.study-bar {
  margin-top: 0;
}

.flashcard {
  width: 100%;
  min-height: 280px;
  padding: 0;
  border: 0;
  background: none;
  perspective: 1400px;
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  display: grid;
  min-height: 280px;
  transform-style: preserve-3d;
  transition: transform .45s ease;
}

.flashcard.flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-face {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 28px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 18px 40px -26px rgba(0, 0, 0, .45);
  backface-visibility: hidden;
  text-align: center;
}

.flashcard-back {
  transform: rotateY(180deg);
  background:
    linear-gradient(var(--accent-soft), var(--accent-soft)) top / 100% 6px no-repeat,
    var(--surface);
}

.face-label {
  font: 600 12px var(--font-heading);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.face-text {
  font: 500 clamp(18px, 2.4vw, 24px)/1.4 var(--heading-font);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.flip-btn {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.flip-btn kbd {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .22);
  font: 600 12px var(--font-heading);
}

.grade-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.grade-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.grade-btn strong {
  font: 600 15px var(--font-heading);
}

.grade-btn span {
  font-size: 12px;
  color: var(--muted);
}

.grade-again strong { color: var(--danger); }
/* amber, pulled towards this theme's text so it stays readable on any surface */
.grade-hard strong { color: color-mix(in srgb, #C0842A 70%, var(--text)); }
.grade-good strong { color: var(--accent-text); }
.grade-easy strong { color: var(--second); }

.grade-btn:hover {
  border-color: var(--accent);
}

.study-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 0;
  text-align: center;
}

@media (max-width: 640px) {
  .grade-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flashcard,
  .flashcard-inner {
    min-height: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flashcard-inner {
    transition: none;
  }
}

/* summary */
.generate-card {
  margin: 18px 0 8px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
}

.generate-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.generate-top .soon-pill {
  margin-top: 0;
  flex: none;
}

.generate-title {
  margin: 0;
  font: 600 17px/1.3 var(--heading-font);
}

.generate-top .panel-hint {
  margin-top: 4px;
}

.generate-options {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  margin: 16px 0;
}

.generate-options .panel-label {
  margin-bottom: 6px;
  font-size: 13px;
}

.generate-options .chips {
  margin-bottom: 0;
}

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

.generate-actions .btn-outline {
  padding: 11px 18px;
}

.generate-card .form-message {
  min-height: 0;
  margin-top: 10px;
  color: var(--muted);
}

.link-reset {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.summary-view-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.summary-view-head .notes-actions .btn-outline {
  padding: 8px 14px;
}

.danger-outline {
  color: var(--danger);
}

.summary-view .form-message {
  min-height: 0;
  margin: 8px 0 0;
}

.prose {
  max-width: 72ch;
  padding-top: 8px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.prose h1,
.prose h2,
.prose h3 {
  margin: 1.4em 0 .4em;
  font-family: var(--heading-font);
  line-height: 1.3;
}

.prose h1 { font-size: 24px; }
.prose h2 { font-size: 20px; }
.prose h3 { font-size: 17px; }

.prose p,
.prose ul,
.prose ol {
  margin: .6em 0;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose li + li {
  margin-top: .25em;
}

.prose strong {
  color: var(--number);
}

.prose blockquote {
  margin: 1em 0;
  padding: 8px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--accent-soft);
}

.prose code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--second-soft);
  font-size: .9em;
}

.prose table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
}

.prose th,
.prose td {
  padding: 6px 10px;
  border: 1px solid var(--border);
}

/* notes & files */
.tool-panel-filled {
  display: block;
  place-items: normal;
  min-height: 0;
}

.notes-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.notes-head .panel-hint {
  max-width: 52ch;
  margin-top: 4px;
}

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

.notes-actions .btn-outline {
  padding: 11px 18px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 18px 0 8px;
  padding: 22px;
  border: 2px dashed var(--border);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
  transition: border-color .15s, background .15s;
}

.dropzone strong {
  color: var(--text);
  font: 500 15px var(--font-heading);
}

.dropzone.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-status {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.upload-status li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--second-soft);
  font-size: 14px;
}

.upload-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.upload-status li.done .upload-state {
  color: var(--accent-text);
}

.upload-status li.failed .upload-state {
  color: var(--danger);
}

.notes-total {
  margin: 16px 0 8px;
}

.notes-empty {
  margin-top: 18px;
  padding: 28px;
  border-radius: 14px;
  background: var(--second-soft);
  text-align: center;
}

.notes-empty p {
  margin: 0;
}

.note-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.note-item + .note-item {
  border-top-color: var(--border);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.note-item:hover {
  border-color: var(--border);
  background: var(--second-soft);
}

.note-badge {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font: 700 12px var(--font-heading);
}

.badge-pdf { background: #F9DEDC; color: #B3261E; }
.badge-pptx { background: #FCE3CF; color: #A64C18; }
.badge-docx { background: #DCE6F7; color: #2B579A; }

.note-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.note-title {
  font: 500 15px var(--font-heading);
}

.note-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}

.note-meta {
  flex: none;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.note-dialog {
  width: min(760px, calc(100vw - 32px));
}

.note-textarea {
  min-height: 320px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font-body);
  resize: vertical;
}

.note-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

@media (max-width: 640px) {
  .note-meta {
    display: none;
  }

  .dropzone {
    display: none;
  }
}

/* login, sign up, reset and welcome */
body.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: var(--bg);
  color: var(--text);
}

.auth-shell {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .35);
}

.auth-shell-wide {
  width: min(1040px, 100%);
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
}

.auth-hero {
  position: relative;
  overflow: hidden;
  min-height: 540px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 40px;
  /* The same light patch every theme banner has, and the same problem the closing band had: the
     small white list items at the bottom sit under it. Measured pixel by pixel on the sign-in and
     invite screens, ocean fell to 4.20. A 16% shade over the whole panel, matching .closer, rather
     than a shade behind the words, which cannot reach the lines above them. Token arithmetic is no
     use here — it pairs a wash in one corner with a base colour from the other and over-reports. */
  background: linear-gradient(rgb(0 0 0 / .16), rgb(0 0 0 / .16)), var(--banner);
  color: #fff;
}

.auth-brand,
.auth-hero-text,
.auth-points,
.step-dots {
  position: relative;
  z-index: 1;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font: 600 22px var(--heading-font);
  text-decoration: none;
}

/* same reason as .side-logo: the mark is inline now, and it sits on a white disc over the dark
   banner, so it keeps its own colours rather than inheriting the hero's white text */
.auth-brand :is(img, .mark) {
  width: 40px;
  height: 40px;
  padding: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .85);
}

.auth-hero h1 {
  margin: 0;
  font: 600 clamp(28px, 3.4vw, 40px)/1.15 var(--heading-font);
  letter-spacing: -.01em;
}

.auth-hero p {
  max-width: 36ch;
  margin: 12px 0 0;
  color: rgba(255, 255, 255, .85);
}

.auth-points {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-points li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-points li::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FFF1B8;
  box-shadow: 0 0 8px 3px rgba(255, 215, 122, .6);
}

.step-dots {
  display: flex;
  gap: 6px;
}

.step-dots span {
  width: 28px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .35);
}

.step-dots span.on {
  background: #fff;
}

.auth-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px;
  overflow-y: auto;
}

.auth-shell-wide .auth-card {
  justify-content: flex-start;
  max-height: calc(100vh - 64px);
}

.auth-title {
  margin: 0;
  font: 600 26px/1.2 var(--heading-font);
}

.auth-sub {
  margin: 6px 0 20px;
  color: var(--muted);
}

.auth-page .switch {
  background: var(--second-soft);
}

.auth-page .show-btn {
  color: var(--accent-text);
}

.auth-page .form-message {
  color: var(--danger);
}

.auth-page .step-label {
  margin: 0 0 6px;
  color: var(--accent-text);
}

.auth-page .hint {
  color: var(--muted);
}

.auth-link {
  align-self: flex-end;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font: 600 14px var(--font-body);
  cursor: pointer;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-back {
  align-self: flex-start;
  margin-top: 16px;
}

/* the two ways out of the login card: ask for an invite, or go back to the front door */
.auth-ask {
  align-self: center;
  margin-top: 22px;
  text-decoration: none;
}

.auth-ask + .auth-home {
  margin-top: 8px;
}

.auth-home {
  align-self: center;
  margin-top: 22px;
  color: var(--muted);
  text-decoration: none;
}

.btn-link-block {
  display: block;
  text-align: center;
  text-decoration: none;
}

@media (max-width: 760px) {
  body.auth-page {
    place-items: start center;
    padding: 16px;
  }

  .auth-shell,
  .auth-shell-wide {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-hero {
    min-height: 0;
    gap: 16px;
    padding: 24px;
  }

  .auth-points {
    display: none;
  }

  .auth-card {
    padding: 28px 22px;
  }

  .auth-shell-wide .auth-card {
    max-height: none;
  }
}

/* forms inside the app follow the theme */
:is(.app, .auth-page) .field {
  color: var(--text);
}

:is(.app, .auth-page) .field input {
  border-color: var(--border);
  background: var(--bg);
  color: var(--text);
}

:is(.app, .auth-page) .field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

:is(.app, .auth-page) .chip {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

:is(.app, .auth-page) .chip.on {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

:is(.app, .auth-page) .tag button {
  color: var(--accent-text);
}

:is(.app, .auth-page) .btn-soft {
  background: var(--accent-soft);
  color: var(--accent-text);
}

:is(.app, .auth-page) .toggle {
  color: var(--text);
}

:is(.app, .auth-page) .toggle input {
  accent-color: var(--accent);
}

:is(.app, .auth-page) .btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

:is(.app, .auth-page) .btn-primary:hover {
  background: var(--accent-hover);
}

:is(.app, .auth-page) .form-message.ok {
  color: var(--accent-text);
}

@media (max-width: 900px) {
  .dash-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  body.app {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: 76px;
  }

  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  }

  .side-logo {
    display: none;
  }

  .side-nav {
    flex: 1;
    flex-direction: row;
    justify-content: space-around;
    gap: 2px;
  }

  .side-link {
    width: auto;
    min-width: 52px;
    padding: 7px 4px;
    font-size: 12px;
  }

  .side-me {
    margin-top: 0;
  }

  .dash {
    grid-column: 1;
    padding: 20px 16px 32px;
  }

  .banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dot.studying {
    animation: none;
  }
}

@media (hover: hover) and (pointer: fine) {
  body.app,
  body.app *,
  body.auth-page,
  body.auth-page *,
  body.shell,
  body.shell * {
    cursor: var(--homeroom-cursor) !important;
  }

  body.app :is(input:not([type="checkbox"], [type="radio"], [type="file"]), textarea, [contenteditable="true"]),
  body.auth-page :is(input:not([type="checkbox"], [type="radio"], [type="file"]), textarea, [contenteditable="true"]),
  body.shell input:not([type="range"]) {
    cursor: text !important;
  }
}

/* study group updates and new chats */
.new-chat-row {
  display: flex;
  gap: 8px;
  margin: 2px 8px 12px;
}

.new-chat-row .new-group-btn {
  flex: 1;
  width: auto;
  margin: 0;
  white-space: nowrap;
}

.chat-thread.feed-only :is(.composer, .composer-error) {
  display: none;
}

.chat-dialog .dialog-body {
  padding-bottom: 20px;
}

.chat-dialog .member-list.pick {
  max-height: 320px;
}

.friend-pick {
  width: 100%;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.friend-pick:hover {
  background: var(--second-soft);
}

/* the custom cursor for the newer themes */

/* the attendance grid */
.streak-panel {
  flex-wrap: wrap;
}

.streak-grid {
  flex: 1 1 100%;
  min-width: 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.glow-panel {
  margin-bottom: 20px;
}

.grid-summary {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}

.grid-summary strong {
  color: var(--text);
  font-weight: 600;
}

.grid-scroll {
  overflow-x: auto;
  padding: 2px 2px 4px;
}

.study-grid {
  --cell: 12px;
  --gap: 3px;
  display: grid;
  grid-template-columns: auto max-content;
  gap: 4px 6px;
  width: max-content;
}

.grid-months {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(var(--weeks), var(--cell));
  column-gap: var(--gap);
  height: 13px;
  font-size: 12px;
  line-height: 13px;
  color: var(--muted);
}

.grid-months span {
  white-space: nowrap;
}

.grid-weekdays {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-rows: repeat(7, var(--cell));
  row-gap: var(--gap);
  font-size: 12px;
  line-height: var(--cell);
  color: var(--muted);
}

.grid-cells {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-rows: repeat(7, var(--cell));
  grid-auto-flow: column;
  grid-auto-columns: var(--cell);
  gap: var(--gap);
}

.g-cell {
  position: relative;
  display: block;
  width: var(--cell, 10px);
  height: var(--cell, 10px);
  border-radius: 3px;
  background: var(--ring-track);
}

.g-1 { background: color-mix(in srgb, var(--ring) 35%, var(--ring-track)); }
.g-2 { background: color-mix(in srgb, var(--ring) 58%, var(--ring-track)); }
.g-3 { background: color-mix(in srgb, var(--ring) 80%, var(--ring-track)); }

.g-4 {
  background: var(--ring);
  box-shadow: 0 0 6px color-mix(in srgb, var(--glow) 70%, transparent);
}

.g-future {
  background: transparent;
}

.g-today {
  outline: 1.5px solid var(--number);
  outline-offset: 1px;
}

.grid-cells .g-cell[data-label]:hover {
  outline: 1.5px solid var(--text);
  outline-offset: 1px;
}

/* the best day of the year gets a gold star, which is what the panel's own words promise.
   It was a glowing dot drawn to look like a firefly until the app was renamed on 20 Nov 2026.
   The colour stays var(--glow) so every one of the fifteen themes keeps its own star. */
.g-best::after {
  content: "\2605";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  font-size: 10px;
  line-height: 12px;
  text-align: center;
  color: var(--glow);
  text-shadow: 0 0 4px var(--glow);
  animation: grid-star 2.4s ease-in-out infinite;
}

@keyframes grid-star {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

.grid-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.grid-legend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* calendar */
.kind-test { --kind: var(--accent); }
.kind-exam { --kind: #E0564B; }
.kind-assignment { --kind: var(--second); }
.kind-other { --kind: var(--muted); }

.cal-add.btn-small {
  margin-top: 0;
  padding: 6px 12px;
}

.cal-countdown {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 14px;
}

.cal-countdown-days {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
  font: 600 22px/1 var(--heading-font);
  color: var(--kind);
}

.cal-countdown-days small {
  margin-top: 3px;
  font: 500 12px var(--font-body);
  color: var(--muted);
}

.cal-countdown strong {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.cal-countdown small {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 6px;
  font: 600 14px var(--heading-font);
  color: var(--text);
}

.cal-nav {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.cal-nav:hover {
  background: var(--second-soft);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  text-align: center;
}

.cal-weekday {
  padding: 2px 0;
  font-size: 12px;
  color: var(--muted);
}

.cal-day {
  position: relative;
  aspect-ratio: 1;
  max-height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text);
  font: 500 13px var(--font-body);
  cursor: pointer;
}

.cal-day:hover {
  background: var(--second-soft);
}

.cal-day.studied {
  background: color-mix(in srgb, var(--ring) 32%, transparent);
}

.cal-day.today {
  box-shadow: inset 0 0 0 1.5px var(--number);
  font-weight: 700;
}

.cal-day.selected {
  background: var(--accent);
  color: var(--on-accent);
}

.cal-dots {
  position: absolute;
  bottom: 2px;
  left: 50%;
  display: flex;
  gap: 2px;
  transform: translateX(-50%);
}

.cal-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--kind);
}

.cal-day.selected .cal-dots i {
  background: #fff;
}

.cal-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.cal-key i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--kind);
}

.cal-key i:first-child {
  margin-left: 0;
}

.cal-key i.studied {
  background: color-mix(in srgb, var(--ring) 55%, transparent);
}

.cal-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.cal-list .panel-hint {
  margin: 0;
}

.cal-list-label {
  margin: 4px 0 0;
  font: 600 12px var(--heading-font);
  color: var(--muted);
}

.cal-list-label:first-child {
  margin-top: 0;
}

.cal-event {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-left: 3px solid var(--kind);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cal-event:hover {
  background: var(--second-soft);
}

.cal-kind {
  flex: none;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--kind) 18%, transparent);
  color: color-mix(in srgb, var(--kind) 45%, var(--text));
  font-size: 12px;
  font-weight: 600;
}

.cal-event-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cal-event-text strong {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.cal-event-text small {
  font-size: 12px;
  color: var(--muted);
}

.cal-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 640px) {
  .cal-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .g-best::after {
    animation: none;
  }
}

.player-link {
  display: flex;
  gap: 8px;
}

.player-link input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 14px var(--font-body);
}

.player-link .btn-leaf {
  padding: 10px 16px;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.room,
.room-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 600 14px var(--font-body);
}

.room {
  width: 100%;
  border: 1.5px solid transparent;
  text-align: left;
  cursor: pointer;
}

.room:hover {
  border-color: var(--accent);
}

.room-head .link-btn {
  margin-left: auto;
}

.room-icon {
  font-size: 20px;
}

/* page transitions: the sidebar stays put and the page moves in a way that suits the theme */
:root,
:root[data-theme="meadow"] {
  --page-in: page-lift .45s cubic-bezier(.22, 1, .36, 1);
  --page-out: page-fade-out .16s ease-in forwards;
}

:root[data-theme="ember"] {
  --page-in: page-haze .55s ease-out;
  --page-out: page-haze-out .16s ease-in forwards;
}

:root[data-theme="pumpkin"] {
  --page-in: page-rise .5s cubic-bezier(.2, .8, .2, 1);
  --page-out: page-fade-out .16s ease-in forwards;
}

:root[data-theme="pink"] {
  --page-in: page-pop .45s cubic-bezier(.34, 1.56, .64, 1);
  --page-out: page-shrink-out .16s ease-in forwards;
}

:root[data-theme="cherry"] {
  --page-in: page-snap .28s cubic-bezier(.2, .9, .3, 1);
  --page-out: page-snap-out .14s ease-in forwards;
}

:root[data-theme="retro"] {
  --page-in: page-turn .55s cubic-bezier(.22, 1, .36, 1);
  --page-out: page-turn-out .18s ease-in forwards;
}

:root[data-theme="ocean"] {
  --page-in: page-wave .6s cubic-bezier(.22, 1, .36, 1);
  --page-out: page-fade-out .16s ease-in forwards;
}

:root[data-theme="aurora"] {
  --page-in: page-glow .65s ease-out;
  --page-out: page-glow-out .18s ease-in forwards;
}

:root[data-theme="sunflower"] {
  --page-in: page-bloom .6s cubic-bezier(.22, 1, .36, 1);
  --page-out: page-fade-out .16s ease-in forwards;
}

:root[data-theme="lavender"] {
  --page-in: page-sway .5s cubic-bezier(.34, 1.4, .64, 1);
  --page-out: page-fade-out .16s ease-in forwards;
}

:root[data-theme="frost"] {
  --page-in: page-settle .55s cubic-bezier(.22, 1, .36, 1);
  --page-out: page-fade-out .16s ease-in forwards;
}

:root[data-theme="linen"] {
  --page-in: page-weave .5s cubic-bezier(.22, 1, .36, 1);
  --page-out: page-fade-out .16s ease-in forwards;
}

:root[data-theme="fern"] {
  --page-in: page-unfurl .55s cubic-bezier(.22, 1, .36, 1);
  --page-out: page-fade-out .16s ease-in forwards;
}

:root[data-theme="dusk"] {
  --page-in: page-nightfall .6s ease-out;
  --page-out: page-glow-out .18s ease-in forwards;
}

:root[data-theme="cocoa"] {
  --page-in: page-steep .55s ease-out;
  --page-out: page-haze-out .16s ease-in forwards;
}

/* wait for the page's data with the sidebar showing, then bring the page in */
body.app.checking {
  visibility: visible;
}

body.app.checking .dash {
  visibility: hidden;
}

body.app:not(.checking) .dash {
  animation: var(--page-in);
}

body.app.leaving .dash {
  animation: var(--page-out);
}

@keyframes page-lift {
  from { opacity: 0; transform: translateY(12px); }
}

@keyframes page-fade-out {
  to { opacity: 0; transform: translateY(-6px); }
}

@keyframes page-haze {
  from { opacity: 0; filter: blur(6px) sepia(.4); transform: translateY(6px); }
}

@keyframes page-haze-out {
  to { opacity: 0; filter: blur(4px); }
}

@keyframes page-rise {
  from { opacity: 0; transform: translateY(28px); }
}

@keyframes page-pop {
  from { opacity: 0; transform: scale(.96); }
}

@keyframes page-shrink-out {
  to { opacity: 0; transform: scale(.98); }
}

@keyframes page-snap {
  from { opacity: 0; transform: translateX(22px); }
}

@keyframes page-snap-out {
  to { opacity: 0; transform: translateX(-14px); }
}

@keyframes page-turn {
  from { opacity: 0; transform: perspective(1400px) rotateY(-7deg) translateX(-18px); transform-origin: left center; }
}

@keyframes page-turn-out {
  to { opacity: 0; transform: perspective(1400px) rotateY(5deg); transform-origin: right center; }
}

@keyframes page-wave {
  0% { opacity: 0; transform: translateY(26px); }
  60% { opacity: 1; transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

@keyframes page-glow {
  from { opacity: 0; filter: blur(10px) brightness(1.5) saturate(1.4); }
}

@keyframes page-glow-out {
  to { opacity: 0; filter: blur(8px) brightness(1.3); }
}

@keyframes page-bloom {
  from { opacity: .2; clip-path: circle(0% at 50% 35%); }
  to { opacity: 1; clip-path: circle(150% at 50% 35%); }
}

@keyframes page-sway {
  from { opacity: 0; transform: translateY(14px) rotate(-.6deg); }
}

@keyframes page-settle {
  0% { opacity: 0; transform: translateY(-18px); }
  70% { opacity: 1; transform: translateY(2px); }
  100% { transform: translateY(0); }
}

@keyframes page-weave {
  from { opacity: 0; transform: translateX(-14px) translateY(6px); }
}

@keyframes page-unfurl {
  from { opacity: 0; transform: scaleY(.94) translateY(16px); transform-origin: bottom center; }
}

@keyframes page-nightfall {
  from { opacity: 0; filter: brightness(.55) blur(7px); }
}

@keyframes page-steep {
  from { opacity: 0; filter: blur(5px) saturate(1.3); transform: translateY(8px); }
}

@media (prefers-reduced-motion: reduce) {
  body.app:not(.checking) .dash,
  body.app.leaving .dash {
    animation: none;
  }
}

/* planner */
.planner-tabs {
  display: flex;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  margin: 0 0 18px;
  padding: 4px;
  border-radius: 12px;
  background: var(--second-soft);
}

.planner-tab {
  padding: 8px 18px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font: 600 14px var(--font-body);
  white-space: nowrap;
  cursor: pointer;
}

.planner-tab.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.planner-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.planner-view[hidden] {
  display: none;
}

.planner-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 14px;
}

.planner-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 600 15px var(--heading-font);
  color: var(--text);
}

.planner-summary {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.planner-summary strong {
  color: var(--text);
}

.planner-bar .btn-small {
  margin-top: 0;
}

.planner-empty {
  margin: 20px 0 8px;
  color: var(--muted);
  text-align: center;
}

/* planner: week */
.week-daypicker {
  display: none;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.week-daypicker .chip {
  white-space: nowrap;
}

.week-scroll {
  max-height: 620px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.week-grid {
  display: grid;
  grid-template-columns: 70px repeat(7, minmax(92px, 1fr));
  min-width: 720px;
}

.week-corner,
.week-dayhead {
  position: sticky;
  top: 0;
  z-index: 3;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.week-dayhead {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 8px 4px;
  border-left: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.week-dayhead strong {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font: 600 17px var(--heading-font);
  color: var(--text);
}

.week-dayhead.today strong {
  background: var(--accent);
  color: var(--on-accent);
}

.week-event {
  max-width: 100%;
  padding: 1px 6px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: color-mix(in srgb, var(--kind) 20%, transparent);
  color: var(--text);
  font: 600 12px var(--font-body);
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}

.week-times {
  position: relative;
  grid-row: 2;
  grid-column: 1;
}

.week-times span {
  position: absolute;
  right: 8px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  transform: translateY(-50%);
}

.week-times span:first-child {
  transform: none;
}

.week-day {
  position: relative;
  grid-row: 2;
  border-left: 1px solid var(--border);
  background-image: linear-gradient(var(--border) 1px, transparent 1px);
  background-size: 100% 48px;
  cursor: pointer;
}

.week-day.today {
  background-color: color-mix(in srgb, var(--accent-soft) 50%, transparent);
}

.week-block {
  position: absolute;
  left: 3px;
  right: 3px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  overflow: hidden;
  padding: 4px 6px;
  border: 0;
  border-left: 3px solid var(--block);
  border-radius: 8px;
  background: color-mix(in srgb, var(--block) 26%, var(--surface));
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: grab;
  touch-action: none;
}

.week-block strong,
.week-block small {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.week-block strong {
  font-size: 12px;
  font-weight: 700;
}

.week-block small {
  font-size: 12px;
  color: color-mix(in srgb, var(--muted) 45%, var(--text));
}

.week-block.short {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding-top: 2px;
  padding-bottom: 2px;
}

.week-block.short .week-block-note {
  display: none;
}

.week-block.done {
  border-left-color: color-mix(in srgb, var(--block) 45%, var(--surface));
  background: color-mix(in srgb, var(--block) 12%, var(--surface));
}

.week-block.dragging {
  z-index: 5;
  opacity: .9;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .2);
  cursor: grabbing;
}

.week-now {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  height: 2px;
  background: #E0564B;
  pointer-events: none;
}

.week-now::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #E0564B;
}

@media (max-width: 700px) {
  .week-daypicker {
    display: flex;
  }

  .week-grid {
    grid-template-columns: 66px minmax(0, 1fr);
    min-width: 0;
  }

  .week-dayhead:not(.focus),
  .week-day:not(.focus) {
    display: none;
  }
}

/* planner: to-do */
.todo-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px 150px auto;
  gap: 8px;
}

.todo-form input,
.todo-form select {
  min-width: 0;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 14px var(--font-body);
}

.todo-panel .form-message:empty {
  display: none;
}

.todo-filters {
  margin: 14px 0 0;
}

.todo-group {
  margin-top: 16px;
}

.todo-group.overdue .cal-list-label {
  color: var(--danger);
}

.todo-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.todo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-left: 3px solid var(--block);
  border-radius: 10px;
  background: var(--bg);
}

.todo input {
  flex: none;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.todo-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.todo-text strong {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.todo-text small {
  font-size: 12px;
  color: var(--muted);
}

.todo.done strong {
  color: var(--muted);
  text-decoration: line-through;
}

.todo-panel > .link-btn {
  margin-top: 16px;
}

@media (max-width: 760px) {
  .todo-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .todo-form [name="title"],
  .todo-form button {
    grid-column: 1 / -1;
  }
}

/* planner: calendar */
.month-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 20px;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.month-weekday {
  padding: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.month-cell {
  min-width: 0;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  overflow: hidden;
  padding: 6px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.month-cell:hover {
  border-color: var(--border);
}

.month-cell.selected {
  border-color: var(--accent);
}

.month-num {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  font: 600 13px var(--heading-font);
}

.month-cell.today .month-num {
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
}

.month-chips {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.month-chip {
  display: block;
  overflow: hidden;
  padding: 1px 5px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--kind, var(--block)) 22%, transparent);
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.month-chip.todo {
  padding-left: 2px;
  background: none;
  color: var(--muted);
}

.month-chip.todo.done {
  text-decoration: line-through;
}

.month-more {
  font-size: 12px;
  color: var(--muted);
}

.month-dots {
  display: none;
}

.month-day {
  position: sticky;
  top: 20px;
}

.month-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.cal-event.done strong {
  text-decoration: line-through;
}

@media (max-width: 1000px) {
  .month-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .month-day {
    position: static;
  }
}

@media (max-width: 640px) {
  .month-cell {
    min-height: 52px;
    align-items: center;
    padding: 4px 2px;
  }

  .month-chips {
    display: none;
  }

  .month-dots {
    position: static;
    display: flex;
    margin-top: auto;
    transform: none;
  }
}

/* planner: semester */
.semester-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 200px)) auto;
  align-items: end;
  gap: 12px;
  margin-top: 12px;
}

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

.semester-setup .form-message:empty {
  display: none;
}

.semester-week {
  margin: 4px 0 0;
  font: 600 26px/1.1 var(--heading-font);
  color: var(--number);
}

.semester-week small {
  font: 500 14px var(--font-body);
  color: var(--muted);
}

.semester-bar {
  height: 10px;
  margin-top: 4px;
}

.countdowns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.countdowns .cal-countdown {
  width: 100%;
  margin: 0;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 180px minmax(360px, 1fr);
  align-items: center;
  gap: 12px;
}

.timeline-label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.timeline-track {
  position: relative;
  height: 30px;
  margin: 0 8px;
  border-radius: 8px;
  background: var(--bg);
}

.timeline-axis .timeline-track {
  height: 18px;
  background: none;
}

.timeline-axis .timeline-track span {
  position: absolute;
  top: 0;
  font-size: 12px;
  color: var(--muted);
}

.timeline-mark {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  padding: 0;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--kind);
  cursor: pointer;
}

.timeline-mark.kind-exam {
  border-radius: 3px;
  transform: rotate(45deg);
}

.timeline-mark:hover {
  scale: 1.3;
}

.timeline-today {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  background: var(--number);
  opacity: .5;
}

.semester-hours {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.semester-hours-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 70px;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.semester-hours-row .bar {
  margin: 0;
  background: var(--bg);
}

.semester-hours-row strong {
  text-align: right;
}

.block-times {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 640px) {
  .semester-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .semester-form-actions {
    grid-column: 1 / -1;
  }

  .timeline-row {
    grid-template-columns: 110px minmax(300px, 1fr);
  }

  .semester-hours-row {
    grid-template-columns: 80px minmax(0, 1fr) 60px;
  }

  .block-times {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .block-times .field:first-child {
    grid-column: 1 / -1;
  }

  .side-link {
    min-width: 42px;
    padding: 7px 2px;
    font-size: 12px;
  }

  .side-nav {
    gap: 0;
  }
}

.planner-tabs,
.week-daypicker {
  scrollbar-width: none;
}

.week-daypicker .chip {
  flex: none;
}

@media (max-width: 640px) {
  .planner-tabs {
    width: 100%;
  }

  .planner-tab {
    flex: 1;
    padding: 8px 6px;
    font-size: 13px;
  }
}

/* app frame: Homeroom's pages sit in a frame, which is what keeps the address clean */
body.shell {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

.shell-page {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* friends */
.friend-search {
  width: 100%;
  margin-top: 12px;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 15px var(--font-body);
}

.people-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.people-rows:empty {
  display: none;
}

.person-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.person-row:last-child {
  border-bottom: 0;
}

.person-row-text {
  flex: 1 1 120px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.person-row-text strong {
  overflow: hidden;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text);
}

.person-row-text small {
  font-size: 12px;
  color: var(--muted);
}

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

.person-row-actions .btn-small {
  margin-top: 0;
}

.person-row-actions .btn-outline {
  padding: 7px 12px;
  font-size: 13px;
  text-decoration: none;
}

.friend-tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 600;
}

/* focus */
.focus-grid {
  align-items: start;
}

.focus-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  overflow: hidden;
  padding: 22px 24px 26px;
  text-align: center;
  --phase: var(--ring);
}

.focus-stage.on-break {
  --phase: var(--second);
}

.focus-glow {
  position: absolute;
  top: 30px;
  left: 50%;
  width: 320px;
  height: 320px;
  margin-left: -160px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--glow) 35%, transparent), transparent 65%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s;
}

.focus-stage.focusing .focus-glow,
.focus-stage.on-break .focus-glow {
  opacity: 1;
  animation: focus-breathe 6s ease-in-out infinite;
}

@keyframes focus-breathe {
  0%, 100% { transform: scale(.9); opacity: .55; }
  50% { transform: scale(1.08); opacity: 1; }
}

.focus-top {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.focus-phase {
  padding: 4px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--phase) 22%, transparent);
  color: var(--text);
  font: 600 13px var(--heading-font);
}

.focus-ring {
  position: relative;
  width: 240px;
  height: 240px;
}

.focus-ring svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.focus-ring circle {
  fill: none;
  stroke-width: 10;
}

.focus-ring-track {
  stroke: var(--ring-track);
}

.focus-ring-fill {
  stroke: var(--phase);
  stroke-linecap: round;
  stroke-dasharray: 615.75;
  transition: stroke-dashoffset .5s linear;
}

.focus-time {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.focus-time strong {
  font: 600 52px/1 var(--heading-font);
  color: var(--number);
  font-variant-numeric: tabular-nums;
}

.focus-time small {
  max-width: 170px;
  overflow: hidden;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.focus-rounds {
  display: flex;
  gap: 8px;
}

.focus-rounds span {
  width: 12px;
  height: 12px;
  border: 2px solid var(--phase);
  border-radius: 50%;
}

.focus-rounds .done {
  background: var(--phase);
}

.focus-rounds .now {
  box-shadow: 0 0 8px var(--glow);
}

.focus-message {
  position: relative;
  min-height: 1.5em;
  margin: 0;
  color: var(--muted);
}

.focus-setup {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.focus-setup[hidden] {
  display: none;
}

.focus-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.focus-actions .btn-outline {
  padding: 11px 18px;
}

.focus-note {
  position: relative;
  margin: 0;
}

.focus-today {
  margin: 8px 0 0;
  color: var(--text);
}

.room-group-start {
  width: 100%;
  margin-top: 10px;
  padding: 9px 14px;
}

.room-group-start[hidden] {
  display: none;
}

.room-invite {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 14px;
}

.room-invite .btn-small {
  margin-top: 0;
}

.room-following {
  margin: 10px 0 0;
}

.room-status {
  font: 600 13px var(--heading-font);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.room-member.focus .room-status {
  color: var(--number);
}

.room-member.break .room-status {
  color: var(--second);
}

.room-chat {
  max-height: 160px;
  overflow-y: auto;
  margin: 12px 0 8px;
  font-size: 14px;
}

.room-chat:empty {
  display: none;
}

.room-chat p {
  margin: 0 0 4px;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* focus full screen: only the timer */
body.focus-immersive .sidebar,
body.focus-immersive .dash-top,
body.focus-immersive .focus-grid > .dash-col {
  display: none;
}

body.focus-immersive {
  grid-template-columns: minmax(0, 1fr);
  padding-bottom: 0;
}

body.focus-immersive .dash {
  grid-column: 1;
  max-width: none;
  padding: 0;
}

body.focus-immersive .focus-grid {
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
}

body.focus-immersive .focus-stage {
  min-height: 100vh;
  min-height: 100dvh;
  justify-content: center;
  border: 0;
  border-radius: 0;
}

body.focus-immersive .focus-ring {
  width: 320px;
  height: 320px;
}

body.focus-immersive .focus-time strong {
  font-size: 72px;
}

body.focus-immersive .focus-glow {
  top: 50%;
  width: 520px;
  height: 520px;
  margin: -330px 0 0 -260px;
}

@media (max-width: 640px) {
  .side-link[data-music] {
    display: none;
  }

  .focus-ring {
    width: 210px;
    height: 210px;
  }

  .focus-time strong {
    font-size: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .focus-stage.focusing .focus-glow,
  .focus-stage.on-break .focus-glow {
    animation: none;
  }
}

/* security check on the login page */
.captcha:empty {
  display: none;
}

.captcha {
  display: flex;
  justify-content: center;
  margin: 4px 0 8px;
}

/* admin page */
.admin-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.admin-stats div {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--accent-soft);
}

.admin-stats strong {
  font: 600 26px var(--font-heading);
  color: var(--text);
}

.admin-stats small {
  font-size: 12px;
  color: var(--muted);
}

.admin-sub {
  margin-top: 18px;
}

.day-bars {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  align-items: end;
  gap: 4px;
  height: 90px;
  margin-top: 14px;
}

.day-bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.day-bar-fill {
  width: 100%;
  min-height: 3px;
  border-radius: 6px 6px 2px 2px;
  background: var(--ring);
}

.day-bar small {
  font-size: 12px;
  color: var(--muted);
}

.top-users,
.limit-rows,
.problem-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.top-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-user-rank {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font: 600 13px/26px var(--font-heading);
  text-align: center;
}

.top-user-text,
.limit-row {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.top-user-text .bar,
.limit-row .bar,
.generate-meter .bar {
  margin-top: 6px;
}

.top-user-text small,
.limit-row small {
  font-size: 12px;
  color: var(--muted);
}

.limit-row {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.limit-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.limit-link {
  font-size: 13px;
  color: var(--accent-text);
}

.generate-meter {
  display: block;
  max-width: 260px;
  margin-top: 4px;
}

.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: #3DBE6B;
  vertical-align: 1px;
}

.access-tag.blocked {
  color: var(--danger);
  font-weight: 600;
}

.problem-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.problem-row small {
  font-size: 12px;
  color: var(--muted);
}

.problem-row code {
  overflow-wrap: anywhere;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 12px;
}

/* the full emoji picker */
.emoji-picker-box {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
}

.emoji-picker-box emoji-picker {
  --background: var(--surface);
  --border-color: var(--border);
  --border-radius: 16px;
  --button-hover-background: var(--second-soft);
  --button-active-background: var(--accent-soft);
  --category-font-color: var(--muted);
  --indicator-color: var(--accent);
  --input-border-color: var(--border);
  --input-font-color: var(--text);
  --input-placeholder-color: var(--muted);
  --outline-color: var(--accent);
  --emoji-size: 1.45rem;
  display: block;
  height: 380px;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .45);
  overflow: hidden;
}

@media (max-width: 559px) {
  .emoji-picker-box emoji-picker {
    width: 100%;
    height: min(380px, 60vh);
    --num-columns: 8;
  }
}

/* two-factor login */
.two-factor-panel {
  margin-top: 20px;
}

/* taking your data out, and deleting the account */
.data-panel {
  margin-top: 20px;
}

.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.delete-list {
  margin: 0 0 18px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.delete-list li + li {
  margin-top: 8px;
}

.delete-list strong {
  color: var(--text);
}

.admin-lock {
  max-width: 560px;
  margin-top: 18px;
}

.two-factor-status {
  margin: 8px 0 4px;
  font: 600 15px var(--font-heading);
  color: var(--text);
}

.two-factor-status.on {
  color: var(--accent-text);
}

.two-factor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.two-factor-actions .btn-small {
  margin-top: 0;
}

.two-factor-qr {
  display: inline-flex;
  margin: 8px 0;
  padding: 10px;
  border-radius: 14px;
  background: #fff;
}

.two-factor-qr img {
  display: block;
}

.two-factor-secret {
  display: block;
  margin: 4px 0 12px;
  padding: 8px 10px;
  overflow-wrap: anywhere;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--text);
  font: 500 13px "Roboto Mono", monospace;
  letter-spacing: .05em;
}

.two-factor-form .field input {
  max-width: 180px;
  letter-spacing: .2em;
}

#code-form .auth-link {
  display: block;
  margin: 12px auto 0;
}

/* placeholder text in every theme */
:is(.app, .auth-page) ::placeholder {
  color: var(--muted);
  opacity: 1;
}

/* phones: five main pages in the bottom bar, the rest under More */
.side-more {
  display: none;
  border: 0;
  background: none;
  cursor: pointer;
}

.more-sheet {
  inset: auto 8px calc(76px + env(safe-area-inset-bottom, 0px)) 8px;
  width: auto;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 16px 36px -14px rgba(0, 0, 0, .4);
}

.more-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.more-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 12px;
  border-radius: 12px;
  color: var(--text);
  font: 500 15px var(--font-heading);
  text-decoration: none;
}

.more-item:hover {
  background: var(--second-soft);
}

.more-item.on {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.more-item svg {
  flex: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.more-item .avatar {
  flex: none;
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.more-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #C4323A;
  color: #fff;
  font: 600 12px/20px var(--font-heading);
  text-align: center;
}

@media (max-width: 640px) {
  .sidebar .side-nav {
    gap: 0;
    justify-content: space-around;
  }

  .sidebar .side-link {
    flex: 1 1 0;
    min-width: 0;
    min-height: 52px;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    font-size: 12px;
  }

  .sidebar .side-link svg {
    width: 22px;
    height: 22px;
  }

  .sidebar :is(.side-me, #nav-admin, a[data-music], a[href="goals.html"], a[href="friends.html"]) {
    display: none;
  }

  .sidebar a[href="home.html"] { order: 1; }
  .sidebar a[href="courses.html"] { order: 2; }
  .sidebar a[href="planner.html"] { order: 3; }
  .sidebar a[href="focus.html"] { order: 4; }
  .sidebar a[href="chat.html"] { order: 5; }

  .sidebar .side-more {
    order: 6;
    display: flex;
  }

  .sidebar .side-link .nav-badge {
    top: 2px;
    right: calc(50% - 22px);
  }

  /* the course tools fit on screen as a grid */
  .tool-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }

  .tool-tab {
    min-height: 44px;
    justify-content: center;
    padding: 8px 6px;
    border-radius: 12px;
    font-size: 13px;
    text-align: center;
    white-space: normal;
  }
}

/* small controls get a finger-sized tap area without changing how they look */
@media (pointer: coarse), (max-width: 640px) {
  :is(.cal-nav,
.thread-back,
.msg-action,
.reaction,
.link-btn,
.back-link,
.seg,
.chip,
.btn-small,
.planner-tab,
.dialog-close,
.course-edit,
.btn-outline,
.btn-soft,
.limit-link) {
    position: relative;
  }

  :is(.cal-nav,
.thread-back,
.msg-action,
.reaction,
.link-btn,
.back-link,
.seg,
.chip,
.btn-small,
.planner-tab,
.dialog-close,
.course-edit,
.btn-outline,
.btn-soft,
.limit-link)::after {
    content: "";
    position: absolute;
    top: min(0px, calc((100% - 44px) / 2));
    right: min(0px, calc((100% - 44px) / 2));
    bottom: min(0px, calc((100% - 44px) / 2));
    left: min(0px, calc((100% - 44px) / 2));
  }

  .topic-item,
  .topic-add,
  .btn-leaf,
  .focus-course-link,
  .cal-day,
  :is(.app, .auth-page) select,
  :is(.app, .auth-page) input:not([type=checkbox], [type=radio], [type=file]) {
    min-height: 44px;
  }

  .cal-day {
    min-width: 44px;
  }

  .focus-note,
  .toggle {
    min-height: 44px;
    align-items: center;
  }
}

/* home: what is happening now, the attendance grid, this week */
.banner-action {
  position: relative;
  z-index: 1;
  flex: none;
  padding: 12px 22px;
  border-radius: 12px;
  background: #fff;
  color: #1F2A24;
  font: 600 15px var(--font-heading);
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .45);
}

.banner-action:hover {
  background: #F3F3EE;
}

.home-glow .streak-grid {
  padding-top: 16px;
}

.week-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* the calendar fills its column so both sides of the grid end level */
.calendar-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.calendar-panel .cal-list {
  flex: 1;
}

/* once the grid stacks, the calendar keeps its own height */
@media (max-width: 900px) {
  .calendar-panel,
  .calendar-panel .cal-list {
    flex: none;
  }
}

.week-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.week-stats .stat-value {
  margin-top: 0;
}

.week-edit {
  color: var(--accent-text);
  font: 500 14px var(--font-heading);
}

.week-empty {
  margin: 0;
  color: var(--text);
}

.week-panel .btn-small {
  align-self: flex-start;
}

.week-privacy {
  margin: 0;
}

@media (max-width: 640px) {
  .banner-action {
    align-self: stretch;
    text-align: center;
  }

  .week-stats {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
}

/* focus: the stopwatch has no rounds */
.focus-stage.stopwatch .focus-time strong {
  font-variant-numeric: tabular-nums;
}

/* confirming and undoing */
.confirm-dialog {
  width: min(420px, calc(100vw - 32px));
}

.confirm-body {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

.confirm-ok {
  font-weight: 600;
}

.confirm-ok:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.confirm-dialog .field {
  margin-top: 16px;
}

.undo-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 32px);
  padding: 10px 10px 10px 18px;
  border-radius: 14px;
  background: var(--text);
  color: var(--surface);
  font: 500 14px var(--font-heading);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .45);
  transform: translateX(-50%);
}

.undo-toast[hidden] {
  display: none;
}

.undo-button {
  min-height: 36px;
  padding: 6px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: 600 14px var(--font-heading);
  cursor: pointer;
}

.row-more {
  min-width: 38px;
  font-weight: 600;
}

@media (max-width: 640px) {
  .undo-toast {
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }
}

/* finishing touches: focus rings, text selection, the caret and scrollbars follow the theme */
:is(.app, .auth-page, .shell) :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:is(.app, .auth-page) :is(input, select, textarea):focus-visible {
  outline-offset: 1px;
}

.sidebar :is(.side-link, .side-logo):focus-visible {
  outline-color: currentColor;
  outline-offset: -3px;
}

.banner :is(a, button):focus-visible,
.undo-toast button:focus-visible {
  outline-color: #fff;
}

.g-cell:focus-visible {
  outline-offset: 1px;
}

:is(.app, .auth-page) ::selection {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  color: inherit;
}

:is(.app, .auth-page) {
  caret-color: var(--accent);
  scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent;
}

/* Tap targets on the sign-in pages, and the sidebar mark further down. The sizes are reached with
   invisible padding and a minimum height rather than by making anything bigger to look at, so
   nothing moves on the page. Links clear 24px, which is the measured minimum; the controls you
   aim at clear 44px. */
.auth-link {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}

.auth-page .show-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
}

.auth-brand {
  min-height: 44px;
}

/* the sidebar mark, only at the widths where there is a sidebar: under 640px it is hidden and the
   nav becomes a row along the bottom, which this must not put it back into */
@media (min-width: 641px) {
  .side-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }
}

/* "Optional" beside a field label inherits a fraction of it and lands under 12px */
.field span small,
.auth-page .field small {
  font-size: 12px;
}

/* The age confirmation on the invite form. Homeroom has said it is 18 and over since the privacy page
   was written; this is where that stops being a request and becomes a question you have to answer.
   The row is the tap target, not the box, so there is something to aim at on a phone. */
.auth-page .field-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.auth-page .field-check input {
  flex: none;
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* the same red the other fields use when something is missing */
.auth-page .field-check input[aria-invalid="true"] {
  outline: 2px solid var(--danger);
  outline-offset: 3px;
}

/* A label belongs to the field below it, so it has to sit nearer that field than the one above.
   Measured at 375px before this: 0px above a label and 6px below it, which reads the wrong way round
   and leaves the eye matching each label to the field it follows. 16px between groups against the 6px
   inside one is enough for the pairing to be obvious without the form growing much. */
.auth-page .field {
  margin-bottom: 16px;
}

/* the last one before the human check already has the checkbox row's own spacing under it */
.auth-page .field:last-of-type {
  margin-bottom: 0;
}

/* The small print links under the sign-in forms are 24px tall, which clears the measured minimum
   but not the 44px you want under a thumb. The public header grows its targets with an invisible
   ::before layer, which moves nothing — but here two of these links sit only 8px apart, so a layer
   reaching 10px in each direction made them overlap by 12px, and a 44px target that sometimes fires
   the link below it is worse than a 24px one that does not. So the box itself is 44px: it cannot
   overlap anything, because the space is really there. It costs about 60px down the login page. */
@media (max-width: 720px), (pointer: coarse) {
  .auth-page :is(.auth-link, .auth-back) {
    min-height: 44px;
  }
}

/* Quiet lines on the sign-in pages that say what happens next. They matter most on a phone, where
   the panel with the three points is hidden and the form is otherwise unexplained at the moment
   someone decides whether to hand over their name. */
.auth-page .auth-aside {
  margin: -4px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* beside a field rather than above the form, so it sits with what it describes */
.auth-page #email-note {
  margin: -10px 0 16px;
}

.auth-page .auth-aside a {
  color: var(--accent-text);
}

/* The college screen. Two panels: counts that name nobody, and a list that does. */
.college-cards {
  display: grid;
  gap: 14px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.college-cards > li {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
}

.cc-name {
  font-family: var(--heading-font);
  font-weight: 600;
}

.cc-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.cc-stats div {
  display: grid;
  gap: 2px;
}

.cc-stats strong {
  font-family: var(--heading-font);
  font-size: 1.3rem;
}

.cc-stats small {
  font-size: .8rem;
  color: var(--muted);
}

.person-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.person-row:first-child {
  border-top: 0;
}

.person-name {
  font-weight: 600;
}

.person-note,
.person-figures {
  font-size: .85rem;
  color: var(--muted);
}

.person-figures {
  display: grid;
  gap: 2px;
  text-align: right;
  flex: none;
}

@media (max-width: 560px) {
  .person-row { flex-wrap: wrap; }
  .person-figures { text-align: left; }
}

/* Choosing which college to work on, the way the Career Office staff app asks it: a card each,
   the count on it, and one button that commits. */
.college-choose {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.college-choose > li {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
}

.college-choose .btn-outline {
  margin-top: 10px;
  justify-self: start;
}

.working-on {
  margin-top: 6px;
  font-size: .9rem;
  color: var(--muted);
}

.working-on .link-btn {
  margin-left: 8px;
}

/* The sign-in chooser: which door you came through. */
.door-list {
  display: grid;
  gap: 12px;
  margin: 18px 0 24px;
  padding: 0;
  list-style: none;
}

.door {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.door-icon svg {
  display: block;
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.door-words {
  display: grid;
  gap: 3px;
  flex: 1;
}

.door-words span {
  font-size: .88rem;
  color: var(--muted);
}

.door i {
  font-style: normal;
  color: var(--accent);
}

@media (hover: hover) and (pointer: fine) {
  .door:hover { border-color: var(--accent); box-shadow: 0 8px 20px -14px rgb(var(--shade) / .5); }
}

.door:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
