:root {
  --bg: #0b0f0c;
  --panel: #121913;
  --line: #24332a;
  --text: #e8f1e9;
  --dim: #93a898;
  --accent: #5dfc8a;
  --accent-ink: #062b12;
  --warn: #ffd479;
  --danger: #ff7b7b;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--sans); }
body { min-height: 100dvh; }
[hidden] { display: none !important; }
#app, #demo-bar { max-width: 520px; margin: 0 auto; }
#demo-bar { background: #2a2410; color: var(--warn); font: 12px/1.4 var(--mono); padding: 6px 16px; text-align: center; }
main { padding: 12px 16px 48px; }
.pad { padding: 16px; }
h1 { font: 600 24px/1.25 var(--mono); margin: 8px 0 12px; }
h2 { font: 600 13px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin: 28px 0 10px; }
p { margin: 0 0 12px; }
a { color: var(--accent); }
small { color: var(--dim); font-size: 12px; }
.dim { color: var(--dim); font-size: 14px; }
.err { color: var(--danger); }
.logo { font: 700 18px var(--mono); color: var(--accent); }
.logo::before { content: "> "; color: var(--dim); }

.top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.top nav { display: flex; gap: 16px; }
.navlink { font: 14px var(--mono); color: var(--text); text-decoration: none; background: none; border: 0; padding: 8px 0; cursor: pointer; white-space: nowrap; }
.title { flex: 1; min-width: 0; text-align: center; display: flex; flex-direction: column; }
.title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { background: var(--accent); color: var(--accent-ink); border-radius: 9px; padding: 0 6px; margin-left: 4px; font-size: 12px; font-weight: 700; }

input[type=text], input[type=email], input[type=search], select {
  width: 100%; min-height: 46px; padding: 10px 12px; font: 16px var(--sans); color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 16px; font: 600 15px var(--mono); color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: none; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 13px; white-space: nowrap; }
.btn.block { display: flex; width: 100%; margin-top: 10px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }

.onb { display: flex; flex-direction: column; gap: 12px; padding-top: 28px; }
.onb p { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline > input, .inline > select { flex: 1; min-width: 150px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.or { text-align: center; color: var(--dim); font: 12px var(--mono); margin: 6px 0; }
.check { display: flex; gap: 10px; align-items: center; padding: 6px 0; cursor: pointer; }
.levels { display: flex; flex-direction: column; gap: 4px; }
.level { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.note { background: #1c2416; border: 1px solid #3a4a22; color: var(--warn); border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 0 0 12px; }
.chat .note { margin: 8px 16px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 10px; }
.card p { margin: 0; }
.card.resolved { opacity: .6; }
.card.row { flex-direction: row; flex-wrap: wrap; }
blockquote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--line); color: var(--text); background: var(--bg); overflow-wrap: anywhere; }

.adder { display: flex; flex-direction: column; gap: 10px; }
.results { display: flex; flex-direction: column; }
.result { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.result > div { min-width: 0; overflow-wrap: anywhere; }

.niche { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.niche-name { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0 0 8px; color: var(--text); font: 600 17px var(--sans); cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 36px; padding: 4px 10px; font: 13px var(--mono); color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 18px; cursor: pointer; }
.chip b { color: var(--accent); }
.chip.zero, .chip.zero b { color: var(--dim); }
.chan { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; color: var(--text); text-decoration: none; }
.chan.muted { color: var(--dim); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }

.chat { display: flex; flex-direction: column; height: calc(100dvh - var(--bar, 0px)); }
.msgs { flex: 1; overflow-y: auto; padding: 12px 16px; }
.msg { margin-bottom: 12px; }
.who { background: none; border: 0; padding: 4px 0; color: var(--accent); font: 600 13px var(--mono); cursor: pointer; }
.msg.mine .who { color: var(--warn); cursor: default; }
.when { color: var(--dim); font: 11px var(--mono); margin-left: 8px; }
.body { overflow-wrap: anywhere; white-space: pre-wrap; }
.composer { display: flex; gap: 8px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
.composer input { flex: 1; }

.sheet-wrap { position: fixed; inset: 0; z-index: 10; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; max-height: 85dvh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px 16px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 4px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet h2 { margin: 6px 0 10px; font-size: 15px; text-transform: none; letter-spacing: 0; color: var(--text); }
.x { background: none; border: 0; color: var(--dim); font-size: 26px; line-height: 1; width: 40px; height: 40px; cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 20; max-width: calc(100% - 32px); background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 8px; font-size: 14px; }
