/* =========================================================================
   UA Messenger Web — stylesheet
   Palette mirrors https://messenger.vn.ua (purple / pink on deep violet).
   ========================================================================= */

/* ------------------------------- variables ------------------------------ */
:root {
  --void: #0a0710;
  --deep: #150b28;
  --panel: #1c1130;
  --panel-2: #241640;
  --panel-3: #2c1a4e;
  --purple-900: #3b1078;
  --purple-700: #5b21b6;
  --purple-600: #7c3aed;
  --purple-400: #a855f7;
  --purple-300: #c084fc;
  --pink-500: #e0409e;
  --text-hi: #f5f1fb;
  --text-mid: #cabfe0;
  --text-low: #8b7fa8;
  --line: rgba(233, 221, 255, 0.10);
  --line-strong: rgba(233, 221, 255, 0.18);
  --danger: #ef4466;
  --success: #2fce8f;
  --warning: #f5a524;
  --grad: linear-gradient(135deg, var(--purple-600) 0%, var(--purple-400) 55%, var(--pink-500) 120%);
  --shadow-glow: 0 0 60px rgba(124, 58, 237, 0.35);
  --shadow-card: 0 18px 50px -22px rgba(10, 5, 20, 0.8);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --font-display: "Unbounded", "Manrope", sans-serif;
  --font-body: "Manrope", "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(.16, .8, .24, 1);
  --rail-w: 76px;
  --list-w: 360px;
  --header-h: 64px;
}

html[data-theme="light"] {
  --void: #f4f1fa;
  --deep: #ffffff;
  --panel: #ffffff;
  --panel-2: #f3eefb;
  --panel-3: #ebe3f7;
  --text-hi: #1a1030;
  --text-mid: #4b3f66;
  --text-low: #7a6e96;
  --line: rgba(30, 10, 70, 0.10);
  --line-strong: rgba(30, 10, 70, 0.18);
  --shadow-glow: 0 0 60px rgba(124, 58, 237, 0.18);
  --shadow-card: 0 18px 44px -26px rgba(60, 30, 120, 0.4);
}

/* --------------------------------- base --------------------------------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(1100px 640px at 88% -12%, rgba(168, 85, 247, 0.20), transparent 60%),
    radial-gradient(900px 560px at -8% 4%, rgba(99, 102, 241, 0.16), transparent 55%),
    var(--void);
  color: var(--text-hi);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  overflow: hidden;
}
html[data-theme="light"] body {
  background:
    radial-gradient(1100px 640px at 88% -12%, rgba(168, 85, 247, 0.12), transparent 60%),
    radial-gradient(900px 560px at -8% 4%, rgba(99, 102, 241, 0.10), transparent 55%),
    var(--void);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--purple-300); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple-700); }
::selection { background: rgba(168, 85, 247, 0.4); }
.hidden { display: none !important; }
.noscript { padding: 40px; text-align: center; }

/* -------------------------------- loader -------------------------------- */
.boot-loader {
  position: fixed; inset: 0; display: grid; place-content: center; justify-items: center;
  gap: 22px; background: var(--void); z-index: 200;
}
.boot-logo { width: 68px; height: 68px; object-fit: contain; animation: pulse 1.8s var(--ease) infinite; }
.boot-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--panel-3); border-top-color: var(--purple-400);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.94); opacity: .8; } }

/* --------------------------- shared components -------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 20px; border-radius: var(--radius-pill); font-weight: 700;
  font-size: 14.5px; transition: transform .18s var(--ease), background .18s, box-shadow .18s, opacity .18s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--grad); color: #fff; box-shadow: var(--shadow-glow); }
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 0 46px rgba(124, 58, 237, .5); }
.btn--ghost { background: rgba(255, 255, 255, .06); color: var(--text-hi); border: 1px solid var(--line-strong); }
html[data-theme="light"] .btn--ghost { background: var(--panel-2); }
.btn--ghost:hover { background: rgba(255, 255, 255, .1); }
.btn--danger { background: rgba(239, 68, 102, .14); color: var(--danger); border: 1px solid rgba(239, 68, 102, .35); }
.btn--danger:hover { background: rgba(239, 68, 102, .22); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn--icon { padding: 10px; width: 42px; height: 42px; border-radius: 50%; }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 15px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-mid); }
.input, .textarea, .select {
  width: 100%; padding: 13px 15px; border-radius: var(--radius-sm);
  background: var(--panel-2); border: 1px solid var(--line-strong);
  color: var(--text-hi); outline: none; transition: border-color .18s, box-shadow .18s;
}
html[data-theme="light"] .input, html[data-theme="light"] .textarea, html[data-theme="light"] .select { background: #fff; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--purple-400); box-shadow: 0 0 0 3px rgba(168, 85, 247, .18); }
.input::placeholder, .textarea::placeholder { color: var(--text-low); }
.textarea { resize: vertical; min-height: 90px; }
.hint { font-size: 12.5px; color: var(--text-low); }
.form-error {
  background: rgba(239, 68, 102, .12); border: 1px solid rgba(239, 68, 102, .3);
  color: #ff8fa6; padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 14px;
}
.form-note {
  background: rgba(47, 206, 143, .1); border: 1px solid rgba(47, 206, 143, .3);
  color: #6ee7b7; padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 14px;
}

.avatar {
  position: relative; border-radius: 50%; overflow: hidden; flex: none;
  background: var(--panel-3); display: grid; place-items: center; color: #fff; font-weight: 700;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--xs { width: 30px; height: 30px; font-size: 12px; }
.avatar--sm { width: 44px; height: 44px; font-size: 16px; }
.avatar--md { width: 52px; height: 52px; font-size: 18px; }
.avatar--xl { width: 104px; height: 104px; font-size: 36px; }

.badge-online {
  position: absolute; right: 1px; bottom: 1px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--success); border: 2px solid var(--panel);
}

/* ------------------------------ login view ------------------------------ */
.auth-view {
  position: fixed; inset: 0; overflow-y: auto;
  display: grid; grid-template-columns: 1.05fr .95fr;
}
.auth-hero {
  position: relative; overflow: hidden; padding: 54px 56px;
  background: linear-gradient(150deg, var(--purple-900), var(--deep) 65%);
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-hero::after {
  content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(224, 64, 158, .55), transparent 68%);
  bottom: -220px; right: -160px; filter: blur(10px);
}
.auth-hero::before {
  content: ""; position: absolute; width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, .55), transparent 68%);
  top: -200px; left: -140px;
}
.auth-brand { display: flex; align-items: center; gap: 13px; position: relative; z-index: 1; }
.auth-brand img { width: 44px; height: 44px; object-fit: contain; }
.auth-brand b { font-family: var(--font-display); font-size: 20px; letter-spacing: .3px; }
.auth-hero-copy { position: relative; z-index: 1; max-width: 460px; }
.auth-hero-copy h1 { font-family: var(--font-display); font-size: clamp(28px, 4vw, 44px); line-height: 1.1; margin: 0 0 18px; }
.auth-hero-copy p { color: var(--text-mid); font-size: 16px; margin: 0 0 24px; }
.auth-features { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; position: relative; z-index: 1; }
.auth-features li { display: flex; gap: 11px; align-items: center; color: var(--text-mid); font-size: 14.5px; }
.auth-features svg { color: var(--purple-300); flex: none; }
.auth-panel { display: grid; place-items: center; padding: 40px 28px; background: var(--void); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-family: var(--font-display); font-size: 25px; margin: 0 0 6px; }
.auth-card .sub { color: var(--text-low); font-size: 14px; margin: 0 0 24px; }
.auth-tabs { display: flex; gap: 6px; background: var(--panel-2); padding: 5px; border-radius: var(--radius-pill); margin-bottom: 24px; }
.auth-tabs button { flex: 1; padding: 9px; border-radius: var(--radius-pill); color: var(--text-low); font-weight: 600; font-size: 14px; transition: .18s; }
.auth-tabs button.is-active { background: var(--grad); color: #fff; }
.turnstile-slot { margin: 4px 0 16px; min-height: 0; }
.auth-alt { display: flex; justify-content: space-between; margin-top: 16px; font-size: 13.5px; }
.auth-foot { margin-top: 26px; font-size: 12.5px; color: var(--text-low); text-align: center; }

@media (max-width: 880px) {
  .auth-view { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-panel { align-items: start; padding-top: 46px; }
}

/* ------------------------------- app shell ------------------------------ */
.app-shell { display: grid; grid-template-columns: var(--rail-w) var(--list-w) 1fr; height: 100vh; height: 100dvh; }
.app-shell.view-settings { grid-template-columns: var(--rail-w) 1fr; }
.app-shell.view-settings .list-col { display: none; }

/* rail */
.rail {
  background: var(--deep); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 0;
}
.rail-logo { width: 40px; height: 40px; object-fit: contain; margin-bottom: 12px; }
.rail-nav { display: flex; flex-direction: column; gap: 8px; flex: 1; align-items: center; }
.rail-btn {
  position: relative; width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center;
  color: var(--text-low); transition: .18s var(--ease);
}
.rail-btn:hover { background: var(--panel-2); color: var(--text-hi); }
.rail-btn.is-active { background: var(--panel-2); color: var(--purple-300); box-shadow: inset 0 0 0 1px var(--line-strong); }
.rail-btn.is-active::before { content: ""; position: absolute; left: -16px; top: 50%; transform: translateY(-50%); width: 3px; height: 26px; border-radius: 4px; background: var(--grad); }
.rail-badge {
  position: absolute; top: 5px; right: 5px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--pink-500); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--deep);
}
.rail-avatar { margin-top: auto; }
.rail-avatar .avatar { cursor: pointer; border: 2px solid var(--line-strong); }

/* list column */
.list-col { background: var(--deep); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.list-header { height: var(--header-h); display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); flex: none; }
.list-header h2 { font-family: var(--font-display); font-size: 18px; margin: 0; flex: 1; }
.search-box { position: relative; padding: 12px 14px; border-bottom: 1px solid var(--line); flex: none; }
.search-box svg { position: absolute; left: 26px; top: 50%; transform: translateY(-50%); color: var(--text-low); pointer-events: none; }
.search-box input { padding-left: 40px; }
.list-body { flex: 1; overflow-y: auto; min-height: 0; }

.row-item {
  display: flex; gap: 12px; align-items: center; padding: 12px 16px; cursor: pointer;
  transition: background .15s; border: none; width: 100%; text-align: left; color: inherit;
}
.row-item:hover { background: var(--panel); }
.row-item.is-active { background: var(--panel-2); }
.row-main { flex: 1; min-width: 0; }
.row-top { display: flex; align-items: baseline; gap: 8px; }
.row-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.row-time { font-size: 11.5px; color: var(--text-low); flex: none; }
.row-bottom { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.row-preview { font-size: 13px; color: var(--text-low); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.row-preview .me { color: var(--text-mid); }
.row-unread { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--grad); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.verified { color: var(--purple-300); flex: none; }

.empty-state { display: grid; place-items: center; text-align: center; padding: 60px 26px; color: var(--text-low); gap: 12px; }
.empty-state svg { opacity: .5; }
.empty-state h3 { color: var(--text-mid); margin: 0; font-size: 16px; }
.empty-state p { margin: 0; font-size: 13.5px; max-width: 320px; }

/* chat column */
.chat-col { display: flex; flex-direction: column; min-width: 0; background: var(--void); position: relative; }
.chat-header { height: var(--header-h); flex: none; display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--deep); }
.chat-header .back { display: none; }
.chat-peer { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; cursor: pointer; }
.chat-peer-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-peer-status { font-size: 12px; color: var(--text-low); }
.chat-header-actions { display: flex; gap: 4px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--text-mid); transition: .15s; }
.icon-btn:hover { background: var(--panel-2); color: var(--text-hi); }

.messages { flex: 1; overflow-y: auto; padding: 22px 22px 8px; display: flex; flex-direction: column; gap: 3px; min-height: 0; scroll-behavior: smooth; }
.msg-day { align-self: center; margin: 14px 0 8px; font-size: 11.5px; color: var(--text-low); background: var(--panel); padding: 4px 12px; border-radius: 999px; }
.msg { display: flex; gap: 9px; max-width: min(74%, 620px); align-items: flex-end; position: relative; }
.msg--in { align-self: flex-start; }
.msg--out { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { align-self: flex-end; }
.msg-body { position: relative; }
.bubble {
  padding: 9px 13px; border-radius: 16px; font-size: 14.5px; line-height: 1.45;
  word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap;
}
.msg--in .bubble { background: var(--panel-2); border-bottom-left-radius: 5px; }
.msg--out .bubble { background: var(--grad); color: #fff; border-bottom-right-radius: 5px; }
.msg-meta { display: flex; gap: 5px; align-items: center; justify-content: flex-end; margin-top: 3px; font-size: 10.5px; color: var(--text-low); }
.msg--out .msg-meta { color: rgba(255, 255, 255, .7); }
.msg-meta .read { color: #7fe7ff; }
.msg-reactions { display: flex; gap: 3px; margin-top: 4px; flex-wrap: wrap; }
.reaction-chip { background: var(--panel-3); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; font-size: 12px; }
.msg-tools { position: absolute; top: -14px; display: none; gap: 2px; background: var(--panel-3); border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px; z-index: 3; box-shadow: var(--shadow-card); }
.msg--in .msg-tools { left: 6px; }
.msg--out .msg-tools { right: 6px; }
.msg:hover .msg-tools { display: flex; }
.msg-tools button { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; }
.msg-tools button:hover { background: var(--panel); }
.bubble img.media { border-radius: 12px; max-width: 280px; margin: -3px -3px 5px; }

.typing-indicator { align-self: flex-start; display: flex; gap: 4px; padding: 12px 15px; background: var(--panel-2); border-radius: 16px; border-bottom-left-radius: 5px; }
.typing-indicator span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-low); animation: typing 1.2s infinite; }
.typing-indicator span:nth-child(2) { animation-delay: .15s; }
.typing-indicator span:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.composer { flex: none; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--deep); display: flex; align-items: flex-end; gap: 10px; }
.composer .icon-btn { flex: none; }
.composer-input { flex: 1; }
.composer-input textarea { max-height: 140px; min-height: 44px; padding: 11px 15px; border-radius: 22px; }
.send-btn { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; transition: .18s; }
.send-btn:hover { transform: scale(1.05); }
.send-btn[disabled] { opacity: .4; pointer-events: none; }
.attach-preview { display: flex; gap: 10px; align-items: center; padding: 9px 18px; border-top: 1px solid var(--line); background: var(--panel); }
.attach-preview img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; }

.chat-placeholder { flex: 1; display: grid; place-items: center; text-align: center; padding: 40px; color: var(--text-low); }
.chat-placeholder img { width: 84px; opacity: .5; margin: 0 auto 18px; }

/* mobile tab bar */
.mobile-nav { display: none; }

/* ------------------------- settings / panels ---------------------------- */
.pane-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.pane-narrow { max-width: 680px; margin: 0 auto; padding: 26px 22px 60px; width: 100%; }
.section-title { font-family: var(--font-display); font-size: 15px; color: var(--text-mid); margin: 28px 0 12px; letter-spacing: .3px; }
.section-title:first-child { margin-top: 6px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.setting-row { display: flex; align-items: center; gap: 14px; padding: 15px 18px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; color: inherit; transition: background .15s; }
.setting-row:last-child { border-bottom: none; }
button.setting-row:hover { background: var(--panel-2); }
.setting-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--panel-2); color: var(--purple-300); flex: none; }
.setting-label { flex: 1; min-width: 0; font-weight: 600; font-size: 14.5px; }
.setting-label small { display: block; font-weight: 500; font-size: 12.5px; color: var(--text-low); margin-top: 1px; }
.setting-value { color: var(--text-low); font-size: 13.5px; flex: none; }
.setting-row .chev { color: var(--text-low); flex: none; }
.setting-row--danger .setting-ico { background: rgba(239, 68, 102, .14); color: var(--danger); }
.setting-row--danger .setting-label { color: var(--danger); }

.profile-card { display: flex; gap: 18px; align-items: center; padding: 22px; }
.profile-card .info { min-width: 0; }
.profile-card h3 { margin: 0; font-size: 19px; font-weight: 800; }
.profile-card .uname { color: var(--text-low); font-size: 13.5px; }
.profile-card .bio { color: var(--text-mid); font-size: 13.5px; margin-top: 6px; }
.avatar-edit { position: relative; flex: none; }
.avatar-edit .avatar-overlay { position: absolute; inset: 0; border-radius: 50%; background: rgba(0, 0, 0, .45); display: grid; place-items: center; opacity: 0; transition: .18s; color: #fff; cursor: pointer; }
.avatar-edit:hover .avatar-overlay { opacity: 1; }

.seg { display: flex; gap: 5px; background: var(--panel-2); padding: 4px; border-radius: var(--radius-pill); }
.seg button { padding: 7px 14px; border-radius: var(--radius-pill); color: var(--text-low); font-weight: 600; font-size: 13px; transition: .15s; }
.seg button.is-active { background: var(--grad); color: #fff; }

.switch { position: relative; width: 46px; height: 26px; border-radius: 999px; background: var(--panel-3); transition: .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s var(--ease); }
.switch.is-on { background: var(--purple-600); }
.switch.is-on::after { transform: translateX(20px); }

.lang-option { display: flex; align-items: center; gap: 12px; }
.lang-option img { width: 26px; height: 18px; border-radius: 3px; object-fit: cover; }
.lang-option .tick { color: var(--purple-300); }

/* utilities for settings list used as tabs content */
.settings-head { height: var(--header-h); display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--deep); flex: none; }
.settings-head h2 { font-family: var(--font-display); font-size: 18px; margin: 0; }

/* --------------------------------- modal -------------------------------- */
.modal-host { position: fixed; inset: 0; z-index: 300; display: none; }
.modal-host.is-open { display: block; }
.modal-scrim { position: absolute; inset: 0; background: rgba(4, 2, 10, .72); backdrop-filter: blur(4px); animation: fade .2s; }
.modal-card {
  position: relative; margin: auto; top: 50%; transform: translateY(-50%);
  width: min(460px, calc(100vw - 32px)); max-height: 88vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 22px;
  padding: 26px; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9); animation: pop .22s var(--ease);
}
.modal-card h3 { font-family: var(--font-display); font-size: 19px; margin: 0 0 6px; }
.modal-card .modal-sub { color: var(--text-low); font-size: 13.5px; margin: 0 0 18px; }
.modal-close { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--text-low); }
.modal-close:hover { background: var(--panel-2); color: var(--text-hi); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }

.qr-box { display: grid; place-items: center; gap: 16px; text-align: center; }
.qr-canvas { background: #fff; padding: 16px; border-radius: 18px; }
.qr-canvas img, .qr-canvas canvas { width: 220px; height: 220px; }
.qr-url { font-size: 12.5px; color: var(--text-low); word-break: break-all; }

/* -------------------------------- toast --------------------------------- */
.toast-host { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
  background: var(--panel-3); color: var(--text-hi); border: 1px solid var(--line-strong);
  padding: 12px 18px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-card); animation: pop .2s var(--ease); max-width: 90vw;
}
.toast--error { background: rgba(239, 68, 102, .96); color: #fff; border-color: transparent; }
.toast--success { background: rgba(47, 206, 143, .96); color: #06231a; border-color: transparent; }

.spinner-inline { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }

/* ------------------------------- responsive ----------------------------- */
@media (max-width: 1080px) {
  :root { --list-w: 320px; }
}
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; position: relative; }
  .rail { position: fixed; bottom: 0; left: 0; right: 0; flex-direction: row; height: calc(62px + env(safe-area-inset-bottom)); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: none; border-top: 1px solid var(--line); z-index: 40; gap: 4px; }
  .rail-logo { display: none; }
  .rail-nav { flex-direction: row; flex: 1; justify-content: space-around; gap: 0; }
  .rail-btn { width: 56px; height: 48px; }
  .rail-btn.is-active::before { display: none; }
  .rail-avatar { margin: 0; }
  .list-col, .chat-col { position: absolute; inset: 0; bottom: calc(62px + env(safe-area-inset-bottom)); }
  .list-col { border-right: none; z-index: 10; }
  .chat-col { z-index: 20; transform: translateX(100%); transition: transform .24s var(--ease); }
  .app-shell.chat-open .chat-col { transform: translateX(0); }
  .app-shell.chat-open .list-col { transform: translateX(-22%); }
  .app-shell.view-settings .chat-col { transform: none; }
  .chat-header .back { display: grid; }
  .msg { max-width: 86%; }
  .settings-head { padding-top: env(safe-area-inset-top); }
}
@media (max-width: 480px) {
  .messages { padding: 16px 12px 4px; }
  .composer { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .pane-narrow { padding: 18px 14px 60px; }
  .modal-card { padding: 22px 18px; }
}

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