/* Top bar, chat messages, code blocks, composer. */
/* main */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { padding: 10px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; background: var(--panel); min-height: 53px; }
.topbar .title { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 8px; font-family: "JetBrains Mono", monospace; }
.ctx-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 99px; padding: 3px 10px 3px 5px; font-size: 12px; background: none; }
.ctx-pill .num { font-weight: 600; font-variant-numeric: tabular-nums; }
.only-narrow, .only-mobile { display: none; }
.chat { flex: 1; overflow-y: auto; padding: 24px 20px; position: relative; }
.chat-inner { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.empty { color: var(--muted); text-align: center; margin-top: 16vh; }
.empty h2 { color: var(--text); margin: 0 0 6px; font-size: 20px; }
.u-wrap { align-self: flex-end; max-width: 85%; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.msg-user { background: var(--user-bg); padding: 10px 14px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; word-wrap: break-word; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); background: var(--panel); border-radius: 99px; padding: 2px 9px; font-size: 12px; max-width: 260px; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.skill { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
button.chip:hover { background: var(--panel-2); }
.chip .x { border: 0; background: none; padding: 0; color: var(--muted); line-height: 1; font-size: 14px; }
.msg-ai { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); word-wrap: break-word; }
.msg-ai.error { border-color: var(--err); }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md pre { background: var(--code-bg); padding: 10px 12px; border-radius: 8px; overflow-x: auto; }
.md code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.md pre code { background: none; padding: 0; }
.code-wrap { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin: .8em 0; background: var(--code-bg); }
.code-wrap pre { margin: 0; border-radius: 0; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 12px; border-bottom: 1px solid var(--border); font-size: 11.5px; color: var(--muted); font-family: "JetBrains Mono", monospace; }
.code-copy { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; color: var(--muted); font-size: 12px; padding: 3px 7px; border-radius: 6px; font-family: "Plus Jakarta Sans", system-ui, sans-serif; }
.code-copy:hover { background: var(--panel-2); color: var(--text); }
.code-copy.done { color: var(--ok); }
.code-copy .i { width: 13px; height: 13px; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; } .md th, .md td { border: 1px solid var(--border); padding: 4px 8px; }
.meta { color: var(--muted); font-size: 12px; margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--panel-2); text-transform: uppercase; letter-spacing: .03em; }
.badge.done { color: var(--ok); } .badge.error { color: var(--err); } .badge.running, .badge.queued { color: var(--warn); }
.thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.linkish { border: 0; background: none; color: var(--muted); padding: 0; font-size: 12px; }
.linkish:hover { color: var(--text); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.divider.error { color: var(--err); }
.drop-hint { position: absolute; inset: 12px; border: 2px dashed var(--accent); border-radius: 14px; background: color-mix(in srgb, var(--bg) 85%, transparent); display: none; align-items: center; justify-content: center; font-weight: 600; color: var(--accent); z-index: 5; pointer-events: none; }
.dragging .drop-hint { display: flex; }

/* composer */
.composer { border-top: 1px solid var(--border); background: var(--panel); padding: 12px 20px 14px; }
.composer-inner { max-width: 820px; margin: 0 auto; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); padding: 8px 10px; }
.composer-inner:focus-within { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.composer .chips { justify-content: flex-start; margin-bottom: 6px; }
.composer textarea { width: 100%; border: 0; background: none; resize: none; outline: none; min-height: 44px; max-height: 240px; padding: 4px 2px; }
.composer-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.composer-row .grow { flex: 1; }
.composer select { border: 1px solid var(--border); border-radius: 8px; background: var(--panel); padding: 5px 8px; }
