/* Kimia UI — dark-first, glass surfaces, one gradient accent.
   Hand-written, no framework. Logical properties (inline-start/end) are used
   for everything that should mirror in RTL; the chat bubbles deliberately use
   physical left/right because their sides are a product decision, not a
   text-direction consequence: the user's prompts sit right, Kimia sits left,
   in both languages. */

@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/Vazirmatn.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #070b13;
  --bg-glow-1: rgba(56, 130, 246, .13);
  --bg-glow-2: rgba(129, 92, 246, .10);
  --surface: #0e1520;
  --surface-2: #151e2c;
  --surface-3: #1c2738;
  --glass: rgba(17, 25, 39, .72);
  --border: rgba(148, 178, 215, .13);
  --border-strong: rgba(148, 178, 215, .26);
  --text: #e9eef6;
  --text-dim: #97a6bb;
  --text-faint: #64748b;
  --accent: #4da8ff;
  --accent-2: #8b7bff;
  --grad: linear-gradient(135deg, #38bdf8 0%, #6d7ffb 55%, #a78bfa 100%);
  --accent-dim: rgba(77, 168, 255, .13);
  --ok: #34d399;
  --ok-dim: rgba(52, 211, 153, .12);
  --warn: #fbbf24;
  --warn-dim: rgba(251, 191, 36, .11);
  --danger: #fb7185;
  --danger-dim: rgba(251, 113, 133, .12);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 34px rgba(0, 0, 0, .35);
  --glow: 0 0 0 1px rgba(93, 143, 255, .22), 0 6px 28px rgba(80, 130, 255, .25);
  --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Roboto, Tahoma, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #eef1f7;
    --bg-glow-1: rgba(56, 130, 246, .10);
    --bg-glow-2: rgba(129, 92, 246, .08);
    --surface: #ffffff;
    --surface-2: #f2f5fa;
    --surface-3: #e9edf5;
    --glass: rgba(255, 255, 255, .78);
    --border: rgba(30, 55, 90, .12);
    --border-strong: rgba(30, 55, 90, .24);
    --text: #131c2a;
    --text-dim: #57677c;
    --text-faint: #8795a8;
    --accent: #146fe0;
    --accent-2: #6d5ce6;
    --accent-dim: rgba(20, 111, 224, .10);
    --ok: #0e9f5f;
    --ok-dim: rgba(14, 159, 95, .10);
    --warn: #b07508;
    --warn-dim: rgba(176, 117, 8, .10);
    --danger: #d63a52;
    --danger-dim: rgba(214, 58, 82, .09);
    --shadow: 0 1px 2px rgba(16, 26, 38, .07), 0 10px 30px rgba(16, 26, 38, .08);
    --glow: 0 0 0 1px rgba(20, 111, 224, .18), 0 6px 24px rgba(20, 111, 224, .16);
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(900px 500px at 85% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(700px 480px at -10% 110%, var(--bg-glow-2), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

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

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

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

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

.app-loading { display: grid; place-items: center; height: 100vh; }
.boot { text-align: center; animation: rise .5s ease both; }
.boot-mark {
  width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 17px;
  display: grid; place-items: center;
  background: var(--grad);
  color: #fff; font-size: 28px; font-weight: 750;
  box-shadow: var(--glow);
}
.boot-text { color: var(--text-dim); letter-spacing: .35em; font-size: 12px; text-transform: uppercase; }

/* ----------------------------------------------------------------- shell --- */

.shell { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }

.sidebar {
  display: flex; flex-direction: column;
  border-inline-end: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  position: sticky; top: 0; height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  font-weight: 700; font-size: 16.5px; letter-spacing: .01em;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--grad); color: #fff; font-size: 17px; font-weight: 750;
  box-shadow: 0 3px 14px rgba(80, 130, 255, .35);
  flex: none;
}

.nav { flex: 1; padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: 10px;
  color: var(--text-dim); font-size: 14px; font-weight: 530;
  border: 1px solid transparent;
  transition: color .15s, background .15s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active {
  color: var(--text); background: var(--accent-dim);
  border-color: rgba(93, 143, 255, .25);
  box-shadow: inset 3px 0 0 0 var(--accent);
}
[dir="rtl"] .nav a.active { box-shadow: inset -3px 0 0 0 var(--accent); }
.nav-count {
  min-width: 20px; padding: 1px 7px; border-radius: 99px; text-align: center;
  background: var(--grad); color: #fff; font-size: 11px; font-weight: 650;
}

.sidebar-foot {
  border-block-start: 1px solid var(--border);
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.who { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-dim); min-width: 0; }
.who b { color: var(--text); font-weight: 600; }

/* ------------------------------------------------------------------ page --- */

.page { padding: 26px 30px; max-width: 1160px; margin-inline: auto; width: 100%; }
.page-head { margin-block-end: 20px; }
.page-head h1 { margin: 0 0 4px; font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.page-head p { margin: 0; color: var(--text-dim); font-size: 13.5px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.small { font-size: 12.5px; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--mono); font-size: .92em; font-variant-numeric: tabular-nums; }
.num { text-align: end; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------------ card --- */

.card {
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-block-end: 16px;
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 18px; border-block-end: 1px solid var(--border);
  font-weight: 650; font-size: 14px;
}
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.empty { text-align: center; padding: 44px 22px; color: var(--text-dim); }
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 16px; }
.empty p { margin: 0; font-size: 13.5px; }

.stat { padding: 14px 18px; }
.stat-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat-label { font-size: 12px; color: var(--text-faint); margin-block-start: 2px; }

/* --------------------------------------------------------------- buttons --- */

.btn {
  appearance: none; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 13.5px; font-weight: 570;
  padding: 8px 15px; border-radius: 10px; cursor: pointer;
  transition: transform .12s, box-shadow .15s, background .15s, border-color .15s;
}
.btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }

.btn-primary {
  background: var(--grad); border: none; color: #fff;
  box-shadow: 0 3px 16px rgba(80, 130, 255, .30);
}
.btn-primary:hover:not(:disabled) { background: var(--grad); filter: brightness(1.08); box-shadow: var(--glow); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }

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

.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }

/* ----------------------------------------------------------------- forms --- */

.field { margin-block-end: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-block-end: 5px; }

input, textarea, select {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 9px 12px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }

.editor {
  font-family: var(--mono); font-size: 13px; line-height: 1.55;
  min-height: 380px; white-space: pre; tab-size: 2;
}

/* ----------------------------------------------------------------- pills --- */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .01em;
  background: var(--surface-3); color: var(--text-dim);
  border: 1px solid var(--border);
}
.pill.ok { background: var(--ok-dim); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-dim); color: var(--warn); border-color: transparent; }
.pill.danger { background: var(--danger-dim); color: var(--danger); border-color: transparent; }
.pill.info { background: var(--accent-dim); color: var(--accent); border-color: transparent; }
.pill.running { background: var(--accent-dim); color: var(--accent); border-color: transparent; }
.pill.running::before {
  content: ""; width: 7px; height: 7px; border-radius: 99px;
  background: var(--accent); animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .25; transform: scale(.8); } }

/* ---------------------------------------------------------------- tables --- */

.table-scroll { overflow: auto; max-height: 460px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  position: sticky; top: 0; z-index: 1;
  text-align: start; font-size: 11.5px; font-weight: 650;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-faint);
  background: var(--surface);
  padding: 10px 14px; border-block-end: 1px solid var(--border-strong);
  white-space: nowrap;
}
tbody td {
  padding: 9px 14px; border-block-end: 1px solid var(--border);
  vertical-align: top; font-variant-numeric: tabular-nums;
}
tbody tr:last-child td { border-block-end: none; }
tbody tr:hover { background: var(--surface-2); }

/* -------------------------------------------------------------- progress --- */

.progress {
  height: 5px; border-radius: 99px; overflow: hidden;
  background: var(--surface-3);
}
.progress i {
  display: block; height: 100%; border-radius: 99px;
  background: var(--grad);
  transition: width .4s ease;
}

/* ---------------------------------------------------------------- notice --- */

.notice {
  padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  border-inline-start: 3px solid var(--border-strong);
  font-size: 13.5px; margin-block: 8px;
}
.notice.warn { border-inline-start-color: var(--warn); background: var(--warn-dim); }
.notice.info { border-inline-start-color: var(--accent); background: var(--accent-dim); }

/* ----------------------------------------------------------------- toast --- */

.toast-host {
  position: fixed; inset-block-end: 18px; inset-inline-start: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 1200;
  width: min(430px, calc(100vw - 32px));
}
.toast {
  background: var(--glass); backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-inline-start: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 11px 15px; font-size: 13.5px;
  animation: rise .22s ease both;
}
.toast.error { border-inline-start-color: var(--danger); }
.toast.ok { border-inline-start-color: var(--ok); }
@keyframes rise { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }
.toast-host .toast { transform: none; animation-name: rise-in; }
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } }

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

.chat { display: grid; grid-template-columns: 236px 1fr; height: 100vh; min-height: 0; }

.chat-list {
  border-inline-end: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow: auto;
}
.chat-list-head { padding: 12px; border-block-end: 1px solid var(--border); }
.conv {
  display: block; padding: 10px 13px;
  border-block-end: 1px solid var(--border);
  color: var(--text); font-size: 13.5px; cursor: pointer;
  transition: background .14s;
}
.conv:hover { background: var(--surface-2); text-decoration: none; }
.conv.active { background: var(--accent-dim); box-shadow: inset 3px 0 0 0 var(--accent); }
[dir="rtl"] .conv.active { box-shadow: inset -3px 0 0 0 var(--accent); }
.conv-title { font-weight: 570; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }

.msgs {
  flex: 1; overflow: auto;
  padding: 26px clamp(16px, 4vw, 44px);
  display: flex; flex-direction: column; gap: 18px;
}

/* Bubble sides are a product decision, not a text-direction one: the user
   sits right, Kimia sits left, in both English and Persian. Hence physical
   margins, not logical ones. */
.msg { animation: msg-in .28s ease both; max-width: min(860px, 92%); }
@keyframes msg-in { from { opacity: 0; transform: translateY(10px); } }

.msg.user {
  margin-left: auto;
  margin-right: 0;
}
.msg.user .msg-body {
  background: var(--grad);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  padding: 11px 16px;
  box-shadow: 0 4px 18px rgba(80, 130, 255, .28);
  font-weight: 480;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg.assistant {
  margin-right: auto;
  margin-left: 0;
  width: 100%;
  /* Messenger layout: avatar physically on the left of the card in both
     languages. direction:ltr pins the flex order; the body restores the
     page's text direction below. */
  display: flex;
  align-items: flex-start;
  gap: 10px;
  direction: ltr;
}
.msg.assistant .msg-body {
  flex: 1;
  min-width: 0;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 4px 18px 18px 18px;
  padding: 15px 19px;
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}
[dir="rtl"] .msg.assistant .msg-body { direction: rtl; }
[dir="ltr"] .msg.assistant .msg-body { direction: ltr; }

.msg-avatar {
  flex: none;
  width: 32px; height: 32px;
  border-radius: 99px;
  display: grid; place-items: center;
  background: var(--grad);
  color: #fff; font-size: 15px; font-weight: 750;
  box-shadow: 0 2px 10px rgba(80, 130, 255, .35);
  margin-block-start: 2px;
  user-select: none;
}

/* Agent activity inside an assistant message */
.steps { display: flex; flex-direction: column; gap: 6px; margin-block: 10px; }
.step {
  display: flex; align-items: baseline; gap: 9px;
  font-size: 12.8px; color: var(--text-dim);
  padding: 4px 2px;
}
.step-dot {
  flex: none; width: 8px; height: 8px; border-radius: 99px;
  background: var(--text-faint); position: relative; top: 1px;
}
.step.running .step-dot { background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }
.step.ok .step-dot { background: var(--ok); }
.step.fail .step-dot { background: var(--danger); }

/* Live "working" shimmer */
.thinking {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text-dim); font-size: 13.5px;
}
.thinking .dots { display: inline-flex; gap: 4px; }
.thinking .dots i {
  width: 6px; height: 6px; border-radius: 99px; background: var(--accent);
  animation: bounce 1.2s ease-in-out infinite;
}
.thinking .dots i:nth-child(2) { animation-delay: .15s; }
.thinking .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 30% { transform: translateY(-4px); opacity: .5; } }

.artifacts { display: flex; flex-direction: column; gap: 8px; margin-block-start: 12px; }
.artifact {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
.artifact:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); text-decoration: none; }

.chart { display: grid; gap: 6px; margin-block: 10px; }
.chart-row { display: grid; grid-template-columns: minmax(90px, 200px) 1fr auto; gap: 10px; align-items: center; font-size: 12.8px; }
.chart-bar { height: 18px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.chart-bar i { display: block; height: 100%; background: var(--grad); border-radius: 5px; }

/* Clarifying-question form inside an assistant message */
.q-form { display: flex; flex-direction: column; gap: 10px; }
.q-title { font-weight: 700; font-size: 13px; }
.q-item { display: flex; flex-direction: column; gap: 4px; }
.q-text { font-weight: 570; font-size: 13.5px; }
.q-option { border-style: dashed; }
.q-option.selected {
  background: var(--accent-dim);
  border-style: solid;
  border-color: var(--accent);
  color: var(--accent);
}

.thinking .elapsed {
  color: var(--text-faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Markdown-lite answer rendering */
.md { display: flex; flex-direction: column; gap: 8px; }
.md-p { margin: 0; }
.md-h { font-weight: 700; font-size: 15px; margin-block-start: 6px; }
.md-list { margin: 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 4px; }
.md-code {
  font-family: var(--mono); font-size: .9em;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 6px;
}
.md-link { font-weight: 600; }

details.diag { margin-block-start: 9px; }
details.diag > summary { cursor: pointer; font-size: 12.5px; color: var(--text-dim); user-select: none; }
details.diag pre {
  background: var(--surface-2); padding: 10px; border-radius: var(--radius-sm);
  overflow: auto; font-size: 12px; margin: 8px 0 0; max-height: 320px;
  border: 1px solid var(--border);
}

/* -------------------------------------------------------------- composer --- */

.composer { padding: 14px clamp(16px, 4vw, 44px) 20px; }
.composer-inner {
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.composer-inner:focus-within { border-color: var(--accent); box-shadow: var(--glow); }
.composer textarea {
  background: none; border: none; box-shadow: none; padding: 6px 6px 2px;
  resize: none; max-height: 200px; font-size: 14.5px;
}
.composer textarea:focus { box-shadow: none; border: none; }

/* ------------------------------------------------------- chat drawer bits --- */

.chat-bar {
  display: none;
  align-items: center; gap: 8px;
  padding: 8px 12px;
  border-block-end: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.chat-drawer-toggle::before { content: "☰"; margin-inline-end: 6px; font-size: 14px; }

.chat-scrim {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(2, 6, 14, .55);
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}

/* ----------------------------------------------------------------- login --- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(400px, 100%); animation: rise-in .4s ease both; }
.login-card .card { box-shadow: var(--shadow), 0 0 80px rgba(80, 130, 255, .10); }

/* ------------------------------------------------------------ context menu --- */

.ctx-menu {
  position: fixed; z-index: 1000;
  min-width: 208px; padding: 5px;
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 1px;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: menu-in .12s ease both;
}
@keyframes menu-in { from { opacity: 0; transform: scale(.97); } }
.ctx-item {
  appearance: none; background: none; border: 0; border-radius: 6px;
  padding: 8px 10px; font: inherit; font-size: 13.5px; color: var(--text);
  text-align: start; cursor: pointer; white-space: nowrap;
}
.ctx-item:hover:not([disabled]),
.ctx-item:focus-visible:not([disabled]) { background: var(--surface-2); outline: none; }
.ctx-item[disabled] { color: var(--text-faint); cursor: default; }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger:hover:not([disabled]),
.ctx-item.danger:focus-visible:not([disabled]) { background: var(--danger-dim); }
.ctx-sep { height: 1px; background: var(--border); margin: 4px 2px; }

tr.has-menu:hover { background: var(--surface-2); }

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

@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto;
    flex-direction: row; align-items: center; gap: 8px; overflow-x: auto;
    border-inline-end: none; border-block-end: 1px solid var(--border);
  }
  .nav { display: flex; flex-direction: row; padding: 8px; }
  .nav a.active, [dir="rtl"] .nav a.active { box-shadow: none; }
  .sidebar-foot { margin: 0; padding: 8px; border: none; flex-direction: row; align-items: center; }
  .brand span { display: none; }

  .chat { grid-template-columns: 1fr; }
  .chat-list {
    position: fixed; inset-block: 0; inset-inline-start: 0;
    width: min(300px, 84vw); z-index: 60;
    transform: translateX(var(--drawer-hidden, -102%));
    transition: transform .18s ease;
    box-shadow: var(--shadow);
    background: var(--surface);
  }
  .chat.drawer-open .chat-list { transform: translateX(0); }
  .chat.drawer-open .chat-scrim { opacity: 1; pointer-events: auto; }
  .chat-bar { display: flex; }

  .page { padding: 16px; }
  .msgs { padding: 18px 14px; }
  .composer { padding: 10px 12px 14px; }
  .msg { max-width: 96%; }
  .grid-2 { grid-template-columns: 1fr; }
}

[dir="rtl"] .chat-list { --drawer-hidden: 102%; }
