/* ===== Tokens ============================================================ */

:root {
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #ffffff;
  --bg-subtle: #f6f7f9;
  --bg-hover: #f1f3f6;
  --surface: #ffffff;
  --text: #1c2230;
  --text-muted: #5f6b7d;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;

  --accent: #3b6ef5;
  --accent-hover: #2f5ddb;
  --accent-soft: #e8eefe;
  --accent-text: #ffffff;

  --danger: #d0353f;
  --danger-hover: #b42a33;
  --danger-soft: #fdecee;
  --success: #1f8a4c;
  --warn-bg: #fff6e0;
  --warn-border: #f0d48a;
  --warn-text: #6b4e00;

  --rail-bg: #11161f;
  --sidebar-bg: #1b2230;
  --sidebar-text: #c7cfdb;
  --sidebar-muted: #8592a6;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: #3b6ef5;
  --sidebar-active-text: #ffffff;

  --banner-bg: #1f3c8f;
  --banner-text: #ffffff;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 10px 40px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181f;
    --bg-subtle: #1a1f28;
    --bg-hover: #1f2530;
    --surface: #1a1f28;
    --text: #e4e8ee;
    --text-muted: #98a2b3;
    --border: #2a313d;
    --border-strong: #3a4250;
    --accent: #5b86ff;
    --accent-hover: #7398ff;
    --accent-soft: #22304f;
    --danger: #f0616a;
    --danger-hover: #ff7b83;
    --danger-soft: #3a1f23;
    --success: #4cc27f;
    --warn-bg: #3a3017;
    --warn-border: #6b5a26;
    --warn-text: #f3dc9a;
    --rail-bg: #0b0e13;
    --sidebar-bg: #11151c;
    --banner-bg: #233f8f;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  }
}

/* ===== Base ============================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  font: 15px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0 0 8px;
  line-height: 1.25;
}

p {
  margin: 0 0 12px;
}

a {
  color: var(--accent);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 4px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-subtle);
}

.muted {
  color: var(--text-muted);
}

.muted-inline {
  color: inherit;
  opacity: 0.65;
  font-weight: 400;
}

.small {
  font-size: 13px;
}

.lead {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.row-gap {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm {
  width: 15px;
  height: 15px;
}

.muted-icon {
  color: var(--text-muted);
}

/* ===== Layout ============================================================ */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.boot {
  margin: auto;
  color: var(--text-muted);
}

.workspace {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.scrim {
  display: none;
}

.mobile-only {
  display: none !important;
}

/* ===== Guest banner ====================================================== */

.banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 8px 16px;
  background: var(--banner-bg);
  color: var(--banner-text);
  font-size: 14px;
}

.banner-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* ===== Buttons =========================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}

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

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 13px;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
}

.btn-danger-ghost {
  color: var(--danger);
  border-color: var(--border-strong);
}

.btn-danger-ghost:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.btn-light {
  background: #fff;
  border-color: #fff;
  color: #1f3c8f;
}

.btn-light:hover {
  background: #e8eefe;
}

.btn-link-light {
  background: transparent;
  border-color: transparent;
  color: #fff;
  text-decoration: underline;
}

.btn-link-light:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-link {
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  font-weight: 600;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.icon-btn-sm {
  width: 24px;
  height: 24px;
}

/* ===== Avatars =========================================================== */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  user-select: none;
}

.avatar-xs {
  width: 20px;
  height: 20px;
  font-size: 9px;
  border-radius: 5px;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
  border-radius: 6px;
}

.avatar-md {
  width: 36px;
  height: 36px;
  font-size: 13px;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 20px;
  border-radius: 12px;
}

.av-0 { background: #3b6ef5; }
.av-1 { background: #0f9d8a; }
.av-2 { background: #c2410c; }
.av-3 { background: #7c3aed; }
.av-4 { background: #be185d; }
.av-5 { background: #15803d; }
.av-6 { background: #b45309; }
.av-7 { background: #0369a1; }
.av-mail { background: var(--bg-hover); color: var(--text-muted); }

/* ===== Org rail ========================================================== */

.rail {
  width: 68px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  background: var(--rail-bg);
  overflow-y: auto;
}

.rail-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: #c7cfdb;
  cursor: pointer;
  text-decoration: none;
  transition: border-radius 0.15s, background 0.15s;
}

.rail-item:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.rail-item.active {
  box-shadow: 0 0 0 2px var(--rail-bg), 0 0 0 4px #fff;
}

.rail-org {
  background: transparent;
  padding: 0;
}

.rail-org-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}

.list-row .rail-org-initials {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  font-size: 13px;
}

.rail-add {
  border: 1px dashed rgba(255, 255, 255, 0.25);
  background: transparent;
}

.rail-sep {
  width: 28px;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  flex: none;
}

.rail-spacer {
  flex: 1;
}

.rail-me {
  background: transparent;
}

.rail-badge {
  position: absolute;
  top: -5px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  border: 2px solid var(--rail-bg);
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}

.rail-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--rail-bg);
  background: #fff;
}

/* ===== Sidebar =========================================================== */

.sidebar {
  width: 260px;
  flex: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 56px;
  padding: 0 12px 0 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex: none;
}

.org-name-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}

.org-name-btn:hover {
  background: var(--sidebar-hover);
}

.org-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-role {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sidebar-muted);
  flex: none;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px 16px;
}

.side-section {
  margin-top: 14px;
}

.side-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 4px 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sidebar-muted);
}

.side-section-title .icon-btn {
  color: var(--sidebar-muted);
}

.side-section-title .icon-btn:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.side-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 32px;
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--sidebar-text);
  text-align: left;
  text-decoration: none;
  font-size: 15px;
  cursor: pointer;
}

.side-item:hover {
  background: var(--sidebar-hover);
}

.side-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
}

.side-item.unread {
  color: #fff;
  font-weight: 700;
}

.side-item.inactive .side-label {
  opacity: 0.55;
  text-decoration: line-through;
}

.side-action {
  color: var(--sidebar-muted);
}

.side-icon {
  display: inline-flex;
  justify-content: center;
  width: 20px;
  flex: none;
  opacity: 0.75;
}

.side-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-badge {
  flex: none;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.side-empty {
  padding: 4px 10px;
  font-size: 13px;
  color: var(--sidebar-muted);
}

/* ===== Conversation ====================================================== */

.conv-header {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  flex: none;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.conv-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.conv-title-btn {
  border: 0;
  background: none;
  padding: 4px 6px;
  margin-left: -6px;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
}

.conv-title-btn:hover {
  background: var(--bg-hover);
}

.conv-name {
  font-weight: 700;
  font-size: 17px;
  white-space: nowrap;
}

.conv-topic {
  color: var(--text-muted);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.conv-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.member-count {
  color: var(--text-muted);
}

.scroller {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.message-list {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100%;
  padding: 16px 0 8px;
}

.load-older {
  display: flex;
  justify-content: center;
  padding: 8px 0 16px;
}

.conv-intro {
  padding: 24px 20px 16px;
}

.conv-intro-topic {
  margin-top: -6px;
  padding-left: 10px;
  border-left: 3px solid var(--border-strong);
}

.conv-intro h2 {
  margin-top: 10px;
  font-size: 22px;
}

.conv-intro-icon,
.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 28px;
  font-weight: 700;
}

.day-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 20px 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.day-divider::before,
.day-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.msg {
  display: flex;
  gap: 10px;
  padding: 6px 20px 2px;
}

.msg:hover {
  background: var(--bg-subtle);
}

.msg-grouped {
  padding-top: 1px;
}

.msg-gutter {
  width: 36px;
  flex: none;
  display: flex;
  justify-content: center;
}

/* The hover time (compact, e.g. "12:18") must stay on one line no taller than a
   line of message text, or it stretches the row. */
.msg-grouped .msg-gutter {
  justify-content: flex-end;
}

.msg-grouped .msg-time {
  visibility: hidden;
  font-size: 11px;
  line-height: 22px;
}

.msg-grouped:hover .msg-time {
  visibility: visible;
}

.msg-content {
  flex: 1;
  min-width: 0;
}

.msg-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.msg-author {
  font-weight: 700;
}

.msg-time {
  flex: none;
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.msg-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.composer-slot {
  flex: none;
  padding: 0 20px 12px;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

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

.composer-input {
  flex: 1;
  min-height: 34px;
  max-height: 200px;
  padding: 6px 0;
  border: 0;
  outline: none;
  background: transparent;
  resize: none;
  line-height: 1.45;
}

.send-btn {
  background: var(--accent);
  color: #fff;
}

.send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  color: #fff;
}

.send-btn:disabled {
  background: var(--bg-hover);
  color: var(--text-muted);
  opacity: 1;
}

.composer-hint {
  padding: 4px 4px 0;
  font-size: 11px;
  color: var(--text-muted);
}

.composer-disabled {
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  color: var(--text-muted);
  text-align: center;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  padding: 32px 16px;
  text-align: center;
}

.empty-state .btn {
  margin-top: 8px;
}

.loading {
  margin: auto;
  color: var(--text-muted);
}

/* ===== Home ============================================================== */

.home {
  flex: 1;
  overflow-y: auto;
  padding: 40px 16px;
}

.home-inner {
  max-width: 680px;
  margin: 0 auto;
}

.home h1 {
  font-size: 28px;
}

.card {
  margin-bottom: 20px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.card h2 {
  font-size: 17px;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.card-title-row h2 {
  margin: 0;
}

/* ===== Lists ============================================================= */

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

.list-scroll {
  max-height: 50vh;
  overflow-y: auto;
  margin: 0 -8px;
  padding: 0 8px;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 8px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  text-align: left;
  color: inherit;
}

.list > li + li > .list-row,
.list > .list-row + .list-row {
  border-top: 1px solid var(--border);
  border-radius: 0;
}

.list-link,
.list-check {
  cursor: pointer;
  text-decoration: none;
}

.list-link:hover,
.list-check:hover {
  background: var(--bg-hover);
  border-radius: var(--radius);
}

.list-main {
  flex: 1;
  min-width: 0;
}

.list-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.list-empty {
  padding: 16px 8px;
  color: var(--text-muted);
  text-align: center;
}

.list-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.channel-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 9px;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 18px;
}

.role-pill,
.joined-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.role-admin {
  background: var(--accent-soft);
  color: var(--accent);
}

.joined-pill {
  margin-left: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: 1px;
}

/* ===== Modals ============================================================ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 16px;
  background: rgba(10, 14, 22, 0.55);
  overflow-y: auto;
  animation: fade-in 0.12s ease-out;
}

.modal {
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: pop-in 0.14s ease-out;
}

.modal-lg {
  max-width: 640px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 6px;
}

.modal-header h2 {
  margin: 0;
  font-size: 19px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-body {
  padding: 8px 20px 20px;
}

.modal-body > .input {
  margin-bottom: 8px;
}

.modal-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.confirm-message {
  color: var(--text-muted);
}

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

.tab {
  padding: 8px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
}

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

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.panel-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.panel-toolbar .input {
  flex: 1;
}

.section-heading {
  margin: 20px 0 6px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.section-heading-row .section-heading {
  margin: 0;
}

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

.notice {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
}

.notice-warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

/* ===== Forms ============================================================= */

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
}

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

.input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}

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

.input-sm {
  width: auto;
  padding: 4px 8px;
  font-size: 13px;
}

textarea.input {
  resize: vertical;
}

.form-error {
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.form .small {
  margin: 0;
}

/* ===== Toasts ============================================================ */

.toasts {
  position: fixed;
  right: 16px;
  top: 64px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: min(380px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #1c2230;
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: pop-in 0.16s ease-out;
  transition: opacity 0.3s, transform 0.3s;
}

.toast-success {
  background: #17663a;
}

.toast-error {
  background: #a3232c;
}

.toast-out {
  opacity: 0;
  transform: translateY(6px);
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ===== Small screens ===================================================== */

@media (max-width: 760px) {
  .mobile-only {
    display: inline-flex !important;
  }

  .rail {
    width: 60px;
  }

  .rail-item,
  .rail-org-initials {
    width: 40px;
    height: 40px;
  }

  .sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 60px;
    z-index: 20;
    transform: translateX(calc(-100% - 60px));
    transition: transform 0.18s ease-out;
    box-shadow: var(--shadow);
  }

  body.sidebar-open .sidebar {
    transform: none;
  }

  body.sidebar-open .scrim {
    display: block;
    position: absolute;
    inset: 0 0 0 60px;
    z-index: 10;
    background: rgba(10, 14, 22, 0.45);
  }

  .composer-hint {
    display: none;
  }

  .conv-topic {
    display: none;
  }

  .msg {
    padding-left: 12px;
    padding-right: 12px;
  }

  .composer-slot {
    padding: 0 12px 10px;
  }

  .overlay {
    padding-top: 4vh;
  }

  .home {
    padding: 24px 16px;
  }

  .list-row .row-gap {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}
