/* Synapse Chat — dark UI, matching the palette the other Synapse apps use. */

:root {
  --bg-base: #0b0c10;
  --bg-elev-1: #14161c;
  --bg-elev-2: #1b1e26;
  --bg-input: #1b1e26;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.16);
  --text: #e8e9ec;
  --text-muted: rgba(232,233,236,0.62);
  --text-faint: rgba(232,233,236,0.38);

  --color-red: rgb(225, 50, 0);
  --color-orange: rgb(255, 165, 0);
  --color-pumpkin: rgb(243, 112, 118);
  --color-sky: rgb(61, 148, 226);
  --color-purple: rgb(153, 42, 246);
  --color-pink: rgb(235, 44, 187);
  --color-yellow: rgb(255, 225, 100);
  --color-green: rgb(100, 200, 50);
  --color-levander: rgb(150, 150, 255);

  --accent: var(--color-sky);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  --sidebar-w: 340px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* The app shows and hides screens, modals and rows with the `hidden` attribute.
   Many rules below set `display` on those same elements, and a class selector
   outranks the user-agent's `[hidden] { display: none }` — without this, every
   modal renders at once. Keep this above everything that sets display. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--bg-base);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.login-mark svg { fill: currentColor; stroke: none; }

button { font: inherit; color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em;
       background: var(--bg-elev-2); padding: 1px 5px; border-radius: 5px; }

/* ===== screens ===== */

.screen { min-height: 100dvh; }
.screen.center { display: grid; place-items: center; padding: 24px;
  padding-top: calc(24px + var(--sat)); padding-bottom: calc(24px + var(--sab));
  background-image: radial-gradient(120% 90% at 50% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%); }

.card {
  width: min(380px, 100%);
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 22px 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

.login-card { display: flex; flex-direction: column; align-items: center; gap: 0; }
.login-mark {
  width: 56px; height: 56px; display: grid; place-items: center;
  border-radius: 16px; margin-bottom: 14px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  box-shadow: 0 8px 26px color-mix(in srgb, var(--accent) 28%, transparent);
}
.login-mark svg { width: 28px; height: 28px; }
.login-card h1 { font-size: 19px; font-weight: 650; margin: 0 0 3px; letter-spacing: -0.01em; }
.login-card .sub { color: var(--text-faint); font-size: 12.5px; margin: 0 0 20px; }
.login-card label, .login-card button, .login-card .status { width: 100%; }

label { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
label > span { font-size: 11px; font-weight: 500; text-transform: uppercase;
               letter-spacing: 0.05em; color: var(--text-muted); }

input[type=text], input[type=password], input[type=search], input[type=email], textarea, select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  color: var(--text);
  font: inherit;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border); background: var(--bg-elev-2);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 13.5px; font-weight: 550; cursor: pointer;
  transition: filter .15s, transform .05s, border-color .15s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--color-red); border-color: color-mix(in srgb, var(--color-red) 40%, transparent); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 10px; font-size: 12.5px; }
.btn .i { width: 15px; height: 15px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; flex: 0 0 auto;
  border: none; background: transparent; color: var(--text-muted);
  border-radius: 9px; cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-elev-2); color: var(--text); }
.icon-btn.sm { width: 26px; height: 26px; }
.icon-btn.sm svg { width: 15px; height: 15px; }

.status { text-align: center; font-size: 13px; padding: 9px 12px;
          border-radius: var(--radius-sm); margin-top: 10px; line-height: 1.4; }
.status:empty { display: none; }
.status.error   { background: color-mix(in srgb, var(--color-red) 18%, transparent);
                  border: 1px solid color-mix(in srgb, var(--color-red) 45%, transparent); color: #ffb3a0; }
.status.success { background: color-mix(in srgb, var(--color-green) 18%, transparent);
                  border: 1px solid color-mix(in srgb, var(--color-green) 45%, transparent); color: #bff29a; }
.status.info    { background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text-muted); }

.empty { text-align: center; padding: 24px 8px; color: var(--text-muted); }
.empty .icon { font-size: 34px; margin-bottom: 10px; }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 6px; }
.empty .hint { font-size: 13px; color: var(--text-faint); margin: 0 0 14px; line-height: 1.5; }

/* ===== app layout ===== */

.app {
  display: grid;
  /* minmax(0,…) not 1fr: a bare 1fr floors at the column's min-content width, and
     one wide child then pushes the whole pane off-screen on a phone. */
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--bg-elev-1);
  border-right: 1px solid var(--border);
  padding-left: var(--sal);
}

.side-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 12px 10px; padding-top: calc(12px + var(--sat));
  border-bottom: 1px solid var(--border);
}
.side-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.side-title strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn { font-size: 11px; color: var(--text-faint); display: flex; align-items: center; gap: 5px; }
.conn::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); }
.conn[data-state=live]::before { background: var(--color-green); }
.conn[data-state=connecting]::before { background: var(--color-yellow); animation: pulse 1.4s infinite; }
.conn[data-state=offline]::before { background: var(--color-red); }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .3 } }

.avatar-btn { width: 36px; height: 36px; padding: 0; border: none; background: none; cursor: pointer; flex: 0 0 auto; }
.avatar-btn img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
                  border: 2px solid var(--accent); background: var(--bg-elev-2); display: block; }

.search-row { padding: 10px 12px; }
.search-row input { padding: 8px 11px; font-size: 13px; }

.conv-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; -webkit-overflow-scrolling: touch; }

.conv-item {
  display: flex; gap: 10px; align-items: center;
  padding: 9px 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent;
}
.conv-item:hover { background: var(--bg-elev-2); }
.conv-item.active { background: color-mix(in srgb, var(--accent) 15%, transparent);
                    border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.conv-item .av { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%;
                 display: grid; place-items: center; font-size: 17px; overflow: hidden;
                 background: var(--bg-elev-2); border: 1px solid var(--border); }
.conv-item .av img { width: 100%; height: 100%; object-fit: cover; }
.conv-item .body { flex: 1; min-width: 0; }
.conv-item .row1 { display: flex; align-items: baseline; gap: 8px; }
.conv-item .name { font-weight: 600; font-size: 13.5px; flex: 1; min-width: 0;
                   overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .time { font-size: 11px; color: var(--text-faint); flex: 0 0 auto; }
.conv-item .preview { font-size: 12.5px; color: var(--text-muted); overflow: hidden;
                      text-overflow: ellipsis; white-space: nowrap; }
.conv-item .preview.locked { color: var(--text-faint); font-style: italic; }
.badge { flex: 0 0 auto; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px;
         background: var(--accent); color: #fff; font-size: 11px; font-weight: 650;
         display: grid; place-items: center; }

.side-foot { padding: 8px 12px calc(10px + var(--sab)); border-top: 1px solid var(--border); }

/* ===== chat pane ===== */

.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding-right: var(--sar); }
.chat-empty { flex: 1; display: grid; place-items: center; }
.chat-live { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.chat-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; padding-top: calc(11px + var(--sat));
  border-bottom: 1px solid var(--border); background: var(--bg-elev-1);
}
.chat-avatar { width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
               display: grid; place-items: center; font-size: 16px; overflow: hidden;
               background: var(--bg-elev-2); border: 1px solid var(--border); }
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.chat-title strong { font-size: 14.5px; font-weight: 620; overflow: hidden;
                     text-overflow: ellipsis; white-space: nowrap; }
.chat-title span { font-size: 11.5px; color: var(--text-faint); overflow: hidden;
                   text-overflow: ellipsis; white-space: nowrap; }

.key-warning {
  margin: 10px 14px 0; padding: 10px 12px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-yellow) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-yellow) 35%, transparent);
  font-size: 12.5px; color: #f2e6a8;
}
.key-warning strong { display: block; margin-bottom: 3px; }
.key-warning span { color: rgba(242,230,168,.75); }

.messages { flex: 1; overflow-y: auto; padding: 14px; display: flex;
            flex-direction: column; gap: 2px; -webkit-overflow-scrolling: touch; }

.day-sep { align-self: center; margin: 12px 0 8px; padding: 3px 11px; border-radius: 20px;
           background: var(--bg-elev-2); color: var(--text-faint); font-size: 11px; font-weight: 500; }

.msg { display: flex; gap: 8px; max-width: min(640px, 82%); align-self: flex-start; margin-top: 2px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.start { margin-top: 10px; }
.msg .msg-av { width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto; overflow: hidden;
               background: var(--bg-elev-2); border: 1px solid var(--border); align-self: flex-end; }
.msg .msg-av img { width: 100%; height: 100%; object-fit: cover; }
.msg .msg-av.hidden { visibility: hidden; }
.msg.mine .msg-av { display: none; }

.bubble-wrap { display: flex; flex-direction: column; min-width: 0; position: relative; }
.msg.mine .bubble-wrap { align-items: flex-end; }

.msg-author { font-size: 11.5px; font-weight: 600; color: var(--text-muted); margin: 0 0 3px 11px; }

.bubble {
  background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 8px 12px;
  font-size: 14px; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap;
  position: relative;
}
.msg.mine .bubble { background: color-mix(in srgb, var(--accent) 88%, #000); border-color: transparent; color: #fff; }
.msg.start .bubble { border-top-left-radius: 6px; }
.msg.mine.start .bubble { border-top-left-radius: var(--radius-lg); border-top-right-radius: 6px; }
.bubble.deleted { font-style: italic; color: var(--text-faint); background: transparent;
                  border-style: dashed; }
.bubble.locked { font-style: italic; color: var(--text-faint); }

.msg-meta { display: flex; align-items: center; gap: 5px; font-size: 10.5px;
            color: var(--text-faint); margin: 3px 10px 0; }
.msg.mine .msg-meta { justify-content: flex-end; }
.msg-meta .edited { font-style: italic; }
.msg-meta .ticks { display: inline-flex; }
.msg-meta .ticks svg { width: 13px; height: 13px; stroke-width: 2.4; }
.msg-meta .ticks.seen { color: var(--color-sky); }

.reply-quote {
  border-left: 3px solid color-mix(in srgb, var(--accent) 70%, transparent);
  padding: 2px 0 2px 8px; margin-bottom: 5px; font-size: 12.5px; opacity: .82;
  display: flex; flex-direction: column; cursor: pointer;
}
.reply-quote b { font-size: 11.5px; font-weight: 600; }
.reply-quote span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }

.attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.attachments:first-child { margin-top: 0; }
.att-image { max-width: 260px; border-radius: 10px; display: block; cursor: pointer; background: var(--bg-base); }
.att-file { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px;
            background: rgba(0,0,0,.22); border: 1px solid var(--border); cursor: pointer; font-size: 12.5px; }
.att-file .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file .fsize { color: var(--text-faint); font-size: 11px; flex: 0 0 auto; }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 8px 0; }
.msg.mine .reactions { justify-content: flex-end; }
.reaction { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px;
            border-radius: 20px; background: var(--bg-elev-2); border: 1px solid var(--border);
            font-size: 12px; cursor: pointer; }
.reaction.on { background: color-mix(in srgb, var(--accent) 22%, transparent);
               border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.reaction .n { font-size: 11px; color: var(--text-muted); }

.msg-actions { position: absolute; top: -26px; display: flex; gap: 2px; padding: 2px;
               border-radius: 9px; background: var(--bg-elev-1); border: 1px solid var(--border);
               box-shadow: 0 6px 18px rgba(0,0,0,.45); opacity: 0; pointer-events: none;
               transition: opacity .12s; z-index: 3;
               max-width: calc(100vw - 28px); flex-wrap: wrap; }
.msg.mine .msg-actions { right: 6px; }
.msg:not(.mine) .msg-actions { left: 6px; }
.msg:hover .msg-actions, .msg-actions.pinned { opacity: 1; pointer-events: auto; }
.msg-actions .icon-btn { width: 27px; height: 27px; }
.msg-actions .icon-btn svg { width: 15px; height: 15px; }

.emoji-row { display: flex; gap: 1px; }
.emoji-row button { border: none; background: none; cursor: pointer; font-size: 15px;
                    width: 27px; height: 27px; border-radius: 7px; }
.emoji-row button:hover { background: var(--bg-elev-2); }

.typing-row { padding: 0 16px 6px; font-size: 12px; color: var(--text-faint); font-style: italic; }

.reply-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px;
             border-top: 1px solid var(--border); background: var(--bg-elev-1); }
.reply-info { flex: 1; min-width: 0; display: flex; flex-direction: column;
              border-left: 3px solid var(--accent); padding-left: 9px; }
.reply-to { font-size: 11.5px; font-weight: 600; color: var(--accent); }
.reply-text { font-size: 12.5px; color: var(--text-muted); overflow: hidden;
              text-overflow: ellipsis; white-space: nowrap; }

.attach-tray { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 14px 0; }
.tray-item { display: flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 9px;
             background: var(--bg-elev-2); border: 1px solid var(--border); font-size: 12px; }
.tray-item img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }
.tray-item .x { cursor: pointer; color: var(--text-faint); }
.tray-item .x:hover { color: var(--color-red); }

.composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 14px; padding-bottom: calc(10px + var(--sab));
  border-top: 1px solid var(--border); background: var(--bg-elev-1);
}
.composer textarea {
  flex: 1; resize: none; max-height: 140px; border-radius: 20px;
  padding: 10px 14px; font-size: 14px; line-height: 1.4;
  overflow-y: hidden;              /* autoGrow turns this on at max height */
  scrollbar-width: thin;
}
.send-btn {
  width: 38px; height: 38px; flex: 0 0 auto; border: none; border-radius: 50%;
  background: var(--accent); color: #fff; cursor: pointer;
  display: grid; place-items: center; transition: filter .15s, opacity .15s;
}
.send-btn:disabled { opacity: .4; cursor: not-allowed; }
.send-btn:not(:disabled):hover { filter: brightness(1.12); }

/* ===== modals ===== */

.modal-root { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.62); backdrop-filter: blur(3px); }
.modal {
  position: relative; width: min(440px, 100%); max-height: min(86dvh, 720px);
  display: flex; flex-direction: column;
  background: var(--bg-elev-1); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: 0 30px 70px rgba(0,0,0,.6);
}
.modal.wide { width: min(880px, 100%); }
.modal > header { display: flex; align-items: center; gap: 10px; padding: 14px 12px 14px 18px;
                  border-bottom: 1px solid var(--border); }
.modal > header h2 { flex: 1; margin: 0; font-size: 15px; font-weight: 620; }
.modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.modal-body.image-body { padding: 0; display: grid; place-items: center; background: #000; }
.modal-body.image-body img { max-width: 100%; max-height: 74dvh; display: block; }
.modal > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px;
                  border-top: 1px solid var(--border); }

.seg { display: flex; gap: 4px; padding: 3px; background: var(--bg-elev-2);
       border-radius: 10px; margin-bottom: 14px; }
.seg-btn { flex: 1; border: none; background: transparent; color: var(--text-muted);
           padding: 7px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 550; }
.seg-btn.active { background: var(--accent); color: #fff; }

.picker-label { font-size: 11px; font-weight: 500; text-transform: uppercase;
                letter-spacing: .05em; color: var(--text-muted); margin-bottom: 7px; }
.picker { display: flex; flex-direction: column; gap: 3px; max-height: 260px; overflow-y: auto; }
.picker-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px;
              border-radius: 9px; cursor: pointer; border: 1px solid transparent; }
.picker-row:hover { background: var(--bg-elev-2); }
.picker-row.sel { background: color-mix(in srgb, var(--accent) 16%, transparent);
                  border-color: color-mix(in srgb, var(--accent) 38%, transparent); }
.picker-row img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
                  background: var(--bg-elev-2); }
.picker-row .who { flex: 1; min-width: 0; }
.picker-row .who b { display: block; font-size: 13.5px; font-weight: 600; }
.picker-row .who small { color: var(--text-faint); font-size: 11.5px; }
.picker-row .check { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); }
.picker-row.sel .check { background: var(--accent); border-color: var(--accent); }

.section-title { font-size: 11px; font-weight: 500; text-transform: uppercase;
                 letter-spacing: .05em; color: var(--text-muted); margin: 18px 0 8px; }
.section-title:first-child { margin-top: 0; }

.list-row { display: flex; align-items: center; gap: 10px; padding: 9px 0;
            border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.list-row img.av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--bg-elev-2); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow b { display: block; font-size: 13.5px; font-weight: 600; }
.list-row .grow small { color: var(--text-faint); font-size: 11.5px; display: block;
                        overflow: hidden; text-overflow: ellipsis; }
.chip { display: inline-block; padding: 1px 7px; border-radius: 20px; font-size: 10.5px;
        font-weight: 600; background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text-muted); }
.chip.accent { background: color-mix(in srgb, var(--accent) 20%, transparent);
               border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.chip.good { color: var(--color-green); border-color: color-mix(in srgb, var(--color-green) 45%, transparent); }

.fp { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px;
      color: var(--text-muted); letter-spacing: .02em; }

.toggle-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.toggle-row .grow { flex: 1; }
.toggle-row .grow b { display: block; font-size: 13.5px; }
.toggle-row .grow small { color: var(--text-faint); font-size: 12px; }

/* ===== install banner ===== */

.install-banner {
  position: fixed; z-index: 55;
  left: 50%; transform: translateX(-50%);
  bottom: calc(16px + var(--sab));
  width: min(440px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px 12px 14px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 18px 44px rgba(0,0,0,.6);
  animation: sheetin .24s ease;
}
.install-icon { width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto; }
.install-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.install-copy strong { font-size: 13.5px; font-weight: 620; }
.install-copy span { font-size: 12px; color: var(--text-muted); }
.install-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }

/* iOS gets instructions rather than a button, so the row stacks instead. */
.install-banner.ios { align-items: flex-start; }
.install-banner.ios .install-actions { align-self: flex-start; }
.install-copy .ios-step { display: inline-flex; align-items: center; gap: 4px; }
.install-copy .ios-step svg { width: 14px; height: 14px; vertical-align: -2px; }

@keyframes sheetin { from { opacity: 0; transform: translate(-50%, 10px) } to { opacity: 1; transform: translateX(-50%) } }

/* ===== toasts ===== */

.toast-host { position: fixed; left: 50%; transform: translateX(-50%);
              bottom: calc(20px + var(--sab)); z-index: 90;
              display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--bg-elev-2); border: 1px solid var(--border-strong);
         border-radius: 10px; padding: 9px 14px; font-size: 13px;
         box-shadow: 0 12px 30px rgba(0,0,0,.5); animation: toastin .2s ease; max-width: 90vw; }
.toast.error { border-color: color-mix(in srgb, var(--color-red) 50%, transparent); color: #ffb3a0; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }

.only-mobile { display: none; }

/* ===== mobile ===== */

@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { grid-column: 1; grid-row: 1; }
  .chat { grid-column: 1; grid-row: 1; background: var(--bg-base);
          transform: translateX(100%); transition: transform .22s ease; }
  .chat[data-open="true"] { transform: none; }
  .only-mobile { display: inline-grid; }
  .msg { max-width: 88%; }
  /* Both mobile views own the bottom edge — the Settings footer on the list, the
     composer in a conversation — so the banner always sits above that bar. */
  .install-banner { bottom: calc(74px + var(--sab)); }
  /* No hover on touch: taps set .pinned instead (see app.js). Anchor the bar to
     the bubble's own side so it stays on screen. */
  .msg:not(.mine) .msg-actions { left: 0; }
  .msg.mine .msg-actions { right: 0; }
  .modal { max-height: 92dvh; }
  .modal-root { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
