/* Aurora — design doux et lisible (indigo / lavande), inspiré du mockup. Aucune dépendance. */
:root {
  --bg: #f9fafd; --side: #f3f4fa; --card: #fff; --line: #e7e9f3; --line-2: #eef0f8;
  --text: #1c2033; --muted: #7b8099; --accent: #5b6cf0; --accent-d: #4a5ae0; --accent-soft: #eceffe;
  --bubble: #e9edfd; --danger: #d9435a; --ok: #2f9e6e;
  --radius: 16px; --shadow: 0 1px 2px rgba(28,32,51,.04), 0 6px 20px rgba(28,32,51,.05);
  --side-w: 300px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; }
.ic { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); font-size: .9rem; }
code { background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; font-size: .9em; }

/* ---------- Layout ---------- */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar { width: var(--side-w); flex: none; background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 16px 12px; gap: 6px; transition: margin-left .2s ease, transform .25s ease; }
.app.collapsed .sidebar { margin-left: calc(var(--side-w) * -1); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.scrim { display: none; }

.side-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 600; font-size: 1.35rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.orb { width: 38px; height: 38px; border-radius: 50%; background: radial-gradient(circle at 32% 28%, #fff 0 12%, #c9d0ff 38%, #8d9cf7 70%, #b8a6f5 100%); box-shadow: 0 2px 10px rgba(91,108,240,.3); flex: none; }
.icon-btn { background: none; border: 0; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: rgba(91,108,240,.08); color: var(--text); }
.new-chat { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; color: var(--text); font-weight: 600; box-shadow: var(--shadow); margin-bottom: 10px; }
.new-chat:hover { text-decoration: none; border-color: #d5d9f3; }
.new-chat .plus { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.new-chat .plus .ic { width: 16px; height: 16px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; color: var(--text); }
.side-nav a:hover { background: rgba(91,108,240,.07); text-decoration: none; }
.side-nav a.active { background: #e6e8f3; font-weight: 600; }
.side-nav a .ic { color: var(--muted); }
.side-nav a.sub { padding-left: 40px; font-size: .95rem; padding-top: 7px; padding-bottom: 7px; color: #454b66; }
.side-nav a.sub .ic { width: 17px; height: 17px; }
.side-title { margin: 14px 8px 4px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
.history { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; overscroll-behavior: contain; }
.hist-item { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 11px; color: var(--text); font-size: .95rem; position: relative; }
.hist-item:hover { background: rgba(91,108,240,.07); text-decoration: none; }
.hist-item.active { background: var(--accent-soft); }
.hist-item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-item .d { color: var(--muted); font-size: .8rem; flex: none; }
.hist-item .proj { color: var(--accent); flex: none; }
.hist-item .proj .ic { width: 14px; height: 14px; }
.hist-empty, .hist-label { color: var(--muted); font-size: .85rem; padding: 8px 10px; }

/* ---------- Topbar ---------- */
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--line-2); background: rgba(255,255,255,.85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); min-height: 72px; flex: none; }
.menu-btn { display: none; }
.top-title { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; }
.sparkle-lg { color: var(--accent); }
.sparkle-lg .ic { width: 30px; height: 30px; }
.tt { min-width: 0; }
.tt-main { font-size: 1.2rem; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-sub { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-tools { display: flex; align-items: center; gap: 10px; flex: none; }
.model-box { display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; padding: 4px; background: #f1f2f8; border: 1px solid var(--line); border-radius: 999px; }
.seg button { display: flex; align-items: center; gap: 7px; border: 0; background: none; padding: 8px 16px; border-radius: 999px; color: var(--muted); font-weight: 500; }
.seg button .ic { width: 17px; height: 17px; }
.seg button.on { background: #e1e6ff; color: var(--accent-d); font-weight: 600; }
#levelSel { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 12px; font-size: .9rem; color: var(--text); }
.cost { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; padding: 4px 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.cost small { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; }
.cost b { font-size: .9rem; font-variant-numeric: tabular-nums; }
.account { position: relative; }
.avatar { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent-soft); color: var(--accent); font-weight: 600; letter-spacing: .02em; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 34px rgba(28,32,51,.14); padding: 6px; z-index: 40; }
.menu.up { top: auto; bottom: calc(100% + 10px); left: 0; right: auto; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 12px 12px; border-radius: 10px; color: var(--text); font-size: .95rem; }
.menu a:hover, .menu button:hover { background: var(--accent-soft); text-decoration: none; }
.menu-email { padding: 8px 12px; color: var(--muted); font-size: .85rem; word-break: break-all; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }

/* ---------- Content / pages ---------- */
.content { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.content-chat { overflow: hidden; display: flex; flex-direction: column; }
.page { max-width: 980px; margin: 0 auto; padding: 28px 24px 60px; }
.page.narrow { max-width: 760px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 1.4rem; display: flex; align-items: center; gap: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card h3 { margin: 0 0 8px; font-size: 1.05rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.proj-card { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--text); box-shadow: var(--shadow); }
.proj-card:hover { text-decoration: none; border-color: #cfd5fa; }
.proj-card h4 { margin: 0 0 4px; font-size: 1.05rem; display: flex; gap: 8px; align-items: center; }
.proj-card p { margin: 0 0 10px; color: var(--muted); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.proj-card .meta { font-size: .8rem; color: var(--muted); }
.note-isolated { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; margin-bottom: 18px; color: #3d4ab5; font-size: .92rem; }
.empty { color: var(--muted); padding: 22px; text-align: center; }

.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--line-2); }
.row:last-child { border-bottom: 0; }
.row .ico { color: var(--accent); }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; color: var(--text); }
.row .sub { color: var(--muted); font-size: .82rem; }
.row .err { color: var(--danger); font-size: .82rem; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 11px 18px; border-radius: 12px; font-weight: 500; min-height: 44px; cursor: pointer; }
.btn:hover { text-decoration: none; border-color: #cfd5fa; background: #fafbff; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-d); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn.icon { padding: 8px; min-height: 40px; min-width: 40px; }

.form label { display: block; margin-bottom: 14px; font-weight: 500; font-size: .92rem; }
.form input:not([type=checkbox]):not([type=file]), .form textarea, .form select, .auth-form input:not([type=checkbox]), .inline-form input, .searchbar input {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-weight: 400; font-size: 16px; }
.form input:focus, .form textarea:focus, .form select:focus, .auth-form input:focus, .inline-form input:focus, .searchbar input:focus { outline: 2px solid #c9d0ff; border-color: var(--accent); }
.form textarea { resize: vertical; }
.cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.or { text-align: center; color: var(--muted); font-size: .85rem; margin: 6px 0 12px; }
.inline-form { display: flex; gap: 10px; margin-bottom: 8px; }
.inline-form input { margin-top: 0; }
.dropzone.drag { outline: 2px dashed var(--accent); }
.checklist { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; margin: 8px 0 14px; }
.checklist label { display: flex; align-items: center; gap: 12px; margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--line-2); font-weight: 400; cursor: pointer; }
.checklist input { width: 20px; height: 20px; accent-color: var(--accent); }
.searchbar { position: relative; margin-bottom: 18px; }
.searchbar .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.searchbar input { padding-left: 44px; margin: 0; border-radius: 999px; box-shadow: var(--shadow); }
.res-group h3 { margin: 18px 4px 6px; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.res-item { display: block; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; color: var(--text); }
.res-item:hover { text-decoration: none; border-color: #cfd5fa; }
.res-item b { display: block; }
.res-item span { color: var(--muted); font-size: .88rem; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.table .r { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Chat ---------- */
.chat-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.project-banner { display: flex; align-items: center; gap: 8px; padding: 8px 24px; background: var(--accent-soft); color: #3d4ab5; font-size: .88rem; }
.project-banner .ic { width: 16px; height: 16px; }
.project-banner span { color: var(--muted); }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 24px 12px; overscroll-behavior: contain; scroll-behavior: smooth; }
.msg-inner { max-width: 860px; margin: 0 auto; }
.welcome { max-width: 560px; margin: 8vh auto 0; text-align: center; color: var(--muted); }
.welcome h2 { color: var(--text); margin: 12px 0 6px; font-size: 1.5rem; }
.welcome-orb { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.welcome-orb .ic { width: 30px; height: 30px; }
.m { display: flex; flex-direction: column; max-width: 860px; margin: 0 auto 18px; }
.m.user { align-items: flex-end; }
.m .bubble { background: var(--bubble); border-radius: 20px 20px 6px 20px; padding: 14px 20px; max-width: 82%; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.m .time { color: var(--muted); font-size: .78rem; margin: 6px 6px 0; }
.m .atts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 6px; max-width: 82%; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: .85rem; max-width: 220px; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .ic { width: 15px; height: 15px; color: var(--accent); }
.chip button { border: 0; background: none; padding: 0; display: grid; color: var(--muted); }
.m.assistant { flex-direction: row; gap: 14px; align-items: flex-start; }
.m .av { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.m .av .ic { width: 20px; height: 20px; }
.m .card-msg { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px 26px; min-width: 0; flex: 1; box-shadow: var(--shadow); }
.m .meta { color: var(--muted); font-size: .76rem; margin-top: 10px; display: flex; gap: 12px; flex-wrap: wrap; }
.m .meta button { border: 0; background: none; color: var(--muted); padding: 2px 0; font-size: .76rem; }
.m .meta button:hover { color: var(--accent); }
.typing { display: inline-flex; gap: 5px; padding: 6px 2px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: #b9c0f5; animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; transform: scale(.85); } 40% { opacity: 1; transform: scale(1); } }
.m.error .card-msg { border-color: #f1c3cb; background: #fff7f8; color: var(--danger); }

/* Markdown rendu */
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { line-height: 1.25; margin: 1.1em 0 .4em; }
.md h1 { font-size: 1.4rem; } .md h2 { font-size: 1.25rem; } .md h3 { font-size: 1.08rem; } .md h4 { font-size: 1rem; }
.md p { margin: .6em 0; } .md ul, .md ol { padding-left: 1.4em; margin: .5em 0; } .md li { margin: .25em 0; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.1em 0; }
.md code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.md pre { background: #f5f6fb; border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: .8em 0; padding: .2em 1em; border-left: 3px solid #c9d0ff; color: #4b516b; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; margin: .8em 0; }
.md th, .md td { border: 1px solid var(--line); padding: 7px 12px; text-align: left; }
.md th { background: #f5f6fb; }
.md em:last-child, .md p:last-child > em:only-child { color: var(--muted); font-size: .9rem; }

/* Composer */
.composer { flex: none; padding: 8px 24px calc(14px + var(--safe-b)); background: linear-gradient(to top, var(--bg) 70%, rgba(249,250,253,0)); }
.composer-box { max-width: 860px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 30px; padding: 10px 12px; box-shadow: var(--shadow); }
.composer-box:focus-within { border-color: #c9d0ff; }
.composer textarea { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; padding: 11px 6px; max-height: 180px; background: none; font-size: 16px; line-height: 1.4; }
.round-btn { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--muted); display: grid; place-items: center; flex: none; }
.round-btn:hover { color: var(--accent); }
.send-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 4px 12px rgba(91,108,240,.35); }
.send-btn[disabled] { background: #c3c8ee; box-shadow: none; }
.attach-wrap { position: relative; }
.attach-row { max-width: 860px; margin: 0 auto 8px; display: flex; gap: 8px; overflow-x: auto; padding: 2px; -webkit-overflow-scrolling: touch; }
.attach-row .chip { flex: none; padding: 8px 12px; }
.attach-row .chip.up { opacity: .6; }
.composer-note { max-width: 860px; margin: 8px auto 0; text-align: center; color: var(--muted); font-size: .75rem; }

/* Quiz */
.quiz-q { padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.quiz-q:last-child { border-bottom: 0; }
.quiz-q h4 { margin: 0 0 10px; font-size: 1rem; }
.opt { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; min-height: 46px; }
.opt:hover { border-color: #cfd5fa; }
.opt.good { background: #eaf8f1; border-color: #8fd5b6; }
.opt.bad { background: #fff0f2; border-color: #f0b3bd; }
.explain { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; font-size: .92rem; margin-top: 6px; }
.score { font-size: 1.1rem; font-weight: 600; margin: 12px 0; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); background: #1c2033; color: #fff; padding: 12px 18px; border-radius: 14px; z-index: 100; max-width: calc(100vw - 32px); font-size: .92rem; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast.bad { background: var(--danger); }

/* ---------- Auth ---------- */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: radial-gradient(circle at 20% 10%, #eef0ff 0, transparent 50%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 28px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 12px; font-size: 1.35rem; font-weight: 600; margin-bottom: 14px; }
.auth-card h1 { font-size: 1.3rem; margin: 0 0 14px; } .auth-card h3 { margin: 18px 0 4px; font-size: 1rem; }
.auth-form label { display: block; margin-bottom: 12px; font-size: .92rem; font-weight: 500; }
.auth-form .btn { width: 100%; margin-top: 6px; }
.auth-form label.check { display: flex; gap: 10px; align-items: center; font-weight: 400; }
.auth-alt { text-align: center; color: var(--muted); font-size: .92rem; }
.alert { background: #fff0f2; color: var(--danger); border: 1px solid #f5c6ce; padding: 10px 14px; border-radius: 12px; margin-bottom: 12px; font-size: .92rem; }
.checks { list-style: none; padding: 0; margin: 0 0 12px; font-size: .88rem; } .checks .ok { color: var(--ok); } .checks .ko { color: var(--danger); }

/* ---------- Mobile (iPhone) ---------- */
@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 60; top: 0; left: 0; bottom: 0; width: min(86vw, 340px); transform: translateX(-102%); margin-left: 0 !important; padding-top: calc(18px + var(--safe-t)); padding-bottom: calc(12px + var(--safe-b)); box-shadow: 0 0 40px rgba(0,0,0,.18); }
  .app.drawer-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 50; background: rgba(20,24,45,.35); display: block; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .app.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  #collapseBtn { display: none; }
  .menu-btn { display: grid; flex: none; }
  .topbar { flex-wrap: wrap; padding: calc(8px + var(--safe-t)) 12px 8px; gap: 6px 8px; min-height: 0; }
  .top-title { flex: 1; gap: 10px; }
  .sparkle-lg { display: none; }
  .tt-main { font-size: 1.05rem; } .tt-sub { display: none; }
  .top-tools { order: 3; width: 100%; justify-content: space-between; gap: 8px; }
  .model-box { flex: 0 1 auto; min-width: 0; }
  .seg button { padding: 8px 12px; min-height: 40px; }
  .seg button span { display: inline; }
  #levelSel { padding: 9px 8px; min-height: 40px; max-width: 110px; }
  .cost { padding: 3px 8px; }
  .avatar { order: 2; width: 40px; height: 40px; }
  .top-title { order: 1; } .menu-btn { order: 0; } .account { order: 2; }
  .topbar { flex-wrap: wrap; }
  .account { position: static; }
  .content-chat { overflow: hidden; }
  .messages { padding: 14px 12px 8px; }
  .m.assistant { gap: 8px; }
  .m .av { display: none; }
  .m .card-msg { padding: 14px 16px; border-radius: 16px; }
  .m .bubble { max-width: 90%; padding: 12px 16px; }
  .composer { padding: 6px 10px calc(10px + var(--safe-b)); }
  .composer-note { display: none; }
  .composer-box { padding: 8px; }
  .page { padding: 18px 14px 50px; }
  .cols { grid-template-columns: 1fr; }
  .menu { right: 8px; top: 58px; position: fixed; }
  .menu.up { position: absolute; top: auto; right: auto; bottom: calc(100% + 10px); }
  .btn { min-height: 46px; }
  .new-chat span:last-child { font-size: 1rem; }
}
@media (max-width: 430px) {
  .topbar { padding-left: 8px; padding-right: 10px; }
  .top-tools { flex-wrap: nowrap; gap: 6px; }
  .model-box { flex: 0 1 auto; gap: 6px; min-width: 0; }
  .seg { padding: 3px; }
  .seg button { padding: 8px 11px; gap: 5px; }
  .seg button .ic { display: none; }
  #levelSel { max-width: 92px; min-width: 0; padding: 9px 6px; font-size: .85rem; }
  .cost { flex: none; padding: 3px 7px; }
  .cost b { font-size: .8rem; }
  .cost small { font-size: .58rem; }
}
@media (min-width: 861px) { .menu-btn { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
