/* Kelex — one stylesheet for the landing page, sign-in and the chat app.
   No build step: edit and upload. */

@font-face {
  font-family: "Bricolage";
  src: url("/assets/fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --berry: #B0215E;
  --berry-deep: #8A1648;
  --berry-soft: #F7E3EC;
  --saffron: #F6B21B;
  --leaf: #1FA971;
  --ink: #1D1626;
  --muted: #776C82;
  --paper: #FAF8FB;
  --surface: #FFFFFF;
  --raised: #F3EEF4;
  --line: #E8E1EB;
  --wall: #F1EBF2;
  --wall-mark: rgba(176, 33, 94, .07);
  --bubble-in: #FFFFFF;
  --bubble-out: #B0215E;
  --on-out: #FFFFFF;
  --on-out-soft: rgba(255, 255, 255, .78);
  --danger: #C62B2B;
  --shadow: 0 10px 40px rgba(40, 16, 48, .16);
  --display: "Bricolage", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --berry: #E0508F;
  --berry-deep: #B0215E;
  --berry-soft: #3A1B2B;
  --ink: #F2ECF5;
  --muted: #A598B0;
  --paper: #15101B;
  --surface: #1D1626;
  --raised: #2A2034;
  --line: #33283E;
  --wall: #120D17;
  --wall-mark: rgba(224, 80, 143, .06);
  --bubble-in: #251C2F;
  --bubble-out: #9C1D54;
  --danger: #F07272;
  --shadow: 0 10px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
h1, h2, h3 { font-family: var(--display); font-weight: 650; letter-spacing: -.015em; line-height: 1.12; margin: 0; }
p { margin: 0; }
a { color: var(--berry); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--berry); outline-offset: 2px; }
::selection { background: var(--berry); color: #fff; }

/* Woven-cloth motif used behind conversations and on the brand panels. */
.weave {
  background-color: var(--wall);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23B0215E' stroke-opacity='.09' stroke-width='1.4'%3E%3Cpath d='M36 6 66 36 36 66 6 36Z'/%3E%3Cpath d='M36 20 52 36 36 52 20 36Z'/%3E%3Cpath d='M0 0 12 12M72 0 60 12M0 72 12 60M72 72 60 60'/%3E%3C/g%3E%3Cg fill='%23B0215E' fill-opacity='.11'%3E%3Ccircle cx='36' cy='36' r='3'/%3E%3Ccircle cx='0' cy='36' r='2'/%3E%3Ccircle cx='72' cy='36' r='2'/%3E%3Ccircle cx='36' cy='0' r='2'/%3E%3Ccircle cx='36' cy='72' r='2'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- Shared controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border: 0; border-radius: 999px;
  background: var(--berry); color: #fff; font-weight: 600; text-decoration: none;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--berry-deep); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn.quiet { background: var(--raised); color: var(--ink); }
.btn.quiet:hover { background: var(--line); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.danger:hover { background: var(--raised); }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }

.icon-btn {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--raised); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.solid { background: var(--berry); color: #fff; }
.icon-btn.solid:hover { background: var(--berry-deep); }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field small { display: block; color: var(--muted); font-size: 13px; margin-top: 5px; }
.input, .field input, .field textarea {
  width: 100%; min-height: 48px; padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface);
  outline: none; transition: border-color .15s;
}
.field textarea { resize: vertical; min-height: 84px; }
.input:focus, .field input:focus, .field textarea:focus { border-color: var(--berry); }
.error { color: var(--danger); font-size: 14px; margin: -8px 0 14px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }
.switch input { appearance: none; width: 46px; height: 28px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: background .15s; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked { background: var(--berry); }
.switch input:checked::after { transform: translateX(18px); }
.switch small { display: block; color: var(--muted); font-size: 13px; }

/* ---------- Landing and sign-in ---------- */
.front { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.front-brand { padding: clamp(24px, 5vw, 64px); display: flex; flex-direction: column; gap: 28px; }
.front-side { background: var(--surface); padding: clamp(24px, 5vw, 64px); display: flex; flex-direction: column; justify-content: center; border-left: 1px solid var(--line); }
.wordmark { display: inline-flex; align-items: center; gap: 10px; font: 700 24px/1 var(--display); letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.wordmark img { width: 36px; height: 36px; }
.pitch { margin: auto 0; display: flex; flex-direction: column; gap: 10px; max-width: 30rem; }
.pitch .say {
  width: fit-content; max-width: 100%; padding: 14px 20px; border-radius: 24px;
  font: 600 clamp(22px, 3.3vw, 36px)/1.15 var(--display); letter-spacing: -.02em;
  background: var(--bubble-in); box-shadow: 0 1px 1px rgba(40,16,48,.08); border-bottom-left-radius: 6px;
}
.pitch .say.mine { align-self: flex-end; background: var(--bubble-out); color: #fff; border-radius: 24px; border-bottom-right-radius: 6px; }
.pitch .say.small { font: 500 17px/1.4 var(--body); letter-spacing: 0; }
.front-side h1 { font-size: clamp(28px, 4vw, 40px); margin-bottom: 8px; }
.front-side .lede { color: var(--muted); margin-bottom: 28px; max-width: 36ch; }
.front-side form { max-width: 400px; }
.front-actions { display: flex; flex-wrap: wrap; gap: 12px; max-width: 400px; }
.front-actions .btn { flex: 1 1 160px; }
.alt { margin-top: 22px; color: var(--muted); font-size: 15px; }
.how { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); max-width: 400px; color: var(--muted); font-size: 15px; }
.how strong { color: var(--ink); }
@media (max-width: 820px) {
  .front { grid-template-columns: 1fr; }
  .front-brand { padding-bottom: 36px; }
  .front-brand.slim .pitch { display: none; }
  .front-side { border-left: 0; border-top: 1px solid var(--line); justify-content: flex-start; padding-bottom: calc(32px + var(--safe-b)); }
}

/* ---------- App shell ---------- */
.app {
  height: var(--app-h, 100dvh); display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  overflow: hidden; background: var(--surface);
}
.pane-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--surface); padding-top: var(--safe-t); }
.pane-chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }

.list-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px; }
.list-head .me { border: 0; background: none; padding: 0; border-radius: 50%; }
.search { flex: 1; position: relative; }
.search input { width: 100%; height: 42px; border: 0; border-radius: 999px; background: var(--raised); padding: 0 16px 0 40px; outline: none; }
.search input:focus { box-shadow: 0 0 0 2px var(--berry); }
.search svg { position: absolute; left: 13px; top: 11px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }

.banner { margin: 4px 12px 8px; padding: 12px 14px; border-radius: 16px; background: var(--berry-soft); display: flex; align-items: center; gap: 12px; font-size: 14px; }
.banner p { flex: 1; }
.banner .x { border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; padding: 4px; }

.chat-list { flex: 1; overflow-y: auto; padding: 0 6px calc(12px + var(--safe-b)); overscroll-behavior: contain; }
.section-label { padding: 14px 12px 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.row {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border: 0; border-radius: 16px;
  background: none; text-align: left; position: relative;
}
.row:hover { background: var(--raised); }
.row.active { background: var(--berry-soft); }
.row-main { flex: 1; min-width: 0; }
.row-main > .row-title, .row-main > .row-text { display: block; }
.row-top { display: flex; align-items: baseline; gap: 8px; }
.row-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-title .kind { color: var(--muted); font-weight: 500; font-size: 13px; margin-left: 6px; }
.row-time { font-size: 12.5px; color: var(--muted); flex: none; }
.row-bottom { display: flex; align-items: center; gap: 8px; margin-top: 1px; }
.row-text { flex: 1; min-width: 0; color: var(--muted); font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-text .who { color: var(--ink); }
.badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--berry); color: #fff; font-size: 12.5px; font-weight: 700; display: grid; place-items: center; flex: none; }
.badge.muted { background: var(--muted); }
.empty { padding: 48px 28px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 20px; margin-bottom: 8px; }
.empty .btn { margin-top: 18px; }

.avatar {
  --size: 50px; width: var(--size); height: var(--size); flex: none; border-radius: 50%; position: relative;
  display: grid; place-items: center; color: #fff; font: 650 calc(var(--size) * .38)/1 var(--display); background: var(--berry);
  user-select: none;
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar.s { --size: 40px; }
.avatar.xs { --size: 30px; }
.avatar.xl { --size: 96px; }
.avatar .on { position: absolute; right: 0; bottom: 0; width: 26%; height: 26%; min-width: 11px; min-height: 11px; border-radius: 50%; background: var(--leaf); box-shadow: 0 0 0 2.5px var(--surface); }

/* ---------- Conversation ---------- */
.chat-empty { flex: 1; display: grid; place-items: center; text-align: center; padding: 32px; }
.chat-empty .card { background: var(--surface); padding: 28px 32px; border-radius: 28px; max-width: 360px; box-shadow: 0 1px 2px rgba(40,16,48,.08); }
.chat-empty img { width: 56px; height: 56px; margin-bottom: 14px; }
.chat-empty p { color: var(--muted); margin-top: 8px; }

.chat-head { display: flex; align-items: center; gap: 6px; padding: calc(8px + var(--safe-t)) 10px 8px; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 2; }
.chat-head .back { display: none; }
.chat-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: 0; background: none; text-align: left; padding: 2px 6px; border-radius: 14px; }
.chat-who:hover { background: var(--raised); }
.chat-who h2 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-who p { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-who p.live { color: var(--berry); }

.scroller { flex: 1; overflow-y: auto; padding: 14px clamp(10px, 4vw, 56px) 10px; display: flex; flex-direction: column; gap: 3px; overscroll-behavior: contain; }
.scroller > :first-child { margin-top: auto; }
.day, .sys { align-self: center; margin: 10px 0; padding: 4px 12px; border-radius: 99px; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 500; box-shadow: 0 1px 1px rgba(40,16,48,.06); text-align: center; max-width: 90%; }
.day { position: sticky; top: 4px; z-index: 1; }

.msg { display: flex; max-width: min(78%, 560px); align-self: flex-start; position: relative; }
.msg.out { align-self: flex-end; }
.msg.gap { margin-top: 9px; }
.bubble {
  min-width: 0; padding: 7px 12px 6px; border-radius: 19px; background: var(--bubble-in);
  box-shadow: 0 1px 1px rgba(40,16,48,.08); overflow-wrap: anywhere; position: relative; display: flow-root;
}
.msg.first:not(.out) .bubble { border-top-left-radius: 6px; }
.msg.out .bubble { background: var(--bubble-out); color: var(--on-out); }
.msg.out.first .bubble { border-top-right-radius: 6px; }
.msg.flash .bubble { animation: flash 1.2s ease; }
@keyframes flash { 30% { box-shadow: 0 0 0 4px var(--saffron); } }
.sender { font-size: 13.5px; font-weight: 700; margin-bottom: 1px; }
.text { white-space: pre-wrap; }
.text a { color: inherit; text-decoration: underline; }
.meta { float: right; margin: 6px -3px -2px 12px; font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; line-height: 1; user-select: none; }
.msg.out .meta { color: var(--on-out-soft); }
.meta svg { width: 17px; height: 12px; }
.meta .read { color: var(--saffron); }
.quote { display: block; width: 100%; border: 0; text-align: left; margin: 2px 0 5px; padding: 5px 10px; border-radius: 10px; border-left: 3px solid var(--berry); background: var(--raised); font-size: 14px; color: inherit; }
.msg.out .quote { background: rgba(255,255,255,.16); border-left-color: var(--saffron); }
.quote b { display: block; font-size: 13px; }
.quote span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.msg.pending { opacity: .65; }

.media { width: min(330px, 68vw); margin: -3px -8px 5px; display: grid; gap: 3px; border-radius: 15px; overflow: hidden; }
.media.multi { grid-template-columns: 1fr 1fr; }
.media button { border: 0; padding: 0; background: var(--raised); display: block; line-height: 0; }
.media img { width: 100%; height: 100%; max-height: 380px; object-fit: cover; display: block; }
.media.multi img { aspect-ratio: 1; }
.media video { width: 100%; max-height: 380px; display: block; background: #000; }
.file { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; padding: 3px 0 5px; min-width: 200px; }
.file .ico { width: 42px; height: 42px; border-radius: 50%; background: var(--berry); color: #fff; display: grid; place-items: center; flex: none; }
.msg.out .file .ico { background: rgba(255,255,255,.2); }
.file .ico svg { width: 20px; height: 20px; }
.file b { display: block; font-size: 14.5px; font-weight: 600; word-break: break-all; }
.file small { opacity: .75; font-size: 12.5px; }
.voice { display: flex; align-items: center; gap: 10px; padding: 3px 0 4px; min-width: 210px; }
.voice button { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--berry); color: #fff; display: grid; place-items: center; flex: none; }
.msg.out .voice button { background: #fff; color: var(--berry-deep); }
.voice button svg { width: 18px; height: 18px; }
.voice .bar { flex: 1; height: 4px; border-radius: 4px; background: var(--line); position: relative; overflow: hidden; }
.msg.out .voice .bar { background: rgba(255,255,255,.3); }
.voice .bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--berry); }
.msg.out .voice .bar i { background: #fff; }
.voice time { font-size: 12.5px; opacity: .8; min-width: 34px; text-align: right; }

.to-bottom { position: absolute; right: 18px; bottom: 86px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); display: grid; place-items: center; z-index: 3; }
.to-bottom svg { width: 22px; height: 22px; }
.to-bottom .badge { position: absolute; top: -6px; right: -4px; }

.context { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface); border-top: 1px solid var(--line); }
.context div { flex: 1; min-width: 0; border-left: 3px solid var(--berry); padding-left: 10px; font-size: 14px; }
.context b { display: block; color: var(--berry); font-size: 13px; }
.context span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.picked { display: flex; gap: 8px; padding: 10px 12px 2px; background: var(--surface); border-top: 1px solid var(--line); overflow-x: auto; }
.picked .chip { position: relative; flex: none; width: 68px; height: 68px; border-radius: 12px; background: var(--raised); overflow: hidden; display: grid; place-items: center; font-size: 11px; text-align: center; padding: 4px; word-break: break-all; color: var(--muted); }
.picked .chip img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.picked .chip button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 14px; line-height: 1; z-index: 1; }

.composer { display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px calc(8px + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--line); }
.composer textarea { flex: 1; min-width: 0; max-height: 140px; min-height: 42px; resize: none; border: 0; outline: none; border-radius: 21px; background: var(--raised); padding: 10px 16px; line-height: 1.4; }
.composer .rec { flex: 1; min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 8px; color: var(--danger); font-weight: 600; font-variant-numeric: tabular-nums; }
.composer .rec i { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.notice-bar { padding: 14px calc(14px) calc(14px + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 14.5px; }

/* ---------- Sheets, menus, toasts ---------- */
.veil { position: fixed; inset: 0; z-index: 20; background: rgba(20, 8, 24, .5); display: grid; place-items: center; padding: 20px; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: min(440px, 100%); max-height: min(88dvh, 760px); display: flex; flex-direction: column; background: var(--surface); border-radius: 26px; box-shadow: var(--shadow); overflow: hidden; }
.sheet-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 10px 20px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { flex: 1; font-size: 19px; }
.sheet-body { overflow-y: auto; padding: 18px 20px 22px; }
.sheet-body.flush { padding-left: 8px; padding-right: 8px; }
.sheet-foot { padding: 12px 20px calc(16px + var(--safe-b)); border-top: 1px solid var(--line); display: flex; gap: 10px; }
.sheet-foot .btn { flex: 1; }
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; margin-bottom: 18px; }
.hero h3 { font-size: 22px; margin-top: 10px; }
.hero p { color: var(--muted); font-size: 14.5px; }
.hero .avatar-edit { border: 0; background: none; padding: 0; border-radius: 50%; position: relative; }
.hero .avatar-edit .cam { position: absolute; right: -2px; bottom: -2px; width: 32px; height: 32px; border-radius: 50%; background: var(--berry); color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 3px var(--surface); }
.hero .avatar-edit .cam svg { width: 16px; height: 16px; }
.about { background: var(--raised); border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.about small { display: block; color: var(--muted); font-size: 12.5px; margin-bottom: 2px; }
.rows { margin: 0 -12px; }
.rows .row .role { font-size: 12.5px; color: var(--berry); font-weight: 600; }
.rows .row .sub { color: var(--muted); font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chips button { border: 0; border-radius: 99px; background: var(--berry-soft); color: var(--ink); padding: 5px 10px 5px 12px; font-size: 14px; }
.seg { display: flex; background: var(--raised); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 10px; padding: 8px; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.stack { display: grid; gap: 8px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

.menu { position: fixed; z-index: 30; min-width: 190px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 6px; animation: fade .12s ease; }
.menu button { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 10px 12px; border-radius: 10px; text-align: left; font-size: 15px; }
.menu button:hover { background: var(--raised); }
.menu button.danger { color: var(--danger); }
.menu svg { width: 19px; height: 19px; color: var(--muted); }
.menu button.danger svg { color: inherit; }

.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 40; background: var(--ink); color: var(--paper); padding: 11px 18px; border-radius: 14px; font-size: 14.5px; box-shadow: var(--shadow); max-width: calc(100vw - 32px); animation: fade .15s ease; }

.lightbox { position: fixed; inset: 0; z-index: 35; background: rgba(8, 4, 10, .94); display: grid; place-items: center; animation: fade .15s ease; }
.lightbox img { max-width: 100vw; max-height: 100dvh; object-fit: contain; }
.lightbox .bar { position: absolute; top: calc(10px + var(--safe-t)); right: 10px; display: flex; gap: 6px; }
.lightbox .icon-btn { color: #fff; background: rgba(255,255,255,.12); }

/* ---------- Phones: one pane at a time ---------- */
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .pane-list { border-right: 0; min-width: 0; }
  .pane-chat { position: fixed; inset: 0; height: var(--app-h, 100dvh); z-index: 10; transform: translateX(100%); transition: transform .22s ease; visibility: hidden; }
  .app.chat-open .pane-chat { transform: none; visibility: visible; }
  .chat-head .back { display: grid; }
  .msg { max-width: 86%; }
  .veil { padding: 0; place-items: end center; }
  .sheet { width: 100%; max-height: 92dvh; border-radius: 26px 26px 0 0; animation: rise .2s ease; }
  @keyframes rise { from { transform: translateY(40px); opacity: 0; } }
  .menu { left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + var(--safe-b)); }
  .to-bottom { right: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
