@font-face { font-family: "Jakarta"; src: url("/static/font.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
:root {
  --side: #0e1a33; --side-2: #16264a; --side-fg: #c9d3e6; --side-dim: #8592ad; --side-hi: #ffffff;
  --acc: #1fa35c; --acc-2: #178a4c; --navy: #13235a;
  --bg: #ffffff; --bg-2: #f6f7f9; --fg: #1b1f27; --mut: #616977; --line: #e3e6eb; --hover: #f2f4f7;
  --red: #c62828; --red-bg: #fdecea; --amber: #a15c00; --amber-bg: #fff4e0; --did: #5b6472;
  --radius: 10px; --font: "Jakarta", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15181e; --bg-2: #1b1f27; --fg: #e8ebf0; --mut: #9aa3b2; --line: #2a303a; --hover: #1f242d;
    --red: #ff8a80; --red-bg: #3a1d1d; --amber: #ffcc80; --amber-bg: #3a2c14; --did: #a3acba; }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 15px/1.45 var(--font); background: var(--bg); color: var(--fg); -webkit-text-size-adjust: 100%; }
button { font: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
.muted { color: var(--mut); } .small { font-size: 13px; }
.link { background: none; border: 0; color: inherit; text-decoration: underline; padding: 0; }

/* login */
.login-page { display: grid; place-items: center; min-height: 100%; background: var(--side); padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--bg); border-radius: 16px; padding: 28px 24px; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.login-card h1 { font-size: 22px; margin: 16px 0 4px; }
.login-card label { display: block; font-weight: 600; margin: 14px 0 6px; }
.login-card input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.login-card button { width: 100%; margin-top: 18px; padding: 12px; border: 0; border-radius: var(--radius); background: var(--acc); color: #fff; font-weight: 700; }
.login-card button:disabled { opacity: .6; }
.err { color: var(--red); min-height: 1.2em; margin: 10px 0 0; }
.logo-tile { background: #fff; border-radius: 12px; padding: 10px 14px; display: inline-flex; }
.logo-tile img { height: 40px; width: auto; display: block; }
.logo-tile.small { padding: 5px 7px; border-radius: 8px; } .logo-tile.small img { height: 22px; }

/* layout */
.app { display: grid; grid-template-columns: 270px minmax(0, 1fr) 0; height: 100vh; height: 100dvh; }
.app.with-thread { grid-template-columns: 270px minmax(0, 1fr) minmax(320px, 420px); }
.side { background: var(--side); color: var(--side-fg); display: flex; flex-direction: column; min-height: 0; }
.side-head { display: flex; gap: 10px; align-items: center; padding: 14px 14px 10px; border-bottom: 1px solid var(--side-2); }
.ws-name { color: var(--side-hi); font-weight: 800; } .ws-sub { font-size: 12px; color: var(--side-dim); }
.side-search { padding: 10px 12px 4px; }
.side-search input { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--side-2); background: var(--side-2); color: var(--side-hi); }
.side-search input::placeholder { color: var(--side-dim); }
.side-list { overflow-y: auto; flex: 1; padding: 6px 0 12px; }
.sec { padding: 14px 18px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--side-dim); font-weight: 700; }
.item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; color: var(--side-fg); padding: 6px 18px; font-size: 15px; }
.item:hover { background: var(--side-2); }
.item.on { background: var(--acc); color: #fff; }
.item.unread { color: var(--side-hi); font-weight: 800; }
.item .hash { opacity: .7; width: 14px; text-align: center; }
.item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { background: #e01e5a; color: #fff; border-radius: 10px; font-size: 11px; font-weight: 800; padding: 1px 7px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--side-dim); display: inline-block; }
.dot.ok { background: var(--acc); }
.side-foot { border-top: 1px solid var(--side-2); padding: 10px 16px; display: flex; justify-content: space-between; font-size: 13px; color: var(--side-dim); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--line); }
.main-head { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line); min-height: 58px; }
.main-head h2 { font-size: 18px; margin: 0; }
.titles { flex: 1; min-width: 0; }
.about { font-size: 13px; color: var(--mut); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { display: none; border: 0; background: none; font-size: 28px; line-height: 1; padding: 0 8px 0 0; color: var(--fg); }
.tabs { display: flex; gap: 4px; }
.tabs button { border: 1px solid var(--line); background: var(--bg); padding: 5px 12px; border-radius: 16px; font-size: 13px; color: var(--fg); }
.tabs button.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.view { flex: 1; overflow-y: auto; min-height: 0; padding: 8px 0 12px; overscroll-behavior: contain; }

/* messages */
.day { display: flex; align-items: center; gap: 10px; margin: 14px 18px 4px; color: var(--mut); font-size: 12px; font-weight: 700; }
.day::before, .day::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.msg { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; padding: 6px 18px; }
.msg:hover { background: var(--hover); }
.msg.new { box-shadow: inset 3px 0 0 #e01e5a; }
.av { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; }
.mh { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.who { font-weight: 800; background: none; border: 0; padding: 0; color: var(--fg); }
.when { font-size: 12px; color: var(--mut); }
.chip { font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; color: var(--mut); background: var(--bg-2); }
.chip.st { border-color: var(--acc); color: var(--acc-2); }
.txt { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.msg.k-out .txt { }
.msg.k-failed .txt { color: var(--red); } .msg.k-failed { background: var(--red-bg); }
.msg.k-blocked .txt { color: var(--amber); } .msg.k-blocked { background: var(--amber-bg); }
.msg.k-relay .txt, .msg.k-status .txt, .msg.k-note .txt { color: var(--did); font-size: 14px; }
.msg.k-doc .txt { font-size: 14px; }
.more { border: 0; background: none; color: var(--acc-2); font-weight: 700; padding: 2px 0; }
.replies { margin-top: 4px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 3px 10px; font-size: 13px; color: var(--acc-2); font-weight: 700; }
.replies.unread::after { content: " · new"; color: #e01e5a; }
.older { display: block; margin: 8px auto; border: 1px solid var(--line); background: var(--bg); border-radius: 16px; padding: 5px 14px; color: var(--fg); }
.empty { color: var(--mut); text-align: center; padding: 40px 20px; }

/* composer */
.composer { border-top: 1px solid var(--line); padding: 10px 14px 12px; background: var(--bg); }
.comp-row { display: flex; gap: 8px; align-items: flex-end; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.comp-row textarea { flex: 1; resize: none; border: 0; outline: 0; background: transparent; max-height: 180px; min-height: 24px; padding: 4px 6px; }
.comp-row button { border: 0; background: var(--acc); color: #fff; border-radius: 8px; padding: 7px 14px; font-weight: 700; }
.comp-row button:disabled { background: var(--line); color: var(--mut); cursor: not-allowed; }
.attach { border-radius: 8px; padding: 4px 10px; font-weight: 800; color: var(--mut); border: 1px solid var(--line); cursor: pointer; }
.comp-note { font-size: 13px; color: var(--mut); min-height: 0; margin-bottom: 6px; }
.comp-note:empty { display: none; }
.comp-note.err { color: var(--red); }
.comp-file { font-size: 13px; color: var(--mut); margin-top: 4px; }
.composer.off textarea { cursor: not-allowed; }

/* thread */
.thread { display: none; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.app.with-thread .thread { display: flex; }
.thread-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); min-height: 58px; }
.thread-head h3 { margin: 0; font-size: 16px; }
.x { border: 0; background: none; font-size: 26px; color: var(--mut); }
.t-view { flex: 1; overflow-y: auto; padding: 8px 0; }
.t-view .msg.root { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 6px; }

/* pages */
.page { padding: 14px 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--bg); min-width: 0; }
.card h4 { margin: 0 0 4px; font-size: 16px; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 3px 10px; font-size: 13px; margin-top: 8px; }
.kv dt { color: var(--mut); } .kv dd { margin: 0; overflow-wrap: anywhere; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; color: var(--mut); font-weight: 700; border-bottom: 1px solid var(--line); padding: 6px 8px; position: sticky; top: 0; background: var(--bg); }
table.t td { border-bottom: 1px solid var(--line); padding: 6px 8px; vertical-align: top; overflow-wrap: anywhere; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--hover); }
.scroll-x { overflow-x: auto; }
.pill { display: inline-block; border-radius: 10px; padding: 0 8px; font-size: 12px; font-weight: 700; background: var(--bg-2); border: 1px solid var(--line); }
.pill.good { color: var(--acc-2); border-color: var(--acc); } .pill.bad { color: var(--red); border-color: var(--red); } .pill.warn { color: var(--amber); border-color: var(--amber); }
.filebox { white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.row input, .row select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.btn { border: 1px solid var(--line); background: var(--bg); color: var(--fg); padding: 6px 12px; border-radius: 8px; }
.btn.primary { background: var(--acc); color: #fff; border-color: var(--acc); }
h3.sub { font-size: 15px; margin: 18px 0 8px; }
.home-list .item { color: var(--fg); padding: 10px 6px; border-bottom: 1px solid var(--line); }
.home-list .item.unread { color: var(--fg); }

/* phone: the sidebar is the home screen, a channel opens full screen, a thread opens over it */
@media (max-width: 760px) {
  .app, .app.with-thread { grid-template-columns: 100%; }
  .side { display: flex; } .main, .thread { display: none; }
  .app.in-main .side { display: none; } .app.in-main .main { display: flex; }
  .app.with-thread .main, .app.with-thread .side { display: none; } .app.with-thread .thread { display: flex; }
  .back { display: block; }
  .item { padding: 10px 18px; font-size: 16px; }
  .msg { padding: 6px 12px; } .page { padding: 12px; }
}

/* Now: the first screen */
.page.now { display: flex; flex-direction: column; gap: 12px; }
.now-row { padding: 12px 14px; }
.now-row.has-p { border-left: 4px solid var(--amber); }
.nr-h { display: flex; align-items: center; gap: 10px; }
.nr-h.click { cursor: pointer; }
.nr-t { flex: 1; min-width: 0; }
.nr-d { font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.np { margin: 8px 0 0 46px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); }
.np.click { cursor: pointer; } .np.click:hover { background: var(--hover); }
.np-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.np-age { font-weight: 700; color: var(--mut); } .np-age.old { color: var(--amber); }
.np-t { font-size: 14px; margin-top: 3px; overflow-wrap: anywhere; }
.chip.link { cursor: pointer; border-color: var(--acc); color: var(--acc-2); font: inherit; font-size: 12px; }
.now-row details { margin: 8px 0 0 46px; font-size: 13px; }
.np-l { margin: 4px 0; overflow-wrap: anywhere; }
@media (max-width: 760px) { .np, .now-row details { margin-left: 0; } }
.now-sum { display: flex; flex-wrap: wrap; gap: 6px; }
.now-sum .ns { font: inherit; font-size: 13px; border: 1px solid var(--line); border-radius: 14px; padding: 3px 10px; background: var(--bg); color: inherit; cursor: pointer; }
.now-sum .ns.warn { border-color: var(--amber); color: var(--amber); font-weight: 700; }
.now-row .more { margin: 8px 0 0 46px; }
@media (max-width: 760px) { .now-row .more { margin-left: 0; } }
@media (max-width: 760px) { .nr-h { flex-wrap: wrap; } .nr-t { flex: 1 1 calc(100% - 50px); } .nr-h .pill { margin-left: 46px; } }

/* B-010 maps */
.maplinks { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 12px; }
.btn.maplink { font-size: 13px; padding: 4px 10px; margin: 4px 6px 0 0; }
.mapcard p { margin: 6px 0 8px; } .mapcard .row { display: flex; gap: 6px; flex-wrap: wrap; }
.map .map-answer { font-size: 17px; font-weight: 600; margin: 12px 0 6px; max-width: 65ch; }
.map figure.flow { margin: 14px 0; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.map figcaption { font-size: 13px; color: var(--mut); margin-bottom: 8px; }
.lanes { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 10px 18px; align-items: start; }
.lane-h { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--mut); border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.step { position: relative; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; padding: 8px 10px; border: 1.5px solid var(--acc); border-radius: 10px; background: var(--bg); }
.step.risky { border-color: var(--red); border-style: dashed; }
.step::after { content: '→'; position: absolute; right: -16px; top: 8px; color: var(--mut); }
.step .num { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 11px; background: var(--acc); color: #fff; font-size: 12px; font-weight: 700; }
ol.behind { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
ol.behind li { padding: 4px 0 6px 10px; position: relative; overflow-wrap: anywhere; }
ol.behind li + li::before { content: '↓'; position: absolute; left: -7px; top: -9px; font-size: 11px; color: var(--mut); background: var(--bg); }
ol.behind .kind { display: inline-block; font-size: 11px; font-weight: 700; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-right: 6px; color: var(--mut); }
ol.behind .b-n8n .kind, ol.behind .b-ai .kind { border-style: dashed; } ol.behind .b-table .kind { border-radius: 0; } ol.behind .b-bot .kind { border-radius: 9px; }
ol.behind b { margin-right: 6px; } ol.behind .does { color: var(--mut); }
ol.breaks li { margin-bottom: 8px; } .card.mismatch { border-color: var(--red); margin-bottom: 10px; }
.mono { font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .lanes { grid-template-columns: 1fr; gap: 6px; } .lane-h { display: none; }
  .step::after { content: '↓'; right: auto; left: 18px; top: auto; bottom: -16px; }
  ol.behind { margin: 6px 0 14px 18px; }
}
.card.click { cursor: pointer; } .card.click:hover { background: var(--hover); }
