/*
  Karma — панель.
  Цвет акцента берётся из аватарки бота (app.js пишет --h), поэтому у каждого бота панель своего оттенка.
  Поверхности — тёмные, подкрашенные тем же оттенком; никаких серых «кнопочных» карточек: настройки идут списком.
*/
:root {
  --h: 28;
  --bg: hsl(var(--h) 22% 5.5%);
  --rail: hsl(var(--h) 24% 7.5%);
  --surface: hsl(var(--h) 18% 10.5%);
  --surface-2: hsl(var(--h) 18% 13%);
  --line: hsl(var(--h) 14% 17%);
  --line-2: hsl(var(--h) 14% 24%);
  --text: hsl(var(--h) 30% 95%);
  --muted: hsl(var(--h) 9% 64%);
  --faint: hsl(var(--h) 8% 42%);
  --accent: hsl(var(--h) 92% 62%);
  --accent-soft: hsl(var(--h) 80% 55% / .15);
  --accent-ring: hsl(var(--h) 92% 62% / .28);
  --accent-ink: hsl(var(--h) 45% 8%);
  --ok: #67d995;
  --bad: #ff6f6f;
  --warn: #ffc247;
  --radius: 12px;
  --display: 'Unbounded', 'Onest', ui-sans-serif, system-ui, sans-serif;
  --font: 'Onest', ui-sans-serif, 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; transition: background .6s; }
a { color: var(--accent); text-underline-offset: 3px; }
button { font-family: inherit; cursor: pointer; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── иконки ── */
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i.lg { width: 22px; height: 22px; }
.i.xl { width: 28px; height: 28px; stroke-width: 1.5; }
@keyframes k-spin { to { transform: rotate(360deg); } }
@keyframes k-blink { 50% { opacity: .35; } }
@keyframes k-shimmer { to { background-position: -200% 0; } }
.spin { animation: k-spin .9s linear infinite; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ── вход ── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 340px; }
.login-card .mark.av { width: 80px; height: 80px; border-radius: 50%; overflow: hidden; background: none; }
.login-card .mark.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-card .mark { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; margin-bottom: 22px; }
.login-card h1 { font: 600 24px/1.2 var(--display); letter-spacing: -.02em; margin: 0 0 6px; }
.login-card p { color: var(--muted); margin: 0 0 24px; }
.login-card .err { color: var(--bad); margin: 14px 0 0; display: none; font-size: 13.5px; }

/* ── поля ── */
input, select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 9px 12px; font: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-2); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { resize: vertical; min-height: 92px; line-height: 1.5; }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
select option { background: #151515; }
input[type=number] { font-variant-numeric: tabular-nums; }

/* ── кнопки ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 8px 15px; font-weight: 600; font-size: 14px;
  transition: filter .15s, background .15s, border-color .15s, transform .1s; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 12%, transparent); filter: none; }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn .i { width: 16px; height: 16px; }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: 8px; color: var(--muted); display: inline-flex; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ── каркас ── */
.app { display: none; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; }
.app.on { display: grid; }
.rail { background: var(--rail); border-right: 1px solid var(--line); padding: 18px 14px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 6px 16px; }
.brand img { width: 40px; height: 40px; border-radius: 12px; background: var(--surface); object-fit: cover; }
.brand b { display: block; font: 600 15px/1.2 var(--display); letter-spacing: -.01em; }
.brand small { color: var(--muted); display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: inline-block; animation: k-blink 2.4s ease-in-out infinite; }
.dot.off { background: var(--faint); animation: none; }

.guild { position: relative; margin-bottom: 14px; }
.guild-btn { width: 100%; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; text-align: left; }
.guild-btn:hover { border-color: var(--line-2); }
.guild-btn .ico, .guild-menu .ico { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--muted); object-fit: cover; flex: none; overflow: hidden; }
.guild-btn span.n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.guild-menu { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 5px; box-shadow: 0 18px 40px rgb(0 0 0 / .5); display: none; }
.guild-menu.on { display: block; }
.guild-menu button { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: 0; border-radius: 8px; padding: 7px 8px; text-align: left; }
.guild-menu button:hover, .guild-menu button.cur { background: var(--accent-soft); }

.nav-group { color: var(--faint); font-size: 12.5px; font-weight: 600; padding: 18px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border-radius: 10px; color: var(--muted); border: 0; background: none; text-align: left; font-size: 14.5px; transition: color .12s, background .12s; }
.nav-item:hover { color: var(--text); background: var(--surface); }
.nav-item.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.nav-item .tag { margin-left: auto; font-size: 11.5px; padding: 1px 7px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.rail .spacer { flex: 1; min-height: 18px; }
.rail-foot { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 2px; }
.kbd { margin-left: auto; font: 11.5px var(--mono); color: var(--faint); border: 1px solid var(--line-2); border-radius: 6px; padding: 0 6px; }

.main { min-width: 0; padding: 34px clamp(20px, 4vw, 56px) 140px; }
.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 8px; }
.page-head h1 { font: 600 clamp(24px, 3vw, 32px)/1.15 var(--display); letter-spacing: -.025em; margin: 0; }
.page-head p { margin: 8px 0 0; color: var(--muted); max-width: 60ch; }
.page-head .grow { flex: 1; min-width: 0; }
.menu-btn { display: none; }

/* настройки — списком, без коробок */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: clamp(28px, 4vw, 64px); align-items: start; }
.split > .aside { position: sticky; top: 24px; display: grid; gap: 22px; }
.group { padding-top: 30px; }
.group > header h3 { margin: 0; font: 700 16px/1.3 var(--font); letter-spacing: -.005em; }
.group > header p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; max-width: 58ch; }
.rows { margin-top: 10px; }
.row { display: grid; grid-template-columns: minmax(150px, 36%) minmax(0, 1fr); gap: 6px 28px; padding: 15px 0; border-top: 1px solid var(--line); align-items: start; }
.rows > .row:first-child { border-top: 0; padding-top: 8px; }
.row .lbl b { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.35; }
.row .lbl small { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 2px; }
.row .ctl { min-width: 0; display: grid; gap: 10px; justify-items: start; }
.row .ctl > input, .row .ctl > select { max-width: 380px; }
.row .ctl > textarea, .row .ctl > .wide { max-width: 100%; }
.row.stack { grid-template-columns: 1fr; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; max-width: 380px; }
.unit { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 380px; }
.unit input { max-width: 130px; }
.unit span { color: var(--muted); font-size: 13.5px; }

/* переключатель */
.switch { position: relative; width: 42px; height: 24px; flex: none; display: inline-block; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch .slider { position: absolute; inset: 0; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 999px; transition: .18s; }
.switch .slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: var(--muted); border-radius: 50%; transition: .18s; }
.switch input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); background: var(--accent-ink); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.row.toggle { align-items: center; }

/* сегменты: выбор из 2–4 вариантов */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.color-field { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.color-field input[type=color] { width: 42px; height: 38px; padding: 3px; flex: none; cursor: pointer; }
.color-field input[type=text] { width: 120px; font-family: var(--mono); font-size: 13.5px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 5px 3px 11px; display: inline-flex; gap: 7px; align-items: center; font-size: 13.5px; max-width: 100%; }
.chip.pic { padding-left: 4px; }
.chip img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; background: var(--surface); }
.chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip small { color: var(--faint); font: 11.5px var(--mono); }
.chip button { background: none; border: 0; color: var(--muted); padding: 2px; display: inline-flex; border-radius: 50%; }
.chip button:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.chip .i { width: 14px; height: 14px; }
.chip.role::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--rc, var(--muted)); flex: none; }
.muted { color: var(--muted); }
.adder { display: flex; gap: 8px; width: 100%; max-width: 380px; }

/* темы тикетов и прочие списки-редакторы */
.items { display: grid; gap: 10px; width: 100%; }
.item { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 12px 14px; display: grid; gap: 10px; }
.item .top { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.item .top input.emoji { text-align: center; padding: 9px 4px; font-size: 18px; }
.item .tools { display: flex; gap: 2px; }
.item .sub { display: grid; gap: 8px; }

/* ── предпросмотр ── */
.aside h4 { margin: 0 0 10px; font: 700 14px/1.3 var(--font); color: var(--muted); }
.shot { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%) 0 0 / 200% 100%; aspect-ratio: 1000 / 380; position: relative; animation: k-shimmer 1.6s linear infinite; }
.shot img { width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .25s; }
.shot img.ready { opacity: 1; }
.shot.done { animation: none; background: var(--surface); }
.shot .fail { position: absolute; inset: 0; display: none; place-items: center; padding: 16px; text-align: center; color: var(--muted); font-size: 13.5px; }
.shot.err .fail { display: grid; }
.shot.err { animation: none; }

.dmsg { background: #313338; border-radius: 12px; padding: 14px 16px; display: grid; grid-template-columns: 40px 1fr; gap: 12px; color: #dbdee1; font-size: 15px; line-height: 1.4; }
.dmsg .av { width: 40px; height: 40px; border-radius: 50%; background: #1e1f22; object-fit: cover; }
.dmsg .who { font-weight: 600; color: #fff; }
.dmsg .botmark { background: #5865f2; color: #fff; font-size: 10px; font-weight: 700; border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 2px; }
.dmsg .emb { margin-top: 6px; background: #2b2d31; border-left: 4px solid var(--emb, #57f287); border-radius: 4px; padding: 10px 12px 12px; max-width: 100%; display: grid; gap: 8px; }
.dmsg .emb h5 { margin: 0; font-size: 16px; color: #fff; }
.dmsg .emb p { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.dmsg .emb img { width: 100%; border-radius: 6px; display: block; }
.dmsg .btnrow { display: flex; gap: 8px; margin-top: 8px; }
.dmsg .fakebtn { background: #5865f2; color: #fff; font-weight: 600; font-size: 14px; border-radius: 4px; padding: 6px 14px; }
.dmsg .fakesel { background: #1e1f22; color: #b5bac1; border-radius: 4px; padding: 8px 12px; font-size: 14px; width: 100%; }

.notes { display: grid; gap: 8px; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; background: var(--surface); border: 1px solid var(--line); }
.note .i { margin-top: 2px; }
.note.warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.note.warn .i { color: var(--warn); }
.note.ok .i { color: var(--ok); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--surface); padding: 12px 14px; }
.stat .n { font: 600 22px/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 4px; }

.list { display: grid; }
.li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); min-width: 0; }
.li:first-child { border-top: 0; }
.li img { width: 30px; height: 30px; border-radius: 50%; background: var(--surface); object-fit: cover; flex: none; }
.li .t { flex: 1; min-width: 0; }
.li .t b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .t small { color: var(--muted); font-size: 12.5px; }
.li .rk { width: 26px; text-align: center; color: var(--muted); font: 600 13px var(--display); flex: none; }
.li .rk.top1 { color: #ffd24a; } .li .rk.top2 { color: #cfd6e0; } .li .rk.top3 { color: #e0955a; }
.li .val { font: 600 14px var(--display); color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── обзор ── */
.pulse { display: flex; flex-wrap: wrap; gap: 6px 34px; margin: 26px 0 6px; }
.pulse div { min-width: 90px; }
.pulse .n { font: 600 clamp(22px, 2.6vw, 30px)/1.1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.pulse .l { color: var(--muted); font-size: 13px; margin-top: 3px; }
.sys-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.sys-row:first-child { border-top: 0; }
.sys-row .i { color: var(--muted); }
.sys-row .t { flex: 1; min-width: 0; }
.sys-row .t b { font-weight: 600; }
.sys-row .t small { display: block; color: var(--muted); font-size: 13px; }
.sys-row a.go { color: var(--muted); font-size: 13px; text-decoration: none; }
.sys-row a.go:hover { color: var(--accent); }
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 28px; margin-top: 10px; }
.link { display: flex; align-items: center; gap: 12px; padding: 10px 0; color: var(--text); text-decoration: none; border: 0; background: none; text-align: left; font-size: 14.5px; border-top: 1px solid var(--line); }
.link:hover { color: var(--accent); }
.link .i { color: var(--muted); }
.link:hover .i { color: var(--accent); }
.link small { display: block; color: var(--muted); font-size: 12.5px; }
.link.danger { color: var(--bad); }

/* ── логи ── */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 22px 0 14px; }
.toolbar input[type=search] { max-width: 260px; }
.logbox { background: #060606; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0; font: 12.5px/1.65 var(--mono); color: #c2c2c2; white-space: pre-wrap; word-break: break-word; max-height: 68vh; overflow: auto; }
.logbox .w { color: var(--warn); } .logbox .e { color: var(--bad); } .logbox .d { color: var(--faint); }

/* ── сохранение ── */
.savebar { position: fixed; left: calc(268px + (100vw - 268px) / 2); bottom: 22px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; z-index: 40;
  display: flex; align-items: center; gap: 14px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 16px; padding: 10px 10px 10px 18px; box-shadow: 0 18px 50px rgb(0 0 0 / .55); transition: transform .22s, opacity .22s; max-width: calc(100vw - 24px); }
.savebar.on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.savebar .msg { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.savebar .msg::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.savebar.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translate(calc(-50% - 6px), 0); } 40%, 80% { transform: translate(calc(-50% + 6px), 0); } }

.toast { position: fixed; bottom: 24px; right: 24px; z-index: 60; display: flex; gap: 10px; align-items: center; background: var(--surface-2); border: 1px solid var(--line-2); padding: 11px 16px; border-radius: 12px; transform: translateY(14px); opacity: 0; transition: .22s; pointer-events: none; font-size: 14px; box-shadow: 0 14px 40px rgb(0 0 0 / .5); }
.toast.show { opacity: 1; transform: none; }
.toast.ok .i { color: var(--ok); }
.toast.err { border-color: color-mix(in srgb, var(--bad) 55%, transparent); }
.toast.err .i { color: var(--bad); }

/* ── диалоги ── */
dialog { background: var(--surface-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 16px; padding: 0; max-width: min(92vw, 460px); width: 100%; box-shadow: 0 30px 80px rgb(0 0 0 / .6); }
dialog::backdrop { background: rgb(0 0 0 / .62); backdrop-filter: blur(3px); }
dialog .dlg { padding: 22px 22px 18px; }
dialog h3 { margin: 0 0 6px; font: 600 18px/1.3 var(--display); letter-spacing: -.01em; }
dialog p { margin: 0 0 18px; color: var(--muted); }
dialog .acts { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
dialog.palette { max-width: 560px; align-self: start; margin-top: 12vh; }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.pal-in input { border: 0; background: none; box-shadow: none !important; padding: 0; font-size: 16px; }
.pal-list { max-height: 46vh; overflow: auto; padding: 6px; }
.pal-list button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: 10px; text-align: left; font-size: 14.5px; }
.pal-list button .i { color: var(--muted); }
.pal-list button.cur { background: var(--accent-soft); }
.pal-list button small { margin-left: auto; color: var(--faint); }
.pal-empty { padding: 20px; text-align: center; color: var(--muted); }

.empty { padding: 26px 0; color: var(--muted); }
.badge { font-size: 12.5px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.badge.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font: 12.5px var(--mono); }
.ph { background: none; border: 1px solid var(--line-2); border-radius: 7px; padding: 2px 8px; font: 12px var(--mono); color: var(--muted); }
.ph:hover { color: var(--accent); border-color: var(--accent); }
.ai-prompt { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 12px 14px; display: grid; gap: 10px; width: 100%; }
.ai-prompt .head { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.ai-prompt .head input { max-width: 260px; }

/* ── узкие экраны ── */
@media (max-width: 1180px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > .aside { position: static; order: -1; max-width: 560px; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: 0 auto 0 0; width: 288px; max-width: 86vw; z-index: 50; transform: translateX(-102%); transition: transform .25s; height: 100dvh; }
  .app.nav-open .rail { transform: none; box-shadow: 30px 0 80px rgb(0 0 0 / .6); }
  .menu-btn { display: inline-flex; margin-top: 2px; }
  .main { padding: 22px 16px 150px; }
  .row { grid-template-columns: 1fr; gap: 8px; }
  .savebar { left: 50%; width: calc(100vw - 24px); justify-content: space-between; }
  .toast { left: 12px; right: 12px; bottom: 90px; }
  .pair { grid-template-columns: 1fr; }
}

/* правка панели прямо в превью */
.dmsg .edit { border-radius: 4px; outline: 1px dashed transparent; outline-offset: 3px; transition: outline-color .12s; cursor: text; min-height: 1.2em; }
.dmsg .edit:hover { outline-color: rgb(255 255 255 / .28); }
.dmsg .edit:focus { outline: 2px solid #5865f2; background: rgb(255 255 255 / .04); }
.dmsg .emb { position: relative; }
.dmsg .stripe-pick { position: absolute; left: -4px; top: 0; bottom: 0; width: 14px; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.dmsg .btnrow { align-items: center; }
.dmsg .fakebtn.edit { min-width: 40px; }
.dmsg .fakesel.edit { width: 100%; }
.swatches { display: flex; gap: 6px; margin-left: 4px; }
.sw { width: 18px; height: 18px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.sw.on { border-color: #fff; }
.sw:hover { transform: scale(1.15); }

/* вход через Discord */
.btn.discord { width: 100%; padding: 12px; background: #5865f2; color: #fff; font-size: 15px; }
.btn.discord:hover { filter: brightness(1.1); }
.login-card .fine { color: var(--muted); font-size: 13px; margin: 12px 0 18px; }
.login-card details.pw { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.login-card details.pw summary { cursor: pointer; color: var(--muted); font-size: 13.5px; margin-bottom: 10px; }
.login-card details.pw summary:hover { color: var(--text); }
.login-card .err { display: none; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; min-width: 0; }
.me img { width: 30px; height: 30px; border-radius: 50%; background: var(--surface); object-fit: cover; flex: none; }
.me b { display: block; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me small { color: var(--muted); font-size: 12.5px; }

/* ответы бота */
.resp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 18px 24px; margin-top: 14px; }
.resp { display: grid; gap: 8px; align-content: start; min-width: 0; }
.resp-head { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.resp-head b { font-weight: 600; font-size: 14px; }
.resp-head code { font-size: 11.5px; color: var(--faint); }
.resp .dmsg { padding: 10px 14px; }
.resp .rtext { white-space: pre-wrap; word-break: break-word; min-height: 1.4em; }
.resp .rtext code { background: #1e1f22; border: 0; padding: 1px 5px; border-radius: 4px; }
.mention { background: rgb(88 101 242 / .3); color: #c9cdfb; border-radius: 3px; padding: 0 3px; }
.rnote { display: flex; gap: 10px; align-items: center; color: #949ba4; font-size: 12px; margin-top: 4px; }
.rnote:empty { display: none; }
.rnote span { display: inline-flex; gap: 5px; align-items: center; }
.rnote .i { width: 13px; height: 13px; }
.rnote .chg { color: #ffc247; }
.resp-foot { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.ph-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; }

/* первый вход без бота */
.onboard { display: none; min-height: 100vh; place-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center; }
.onboard.on { display: grid; }
.onboard h1 { font: 600 clamp(24px, 4vw, 32px)/1.15 var(--display); letter-spacing: -.025em; margin: 18px 0 0; }
.onboard p { color: var(--muted); max-width: 42ch; margin: 0 0 12px; }
.onboard .btn { width: min(340px, 100%); padding: 12px; }
.orbit { width: 168px; height: 168px; border-radius: 50%; padding: 6px; background: conic-gradient(from 0deg, var(--accent), transparent 35%, var(--accent)); animation: k-spin 6s linear infinite; }
.orbit img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; border: 5px solid var(--bg); background: var(--surface); animation: k-spin 6s linear infinite reverse; }
.ob-foot { display: flex; gap: 16px; margin-top: 10px; }
.ob-foot .icon-btn { gap: 8px; font-size: 13.5px; }
