@font-face {
  font-family:"Inter";
  src:url("InterVariable.woff2") format("woff2");
  font-style:normal;
  font-weight:100 900;
  font-display:swap
}
:root {
  color-scheme:light;
  --tg-theme-bg-color:#fff;
  --tg-theme-secondary-bg-color:#f4f4f5;
  --tg-theme-text-color:#18222d;
  --tg-theme-hint-color:#7b8b99;
  --tg-theme-link-color:#3390ec;
  --tg-theme-button-color:#3390ec;
  --tg-theme-button-text-color:#fff;
  --tg-theme-header-bg-color:#fff;
  --accent:var(--tg-theme-button-color);
  --file-button-text:var(--tg-theme-button-text-color);
  --bg:var(--tg-theme-bg-color);
  --surface:var(--tg-theme-secondary-bg-color);
  --text:var(--tg-theme-text-color);
  --muted:var(--tg-theme-hint-color);
  --line:color-mix(in srgb,var(--text) 8%,transparent);
  --soft-accent:color-mix(in srgb,var(--accent) 10%,var(--bg));
  --bubble-out:#258fdf;
  --incoming:#f0f0f4;
  --out-text:#fff;
  --out-meta:#e4f3ff;
  --meta-color:#707078;
  --header:#fff;
  --deleted-bg:#f7edef;
  --deleted-text:#63444c;
  --deleted-line:#d5b4bd;
  --deleted-meta:#86505b;
  --wallpaper:#fff;
  --bubble-shadow:0 1px 2px #18222d17;
  --radius-control:999px;
  --radius-surface:24px;
  --radius-panel:28px;
  --radius-message:20px;
  --radius-pill:999px;
  --control-height:48px;
  --control-compact:40px;
  --control-icon:40px;
  --space-card:16px;
  --space-section:20px;
  --danger:#d65555;
  --safe-top:max(var(--tg-content-safe-area-inset-top,0px),var(--tg-safe-area-inset-top,0px),env(safe-area-inset-top,0px));
  --safe-bottom:max(var(--tg-content-safe-area-inset-bottom,0px),var(--tg-safe-area-inset-bottom,0px),env(safe-area-inset-bottom,0px));
  --font-ui:"Inter";
  font-family:var(--font-ui),system-ui,sans-serif;
  font-synthesis:none
}
:root[data-theme=dark] {
  color-scheme:dark;
  --bg:#1c1c1e;
  --surface:#272729;
  --text:#f5f5f5;
  --muted:#a0a0a5;
  --line:#ffffff0d;
  --accent:#75b5e9;
  --file-button-text:#102b40;
  --soft-accent:#75b5e91c;
  --incoming:#232325;
  --bubble-out:#383a3c;
  --out-text:#f5f5f5;
  --out-meta:#bec0c3;
  --meta-color:#a8a8ae;
  --wallpaper:#171719;
  --header:#1c1c1e;
  --deleted-bg:#33272c;
  --deleted-text:#eedde2;
  --deleted-line:#70515d;
  --deleted-meta:#d0afb9;
  --danger:#ed9eaf;
  --bubble-shadow:none
}
* {
  box-sizing:border-box
}
html { background:var(--bg); min-height:100%; }
html,body { overflow-x:hidden; overscroll-behavior-x:none; touch-action:pan-y; }
body {
  margin:0;
  min-height:100vh;
  background:var(--bg);
  color:var(--text);
  font-size:15px
}
button,input,a {
  -webkit-tap-highlight-color:transparent
}
button,input {
  font:inherit
}
button {
  cursor:pointer
}
button:disabled {
  cursor:wait;
  opacity:.55
}
button:focus-visible,a:focus-visible,input:focus-visible,[tabindex]:focus-visible {
  outline:3px solid color-mix(in srgb,var(--accent) 60%,transparent);
  outline-offset:2px
}
button {
  border:0
}
a {
  color:var(--tg-theme-link-color)
}
svg {
  width:22px;
  height:22px;
  display:block;
  stroke:currentColor;
  fill:none;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
  flex-shrink:0
}
[hidden] {
  display:none!important
}
.app-shell {
  display:grid;
  grid-template-columns:360px minmax(0,1fr);
  height:var(--layout-height,100vh);
  max-width:1600px;
  margin:auto;
  background:var(--bg);
  overflow:hidden
}
.sidebar {
  display:flex;
  flex-direction:column;
  min-width:0;
  background:var(--bg);
  border-right:1px solid var(--line);
  z-index:2;
  padding-top:var(--safe-top)
}
.sidebar-header {
  display:flex;
  gap:12px;
  align-items:center;
  padding:24px 22px 20px
}
.brand-mark {
  width:43px;
  height:43px;
  flex-shrink:0;
  overflow:hidden;
  border-radius:50%;
  background:var(--accent);
}
.brand-mark img { width:100%; height:100%; display:block; object-fit:cover; }

h1,h2,h3,p {
  margin:0
}
.brand h1 {
  font-size:23px;
  letter-spacing:-.5px;
  font-weight:650
}
.brand p {
  color:var(--muted);
  font-size:12px;
  margin-top:4px
}
.sidebar-search {
  padding:0 16px 16px
}
.search-field {
  display:flex;
  align-items:center;
  gap:10px;
  background:var(--surface);
  border-radius:12px;
  padding:0 13px;
  color:var(--muted);
  height:42px;
  min-width:0
}
.search-field svg {
  width:20px;
  height:20px
}
.search-field input {
  border:0;
  outline:0;
  background:transparent;
  min-width:0;
  width:100%;
  color:var(--text);
  height:100%;
  font-size:16px
}
.search-field input::placeholder {
  color:var(--muted);
  opacity:1
}
.sidebar-section {
  display:flex;
  justify-content:space-between;
  padding:3px 24px 11px;
  font-size:10px;
  letter-spacing:1.4px;
  font-weight:700;
  color:var(--muted)
}
.chat-list {
  overflow-y:auto;
  flex:1;
  scrollbar-width:thin;
  padding:0 8px
}
.chat-row {
  width:100%;
  display:flex;
  gap:12px;
  align-items:center;
  text-align:left;
  background:transparent;
  border-radius:12px;
  padding:13px 12px;
  color:var(--text);
  transition:background .12s,transform .12s
}
.chat-row.selected {
  background:var(--soft-accent)
}
.chat-row:active:not(.selected) {
  background:var(--surface);
  transform:scale(.995)
}
@media (hover:hover) and (pointer:fine) {
  .chat-row:hover:not(.selected) { background:var(--surface); }
}
.avatar {
  width:51px;
  height:51px;
  border-radius:50%;
  background:var(--avatar-color,#74b3e8);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:19px;
  font-weight:550;
  flex-shrink:0;
  letter-spacing:-.5px
}
.avatar-0 {
  --avatar-color:#6d9ee8
}
.avatar-1 {
  --avatar-color:#8b83dc
}
.avatar-2 {
  --avatar-color:#e4a053
}
.avatar-3 {
  --avatar-color:#70b797
}
.avatar-4 {
  --avatar-color:#d47f9a
}
.avatar-5 {
  --avatar-color:#68b1be
}
.chat-body {
  min-width:0;
  flex:1
}
.chat-topline {
  display:flex;
  gap:8px;
  align-items:center;
  margin-bottom:7px
}
.chat-title {
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  flex:1;
  font-size:15px;
  font-weight:600
}
.chat-time {
  font-size:11px;
  color:var(--muted);
  white-space:nowrap
}
.chat-bottomline {
  display:flex;
  gap:8px;
  align-items:center
}
.chat-preview {
  min-width:0;
  flex:1;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--muted);
  font-size:13px;
  line-height:18px
}
.chat-indicator {
  border-radius:9px;
  min-width:19px;
  height:19px;
  padding:1px 6px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--surface);
  font-size:10px;
  color:var(--muted)
}
.chat-row.selected .chat-indicator {
  background:var(--accent);
  color:var(--tg-theme-button-text-color)
}
.conversation {
  min-width:0;
  height:100%;
  position:relative;
  background:var(--wallpaper)
}
.conversation::before { content:none; }
.welcome {
  position:relative;
  height:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:24px
}
.welcome-icon {
  height:90px;
  width:90px;
  border-radius:28px;
  display:grid;
  place-items:center;
  background:color-mix(in srgb,var(--bg) 72%,transparent);
  color:var(--accent);
  margin-bottom:24px;
  box-shadow:0 8px 32px #17212b08
}
.welcome-icon svg {
  width:40px;
  height:40px;
  stroke-width:1.5
}
.welcome h2 {
  font-size:23px;
  font-weight:600;
  letter-spacing:-.5px
}
.welcome p {
  font-size:14px;
  line-height:1.7;
  color:var(--muted);
  margin-top:12px
}
.welcome-note {
  display:flex;
  align-items:center;
  gap:6px;
  font-size:11px;
  color:var(--muted);
  margin-top:35px
}
.welcome-note svg {
  width:13px;
  height:13px
}
.thread {
  height:100%;
  display:flex;
  flex-direction:column;
  position:relative
}
.thread-header {
  display:grid;
  grid-template-columns:40px minmax(0,1fr) 40px;
  gap:10px;
  align-items:center;
  padding:9px 12px;
  padding-top:calc(9px + var(--safe-top));
  background:var(--header);
  min-height:70px;
  border-bottom:1px solid var(--line)
}
.header-identity {
  display:grid;
  grid-template-columns:40px minmax(0,1fr) 40px;
  align-items:center;
  gap:6px;
  width:100%;
  max-width:420px;
  min-height:48px;
  min-width:0;
  padding:4px 6px;
  border-radius:var(--radius-pill);
  background:var(--surface);
  justify-self:center
}
.icon-button.header-search-button {
  width:40px;
  height:40px;
  padding:7px;
  border-radius:50%;
  background:var(--bg);
  color:var(--muted);
  transition:color .14s ease,transform .14s ease
}
.thread-avatar { justify-self:center; }
.header-search-button svg { width:26px; height:26px; }
.header-search-button:active { color:var(--text); transform:scale(.94); }
@media (hover:hover) and (pointer:fine) {
  .header-search-button:hover { color:var(--text); }
}
.header-center-spacer { width:40px; height:40px; }
.thread-tools-panel { flex-shrink:0; background:var(--bg); }
.thread-avatar {
  width:36px;
  height:36px;
  font-size:15px
}
.thread-heading {
  min-width:0;
  width:100%;
  text-align:center;
  color:var(--text);
  padding:0 4px
}
.thread-heading h2 {
  font-size:17px;
  letter-spacing:-.2px;
  font-weight:600;
  white-space:nowrap;
  text-overflow:ellipsis;
  overflow:hidden
}
.thread-heading p {
  font-size:12px;
  color:var(--muted);
  margin-top:2px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap
}
.header-archive {
  color:var(--muted)
}
.icon-button {
  height:36px;
  width:36px;
  padding:7px;
  display:grid;
  place-items:center;
  color:var(--muted);
  border-radius:50%;
  background:transparent;
  flex-shrink:0
}
@media (hover:hover) and (pointer:fine) {
  .icon-button:hover { background:var(--surface); }
}
.mobile-back { display:grid; color:var(--accent); }
.thread-tools {
  background:var(--bg);
  display:flex;
  gap:10px;
  padding:12px 27px 10px;
  align-items:center
}
.message-search {
  flex:1;
  height:42px;
  border-radius:12px
}
.search-options {
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  padding:0 27px 10px;
}
.search-options[hidden] { display:none; }
.reset-search { background:transparent; color:var(--accent); font-size:13px; padding:8px 0 8px 8px; }
.filters {
  display:flex;
  flex-wrap:wrap;
  gap:7px;
  background:var(--bg);
  padding:3px 27px 13px;
  overflow-x:hidden;
  border-bottom:1px solid var(--line);
  flex-shrink:0
}
.filter {
  white-space:nowrap;
  background:transparent;
  color:var(--muted);
  padding:8px 12px;
  border-radius:8px;
  font-size:12px;
  font-weight:550
}
@media (hover:hover) and (pointer:fine) {
  .filter:hover { background:var(--surface); }
}
.filter.active {
  background:var(--soft-accent);
  color:var(--accent)
}
.message-pane { position:relative; display:flex; flex-direction:column; flex:1; min-height:0; }
.history-progress { position:absolute; top:8px; left:50%; transform:translateX(-50%); z-index:3; max-width:calc(100% - 24px); padding:6px 12px; border-radius:16px; border:1px solid var(--line); background:var(--bg); color:var(--muted); font-size:12px; line-height:18px; white-space:nowrap; pointer-events:none; box-shadow:0 2px 10px #0001; }
.message-scroll {
  overflow-y:auto;
  flex:1;
  position:relative;
  scrollbar-width:thin;
  padding:6px 14px calc(18px + var(--safe-bottom));
  overscroll-behavior:contain
}
.messages {
  max-width:820px;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  gap:0
}
.day-group { display:flex; flex-direction:column; gap:0; }
.date-divider {
  align-self:center;
  position:sticky;
  top:6px;
  z-index:1;
  padding:3px 10px;
  margin:12px 0 10px;
  border-radius:14px;
  background:var(--surface);
  color:var(--muted);
  font-size:12px;
  line-height:17px;
  font-weight:500
}
.message {
  --message-meta:var(--meta-color);
  position:relative;
  align-self:flex-start;
  max-width:min(87%,600px);
  min-width:58px;
  margin-top:6px;
  background:var(--incoming);
  color:var(--text);
  border-radius:16px 16px 16px 5px;
  padding:6px 10px;
  overflow-wrap:anywhere;
  scroll-margin:50px
}
.message.outgoing {
  --message-meta:var(--out-meta);
  align-self:flex-end;
  color:var(--out-text);
  background:var(--bubble-out);
  border-radius:16px 16px 5px 16px
}
.date-divider + .message { margin-top:0; }
.message.group-next { border-top-left-radius:6px; }
.message.group-continues { border-bottom-left-radius:6px; }
.message.outgoing.group-next { border-top-left-radius:16px; border-top-right-radius:6px; }
.message.outgoing.group-continues { border-bottom-left-radius:16px; border-bottom-right-radius:6px; }
.message.deleted {
  --message-meta:var(--deleted-meta);
  color:var(--deleted-text);
  background:var(--deleted-bg);
  border:1px solid var(--deleted-line)
}
.message-author {
  font-weight:600;
  color:var(--accent);
  font-size:12px;
  margin:0 0 6px
}
.message-text {
  white-space:pre-wrap;
  font-size:16px;
  line-height:1.35;
  word-break:break-word
}
.message-text::after { content:""; display:inline-block; width:var(--meta-space,43px); height:1px; }
.message.outgoing a { color:inherit; text-decoration:underline; }
.message-text pre {
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  margin:6px 0;
  font-family:inherit;
  font-size:12px;
  line-height:1.5;
  background:color-mix(in srgb,var(--text) 6%,transparent);
  padding:8px;
  border-radius:6px
}
.message-text code {
  font-family:inherit;
  font-size:.91em
}
.message-text a {
  word-break:break-word;
  text-decoration:none
}
.spoiler {
  background:color-mix(in srgb,var(--text) 14%,transparent);
  border-radius:3px
}
.message-meta {
  position:absolute;
  right:9px;
  bottom:5px;
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:5px;
  color:var(--message-meta);
  font-size:10px;
  line-height:14px;
  white-space:nowrap
}
.message:not(.has-text) .message-meta { position:static; margin-top:5px; }
.state-deleted { font-size:9px; padding:0 4px; border-radius:4px; background:color-mix(in srgb,var(--deleted-line) 23%,transparent); }
.edit-button { display:inline-flex; align-items:center; gap:2px; color:var(--accent); font-size:10px; line-height:14px; padding:0; background:transparent; }
.edit-button svg { width:12px; height:12px; stroke-width:1.8; }
.message.outgoing .edit-button { color:var(--out-text); }
:root[data-theme=dark] .message.outgoing .edit-button { color:#8cc6f0; }
@media (hover:hover) and (pointer:fine) {
  .edit-button:hover { text-decoration:underline; }
}
.text-button {
  font-size:11px;
  color:var(--tg-theme-link-color);
  background:transparent;
  padding:3px 0;
  display:flex;
  gap:4px;
  align-items:center
}
.text-button svg {
  width:13px;
  height:13px
}
.media-card {
  min-width:0;
  max-width:100%;
  margin:4px 0 2px;
  padding:2px 1px;
}
.file-summary {
  display:flex;
  align-items:center;
  gap:11px;
  min-width:0;
}
.file-icon {
  width:42px;
  height:42px;
  aspect-ratio:1;
  flex:0 0 42px;
  border-radius:13px;
  background:color-mix(in srgb,var(--accent) 13%,transparent);
  color:var(--accent);
  display:grid;
  place-items:center;
}
.file-icon svg { display:block; width:22px; height:22px; }
.file-description { flex:1; min-width:0; }
.file-name { font-size:15px; font-weight:550; line-height:1.35; word-break:break-word; margin:0; }
.file-metadata { color:var(--muted); font-size:12px; line-height:1.5; margin:3px 0 0; }
.file-actions { display:flex; flex-wrap:wrap; align-items:center; gap:7px; margin-top:10px; }
.file-actions .file-primary {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  flex:0 1 auto;
  min-width:0;
  min-height:35px;
  padding:7px 11px;
  border-radius:12px;
  font-size:12px;
  font-weight:550;
  line-height:17px;
  background:var(--accent);
  color:var(--file-button-text);
  text-align:center;
  white-space:nowrap;
}
.file-primary svg { display:block; flex:0 0 15px; width:15px; height:15px; }
.file-actions .file-primary:disabled { opacity:.75; }
.file-actions .file-secondary {
  display:inline-flex;
  flex:0 1 auto;
  align-items:center;
  justify-content:center;
  gap:6px;
  min-height:35px;
  border:1px solid var(--line);
  border-radius:var(--radius-pill);
  background:var(--bg);
  color:var(--text);
  padding:7px 10px;
  font-size:12px;
  line-height:17px;
  text-align:center;
  white-space:nowrap;
}
@media (hover:hover) and (pointer:fine) {
  .file-secondary:hover { background:color-mix(in srgb,var(--accent) 16%,var(--bg)); }
}
.file-secondary svg { display:block; flex:0 0 14px; width:14px; height:14px; }
.message.outgoing .file-actions .file-primary { background:#ffffff26; color:var(--out-text); }
.message.deleted .file-actions .file-primary { background:var(--accent); color:var(--file-button-text); }
.empty-surface { display:flex; align-items:center; justify-content:center; }
#chat-items.empty-surface,#messages.empty-surface { min-height:100%; }
.empty-state { max-width:320px; padding:28px 22px; text-align:center; margin:auto; }
.empty-icon { display:grid; place-items:center; width:64px; height:64px; margin:0 auto 18px; border-radius:50%; background:var(--soft-accent); color:var(--accent); }
.empty-icon svg { width:29px; height:29px; stroke-width:1.65; }
.empty-state h3 { font-size:17px; line-height:1.3; font-weight:600; margin:0; }
.empty-state p { max-width:260px; margin:9px auto 0; font-size:14px; line-height:1.5; color:var(--muted); }
.empty-action { margin:18px auto 0; min-height:40px; padding:9px 17px; font-size:14px; font-weight:550; border-radius:20px; background:var(--soft-accent); color:var(--accent); }
.loading-label {
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
  gap:9px;
  padding:25px;
  font-size:12px
}
.spinner {
  width:17px;
  height:17px;
  border:2px solid color-mix(in srgb,var(--muted) 25%,transparent);
  border-top-color:var(--accent);
  border-radius:50%;
  animation:spin .7s linear infinite
}
.notice {
  position:fixed;
  bottom:25px;
  left:50%;
  transform:translateX(-50%);
  z-index:30;
  background:var(--text);
  color:var(--bg);
  box-shadow:0 4px 20px #0002;
  border-radius:12px;
  padding:13px 20px;
  font-size:13px;
  max-width:min(90vw,560px);
  line-height:1.5
}
.gate {
  position:fixed;
  inset:0;
  background:var(--bg);
  z-index:40;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:32px;
  gap:17px
}
.boot-status {
  position: fixed;
  inset: 0;
  z-index: 39;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px;
  text-align: center;
  color: var(--text);
  background: var(--bg);
}
.boot-status[hidden] { display: none !important; }
.boot-status.failed .boot-spinner { display: none; }
.boot-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: boot-spin .8s linear infinite;
}
.boot-status h2 { margin-top: 4px; font-size: 19px; }
.boot-status p { max-width: 300px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.boot-status small { max-width: 300px; color: var(--muted); font-size: 11px; opacity: .8; }
.boot-status button {
  min-height: 42px;
  margin-top: 4px;
  padding: 0 18px;
  border-radius: 14px;
  color: var(--tg-theme-button-text-color);
  background: var(--accent);
  font-weight: 600;
}
@keyframes boot-spin { to { transform: rotate(360deg); } }
.gate svg {
  height:54px;
  width:54px;
  color:var(--accent)
}
.gate h1 {
  font-size:22px
}
.gate p {
  color:var(--muted);
  font-size:14px;
  max-width:350px;
  line-height:1.7
}
.gate button {
  padding:12px 23px;
  border-radius:10px;
  color:var(--tg-theme-button-text-color);
  background:var(--accent)
}
.sheet {
  border:0;
  color:var(--text);
  background:var(--bg);
  padding:0;
  border-radius:20px;
  max-width:620px;
  width:calc(100% - 36px);
  max-height:84dvh;
  box-shadow:0 24px 100px #0004;
  overflow-x:hidden;
  overflow-y:auto
}
.sheet::backdrop {
  background:#00000080;
  backdrop-filter:blur(3px)
}
.sheet-handle {
  height:4px;
  background:var(--line);
  width:36px;
  border-radius:4px;
  margin:9px auto -3px
}
.sheet-header {
  padding:20px 23px 17px;
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
  position:sticky;
  top:0;
  background:var(--bg);
  z-index:1;
  border-bottom:1px solid var(--line)
}
.sheet-header h2 {
  font-size:19px;
  letter-spacing:-.3px
}
.eyebrow {
  color:var(--muted);
  font-size:9px;
  letter-spacing:1.2px;
  font-weight:650;
  margin-bottom:7px
}
.sheet-content {
  padding:20px 23px calc(23px + var(--safe-bottom))
}
.version-item { padding:0; position:relative; }
.version-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  margin-bottom:6px
}
.version-heading h3 {
  font-size:16px;
  font-weight:600
}
.version-date {
  font-size:12px;
  color:var(--muted)
}
.version-text {
  padding:12px;
  background:var(--surface);
  border-radius:10px;
  margin:10px 0;
  font-size:16px;
  line-height:1.45;
  white-space:pre-wrap;
  overflow-wrap:anywhere
}
.version-diff {
  margin-top:10px
}
.version-diff summary {
  cursor:pointer;
  color:var(--accent);
  font-size:11px;
  padding:3px 0
}
.diff-text {
  font-size:13px;
  line-height:1.7;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  margin-top:8px
}
.diff-text ins {
  text-decoration:none;
  background:#54bc7830;
  color:var(--text);
  border-radius:2px
}
.diff-text del {
  background:#e3696930;
  color:var(--text);
  border-radius:2px
}
.diff-legend {
  font-size:10px;
  color:var(--muted);
  display:flex;
  gap:10px;
  margin-top:8px
}
.diff-legend span:first-child::before {
  content:"";
  display:inline-block;
  width:8px;
  height:8px;
  border-radius:2px;
  background:#e3696950;
  margin-right:4px
}
.diff-legend span:last-child::before {
  content:"";
  display:inline-block;
  width:8px;
  height:8px;
  border-radius:2px;
  background:#54bc7850;
  margin-right:4px
}
.media-view {
  max-width:100%;
  max-height:60dvh;
  display:block;
  margin:0 auto;
  border-radius:9px
}
.media-sheet audio {
  width:100%;
  margin:14px 0
}
.download-link {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  margin-top:16px;
  padding:12px;
  width:100%;
  min-height:42px;
  border:1px solid color-mix(in srgb,var(--accent) 18%,transparent);
  background:var(--soft-accent);
  color:var(--accent);
  border-radius:10px;
  text-decoration:none;
  font-size:13px
}
button.download-link { cursor:pointer; }
.preview-banner {
  position:fixed;
  top:0;
  left:0;
  right:0;
  min-height:31px;
  background:#f5c96a;
  color:#54370a;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:14px;
  font-size:11px;
  z-index:60;
  padding:6px 10px
}
.preview-banner button {
  font-size:10px;
  font-weight:600;
  background:#54370a14;
  border-radius:5px;
  padding:3px 8px;
  color:inherit
}
.is-preview .app-shell {
  height:calc(var(--layout-height,100vh) - 35px);
  margin-top:35px
}
.is-preview .gate {
  top:35px
}
@keyframes spin {
  to {
    transform:rotate(360deg)
  }
}
@keyframes shimmer {
  to {
    background-position:-200% 0
  }
}
@media(min-width:1600px) {
  .app-shell {
    border-left:1px solid var(--line);
    border-right:1px solid var(--line)
  }
}
@media(max-width:1050px) {
  .app-shell {
    grid-template-columns:310px minmax(0,1fr)
  }
  .sidebar-header {
    padding:21px 18px
  }
  .brand-badge {
    display:none
  }
  .thread-tools,.filters,.search-options {
    padding-left:20px;
    padding-right:20px
  }
  .message-scroll {
    padding-left:20px;
    padding-right:20px
  }
  .filter {
    font-size:11px;
    padding:8px 10px
  }
}
@media(max-width:700px) {
  .app-shell {
    display:block
  }
  .sidebar {
    height:100%;
    border:0
  }
  .conversation {
    display:none
  }
  .app-shell.chat-open .sidebar {
    display:none
  }
  .app-shell.chat-open .conversation {
    display:block;
    height:100%
  }
  .sidebar-header {
    padding:19px 19px 20px
  }
  .chat-row {
    padding:12px 10px
  }
  .chat-list {
    padding:0 7px
  }
  .chat-title {
    font-size:16px
  }
  .chat-preview {
    font-size:14px
  }
  .avatar {
    width:54px;
    height:54px
  }
  .avatar.thread-avatar {
    width:36px;
    height:36px
  }
  .thread-heading h2 {
    font-size:16px
  }
  .thread-heading p {
    font-size:11px
  }
  .header-archive svg {
    width:19px;
    height:19px
  }
  .thread-tools {
    padding:11px 13px 7px;
    gap:7px
  }
  .message-search {
    height:36px
  }
  .search-field input {
    font-size:16px
  }
  .filters {
    padding:3px 13px 10px;
    gap:4px
  }
  .filter {
    font-size:11px;
    padding:8px 10px
  }
  .message-scroll {
    padding:11px 12px 21px
  }
  .thread-footer {
    padding:10px 14px calc(10px + var(--safe-bottom));
    font-size:9px
  }
  .thread-footer svg {
    height:12px;
    width:12px
  }
  .sheet {
    position:fixed;
    top:auto;
    bottom:0;
    margin:0;
    width:100%;
    max-width:none;
    max-height:88dvh;
    border-radius:20px 20px 0 0
  }
  .sheet-header {
    padding:18px
  }
  .sheet-content {
    padding:18px 18px calc(20px + var(--safe-bottom))
  }
  .sheet-header h2 {
    font-size:18px
  }
  .notice {
    bottom:20px
  }
  .preview-banner {
    font-size:9px;
    gap:7px
  }
  .preview-banner button {
    font-size:9px
  }
  .read-only {
    font-size:9px
  }
}
@media(prefers-reduced-motion:reduce) {
  * {
    animation:none!important;
    scroll-behavior:auto!important
  }
}
/* Keep long archives inside the viewport instead of expanding the grid row. */
.app-shell {
  grid-template-rows:minmax(0,1fr)
}
.sidebar,.conversation,.thread,.message-scroll {
  min-height:0
}
.thread-header,.thread-tools-panel,.thread-tools,.filters {
  flex-shrink:0
}

/* Keep input text above iOS's automatic focus zoom threshold. */
input,textarea,select,[contenteditable="true"] { font-size:16px; }
.avatar { position:relative; overflow:hidden; }
.avatar img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.time-explanation { color:var(--muted); font-size:11px; line-height:1.5; margin:0 auto 14px; max-width:820px; }
@media(max-width:380px) {
  .thread-tools { flex-wrap:wrap; }
  .message-search { flex-basis:100%; }
}

.version-navigation { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
.version-step { display:grid; place-items:center; width:40px; height:40px; border-radius:20px; color:var(--accent); background:var(--surface); font-size:20px; }
.version-step:disabled { cursor:default; opacity:.35; }
.version-counter { color:var(--muted); font-size:13px; font-variant-numeric:tabular-nums; }
.version-selector { display:flex; flex-wrap:wrap; gap:7px; overflow-x:hidden; padding:0 0 18px; }
.version-chip { min-width:34px; height:30px; padding:0 10px; border-radius:15px; background:var(--surface); color:var(--muted); font-size:13px; flex-shrink:0; }
.version-chip.active { background:var(--accent); color:var(--bg); }
.version-author { color:var(--muted); font-size:12px; margin:5px 0 0; }
.version-item .time-explanation { margin:8px 0 0; font-size:11px; }
.message.outgoing .file-metadata { color:var(--out-meta); }
.message.outgoing .file-icon { color:var(--out-text); background:#ffffff24; }
.message.deleted .file-metadata { color:var(--deleted-meta); }
.thread-heading h2 { margin:0; }
.thread-title-button {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:5px;
  max-width:100%;
  padding:0;
  color:inherit;
  background:transparent;
  font:inherit;
  letter-spacing:inherit;
  vertical-align:middle;
}
.thread-title-button>span:first-child { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.thread-title-button:active:not(:disabled) { opacity:.68; }
.thread-title-button:disabled { cursor:default; }
.chat-actions-sheet { max-width:460px; }
.chat-action-identity { display:flex; align-items:center; gap:12px; min-width:0; margin-bottom:14px; }
.chat-action-identity-icon { display:grid; place-items:center; width:42px; height:42px; flex:0 0 42px; color:var(--accent); background:var(--soft-accent); border-radius:50%; }
.chat-action-identity-icon svg { width:21px; height:21px; }
.chat-action-identity>div { display:grid; gap:3px; min-width:0; }
.chat-action-identity strong { overflow:hidden; color:var(--text); font-size:16px; text-overflow:ellipsis; white-space:nowrap; }
.chat-action-identity span { color:var(--muted); font-size:12px; }
.chat-action-note,.delete-chat-scope { margin:0 0 14px; color:var(--muted); font-size:13px; line-height:1.5; }
.chat-action-list { display:grid; gap:9px; }
.chat-action-button { display:flex; align-items:center; gap:12px; width:100%; min-height:62px; padding:11px 14px; border:1px solid var(--line); border-radius:var(--radius-surface); background:var(--surface); color:var(--text); text-align:left; }
.chat-action-button>span:first-child { display:grid; place-items:center; flex:0 0 24px; color:var(--accent); }
.chat-action-button>span:first-child svg { width:21px; height:21px; }
.chat-action-button>span:last-child { display:grid; gap:3px; min-width:0; }
.chat-action-button strong { font-size:14px; font-weight:650; line-height:1.25; }
.chat-action-button small { color:var(--muted); font-size:12px; line-height:1.35; }
.chat-action-button:active { transform:scale(.99); }
.chat-action-destructive>span:first-child,.chat-action-destructive strong { color:var(--danger); }
.delete-chat-warning { margin-bottom:16px; padding:14px 15px; border:1px solid color-mix(in srgb,var(--danger) 26%,transparent); border-radius:var(--radius-surface); background:color-mix(in srgb,var(--danger) 8%,var(--surface)); }
.delete-chat-warning strong { display:block; color:var(--danger); font-size:14px; }
.delete-chat-warning p { margin:6px 0 0; color:var(--text); font-size:13px; line-height:1.5; }
.delete-chat-scope { margin:0 0 11px; }
.chat-delete-confirm-actions { display:grid; grid-template-columns:1fr 1fr; gap:9px; margin-top:20px; }
.chat-delete-confirm-actions button { min-height:var(--control-height); padding:10px 16px; border-radius:var(--radius-pill); font-size:13px; font-weight:650; line-height:1.3; }
.chat-delete-cancel { color:var(--text); background:var(--surface); }
.chat-delete-confirm { color:#fff; background:#c84658; }
:root[data-theme=dark] .chat-delete-confirm { color:#231418; background:var(--danger); }
@media(max-width:700px) {
  .thread-header { grid-template-columns:40px minmax(0,1fr) 40px; gap:8px; min-height:62px; padding:6px 10px; padding-top:calc(6px + var(--safe-top)); }
  .header-identity { min-height:48px; padding:4px 6px; }
  .thread-heading { padding:0 2px; }
  .thread-heading h2 { font-size:16px; }
  .thread-heading p { font-size:10px; margin-top:2px; }
  .message-scroll { padding:4px 10px calc(18px + var(--safe-bottom)); }
  .message { max-width:89%; padding:6px 9px; }
  .message-meta { right:8px; }
  .sheet-header { border-bottom:0; padding-bottom:10px; }
  .sheet-header h2 { font-size:18px; }
}

/* Keyboard obstruction changes scrolling space, never the scale of the app. */
html,body { overflow:hidden; overflow-x:hidden; overscroll-behavior-x:none; touch-action:pan-y; }
.sidebar,.thread { padding-bottom:var(--keyboard-inset,0px); }
.sidebar-header,.sidebar-search,.sidebar-section { flex-shrink:0; }
.chat-list,.message-scroll { min-height:0; overflow-x:hidden; overscroll-behavior:contain; overflow-anchor:none; }
.chat-list { padding-bottom:var(--safe-bottom); }
.search-done { flex-shrink:0; padding:7px 0 7px 6px; background:transparent; color:var(--accent); font-size:13px; font-weight:550; }
.search-field:not(:focus-within) .search-done { display:none; }
.search-field { padding-right:10px; }
.page-sentinel { height:2px; flex-shrink:0; display:flex; justify-content:center; align-items:center; color:var(--muted); }
.page-sentinel.has-page { height:32px; }
.page-sentinel .spinner { width:15px; height:15px; }
.page-sentinel .text-button { font-size:12px; padding:5px 14px; }
.sheet { max-height:calc((var(--layout-height,100vh) - var(--keyboard-inset,0px)) * .84); }
.notice { bottom:calc(20px + var(--visual-bottom,0px)); }
@media(max-width:700px) {
  .sheet { bottom:var(--visual-bottom,0px); max-height:calc((var(--layout-height,100vh) - var(--keyboard-inset,0px)) * .88); }
  .thread-tools { flex-wrap:wrap; }
  .message-search { flex-basis:100%; }
}

@media(max-width:700px) {
  .thread-tools { padding:10px 12px; }
  .message-search { height:42px; }
  .search-options { padding:0 12px 9px; }
  .filters { padding:0 12px 10px; gap:5px; }
  .filter { min-height:36px; padding:8px 11px; font-size:12px; border-radius:18px; }
  .media-card { min-width:0; }
}
.message-scroll .page-sentinel,.message-scroll .date-divider { overflow-anchor:none; }

/* Shared rounded SVG system; glyphs never intercept button taps. */
.icon{pointer-events:none}
.version-step svg,.calendar-step svg{width:20px;height:20px}
.version-diff summary{display:flex;align-items:center;gap:6px;list-style:none}
.version-diff summary::-webkit-details-marker{display:none}
.version-diff summary::marker{content:""}
.version-diff summary svg{width:15px;height:15px}
.version-diff[open] summary svg{transform:rotate(180deg)}

/* Match Telegram's compact bubble rhythm while keeping readable inner padding. */
.message {
  margin-top:4px;
  padding:7px 11px;
  line-height:1.4;
}
.message-text { line-height:1.4; }
.message.group-next { margin-top:2px; }
.message-meta { font-size:10px; }
@media(max-width:700px) {
  .message { max-width:92%; padding:7px 11px; }
  .message.group-next { margin-top:2px; }
}

/* Rounded, solid Telegram-like controls shared across the archive UI. */
.search-field,.filter,.chat-indicator,.version-chip,.empty-action,.download-link {
  border-radius:var(--radius-pill);
}
.chat-row { border-radius:var(--radius-surface); }
.gate button,.calendar-apply { border-radius:var(--radius-control); }
.file-actions .file-primary,.file-actions .file-secondary { border-radius:var(--radius-pill); }
.thread-heading { border-radius:var(--radius-pill); }
.date-divider { border-radius:var(--radius-pill); }
.message { border-radius:var(--radius-message) var(--radius-message) var(--radius-message) 6px; }
.message.outgoing { border-radius:var(--radius-message) var(--radius-message) 6px var(--radius-message); }
.message.group-next { border-top-left-radius:7px; }
.message.group-continues { border-bottom-left-radius:7px; }
.message.outgoing.group-next { border-top-left-radius:var(--radius-message); border-top-right-radius:7px; }
.message.outgoing.group-continues { border-bottom-left-radius:var(--radius-message); border-bottom-right-radius:7px; }
.back-button {
  display:grid;
  place-items:center;
  width:40px;
  height:40px;
  flex:0 0 40px;
  padding:9px;
  border-radius:50%;
  background:var(--surface);
  color:var(--accent);
  transition:background .14s ease,transform .14s ease;
  -webkit-tap-highlight-color:transparent
}
.back-button svg { width:20px; height:20px; }
.back-button:active { transform:scale(.94); background:var(--soft-accent); }
@media (hover:hover) and (pointer:fine) {
  .back-button:hover { background:var(--soft-accent); }
}
.version-text { border-radius:var(--radius-surface); }
.notice { border-radius:var(--radius-surface); }
.sheet { border-radius:var(--radius-panel); }
@media(max-width:700px) {
  .sheet { border-radius:var(--radius-panel) var(--radius-panel) 0 0; }
}

/* First-run language and Telegram Business setup flow. */
.setup-screen {
  position:fixed;
  inset:0;
  z-index:50;
  display:block;
  overflow-x:hidden;
  overflow-y:auto;
  padding:calc(18px + var(--safe-top)) 18px calc(18px + var(--safe-bottom));
  background:var(--bg);
  overscroll-behavior:contain;
  touch-action:pan-y
}
.setup-panel {
  width:min(100%,460px);
  margin:0 auto;
  padding:22px;
  border:1px solid var(--line);
  border-radius:var(--radius-panel);
  background:var(--surface);
  box-shadow:var(--bubble-shadow)
}
.setup-brand { display:flex; align-items:center; gap:11px; margin-bottom:24px; font-size:19px; font-weight:700; }
.setup-brand img { width:44px; height:44px; border-radius:50%; }
.setup-content h1 { font-size:23px; line-height:1.2; letter-spacing:-.35px; }
.setup-content h1:focus { outline:none; }
.setup-description { margin-top:9px; color:var(--muted); font-size:14px; line-height:1.5; }
.setup-language-list { display:grid; gap:10px; margin-top:21px; }
.setup-language {
  display:flex;
  align-items:center;
  justify-content:space-between;
  min-height:var(--control-height);
  padding:12px 16px;
  border:1px solid var(--line);
  border-radius:var(--radius-pill);
  background:var(--bg);
  color:var(--text);
  font-weight:600;
  text-align:left
}
.setup-language span:last-child { color:var(--muted); font-size:12px; font-weight:500; }
.setup-steps { display:grid; gap:10px; margin:19px 0 0; padding:0; list-style:none; }
.setup-step { display:grid; grid-template-columns:28px minmax(0,1fr); gap:10px; align-items:start; }
.setup-step-number { display:grid; width:27px; height:27px; place-items:center; border-radius:50%; background:var(--soft-accent); color:var(--accent); font-size:13px; font-weight:700; }
.setup-step strong { display:block; padding-top:2px; font-size:14px; line-height:1.35; }
.setup-step p { margin-top:3px; color:var(--muted); font-size:13px; line-height:1.45; }
.setup-note { margin-top:16px; padding:12px 13px; border-radius:15px; background:var(--bg); color:var(--muted); font-size:12px; line-height:1.5; }
.setup-actions { display:grid; gap:9px; margin-top:17px; }
.setup-primary,.setup-secondary {
  min-height:46px;
  padding:0 16px;
  border-radius:var(--radius-pill);
  font-weight:650
}
.setup-primary { background:var(--accent); color:var(--tg-theme-button-text-color); }
.setup-secondary { background:transparent; color:var(--tg-theme-link-color); }
.setup-feedback { margin:13px 0 0; color:var(--muted); font-size:13px; line-height:1.45; }
.connection-banner {
  margin:0 15px 11px;
  padding:11px 13px;
  border:1px solid var(--line);
  border-radius:var(--radius-pill);
  background:var(--surface)
}
.connection-banner>div { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.connection-banner strong { font-size:13px; line-height:1.3; }
.connection-banner button { display:flex; flex-shrink:0; align-items:center; justify-content:center; gap:6px; min-height:34px; padding:0 12px; border-radius:var(--radius-pill); background:var(--accent); color:var(--tg-theme-button-text-color); font-size:12px; font-weight:650; }
.connection-banner button svg { width:15px; height:15px; }
.connection-banner p { margin-top:4px; color:var(--muted); font-size:12px; line-height:1.4; }
@media(max-width:700px) {
  .setup-panel { padding:20px; border-radius:24px; }
  .setup-brand { margin-bottom:20px; }
  .setup-content h1 { font-size:21px; }
}

.brand{min-width:0;flex:1}
.brand p{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.about-open{display:grid;place-items:center;width:40px;height:40px;min-height:40px;flex:0 0 40px;padding:0;margin:0;border-radius:50%;color:var(--muted);background:var(--surface)}
.about-open svg{width:20px;height:20px;display:block}
.about-open>span{display:flex;align-items:center;justify-content:center}
.about-links{display:flex;flex-direction:column;gap:10px}
.about-links a{display:block;padding:14px 16px;border-radius:var(--radius-pill);background:var(--surface);color:var(--accent);text-decoration:none;font-size:14px;overflow-wrap:anywhere}

/* Shared component roles: actions are capsules; containers use soft corners. */
.search-field,.message-search{min-height:46px;border-radius:var(--radius-pill)}
.search-field input{font-size:16px}
.filter{min-height:36px;padding:8px 14px;border-radius:var(--radius-pill)}
.sheet-header{padding:18px 20px 12px;gap:12px}
.sheet-content{padding:16px 20px calc(20px + var(--safe-bottom))}
.sheet-header h2{font-size:18px;font-weight:650;line-height:1.35}
.close-sheet{display:grid;place-items:center;width:var(--control-icon);height:var(--control-icon);flex:0 0 var(--control-icon);padding:10px;border-radius:50%;background:var(--surface)}
.close-sheet svg{width:20px;height:20px}
.chat-action-button{padding:14px 16px;min-height:64px;border-radius:var(--radius-surface)}
.chat-action-identity,.delete-chat-warning,.setup-note,.connection-banner{border-radius:var(--radius-surface)}
.setup-panel{padding:20px;border-radius:var(--radius-panel)}
.setup-language,.setup-primary,.setup-secondary,.gate button,.boot-status button{min-height:var(--control-height);border-radius:var(--radius-pill);padding:12px 16px;font-weight:600}
.setup-note{padding:14px 16px}
.setup-primary,.connection-banner button{color:var(--file-button-text)}
.setup-steps{gap:14px}
.connection-banner{padding:14px 16px}
.file-actions{gap:8px}
.file-actions .file-primary,.file-actions .file-secondary{min-height:var(--control-compact);padding:10px 14px;border-radius:var(--radius-pill);font-size:13px;font-weight:550}
.file-icon{width:44px;height:44px;flex:0 0 44px;border-radius:16px}
.file-icon svg{width:22px;height:22px}
.version-step{width:var(--control-icon);height:var(--control-icon);border-radius:50%}
.version-chip{min-height:32px;border-radius:var(--radius-pill)}
.empty-action{min-height:44px;padding:10px 18px;border-radius:var(--radius-pill)}
.about-links a{min-height:var(--control-height);padding:13px 16px;font-weight:550}
@media(max-width:700px){.sheet-header{padding:18px 16px 12px}.sheet-content{padding:16px 16px calc(20px + var(--safe-bottom))}}
