:root {
  --bg: #121119;
  --panel: #191721;
  --panel2: #23202d;
  --line: #393345;
  --text: #f4effa;
  --muted: #b4a9c2;
  --accent: #a78bfa;
  --accent-dim: #a78bfa26;
  --room-gutter: clamp(18px, 4vw, 56px);
  color-scheme: dark;
}

:where(button, a, input, textarea, select, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.sidebar {
  width: 252px;
  flex-basis: 252px;
  padding: 20px 14px 16px;
  background: linear-gradient(160deg, #231c33, var(--panel) 46%);
}

.brand { min-height: 56px; padding-bottom: 16px; }
.brand .logo {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: #382951;
  border: 1px solid #51416b;
  border-radius: 11px;
}
.rooms { gap: 5px; }
.room { min-height: 44px; border: 1px solid transparent; }
.room:hover { background: #292238; }
.room.active { border-color: #534271; background: #35294b; }
.room .cnt { color: #191127; }
.topbar {
  min-height: 71px;
  padding-inline: var(--room-gutter);
  background: #191721;
}
.roomtitle h1 { font-size: clamp(18px, 2vw, 24px); }
.roomtitle h1 .hash { color: var(--accent); }
.roomtitle p { font-size: 12px; }
.messages { padding: 22px var(--room-gutter) 12px; gap: 7px; }
.msg { padding: 10px; border: 1px solid transparent; }
.msg:hover, .msg:focus-within { background: #211c2b; border-color: var(--line); }
.msg:focus-within .replybtn { opacity: 1; }
.avatar { background: #262032; border-color: #483d57; }
.badge { background: var(--panel2); border-color: var(--line); }
.time, .hint { color: var(--muted); }
.content { line-height: 1.65; }
.mention { background: #3c2b55; color: #e8dcff; }
.composer { padding: 14px var(--room-gutter); }
.crow {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel2);
}
#input { min-width: 0; background: #16131e; }
#input:focus { border-color: var(--accent); }
#input:focus-visible { outline-offset: 1px; }
#sendBtn, .gate button { color: #191127; }
#sendBtn:hover:not(:disabled), .gate button:hover { background: #c0aaff; }
.gate { background: radial-gradient(ellipse at 50% 0%, #322247, var(--bg) 70%); }

#calendarPage { flex: 1; min-height: 0; padding-inline: var(--room-gutter); }
.team-calendar .fc { --fc-button-bg-color: #35294b; --fc-button-border-color: #534271;
  --fc-button-hover-bg-color: #493867; --fc-button-hover-border-color: #6c5591;
  --fc-button-active-bg-color: #58427c; --fc-button-active-border-color: #766098;
  border: 1px solid var(--line); padding: 12px; border-radius: 14px; background: var(--panel); }
.team-calendar .fc .fc-toolbar-title { font-size: clamp(16px, 2.6vw, 23px); }
.team-calendar .fc .fc-button { background: var(--fc-button-bg-color); }
.team-calendar .fc .fc-button:hover { background: var(--fc-button-hover-bg-color); }
.team-calendar .fc .fc-button.fc-button-active { background: var(--fc-button-active-bg-color); }
.calendar-column { border-top: 3px solid #756394; }
.calendar-column:nth-child(2) { border-top-color: #829cf0; }
.calendar-column:nth-child(3) { border-top-color: #e3b26a; }
.calendar-column:nth-child(4) { border-top-color: #73c49b; }
.calendar-column h3 { font-size: 14px; }
.team-calendar label { display: block; margin-bottom: 12px; }
.team-calendar details { margin-top: 16px; }

@media (max-width: 760px) {
  :root { --room-gutter: 12px; }
  .topbar { min-height: 59px; }
  .menu-btn { min-width: 42px; min-height: 42px; }
  .messages { gap: 4px; padding-top: 12px; }
  .msg { padding: 7px 5px; }
  .composer { padding-block: 8px max(8px, env(safe-area-inset-bottom)); }
  .crow { gap: 5px; padding: 5px; }
  .attachbtn { padding-inline: 8px; }
}

@media (max-width: 600px) {
  .team-calendar .fc:has(.fc-listWeek-view) { min-width: 0; }
  .team-calendar .fc .fc-toolbar { flex-wrap: wrap; gap: 8px; }
  .team-calendar .fc .fc-toolbar-chunk:nth-child(2) { order: -1; flex-basis: 100%; }
  .calendar-board { grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); }
  .team-calendar form input[name="title"] { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .replybtn { transition: none; }
  .messages { scroll-behavior: auto; }
  .msg.flash { animation: none; }
}
