/* dev.littlespace.chat. Colors follow the littlespace.chat theme. */

/* Anything marked hidden stays hidden, whatever layout it otherwise uses. */
[hidden] { display: none !important; }
:root {
  --sky: #06061a;
  --sky-2: #0c0b28;
  --panel: #1c1b22;
  --panel-2: #24232c;
  --input: #2a2932;
  --line: #302f3a;
  --text: #ecebf3;
  --muted: #a6a3b8;
  --faint: #7a778d;
  --blue: #0008e1;
  --blue-hi: #2b33ff;
  --cyan: #5ec8f2;
  --pink: #f5a3d3;
  --lavender: #b39cf7;
  --code-bg: #121130;
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'Radio Canada Big', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 400 17px/1.6 var(--font);
  color: var(--text);
  background-color: var(--sky);
}

/* The same sparse starfield as the sign-in page. It sits on its own fixed layer
   so scrolling just moves the page over it instead of repainting it every frame. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  will-change: transform;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #8f8cb8 50%, transparent 51%),
    radial-gradient(1px 1px at 37% 9%, #6d6a96 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 68% 22%, #9c99c4 50%, transparent 51%),
    radial-gradient(1px 1px at 84% 41%, #6d6a96 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 63%, #7d7aa6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 55% 74%, #8f8cb8 50%, transparent 51%),
    radial-gradient(1px 1px at 91% 83%, #6d6a96 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 91%, #7d7aa6 50%, transparent 51%),
    radial-gradient(ellipse 80% 60% at 50% 0%, var(--sky-2), transparent 70%);
  background-size: 720px 720px, 720px 720px, 720px 720px, 720px 720px, 720px 720px, 720px 720px, 720px 720px, 720px 720px, 100% 100%;
}

a { color: var(--cyan); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; }
code, pre { font-family: var(--mono); font-variant-ligatures: none; }
code { font-size: 0.86em; }
:not(pre) > code { background: var(--panel-2); border: 1px solid var(--line); padding: 0.1em 0.35em; border-radius: 5px; color: #dcd6fa; }
h1, h2, h3, h4 { line-height: 1.2; font-weight: 600; margin: 0; }
p { margin: 0 0 1em; }
.small { font-size: 0.88rem; color: var(--muted); }
.muted { color: var(--muted); }

.skip { position: absolute; left: -999px; top: 8px; background: var(--blue); color: #fff; padding: 8px 12px; border-radius: var(--radius); z-index: 50; }
.skip:focus { left: 8px; }

/* Buttons match the instance's sign-in button: deep theme blue, 8px corners. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 500 16px/1 var(--font); color: #fff; text-decoration: none;
  background: var(--blue); border: 1px solid transparent; border-radius: var(--radius);
  padding: 12px 20px; cursor: pointer;
}
.btn:hover { background: var(--blue-hi); text-decoration: none; }
.btn-small { padding: 8px 14px; font-size: 15px; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--panel-2); }

.copy {
  font: 500 13px/1 var(--font); color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; cursor: pointer;
}
.copy:hover { color: var(--text); border-color: var(--faint); }
.copy[data-done] { color: var(--pink); border-color: var(--pink); }

/* Header */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(6, 6, 26, 0.94);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 17px; }
.brand img { border-radius: 8px; background: #141038; }
.brand-sub { color: var(--lavender); font-weight: 500; }
.top-nav { display: flex; gap: 4px; }
.top-nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: var(--radius); font-weight: 500; font-size: 15px; }
.top-nav a:hover { color: var(--text); background: var(--panel); }
.top-nav a[aria-current] { color: var(--text); background: var(--panel-2); }
.top-user { margin-left: auto; }
.me { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 500; font-size: 15px; }
.me img, .me-fallback { width: 28px; height: 28px; border-radius: 50%; }
.me-fallback { display: inline-grid; place-items: center; background: var(--lavender); color: #1b1240; font-weight: 700; font-size: 14px; }
.me-fallback-lg { width: 64px; height: 64px; font-size: 28px; }

/* Home */
.home { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 48px; padding: 72px 0 56px; }
.hero h1 { font-size: clamp(40px, 6vw, 64px); font-weight: 700; letter-spacing: -0.015em; max-width: 14ch; }
.lede { font-size: 19px; color: var(--muted); max-width: 58ch; margin-top: 20px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 28px; }
.install { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 6px 6px 14px; }
.install { max-width: 100%; }
.install code { font-size: 14px; color: #dcd6fa; white-space: nowrap; overflow-x: auto; min-width: 0; }

.demo { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: center; position: relative; }
.demo-code { margin: 0; position: relative; z-index: 1; }
.demo-code pre { font-size: 13.5px; }
.chat {
  background: #18171d; border: 1px solid var(--line); border-radius: var(--radius-lg);
  margin-left: -28px; position: relative; z-index: 2;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  font-size: 15px; overflow: hidden;
}
.chat-bar { padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; color: var(--text); }
.chat-bar .hash { color: var(--faint); margin-right: 4px; }
.msg { display: flex; gap: 12px; padding: 12px 16px 6px; }
.msg p { margin: 0; }
.who { font-weight: 600; color: var(--text); }
.who time { font-weight: 400; font-size: 12px; color: var(--faint); margin-left: 6px; }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; margin-top: 2px; }
.a-user { background: #5848d8; }
.a-bot { background: #1fb5a3; }
.msg-bot { padding-top: 6px; }
.msg-bot .avatar { margin-top: 24px; }
.replying { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 2px !important; }
.avatar-xs { width: 14px; height: 14px; border-radius: 50%; background: #5848d8; }
.tag { font-size: 10px; font-weight: 700; background: var(--blue); color: #fff; padding: 1px 4px; border-radius: 3px; vertical-align: 2px; }
/* The one accent: the bot's reply. */
.msg-bot div > p:last-child { color: var(--pink); font-weight: 600; font-size: 17px; }
.chat-input { margin: 14px 16px 16px; background: var(--input); color: var(--faint); border-radius: var(--radius); padding: 11px 14px; }

.next { padding: 40px 0; border-top: 1px solid var(--line); }
.next h2, .today h2 { font-size: 26px; margin-bottom: 24px; }
.next-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 48px; }
.next-list li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.next-list a { font-weight: 600; font-size: 19px; text-decoration: none; }
.next-list a:hover { text-decoration: underline; }
.next-list p { margin: 4px 0 0; color: var(--muted); }
.next-main { grid-row: span 2; border-bottom: 0 !important; background: var(--panel); border: 1px solid var(--line) !important; border-radius: var(--radius-lg); padding: 24px !important; align-self: start; }
.next-main a { font-size: 24px; }
.next-main p { font-size: 18px; }
.next-soon a { color: var(--lavender); }

.today { padding: 40px 0 72px; border-top: 1px solid var(--line); }
.today-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.today h3 { font-size: 18px; margin-bottom: 10px; color: var(--lavender); }
.today ul { margin: 0 0 12px; padding-left: 20px; color: var(--muted); }
.today li { margin: 6px 0; }
.today li::marker { color: var(--faint); }

/* Code blocks */
.code { margin: 1.4em 0; background: var(--code-bg); border: 1px solid #262457; border-radius: var(--radius-lg); overflow: hidden; }
.code-bar { display: flex; justify-content: space-between; align-items: center; min-height: 38px; padding: 6px 8px 6px 16px; border-bottom: 1px solid #262457; font-size: 13px; color: var(--faint); }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; font: 14px/1.65 var(--mono); color: #d8d2f7; tab-size: 2; }
.hljs-keyword, .hljs-built_in { color: #c4a5ff; }
.hljs-string, .hljs-regexp { color: #f5a3d3; }
.hljs-subst { color: #d8d2f7; }
.hljs-number, .hljs-literal { color: #ffc28a; }
.hljs-title.function_, .hljs-title { color: #7fd5f7; }
.hljs-title.class_ { color: #f2d77a; }
.hljs-attr, .hljs-property { color: #a8e6cf; }
.hljs-comment { color: #6f6b97; font-style: italic; }
.hljs-meta, .hljs-variable { color: #d8d2f7; }

/* Docs layout */
.docs { flex: 1; display: grid; grid-template-columns: 240px minmax(0, 1fr) 200px; gap: 48px; width: 100%; max-width: 1280px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 40px) 64px; }
.docs-nav { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 110px); overflow-y: auto; }
.docs-nav summary { display: none; }
.docs-nav-section { font-size: 14px; font-weight: 600; color: var(--lavender); margin: 20px 0 6px; }
.docs-nav-section:first-of-type { margin-top: 0; }
.docs-nav ul { list-style: none; margin: 0; padding: 0; }
.docs-nav a { display: block; color: var(--muted); text-decoration: none; padding: 5px 10px; border-radius: 6px; font-size: 15px; }
.docs-nav a:hover { color: var(--text); background: var(--panel); }
.docs-nav a[aria-current] { color: #fff; background: var(--panel-2); box-shadow: inset 2px 0 0 var(--pink); }

.toc { position: sticky; top: 88px; align-self: start; font-size: 14px; }
.toc p { font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 4px 12px; color: var(--faint); text-decoration: none; }
.toc a:hover { color: var(--text); }
.toc .toc-3 a { padding-left: 24px; }

.prose { max-width: 72ch; }
.prose h1 { font-size: clamp(32px, 4vw, 42px); font-weight: 700; letter-spacing: -0.01em; margin-bottom: 16px; }
.prose h1 + p { font-size: 19px; color: var(--muted); }
.prose h2 { font-size: 26px; margin: 2.2em 0 0.6em; }
.prose h3 { font-size: 20px; margin: 1.8em 0 0.5em; }
.prose h2, .prose h3 { position: relative; }
.anchor { position: absolute; left: -1.1em; color: var(--faint); text-decoration: none; opacity: 0; font-weight: 400; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .anchor:focus { opacity: 1; }
.prose ul, .prose ol { padding-left: 24px; margin: 0 0 1em; }
.prose li { margin: 4px 0; }
.prose li::marker { color: var(--faint); }
.prose ol > li::marker { color: var(--lavender); font-weight: 600; font-family: var(--font); }
.prose strong { color: #fff; font-weight: 600; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
.note { margin: 1.4em 0; padding: 14px 18px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--lavender); border-radius: var(--radius); }
.note p:last-child { margin-bottom: 0; }
.table-wrap { overflow-x: auto; margin: 1.4em 0; border: 1px solid var(--line); border-radius: var(--radius-lg); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--panel); font-weight: 600; }
tr:last-child td { border-bottom: 0; }

.pager { display: flex; justify-content: space-between; gap: 16px; max-width: 72ch; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { display: flex; flex-direction: column; text-decoration: none; font-weight: 600; font-size: 17px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.pager a:hover { background: var(--panel); }
.pager span { font-size: 13px; font-weight: 400; color: var(--faint); }
.pager-next { text-align: right; margin-left: auto; }

/* Simple pages */
.page { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 48px clamp(16px, 4vw, 40px) 72px; }
.page h1 { font-size: clamp(32px, 4vw, 44px); font-weight: 700; }
.message { max-width: 640px; }
.message .btn { margin-top: 8px; }

/* Invite builder */
.invite-form { margin-top: 32px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.field label, .presets legend, .perm-group legend, .result-label { font-weight: 600; font-size: 16px; display: block; margin-bottom: 8px; padding: 0; }
.field input { width: 100%; max-width: 420px; font: 16px var(--mono); color: var(--text); background: var(--input); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.field input:focus { outline: 2px solid var(--cyan); outline-offset: 0; border-color: transparent; }
.field input:user-invalid { border-color: #ff7a9a; }
.help { color: var(--muted); font-size: 14px; margin: 8px 0 0; max-width: 60ch; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: 500 14px/1 var(--font); color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; cursor: pointer; }
.chip:hover { border-color: var(--lavender); }
.chip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); }
.chip-quiet { color: var(--muted); background: transparent; }
.perm-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 40px; }
.perm-group { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; }
.perm-group:last-child { grid-column: 1 / -1; }
.perm-group legend { float: left; width: 100%; margin-bottom: 10px; color: var(--lavender); }
.perm { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; font-size: 15px; clear: both; }
.perm input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--blue-hi); flex: none; }
.perm small { display: block; color: var(--faint); font-size: 13px; }
.perm-danger span { color: #ffb3c7; }
.result { position: sticky; bottom: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: 0 -10px 40px -10px rgba(0, 0, 0, 0.6); }
.result { padding: 12px 16px; }
.result-empty { padding: 4px 0; }
.result-link:not([hidden]) { display: flex; align-items: center; gap: 16px; }
.result-text { flex: 1; min-width: 0; }
.result-label { margin: 0 0 4px; font-size: 14px; }
.result-label .small { font-weight: 400; margin-left: 8px; font-family: var(--mono); font-size: 12px; }
.result-url { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; color: #dcd6fa; background: none !important; border: 0 !important; padding: 0 !important; }
.result-actions { display: flex; gap: 8px; flex: none; }
@media (max-width: 640px) { .result-link:not([hidden]) { flex-direction: column; align-items: stretch; } }

/* Account */
.account-head { display: flex; align-items: center; gap: 18px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.account-head img { border-radius: 50%; }
.account-head h1 { font-size: 32px; }
.account-head p { margin: 2px 0 0; }
.account-head form { margin-left: auto; }
.empty { margin-top: 36px; max-width: 60ch; }
.empty h2 { font-size: 24px; margin-bottom: 12px; }
.empty p { color: var(--muted); }

/* Footer */
.foot { border-top: 1px solid var(--line); background: rgba(6, 6, 26, 0.6); }
.foot-inner { max-width: 1180px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; font-size: 14px; color: var(--faint); }
.foot p { margin: 0; max-width: 56ch; }
.foot ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; padding: 0; }
.foot a { color: var(--muted); }

@media (max-width: 1100px) {
  .docs { grid-template-columns: 220px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .demo { grid-template-columns: minmax(0, 1fr); }
  .chat { margin: -20px 12px 0; }
  .next-list, .today-cols, .perm-groups { grid-template-columns: minmax(0, 1fr); }
  .next-main { grid-row: auto; }
  .docs { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 16px; }
  .docs-nav { position: static; max-height: none; }
  .docs-nav summary { display: block; cursor: pointer; font-weight: 600; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
  .docs-nav details[open] summary { margin-bottom: 12px; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .top { gap: 12px; flex-wrap: wrap; }
  .top-nav { order: 3; width: 100%; overflow-x: auto; }
  .brand-sub { display: none; }
  .hero { padding-top: 40px; }
  .me span { display: none; }
  .account-head { flex-wrap: wrap; }
  .account-head form { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* Bot builder */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.builder { max-width: 1040px; }
.builder.narrow { max-width: 680px; }
.crumbs { font-size: 14px; color: var(--faint); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.b-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.b-head h1 { font-size: clamp(28px, 4vw, 38px); }
.b-head p { margin: 4px 0 0; }
.b-section { margin-top: 40px; }
.b-section h2 { font-size: 22px; margin-bottom: 8px; }
.b-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.b-section-head h2 { margin: 0; }

.bot-line { display: flex; align-items: center; gap: 14px; margin: 16px 0; }
.bot-line .bot-name { font-weight: 600; font-size: 18px; margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bot-line .small { margin: 2px 0 0; }
.bot-av, .g-icon { flex: none; border-radius: 50%; object-fit: cover; }
.bot-av { width: 40px; height: 40px; }
.bot-av-lg { width: 56px; height: 56px; }
.g-icon { width: 32px; height: 32px; border-radius: 10px; }
.bot-av-blank, .g-icon-blank { display: inline-grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line); color: var(--lavender); font-weight: 700; }

.rows { list-style: none; margin: 12px 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.row-name { color: var(--text); text-decoration: none; }
a.row-name:hover { text-decoration: underline; }
.empty-line { color: var(--muted); padding: 16px 0; margin: 0; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.status-ok { color: #8fe3b0; } .status-ok::before { background: #3ccf7a; }
.status-warn { color: #f5d08a; } .status-warn::before { background: #f0b43c; }
.status-bad { color: #ffb3c7; } .status-bad::before { background: #ff5c8a; }

.banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 20px 0 0; padding: 12px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--lavender); }
.banner p { margin: 0; }
.banner-ok { border-left-color: #3ccf7a; }
.banner-warn { border-left-color: #f0b43c; }
.banner-bad { border-left-color: #ff5c8a; }

.steps { padding-left: 22px; color: var(--muted); }
.steps li { margin: 8px 0; }
.steps li::marker { color: var(--lavender); font-weight: 600; }
.steps strong { color: var(--text); }

.b-form { display: grid; gap: 22px; margin-top: 24px; }
.b-form .field { margin: 0; }
.b-form label, .b-form legend { font-weight: 600; display: block; margin-bottom: 8px; padding: 0; }
.b-form input:not([type=checkbox]):not([type=radio]), .b-form textarea {
  width: 100%; font: 16px/1.5 var(--font); color: var(--text); background: var(--input);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
}
.b-form textarea { resize: vertical; min-height: 72px; }
.b-form input:focus, .b-form textarea:focus { outline: 2px solid var(--cyan); outline-offset: 0; border-color: transparent; }
.b-form [aria-invalid="true"] { border-color: #ff7a9a; }
.b-form input:not([type=checkbox]):not([type=radio]) { max-width: none; }
.b-form input.input-short { max-width: 120px !important; }
.optional { font-weight: 400; color: var(--faint); font-size: 14px; margin-left: 6px; }
.field-error { color: #ffb3c7; font-size: 14px; margin: 8px 0 0; }
.help-top { margin: -4px 0 10px; }
.prefixed { display: flex; align-items: stretch; }
.prefixed span { display: grid; place-items: center; padding: 0 12px; background: var(--panel-2); border: 1px solid var(--line); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); font-family: var(--mono); color: var(--lavender); }
.prefixed input { border-radius: 0 var(--radius) var(--radius) 0 !important; font-family: var(--mono) !important; }
.inline-form { grid-template-columns: minmax(0, 360px) max-content; justify-content: start; align-items: start; gap: 12px; }
.inline-form > .btn { margin-top: 36px; }
.resp { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; margin-bottom: 10px; }
.link-btn { background: none; border: 0; padding: 8px 4px; color: var(--muted); font: 14px var(--font); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--text); }
.link-danger { color: #ff9ab5; }
.btn-danger { background: #b3264f; }
.btn-danger:hover { background: #d12e5e; }
.options { display: grid; gap: 4px; }
.check { display: flex !important; gap: 10px; align-items: flex-start; font-weight: 400 !important; cursor: pointer; padding: 4px 0; margin: 0 !important; }
.check input { margin-top: 5px; width: 16px; height: 16px; accent-color: var(--blue-hi); flex: none; }
.check small { display: block; color: var(--faint); font-size: 13px; }
.field-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px !important; }
.field-inline label { margin: 0 !important; font-weight: 400 !important; display: inline !important; }
.form-actions { display: flex; gap: 10px; }

.b-details { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-top: 10px; background: var(--panel); }
.b-details summary { cursor: pointer; font-weight: 600; }
.b-details[open] summary { margin-bottom: 8px; }
.b-details .b-form { margin: 8px 0 28px; }

.log { list-style: none; margin: 12px 0 0; padding: 0; font-size: 15px; }
.log li { padding: 8px 0 8px 12px; border-left: 2px solid var(--line); color: var(--muted); }
.log time { color: var(--faint); font-size: 13px; margin-right: 8px; }
.log-warn { border-left-color: #f0b43c !important; }
.log-error { border-left-color: #ff5c8a !important; color: var(--text) !important; }

.cmd-table td { vertical-align: middle; }
.cmd-table a { text-decoration: none; }
.cmd-table code { font-size: 15px; }
.cmd-table .num { text-align: right; width: 80px; color: var(--muted); }
.preview-cell { color: var(--muted); max-width: 420px; }
.is-off td { opacity: 0.6; }
.empty { padding: 24px; border: 1px dashed var(--line); border-radius: var(--radius-lg); margin-top: 12px; }
.empty p { color: var(--muted); }

.cmd-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 48px; align-items: start; }
.cmd-side { position: sticky; top: 88px; display: grid; gap: 24px; margin-top: 24px; }
.chat-preview { margin: 0; box-shadow: none; }
.pv-out { white-space: normal; word-wrap: break-word; color: var(--text) !important; font-weight: 400 !important; font-size: 15px !important; }
.pv-empty { color: var(--faint); font-style: italic; }
.mention { background: rgba(94, 200, 242, 0.15); color: #9edcf7; border-radius: 4px; padding: 0 3px; }
.pv-args { display: flex; align-items: center; gap: 8px; margin: 0 16px 16px; }
.pv-args input { flex: 1; min-width: 0; font: 14px var(--font); color: var(--text); background: var(--input); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; }
.vars h2 { font-size: 17px; margin-bottom: 4px; }
.vars dl { margin: 10px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.vars dt { white-space: nowrap; }
.vars dd { margin: 0; color: var(--muted); }

@media (max-width: 900px) {
  .cmd-layout { grid-template-columns: minmax(0, 1fr); }
  .cmd-side { position: static; }
  .inline-form { grid-template-columns: minmax(0, 1fr); }
  .inline-form > .btn { margin-top: 0; justify-self: start; }
}
.input-row { display: flex; align-items: center; gap: 10px; }

/* B2: module pages */
.scope-title { font-size: clamp(26px, 3.5vw, 34px) !important; }
.b-tabs { display: flex; gap: 4px; margin: 24px 0 8px; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.b-tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.b-tabs a:hover { color: var(--text); }
.b-tabs a[aria-current] { color: var(--text); border-bottom-color: var(--pink); }
.crumbs.sub { margin: 20px 0 0; }
.narrow-form { max-width: 640px; }
.b-form .label { font-weight: 600; display: block; margin-bottom: 8px; }
.b-form .label-quiet { font-weight: 400; color: var(--muted); font-size: 15px; margin-top: 6px; }
.b-form select {
  width: 100%; max-width: 420px; font: 16px var(--font); color: var(--text); background: var(--input);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
}
.b-form select:focus { outline: 2px solid var(--cyan); outline-offset: 0; border-color: transparent; }
.b-form select[aria-invalid="true"] { border-color: #ff7a9a; }

.module-form { gap: 20px; }
.module { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 22px; }
.module-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.module-head h2 { font-size: 20px; margin: 0; }
.module-body { display: grid; gap: 20px; }
.is-muted { opacity: 0.5; }
.switch { display: inline-flex !important; align-items: center; gap: 8px; margin: 0 !important; font-weight: 500 !important; cursor: pointer; }
.switch input { appearance: none; width: 40px; height: 22px; border-radius: 999px; background: var(--input); border: 1px solid var(--line); position: relative; cursor: pointer; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--faint); transition: transform 0.15s; }
.switch input:checked { background: var(--blue); border-color: var(--blue); }
.switch input:checked::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.picker { max-width: 420px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input); }
.picker summary { cursor: pointer; padding: 10px 12px; list-style: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker summary::-webkit-details-marker { display: none; }
.picker summary::after { content: '▾'; float: right; color: var(--faint); margin-left: 8px; }
.picker[open] summary { border-bottom: 1px solid var(--line); }
.picker-list { max-height: 260px; overflow-y: auto; padding: 6px 12px 10px; }
.picker-group { font-size: 13px; font-weight: 600; color: var(--lavender); margin: 10px 0 2px; }
.picker-list .check { padding: 3px 0; }
.check.is-off { opacity: 0.55; cursor: not-allowed; }
.role-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 8px; vertical-align: 0; }

.radio-row { display: grid; gap: 2px; }
.radio-row .check input { accent-color: var(--blue-hi); }
.sub-fields { display: grid; gap: 14px; margin: 8px 0 0 26px; }
.problem-list { margin: 6px 0; padding-left: 20px; }
.problem-list li { margin: 2px 0; }
.banner > div { flex: 1; }
.banner .small { margin: 4px 0 0; }

.row-toggle { margin: 0; }
.row .num { min-width: 80px; text-align: right; }
.row.is-off .row-name { color: var(--muted); }
.delete-form { margin-top: 28px; }

.choice-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0 20px; }
.choice { display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); text-decoration: none; color: var(--text); }
.choice:hover { border-color: var(--lavender); }
.choice strong { display: block; font-size: 17px; color: var(--cyan); margin-bottom: 4px; }
.choice span { color: var(--muted); font-size: 15px; }

.pair-head, .pair { display: grid; grid-template-columns: 90px minmax(0, 1fr) minmax(0, 1fr) 64px; gap: 8px; align-items: center; }
.pair-head { font-size: 13px; color: var(--faint); margin-bottom: 6px; }
.pair-head em { font-style: normal; }
.pair { margin-bottom: 8px; }
.pair select { max-width: none !important; }
.pair-emoji { text-align: center; font-size: 18px !important; }

.tester { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; }
.tester label { font-weight: 600; display: block; margin-bottom: 8px; }
.tester input { width: 100%; font: 16px var(--font); color: var(--text); background: var(--input); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.tester-out { margin: 10px 0 0; font-size: 15px; color: var(--muted); }
.tester-removed { color: #ffb3c7; }
.tester-removed::before { content: '✕ '; }
.tester-allowed { color: #8fe3b0; }
.tester-allowed::before { content: '✓ '; }

@media (max-width: 700px) {
  .choice-row { grid-template-columns: minmax(0, 1fr); }
  .pair-head { display: none; }
  .pair { grid-template-columns: 64px minmax(0, 1fr); }
  .pair > input[name="pair_label"] { grid-column: 1 / -1; }
  .row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .switch input::after { transition: none; } }

/* B3: embed builder */
.embed-editor { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; background: rgba(28, 27, 34, 0.6); }
.embed-switch { padding: 0 !important; }
.embed-box { margin-top: 16px; }
.embed-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 24px; align-items: start; }
.embed-fields { display: grid; gap: 16px; }
.embed-preview-wrap { position: sticky; top: 88px; }
.embed-preview-wrap .small { margin: 0 0 6px; }
.b-form input[type=color] { width: 56px !important; max-width: 56px !important; flex: none; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--input); cursor: pointer; }
.efield { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) 130px 64px; gap: 8px; align-items: center; margin-bottom: 8px; }
.efield select { max-width: none !important; }

.embed-preview { --edge: #5b49c9; background: #222129; border-left: 4px solid var(--edge); border-radius: 4px; padding: 10px 14px 12px; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.embed-preview p { margin: 0; }
.ep-body { display: flex; gap: 12px; }
.ep-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.ep-author { font-size: 13px; font-weight: 600; }
.ep-title { font-weight: 700; font-size: 15px; }
.ep-title a { color: var(--cyan); }
.ep-desc { color: #dcdbe6; }
.ep-fields { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 2px; }
.ep-field { flex: 1 1 100%; }
.ep-inline { flex: 1 1 calc(33% - 16px); min-width: 80px; }
.ep-fname { font-weight: 700; font-size: 13px; }
.ep-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; flex: none; }
.ep-image { display: block; width: 100%; max-height: 180px; object-fit: cover; border-radius: 4px; margin-top: 10px; }
.ep-sample { display: grid; place-items: center; background: repeating-linear-gradient(45deg, #2c2b36, #2c2b36 8px, #26252f 8px, #26252f 16px); color: var(--faint); font-size: 12px; }
div.ep-image { height: 120px; }
.ep-footer { font-size: 12px; color: var(--faint); margin-top: 10px !important; }

@media (max-width: 900px) {
  .embed-grid { grid-template-columns: minmax(0, 1fr); }
  .embed-preview-wrap { position: static; }
  .efield { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* B3: scheduled messages */
.b-form-inner { display: grid; gap: 22px; }
.b-form input.input-mid { max-width: 240px !important; }
.b-form select.select-short { max-width: 140px; }
.radio-inline { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.day-row { display: flex; flex-wrap: wrap; gap: 6px; }
.day { cursor: pointer; margin: 0 !important; }
.day input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.day span { display: inline-block; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); font-weight: 500; font-size: 14px; }
.day input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; }
.day input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }
.next-runs { margin: 4px 0 0; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); font-size: 15px; color: var(--muted); }
.next-runs:empty { display: none; }
.next-runs-error { color: #ffb3c7; }

/* B3: live alerts */
.status-live { color: #ffb3c7; }
.status-live::before { background: #ff4f7b; box-shadow: 0 0 0 3px rgba(255, 79, 123, 0.25); }
.vars-details { margin: 0; }
.vars-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 10px 0 4px; font-size: 14px; }
.vars-dl dd { margin: 0; color: var(--muted); }
.prefixed span { white-space: nowrap; }

/* B4: premium */
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.head-actions form { margin: 0; }
.plan-pill { font-size: 14px; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; }
.plan-pill:hover { color: var(--text); border-color: var(--lavender); }
.plan-pill.is-premium { color: #1b1240; background: var(--pink); border-color: var(--pink); }
.plan-now { margin-top: 24px; padding: 22px 24px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); max-width: 720px; }
.plan-now p { margin: 0 0 12px; color: var(--muted); }
.plan-now form { margin: 0; }
.plan-badge { display: inline-block; font-weight: 700; font-size: 14px; padding: 4px 10px; border-radius: 999px; background: var(--pink); color: #1b1240 !important; }
.plan-badge.plan-free { background: var(--panel-2); color: var(--muted) !important; border: 1px solid var(--line); }
.checkout-form { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.plan-table { max-width: 720px; }
.plan-table td:not(:first-child), .plan-table th:not(:first-child) { text-align: center; width: 160px; }
.plan-table td:last-child { color: var(--pink); font-weight: 600; }
.status-form { margin-top: 8px; }
.status-form .input-row { flex-wrap: wrap; }
.status-form #status_text { flex: 1; min-width: 200px; }
.b-form input.status-emoji { max-width: 64px !important; text-align: center; }
button[disabled] { opacity: 0.5; cursor: not-allowed; }

/* B4: admin */
.admin-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 28px 0 0; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.admin-stats > div { padding: 16px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-right: -1px; margin-bottom: -1px; }
.admin-stats dt { color: var(--muted); font-size: 14px; }
.admin-stats dd { margin: 4px 0 0; font-size: 28px; font-weight: 700; }
.admin-stats dd a { color: var(--text); text-decoration: none; }
.admin-stats dd a:hover { text-decoration: underline; }
.admin-stats dd.small { font-size: 13px; font-weight: 400; }
.admin-stats dd.small a { color: var(--muted); }
.admin-search { display: flex; gap: 10px; flex-wrap: wrap; margin: 24px 0 8px; }
.admin-search input, .admin-search select { font: 16px var(--font); color: var(--text); background: var(--input); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; }
.admin-search input { flex: 1; min-width: 220px; max-width: 420px; }
.admin-search input:focus, .admin-search select:focus { outline: 2px solid var(--cyan); outline-offset: 0; }
.admin-table td { vertical-align: middle; }
.admin-table .num { text-align: right; width: 110px; }
.admin-table form { margin: 0; }
.admin-filter { display: flex; gap: 16px; margin: 20px 0 4px; font-size: 15px; }
.admin-filter a { color: var(--muted); }
.admin-filter a[aria-current] { color: var(--text); font-weight: 600; text-decoration: none; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--lavender); vertical-align: 1px; }
.tag-bad { color: #ffb3c7; border-color: rgba(255, 92, 138, 0.4); }
.narrow-admin { max-width: 760px; }
.limits-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px 24px; }
.limits-grid .small { margin: 4px 0 0; }
.b-form input.input-date { max-width: 200px !important; color-scheme: dark; }
.limits-grid .field { display: flex; flex-direction: column; justify-content: flex-end; }
@media (max-width: 640px) { .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lede-small { font-size: 17px; margin-top: 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.switch .sw-on, .switch input:checked ~ .sw-off { display: none; }
.switch input:checked ~ .sw-on { display: inline; }
.switch .sw-off { color: var(--muted); }
