:root {
  color-scheme: light;
  --bg: #eef3fb;
  --surface: #ffffff;
  --surface-2: #f5f8fd;
  --surface-3: #e9eff9;
  --text: #182236;
  --muted: #6c7890;
  --line: #dce4f1;
  --blue: #0b72ff;
  --blue-2: #e7f1ff;
  --cyan: #22b8f0;
  --green: #1ea875;
  --red: #e34a5f;
  --amber: #ef9f27;
  --purple: #7656e8;
  --shadow: 0 22px 56px rgba(31, 63, 112, .14);
  --shadow-soft: 0 8px 28px rgba(31, 63, 112, .09);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1622;
    --surface: #171f2d;
    --surface-2: #1d2737;
    --surface-3: #253247;
    --text: #edf3ff;
    --muted: #9ca9bf;
    --line: #2c394e;
    --blue: #3b91ff;
    --blue-2: #17345b;
    --shadow: 0 24px 60px rgba(0, 0, 0, .34);
    --shadow-soft: 0 8px 26px rgba(0, 0, 0, .22);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1622;
  --surface: #171f2d;
  --surface-2: #1d2737;
  --surface-3: #253247;
  --text: #edf3ff;
  --muted: #9ca9bf;
  --line: #2c394e;
  --blue: #3b91ff;
  --blue-2: #17345b;
  --shadow: 0 24px 60px rgba(0, 0, 0, .34);
  --shadow-soft: 0 8px 26px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  min-height: 100dvh;
  overflow: hidden;
  font-family: Inter, ui-rounded, "SF Pro Display", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: var(--blue); }
img { max-width: 100%; }
[hidden] { display: none !important; }

.boot-screen {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 15px;
  color: var(--muted);
}
.boot-screen img { border-radius: 28px; box-shadow: var(--shadow-soft); }
.boot-pulse { width: 64px; height: 5px; border-radius: 99px; overflow: hidden; background: var(--surface-3); position: relative; }
.boot-pulse::after { content: ""; position: absolute; inset: 0; width: 45%; border-radius: inherit; background: var(--blue); animation: boot 1.15s ease-in-out infinite alternate; }
@keyframes boot { from { transform: translateX(-110%); } to { transform: translateX(235%); } }

.auth-page {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(330px, 510px) minmax(420px, 1fr);
  gap: 22px;
  padding: max(24px, var(--safe-top)) 24px max(24px, var(--safe-bottom));
}
.auth-panel, .auth-visual {
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.auth-panel { padding: 34px; overflow-y: auto; }
.auth-visual {
  position: relative;
  display: grid;
  place-items: center;
  padding: 56px;
  color: white;
  isolation: isolate;
  background:
    radial-gradient(circle at 20% 20%, rgba(83, 213, 255, .85), transparent 33%),
    radial-gradient(circle at 80% 15%, rgba(143, 99, 255, .72), transparent 30%),
    linear-gradient(145deg, #075ee8 0%, #0b72ff 45%, #0255c6 100%);
}
.auth-visual::before, .auth-visual::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 50%;
  z-index: -1;
}
.auth-visual::before { width: 520px; height: 520px; right: -110px; top: -170px; }
.auth-visual::after { width: 370px; height: 370px; left: -120px; bottom: -120px; }
.auth-visual-card { max-width: 560px; }
.auth-visual h1 { margin: 24px 0 12px; font-size: clamp(38px, 5vw, 72px); line-height: .98; letter-spacing: -.05em; }
.auth-visual p { margin: 0; max-width: 520px; font-size: 18px; line-height: 1.62; color: rgba(255,255,255,.82); }
.auth-logo { width: 78px; height: 78px; border-radius: 25px; box-shadow: 0 16px 42px rgba(0,0,0,.18); }
.auth-head { display: flex; align-items: center; gap: 14px; margin-bottom: 25px; }
.auth-head img { width: 54px; height: 54px; border-radius: 18px; }
.auth-head h2 { margin: 0; font-size: 27px; letter-spacing: -.03em; }
.auth-head p { margin: 3px 0 0; color: var(--muted); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; border-radius: 17px; background: var(--surface-2); margin-bottom: 24px; }
.auth-tab { border: 0; background: transparent; padding: 11px; border-radius: 13px; cursor: pointer; color: var(--muted); font-weight: 760; }
.auth-tab.active { background: var(--surface); color: var(--blue); box-shadow: 0 4px 16px rgba(28,57,99,.09); }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.field { display: grid; gap: 7px; }
.field > span { color: var(--muted); font-size: 12px; font-weight: 780; letter-spacing: .03em; }
.field input, .field textarea, .field select, .search-box input, .composer textarea {
  width: 100%;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface-2);
  outline: none;
  border-radius: 15px;
  padding: 13px 14px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus, .search-box input:focus, .composer textarea:focus {
  border-color: color-mix(in srgb, var(--blue) 68%, var(--line));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 12%, transparent);
  background: var(--surface);
}
.check-row { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: 13px; line-height: 1.5; }
.check-row input { margin-top: 3px; accent-color: var(--blue); }
.primary-btn, .secondary-btn, .danger-btn, .ghost-btn, .icon-btn {
  border: 0;
  cursor: pointer;
  transition: transform .12s ease, opacity .15s, background .15s;
}
.primary-btn:active, .secondary-btn:active, .danger-btn:active, .ghost-btn:active, .icon-btn:active { transform: scale(.97); }
.primary-btn, .secondary-btn, .danger-btn { min-height: 45px; padding: 11px 18px; border-radius: 15px; font-weight: 800; }
.primary-btn { color: #fff; background: linear-gradient(135deg, var(--blue), #045bd3); box-shadow: 0 9px 22px color-mix(in srgb, var(--blue) 28%, transparent); }
.secondary-btn { color: var(--blue); background: var(--blue-2); }
.danger-btn { color: #fff; background: var(--red); }
.ghost-btn { padding: 9px 12px; color: var(--muted); background: transparent; border-radius: 12px; }
.icon-btn {
  width: 43px; height: 43px; flex: 0 0 43px;
  display: grid; place-items: center;
  border-radius: 15px;
  color: var(--muted);
  background: var(--surface-2);
}
.icon-btn:hover { color: var(--blue); background: var(--blue-2); }
.icon-btn svg { width: 21px; height: 21px; }
button:disabled { opacity: .52; cursor: default; }

.app-shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: 82px minmax(310px, 390px) minmax(420px, 1fr);
  padding: max(12px, var(--safe-top)) 12px max(12px, var(--safe-bottom));
  gap: 12px;
}
.nav-rail, .list-pane, .content-pane {
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  box-shadow: var(--shadow-soft);
}
.nav-rail { border-radius: 27px; display: flex; flex-direction: column; align-items: center; padding: 13px 9px; gap: 8px; }
.brand-button { width: 55px; height: 55px; border: 0; padding: 0; background: none; cursor: pointer; margin-bottom: 8px; position: relative; }
.brand-button img { width: 100%; height: 100%; border-radius: 19px; }
.brand-badge, .nav-badge {
  position: absolute; right: -4px; top: -4px;
  min-width: 21px; height: 21px; padding: 0 5px;
  display: grid; place-items: center;
  border-radius: 99px;
  color: #fff; background: var(--red);
  border: 2px solid var(--surface);
  font-size: 10px; font-weight: 850;
}
.nav-button {
  width: 57px; min-height: 54px; border: 0; border-radius: 18px;
  color: var(--muted); background: transparent; cursor: pointer;
  display: grid; place-items: center; position: relative;
}
.nav-button svg { width: 23px; height: 23px; }
.nav-button.active { color: var(--blue); background: var(--blue-2); }
.nav-button:hover { background: var(--surface-2); }
.nav-spacer { flex: 1; }
.profile-mini { width: 48px; height: 48px; border: 0; padding: 0; border-radius: 16px; overflow: hidden; cursor: pointer; background: var(--surface-3); color: var(--blue); font-weight: 850; }
.profile-mini img { width: 100%; height: 100%; object-fit: cover; }

.list-pane { border-radius: 27px; display: flex; flex-direction: column; }
.pane-head { padding: 18px 18px 12px; display: flex; align-items: center; gap: 11px; }
.pane-title { min-width: 0; flex: 1; }
.pane-title h1 { margin: 0; font-size: 25px; letter-spacing: -.035em; }
.pane-title p { margin: 3px 0 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-wrap { padding: 0 14px 11px; }
.search-box { position: relative; }
.search-box input { padding-left: 42px; min-height: 44px; }
.search-box svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.filter-row { display: flex; gap: 7px; padding: 0 14px 10px; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip { border: 0; border-radius: 13px; padding: 9px 12px; white-space: nowrap; cursor: pointer; color: var(--muted); background: var(--surface-2); font-size: 12px; font-weight: 800; }
.filter-chip.active { background: var(--blue-2); color: var(--blue); }
.list-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 12px; }
.list-scroll::-webkit-scrollbar, .message-scroll::-webkit-scrollbar { width: 8px; }
.list-scroll::-webkit-scrollbar-thumb, .message-scroll::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }
.list-item {
  width: 100%; border: 0; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 50px minmax(0,1fr) auto;
  gap: 11px; align-items: center;
  padding: 10px; border-radius: 18px;
  color: var(--text); background: transparent;
  position: relative;
}
.list-item:hover { background: var(--surface-2); }
.list-item.active { background: var(--blue-2); }
.avatar {
  width: 50px; height: 50px; border-radius: 17px; overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #e7f1ff, #dce9fb);
  color: var(--blue); font-weight: 900; letter-spacing: -.03em;
  position: relative;
}
.avatar.group { border-radius: 19px; background: linear-gradient(145deg,#eee9ff,#e4dcff); color: var(--purple); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.online-dot { position: absolute; right: 1px; bottom: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); border: 2px solid var(--surface); }
.item-main { min-width: 0; }
.item-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.item-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.item-preview { margin-top: 4px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-side { display: grid; justify-items: end; gap: 6px; min-width: 50px; }
.item-time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.unread-pill { min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: 99px; color: #fff; background: var(--blue); font-size: 10px; font-weight: 850; }
.pin-mark { color: var(--blue); display: inline-flex; }
.pin-mark svg { width: 13px; height: 13px; }
.empty-state { min-height: 260px; display: grid; place-content: center; justify-items: center; text-align: center; padding: 30px; color: var(--muted); }
.empty-state svg { width: 48px; height: 48px; color: var(--blue); margin-bottom: 12px; }
.empty-state h3 { margin: 0 0 7px; color: var(--text); }
.empty-state p { margin: 0; max-width: 280px; line-height: 1.5; font-size: 13px; }
.list-footer { padding: 7px 13px 11px; text-align: center; color: var(--muted); font-size: 10px; }

.content-pane { border-radius: 27px; display: flex; flex-direction: column; position: relative; }
.welcome-view { flex: 1; display: grid; place-content: center; justify-items: center; padding: 40px; text-align: center; background: radial-gradient(circle at center, color-mix(in srgb,var(--blue) 8%,transparent), transparent 52%); }
.welcome-logo { width: 92px; height: 92px; border-radius: 30px; box-shadow: var(--shadow); }
.welcome-view h2 { margin: 22px 0 8px; font-size: 30px; letter-spacing: -.04em; }
.welcome-view p { margin: 0; max-width: 520px; color: var(--muted); line-height: 1.6; }
.install-btn { margin-top: 18px; }
.chat-head { min-height: 72px; display: flex; align-items: center; gap: 12px; padding: 10px 15px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(18px); }
.mobile-back { display: none; }
.chat-person { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; }
.chat-person .avatar { width: 45px; height: 45px; border-radius: 15px; }
.chat-person-name { min-width: 0; }
.chat-person-name strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-person-name span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.chat-actions { display: flex; gap: 7px; }
.message-area { flex: 1; min-height: 0; position: relative; overflow: hidden; background:
    radial-gradient(circle at 18% 16%, color-mix(in srgb, var(--blue) 9%, transparent) 0 1px, transparent 2px),
    radial-gradient(circle at 82% 77%, color-mix(in srgb, var(--purple) 8%, transparent) 0 1px, transparent 2px),
    var(--surface-2);
  background-size: 34px 34px, 42px 42px, auto;
}
.message-scroll { height: 100%; overflow-y: auto; padding: 20px 24px 24px; scroll-behavior: smooth; }
.day-separator { width: max-content; max-width: 80%; margin: 14px auto; padding: 6px 10px; border-radius: 12px; color: var(--muted); background: color-mix(in srgb,var(--surface) 88%,transparent); box-shadow: var(--shadow-soft); font-size: 10px; font-weight: 750; }
.message-row { display: flex; margin: 4px 0; align-items: flex-end; gap: 7px; }
.message-row.mine { justify-content: flex-end; }
.message-row.theirs { justify-content: flex-start; }
.bubble {
  max-width: min(72%, 690px);
  padding: 9px 12px 7px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 4px 15px rgba(38,61,100,.08);
  border: 1px solid color-mix(in srgb,var(--line) 72%,transparent);
  overflow: hidden;
}
.message-row.mine .bubble { color: #fff; background: linear-gradient(145deg,#147cff,#0765e4); border-color: transparent; border-bottom-right-radius: 6px; }
.message-row.theirs .bubble { border-bottom-left-radius: 6px; }
.sender-name { color: var(--blue); font-size: 10px; font-weight: 850; margin-bottom: 4px; }
.reply-block { border-left: 3px solid currentColor; opacity: .8; padding: 5px 8px; margin-bottom: 7px; border-radius: 7px; background: rgba(255,255,255,.12); font-size: 11px; }
.reply-block strong { display: block; margin-bottom: 2px; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.48; font-size: 14px; }
.message-meta { display: flex; justify-content: flex-end; align-items: center; gap: 5px; margin-top: 5px; font-size: 9px; opacity: .72; }
.tick { display: inline-flex; color: currentColor; }
.tick.read { color: #90edff; }
.tick svg { width: 15px; height: 15px; }
.message-image { display: block; width: min(360px, 54vw); max-height: 360px; object-fit: cover; border-radius: 13px; background: var(--surface-3); cursor: zoom-in; }
.message-file { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.file-icon { width: 39px; height: 39px; border-radius: 13px; display: grid; place-items: center; color: var(--blue); background: var(--blue-2); }
.file-icon svg { width: 20px; height: 20px; }
.file-info { min-width: 0; flex: 1; }
.file-info strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.file-info span { display: block; margin-top: 3px; font-size: 10px; opacity: .7; }
.voice-player { min-width: min(340px, 58vw); display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 9px; }
.voice-play { width: 40px; height: 40px; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--blue); background: var(--blue-2); }
.message-row.mine .voice-play { color: #fff; background: rgba(255,255,255,.18); }
.voice-wave { height: 28px; display: flex; align-items: center; gap: 2px; overflow: hidden; }
.voice-wave i { display: block; width: 3px; border-radius: 99px; background: currentColor; opacity: .58; }
.voice-duration { font-size: 10px; opacity: .78; white-space: nowrap; }
.composer-wrap { border-top: 1px solid var(--line); background: color-mix(in srgb,var(--surface) 90%,transparent); backdrop-filter: blur(18px); padding: 10px 14px 12px; }
.reply-preview { display: none; margin-bottom: 8px; padding: 8px 11px; border-radius: 13px; background: var(--surface-2); border-left: 3px solid var(--blue); font-size: 11px; }
.reply-preview.visible { display: flex; align-items: center; gap: 9px; }
.reply-preview > div { flex: 1; min-width: 0; }
.reply-preview strong, .reply-preview span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 8px; align-items: end; }
.composer textarea { min-height: 44px; max-height: 140px; resize: none; padding: 11px 13px; line-height: 1.45; }
.send-button { color: #fff; background: var(--blue); }
.recording { color: #fff !important; background: var(--red) !important; animation: record 1s ease-in-out infinite alternate; }
@keyframes record { from { box-shadow: 0 0 0 0 rgba(227,74,95,.24); } to { box-shadow: 0 0 0 9px rgba(227,74,95,0); } }

.panel-view { flex: 1; min-height: 0; overflow-y: auto; padding: 22px; }
.panel-view h2 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.035em; }
.panel-view > p { margin: 0 0 20px; color: var(--muted); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 12px; }
.info-card { border: 1px solid var(--line); border-radius: 20px; padding: 16px; background: var(--surface-2); }
.info-card h3 { margin: 0 0 5px; font-size: 15px; }
.info-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.section-card { border: 1px solid var(--line); border-radius: 22px; background: var(--surface); overflow: hidden; margin-bottom: 13px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.section-head h3 { margin: 0; font-size: 15px; }
.section-body { padding: 15px 17px; }
.action-list { display: grid; gap: 7px; }
.action-row { display: flex; align-items: center; gap: 12px; border: 0; width: 100%; text-align: left; padding: 11px; border-radius: 15px; background: var(--surface-2); cursor: pointer; }
.action-row:hover { background: var(--surface-3); }
.action-row .action-icon { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; background: var(--blue-2); color: var(--blue); }
.action-row .action-icon svg { width: 20px; height: 20px; }
.action-row > div:nth-child(2) { min-width: 0; flex: 1; }
.action-row strong { display: block; font-size: 13px; }
.action-row span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); gap: 12px; }
.status-card { aspect-ratio: 3/4; border: 0; border-radius: 22px; overflow: hidden; cursor: pointer; position: relative; background: var(--surface-3); color: white; }
.status-card img { width: 100%; height: 100%; object-fit: cover; }
.status-card::after { content:""; position:absolute; inset:0; background:linear-gradient(transparent 45%,rgba(0,0,0,.7)); }
.status-label { position: absolute; z-index: 1; left: 12px; right: 12px; bottom: 12px; text-align: left; }
.status-label strong, .status-label span { display: block; }
.status-label span { font-size: 10px; opacity: .78; margin-top: 3px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 18px; background: rgba(7,15,30,.52); backdrop-filter: blur(8px); }
.modal-card { width: min(520px,100%); max-height: min(760px,calc(100dvh - 36px)); overflow-y: auto; border-radius: 27px; background: var(--surface); color: var(--text); box-shadow: 0 30px 90px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 19px 12px; }
.modal-symbol { width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center; color: var(--blue); background: var(--blue-2); }
.modal-symbol svg { width: 22px; height: 22px; }
.modal-title { flex: 1; }
.modal-title h3 { margin: 0; font-size: 18px; }
.modal-title p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.modal-body { padding: 10px 19px 19px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 15px; }
.context-menu { position: fixed; z-index: 900; min-width: 210px; padding: 7px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); }
.context-menu button { width: 100%; display: flex; align-items: center; gap: 9px; border: 0; border-radius: 12px; padding: 10px; background: transparent; cursor: pointer; text-align: left; }
.context-menu button:hover { background: var(--surface-2); }
.context-menu button.danger { color: var(--red); }
.context-menu svg { width: 18px; height: 18px; }

.toast-region { position: fixed; z-index: 2000; right: 18px; bottom: calc(18px + var(--safe-bottom)); display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: 380px; padding: 12px 15px; border-radius: 15px; color: #fff; background: #182236; box-shadow: var(--shadow); font-size: 13px; animation: toast-in .2s ease-out; }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.loading-line { height: 3px; background: var(--surface-3); overflow: hidden; }
.loading-line::after { content:""; display:block; height:100%; width:38%; background:var(--blue); animation:load 1s linear infinite; }
@keyframes load { from{transform:translateX(-110%)} to{transform:translateX(310%)} }
.skeleton { background: linear-gradient(90deg,var(--surface-2),var(--surface-3),var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.25s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 76px minmax(300px, 365px) minmax(380px, 1fr); }
  .bubble { max-width: 82%; }
}

@media (max-width: 820px) {
  body { overflow: auto; }
  .auth-page { grid-template-columns: 1fr; padding: 12px; }
  .auth-visual { display: none; }
  .auth-panel { border-radius: 24px; padding: 24px; min-height: calc(100dvh - 24px); }
  .app-shell { min-height: 100dvh; height: 100dvh; grid-template-columns: 1fr; padding: 0; gap: 0; }
  .nav-rail {
    position: fixed; z-index: 300; left: 9px; right: 9px; bottom: calc(8px + var(--safe-bottom));
    height: 68px; border-radius: 22px; padding: 6px 8px; flex-direction: row; justify-content: space-around;
    box-shadow: 0 16px 46px rgba(16,32,61,.24);
  }
  .brand-button, .profile-mini, .nav-spacer, .nav-button.desktop-only { display: none; }
  .nav-button { width: 52px; min-height: 52px; }
  .list-pane, .content-pane { position: fixed; inset: 0; border: 0; border-radius: 0; box-shadow: none; padding-bottom: calc(82px + var(--safe-bottom)); }
  .content-pane { transform: translateX(100%); transition: transform .23s ease; z-index: 200; padding-bottom: 0; }
  .app-shell.chat-open .content-pane { transform: translateX(0); }
  .app-shell.chat-open .list-pane { visibility: hidden; }
  .mobile-back { display: grid; }
  .chat-head { padding-top: max(10px,var(--safe-top)); min-height: calc(68px + var(--safe-top)); }
  .message-scroll { padding: 15px 12px 18px; }
  .bubble { max-width: 88%; }
  .message-image { width: min(330px, 70vw); }
  .voice-player { min-width: min(310px, 68vw); }
  .composer-wrap { padding-bottom: max(10px,var(--safe-bottom)); }
  .panel-view { padding: 17px 14px 96px; }
}

@media (max-width: 540px) {
  .form-grid.two { grid-template-columns: 1fr; }
  .auth-panel { padding: 19px; }
  .pane-head { padding-top: max(18px,var(--safe-top)); }
  .chat-actions .optional-mobile { display: none; }
  .status-grid { grid-template-columns: repeat(2,1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
