/* Kith web UI. Plain CSS, no frameworks: tokens first, then layout, then components. */

:root {
    --bg: #f6f5f2;
    --surface: #ffffff;
    --surface-2: #f0eeea;
    --border: #e1ded7;
    --text: #22262a;
    --muted: #6b7076;
    --accent: #4f7a67;
    --accent-ink: #ffffff;
    --accent-soft: #e3eee8;
    --warn: #9a6b12;
    --warn-soft: #fbf1dc;
    --danger: #b3412f;
    --danger-soft: #f8e4df;
    --ok: #2f7a4d;
    --ok-soft: #e1f2e7;
    --user-bubble: #e8efe9;
    --code-bg: #f1efe9;
    --diff-add: #e3f3e6;
    --diff-del: #f8e3e0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 2px 8px rgba(0, 0, 0, .04);
    --radius: 10px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #16181a;
        --surface: #1e2124;
        --surface-2: #25292d;
        --border: #33383d;
        --text: #e4e6e8;
        --muted: #9aa1a8;
        --accent: #7fb29a;
        --accent-ink: #10201a;
        --accent-soft: #233630;
        --warn: #e0b45c;
        --warn-soft: #3a3020;
        --danger: #ec8a78;
        --danger-soft: #3d2420;
        --ok: #79c795;
        --ok-soft: #1f3528;
        --user-bubble: #243530;
        --code-bg: #2a2e33;
        --diff-add: #1f3a28;
        --diff-del: #43231f;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3);
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; font-weight: 600; margin: 0 0 .75rem; }
h1:focus { outline: none; }
h2 { font-size: 1.1rem; font-weight: 600; margin: 1.5rem 0 .6rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 1rem 0 .4rem; }
code, pre, .mono { font-family: var(--mono); font-size: .88em; }
pre { white-space: pre-wrap; word-break: break-word; margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.pad { padding: 1rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }

/* ---------- Forms and buttons ---------- */

input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .45rem .6rem;
    width: 100%;
    min-width: 0;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; line-height: 1.45; }
textarea.code, .code { font-family: var(--mono); font-size: .85rem; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 1rem; height: 1rem; vertical-align: -2px; }
label { display: block; font-size: .9rem; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: .25rem; color: var(--text); }
label.check { display: inline-flex; align-items: center; gap: .4rem; color: var(--text); cursor: pointer; }
.hint { display: block; font-size: .8rem; color: var(--muted); margin-top: .2rem; }

button, .button {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 8px;
    padding: .4rem .8rem;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    color: var(--text);
}
button:hover:not(:disabled), .button:hover { background: var(--surface-2); text-decoration: none; }
button:disabled { opacity: .55; cursor: default; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover:not(:disabled) { filter: brightness(1.06); background: var(--accent); }
button.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
button.danger:hover:not(:disabled) { background: var(--danger-soft); }
button.ghost { background: transparent; border-color: transparent; }
button.ghost:hover:not(:disabled) { background: var(--surface-2); }
button.small, .button.small { padding: .2rem .55rem; font-size: .85rem; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); }
button.link:hover { text-decoration: underline; background: none; }

.stack { display: flex; flex-direction: column; gap: .8rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.top { align-items: flex-start; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
form.inline { display: inline; margin: 0; }

/* ---------- Shell ---------- */

.shell {
    display: grid;
    grid-template-columns: 200px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas: "top top" "nav main";
    height: 100vh;
    height: 100dvh;
}
.topbar {
    grid-area: top;
    display: flex; align-items: center; gap: .75rem;
    padding: .5rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    min-height: 52px;
}
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: .9rem; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand { font-weight: 650; font-size: 1.1rem; color: var(--text); display: inline-flex; align-items: center; gap: .45rem; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.brand .dot { width: .8rem; height: .8rem; border-radius: 50%; background: var(--accent); display: inline-block; }
.brand.big { font-size: 1.5rem; margin-bottom: 1.25rem; }
.nav-toggle { display: none; font-size: 1.2rem; }
.inbox-link { color: var(--text); font-size: .95rem; display: inline-flex; align-items: center; gap: .35rem; }
.badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.25rem; height: 1.25rem; padding: 0 .35rem;
    background: var(--danger); color: #fff; border-radius: 999px; font-size: .72rem; font-weight: 600;
}
.sidenav {
    grid-area: nav;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: .75rem .5rem;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 1px;
}
.sidenav a {
    display: flex; align-items: center; justify-content: space-between;
    padding: .4rem .7rem; border-radius: 7px; color: var(--text); font-size: .93rem;
}
.sidenav a:hover { background: var(--surface-2); text-decoration: none; }
.sidenav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 550; }
.nav-sep { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .9rem .7rem .3rem; }
.content { grid-area: main; overflow-y: auto; min-width: 0; }
.page { max-width: 980px; margin: 0 auto; padding: 1.25rem 1.25rem 3rem; }
.page.wide { max-width: 1280px; }
.page-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.page-head h1 { margin: 0; flex: 1; }

.nav-signout { display: none; margin-top: auto; padding: .6rem .7rem; }
@media (max-width: 800px) {
    .shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
    .topbar { gap: .5rem; padding: .5rem .6rem; min-width: 0; }
    .topbar .signout, .stop .wide { display: none; }
    .nav-signout { display: block; }
    .chat-head { padding: .5rem .6rem; }
    .chat-head h1 { min-width: 0; }
    .composer { padding: .5rem .6rem .6rem; }
    .nav-toggle { display: inline-flex; }
    .sidenav { display: none; position: fixed; top: 52px; left: 0; bottom: 0; width: 240px; z-index: 30; box-shadow: var(--shadow); }
    .shell.nav-open .sidenav { display: flex; }
    .topbar .who { display: none; }
    .page { padding: 1rem .8rem 3rem; }
}

/* ---------- Auth pages ---------- */

.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 2rem; width: 100%; max-width: 400px; box-shadow: var(--shadow); }

/* ---------- Cards, tables, alerts ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    margin-bottom: .9rem;
    box-shadow: var(--shadow);
}
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.card.flat { box-shadow: none; }
.card.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background: var(--warn-soft); }
.card-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.card-head h3 { margin: 0; flex: 1; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .9rem; }

.alert { border-radius: 8px; padding: .55rem .8rem; margin: .5rem 0; background: var(--surface-2); border: 1px solid var(--border); font-size: .92rem; }
.alert.error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); color: var(--danger); }
.alert.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); color: var(--ok); }
.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); color: var(--warn); }

.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.list th { text-align: left; font-weight: 550; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; padding: .4rem .5rem; border-bottom: 1px solid var(--border); }
table.list td { padding: .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.list tr.total td { font-weight: 600; }

.pill {
    display: inline-flex; align-items: center; gap: .25rem;
    font-size: .72rem; padding: .05rem .45rem; border-radius: 999px;
    background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
    white-space: nowrap; vertical-align: 1px;
}
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: .5rem .8rem; color: var(--muted); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs button:hover:not(:disabled) { background: none; color: var(--text); }

.empty { color: var(--muted); padding: 1.25rem; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }
details > summary { cursor: pointer; color: var(--muted); font-size: .88rem; }
details > summary:hover { color: var(--text); }
.secret { font-family: var(--mono); background: var(--code-bg); padding: .5rem .7rem; border-radius: 8px; word-break: break-all; user-select: all; }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; background: var(--accent); }

/* ---------- Stop button ---------- */

.stop { background: var(--danger); color: #fff; border-color: var(--danger); font-weight: 650; }
.stop:hover:not(:disabled) { background: var(--danger) !important; filter: brightness(1.1); }
.stop.big { font-size: 1.15rem; padding: .8rem 1.6rem; letter-spacing: .03em; border-radius: 12px; }
.stop-wrap { display: inline-flex; align-items: center; gap: .5rem; position: relative; }
.stop-msg { font-size: .82rem; color: var(--muted); }
.stop-wrap.compact .stop-msg {
    position: absolute; top: 2.2rem; right: 0; z-index: 40; width: 16rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .4rem .6rem; box-shadow: var(--shadow);
}

/* ---------- Diff ---------- */

.diff { font-family: var(--mono); font-size: .82rem; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.diff .ln { display: flex; white-space: pre-wrap; word-break: break-word; padding: 0 .5rem; }
.diff .ln .mark { width: 1.2rem; flex: none; color: var(--muted); user-select: none; }
.diff .ln.add { background: var(--diff-add); }
.diff .ln.del { background: var(--diff-del); }
.diff .skip { color: var(--muted); font-size: .75rem; padding: .1rem .5rem; background: var(--surface-2); }

/* ---------- Markdown output ---------- */

.md p { margin: 0 0 .5rem; }
.md p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: .25rem 0 .5rem; padding-left: 1.4rem; }
.md pre { background: var(--code-bg); padding: .6rem .75rem; border-radius: 8px; margin: .4rem 0; overflow-x: auto; }
.md code { background: var(--code-bg); padding: .05rem .3rem; border-radius: 4px; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: .3rem 0; padding-left: .7rem; border-left: 3px solid var(--border); color: var(--muted); }
.md h4, .md h5, .md h6 { margin: .5rem 0 .3rem; font-size: 1rem; }
.md .subtext { font-size: .8rem; color: var(--muted); }

/* ---------- Chat ---------- */

.chat { display: grid; grid-template-columns: 270px 1fr; height: 100%; min-height: 0; }
.chat-side { border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.chat-side .agent-pick { padding: .7rem; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: .5rem; }
.chat-side .sessions { overflow-y: auto; padding: .3rem .4rem 1rem; flex: 1; }
.group-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .8rem .5rem .25rem; display: flex; justify-content: space-between; }
.sess { display: block; padding: .45rem .55rem; border-radius: 8px; color: var(--text); }
.sess:hover { background: var(--surface-2); text-decoration: none; }
.sess.on { background: var(--accent-soft); }
.sess .t { display: flex; align-items: center; gap: .35rem; font-size: .92rem; }
.sess .t .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess .s { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.busy-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; flex: none; }
@keyframes pulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: .6rem; padding: .55rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.chat-head h1 { font-size: 1.05rem; margin: 0; flex: 1; min-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .status-line { flex-basis: 100%; font-size: .8rem; color: var(--muted); margin-top: -.2rem; }
.chat-tools { padding: .6rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.transcript { flex: 1; overflow-y: auto; padding: 1rem 1rem .5rem; display: flex; flex-direction: column; gap: .7rem; }
.transcript-inner { max-width: 820px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: .7rem; }
.msg { display: flex; flex-direction: column; max-width: 100%; }
.msg .meta { font-size: .75rem; color: var(--muted); margin-bottom: .15rem; display: flex; gap: .5rem; }
.msg .body { padding: .55rem .8rem; border-radius: 12px; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.user { align-items: flex-end; }
.msg.user .body { background: var(--user-bubble); border-bottom-right-radius: 4px; max-width: 85%; }
.msg.assistant .body { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; max-width: 92%; }
.msg.assistant.streaming .md > :last-child::after { content: "▍"; color: var(--accent); animation: pulse 1s infinite; margin-left: 1px; }
.msg .reactions { font-size: 1.1rem; margin-top: .2rem; }
.msg.redacted .body { font-style: italic; color: var(--muted); }
.msg-images { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0; }
.msg-images img { max-width: min(320px, 100%); max-height: 320px; border-radius: 8px; border: 1px solid var(--border); display: block; cursor: zoom-in; background: var(--surface-2); }
.msg-images img.emoji { max-width: 48px; max-height: 48px; border: 0; cursor: default; }
.sys { font-size: .8rem; color: var(--muted); text-align: center; padding: 0 1rem; }
.sys.error { color: var(--danger); }
.sys.device { font-family: var(--mono); color: var(--warn); }
.sys.thread a { font-weight: 550; }
.tool { font-size: .82rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); margin-top: .35rem; max-width: 92%; }
.tool > summary { padding: .3rem .6rem; list-style: none; display: flex; gap: .4rem; align-items: center; }
.tool > summary::-webkit-details-marker { display: none; }
.tool > summary::before { content: "▸"; color: var(--muted); }
.tool[open] > summary::before { content: "▾"; }
.tool .tool-body { padding: .2rem .6rem .5rem; display: flex; flex-direction: column; gap: .35rem; }
.tool .tool-body pre { background: var(--surface); padding: .4rem .5rem; border-radius: 6px; max-height: 260px; overflow: auto; }
.tool .err { color: var(--danger); }

.prompt-card { border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--surface); border-radius: 12px; padding: .8rem .9rem; box-shadow: var(--shadow); }
.prompt-card .p-title { font-weight: 600; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.prompt-card .p-body { margin: .4rem 0; font-size: .92rem; }
.prompt-card .p-body pre { background: var(--code-bg); padding: .5rem .6rem; border-radius: 8px; max-height: 300px; overflow: auto; }
.prompt-card .setup-block { margin: .5rem 0; }
.prompt-card .setup-block h4 { margin: 0 0 .2rem; font-size: .85rem; font-family: var(--mono); }
.prompt-card .extra { margin-top: .6rem; padding-top: .6rem; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: .5rem; }

.composer { border-top: 1px solid var(--border); background: var(--surface); padding: .6rem 1rem .8rem; }
.composer-inner { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: .45rem; }
.composer textarea { min-height: 2.6rem; max-height: 14rem; flex: 1; min-width: 0; width: auto; }
.composer .row { flex-wrap: nowrap; }
.composer .opts { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.composer .opts select { width: auto; padding: .2rem .4rem; }
.attachments { display: flex; gap: .4rem; flex-wrap: wrap; }
.attachment { position: relative; }
.attachment img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.attachment button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; padding: 0; border-radius: 50%; font-size: .7rem; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .8); display: flex; align-items: center; justify-content: center; z-index: 100; cursor: zoom-out; }
.lightbox img { max-width: 95vw; max-height: 95vh; border-radius: 8px; }

@media (max-width: 800px) {
    .chat { grid-template-columns: 1fr; }
    .chat-side { display: none; border-right: 0; }
    .chat.show-side .chat-side { display: flex; }
    .chat.show-side .chat-main { display: none; }
    .msg.user .body, .msg.assistant .body { max-width: 100%; }
}
.side-toggle { display: none; }
@media (max-width: 800px) { .side-toggle { display: inline-flex; } }

/* ---------- Memory editor ---------- */

.block-card textarea { min-height: 7rem; font-size: .92rem; }
.count { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.count.near { color: var(--warn); }
.count.over { color: var(--danger); font-weight: 600; }
.versions { display: flex; flex-direction: column; gap: .25rem; max-height: 260px; overflow-y: auto; }
.versions button { justify-content: flex-start; text-align: left; font-size: .85rem; }
.versions button.on { background: var(--accent-soft); border-color: transparent; }
.conflict { border: 1px solid color-mix(in srgb, var(--warn) 50%, var(--border)); background: var(--warn-soft); border-radius: 8px; padding: .7rem; margin-top: .6rem; }

/* ---------- Blazor bits ---------- */

#blazor-error-ui {
    background: var(--warn-soft); color: var(--text); bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
.blazor-error-boundary { background: var(--danger-soft); padding: 1rem; color: var(--danger); border-radius: 8px; }
.blazor-error-boundary::after { content: "Something on this page failed to render."; }

/* ---------- Approvals ---------- */

dl.approval-fields { display: grid; grid-template-columns: 9rem 1fr; gap: .4rem .8rem; margin: .7rem 0; font-size: .93rem; }
dl.approval-fields dt { color: var(--muted); font-size: .85rem; padding-top: .1rem; }
dl.approval-fields dd { margin: 0; min-width: 0; }
.approval .extra { margin-top: .6rem; padding-top: .6rem; border-top: 1px dashed var(--border); }
@media (max-width: 600px) { dl.approval-fields { grid-template-columns: 1fr; } dl.approval-fields dt { padding-top: .4rem; } }

/* ---------- Toasts ---------- */

.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 90; display: flex; flex-direction: column; gap: .5rem; max-width: min(26rem, calc(100vw - 2rem)); }
.toast { display: flex; gap: .5rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; padding: .55rem .7rem; box-shadow: var(--shadow); font-size: .9rem; }

/* Retry controls under the latest reply */
.retry-bar { display: flex; flex-direction: column; align-items: flex-start; margin-top: -.3rem; }
.retry-bar.mine { align-items: flex-end; }
.retry-bar > .row { gap: .2rem; }
.retry-bar > .row button { color: var(--muted); }
.retry-bar > .row button:hover:not(:disabled) { color: inherit; }
.retry-bar .card { width: min(36rem, 100%); }
