:root { --bg: #f4f7f5; --panel: #ffffff; --fg: #15201a; --muted: #5b6b62; --line: #e1e9e4; --brand: #0fa556; --brand-ink: #0b7a40; --soft: #e6f5ec; --danger: #c8312a; --bubble: #ffffff; --chat: #dfe9e2; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b120e; --panel: #121c16; --fg: #e7efe9; --muted: #9db0a5; --line: #1f2c25; --brand: #2ec474; --brand-ink: #5fdc98; --soft: #173325; --danger: #ef6b61; --bubble: #1b2820; --chat: #0f1813; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand-ink); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; padding: 0 max(16px, env(safe-area-inset-left)); background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--fg); text-decoration: none; font-size: 17px; }
.logo svg { width: 30px; height: 30px; }
.top-right { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
main { max-width: 1240px; margin: 0 auto; padding: 20px 16px 120px; }
.loading { color: var(--muted); }
h1 { font-size: 26px; margin: 8px 0 6px; }
h2 { font-size: 19px; margin: 0 0 10px; }
h3 { font-size: 16px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.stack { display: grid; gap: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
button, .btn { font: inherit; border: 0; border-radius: 10px; padding: 9px 14px; cursor: pointer; background: var(--brand); color: #fff; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button.ghost { background: transparent; color: var(--brand-ink); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
button.icon { padding: 6px 9px; background: transparent; color: var(--muted); border: 1px solid var(--line); }
button:disabled { opacity: .55; cursor: default; }
input, textarea, select { font: inherit; color: var(--fg); background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 11px; width: 100%; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); }
textarea { min-height: 96px; resize: vertical; }
label.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.hint { font-size: 12.5px; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; cursor: pointer; display: grid; gap: 4px; }
.card:hover { border-color: var(--brand); }
.card.new { border-style: dashed; place-items: center; color: var(--brand-ink); font-weight: 600; min-height: 96px; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--brand-ink); font-weight: 600; }
.tag.off { background: var(--bg); color: var(--muted); }
.layout { display: grid; grid-template-columns: 200px minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.tabs { display: grid; gap: 4px; position: sticky; top: 76px; }
.tabs button { justify-content: flex-start; background: transparent; color: var(--fg); font-weight: 500; }
.tabs button.on { background: var(--soft); color: var(--brand-ink); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { background: var(--bg); color: var(--fg); border: 1px solid var(--line); font-weight: 500; padding: 6px 12px; border-radius: 999px; }
.chips button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.brow { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: center; }
.bbox { border: 1px dashed var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 8px; }
.item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
/* «Свой код»: the program and its log. */
textarea.code, pre.log { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 13px; line-height: 1.45; tab-size: 4; }
pre.log { margin: 0; padding: 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
/* «Статистика»: messages to the bot by day, 14 small columns. */
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; align-items: end; height: 110px; }
.bar { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 2px; text-align: center; }
.bar i { align-self: end; display: block; min-height: 2px; background: var(--brand); border-radius: 4px 4px 0 0; }
.bar span { font-size: 11px; color: var(--muted); }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); padding: 10px max(16px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px; z-index: 6; }
.savebar .msg { flex: 1; min-width: 0; font-size: 14px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--brand-ink); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.switch input { width: 42px; height: 24px; appearance: none; background: var(--line); border-radius: 999px; position: relative; padding: 0; border: 0; cursor: pointer; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { left: 21px; }
/* The phone preview */
.phone { position: sticky; top: 76px; border-radius: 30px; border: 8px solid #1d2a22; background: var(--chat); height: 600px; display: flex; flex-direction: column; overflow: hidden; }
.phone .bar { background: var(--panel); padding: 10px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.phone .ava { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
.phone .feed { flex: 1; overflow-y: auto; padding: 14px 10px; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 85%; background: var(--bubble); border-radius: 16px 16px 16px 4px; padding: 8px 11px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.bubble.me { align-self: flex-end; background: var(--brand); color: #fff; border-radius: 16px 16px 4px 16px; }
.bubble img { display: block; max-width: 100%; border-radius: 10px; margin-bottom: 6px; }
.kb { display: grid; gap: 4px; max-width: 85%; }
.kb .r { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.kb span { background: color-mix(in srgb, var(--bubble) 70%, var(--brand) 30%); border-radius: 10px; padding: 7px 6px; text-align: center; font-size: 13px; font-weight: 600; color: var(--fg); }
.phone .input { background: var(--panel); padding: 10px 14px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.qr { background: #fff; padding: 12px; border-radius: 14px; width: fit-content; }
.qr img { display: block; width: 220px; height: 220px; image-rendering: pixelated; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tpl { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tpl .card b { font-size: 16px; }
@media (max-width: 1060px) { .layout { grid-template-columns: 180px minmax(0, 1fr); } .preview-col { grid-column: 1 / -1; } .phone { position: static; height: 480px; max-width: 360px; margin: 0 auto; } }
@media (max-width: 720px) {
  .savebar { flex-wrap: wrap; row-gap: 4px; }
  .savebar .msg { order: 3; flex-basis: 100%; font-size: 13px; }
  .savebar button { margin-left: auto; }
  .top-right span { display: none; }
}
@media (max-width: 720px) { .layout { grid-template-columns: 1fr; } .tabs { position: static; grid-auto-flow: column; overflow-x: auto; } .tabs button { white-space: nowrap; } .brow { grid-template-columns: 1fr; } }
