:root {
  --bg: #08080c;
  --bg-soft: #0d0d13;
  --surface: #121219;
  --surface-2: #16161f;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);
  --text: #ededf2;
  --muted: #8d8d9c;
  --faint: #5a5a6b;
  --accent: #b84df2;
  --accent-soft: rgba(184, 77, 242, 0.14);
  --accent-line: rgba(184, 77, 242, 0.4);
  --accent-hi: #cf86f8;
  --ok: #38d19b;
  --ext: #5eb0ff;
  --off: #52525f;
  --warn: #f5b544;
  --err: #f0616d;
  --radius: 13px;
  --radius-sm: 9px;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; letter-spacing: -0.01em; }

.top-accent { position: fixed; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--accent) 35%, var(--accent-hi) 50%, var(--accent) 65%, transparent); z-index: 100; opacity: 0.8; }

a { color: inherit; text-decoration: none; }
input, button, select, textarea { font-family: inherit; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--bg-soft); padding: 2px 6px; border-radius: 5px; color: var(--accent-hi); }
.mono { font-family: var(--mono); }
.small { font-size: 12px; }
.sub { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.break { word-break: break-all; }
.hint { font-size: 12px; color: var(--faint); }
.req { color: var(--accent-hi); font-style: normal; }

/* ── layout ─────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex-shrink: 0; background: var(--bg-soft); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 22px 14px; position: sticky; top: 0; height: 100vh; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 22px; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(145deg, var(--accent), #8e2fc4); display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff; box-shadow: 0 4px 14px rgba(184, 77, 242, 0.35); letter-spacing: -0.02em; flex-shrink: 0; }
.brand-mark.xl { width: 60px; height: 60px; border-radius: 16px; font-size: 24px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 650; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.1em; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--faint); padding: 18px 12px 7px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; font-size: 13.5px; transition: all 0.15s ease; position: relative; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-hi); }
.nav-item.active::before { content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%); width: 3px; height: 18px; background: var(--accent); border-radius: 0 3px 3px 0; }
.nav-ico { width: 18px; text-align: center; opacity: 0.8; font-size: 13px; }
.nav-badge { width: 20px; height: 20px; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; font-size: 11px; font-weight: 600; border: 1px solid var(--line); flex-shrink: 0; }
.nav-badge.inline { display: inline-grid; vertical-align: -5px; margin-right: 4px; }
.nav-item.active .nav-badge { background: var(--accent); color: #fff; border-color: transparent; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--off); margin-left: auto; transition: all 0.2s; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.ext { background: var(--ext); }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }

.content { flex: 1; padding: 34px 40px 80px; max-width: 1180px; width: 100%; min-width: 0; }

/* ── page head ──────────────────────────────────────────────────── */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 26px; gap: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 25px; font-weight: 680; letter-spacing: -0.025em; display: flex; align-items: center; gap: 11px; }
.crumb { font-size: 12px; color: var(--faint); margin-bottom: 7px; }
.crumb a:hover { color: var(--accent-hi); }
.head-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* ── cards ──────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.bot-card { transition: border-color 0.18s, transform 0.18s; display: flex; flex-direction: column; }
.bot-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.bot-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.bot-badge { width: 42px; height: 42px; border-radius: 11px; background: linear-gradient(145deg, var(--surface-2), var(--bg-soft)); border: 1px solid var(--line-strong); display: grid; place-items: center; font-weight: 700; font-size: 17px; color: var(--accent-hi); flex-shrink: 0; }
.bot-badge.sm { width: 30px; height: 30px; font-size: 13px; border-radius: 8px; }
.bot-card h3 { font-size: 16px; font-weight: 640; letter-spacing: -0.02em; }
.bot-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; margin-bottom: 10px; }
.meta { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 12px; min-height: 18px; }
.meta b { color: var(--text); font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tag { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: var(--bg-soft); color: var(--muted); border: 1px solid var(--line); }
.tag.mono { font-family: var(--mono); font-size: 10.5px; }
.tag.warn { color: var(--warn); border-color: rgba(245, 181, 68, 0.25); background: rgba(245, 181, 68, 0.08); }
.tag.ok { color: var(--ok); border-color: rgba(56, 209, 155, 0.25); background: rgba(56, 209, 155, 0.08); }
.bot-actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }

/* ── pills ──────────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 550; padding: 4px 10px; border-radius: 20px; border: 1px solid var(--line); white-space: nowrap; }
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.on { color: var(--ok); background: rgba(56, 209, 155, 0.08); border-color: rgba(56, 209, 155, 0.22); }
.pill.ext { color: var(--ext); background: rgba(94, 176, 255, 0.08); border-color: rgba(94, 176, 255, 0.22); }
.pill.off { color: var(--faint); }

/* ── buttons ────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 550; border: 1px solid transparent; cursor: pointer; transition: all 0.15s ease; background: var(--surface-2); color: var(--text); white-space: nowrap; }
.btn:hover { background: var(--surface); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 2px 12px rgba(184, 77, 242, 0.28); }
.btn.primary:hover { background: var(--accent-hi); box-shadow: 0 4px 18px rgba(184, 77, 242, 0.4); }
.btn.outline { background: transparent; border-color: var(--line-strong); color: var(--muted); }
.btn.outline:hover { border-color: var(--accent-line); color: var(--accent-hi); background: var(--accent-soft); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--line-strong); }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn.block { width: 100%; }
.btn[data-attn="1"] { border-color: var(--warn); color: var(--warn); }
.icon-btn { background: transparent; border: none; color: var(--faint); cursor: pointer; font-size: 13px; padding: 4px 6px; border-radius: 6px; transition: all 0.15s; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }

/* ── forms ──────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 4px; flex-wrap: wrap; }
.form-head h3 { font-size: 15px; font-weight: 620; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field.span2 { grid-column: 1 / -1; }
.field > span { font-size: 12px; font-weight: 500; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.field input, .field select, .field textarea { background: var(--bg-soft); border: 1px solid var(--line-strong); color: var(--text); padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13.5px; width: 100%; transition: border-color 0.15s, box-shadow 0.15s; }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.field textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.field-hint { font-size: 11.5px; color: var(--faint); margin-top: -2px; }
.chip { font-size: 11px; font-family: var(--mono); padding: 4px 9px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-hi); border: 1px solid var(--accent-line); }
.chip-alt { background: var(--bg-soft); color: var(--muted); border-color: var(--line); }
.form-foot { display: flex; align-items: center; gap: 14px; padding-top: 6px; flex-wrap: wrap; }

/* secret */
.secret-wrap { display: flex; align-items: center; gap: 2px; background: var(--bg-soft); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding-right: 4px; }
.secret-wrap:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.secret-wrap input { border: none !important; box-shadow: none !important; background: transparent !important; font-family: var(--mono); letter-spacing: 0.04em; }
.secret-wrap input[data-set="1"]::placeholder { color: var(--ok); opacity: 0.8; }

/* color */
.color-wrap { display: flex; align-items: center; background: var(--bg-soft); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 0 6px 0 8px; }
.color-wrap:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.swatch { width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--line-strong); flex-shrink: 0; }
.color-wrap .hash { color: var(--faint); margin-left: 9px; }
.color-wrap input[data-color] { background: transparent !important; border: none !important; box-shadow: none !important; padding: 10px 6px; letter-spacing: 0.05em; text-transform: uppercase; }
.color-wrap input[type="color"] { width: 30px; height: 30px; padding: 0; border: none; background: none; cursor: pointer; margin-left: auto; border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.color-wrap input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-wrap input[type="color"]::-webkit-color-swatch { border: 1px solid var(--line-strong); border-radius: 6px; }

/* toggle */
.toggle-wrap { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; }
.toggle-wrap input.toggle { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-ui { width: 40px; height: 22px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--line-strong); position: relative; transition: all 0.18s; flex-shrink: 0; }
.toggle-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: all 0.18s; }
.toggle-wrap input.toggle:checked + .toggle-ui { background: var(--accent); border-color: transparent; }
.toggle-wrap input.toggle:checked + .toggle-ui::after { left: 21px; background: #fff; }
.toggle-text { font-size: 13px; color: var(--muted); }

/* emoji grid */
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 16px; }
.emoji-field > span { font-size: 11.5px; }
.emoji-wrap { display: flex; align-items: center; gap: 8px; }
.emoji-preview { width: 26px; height: 26px; border-radius: 6px; background: var(--bg-soft); border: 1px solid var(--line); flex-shrink: 0; display: grid; place-items: center; overflow: hidden; }
.emoji-preview img { width: 20px; height: 20px; }
.emoji-wrap input { padding: 7px 10px; font-size: 12px; }

/* section nav + save bar */
.section-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.section-link { font-size: 12px; padding: 5px 11px; border-radius: 20px; border: 1px solid var(--line); color: var(--muted); transition: all 0.15s; }
.section-link:hover { color: var(--accent-hi); border-color: var(--accent-line); }
.section { margin-bottom: 16px; scroll-margin-top: 20px; }
.save-bar { position: sticky; bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 14px; background: rgba(18, 18, 25, 0.92); backdrop-filter: blur(10px); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 12px 16px; margin-top: 6px; box-shadow: 0 12px 40px rgba(0,0,0,0.45); flex-wrap: wrap; }
.save-actions { display: flex; gap: 9px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.tab { background: none; border: none; color: var(--muted); padding: 10px 16px; font-size: 13.5px; font-weight: 550; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.15s; display: inline-flex; align-items: center; gap: 7px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-hi); border-bottom-color: var(--accent); }
.tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--off); }
.tab-dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* logs */
.log-card { padding: 0; overflow: hidden; }
.log-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.log-head h3 { font-size: 14px; font-weight: 620; }
.log-tools { display: flex; align-items: center; gap: 12px; }
.log { font-family: var(--mono); font-size: 12px; line-height: 1.6; background: #07070a; padding: 14px 16px; height: 62vh; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; color: #cfcfd8; }
.log .ln { display: block; }
.log .ts { color: var(--faint); margin-right: 10px; }
.log .err { color: #ff8a93; }
.log .sys { color: var(--accent-hi); }
.log .empty { color: var(--faint); font-style: italic; }

/* tools */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.tool h3 { font-size: 14.5px; font-weight: 620; margin-bottom: 6px; }
.tool .sub { margin-bottom: 14px; }
.tool .tag { margin-left: 8px; }

/* raw editor */
.raw-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.raw-tab { font-size: 12px; font-family: var(--mono); padding: 5px 11px; border-radius: 7px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.raw-tab.active { border-color: var(--accent-line); color: var(--accent-hi); background: var(--accent-soft); }
textarea.raw { width: 100%; background: #07070a; border: 1px solid var(--line-strong); color: #cfcfd8; border-radius: var(--radius-sm); padding: 12px 14px; font-size: 12.5px; line-height: 1.55; resize: vertical; }
textarea.raw:focus { outline: none; border-color: var(--accent-line); }

/* brand page */
.brand-layout { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
.apply-box { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 4px; }
.apply-label { font-size: 12px; color: var(--muted); font-weight: 500; display: block; margin-bottom: 11px; }
.apply-bots { display: flex; flex-wrap: wrap; gap: 9px; }
.check { display: flex; align-items: center; gap: 8px; padding: 7px 13px 7px 9px; border: 1px solid var(--line-strong); border-radius: 20px; font-size: 12.5px; cursor: pointer; transition: all 0.15s; color: var(--muted); user-select: none; }
.check.small { padding: 4px 10px 4px 8px; font-size: 12px; }
.check:hover { color: var(--text); }
.check:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-hi); }
.check input { display: none; }
.check-badge { width: 19px; height: 19px; border-radius: 5px; background: var(--surface-2); display: grid; place-items: center; font-size: 10px; font-weight: 600; border: 1px solid var(--line); }
.check:has(input:checked) .check-badge { background: var(--accent); color: #fff; border-color: transparent; }
.preview { position: sticky; top: 34px; }
.embed-preview { display: flex; background: #1b1b22; border-radius: 8px; overflow: hidden; margin-top: 6px; }
.embed-bar { width: 4px; background: var(--accent); flex-shrink: 0; transition: background 0.2s; }
.embed-body { padding: 13px 15px; flex: 1; min-width: 0; }
.embed-author { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.embed-ava { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 9px; font-weight: 700; }
.embed-title { font-size: 14px; font-weight: 650; color: #fff; margin-bottom: 6px; }
.embed-desc { font-size: 12px; color: #b5b5c2; line-height: 1.5; }
.embed-foot { font-size: 10.5px; color: #72727f; margin-top: 11px; padding-top: 9px; border-top: 1px solid rgba(255,255,255,0.06); }

/* settings */
.settings-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }

/* empty / alerts */
.empty { text-align: center; padding: 40px 20px; }
.empty-ico { width: 46px; height: 46px; border-radius: 12px; background: rgba(245, 181, 68, 0.12); color: var(--warn); display: grid; place-items: center; font-size: 22px; font-weight: 700; margin: 0 auto 14px; border: 1px solid rgba(245, 181, 68, 0.25); }
.empty h3 { font-size: 16px; margin-bottom: 6px; }
.empty .mono { margin: 8px 0; color: var(--muted); word-break: break-all; }
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.alert.err { background: rgba(240, 97, 109, 0.1); color: var(--err); border: 1px solid rgba(240, 97, 109, 0.25); }

/* login / setup */
.login-screen { min-height: 100vh; display: grid; place-items: center; position: relative; overflow: hidden; padding: 20px; }
.login-glow { position: absolute; width: 500px; height: 500px; background: radial-gradient(circle, rgba(184,77,242,0.16), transparent 68%); top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; z-index: 0; }
.login-card { width: 360px; max-width: 100%; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px; padding: 38px 34px; position: relative; z-index: 1; box-shadow: 0 24px 70px rgba(0,0,0,0.5); }
.login-card.wide { width: 440px; }
.login-top { text-align: center; margin-bottom: 28px; }
.login-top .brand-mark { margin: 0 auto 16px; }
.login-top h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; }
.login-top p { color: var(--muted); font-size: 13px; margin-top: 5px; line-height: 1.5; }
.login-card form { display: flex; flex-direction: column; gap: 16px; }
.setup-note { display: flex; align-items: center; gap: 10px; }

/* toast */
.toast { position: fixed; bottom: 26px; right: 26px; padding: 13px 18px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line-strong); font-size: 13.5px; font-weight: 500; opacity: 0; transform: translateY(14px); transition: all 0.25s ease; pointer-events: none; z-index: 200; box-shadow: 0 12px 40px rgba(0,0,0,0.45); max-width: 380px; }
.toast.show { opacity: 1; transform: none; }
.toast.ok { border-left: 3px solid var(--ok); }
.toast.err { border-left: 3px solid var(--err); }
.toast.warn { border-left: 3px solid var(--warn); }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }

/* responsive */
@media (max-width: 980px) {
  .brand-layout, .settings-grid { grid-template-columns: 1fr; }
  .preview { position: static; }
}
@media (max-width: 760px) {
  .sidebar { width: 68px; padding: 18px 10px; }
  .brand-text, .nav-item span:not(.nav-ico):not(.nav-badge):not(.dot), .nav-label { display: none; }
  .nav-item { justify-content: center; }
  .content { padding: 24px 16px 80px; }
  .form-row, .fields { grid-template-columns: 1fr; }
}

/* ── products ───────────────────────────────────────────────────── */
.notice { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px; }
.product-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.product { padding: 16px 20px; }
.product-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.product-title { display: flex; align-items: flex-end; gap: 10px; flex: 1; min-width: 0; }
.product-title .p-emoji-field { width: 64px; flex: none; }
.product-title .p-emoji { text-align: center; font-size: 18px; padding: 7px 6px; }
.product-title .p-name-field { flex: 1; }
.product-title .p-name { font-size: 15px; font-weight: 600; }
.product-title .p-id { margin-bottom: 9px; flex: none; }
.product-tools { margin-bottom: 4px; }
.product.collapsed .product-head { align-items: center; }
.product.collapsed .product-title .p-name-field > span, .product.collapsed .product-title .p-emoji-field > span { display: none; }
.product.collapsed .product-title .p-id, .product.collapsed .product-tools { margin-bottom: 0; }
.product.invalid { border-color: rgba(240, 97, 109, 0.55); }
.product.invalid .p-name { border-color: var(--err); box-shadow: 0 0 0 3px rgba(240, 97, 109, 0.18); }
.product .p-name-field .missing { display: none; color: var(--err); font-weight: 500; }
.product.invalid .p-name-field .missing { display: inline; }
.product.invalid .p-name-field .req { display: none; }
.product-tools { display: flex; gap: 2px; }
.product-body { margin-top: 14px; display: flex; flex-direction: column; gap: 16px; }
.product.collapsed .product-body { display: none; }
.tiers { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--bg-soft); }
.tiers-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 8px; }
.tier-rows { display: flex; flex-direction: column; gap: 6px; }
.tier-row { display: grid; grid-template-columns: 1fr 170px 32px; gap: 8px; align-items: center; }
.tier-row input { background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); padding: 7px 10px; border-radius: 7px; font-size: 13px; width: 100%; }
.tier-row input:focus { outline: none; border-color: var(--accent-line); }
.price-wrap { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 7px; padding-left: 10px; }
.price-wrap .hash { color: var(--faint); font-size: 12px; }
.price-wrap input { border: none !important; background: transparent !important; font-family: var(--mono); }

/* ── assistant ──────────────────────────────────────────────────── */
.tab-count { font-size: 10.5px; background: var(--accent-soft); color: var(--accent-hi); border-radius: 10px; padding: 1px 7px; }
.tab-count:empty { display: none; }
.kb-auto { display: flex; flex-direction: column; gap: 6px; }
.kb-auto-row { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 7px 10px; background: var(--bg-soft); border-radius: 7px; border: 1px solid var(--line); }
.kb-auto-row b { font-weight: 550; flex: 1; }
.kb-list { display: flex; flex-direction: column; gap: 12px; margin: 10px 0; }
.kb-entry { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; background: var(--bg-soft); display: flex; flex-direction: column; gap: 8px; }
.kb-row { display: grid; grid-template-columns: 130px 1fr 32px; gap: 8px; align-items: center; }
.kb-row select, .kb-row input, .kb-entry textarea { background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); padding: 8px 10px; border-radius: 7px; font-size: 13px; width: 100%; }
.kb-row select { appearance: none; }
.kb-entry textarea { resize: vertical; line-height: 1.5; }
.kb-row input:focus, .kb-entry textarea:focus, .kb-row select:focus { outline: none; border-color: var(--accent-line); }
.test-row { display: grid; grid-template-columns: 1fr 170px auto; gap: 10px; }
.test-row input, .test-row select { background: var(--bg-soft); border: 1px solid var(--line-strong); color: var(--text); padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13.5px; }
.test-row select { appearance: none; }
.test-out { margin-top: 14px; background: #1b1b22; border-radius: 8px; padding: 14px 16px; font-size: 13.5px; line-height: 1.6; min-height: 60px; border-left: 3px solid var(--accent); }
.test-out .err { color: var(--err); }
.test-answer { margin-bottom: 10px; white-space: pre-wrap; }
@media (max-width: 760px) { .test-row, .kb-row, .tier-row { grid-template-columns: 1fr; } }

/* ── usage ──────────────────────────────────────────────────────── */
.usage-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.stat { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stat-v { font-size: 18px; font-weight: 650; letter-spacing: -0.02em; font-family: var(--mono); }
.stat-l { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }
.stat.accent { border-color: var(--accent-line); background: var(--accent-soft); }
.stat.accent .stat-v { color: var(--accent-hi); }
.budget { display: flex; flex-direction: column; gap: 6px; }
.budget-bar { height: 6px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.budget-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-hi)); transition: width 0.3s; }
@media (max-width: 900px) { .usage-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── banners ────────────────────────────────────────────────────── */
.banner-group { margin-bottom: 26px; }
.banner-group-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 12px; }
.banner-group-head h3 { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.banner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 16px; }
.banner-slot { padding: 16px 18px 14px; display: flex; flex-direction: column; gap: 12px; position: relative; transition: border-color 0.15s, box-shadow 0.15s; }
.banner-slot.drag { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.banner-slot.busy { opacity: 0.6; pointer-events: none; }
.banner-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.banner-title { font-size: 14.5px; font-weight: 620; display: flex; align-items: center; gap: 8px; }
.banner-used { font-size: 12px; color: var(--faint); margin-top: 3px; }
.banner-preview { position: relative; aspect-ratio: 4 / 1; border-radius: 9px; overflow: hidden; background: var(--bg-soft); border: 1px dashed var(--line-strong); cursor: pointer; display: grid; place-items: center; }
.banner-slot.has-file .banner-preview { aspect-ratio: auto; border-style: solid; border-color: var(--line); background: #000; }
.banner-preview img { width: 100%; height: auto; max-height: 340px; object-fit: contain; display: block; }
.banner-placeholder { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--faint); font-size: 12px; }
.banner-plus { font-size: 22px; line-height: 1; color: var(--muted); }
.banner-drop-hint { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(184, 77, 242, 0.22); color: #fff; font-weight: 600; font-size: 13px; opacity: 0; transition: opacity 0.15s; pointer-events: none; backdrop-filter: blur(2px); }
.banner-slot.drag .banner-drop-hint { opacity: 1; }
.banner-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.banner-meta { font-size: 11.5px; color: var(--faint); }
.banner-actions { display: flex; gap: 6px; }
@media (max-width: 900px) { .banner-grid { grid-template-columns: 1fr; } }

/* ── documentation import ───────────────────────────────────────── */
.docs-import { display: flex; gap: 8px; margin-top: 4px; }
.docs-import input { flex: 1; background: var(--bg-soft); border: 1px solid var(--line-strong); color: var(--text); padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13.5px; font-family: var(--mono); }
.docs-import input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.docs-hint { margin-top: 10px; line-height: 1.5; }
.docs-sources { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.docs-source { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
.docs-source-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.docs-source-main .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-source-actions { display: flex; gap: 6px; }
.warn-text { color: var(--warn); }
.docs-pages { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.docs-group { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.docs-group summary { cursor: pointer; padding: 9px 14px; display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; list-style: none; }
.docs-group summary::-webkit-details-marker { display: none; }
.docs-group summary > span:first-of-type { flex: 1; }
.docs-group summary::before { content: '▸'; color: var(--faint); margin-right: 8px; }
.docs-group[open] summary::before { content: '▾'; }
.docs-page { display: grid; grid-template-columns: auto auto 1fr auto auto; gap: 10px; align-items: center; padding: 6px 14px 6px 16px; border-top: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.docs-page.off .docs-page-title { color: var(--faint); text-decoration: line-through; }
.docs-page input { accent-color: var(--accent); }
.docs-page-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-page a { text-decoration: none; }
@media (max-width: 900px) { .docs-source { grid-template-columns: 1fr; } }

.docs-picker { margin-top: 14px; border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: var(--radius-sm); padding: 12px 14px; }
.docs-picker-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.docs-picker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; }
.docs-picker-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 7px; font-size: 13px; cursor: pointer; }
.docs-picker-row:hover { background: rgba(255, 255, 255, 0.04); }
.docs-picker-row input { accent-color: var(--accent); }
.docs-picker-foot { display: flex; gap: 6px; align-items: center; margin-top: 12px; }
.docs-picker-foot .spacer { flex: 1; }
.docs-group-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.docs-group-toggle input { accent-color: var(--accent); }

.docs-picker-opts { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: end; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--accent-line); }
.docs-rename { display: flex; align-items: center; gap: 8px; }
.docs-rename input { width: 160px; }
.docs-share { font-size: 13px; display: flex; align-items: center; gap: 8px; cursor: pointer; padding-bottom: 10px; }
.docs-share input { accent-color: var(--accent); }
.docs-map { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--bg-soft); }
.docs-map-head { display: flex; align-items: baseline; gap: 10px; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.docs-map-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px 5px 8px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font-size: 12.5px; cursor: pointer; transition: all 0.15s; }
.chip-check:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-hi); }
.chip-check input { accent-color: var(--accent); margin: 0; }
.chip-check em { font-style: normal; font-size: 11px; color: var(--faint); font-family: var(--mono); }
@media (max-width: 900px) { .docs-picker-opts { grid-template-columns: 1fr; } }

/* ── panels (info embeds) ───────────────────────────────────────── */
.content-wide { max-width: 1480px; }
.panels-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr) 420px; gap: 18px; align-items: start; }
.panels-nav { padding: 10px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 24px; }
.panel-nav-item { display: flex; flex-direction: column; gap: 2px; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 9px; padding: 9px 11px; cursor: pointer; color: var(--text); transition: all 0.15s; }
.panel-nav-item:hover { background: var(--surface-2); }
.panel-nav-item.active { background: var(--accent-soft); border-color: var(--accent-line); }
.panel-nav-item.off .panel-nav-name { color: var(--faint); text-decoration: line-through; }
.panel-nav-name { font-size: 13.5px; font-weight: 600; }
.panel-nav-meta { font-size: 11px; color: var(--faint); display: flex; align-items: center; gap: 5px; }
.dot-on { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); display: inline-block; }
.panels-editor .form-head h4 { font-size: 13px; font-weight: 600; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.buttons-box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--bg-soft); display: flex; flex-direction: column; gap: 10px; }
.btn-rows { display: flex; flex-direction: column; gap: 8px; }
.btn-row { display: grid; grid-template-columns: 1.2fr 0.8fr 0.8fr 1.4fr 32px; gap: 6px; align-items: center; }
.btn-row input, .btn-row select { background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); padding: 7px 9px; border-radius: 7px; font-size: 12.5px; width: 100%; min-width: 0; }
.btn-row input:focus, .btn-row select:focus { outline: none; border-color: var(--accent-line); }
.btn-row .b-url, .btn-row .b-role, .btn-row .b-ticket, .btn-row .b-reply { display: none; }
.btn-row[data-action="link"] .b-url { display: block; }
.btn-row[data-action="link"] .b-style { visibility: hidden; }
.btn-row[data-action="role"] .b-role { display: block; }
.btn-row[data-action="ticket"] .b-ticket { display: block; }
.btn-row[data-action="reply"] .b-reply { display: block; }
.btn-row .b-emoji { grid-column: 1 / 3; }
.btn-row[data-action="role"] .b-reply { display: block; grid-column: 3 / 5; }
.emoji-help { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.emoji-key { display: inline-flex; align-items: center; gap: 5px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; cursor: pointer; color: var(--muted); font-size: 11px; font-family: var(--mono); }
.emoji-key:hover { border-color: var(--accent-line); color: var(--text); }
.emoji-key img { width: 16px; height: 16px; object-fit: contain; }
.panels-preview { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 24px; }
.dc-message { display: flex; gap: 14px; background: #313338; border-radius: 10px; padding: 14px 16px; font-family: "gg sans", "Noto Sans", Inter, system-ui, sans-serif; color: #dbdee1; }
.dc-avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex-shrink: 0; }
.dc-body { min-width: 0; flex: 1; }
.dc-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.dc-user { font-weight: 600; color: #f2f3f5; font-size: 15px; }
.dc-bot { background: #5865f2; color: #fff; font-size: 10px; font-weight: 600; border-radius: 4px; padding: 1px 5px; }
.dc-time { color: #949ba4; font-size: 12px; }
.dc-embed { display: flex; background: #2b2d31; border-radius: 6px; overflow: hidden; max-width: 520px; position: relative; }
.dc-bar { width: 4px; flex-shrink: 0; }
.dc-inner { padding: 10px 16px 12px 12px; min-width: 0; flex: 1; }
.dc-author { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #f2f3f5; margin-bottom: 6px; }
.dc-author img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.dc-title { font-size: 15px; font-weight: 600; color: #00a8fc; margin-bottom: 6px; }
.dc-desc { font-size: 13.5px; line-height: 1.4; white-space: normal; word-break: break-word; }
.dc-desc b { color: #f2f3f5; }
.dc-desc code { background: #1e1f22; color: #dbdee1; padding: 1px 4px; border-radius: 3px; font-size: 12px; }
.dc-desc pre { background: #1e1f22; padding: 8px; border-radius: 4px; font-size: 12px; white-space: pre-wrap; }
.dc-desc a { color: #00a8fc; text-decoration: none; }
.dc-desc .dc-h1 { font-size: 20px; font-weight: 700; color: #f2f3f5; }
.dc-desc .dc-h2 { font-size: 17px; font-weight: 700; color: #f2f3f5; }
.dc-desc .dc-h3 { font-size: 15px; font-weight: 700; color: #f2f3f5; }
.dc-desc .dc-quote { border-left: 4px solid #4e5058; padding-left: 8px; display: inline-block; }
.dc-emoji { width: 20px; height: 20px; vertical-align: -4px; object-fit: contain; }
.dc-image { display: block; width: 100%; max-width: 480px; border-radius: 4px; margin-top: 12px; }
.dc-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 4px; margin: 14px 14px 0 0; flex-shrink: 0; }
.dc-footer { font-size: 12px; color: #949ba4; margin-top: 8px; }
.dc-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; max-width: 520px; }
.dc-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 3px; font-size: 13.5px; font-weight: 500; color: #fff; }
.dc-btn.primary { background: #5865f2; }
.dc-btn.secondary, .dc-btn.link { background: #4e5058; }
.dc-btn.success { background: #248046; }
.dc-btn.danger { background: #da373c; }
.dc-btn-emoji { display: inline-flex; }
.dc-btn-emoji .dc-emoji { width: 18px; height: 18px; vertical-align: middle; }
.dc-ext { font-size: 12px; opacity: 0.8; margin-left: 2px; }
.post-row { display: flex; gap: 8px; align-items: center; }
.post-row select { flex: 1; min-width: 0; background: var(--bg-soft); border: 1px solid var(--line-strong); color: var(--text); padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; }
@media (max-width: 1300px) { .panels-layout { grid-template-columns: 200px minmax(0, 1fr); } .panels-preview { grid-column: 1 / -1; position: static; } }
@media (max-width: 900px) { .panels-layout { grid-template-columns: 1fr; } .panels-nav { position: static; } .btn-row { grid-template-columns: 1fr 1fr; } .btn-row .b-emoji, .btn-row[data-action="role"] .b-reply { grid-column: auto; } }

.btn-row .b-extra { display: none; grid-column: 1 / -1; grid-template-columns: 1fr 1fr 1fr; gap: 10px; padding: 10px 12px 12px; border: 1px dashed var(--line-strong); border-radius: 8px; background: var(--surface); }
.btn-row[data-action="ticket"] .b-extra { display: grid; }
.btn-row .b-extra .field input, .btn-row .b-extra .field textarea { background: var(--bg-soft); padding: 8px 10px; font-size: 12.5px; }
.btn-row .b-extra .field textarea { min-height: 64px; }
@media (max-width: 1100px) { .btn-row .b-extra { grid-template-columns: 1fr; } }
