/* Cloudbase Chat — a dark, compact UI. No framework, no build step. */

:root {
  --bg: #0b0d12;
  --bg-soft: #10131b;
  --panel: #141824;
  --panel-2: #1a1f2e;
  --line: #242b3d;
  --line-soft: #1c2231;
  --text: #e7eaf3;
  --muted: #8b94ab;
  --accent: #6c8cff;
  --accent-soft: rgba(108, 140, 255, 0.14);
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(1100px 620px at 82% -12%, rgba(108, 140, 255, 0.14), transparent 60%),
    radial-gradient(900px 520px at -10% 110%, rgba(52, 211, 153, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.32rem;
}
h2 {
  font-size: 1.05rem;
}
h3 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

p {
  margin: 0;
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 0.08em 0.36em;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 0.82rem;
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.row.wrap {
  flex-wrap: wrap;
}
.pad {
  padding: 14px 4px;
}
.error {
  color: var(--bad);
  font-size: 0.86rem;
  margin-top: 10px;
}

/* ---------------------------------------------------------------- controls */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 550;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.06s;
  white-space: nowrap;
}
.btn:hover {
  background: #232a3d;
  border-color: #2f3852;
}
.btn:active {
  transform: translateY(1px);
}
.btn.primary {
  background: linear-gradient(180deg, #7d99ff, #5d7ff5);
  border-color: #6c8cff;
  color: #0a0d16;
  font-weight: 650;
}
.btn.primary:hover {
  background: linear-gradient(180deg, #8ba4ff, #6b8bff);
}
.btn.danger {
  color: #ffb4b4;
  border-color: #4a2733;
  background: #241a20;
}
.btn.danger:hover {
  background: #2f2029;
}
.btn.ghost {
  background: transparent;
}
.btn.small {
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 8px;
}
.btn.block {
  width: 100%;
  justify-content: center;
  padding: 11px 14px;
}
.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.icon-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

input,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder,
textarea::placeholder {
  color: #5d6579;
}

.field {
  display: block;
  margin-bottom: 12px;
}
.field > span {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  white-space: nowrap;
}
.pill.ok {
  color: #8ef0c8;
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.1);
}
.pill.warn {
  color: #ffd98a;
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.1);
}
.pill.bad {
  color: #ffb4b4;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
}
.pill.small {
  font-size: 0.72rem;
  padding: 2px 8px;
}

.tag {
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
}
.tag.danger {
  color: #ffb4b4;
  border-color: rgba(248, 113, 113, 0.4);
}

/* ------------------------------------------------------------------- boot */

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}
.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ------------------------------------------------------------------- auth */

.auth {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 28px 18px;
}
.auth-card {
  width: 100%;
  max-width: 392px;
  background: linear-gradient(180deg, rgba(26, 31, 46, 0.92), rgba(18, 22, 32, 0.96));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px;
  box-shadow: var(--shadow);
}
.auth-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 20px;
}
.logo {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: #0a0d16;
  background: linear-gradient(150deg, #9db2ff, #5d7ff5);
  flex: 0 0 auto;
}
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 4px;
  margin-bottom: 18px;
}
.seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.seg-btn.active {
  background: var(--panel-2);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}
.auth-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

/* -------------------------------------------------------------------- app */

.app {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 14px;
  background: linear-gradient(180deg, rgba(16, 19, 27, 0.96), rgba(11, 13, 18, 0.98));
  border-right: 1px solid var(--line);
  min-height: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 4px 4px;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #0a0d16;
  background: linear-gradient(150deg, #9db2ff, #5d7ff5);
}
.brand-text {
  font-weight: 650;
  font-size: 0.94rem;
  letter-spacing: -0.01em;
}
.brand .only-narrow {
  margin-left: auto;
}

.me {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  min-width: 0;
}
.me-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.me-text strong {
  font-size: 0.88rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.me-text .small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.82rem;
  color: #0a0d16;
  background: linear-gradient(150deg, #9db2ff, #5d7ff5);
  overflow: hidden;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar.lg {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  font-size: 1.1rem;
}

.rooms {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-weight: 600;
}
.room-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  min-height: 0;
}
.room-item {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 9px;
}
.room-item:hover {
  background: rgba(255, 255, 255, 0.04);
}
.room-item.active {
  background: var(--accent-soft);
}
.room-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  padding: 7px 8px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
}
.room-item.active .room-btn {
  color: var(--text);
  font-weight: 600;
}
.room-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hash {
  color: #5d6579;
}
.dot-badge {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: auto;
  flex: 0 0 auto;
}
.room-del {
  appearance: none;
  border: 0;
  background: transparent;
  color: #4d5568;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 7px;
  opacity: 0;
}
.room-item:hover .room-del {
  opacity: 1;
}
.room-del:hover {
  color: var(--bad);
  background: rgba(248, 113, 113, 0.1);
}
.room-form {
  display: flex;
  gap: 6px;
  padding: 2px;
}
.room-form input {
  padding: 7px 9px;
  font-size: 0.84rem;
  border-radius: 8px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
}
.nav-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 550;
  text-align: left;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
}
.nav-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}
.nav-btn.active {
  background: var(--panel-2);
  color: var(--text);
}
.sidebar-foot {
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  display: flex;
}

/* ------------------------------------------------------------------- main */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 13, 18, 0.72);
  backdrop-filter: blur(8px);
  flex: 0 0 auto;
}
.topbar-title {
  min-width: 0;
  flex: 1 1 auto;
}
.topbar-title h2 {
  font-size: 1rem;
}
.topbar-title p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.views {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}
.view {
  display: none;
  height: 100%;
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
}
.view.active {
  display: flex;
  flex-direction: column;
}

.view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.view-head h3 {
  margin-bottom: 4px;
}
.view-head input {
  max-width: 190px;
  padding: 7px 10px;
  font-size: 0.85rem;
}

/* ------------------------------------------------------------------- chat */

#view-chat {
  padding: 0;
  overflow: hidden;
}
#view-chat.active {
  display: flex;
}
.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 6px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.load-older {
  align-self: center;
  margin-bottom: 4px;
}
.empty {
  margin: auto;
  text-align: center;
  max-width: 420px;
  display: grid;
  gap: 8px;
  color: var(--muted);
  padding: 30px 0;
}

.msg {
  display: flex;
  gap: 10px;
  max-width: min(760px, 88%);
}
.msg.mine {
  flex-direction: row-reverse;
  align-self: flex-end;
}
.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 0.76rem;
  font-weight: 700;
  color: #0a0d16;
  background: linear-gradient(150deg, #9db2ff, #5d7ff5);
}
.msg:not(.mine) .msg-avatar {
  background: linear-gradient(150deg, #7ee0bd, #34d399);
}
.msg-body {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  padding: 9px 13px;
  display: grid;
  gap: 4px;
}
.msg.mine .msg-body {
  background: linear-gradient(180deg, rgba(108, 140, 255, 0.19), rgba(108, 140, 255, 0.12));
  border-color: rgba(108, 140, 255, 0.32);
}
.msg.pending .msg-body {
  opacity: 0.68;
}
.msg.failed .msg-body {
  border-color: rgba(248, 113, 113, 0.45);
}
.msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--muted);
}
.msg.mine .msg-meta {
  flex-direction: row-reverse;
}
.msg-name {
  font-weight: 650;
  color: #c3cbe0;
}
.msg-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
}
.msg-image {
  display: block;
  margin-top: 4px;
}
.msg-image img {
  max-width: 320px;
  max-height: 260px;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
}
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 9px;
  padding: 7px 10px;
  margin-top: 4px;
  color: var(--text);
  text-decoration: none;
  max-width: 100%;
}
.file-chip:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.file-chip-name {
  font-size: 0.84rem;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.typing {
  min-height: 20px;
  padding: 0 24px;
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}
.typing-dots {
  display: inline-flex;
  gap: 3px;
}
.typing-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1.1s infinite;
}
.typing-dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-dots i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes blink {
  0%,
  60%,
  100% {
    opacity: 0.25;
  }
  30% {
    opacity: 1;
  }
}

.composer-wrap {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: rgba(11, 13, 18, 0.9);
  padding: 12px 20px 14px;
  display: grid;
  gap: 8px;
}
.attach-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.84rem;
  width: fit-content;
  max-width: 100%;
}
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.composer textarea {
  resize: none;
  min-height: 42px;
  max-height: 160px;
  padding: 10px 12px;
  border-radius: 11px;
  line-height: 1.4;
}
.composer .btn {
  height: 42px;
  padding: 0 18px;
}
.composer-hint {
  font-size: 0.74rem;
}

/* ------------------------------------------------------------------ files */

.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.file-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.file-thumb {
  height: 118px;
  background: var(--bg-soft);
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--line-soft);
  overflow: hidden;
}
.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.file-ext {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.file-meta {
  padding: 10px 12px;
  display: grid;
  gap: 2px;
  min-width: 0;
}
.file-meta strong {
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 12px;
  margin-top: auto;
}
.upload-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

/* --------------------------------------------------------------- database */

.split {
  display: grid;
  grid-template-columns: minmax(260px, 40%) minmax(0, 1fr);
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
}
.doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow-y: auto;
  min-height: 220px;
}
.doc-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  display: grid;
  gap: 3px;
}
.doc-item:last-child {
  border-bottom: 0;
}
.doc-item:hover {
  background: rgba(255, 255, 255, 0.035);
}
.doc-item.active {
  background: var(--accent-soft);
}
.doc-id {
  font-size: 0.76rem;
  color: #a9b4d0;
  background: none;
  border: 0;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-preview {
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-height: 320px;
  overflow: hidden;
}
.doc-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.code {
  flex: 1 1 auto;
  border: 0;
  border-radius: 0;
  background: var(--bg-soft);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  padding: 12px;
  resize: none;
  min-height: 240px;
}
.code:focus {
  box-shadow: none;
  border-color: transparent;
}
.code:disabled {
  color: var(--muted);
}

/* ------------------------------------------------------------------ admin */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.stat {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  gap: 2px;
}
.stat strong {
  font-size: 1.15rem;
  font-weight: 650;
}
.section-title {
  margin: 20px 0 10px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  font-size: 0.95rem;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  max-height: 320px;
  background: var(--panel);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  padding: 9px 12px;
  background: var(--panel-2);
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.table tr:last-child td {
  border-bottom: 0;
}

/* --------------------------------------------------------------- settings */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}
.card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 12px;
}
.profile-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.kv {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 7px 12px;
  margin: 0;
  font-size: 0.84rem;
}
.kv dt {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-top: 2px;
}
.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* ----------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 32px));
}
.toast {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
  animation: toast-in 0.18s ease-out;
}
.toast.error {
  border-left-color: var(--bad);
}
.toast.leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ------------------------------------------------------------- responsive */

.only-narrow {
  display: none;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .only-narrow {
    display: inline-grid;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 288px;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .brand .only-narrow {
    display: inline-grid;
  }
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
  .messages {
    padding: 14px 14px 4px;
  }
  .composer-wrap {
    padding: 10px 12px 12px;
  }
  .view {
    padding: 14px;
  }
  .msg {
    max-width: 94%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
