/* Visual language follows claude.ai: warm paper neutrals, clay accent,
   serif answers, a floating composer and a quiet sidebar. */
:root {
  --bg: #faf9f5;
  --side: #f5f4ee;
  --panel: #ffffff;
  --raised: #f5f4ef;
  --hover: rgba(31, 30, 29, .06);
  --active: rgba(31, 30, 29, .09);
  --text: #141413;
  --muted: #6f6d66;
  --faint: #a09e96;
  --border: #e6e4dc;
  --border-strong: #d6d3c9;
  --accent: #c96442;
  --accent-hover: #b7593a;
  --accent-soft: #f4e5dd;
  --user-bg: #f0eee6;
  --code-bg: #f5f4ef;
  --ok: #2f8f5b;
  --busy: #c98a1b;
  --err: #b9382a;
  --add-bg: #e6f4ea; --add-fg: #1e6b3a;
  --del-bg: #fbe9e7; --del-fg: #a3271a;
  --shadow: 0 .25rem 1.25rem rgba(0, 0, 0, .035), 0 0 0 .5px rgba(0, 0, 0, .06);
  --shadow-pop: 0 8px 30px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .08);
  --serif: "Tiempos Text", ui-serif, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #262624; --side: #1f1e1d; --panel: #30302e; --raised: #2b2a27;
    --hover: rgba(236, 233, 225, .06); --active: rgba(236, 233, 225, .1);
    --text: #f0eee6; --muted: #a6a39a; --faint: #78766f;
    --border: #3b3a37; --border-strong: #4b4a46;
    --accent: #d97757; --accent-hover: #e2876a; --accent-soft: #45302a;
    --user-bg: #141413; --code-bg: #1f1e1d;
    --add-bg: #1f3527; --add-fg: #8fd6a6; --del-bg: #3d2320; --del-fg: #f2a69a;
    --shadow: 0 .25rem 1.25rem rgba(0, 0, 0, .25), 0 0 0 .5px rgba(255, 255, 255, .06);
    --shadow-pop: 0 8px 30px rgba(0, 0, 0, .45), 0 0 0 .5px rgba(255, 255, 255, .08);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #262624; --side: #1f1e1d; --panel: #30302e; --raised: #2b2a27;
  --hover: rgba(236, 233, 225, .06); --active: rgba(236, 233, 225, .1);
  --text: #f0eee6; --muted: #a6a39a; --faint: #78766f;
  --border: #3b3a37; --border-strong: #4b4a46;
  --accent: #d97757; --accent-hover: #e2876a; --accent-soft: #45302a;
  --user-bg: #141413; --code-bg: #1f1e1d;
  --add-bg: #1f3527; --add-fg: #8fd6a6; --del-bg: #3d2320; --del-fg: #f2a69a;
  --shadow: 0 .25rem 1.25rem rgba(0, 0, 0, .25), 0 0 0 .5px rgba(255, 255, 255, .06);
  --shadow-pop: 0 8px 30px rgba(0, 0, 0, .45), 0 0 0 .5px rgba(255, 255, 255, .08);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
svg { display: block; }
.muted { color: var(--muted); }
.error { color: var(--err); font-size: 13px; min-height: 1.2em; }
.spacer { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--panel); border-radius: 9px; padding: 7px 14px; cursor: pointer; font-size: 14px; }
.btn:hover { background: var(--raised); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.danger-fill { background: var(--err); border-color: var(--err); color: #fff; }
.btn.small { padding: 3px 10px; font-size: 13px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; font-size: 20px; line-height: 1; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
input, textarea { width: 100%; background: var(--panel); border: 1px solid var(--border-strong); border-radius: 10px; padding: 9px 12px; outline: none; }
input:focus { border-color: var(--accent); }

/* ── login ── */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); display: grid; gap: 12px; text-align: center; background: var(--panel); border-radius: 20px; padding: 34px 28px; box-shadow: var(--shadow); }
.login-card h1 { margin: 0; font: 400 30px var(--serif); }
.login-card p { margin: 0 0 8px; }
.login-logo { width: 46px; height: 46px; margin: 0 auto; }

/* ── layout ── */
.app { height: 100dvh; display: grid; grid-template-columns: 272px 1fr; transition: grid-template-columns .2s ease; }
.app.collapsed { grid-template-columns: 0 1fr; }
.app.collapsed .sidebar { visibility: hidden; }
.sidebar { background: var(--side); border-right: .5px solid var(--border); display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 6px 14px; }
.brand { display: flex; align-items: center; gap: 8px; font: 500 19px var(--serif); text-decoration: none; }
.brand img { width: 24px; height: 24px; }
.new-chat { display: flex; align-items: center; gap: 10px; margin: 6px 8px 4px; padding: 7px 8px; border-radius: 10px; text-decoration: none; font-weight: 500; color: var(--text); }
.new-chat:hover { background: var(--hover); }
.new-ico { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.new-ico svg { width: 14px; height: 14px; }
.search-wrap { padding: 4px 10px 6px; }
.search-wrap input { padding: 6px 10px; font-size: 13.5px; background: transparent; border-color: var(--border); }
.session-list { overflow-y: auto; flex: 1; padding: 0 6px 10px; }
.group-label { font-size: 12px; color: var(--muted); padding: 14px 10px 4px; font-weight: 500; }
.s-item { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; border-radius: 8px; cursor: pointer; text-decoration: none; color: var(--text); font-size: 14px; position: relative; min-height: 34px; }
.s-item:hover { background: var(--hover); }
.s-item.active { background: var(--active); }
.s-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-item.unread .s-name { font-weight: 650; }
.s-item .dot { flex: none; }
.s-more { flex: none; width: 26px; height: 26px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; opacity: 0; }
.s-item:hover .s-more, .s-item.menu-open .s-more, .s-item.active .s-more { opacity: 1; }
.s-more:hover { background: var(--active); color: var(--text); }
.s-more svg { width: 16px; height: 16px; }
@media (hover: none) { .s-more { opacity: .7; } }
.badge { font-size: 10.5px; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 5px; padding: 0 4px; margin-left: 6px; vertical-align: 1px; font-weight: 400; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: transparent; }
.dot.idle { background: var(--ok); }
.dot.active { background: var(--busy); animation: pulse 1.2s infinite; }
.s-item.unread .dot { background: var(--accent); }
@keyframes pulse { 50% { opacity: .3; } }
.side-foot { padding: 8px; border-top: .5px solid var(--border); }
.profile { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 6px; border-radius: 10px; cursor: pointer; text-align: left; }
.profile:hover { background: var(--hover); }
.initials { width: 30px; height: 30px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.who { flex: 1; display: grid; font-size: 13.5px; line-height: 1.25; }
.who .muted { font-size: 12px; }
.conn { width: 8px; height: 8px; border-radius: 50%; background: var(--err); }
.conn.on { background: var(--ok); }
.scrim { display: none; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.topbar { display: flex; align-items: center; gap: 4px; padding: 8px 12px; min-height: 52px; }
.show-collapsed { display: none; }
.app.collapsed .show-collapsed { display: inline-grid; }
.title-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; padding: 5px 8px; border-radius: 8px; cursor: pointer; max-width: min(560px, 60vw); font-size: 14.5px; }
.title-btn:hover { background: var(--hover); }
.title-btn #chat-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev-down { width: 14px; height: 14px; color: var(--muted); flex: none; }
.chat-state { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; margin-right: 4px; }

/* ── thread ── */
.scroller { flex: 1; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
.thread { width: 100%; max-width: 768px; margin: 0 auto; padding: 12px 24px 32px; display: flex; flex-direction: column; gap: 16px; }
.thread:empty { display: none; }
.loader-row { text-align: center; color: var(--faint); font-size: 13px; padding: 6px; }
.home { flex: 1; display: flex; align-items: flex-end; justify-content: center; padding: 0 24px 28px; }
.greet { display: flex; align-items: center; gap: 14px; }
.greet img { width: 40px; height: 40px; }
.greet h1 { margin: 0; font: 300 clamp(28px, 4.2vw, 40px)/1.2 var(--serif); letter-spacing: -.01em; }

.u-msg { align-self: flex-end; max-width: 80%; background: var(--user-bg); border-radius: 18px; padding: 10px 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.u-msg.pending { opacity: .6; }
.u-msg .att { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.u-msg .att span { font-size: 12.5px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 2px 8px; }
.a-msg { font: 16.5px/1.65 var(--serif); overflow-wrap: anywhere; padding: 0 2px; }
.a-msg > :first-child { margin-top: 0; }
.a-msg p { margin: 0 0 14px; }
.a-msg h1, .a-msg h2, .a-msg h3, .a-msg h4 { font-family: var(--serif); font-weight: 600; line-height: 1.3; margin: 22px 0 10px; }
.a-msg h1 { font-size: 1.4em; } .a-msg h2 { font-size: 1.22em; } .a-msg h3, .a-msg h4 { font-size: 1.06em; }
.a-msg ul, .a-msg ol { margin: 0 0 14px; padding-left: 26px; }
.a-msg li { margin: 4px 0; }
.a-msg blockquote { margin: 0 0 14px; padding: 2px 16px; border-left: 3px solid var(--border-strong); color: var(--muted); }
.a-msg hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.a-msg a { color: var(--accent); }
.a-msg table { border-collapse: collapse; margin: 0 0 14px; display: block; overflow-x: auto; max-width: 100%; font: 14px/1.5 var(--sans); }
.a-msg th, .a-msg td { border-bottom: 1px solid var(--border); padding: 7px 12px; text-align: left; vertical-align: top; }
.a-msg th { font-weight: 600; border-bottom-color: var(--border-strong); }
.a-msg code { font-family: var(--mono); font-size: .82em; background: var(--code-bg); border: .5px solid var(--border-strong); border-radius: 5px; padding: 1px 5px; color: var(--del-fg); }
.codebox { border: .5px solid var(--border-strong); border-radius: 10px; overflow: hidden; margin: 0 0 14px; background: var(--code-bg); font-family: var(--sans); }
.codebox-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); padding: 6px 8px 6px 14px; }
.codebox pre { margin: 0; padding: 4px 14px 14px; overflow-x: auto; }
.codebox pre code { background: none !important; border: 0; padding: 0; font-size: 13px; line-height: 1.55; color: inherit; }
.copy-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; padding: 3px 7px; border-radius: 6px; font-family: var(--sans); }
.copy-btn:hover { background: var(--hover); color: var(--text); }
.msg-actions { display: flex; align-items: center; gap: 2px; margin-top: 4px; opacity: 0; transition: opacity .15s; font-family: var(--sans); }
.a-msg:hover .msg-actions, .a-msg.last .msg-actions { opacity: 1; }
.msg-time { font-size: 12px; color: var(--faint); margin-left: 6px; }
.spark-end { width: 22px; height: 22px; margin-top: 2px; }

/* ── tool steps ── */
.steps { border: .5px solid var(--border-strong); border-radius: 12px; background: var(--panel); overflow: hidden; font-size: 13.5px; }
.steps-head { display: flex; align-items: center; gap: 8px; padding: 9px 14px; cursor: pointer; color: var(--muted); user-select: none; }
.steps-head:hover { color: var(--text); background: var(--hover); }
.steps-head .chev { transition: transform .15s; width: 14px; height: 14px; flex: none; }
.steps.open .steps-head .chev { transform: rotate(180deg); }
.steps-head .sum { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps-body { display: none; border-top: .5px solid var(--border); padding: 4px 0; }
.steps.open .steps-body { display: block; }
.step-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; padding: 6px 14px; cursor: pointer; }
.step-row:hover { background: var(--hover); }
.step-ico { color: var(--muted); display: grid; place-items: center; }
.step-ico svg { width: 15px; height: 15px; }
.step-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-title code { font-family: var(--mono); font-size: 12.5px; }
.step-stat { font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 6px; }
.step-stat .ok { color: var(--ok); } .step-stat .bad { color: var(--err); }
.step-detail { display: none; padding: 2px 14px 12px 44px; }
.step.open .step-detail { display: block; }
.step-detail pre, .term { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; background: var(--code-bg); border: .5px solid var(--border-strong); border-radius: 8px; padding: 9px 11px; margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 340px; overflow: auto; }
.term .cmd { color: var(--accent); font-weight: 700; }
.cmdbox { max-height: 180px !important; }
.term.err { color: var(--err); }
.lbl { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; margin-top: 10px; }
.diff { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; border: .5px solid var(--border-strong); border-radius: 8px; overflow: auto; max-height: 420px; margin-top: 6px; background: var(--panel); }
.diff div { white-space: pre; padding: 0 10px; min-width: max-content; }
.diff .add { background: var(--add-bg); color: var(--add-fg); }
.diff .del { background: var(--del-bg); color: var(--del-fg); }
.diff .hunk { color: var(--faint); background: var(--raised); }
.todo { list-style: none; padding: 0; margin: 6px 0 0; }
.todo li { display: flex; gap: 8px; padding: 2px 0; }
.todo .done { color: var(--muted); text-decoration: line-through; }
.spin { width: 12px; height: 12px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── dock / composer ── */
.dock { padding: 0 16px calc(10px + env(safe-area-inset-bottom)); }
.dock > * { max-width: 768px; margin-left: auto; margin-right: auto; }
.app.home-mode .dock { flex: 1 1 auto; padding-bottom: 22vh; }
.app.home-mode .scroller { flex: 0 1 auto; min-height: 30vh; }
.working { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); padding: 0 8px 10px; }
.working #working-text { flex: 1; background: linear-gradient(90deg, var(--muted) 0%, var(--text) 50%, var(--muted) 100%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spark, .spark-end { display: inline-block; background: var(--accent); -webkit-mask: url("/static/spark.svg") center / contain no-repeat; mask: url("/static/spark.svg") center / contain no-repeat; }
.spark { width: 16px; height: 16px; animation: spin 2.4s linear infinite; }
.gone-card { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: .5px solid var(--border-strong); background: var(--raised); border-radius: 14px; padding: 9px 12px; margin-bottom: 10px; font-size: 14px; }
.gone-card > span:first-child { flex: 1; min-width: 200px; }
.gone-actions { display: flex; gap: 6px; }
.prompt-card { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; }
.prompt-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.prompt-head .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; }
.prompt-card pre { font: 12px/1.45 var(--mono); white-space: pre-wrap; max-height: 30vh; overflow: auto; margin: 8px 0; background: var(--panel); border-radius: 8px; padding: 8px 10px; }
.keys { display: flex; flex-wrap: wrap; gap: 6px; }
.keys button { min-width: 38px; border: .5px solid var(--border-strong); background: var(--panel); border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
.keys button:hover { border-color: var(--accent); }
.composer { background: var(--panel); border-radius: 20px; box-shadow: var(--shadow); padding: 12px 12px 10px 16px; border: .5px solid transparent; transition: box-shadow .15s; }
.composer:focus-within { box-shadow: 0 .25rem 1.25rem rgba(0,0,0,.06), 0 0 0 .5px var(--border-strong); }
.composer.drag { box-shadow: 0 0 0 2px var(--accent); }
.composer textarea { border: 0; padding: 2px 0 8px; resize: none; max-height: 40vh; background: transparent; line-height: 1.5; font-size: 15.5px; min-height: 28px; }
.app.home-mode .composer textarea { min-height: 52px; }
.composer-bar { display: flex; align-items: center; gap: 6px; }
.tool-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; min-width: 32px; justify-content: center; border: .5px solid var(--border-strong); background: transparent; border-radius: 9px; cursor: pointer; color: var(--muted); padding: 0 8px; font-size: 13px; }
.tool-btn svg { width: 16px; height: 16px; }
.tool-btn:hover { background: var(--hover); color: var(--text); }
.tool-btn.chip.on { color: #229ed9; border-color: #229ed9; background: color-mix(in srgb, #229ed9 10%, transparent); }
.model-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; padding: 5px 8px; cursor: pointer; font-size: 13.5px; }
.model-btn:hover { background: var(--hover); color: var(--text); }
.model-btn svg { width: 14px; height: 14px; }
.send-btn { width: 32px; height: 32px; border-radius: 9px; border: 0; background: var(--accent); color: #fff; cursor: pointer; display: grid; place-items: center; }
.send-btn svg { width: 17px; height: 17px; }
.send-btn:hover { background: var(--accent-hover); }
.send-btn:disabled { opacity: .4; cursor: default; background: var(--accent); }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; }
.attachments:not(:empty) { margin-bottom: 10px; }
.att-card { position: relative; display: flex; align-items: center; gap: 8px; border: .5px solid var(--border-strong); border-radius: 10px; padding: 6px 28px 6px 8px; max-width: 220px; background: var(--raised); font-size: 12.5px; }
.att-card .ext { width: 32px; height: 32px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 10px; font-weight: 700; text-transform: uppercase; flex: none; overflow: hidden; }
.att-card .ext img { width: 100%; height: 100%; object-fit: cover; }
.att-card .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-card button { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--active); cursor: pointer; font-size: 11px; color: var(--muted); }
.disclaimer { text-align: center; font-size: 11.5px; padding-top: 6px; min-height: 18px; }
.jump-btn { position: absolute; left: 50%; transform: translateX(-50%); bottom: 140px; width: 34px; height: 34px; border-radius: 50%; border: .5px solid var(--border-strong); background: var(--panel); box-shadow: var(--shadow); cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.jump-btn svg { width: 16px; height: 16px; }

.pane { border-bottom: .5px solid var(--border); background: var(--raised); padding: 10px 16px; }
.pane pre { margin: 0 auto 8px; max-width: 768px; max-height: 38vh; overflow: auto; font: 12px/1.45 var(--mono); background: #141413; color: #e8e6df; padding: 10px; border-radius: 10px; white-space: pre; }
.pane .keys { max-width: 768px; margin: 0 auto; }

/* ── popovers ── */
.menu { position: fixed; z-index: 50; min-width: 220px; max-height: 70vh; overflow-y: auto; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 5px; font-size: 14px; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 7px 10px; border-radius: 8px; cursor: pointer; text-align: left; text-decoration: none; color: var(--text); }
.menu button:hover, .menu a:hover { background: var(--hover); }
.menu .ico { width: 16px; height: 16px; color: var(--muted); display: grid; place-items: center; }
.menu .ico svg { width: 16px; height: 16px; }
.menu .danger { color: var(--err); }
.menu .danger .ico { color: var(--err); }
.menu .sep { height: 1px; background: var(--border); margin: 4px 6px; }
.menu .label { padding: 6px 10px 2px; font-size: 12px; color: var(--muted); }
.menu .check { margin-left: auto; color: var(--accent); }
.menu .sub { display: block; font-size: 12px; color: var(--muted); }
.dialog { border: 0; border-radius: 16px; background: var(--panel); color: var(--text); width: min(440px, calc(100% - 32px)); padding: 22px; box-shadow: var(--shadow-pop); }
.dialog::backdrop { background: rgba(20, 20, 18, .4); }
.dialog form { display: grid; gap: 12px; }
.dialog h3 { margin: 0; font: 500 20px var(--serif); }
.dialog p { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.rename-input { font-size: 14px; padding: 4px 8px; border-radius: 6px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-pop); z-index: 60; max-width: calc(100% - 32px); }

@media (max-width: 820px) {
  .app, .app.collapsed { grid-template-columns: 1fr; }
  .app .sidebar, .app.collapsed .sidebar { visibility: visible; position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 20; transform: translateX(-102%); transition: transform .22s ease; }
  .app.drawer .sidebar { transform: none; box-shadow: 0 0 50px rgba(0,0,0,.3); }
  .app.drawer .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 15; }
  .show-collapsed { display: inline-grid !important; }
  #collapse-btn { display: none; }
  .thread { padding: 10px 14px 24px; }
  .dock { padding-left: 8px; padding-right: 8px; }
  .a-msg { font-size: 16px; }
  .u-msg { max-width: 90%; }
  .title-btn { max-width: 52vw; }
  .chat-state span:last-child { display: none; }
  .app.home-mode .dock { padding-bottom: 14vh; }
}
