/* ==========================================================================
   StudyLoop — layout
   Rail, channels, conversation, members. One window, no breakpoints for phones:
   it is built for a MacBook, and below about 1000px the member panel goes.
   ========================================================================== */

.app {
  display: grid;
  grid-template-columns: var(--rail-w) var(--side-w) minmax(0, 1fr) var(--panel-w);
  height: 100vh;
  background-color: var(--bg);
  background-image: var(--grad);
  overflow: hidden;
}

.app--bare { grid-template-columns: var(--rail-w) var(--side-w) minmax(0, 1fr); }
.app--bare .panel { display: none; }

/* The rail, the sidebar, a panel and the modal all set their own display,
   which beats the browser's [hidden] rule. This is what actually hides them. */
[hidden] { display: none !important; }

/* ── rail ───────────────────────────────────────────────────────────── */
.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  background: var(--veil);
  border-right: 1px solid var(--rule);
  overflow: hidden;
}

.rail__home {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--sunken);
  color: var(--text-2);
  transition: border-radius var(--dur) var(--ease), background var(--dur) var(--ease);
}
.rail__home:hover { border-radius: var(--r-lg); background: var(--accent); color: var(--accent-ink); }
.rail__home--on { border-radius: var(--r-lg); background: var(--accent); color: var(--accent-ink); }

.rail__sep {
  width: 26px;
  height: 1px;
  margin: 2px 0;
  background: var(--rule-strong);
}

.rail__servers {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 0;
}

.rail__btn {
  position: relative;
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--sunken);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .01em;
  transition: border-radius var(--dur) var(--ease), background var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.rail__btn:hover { border-radius: var(--r-lg); background: var(--raise); color: var(--text); }
.rail__btn--on { border-radius: var(--r-lg); background: var(--accent); color: var(--accent-ink); }

.rail__btn--on::before,
.rail__home--on::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  width: 4px;
  height: 22px;
  margin-top: -11px;
  border-radius: 0 3px 3px 0;
  background: var(--text);
}

.rail__badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  border: 2px solid var(--bg);
  background: var(--danger);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
}

.rail__add {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  border: 1px dashed var(--rule-strong);
  color: var(--text-3);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.rail__add:hover { border-color: var(--accent); color: var(--accent-text); }

.rail__grow { flex: 1; }

.rail__tool {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  color: var(--text-3);
}
.rail__tool:hover { color: var(--text); background: var(--sunken); }

/* ── sidebar ────────────────────────────────────────────────────────── */
.side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--veil);
  border-right: 1px solid var(--rule);
}

.side__head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 10px 0 16px;
  border-bottom: 1px solid var(--rule);
  box-shadow: var(--shadow-1);
}

.side__name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side__menu {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: var(--r-xs);
  color: var(--text-3);
}
.side__menu:hover { color: var(--text); background: var(--sunken); }

.side__scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px 16px;
}

.side__title {
  padding: 12px 8px 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
}
.side__title--first { padding-top: 2px; }

.side__empty {
  padding: 6px 8px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-3);
}

.chan, .dm {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  text-align: left;
}
.chan:hover, .dm:hover { background: var(--sunken); color: var(--text-2); }
.chan--on, .dm--on { background: var(--raise); color: var(--text); }

.chan__hash { flex: none; color: inherit; opacity: .8; }
.chan__hash svg { width: 16px; height: 16px; }

.chan__name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chan__badge {
  flex: none;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 9.5px;
  font-weight: 700;
}

.dm { height: 34px; }

.dm__name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── your bar ───────────────────────────────────────────────────────── */
.me {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px;
  padding: 6px 8px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--sunken);
}

.me__btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 5px;
  border-radius: var(--r-sm);
  text-align: left;
}
.me__btn:hover { background: var(--raise); }

.me__text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.me__text b {
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.me__text small { font-size: 10.5px; color: var(--text-3); }

.me__gear {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-xs);
  color: var(--text-3);
}
.me__gear:hover { color: var(--text); background: var(--raise); }

/* ── avatars ────────────────────────────────────────────────────────── */
.av {
  position: relative;
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: hsl(var(--h, 202) 42% 26%);
  color: hsl(var(--h, 202) 62% 82%);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  overflow: hidden;
  user-select: none;
}
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }

.av--sm { width: 26px; height: 26px; font-size: 9.5px; }
.av--lg { width: 64px; height: 64px; font-size: 20px; }

.av--aurora { box-shadow: 0 0 0 2px var(--accent); }
.av--gold { box-shadow: 0 0 0 2px #e0b455; }
.av--mint { box-shadow: 0 0 0 2px #3ec98d; }
.av--ember { box-shadow: 0 0 0 2px #f0575f; }
.av--silver { box-shadow: 0 0 0 2px #c8ccd4; }

/* ── main + bar ─────────────────────────────────────────────────────── */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: transparent;
}

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--bar);
  box-shadow: var(--shadow-1);
}

.bar__glyph {
  display: grid;
  place-items: center;
  color: var(--text-3);
  font-size: 17px;
  font-weight: 400;
}
.bar__glyph svg { width: 19px; height: 19px; }

.bar__title {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -.005em;
  white-space: nowrap;
}

.bar__topic {
  margin-left: 8px;
  padding-left: 9px;
  border-left: 1px solid var(--rule-strong);
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar__grow { flex: 1; }

.icon-btn {
  position: relative;
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-xs);
  color: var(--text-3);
}
.icon-btn:hover { color: var(--text); background: var(--sunken); }

.dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
}

/* ── the conversation ───────────────────────────────────────────────── */
.chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.chat__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.chat__list {
  display: flex;
  flex-direction: column;
  padding: 18px 0 10px;
  min-height: 100%;
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 6px;
  font-size: 10.5px;
  font-weight: 650;
  color: var(--text-3);
}
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.msg {
  position: relative;
  display: flex;
  gap: 12px;
  margin: 0 8px;
  padding: 7px 10px 8px;
  border-radius: var(--r-md);
  transition: background var(--dur) var(--ease);
}
.msg:hover { background: var(--sunken); }

.msg__av { margin-top: 1px; }

/* The picture is a button: pressing it opens that person. */
.msg__avbtn {
  flex: none;
  align-self: flex-start;
  border-radius: var(--r-pill);
  cursor: pointer;
}
.msg__avbtn:hover { filter: brightness(1.15); }

.msg__body { min-width: 0; flex: 1; }

.msg__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.msg__who {
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}

.msg__who--friend { color: hsl(var(--h, 202) 68% 72%); }

.msg__time {
  font-size: 10.5px;
  color: var(--text-3);
}

.msg__tag {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-3);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-xs);
  padding: 1px 4px;
}

.msg__text {
  margin-top: 1px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg__text strong { color: var(--text); font-weight: 650; }
.msg__text code { color: var(--text); }
.msg__text .mention {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 3px;
  padding: 0 3px;
}

.msg__actions {
  position: absolute;
  top: -10px;
  right: 6px;
  display: none;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule);
  background: var(--raise);
  box-shadow: var(--shadow-1);
}
.msg:hover .msg__actions { display: flex; }

.msg__act {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: var(--r-xs);
  color: var(--text-3);
}
.msg__act:hover { color: var(--text); background: var(--sunken); }
.msg__act--danger:hover { color: var(--danger); }

.msg--editing .msg__text { display: none; }

/* ── composer ───────────────────────────────────────────────────────── */
.composer {
  padding: 0 18px 14px;
  background: var(--bg);
}

.composer__box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--rule);
  background: var(--sunken);
}

.composer__box:focus-within { border-color: var(--rule-strong); }

.composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 200px;
  padding: 6px 0;
  border: 0;
  background: none;
  font-size: 13.5px;
  line-height: 1.5;
  resize: none;
  outline: none;
}
.composer textarea::placeholder { color: var(--text-3); }

.composer__send {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-text);
}
.composer__send:hover { background: var(--accent); color: var(--accent-ink); }

.composer__hint {
  padding: 7px 2px 0;
  font-size: 10.5px;
  color: var(--text-3);
  min-height: 16px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  min-height: 260px;
  padding: 40px 20px;
  text-align: center;
}
.empty__title { font-size: 15px; font-weight: 650; }
.empty__text { max-width: 380px; font-size: 12.5px; line-height: 1.6; color: var(--text-3); }

/* ── home: friends ──────────────────────────────────────────────────── */
.view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg);
}

.home { padding: 22px 24px 30px; }

.home__head { display: flex; align-items: flex-end; gap: 12px; }

.home__title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.012em;
}

.home__sub {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-3);
}

.tabs {
  display: flex;
  gap: 4px;
  margin: 16px 0 0;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--rule);
}

.tab {
  padding: 5px 11px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-3);
}
.tab:hover { color: var(--text); background: var(--sunken); }
.tab--on { background: var(--raise); color: var(--text); }

.home__search {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  padding: 0 14px;
  height: 36px;
  border-radius: var(--r-pill);
  border: 1px solid var(--rule);
  background: var(--sunken);
  color: var(--text-3);
}
.home__search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font-size: 13px;
  outline: none;
}

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

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
}
.row:hover { background: var(--sunken); }

.row__text { min-width: 0; flex: 1; }
.row__name { font-size: 13px; font-weight: 600; }
.row__sub { margin-top: 1px; font-size: 11.5px; color: var(--text-3); }

.row__act {
  flex: none;
  padding: 5px 10px;
  border-radius: var(--r-xs);
  border: 1px solid var(--rule-strong);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
}
.row__act:hover { border-color: var(--accent); color: var(--accent-text); }

/* ── planner ───────────────────────────────────────────────────────── */
.plan { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 22px 24px; align-items: start; }

.plan__panel {
  padding: 18px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--chrome);
}

.plan__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.plan__time {
  margin-top: 10px;
  font-family: var(--font-serif);
  font-size: 42px;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--text);
}

.plan__track {
  margin: 14px 0;
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--sunken);
  overflow: hidden;
}
.plan__bar { height: 100%; background: var(--accent); transition: width 1s linear; }

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

/* ── buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule-strong);
  background: var(--sunken);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
.btn:hover { border-color: var(--text-3); color: var(--text); }

.btn--primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
}
.btn--primary:hover { filter: brightness(1.1); color: var(--accent-ink); }

.btn--danger { border-color: transparent; background: var(--danger); color: #fff; }
.btn--wide { width: 100%; height: 38px; }

/* ── tasks ─────────────────────────────────────────────────────────── */
.task {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 6px;
  border-radius: var(--r-xs);
  text-align: left;
}
.task:hover { background: var(--sunken); }

.task__box {
  width: 16px;
  height: 16px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-xs);
  border: 1.5px solid var(--rule-strong);
  color: transparent;
}
.task--done .task__box { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.task__box svg { width: 11px; height: 11px; stroke-width: 2.6; }

.task__text { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text-2); }
.task--done .task__text { color: var(--text-3); text-decoration: line-through; }

/* ── members panel ────────────────────────────────────────────────── */
.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--veil);
  border-left: 1px solid var(--rule);
  overflow-y: auto;
}

.panel__body { padding: 16px 12px; }

.panel__block + .panel__block { margin-top: 20px; }

.panel__title {
  margin-bottom: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.panel__empty { font-size: 11.5px; line-height: 1.55; color: var(--text-3); }

.member {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 5px 6px;
  border-radius: var(--r-xs);
  text-align: left;
}
.member:hover { background: var(--sunken); }

.member__name { font-size: 12.5px; font-weight: 550; }
.member__sub { display: block; font-size: 10.5px; color: var(--text-3); }

/* ── modal ────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal__scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .7); }

.modal__box {
  position: relative;
  width: min(440px, 100%);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-lg);
  border: 1px solid var(--rule-strong);
  background: var(--chrome);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  animation: pop-in 120ms var(--ease);
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(6px) scale(.99); }
  to { opacity: 1; transform: none; }
}

.modal__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 10px 14px 18px;
  border-bottom: 1px solid var(--rule);
}

.modal__title { flex: 1; font-size: 14px; font-weight: 650; }

.modal__body {
  padding: 18px;
  overflow-y: auto;
}

/* The fresh wrapper every modal is built into, so handlers go with it. */
.modal__stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── fields ───────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 7px; }

.field__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.input {
  height: 36px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule-strong);
  background: var(--sunken);
  font-size: 13px;
  outline: none;
}
.input:focus { border-color: var(--accent); }
.input--area { height: auto; min-height: 76px; padding: 9px 11px; line-height: 1.5; resize: vertical; }

.input-row { display: flex; align-items: center; gap: 0; }

.input__prefix {
  display: grid;
  place-items: center;
  width: 30px;
  height: 36px;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  border: 1px solid var(--rule-strong);
  border-right: 0;
  background: var(--raise);
  font-size: 13px;
  color: var(--text-3);
}
.input-row .input { border-radius: 0 var(--r-sm) var(--r-sm) 0; flex: 1; min-width: 0; }

.hint { font-size: 11px; line-height: 1.55; color: var(--text-3); }

.error {
  padding: 8px 11px;
  border-radius: var(--r-sm);
  background: hsl(0 60% 50% / .12);
  border: 1px solid hsl(0 60% 50% / .35);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--danger);
}

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

/* theme picker */
.themes { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }

.theme {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule);
  background: var(--sunken);
  text-align: left;
}
.theme:hover { border-color: var(--rule-strong); }
.theme--on { border-color: var(--accent); }

.theme__dots { display: flex; gap: 2px; flex: none; }
.theme__dots i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  border: 1px solid rgba(128, 128, 128, .35);
}

.theme__name { font-size: 11.5px; font-weight: 550; color: var(--text-2); }
.theme--on .theme__name { color: var(--text); }

.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, .3);
}
.swatch--on { border-color: var(--text); }

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

.frame {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule);
  background: var(--sunken);
}
.frame--on { border-color: var(--accent); }
.frame__dot { width: 22px; height: 22px; border-radius: 50%; background: hsl(var(--h, 202) 42% 26%); }

/* ── onboarding ───────────────────────────────────────────────────── */
.onboard {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background-color: var(--bg);
  background-image: var(--grad);
  overflow-y: auto;
}

.onboard__box {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px;
  border-radius: var(--r-lg);
  border: 1px solid var(--rule-strong);
  background: var(--chrome);
  box-shadow: var(--shadow-2);
}

.onboard__mark { width: 54px; height: 54px; border-radius: 18px; }

.onboard__title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -.018em;
}

.onboard__sub { font-size: 12.5px; line-height: 1.6; color: var(--text-2); }

.onboard__fine { font-size: 11px; line-height: 1.55; color: var(--text-3); }

/* ── command palette ──────────────────────────────────────────────── */
.palette {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: start center;
  padding: 12vh 20px 20px;
}

.palette__scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); }

.palette__box {
  position: relative;
  width: min(560px, 100%);
  border-radius: var(--r-lg);
  border: 1px solid var(--rule-strong);
  background: var(--chrome);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}

.palette__field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 46px;
  border-bottom: 1px solid var(--rule);
  color: var(--text-3);
}

.palette__field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font-size: 13.5px;
  outline: none;
}

.palette__list { max-height: 52vh; overflow-y: auto; padding: 6px; }

.palette__row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  text-align: left;
}
.palette__row--on { background: var(--raise); }

.palette__title { flex: none; font-size: 12.5px; font-weight: 600; }
.palette__sub {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.palette__none { padding: 14px; font-size: 12px; color: var(--text-3); }

/* ── notifications ───────────────────────────────────────────────── */
.pop {
  position: fixed;
  z-index: 105;
  width: 300px;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-md);
  border: 1px solid var(--rule-strong);
  background: var(--chrome);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}

.pop__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 10px 14px;
  border-bottom: 1px solid var(--rule);
  font-size: 12px;
  font-weight: 650;
}
.pop__head span { flex: 1; }

.pop__list { overflow-y: auto; padding: 6px; }

.pop__row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  text-align: left;
}
.pop__row:hover { background: var(--sunken); }

.pop__row b { font-size: 12px; font-weight: 600; }
.pop__row small { font-size: 10.5px; color: var(--text-3); }

.pop__none { padding: 14px 12px; font-size: 11.5px; line-height: 1.55; color: var(--text-3); }

/* ── toasts ──────────────────────────────────────────────────────── */
.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 130;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.toast {
  padding: 8px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule-strong);
  background: var(--raise);
  color: var(--text);
  font-size: 12px;
  box-shadow: var(--shadow-2);
  animation: toast-in 120ms var(--ease);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ── the cover ───────────────────────────────────────────────────── */
.cover {
  position: fixed;
  inset: 0;
  z-index: 120;
  overflow-y: auto;
  background: var(--bg);
}

.cover__page {
  max-width: 720px;
  margin: 0 auto;
  padding: 46px 30px 70px;
  font-family: var(--font-serif);
  color: var(--text);
}

.cover__eyebrow {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.cover__title {
  margin: 10px 0 6px;
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -.02em;
}

.cover__meta { font-size: 13px; color: var(--text-3); }

.cover h3 {
  margin: 26px 0 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.cover p, .cover li { font-size: 14.5px; line-height: 1.65; color: var(--text-2); }
.cover p + p { margin-top: 8px; }
.cover ul { margin: 0; }
.cover li { position: relative; padding-left: 16px; margin-bottom: 5px; }
.cover li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.cover table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 13px; }
.cover th, .cover td {
  text-align: left;
  padding: 6px 10px 6px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.cover th { font-family: var(--font-ui); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.cover td:first-child { font-weight: 550; color: var(--text); white-space: nowrap; }

/* ── narrow windows: the member panel goes first ─────────────────── */
@media (max-width: 1060px) {
  .app { grid-template-columns: var(--rail-w) var(--side-w) minmax(0, 1fr); }
  .panel { display: none; }
}

@media (max-width: 820px) {
  .app { grid-template-columns: 60px 210px minmax(0, 1fr); }
  .plan { grid-template-columns: 1fr; }
}

/* ── motion: opening, sending, pressing ───────────────────────────────
   Transform and opacity only, so it stays smooth without repainting. */

@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes slide { from { opacity: 0; transform: translateX(-7px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* A channel fades in when it opens, not on every message. */
.chat__list--in { animation: rise 200ms var(--ease); }

/* The message just sent pops in; the ones already there stay still. */
.msg--new { animation: rise 220ms var(--ease); }

/* Opening a view, the member panel, a popover, the cover. */
.view { animation: grow 180ms var(--ease); }
.panel { animation: slide 200ms var(--ease); }
.pop { animation: grow 140ms var(--ease); }
.palette__box { animation: grow 140ms var(--ease); }
.onboard__box { animation: grow 260ms var(--ease); }
.cover__page { animation: rise 220ms var(--ease); }
.modal__scrim, .palette__scrim { animation: fade 160ms var(--ease); }

/* The rail: a press that gives, a hover that lifts. */
.rail__btn, .rail__home, .rail__add, .rail__tool {
  transition: transform var(--dur) var(--ease), border-radius var(--dur) var(--ease),
              background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.rail__btn:hover { transform: translateY(-1px); }
.rail__btn:active, .rail__home:active, .rail__add:active { transform: scale(.93); }

/* Rows slide a hair, so a click feels answered. */
.chan, .dm, .row, .member, .pop__row, .palette__row {
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.chan:hover, .dm:hover { transform: translateX(1px); }

.icon-btn, .me__gear, .side__menu, .msg__act {
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.icon-btn:active, .msg__act:active { transform: scale(.9); }

.av { transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.msg__avbtn:hover .av, .member:hover .av, .row:hover .av { transform: scale(1.06); }

.composer__send {
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.composer__send:active { transform: scale(.92); }

.btn, .row__act, .swatch, .frame, .theme, .copy {
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
              background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn:active, .copy:active { transform: translateY(1px) scale(.99); }
.swatch:hover, .frame:hover, .theme:hover { transform: translateY(-1px); }

/* A run of messages from one person: no second picture, no second name. The
   face keeps its space so the text stays in one column. */
.msg--grouped { padding-top: 2px; padding-bottom: 2px; }
.msg--grouped .msg__text { margin-top: 0; }
.msg__avbtn--quiet { visibility: hidden; }
.msg__edited { margin-left: 5px; font-size: 9.5px; color: var(--text-3); }

/* Nothing to send yet: the button stops looking like a button. */
.composer__send:disabled {
  opacity: .4;
  cursor: default;
  background: var(--sunken);
  color: var(--text-3);
}

/* ── motion, second pass ─────────────────────────────────────────────
   Transform and opacity only. Everything here is a state change, not a loop,
   except the badges, which breathe so an unread is noticed. */

@keyframes drop { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-4px); } }
@keyframes sent { 0% { transform: scale(1); } 45% { transform: scale(.86); } 100% { transform: scale(1); } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.13); } }

/* Changing where you are: the rail and the list ease in, row by row, and
   only then — a message you send must not replay it. */
.app.is-swapping .rail__home,
.app.is-swapping .rail__servers > *,
.app.is-swapping .side__scroll > * { animation: grow 260ms var(--ease) both; }

.app.is-swapping .side__scroll > *:nth-child(1) { animation-name: slide; animation-delay: 0ms; }
.app.is-swapping .side__scroll > *:nth-child(2) { animation-name: slide; animation-delay: 14ms; }
.app.is-swapping .side__scroll > *:nth-child(3) { animation-name: slide; animation-delay: 28ms; }
.app.is-swapping .side__scroll > *:nth-child(4) { animation-name: slide; animation-delay: 42ms; }
.app.is-swapping .side__scroll > *:nth-child(5) { animation-name: slide; animation-delay: 56ms; }
.app.is-swapping .side__scroll > *:nth-child(6) { animation-name: slide; animation-delay: 68ms; }
.app.is-swapping .side__scroll > *:nth-child(7) { animation-name: slide; animation-delay: 80ms; }
.app.is-swapping .side__scroll > *:nth-child(8) { animation-name: slide; animation-delay: 92ms; }
.app.is-swapping .side__scroll > *:nth-child(9) { animation-name: slide; animation-delay: 102ms; }
.app.is-swapping .side__scroll > *:nth-child(10) { animation-name: slide; animation-delay: 112ms; }

.app.is-swapping .rail__servers > *:nth-child(1) { animation-delay: 20ms; }
.app.is-swapping .rail__servers > *:nth-child(2) { animation-delay: 44ms; }
.app.is-swapping .rail__servers > *:nth-child(3) { animation-delay: 68ms; }
.app.is-swapping .rail__servers > *:nth-child(4) { animation-delay: 92ms; }
.app.is-swapping .rail__servers > *:nth-child(5) { animation-delay: 112ms; }
.app.is-swapping .rail__servers > *:nth-child(6) { animation-delay: 132ms; }

/* An unread or a mention breathes, once every two and a bit seconds. */
.rail__badge, .chan__badge, .dot { animation: breathe 2.4s var(--ease) infinite; }

/* The bell drops from its button; the palette drops from the top of the window. */
.pop { transform-origin: top right; }
.palette__box { animation-name: drop; transform-origin: top center; }

/* A theme change fades across the whole surface rather than snapping. */
.rail, .side, .panel, .bar, .me, .composer__box, .input, .modal__box,
.pop, .palette__box, .theme, .frame, .task, .chan, .dm, .row, .member {
  transition: background-color 240ms var(--ease), border-color 240ms var(--ease),
              color 240ms var(--ease), transform var(--dur) var(--ease),
              border-radius var(--dur) var(--ease);
}

/* Sending: the button gives, then the message lands. */
.composer__send--sent { animation: sent 280ms var(--ease); }

/* A toast leaves the way it came. */
.toast--out { animation: toast-out 180ms var(--ease) forwards; }

/* ── more rounding where it was still square ──────────────────────── */
.composer__send { border-radius: var(--r-pill); }
.rail__tool { border-radius: var(--r-md); }
.msg__act { border-radius: var(--r-sm); }
.task__box { border-radius: 5px; }
.input__prefix { border-radius: var(--r-sm) 0 0 var(--r-sm); }
