:root {
  --bg: #111113; --s1: #18181b; --s2: #202024; --line: #2a2a30;
  --text: #e8e8eb; --muted: #8d8d96; --faint: #5f5f69;
  --accent: #d9b382; --accent-ink: #121212;
  --danger: #e07b72;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --chat-font: var(--font);
  --fs: 15px; --radius: 10px; --chat-w: 760px; --dens: 1; --av-r: 50%;
  --r-sm: max(0px, calc(var(--radius) - 3px));
  --side-w: 252px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--fs)/1.55 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.i { flex: none; display: block; }
.muted { color: var(--muted); }
.link { text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
.link:hover { color: var(--text); }
.faint { color: var(--faint); }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); height: 100dvh; }
.topbar { display: none; }
.side {
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--line); padding: 16px 12px 12px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 16px; letter-spacing: -0.01em; padding: 2px 8px 0; }
.brand-mark { width: 18px; height: 18px; border-radius: 5px; background: var(--accent); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; left: 5px; bottom: 4px; width: 8px; height: 8px; border-left: 2.5px solid var(--accent-ink); border-top: 2.5px solid var(--accent-ink); border-top-left-radius: 4px; }
.nav { display: flex; flex-direction: column; gap: 1px; margin-top: 22px; }
.nav a {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px;
  border-radius: var(--r-sm); color: var(--muted); font-size: 14px;
}
.nav a:hover { color: var(--text); background: var(--s1); }
.nav a.on { color: var(--text); background: var(--s2); }
.side-label { margin: 24px 10px 6px; font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.side-chats { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.side-chat { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); }
.side-chat:hover { background: var(--s1); }
.side-chat.on { background: var(--s2); }
.side-chat .av { width: 30px; height: 30px; font-size: 13px; }
.side-chat-t { min-width: 0; line-height: 1.3; }
.side-chat-n { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-chat-l { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-empty { padding: 4px 10px; font-size: 13px; color: var(--faint); }
.side-spacer { flex: 1; }
.side-foot { border-top: 1px solid var(--line); margin: 10px -12px 0; padding: 12px 12px 0; display: flex; flex-direction: column; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; padding: 0 2px 0 8px; font-size: 14px; }
.me .av { width: 26px; height: 26px; font-size: 12px; }
.me .me-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { min-width: 0; min-height: 0; overflow-y: auto; }
.scrim { display: none; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--s1); color: var(--text);
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, filter .15s;
}
.btn:hover { background: var(--s2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--s1); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center; flex: none;
  border: 0; border-radius: var(--r-sm); background: none; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { color: var(--text); background: var(--s2); }
.icon-btn.xs { width: 28px; height: 28px; }
.icon-btn.danger:hover { color: var(--danger); }

.input {
  width: 100%; background: var(--s1); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font: inherit; font-size: 14px; line-height: 1.5; padding: 8px 11px; outline: none;
  transition: border-color .15s;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
textarea.input { resize: vertical; min-height: 80px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 500; }
.hint { font-size: 12.5px; color: var(--faint); line-height: 1.45; }
.hint code, .hint kbd { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); }
.counter { font-size: 11.5px; color: var(--faint); align-self: flex-end; margin-top: -2px; }

.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--s1); border: 1px solid var(--line); border-radius: calc(var(--r-sm) + 2px); flex-wrap: wrap; }
.seg button {
  border: 0; background: none; color: var(--muted); font-size: 13px;
  height: 28px; padding: 0 11px; border-radius: var(--r-sm); cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--s2); color: var(--text); box-shadow: 0 0 0 1px var(--line) inset; }

.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: var(--s2); border: 1px solid var(--line); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked + span { background: var(--accent); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(16px); background: var(--accent-ink); }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: .4; }
.switch input:focus-visible + span { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.check input { margin: 3px 0 0; accent-color: var(--accent); width: 15px; height: 15px; flex: none; }

input[type=range] { accent-color: var(--accent); width: 100%; }
input[type=color] { width: 32px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 4px; }

.badge { display: inline-flex; align-items: center; height: 17px; padding: 0 5px; border-radius: 4px; font-size: 10.5px; font-weight: 600; letter-spacing: .02em; line-height: 1; border: 1px solid; flex: none; }
.badge.adult { color: #e48d86; border-color: color-mix(in srgb, #e48d86 40%, transparent); }
.badge.private { color: var(--muted); border-color: var(--line); }

/* ---------- avatar ---------- */
.av {
  position: relative; display: grid; place-items: center; flex: none; overflow: hidden;
  width: 40px; height: 40px; border-radius: var(--av-r); background: var(--s2);
  font-weight: 600; font-size: 16px; user-select: none;
}
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.mono { background: hsl(var(--h) 16% 21%); color: hsl(var(--h) 32% 74%); }

/* ---------- pages ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 32px 32px 64px; }
.page.narrow { max-width: 760px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; margin: 0; line-height: 1.25; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 4px 0 0; font-size: 14px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.search { flex: 1 1 280px; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--faint); }
.search:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--text); font: inherit; font-size: 14px; }
.search input::placeholder { color: var(--faint); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; min-height: 28px; }
.tag { height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--line); background: none; color: var(--muted); font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; }
.tag:hover { color: var(--text); border-color: color-mix(in srgb, var(--text) 25%, var(--line)); }
.tag.on { color: var(--accent-ink); background: var(--accent); border-color: transparent; }
span.tag { cursor: default; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; min-width: 0; color: inherit; border-radius: var(--radius); }
.card .av { width: 100%; height: auto; aspect-ratio: 1; border-radius: var(--radius); font-size: 44px; font-weight: 500; }
.card .av img { transition: transform .35s ease; }
.card:hover .av img { transform: scale(1.03); }
.card-body { padding: 10px 2px 0; min-width: 0; }
.card-name { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.card-name b { font-weight: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-tag { color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { color: var(--faint); font-size: 12px; margin-top: 6px; display: flex; gap: 6px; }
.card:hover .card-name b { text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }

[data-cards=list] .grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
[data-cards=list] .card { flex-direction: row; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--line); background: var(--s1); }
[data-cards=list] .card:hover { border-color: color-mix(in srgb, var(--text) 18%, var(--line)); }
[data-cards=list] .card .av { width: 64px; height: 64px; aspect-ratio: auto; border-radius: var(--av-r); font-size: 24px; }
[data-cards=list] .card-body { padding: 0; }

.empty { padding: 48px 0; text-align: center; color: var(--muted); font-size: 14px; }
.empty .btn { margin-top: 14px; }
.loading { padding: 40px 0; color: var(--faint); font-size: 14px; }
.more { display: flex; justify-content: center; margin-top: 28px; }

/* ---------- bot page ---------- */
.hero { display: flex; gap: 28px; align-items: flex-start; }
.hero .av { width: 168px; height: 168px; border-radius: var(--radius); font-size: 64px; font-weight: 500; }
.hero-t { flex: 1; min-width: 0; padding-top: 4px; }
.hero h1 { font-size: 26px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero .tagline { color: var(--muted); margin: 6px 0 0; font-size: 15px; }
.hero .meta { color: var(--faint); font-size: 13px; margin-top: 10px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero .tags { margin: 14px 0 0; }
.hero-actions { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.section { margin-top: 36px; }
.section-t { font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.prose { white-space: pre-wrap; color: color-mix(in srgb, var(--text) 88%, var(--muted)); font-size: 14.5px; }
.quote { border-left: 2px solid var(--line); padding: 2px 0 2px 16px; font-family: var(--chat-font); }
.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); font-size: 14px; }
.list-row:first-child { border-top: 0; }
.list-row:hover { background: var(--s1); }
.list-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.locked { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--muted); font-size: 14px; display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 20px; border-bottom: 1px solid var(--line); min-height: 61px; }
.chat-who { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.chat-who .av { width: 38px; height: 38px; }
.chat-name { font-weight: 600; font-size: 15px; display: flex; gap: 8px; align-items: center; line-height: 1.3; }
.chat-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; }
.chat-who > div { min-width: 0; }
.chat-tools { display: flex; gap: 4px; align-items: center; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-anchor: none; }
[data-chatbg=on] .chat-scroll {
  background-image: linear-gradient(rgba(0, 0, 0, var(--bg-dim)), rgba(0, 0, 0, var(--bg-dim))), var(--chat-bg);
  background-size: cover; background-position: center;
}
.msgs { max-width: var(--chat-w); margin: 0 auto; padding: 28px 20px 16px; }
.msg { display: flex; gap: 14px; padding: calc(12px * var(--dens)) 0; }
.msg-av .av { width: 36px; height: 36px; font-size: 14px; }
.msg-main { min-width: 0; flex: 1; }
.msg-name { font-size: 13px; font-weight: 600; margin-bottom: 3px; color: var(--text); }
.msg.user .msg-name { color: var(--muted); }
.msg-text { font-family: var(--chat-font); overflow-wrap: anywhere; }
.msg-text p { margin: 0 0 .7em; }
.msg-text p:last-child { margin-bottom: 0; }
[data-actions=on] .msg-text em { color: var(--muted); }
.msg-text em { font-style: italic; }
[data-speech=on] .msg-text .say { color: color-mix(in srgb, var(--accent) 60%, var(--text)); }
.msg-tools { display: flex; gap: 0; margin: 4px 0 0 -6px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-tools, .msg.last .msg-tools, .msg-tools:focus-within { opacity: 1; }
.msg-err { color: var(--danger); font-size: 13px; margin-top: 4px; }
.caret { display: inline-block; width: 7px; height: 1.05em; vertical-align: -0.15em; background: var(--muted); margin-left: 2px; animation: blink 1s steps(2) infinite; }
.typing { display: inline-flex; gap: 4px; padding: 8px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: dot 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@keyframes blink { to { visibility: hidden; } }
.edit-area { min-height: 120px; font-family: var(--chat-font); }
.edit-row { display: flex; gap: 6px; justify-content: flex-end; margin-top: 8px; }

[data-msg=bubbles] .msg-main { flex: 0 1 auto; max-width: min(84%, 640px); background: var(--s1); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 14px 10px; }
[data-msg=bubbles] .msg.user { flex-direction: row-reverse; }
[data-msg=bubbles] .msg.user .msg-main { background: color-mix(in srgb, var(--accent) 13%, var(--s1)); border-color: color-mix(in srgb, var(--accent) 22%, var(--line)); }
[data-msg=bubbles] .msg.user .msg-name { display: none; }
[data-msg=bubbles] .msg-tools { margin: 6px 0 -4px -8px; }
[data-msg=bubbles] .msg.editing .msg-main { flex: 1; max-width: none; }
[data-avatars=off] .msg-av { display: none; }

.composer { padding: 6px 20px 16px; }
.composer-in {
  max-width: var(--chat-w); margin: 0 auto; display: flex; align-items: flex-end; gap: 8px;
  background: var(--s1); border: 1px solid var(--line); border-radius: calc(var(--radius) + 2px);
  padding: 6px 6px 6px 14px; transition: border-color .15s;
}
.composer-in:focus-within { border-color: color-mix(in srgb, var(--text) 22%, var(--line)); }
.composer textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: none; background: none; color: var(--text); font: inherit; font-family: var(--chat-font); line-height: 1.5; padding: 6px 0; max-height: 220px; }
.composer textarea::placeholder { color: var(--faint); }
.send { width: 34px; height: 34px; border-radius: var(--r-sm); border: 0; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); cursor: pointer; flex: none; transition: filter .15s, opacity .15s; }
.send:hover { filter: brightness(1.08); }
.send:disabled { opacity: .35; cursor: default; filter: none; }
.send.stop { background: var(--s2); color: var(--text); }
.composer-hint { max-width: var(--chat-w); margin: 7px auto 0; font-size: 11.5px; color: var(--faint); text-align: center; }

/* ---------- forms / settings ---------- */
.form { display: flex; flex-direction: column; gap: 18px; }
.form-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 36px; align-items: start; }
.form-block { display: flex; flex-direction: column; gap: 16px; }
.form-block + .form-block { margin-top: 12px; padding-top: 28px; border-top: 1px solid var(--line); }
.form-block > h2 { margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.uploader { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 24px; }
.uploader .av { width: 200px; height: 200px; border-radius: var(--radius); font-size: 72px; font-weight: 500; cursor: pointer; }
.uploader .av::after { content: "Загрузить"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 500; color: #fff; background: rgba(0,0,0,.55); opacity: 0; transition: opacity .15s; }
.uploader .av:hover::after { opacity: 1; }
.uploader-row { display: flex; gap: 6px; }
.toggle-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.toggle-row .t { min-width: 0; }
.form-actions { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 20px; border-top: 1px solid var(--line); }
.form-actions .right { display: flex; gap: 8px; margin-left: auto; }
.form-err { color: var(--danger); font-size: 13.5px; }

.set-group { margin-bottom: 36px; }
.set-group > h2 { margin-bottom: 4px; }
.set-group > .hint { margin-bottom: 8px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 13px 0; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: 0; }
.set-row .t { min-width: 0; }
.set-row .label { font-weight: 500; font-size: 14px; }
.set-row .ctl { display: flex; align-items: center; gap: 10px; flex: none; }
.set-row.col { flex-direction: column; align-items: stretch; gap: 10px; }
.range { display: flex; align-items: center; gap: 12px; width: 240px; }
.range output { min-width: 48px; text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.swatches { display: flex; gap: 6px; align-items: center; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 0; cursor: pointer; padding: 0; box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset; }
.swatch.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--text); }
.bg-prev { width: 64px; height: 40px; border-radius: 6px; border: 1px solid var(--line); background: var(--s1) center/cover; flex: none; }
.css-area { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; min-height: 160px; tab-size: 2; }

.auth { min-height: 100%; display: grid; place-items: center; padding: 32px 20px; }
.auth-box { width: 100%; max-width: 340px; }
.auth-box h1 { margin-bottom: 6px; }
.auth-box .sub { margin-bottom: 26px; }
.auth-alt { margin-top: 18px; font-size: 13.5px; color: var(--muted); text-align: center; }
.auth-alt a { color: var(--text); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }

/* ---------- dialog / toast ---------- */
dialog {
  background: var(--s1); color: var(--text); border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px); padding: 22px; width: calc(100% - 32px); max-width: 400px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
dialog::backdrop { background: rgba(0, 0, 0, .62); }
dialog h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
dialog p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; width: max-content; max-width: calc(100% - 32px); }
.toast { background: var(--s2); border: 1px solid var(--line); color: var(--text); padding: 9px 14px; border-radius: var(--r-sm); font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: up .2s ease; }
.toast.err { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
@keyframes up { from { opacity: 0; transform: translateY(6px); } }

[data-motion=off] *, [data-motion=off] *::before, [data-motion=off] *::after { transition: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 0s !important; } }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: 52px minmax(0, 1fr); }
  .topbar { display: flex; align-items: center; gap: 6px; padding: 0 10px; border-bottom: 1px solid var(--line); }
  .topbar .brand { padding: 0; }
  .side { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(290px, 86vw); background: var(--bg); transform: translateX(-100%); transition: transform .2s ease; }
  .side.open { transform: none; }
  .side.open + .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.55); }
  .side > .brand { display: none; }
  .side .nav { margin-top: 4px; }
  .page { padding: 22px 16px 48px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  [data-cards=list] .grid { grid-template-columns: 1fr; }
  .hero { flex-direction: column; gap: 18px; }
  .hero .av { width: 120px; height: 120px; font-size: 48px; }
  .form-grid { grid-template-columns: 1fr; gap: 24px; }
  .uploader { position: static; flex-direction: row; align-items: center; }
  .uploader .av { width: 112px; height: 112px; font-size: 40px; }
  .uploader-row { flex-direction: column; }
  .row2 { grid-template-columns: 1fr; }
  .set-row { flex-wrap: wrap; }
  .range { width: 100%; }
  .chat-head { padding: 8px 10px 8px 14px; min-height: 54px; }
  .chat-tools .btn span { display: none; }
  .msgs { padding: 18px 14px 10px; }
  .composer { padding: 4px 10px 10px; }
  .composer-hint { display: none; }
  .msg-tools { opacity: 1; }
}
