/* Лента: значения взяты с макетов (белый фон, синий — «ждёт меня», оранжевый — действие наружу). */
:root {
  --bg: #FFFFFF; --ink: #16181D; --muted: #5B6270; --line: #E6E8EC; --line2: #C9CED6;
  --blue: #2456E6; --on-blue: #FFFFFF; --green: #0B6E4F; --red: #B42318;
  --bubble: #F1F2F4; --soft: #F6F7F8; --warn-bg: #FFF3E0; --warn-ink: #5C3200;
  --code-bg: #16181D; --code-ink: #E6E8EC; --veil: rgba(22, 24, 29, 0.4);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --ink: #ECEEF1; --muted: #A3A9B4; --line: #2A2E36; --line2: #3A3F49;
    --blue: #8FB0FF; --on-blue: #111317; --green: #4CC38A; --red: #FF8A7A;
    --bubble: #1D2027; --soft: #181B20; --warn-bg: #3A2A12; --warn-ink: #FFD9A8;
    --code-bg: #0B0C0F; --code-ink: #E6E8EC; --veil: rgba(0, 0, 0, 0.6);
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: 0.45; cursor: default; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

#app { height: 100dvh; display: flex; }
.pane { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.pane > main { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.foot { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
/* Широкое окно: лента слева, тред справа. */
#list { display: none; }
#app.feed #list, #app.wide #list { display: flex; }
#app.feed #main { display: none; }
@media (min-width: 900px) {
  #app #list { display: flex; flex: 0 0 380px; border-right: 1px solid var(--line); }
  #app.feed #main { display: flex; }
  #main { max-width: 760px; }
}
@media (max-width: 899px) { #app:not(.feed) #list { display: none; } }

.top { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; }
.top h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.icon { width: 44px; height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: 0; background: none; padding: 0; color: var(--ink); }
.icon.muted { color: var(--muted); }
.icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bar { display: flex; align-items: center; gap: 4px; padding: 10px 6px 8px; border-bottom: 1px solid var(--line); }
.bar .ttl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bar h1 { margin: 0; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .sub { font-size: 12px; color: var(--muted); border: 0; background: none; padding: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cap { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.st-me { color: var(--blue); font-weight: 600; } .st-run { color: var(--green); font-weight: 600; } .st-err { color: var(--red); font-weight: 600; } .st { font-weight: 600; }

.group { margin: 0; padding: 16px 16px 6px; }
.group.me { color: var(--blue); padding-top: 10px; }
.row { display: flex; flex-direction: column; gap: 3px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.row.on { background: var(--soft); }
.row .l1 { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.row .name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.me .name { font-weight: 600; } .row.rest .name { font-weight: 400; }
.row .time, .row .meta { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.row .line { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.row.me .line { color: var(--ink); }
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 32px; text-align: center; color: var(--muted); }
.empty strong { color: var(--ink); font-size: 17px; font-weight: 600; }
.banner { padding: 8px 16px; background: var(--warn-bg); color: var(--warn-ink); font-size: 13px; }

.btn { height: 48px; padding: 0 16px; border: 1px solid var(--line2); border-radius: 12px; background: var(--bg); font-size: 15px; font-weight: 600; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.two .btn { padding: 0 6px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.two.next { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
.btn.blue { border: 0; background: var(--blue); color: var(--on-blue); }
.btn.ink { border: 0; background: var(--ink); color: var(--bg); }
.btn.big { height: 52px; border-radius: 14px; font-size: 16px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn.text { border: 0; background: none; color: var(--muted); font-weight: 500; height: 44px; }
.btn.link { border: 0; background: none; color: var(--blue); font-weight: 500; height: 44px; padding: 0 12px; font-size: 14px; }
.btn.danger { color: var(--red); }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pad { padding: 12px 16px 0; display: flex; flex-direction: column; gap: 8px; }

.msgs { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.mine { align-self: flex-end; max-width: min(300px, 85%); display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 16px 16px 4px 16px; background: var(--bubble); line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.mine.failed { outline: 1.5px solid var(--red); }
.mine img, .agent img { max-width: 100%; max-height: 220px; border-radius: 8px; display: block; }
.note { align-self: center; font-size: 12px; color: var(--muted); text-align: center; }
.agent { display: flex; flex-direction: column; gap: 10px; }
.agent .who { font-size: 12px; font-weight: 600; color: var(--muted); }
.md { line-height: 1.5; overflow-wrap: anywhere; }
.md p { margin: 0 0 10px; } .md p:last-child, .md ul:last-child, .md pre:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md strong { font-weight: 600; }
.md a { color: var(--blue); }
.md code { font: 13px/1.4 'JetBrains Mono', ui-monospace, Menlo, monospace; background: var(--bubble); padding: 1px 5px; border-radius: 5px; }
.md pre, pre.out { margin: 0 0 10px; padding: 10px 12px; border-radius: 8px; background: var(--code-bg); color: var(--code-ink); font: 11.5px/1.5 'JetBrains Mono', ui-monospace, Menlo, monospace; overflow-x: auto; white-space: pre; }
.md pre code { background: none; padding: 0; font: inherit; color: inherit; }
.md.clamp { max-height: 420px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 80%, transparent); mask-image: linear-gradient(#000 80%, transparent); }
.links { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; }
.links a { min-height: 44px; display: flex; align-items: center; padding: 8px 14px; font-size: 14px; color: var(--blue); font-weight: 500; overflow-wrap: anywhere; }
.links a + a { border-top: 1px solid var(--line); }
.warn { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-ink); font-size: 14px; }
.warn strong { font-weight: 600; }
.err { padding: 12px 14px; border: 1.5px solid var(--red); border-radius: 12px; font-size: 14px; }
.err strong { color: var(--red); font-weight: 600; }
.src { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.src .hd { font-size: 13px; font-weight: 600; }
.src blockquote { margin: 0; padding-left: 12px; border-left: 2px solid var(--line2); white-space: pre-wrap; overflow-wrap: anywhere; }
.src a { font-size: 13px; font-weight: 500; color: var(--blue); }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { min-height: 48px; padding: 12px 16px; border: 1px solid var(--blue); border-radius: 12px; background: var(--bg); color: var(--blue); font-size: 15px; line-height: 1.35; font-weight: 600; text-align: left; overflow-wrap: anywhere; }
.hint { font-size: 12px; color: var(--muted); }
.card { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1.5px solid var(--ink); border-radius: 16px; }
.card.closed { border: 1px solid var(--line); }
.card .to { font-size: 14px; font-weight: 600; }
.card .txt { padding: 12px 14px; border-radius: 10px; background: var(--bubble); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.card textarea { min-height: 120px; }
.card .send { margin-top: 8px; }

.now { display: flex; align-items: center; gap: 10px; margin: 0 12px; padding: 8px 8px 8px 14px; border: 1px solid var(--line); border-radius: 14px; }
.now .what { flex: 1; min-width: 0; min-height: 44px; display: flex; flex-direction: column; justify-content: center; gap: 2px; border: 0; background: none; padding: 0; text-align: left; }
.now .what b { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now .what > span { font-size: 12px; color: var(--muted); }
.stop { height: 44px; padding: 0 16px; border: 1px solid var(--line2); border-radius: 10px; background: var(--bg); font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stop i { width: 10px; height: 10px; border-radius: 2px; background: var(--red); }
.composer { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 0; }
.composer .line { display: flex; align-items: flex-end; gap: 8px; }
.field { width: 100%; padding: 14px; border: 1px solid var(--line2); border-radius: 14px; background: var(--bg); font-size: 16px; line-height: 1.45; resize: none; }
.composer textarea { flex: 1; min-width: 0; height: 44px; max-height: 140px; padding: 10px 14px; border: 1px solid var(--line2); border-radius: 22px; background: var(--bg); font-size: 16px; line-height: 1.4; resize: none; }
.composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer .hint { padding-left: 52px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 4px 0 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; max-width: 100%; }
.chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip button { width: 32px; height: 32px; border: 0; background: none; color: var(--muted); font-size: 18px; padding: 0; }

.form { display: flex; flex-direction: column; gap: 20px; padding: 8px 16px 16px; }
.set { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.seg { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 8px; }
.seg button { height: 48px; border: 1px solid var(--line2); border-radius: 12px; background: var(--bg); font-size: 14px; font-weight: 500; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); font-weight: 600; }
.seg.small button { height: 44px; font-size: 13px; }
.fold { height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 14px; border: 1px solid var(--line2); border-radius: 12px; background: var(--bg); font-size: 14px; text-align: left; width: 100%; }
.fold b { font-weight: 600; } .fold span span { color: var(--muted); }
.fold svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.desc { margin: 0; font-size: 13px; color: var(--muted); }

.veil { position: fixed; inset: 0; background: var(--veil); z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; max-height: 92dvh; overflow-y: auto; padding: 10px 16px max(24px, env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; background: var(--bg); display: flex; flex-direction: column; gap: 18px; }
@media (min-width: 900px) { .veil { align-items: center; } .sheet { border-radius: 20px; } }
.sheet .grip { align-self: center; width: 36px; height: 4px; border-radius: 2px; background: var(--line2); }
.sheet h2 { margin: 0; font-size: 18px; font-weight: 600; }
.sheet .hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ink); }

.step { display: flex; gap: 12px; min-height: 44px; padding: 8px 16px; border: 0; background: none; text-align: left; align-items: baseline; width: 100%; }
.step time { width: 40px; flex-shrink: 0; font-size: 12px; color: var(--muted); }
.step .lbl { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; min-width: 0; }
.step.open { background: var(--soft); font-weight: 500; }
.step.mark { min-height: 32px; padding-top: 4px; padding-bottom: 4px; }
.step.live .lbl::before { content: '● '; color: var(--green); }
.out-badge { padding: 2px 8px; border-radius: 6px; background: var(--warn-bg); color: var(--warn-ink); font-size: 11px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.detail { padding: 0 16px 12px 68px; background: var(--soft); display: flex; flex-direction: column; gap: 8px; }
.detail pre.out { margin: 0; max-height: 50dvh; overflow: auto; }

.login { flex: 1; display: flex; flex-direction: column; padding: 0 24px max(24px, env(safe-area-inset-bottom)); max-width: 440px; margin: 0 auto; }
.login main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.logo { width: 64px; height: 64px; border-radius: 16px; background: #16181D; display: flex; flex-direction: column; justify-content: center; gap: 7px; padding: 0 16px; }
.logo span { height: 5px; border-radius: 3px; background: #FFFFFF; } .logo span:first-child { background: #7DA2FF; } .logo span:last-child { width: 60%; }
.login h1 { margin: 8px 0 0; font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.login p { margin: 0; color: var(--muted); }
.box { border: 1px solid var(--line); border-radius: 14px; }
.box > * { padding: 12px 14px; } .box > * + * { border-top: 1px solid var(--line); }
.kv { display: flex; justify-content: space-between; gap: 12px; align-items: center; font-size: 14px; }
.kv select, .kv input { height: 40px; border: 1px solid var(--line2); border-radius: 10px; background: var(--bg); padding: 0 8px; }
