:root {
  color-scheme: light;
  --blue: #20518d;
  --green: #89cf25;
  --navigation: #15365b;
  --on-navigation: #f2f7fc;
  --navigation-hover: #ffffff24;
  --own-mobile: #e4efd7;
  --ink: #172a43;
  --muted: #52657c;
  --line: #e0e7ef;
  --side: #fff;
  --paper: #f0f5f9;
  --active: #e9f1fb;
  --own: #dfedfb;
  --warning: #9c2f30;
  --danger-paper: #fff2f1;
  --field-line: #b7c8db;
  --surface: #f8fbfd;
  --glass: #f8fbfdeb;
  --on-accent: #fff;
  --day: #e4ecf4;
  --brand-art: #e9f0f8;
  --shade-1: #d7e5f4;
  --shade-2: #e2efcc;
  --poll-bar: #dceaf8;
  --poll-selected: #dcedbc;
  --positive: #456b20;
  --panel-shadow: 0 14px 36px #13263c24;
  --small-radius: 9px;
  --medium-radius: 13px;
  --sheet-radius: 22px;
  --ease-out: cubic-bezier(.23,1,.32,1);
  --ease-drawer: cubic-bezier(.32,.72,0,1);
  --screen-motion: 255ms;
  font: 15px/1.45 'Segoe UI Variable', 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--paper);
  accent-color: var(--blue);
  scrollbar-color: #bccbdd transparent;
}
[data-theme="dark"] {
  color-scheme: dark;
  --blue: #a7d0ff;
  --green: #bde67a;
  --navigation: #182f4b;
  --own-mobile: #293f33;
  --ink: #e9f1fb;
  --muted: #aec1d7;
  --line: #334860;
  --side: #182637;
  --paper: #101b29;
  --active: #2a405a;
  --own: #263d57;
  --warning: #ffb1ae;
  --danger-paper: #442b35;
  --field-line: #607995;
  --surface: #141f2e;
  --glass: #141f2eea;
  --on-accent: #10233d;
  --day: #22354b;
  --brand-art: #1d3148;
  --shade-1: #2d4764;
  --shade-2: #385733;
  --poll-bar: #2d4d70;
  --poll-selected: #394e34;
  --positive: #bde67a;
  --panel-shadow: 0 14px 36px #0006;
  scrollbar-color: #48617e transparent;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body { margin: 0; overscroll-behavior: none; }
::selection { color: #172a43; background: #d7edb4; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; user-select: none; }
button:disabled { cursor: wait; opacity: .6; }
button:active:not(:disabled) { filter: brightness(.9); }
button, input, textarea { -webkit-tap-highlight-color: transparent; }
input, textarea { caret-color: var(--blue); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.025em; }
a { color: var(--blue); text-underline-offset: .16em; }
svg { flex: 0 0 auto; vertical-align: middle; }
.icon-button { position: relative; display: inline-grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 10px; color: var(--blue); background: transparent; }
.icon-button[aria-expanded=true] { background: var(--active); }
.primary, .send { background: var(--blue); color: var(--on-accent); }
.primary { min-height: 44px; padding: 8px 18px; border: 0; border-radius: var(--small-radius); font-weight: 650; }
.link-button { align-self: start; color: var(--blue); font-weight: 650; background: transparent; border: 0; padding: 6px 0; min-height: 35px; }
.gate { display: grid; grid-template-columns: minmax(320px, .92fr) 1fr; min-height: 100vh; min-height: 100dvh; }
.gate-brand { position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; min-height: 660px; justify-content: center; align-items: flex-start; background: var(--brand-art); padding: 75px clamp(36px,7vw,125px); }
.gate-brand img { position: absolute; top: max(42px,env(safe-area-inset-top)); object-fit: contain; }
.gate-heading { max-width: 430px; z-index: 1; }
.gate-brand h1 { font-size: clamp(45px,5.1vw,76px); line-height: 1.02; letter-spacing: -.04em; font-weight: 720; color: var(--blue); }
.gate-brand p { margin-top: 21px; max-width: 270px; font-size: 17px; color: var(--muted); }
.gate-art { width: 355px; height: 270px; position: absolute; right: -91px; bottom: -64px; transform: rotate(-24deg); display: grid; gap: 13px; z-index: -1; }
.gate-art i { border-radius: 22px; background: var(--shade-1); }
.gate-art i:nth-child(2) { width: 78%; background: var(--shade-2); }
.gate-art i:nth-child(3) { width: 62%; }
.gate-content { background: var(--side); display: grid; place-items: center; padding: 45px 28px; }
.auth { display: grid; gap: 15px; width: min(100%, 370px); }
.auth h2 { font-size: 30px; }
.auth > p { color: var(--muted); margin: -4px 0 8px; }
.auth label { font-size: 13px; font-weight: 650; display: grid; gap: 7px; }
.auth input, dialog input { width: 100%; padding: 10px 12px; min-height: 44px; border: 1px solid var(--field-line); border-radius: 8px; background: var(--side); font-size: 16px; }
.auth .primary { margin-top: 3px; }
.auth .form-error, .retry { color: var(--warning); }
.demo-access { margin-top: 7px; border-top: 1px solid var(--line); padding-top: 15px; color: var(--muted); font-size: 13px; }
.demo-access > div { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.demo-choice { background: var(--active); color: var(--blue); border: 0; border-radius: 8px; min-height: 42px; padding: 7px 12px; font-weight: 650; }
.workspace { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0,1fr); overflow: hidden; }
.topbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); background: var(--surface); padding: env(safe-area-inset-top) max(24px,env(safe-area-inset-right)) 0 max(24px,env(safe-area-inset-left)); z-index: 4; }
.brand { display: flex; align-items: center; gap: 17px; }
.brand img { object-fit: contain; }
.brand span { padding-left: 17px; border-left: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 13px; position: relative; }
.connection, .demo-label { display: inline-flex; gap: 7px; align-items: center; color: var(--muted); font-size: 12px; white-space: nowrap; }
.connection i { width: 7px; height: 7px; background: #a56c1a; border-radius: 50%; }
.connection.online i { background: #517d19; }
.demo-label { color: var(--blue); background: var(--active); border-radius: 5px; padding: 3px 7px; }
.account { position: relative; border: 0; background: transparent; display: flex; align-items: center; padding: 4px; min-width: 44px; min-height: 44px; border-radius: 10px; }
.layout { display: grid; grid-template-columns: 308px minmax(0,1fr); min-height: 0; }
.layout.with-details { grid-template-columns: 308px minmax(0,1fr) 265px; }
.inbox { min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--side); }
.inbox-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 19px 14px 23px; }
.inbox-head h1 { font-size: 29px; }
.add-chat { background: var(--active); }
.search { margin: 0 17px 16px; min-height: 43px; display: flex; align-items: center; background: var(--paper); border-radius: var(--small-radius); padding: 0 11px; gap: 8px; color: var(--muted); }
.search input { background: transparent; border: 0; width: 100%; min-width: 0; height: 43px; padding: 0; font-size: 16px; }
.search:focus-within { outline: 2px solid var(--blue); }
.search input:focus-visible { outline: 0; }
#chat-list { overflow: auto; overscroll-behavior: contain; min-height: 0; padding: 0 9px max(16px,env(safe-area-inset-bottom)); }
.chat-item { width: 100%; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 68px; border: 0; background: transparent; text-align: left; padding: 9px 10px; border-radius: var(--small-radius); margin-bottom: 2px; }
.chat-item.active { background: var(--active); }
.chat-name, .chat-preview { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-name { font-weight: 670; }
.chat-preview, .chat-meta, .sub { font-size: 12px; color: var(--muted); }
.chat-meta { display: flex; min-height: 41px; flex-direction: column; align-items: end; gap: 4px; font-variant-numeric: tabular-nums; }
.unread { color: var(--on-accent); background: var(--blue); border-radius: 12px; font-size: 11px; padding: 1px 5px; min-width: 18px; text-align: center; }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.avatar.group { color: var(--on-accent); background: var(--blue); }
.avatar.self { color: #385719; background: #e5f1d2; }
.avatar.n0 { color: #20518d; background: #e2ecfa; }
.avatar.n1 { color: #78512b; background: #f6e8d8; }
.avatar.n2 { color: #4a497d; background: #ebe8fa; }
.avatar.n3 { color: #38644e; background: #e0efe7; }
.room { position: relative; display: grid; grid-template-rows: 72px minmax(0,1fr) auto; min-height: 0; min-width: 0; background: var(--paper); }
.room-head, .details-head { display: flex; align-items: center; border-bottom: 1px solid var(--line); background: var(--side); min-width: 0; }
.room-head { padding: 0 18px 0 23px; gap: 12px; }
.room-identity { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; }
.room-identity div { min-width: 0; }
.room-identity h2 { font-size: 18px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.room-identity .sub { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.back { display: none; }
.timeline { overflow: auto; overscroll-behavior: contain; min-height: 0; padding: 16px clamp(18px,4vw,47px) 25px; }
#messages { min-height: 100%; display: flex; flex-direction: column; justify-content: end; gap: 11px; max-width: 860px; margin: auto; overflow-anchor: none; }
.older { display: block; margin: 0 auto 10px; }
.date-line { align-self: center; margin: 3px 0 8px; font-size: 12px; color: var(--muted); background: var(--day); border-radius: 17px; padding: 4px 11px; }
.message-row { display: flex; gap: 9px; align-items: end; max-width: min(92%,640px); align-self: start; min-width: 0; }
.message-row.own { align-self: end; }
.message-row .avatar { width: 31px; height: 31px; font-size: 11px; border-radius: var(--small-radius); }
.bubble { padding: 9px 12px 7px; border-radius: 13px 13px 13px 4px; background: var(--side); max-width: 100%; min-width: 0; }
.own .bubble { border-radius: 13px 13px 4px 13px; background: var(--own); }
.author { display: block; color: var(--blue); font-size: 12px; margin-bottom: 3px; font-weight: 700; }
.message-copy { white-space: pre-wrap; overflow-wrap: anywhere; }
.message-time { display: block; margin-top: 4px; text-align: right; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.empty { padding: 18px 12px; color: var(--muted); font-size: 14px; }
#messages .empty { margin: auto; text-align: center; }
.media-image, video { display: block; border-radius: 8px; max-width: min(100%,385px); max-height: 270px; object-fit: contain; }
audio { display: block; width: min(270px,100%); min-width: min(240px,55vw); }
.file-row { display: flex; align-items: center; gap: 8px; color: var(--ink); min-width: 0; text-decoration: none; }
.file-icon { display: grid; place-items: center; border: 1px solid var(--field-line); color: var(--blue); width: 38px; height: 38px; border-radius: 8px; flex: 0 0 auto; }
.file-info { display: grid; overflow-wrap: anywhere; font-weight: 650; min-width: 0; line-height: 1.3; }
.file-info small { color: var(--muted); font-weight: 400; }
.media-save { display: inline-block; font-size: 12px; margin-top: 5px; }
.compose-area { position: relative; padding: 0 clamp(12px,3vw,26px) max(15px,env(safe-area-inset-bottom)); }
.composer, .draft { max-width: 910px; margin: auto; background: var(--side); }
.composer { border: 1px solid var(--line); display: flex; align-items: end; gap: 4px; padding: 6px; border-radius: var(--medium-radius); min-width: 0; }
.composer:focus-within { border-color: #9bb9da; }
.composer textarea { flex: 1; min-width: 0; height: 42px; min-height: 42px; max-height: 110px; field-sizing: content; padding: 9px 6px; border: 0; resize: none; background: transparent; font-size: 16px; }
@supports (field-sizing: content) { .composer textarea { height: auto; } }
.composer textarea:focus-visible { outline: 0; }
.send { background: var(--blue); color: var(--on-accent); }
.retry { max-width: 910px; margin: 0 auto 6px; font-size: 13px; padding: 5px 8px; background: var(--danger-paper); border-radius: 6px; }
.draft { display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin-bottom: 5px; border-radius: var(--small-radius); overflow-wrap: anywhere; }
.draft > span { flex: 1; min-width: 0; }
.draft button { margin-left: auto; }
#record.recording { color: #962e2e; background: #fae5e3; }
.popover { position: absolute; z-index: 5; border: 1px solid var(--line); background: var(--side); border-radius: 12px; padding: 9px; }
.profile-menu { top: calc(100% + 10px); right: 0; width: 225px; padding: 15px; overflow-wrap: anywhere; }
.profile-menu p { font-size: 13px; color: var(--muted); }
.profile-menu button { display: block; }
.sticker-menu { bottom: calc(100% + 5px); right: 26px; display: grid; grid-template-columns: repeat(3, 73px); max-height: min(45dvh, 300px); overflow-y: auto; overscroll-behavior: contain; gap: 4px; }
.sticker-choice { border: 0; border-radius: 8px; background: transparent; display: grid; gap: 3px; justify-items: center; align-items: center; padding: 6px 2px; font-size: 11px; color: var(--muted); }
.sticker { display: inline-flex; }
.sticker svg { width: 114px; height: 108px; }
.sticker-choice svg { width: 55px; height: 52px; }
.pet-sticker-art {
  display: block;
  width: 106px;
  aspect-ratio: 445 / 460;
  background: url('/stickers-pets-v1.webp') no-repeat 0 19.15% / 454.386% 272.6%;
}
.pet-sticker-art[data-column="1"] { background-position-x: 25.173%; }
.pet-sticker-art[data-column="2"] { background-position-x: 51.3%; }
.pet-sticker-art[data-row="1"] { background-position-y: 85.64%; }
.office-sticker-art { aspect-ratio: 1; background-position: 71.008% 0; background-size: 789.84375% 489.84375%; }
.office-sticker-art[data-column="1"] { background-position-x: 85.504%; }
.office-sticker-art[data-column="2"] { background-position-x: 100%; }
.office-sticker-art[data-row="1"] { background-position-y: 25.6513%; }
.sticker-choice .pet-sticker-art { width: 52px; }
.sticker-choice { min-height: 65px; padding-inline: 5px; }

.member-row, .member-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.member-row { min-height: 48px; justify-content: space-between; padding: 5px 0; }
.member-row + .member-row { border-top: 1px solid var(--line); }
.member-name { overflow-wrap: anywhere; min-width: 0; }
.member-name small { color: var(--muted); display: block; }
.member-identity > .avatar { flex: 0 0 auto; }
.member-row > button { flex: 0 0 auto; }
.member-group-title { margin: 14px 0 3px; font-size: 14px; }
.details { border-left: 1px solid var(--line); background: var(--side); min-height: 0; min-width: 0; overflow: auto; }
.layout:not(.with-details) .details { display: none; }
.details-head { justify-content: space-between; min-height: 72px; padding: 8px 12px 8px 18px; gap: 8px; }
.details-head h2, .dialog-head h2 { font-size: 18px; }
#details-body { padding: 17px; }
.detail-identity { text-align: center; padding: 7px 0 22px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.detail-identity .avatar { width: 59px; height: 59px; font-size: 17px; border-radius: 15px; margin-bottom: 10px; }
.detail-identity h3 { font-size: 17px; margin-bottom: 4px; }
.detail-files { margin-top: 18px; }
.detail-files h3 { font-size: 14px; margin-bottom: 11px; }
.detail-files .file-row { font-size: 13px; padding-bottom: 10px; }
.detail-files .empty { padding: 0; font-size: 13px; }
dialog { width: min(440px,calc(100% - 24px)); max-height: min(620px,90dvh); padding: 17px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); }
dialog::backdrop { background: #142b4766; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
#people-list { overflow: auto; max-height: 50dvh; margin-top: 10px; }
.person { display: flex; width: 100%; align-items: center; gap: 10px; background: var(--side); border: 0; border-radius: 8px; text-align: left; padding: 8px; overflow-wrap: anywhere; }
.person span:last-child { min-width: 0; }
.person small { color: var(--muted); display: block; }
@media (hover: hover) and (pointer: fine) {
  .icon-button:not(.send):hover, .chat-item:hover, .person:hover, .sticker-choice:hover, .account:hover { background: var(--active); }
  .link-button:hover, .file-row:hover { text-decoration: underline; }
  .primary:hover, .send:hover { filter: brightness(.9); }
}
@media (max-width: 1120px) {
  .layout, .layout.with-details { grid-template-columns: 280px minmax(0,1fr); }
  .details { position: absolute; z-index: 3; right: 0; top: 68px; bottom: 0; width: min(285px,100vw); box-shadow: -8px 0 24px #0002; }
  .layout:not(.with-details) .details { display: block; opacity: 0; visibility: hidden; transform: translateX(32px); }
  @media (prefers-reduced-motion: no-preference) {
    .layout .details { transition: transform 200ms var(--ease-out), opacity 200ms var(--ease-out), visibility 0s; }
    .layout:not(.with-details) .details { transition-delay: 0s, 0s, 200ms; }
  }
}
@media (max-width: 690px) {
  .gate { display: block; background: var(--side); }
  .gate-brand { min-height: 0; padding: max(17px,env(safe-area-inset-top)) 23px 23px; }
  .gate-brand img { position: static; width: 128px; height: auto; margin-bottom: 17px; }
  .gate-brand h1 { font-size: 34px; }
  .gate-brand h1 br { display: none; }
  .gate-brand p { font-size: 14px; margin-top: 8px; }
  .gate-content { padding: 24px 23px max(24px,env(safe-area-inset-bottom)); }
  .auth h2 { font-size: 24px; }
  .topbar { min-height: 56px; padding-left: max(14px,env(safe-area-inset-left)); padding-right: max(10px,env(safe-area-inset-right)); }
  .top-actions { gap: 5px; }
  .brand img { width: 111px; height: auto; }
  .brand span { display: none; }
  .connection span { display: none; }
  .layout, .layout.with-details { display: block; position: relative; overflow: hidden; }
  .layout > :is(.inbox,.room) { position: absolute; inset: 0; }
  .inbox { border-right: 0; }
  .room { z-index: 2; grid-template-rows: 58px minmax(0,1fr) auto; }
  .layout:not(.in-room) .room { transform: translateX(100%); visibility: hidden; }
  .layout.in-room .inbox { transform: translateX(-22%); opacity: .8; visibility: hidden; }
  @media (prefers-reduced-motion: no-preference) {
    .layout:not(.instant-view) > :is(.inbox,.room) {
      transition: transform var(--screen-motion) var(--ease-drawer), opacity var(--screen-motion) var(--ease-drawer), visibility 0s;
    }
    .layout.in-room:not(.instant-view) .inbox, .layout:not(.in-room,.instant-view) .room {
      transition-delay: 0s, 0s, var(--screen-motion);
    }
  }
  .room-head { padding: 0 max(7px,env(safe-area-inset-right)) 0 max(4px,env(safe-area-inset-left)); gap: 4px; }
  .room-identity .avatar { width: 36px; height: 36px; }
  .back { display: inline-grid; }
  .details { top: 0; }
  .details-head { min-height: 58px; }
  .timeline { padding: 12px max(10px,env(safe-area-inset-right)) 16px max(10px,env(safe-area-inset-left)); }
  .compose-area { padding-left: max(7px,env(safe-area-inset-left)); padding-right: max(7px,env(safe-area-inset-right)); }
  .composer { gap: 1px; padding: 3px; }
  .icon-button { min-width: 44px; min-height: 44px; }
  .message-row { max-width: 94%; }
}
.chat-sheet { overscroll-behavior: contain; padding: 18px 22px 22px; background: var(--surface); }
.chat-sheet .dialog-head { margin-bottom: 12px; }
.chat-sheet .dialog-head h2 { font-size: 23px; }
.chat-sheet .primary { width: 100%; min-height: 48px; margin-top: 6px; }
.chat-sheet label, .chat-sheet legend { display: grid; gap: 6px; font-size: 14px; font-weight: 650; }
.chat-sheet fieldset { border: 0; min-width: 0; padding: 0; margin: 0; }
#attachment-options, #poll-options { display: grid; gap: 7px; }
#poll-options { margin-top: 6px; }
#poll-form, #location-form { display: grid; gap: 12px; }
#poll-form .dialog-head, #location-form .dialog-head { margin-bottom: 0; }
#add-option { justify-self: start; min-height: 44px; }
#location-status { color: var(--muted); line-height: 1.55; }
.attachment-choice { display: flex; align-items: center; gap: 13px; padding: 8px; width: 100%; text-align: left; min-height: 62px; border: 1px solid var(--line); border-radius: 12px; background: var(--side); }
.attachment-mark, .location-mark { display: grid; place-items: center; color: var(--blue); background: var(--active); border-radius: 10px; height: 40px; width: 40px; flex: 0 0 auto; }
.attachment-choice:last-child .attachment-mark { background: var(--poll-selected); color: var(--positive); }
.attachment-words { display: grid; }
.attachment-words small, .location-card small { color: var(--muted); font-size: 13px; }
.poll-card { display: grid; gap: 7px; width: min(295px,100%); min-width: 0; padding: 3px 0; }
.poll-card h3 { font-size: 16px; overflow-wrap: anywhere; margin-bottom: 3px; }
.extra-label { display: flex; align-items: center; gap: 6px; color: var(--blue); font-weight: 650; font-size: 12px; }
.poll-row { position: relative; border: 1px solid var(--field-line); border-radius: var(--small-radius); overflow: hidden; background: var(--surface); }
.poll-row.selected { border-color: #6a9738; }
.poll-bar { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; appearance: none; -webkit-appearance: none; }
.poll-bar::-webkit-progress-bar { background: transparent; }
.poll-bar::-webkit-progress-value { background: var(--poll-bar); }
.poll-bar::-moz-progress-bar { background: var(--poll-bar); }
.poll-row.selected .poll-bar::-webkit-progress-value { background: var(--poll-selected); }
.poll-row.selected .poll-bar::-moz-progress-bar { background: var(--poll-selected); }
.poll-choice { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: relative; width: 100%; min-height: 44px; text-align: left; padding: 7px 10px; border: 0; background: transparent; overflow-wrap: anywhere; font-weight: 550; }
.poll-choice:focus-visible { outline-offset: -3px; }
.poll-count { font-variant-numeric: tabular-nums; color: var(--blue); font-weight: 700; }
.poll-note { color: var(--muted); }
.location-card { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-weight: 650; min-height: 48px; touch-action: manipulation; }
.location-card small { display: block; font-weight: 400; }
@media (hover: hover) and (pointer: fine) {
  .attachment-choice:hover, button.poll-choice:hover { background: var(--active); }
}
@media (max-width: 690px) {
  .gate-brand h1 { font-size: clamp(30px,8vw,40px); max-width: 450px; }
  .gate-brand h1 br { display: initial; }
  .chat-sheet { inset: auto 0 0; width: 100%; max-width: none; max-height: 90dvh; margin: 0; border-radius: var(--sheet-radius) var(--sheet-radius) 0 0; padding: 12px max(16px,env(safe-area-inset-right)) max(18px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left)); }
  .chat-sheet::before { content: ''; display: block; width: 34px; height: 4px; background: #b7c8da; border-radius: 20px; margin: 0 auto 7px; }
  .chat-sheet .dialog-head h2 { font-size: 21px; }
  .attachment-choice { min-height: 56px; }
  .poll-card { width: min(270px,72vw); }
}
button, a { touch-action: manipulation; }
.topbar, .room-head, .details, .inbox, .popover, .chat-sheet, #people-dialog, #install-dialog {
  background: var(--surface);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar, .room-head, .details, .inbox, .popover, .chat-sheet, #people-dialog, #install-dialog {
    background: var(--glass);
    backdrop-filter: blur(15px) saturate(115%);
    -webkit-backdrop-filter: blur(15px) saturate(115%);
  }
}
:root[data-theme="dark"] .brand img, :root[data-theme="dark"] .gate-brand img {
  background: #f8fbfd; padding: 3px 6px; border-radius: var(--small-radius);
}
.timeline { background: var(--paper); }
.topbar { border-top: 3px solid var(--green); }
#messages { gap: 12px; }
.layout.with-details { grid-template-columns: 308px minmax(0,1fr) 265px; }
.room { grid-template-rows: 72px minmax(0,1fr) auto; }
.popover, dialog { box-shadow: var(--panel-shadow); }
.people-list, .result-list { overflow-y: auto; }
.notice-count { position: absolute; top: 3px; right: 2px; min-width: 16px; padding: 1px 3px; border-radius: 20px; font-size: 10px; font-weight: 750; color: var(--on-accent); background: var(--blue); }
.muted-mark { font-size: 10px; }
.channel-readonly { width: fit-content; margin: 0 auto; padding: 11px 15px; color: var(--muted); text-align: center; font-size: 13px; }
.typing-line { max-width: 910px; min-height: 21px; margin: 0 auto; color: var(--muted); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.typing-indicator { display: inline-block; vertical-align: middle; width: 5px; height: 5px; margin: 0 14px 0 7px; border-radius: 20px; color: var(--positive); background: currentColor; box-shadow: -6px 0 currentColor,6px 0 currentColor; }
.quote { display: block; width: 100%; max-height: 53px; overflow: hidden; margin: 0 0 5px; color: var(--muted); background: var(--active); border: 0; border-radius: var(--small-radius); padding: 8px 10px; text-align: left; font-size: 12px; overflow-wrap: anywhere; }
.message-footer { display: flex; justify-content: flex-end; align-items: center; gap: 4px; }
.message-footer time { margin-top: 0; }
.read-receipt { color: var(--muted); font-size: 13px; white-space: nowrap; letter-spacing: -.16em; min-width: 1.5em; padding-inline-end: .16em; }
.read-receipt.is-read { color: var(--tint); font-weight: 700; }
.group-read-receipt { color: var(--ink); font-size: 11px; margin-inline-start: 4px; padding: 3px 6px; border-radius: 6px; border: 0; background: var(--active); white-space: nowrap; }
.group-read-mark { margin-inline-end: 4px; font-weight: 700; }
.group-read-receipt:hover { text-decoration: underline; }
.group-read-receipt:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
#readers-list .sub { margin: 0 0 10px; }
.reader-names { max-height: 48dvh; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.reader-names li { padding: 10px 0; border-top: 1px solid var(--line); }
#contact-card:not([hidden]) { display: grid; align-content: start; justify-items: start; gap: 12px; overflow: auto; padding: 8px 18px 108px; }
#contact-card h2, #contact-card p { margin: 0; }
#contact-card .avatar { width: 58px; height: 58px; font-size: 18px; }
#contact-card .primary { margin-block-start: 4px; }
.message-menu-button { width: 34px; min-height: 34px; padding: 0; border: 0; border-radius: var(--small-radius); color: var(--muted); background: transparent; }
.mention { color: var(--blue); }
.deleted-copy { color: var(--muted); font-style: italic; }
.mention-menu { bottom: calc(100% - 12px); left: clamp(6px,3vw,26px); max-width: min(390px,calc(100% - 14px)); }
.result-list { margin-top: 12px; }
.result-item { width: 100%; display: grid; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 10px 6px; min-height: 44px; overflow-wrap: anywhere; }
.result-item small { color: var(--muted); }
.search-form { display: flex; gap: 7px; }
.search-form input { min-width: 0; }
.stack-form, .admin-section { display: grid; gap: 11px; }
.stack-form label { display: grid; gap: 5px; }
#group-edit-actions:not([hidden]) { display: flex; flex-wrap: wrap; column-gap: 18px; }
.stack-form input, .stack-form select, .stack-form textarea { border: 1px solid var(--field-line); border-radius: var(--small-radius); color: var(--ink); background: var(--side); padding: 9px; font: inherit; font-size: 16px; min-height: 44px; width: 100%; }
.stack-form fieldset { margin: 0; min-width: 0; border: 1px solid var(--line); border-radius: var(--small-radius); padding: 4px 9px; }
.choices-list { max-height: 32dvh; overflow-y: auto; }
.stack-form .choice-row { display: flex; align-items: center; gap: 9px; min-height: 44px; }
.choice-row input[type="checkbox"] { width: 18px; min-height: auto; height: 18px; }
.choice-row span { flex: 1; }
.message-actions-list { display: flex; flex-wrap: wrap; column-gap: 22px; margin-top: 12px; }
.reaction-row { display: flex; flex-wrap: wrap; gap: 6px; }
.reaction { min-width: 35px; min-height: 38px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); font-size: 13px; }
.reaction[aria-pressed=true] { border-color: var(--positive); background: var(--poll-selected); }
.form-error, .danger { color: var(--warning); }
.upload-line progress { flex: 1; max-width: 170px; }
.admin-dialog { width: min(640px,calc(100% - 24px)); }
.admin-tabs { display: flex; gap: 14px; border-bottom: 1px solid var(--line); margin-bottom: 15px; }
.admin-tabs [aria-current=page] { border-bottom: 2px solid currentColor; }
.admin-section { padding-bottom: 6px; }
.admin-form { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.admin-form:last-child { border-bottom: 0; }
.admin-result:empty { display: none; }
.admin-channel { border-bottom: 1px solid var(--line); }
.admin-channel summary { cursor: pointer; min-height: 44px; font-weight: 650; }
.audit-list { padding: 0; list-style: none; }
.audit-list li { display: grid; padding: 8px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.audit-list span, .audit-list time { color: var(--muted); font-size: 13px; }
@media (hover: hover) and (pointer: fine) {
  .message-menu-button:hover, .result-item:hover { background: var(--active); }
}
@media (max-width: 1120px) { .layout.with-details { grid-template-columns: 280px minmax(0,1fr); } }
.room-search { display: none; }
@media (max-width: 690px) {
  .gate-brand {
    background: var(--navigation);
    padding: calc(26px + env(safe-area-inset-top)) 24px 32px;
    border-bottom: 4px solid var(--green);
  }
  .gate-brand h1, .gate-brand p { color: var(--on-navigation); }
  .gate-brand img, :root[data-theme="dark"] .gate-brand img,
  .topbar .brand img, :root[data-theme="dark"] .topbar .brand img {
    background: #f8fbfd;
    border-radius: 8px;
    padding: 5px 8px;
  }
  .workspace {
    --mobile-header: calc(62px + env(safe-area-inset-top));
    position: relative;
    grid-template-rows: minmax(0,1fr);
  }
  .topbar {
    position: absolute;
    inset: 0 0 auto;
    height: var(--mobile-header);
    z-index: 1;
    min-height: 0;
    gap: 4px;
    border: 0;
    background: var(--navigation);
    color: var(--on-navigation);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .workspace.mobile-room .topbar { transform: translateX(-22%); opacity: .8; visibility: hidden; pointer-events: none; }
  .top-actions { gap: 1px; }
  .top-actions > .icon-button { color: var(--on-navigation); }
  .top-actions .connection { margin-right: 2px; }
  .topbar :focus-visible { outline-color: var(--green); }
  .top-actions .demo-label { display: none !important; }
  .inbox { padding-top: var(--mobile-header); }
  .inbox-head { padding: 18px 17px 11px 20px; }
  .inbox-head h1 { font-size: 34px; letter-spacing: -.025em; }
  .inbox-head .add-chat { border-radius: 50%; background: var(--green); color: #172a43; }
  .inbox .search { margin: 0 17px 10px; border-radius: 14px; }
  .chat-item { min-height: 72px; column-gap: 12px; }
  .chat-item + .chat-item { position: relative; }
  .chat-item + .chat-item::before { content: ''; position: absolute; inset: 0 10px auto 62px; border-top: 1px solid var(--line); pointer-events: none; }
  .chat-item .avatar, .room-identity .avatar { border-radius: 50%; }
  .chat-preview { font-size: 13px; }
  .room { grid-template-rows: var(--mobile-header) minmax(0,1fr) auto; }
  .room-head { padding-top: env(safe-area-inset-top); gap: 2px; }
  .room-search { display: inline-grid; }
  .room-identity { gap: 8px; }
  .room-identity h2 { font-size: 17px; }
  .timeline { padding-top: 16px; }
  .bubble { padding: 10px 13px 6px; border-radius: 17px 17px 17px 5px; }
  .own .bubble { background: var(--own-mobile); border-radius: 17px 17px 5px 17px; }
  .composer { padding: 4px; border-radius: 25px; }
  .composer .send { border-radius: 50%; background: var(--green); color: #172a43; }
  .message-menu-button, .reaction { min-width: 44px; min-height: 44px; }
  .typing-line { padding-left: 6px; }
  .admin-dialog { width: 100%; }
  @media (hover: hover) and (pointer: fine) {
    .top-actions > .icon-button:hover { background: var(--navigation-hover); }
    .inbox-head .add-chat:hover { background: var(--green); filter: brightness(.93); }
  }
  @media (prefers-reduced-motion: no-preference) {
    .workspace:has(.layout:not(.instant-view)) .topbar {
      transition: transform var(--screen-motion) var(--ease-drawer), opacity var(--screen-motion) var(--ease-drawer), visibility 0s;
    }
    .workspace.mobile-room:has(.layout:not(.instant-view)) .topbar { transition-delay: 0s, 0s, var(--screen-motion); }
  }
  @media (prefers-reduced-motion: reduce) {
    .layout:not(.in-room) .room, .layout.in-room .inbox, .workspace.mobile-room .topbar {
      transform: none;
      opacity: 0;
    }
    .layout:not(.instant-view) > :is(.inbox,.room), .workspace:has(.layout:not(.instant-view)) .topbar {
      transition: opacity 100ms ease-out, visibility 0s;
    }
    .layout.in-room:not(.instant-view) .inbox, .layout:not(.in-room,.instant-view) .room,
    .workspace.mobile-room:has(.layout:not(.instant-view)) .topbar { transition-delay: 0s, 100ms; }
  }
}
@media (prefers-reduced-motion: no-preference) {
  .message-row.arrived { animation: arrive 165ms var(--ease-out) both; }
  :is(.icon-button,.primary,.account,.attachment-choice) { transition: transform 120ms var(--ease-out); }
  :is(.icon-button,.primary,.account,.attachment-choice):active:not(:disabled) { transform: scale(.95); }
  .profile-menu { transform-origin: top right; }
  .sticker-menu { transform-origin: bottom right; }
  dialog { --panel-offset: translateY(10px) scale(.98); --panel-duration: 200ms; }
  .popover { --panel-offset: scale(.96); --panel-duration: 150ms; }
  @media (max-width: 690px) {
    .chat-sheet { --panel-offset: translateY(22%); --panel-duration: var(--screen-motion); }
  }
  @supports (transition-behavior: allow-discrete) {
    .popover {
      opacity: 0;
      transform: var(--panel-offset);
      transition: opacity 130ms var(--ease-out), transform 130ms var(--ease-out), display 130ms allow-discrete;
    }
    .popover:not([hidden]) { opacity: 1; transform: none; transition-duration: var(--panel-duration); }
    .popover[hidden] { pointer-events: none; }
    @starting-style { .popover:not([hidden]) { opacity: 0; transform: var(--panel-offset); } }
  }
  @supports not (transition-behavior: allow-discrete) {
    .popover:not([hidden]) { animation: open-panel var(--panel-duration) var(--ease-drawer); }
  }
  @supports (transition-behavior: allow-discrete) and (overlay: auto) {
    dialog {
      opacity: 0;
      transform: var(--panel-offset);
      transition: opacity 130ms var(--ease-out), transform 130ms var(--ease-out),
        display 130ms allow-discrete, overlay 130ms allow-discrete;
    }
    dialog[open] {
      opacity: 1;
      transform: none;
      transition-duration: var(--panel-duration);
      transition-timing-function: var(--ease-drawer);
    }
    dialog:not([open]), dialog:not([open])::backdrop { pointer-events: none; }
    dialog::backdrop {
      opacity: 0;
      transition: opacity 130ms var(--ease-out), display 130ms allow-discrete, overlay 130ms allow-discrete;
    }
    dialog[open]::backdrop { opacity: 1; transition-duration: var(--panel-duration); }
    @starting-style {
      dialog[open] { opacity: 0; transform: var(--panel-offset); }
      dialog[open]::backdrop { opacity: 0; }
    }
  }
  @supports not ((transition-behavior: allow-discrete) and (overlay: auto)) {
    dialog[open] { animation: open-panel var(--panel-duration) var(--ease-drawer); }
    dialog.panel-closing { pointer-events: none; }
    dialog.panel-closing::backdrop { animation: backdrop-out 130ms var(--ease-out) both; }
  }
  .typing-indicator { animation: typing 850ms ease-in-out infinite alternate; }
  .reaction[aria-pressed=true] { animation: react 130ms ease-out; }
  .message-found .bubble { animation: found 850ms ease-out; }
}
@media (min-width: 1121px) and (prefers-reduced-motion: no-preference) {
  .layout.with-details .details { animation: details-in 200ms var(--ease-out); }
}
@keyframes arrive { from { opacity: .25; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes details-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes open-panel { from { opacity: 0; transform: var(--panel-offset); } to { opacity: 1; transform: none; } }
@keyframes backdrop-out { to { opacity: 0; } }
@keyframes typing { from { opacity: .45; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }
@keyframes react { from { opacity: .7; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
@keyframes found { from { outline: 2px solid var(--blue); } to { outline: 2px solid transparent; } }
@media (display-mode: standalone) { #install { display: none !important; } }

.topbar .brand{gap:7px}
.topbar .brand span{display:block;position:relative;padding:5px 9px;border:0;border-radius:12px 12px 12px 3px;background:var(--green);color:#152f49;font-weight:750;font-size:13px}
.sections{position:relative;flex:1;min-height:0;overflow:hidden}
.sections>section{position:absolute;inset:0;display:flex;flex-direction:column;overflow:hidden;background:var(--side);transition:opacity 140ms var(--ease-out),visibility 0s}
.sections>section[inert]{visibility:hidden;opacity:0;pointer-events:none;transition-delay:0s,140ms}
#contacts-pane{--offset:-1}
#settings-pane{--offset:1}
#directory,#preferences{overflow:auto;padding:8px 16px 24px}
#directory .person{padding:12px 6px;gap:13px;color:var(--ink)}
#directory .person:hover,#preferences button:hover{background:var(--active)}
#preferences strong{font-size:22px;overflow-wrap:anywhere}
#preferences p{color:var(--muted)}
#preferences button{display:block;width:100%;text-align:left;padding:16px 12px;border-bottom:1px solid var(--line);color:var(--ink);font-size:16px}
#preferences button:last-child{color:var(--warning)}
#sections-nav{position:relative;isolation:isolate;display:grid;grid-template-columns:repeat(3,1fr);padding:7px 0 max(8px,env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--side)}
#sections-nav:before{content:"";position:absolute;top:9px;left:0;width:33.333%;height:32px;background:var(--active);border-radius:24px;transform:translateX(calc(var(--tab,1)*100%)) scaleX(.64);transition:transform 230ms var(--ease-drawer);z-index:-1}
#sections-nav button{display:grid;justify-items:center;gap:6px;background:transparent;border:0;padding:6px 0 2px;color:var(--muted);font:600 12px/16px system-ui;transition:color .18s,transform .16s}
#sections-nav svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#sections-nav button[aria-current=page]{color:var(--blue)}
#sections-nav button:active{transform:scale(.93)}
@supports(backdrop-filter:blur(16px)){#sections-nav{background:var(--glass);backdrop-filter:blur(16px)}}
@media(prefers-reduced-motion:reduce){.sections>section,.sections>section[inert],#sections-nav:before,#sections-nav button{transition:none}}
:root{--tint:#0964c8;--tray:#edf0f5;--selected:#fff}
:root[data-theme=dark]{--side:#1c1c1e;--surface:#222225;--paper:#161618;--tray:#303033;--selected:#161617;--ink:#fafafa;--muted:#aeafb6;--line:#353538;--active:#303843;--tint:#65afff;--glass:#303034df}
.workspace .topbar{background:var(--side);color:var(--ink);border:0;box-shadow:none;gap:4px}
.topbar .brand span{display:none}
.workspace .top-actions>.icon-button{color:var(--ink);border-radius:50%;background:var(--tray)}
.top-actions .account .avatar{border-radius:50%}
.inbox{position:relative;background:var(--side);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
.inbox .inbox-head{padding:10px 17px}
.inbox .inbox-head h1{font-size:25px;letter-spacing:-.6px}
.inbox .inbox-head .add-chat{background:#1677df;color:white;border-radius:50%}
.inbox .search{border-radius:25px;background:var(--tray);margin:0 15px 10px;padding:0 16px}
#folders{display:flex;margin:0 15px 5px;padding:3px;border-radius:30px;background:var(--tray);overflow:auto;scrollbar-width:none;flex:none;box-shadow:inset 0 0 0 1px #8882}
#folders button{flex:0 0 auto;white-space:nowrap;max-width:12rem;overflow:hidden;text-overflow:ellipsis;border:0;border-radius:24px;padding:8px 9px;background:none;color:var(--ink);font-size:14px;transition:background .22s}
#folders button[aria-pressed=true]{background:var(--selected);box-shadow:0 1px 5px #0002;font-weight:650}
#chat-list,#directory,#preferences{padding-bottom:calc(104px + env(safe-area-inset-bottom))}
#chat-list{padding-inline:7px}
#chat-list .chat-item{min-height:80px;gap:11px;padding:8px;margin:0}
#chat-list .chat-item+.chat-item:before{left:77px}
.chat-item .avatar,#directory .avatar,#preferences>.avatar{border-radius:50%;width:55px;height:55px;font-size:18px;background:linear-gradient(155deg,#67b9fd,#1665c2);color:white}
.chat-item .avatar.broadcast,.avatar.n1.personal{background:linear-gradient(155deg,#af97ff,#6544b4)}
.chat-item .avatar.team,.avatar.n2.personal{background:linear-gradient(155deg,#55cba9,#087665)}
.avatar.n3.personal,#preferences>.avatar{background:linear-gradient(155deg,#53bddd,#2454a4)}
.chat-name{font-size:17px;letter-spacing:-.2px}
.chat-preview{margin-top:4px;font-size:15px}
.chat-meta{font-size:13px}
#sections-nav{position:absolute;inset:auto 14px max(12px,env(safe-area-inset-bottom));z-index:2;border-radius:38px;padding:4px;box-shadow:0 6px 22px #0002,inset 0 0 0 1px #94949444,inset 0 1px 1px #fff5;background:color-mix(in srgb,var(--tray) 84%,transparent);backdrop-filter:blur(24px) saturate(160%);-webkit-backdrop-filter:blur(24px) saturate(160%)}
#sections-nav:before{top:4px;left:4px;bottom:4px;height:auto;width:calc((100% - 8px)/3);transform:translateX(calc(var(--tab,1)*100%));background:var(--selected);border-radius:32px}
#sections-nav button{color:var(--ink);gap:2px;padding:6px 0;font-size:11px}
#sections-nav svg{width:26px;height:26px}
#sections-nav button[aria-current=page]{color:var(--tint)}
#settings-pane{background:var(--paper)}
#preferences{text-align:center}
#preferences>.avatar{display:grid;margin:10px auto 14px;width:86px;height:86px;font-size:30px}
#preferences p{margin:4px 0 24px}
.setting-row{display:flex;align-items:center;background:var(--side);padding-left:14px;position:relative}
.setting-row:first-of-type{border-radius:18px 18px 0 0}
.setting-row:has(+.setting-row:last-child),.setting-row:last-child{border-radius:0 0 18px 18px}
.setting-row:last-child{margin-top:20px;border-radius:18px}
#preferences .setting-row button{color:var(--ink);font-weight:500;padding:17px 14px}
#preferences .setting-row button:after{content:'';position:absolute;inset:0}
#preferences .setting-row:last-child button{color:var(--warning);border:0}
.setting-icon{display:grid;place-items:center;flex:none;width:31px;height:31px;background:#6856cf;border-radius:9px}
.setting-row:nth-of-type(2) .setting-icon{background:#167adc}
.setting-row:nth-of-type(3) .setting-icon{background:#138877}
.setting-row:last-child .setting-icon{background:#d64849}
.setting-icon svg{width:21px;height:21px;fill:none;stroke:white;stroke-width:1.8;stroke-linejoin:round;stroke-linecap:round}
@media(max-width:690px){
.workspace .topbar .brand img{width:clamp(76px,26vw,108px);height:auto;object-fit:contain}
.top-actions{gap:4px}
.workspace .top-actions>.icon-button{width:38px;min-width:38px;height:38px}
}
@media(prefers-reduced-transparency:reduce){#sections-nav{background:var(--tray)}}
@media(min-width:691px){#folders{margin-inline:8px}#folders button{padding-inline:8px;font-size:12px}}
.avatar[data-person],.avatar.has-chat-photo{position:relative;overflow:hidden}
.avatar[data-person]>img,.avatar.has-chat-photo>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
#preferences .edit-link{color:var(--tint);background:none;text-align:center;border:0;padding:12px;margin:-12px 0 14px}
#edit-profile{width:min(390px,94vw);border-radius:24px}
#profile-form{text-align:center;display:grid;gap:9px}
#photo-preview .avatar{width:112px;height:112px;border-radius:50%;font-size:32px}
#profile-form label{text-align:left}
#display-name{display:block;width:100%;padding:12px;font-size:16px;margin-top:6px}
#profile-form small{color:var(--muted)}
#profile-form button{min-height:44px}
#remove-photo,#profile-error{color:var(--warning)}
#save-profile{background:#1264bc;color:white;border:0;border-radius:16px;padding:10px 18px}
.push-settings{margin-top:20px;padding:12px 14px;background:var(--side);border-radius:18px;text-align:left}
#preferences .push-settings p{margin:0 0 6px;max-width:45ch}
#preferences .push-settings button{color:var(--tint);padding:10px 0;border:0}


.inbox-actions { display: flex; align-items: center; gap: 5px; }
.inbox-actions #manage-folders { color: var(--muted); }
.draft-label { color: var(--blue); font-weight: 650; }
.favorite-mark { display: inline-flex; color: var(--blue); }
.forward-origin { color: var(--blue); font-size: .79rem; font-weight: 650; margin-bottom: 5px; overflow-wrap: anywhere; }
.library-tabs { display: flex; gap: 5px; margin-bottom: 12px; }
.library-tabs button { padding: 8px 12px; min-height: 40px; }
.library-tabs button[aria-pressed=true] { background: var(--active); }
#library-search input, .folder-form input { flex: 1 1 9rem; }
#library-search .primary, .folder-form .primary { width: auto; margin: 0; min-height: 44px; }
.library-item { padding: 10px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.library-context { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-left: 8px; }
.library-context .link-button { min-height: 40px; }
.library-image-link { justify-self: start; max-width: 100%; }
.library-photo { display: block; max-width: 100%; width: auto; height: auto; max-height: 160px; border-radius: 10px; }
.library-url { display: block; padding: 8px; color: var(--blue); overflow-wrap: anywhere; }
#library-more { margin-top: 8px; min-height: 44px; }
.personal-options { display: grid; gap: 6px; }
.personal-options > .link-button { min-height: 44px; text-align: left; }
.personal-options h3 { margin: 12px 0 2px; font-size: 15px; }
.personal-options .folder-choice { display: flex; gap: 10px; align-items: center; min-height: 44px; padding: 6px 10px; }
.folder-choice input { width: 18px; height: 18px; flex: none; }
.folder-entry { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.folder-entry strong { flex: 1 0 100%; overflow-wrap: anywhere; }
.folder-entry .folder-form { flex-wrap: wrap; width: 100%; }
#forward-preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.forward-search { margin-block: 10px; }
.forward-target { display: flex; align-items: center; gap: 12px; padding: 8px; width: 100%; border: 0; background: transparent; color: var(--ink); text-align: left; border-radius: 10px; min-height: 52px; }
.forward-target .avatar { flex: none; width: 36px; height: 36px; }
.forward-target span { overflow-wrap: anywhere; }
.forward-target:is(:hover,:focus-visible) { background: var(--active); }
@media (prefers-reduced-motion: reduce) {
  .layout:not(.instant-view) > :is(.inbox,.room), .workspace:has(.layout:not(.instant-view)) .topbar,
  .layout.in-room:not(.instant-view) .inbox, .layout:not(.in-room,.instant-view) .room,
  .workspace.mobile-room:has(.layout:not(.instant-view)) .topbar { transition: none; }
}

.pinned-message { display: flex; position: sticky; z-index: 1; top: 0; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; min-height: 42px; margin-bottom: 12px; text-align: left; background: var(--surface); border: 1px solid var(--line); }
.pinned-message strong { flex: none; font-size: .79rem; }
.pinned-preview { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: .79rem; }

.room {
  --room-bar-height: 68px;
  --chat-surface: #f0f3f5;
  --chat-own: #e2efd9;
  --chat-border: color-mix(in srgb,var(--ink) 9%,transparent);
  grid-template-rows: var(--room-bar-height) minmax(0,1fr) auto;
  background: var(--chat-surface);
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
:root[data-theme=dark] .room { --chat-surface: #161a1c; --chat-own: #283d32; }
.room-head, .timeline, .compose-area { grid-column: 1; }
.room-head {
  grid-row: 1;
  z-index: 1;
  border-color: var(--chat-border);
  background: var(--side);
}
.room-head .avatar { border-radius: 50%; }
.room-identity h2 { font-size: 1.125rem; font-weight: 680; letter-spacing: -.025em; }
.room-identity .sub { line-height: 1.4; }
.timeline {
  grid-row: 1 / 3;
  background: var(--chat-surface);
  padding-top: calc(var(--room-bar-height) + 18px);
  scroll-padding-block-start: calc(var(--room-bar-height) + 10px);
}
@supports ((backdrop-filter: blur(18px)) or (-webkit-backdrop-filter: blur(18px))) {
  .room-head {
    background: color-mix(in srgb,var(--side) 86%,transparent);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
    backdrop-filter: blur(18px) saturate(135%);
  }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .room-head { background:var(--side); backdrop-filter:none; -webkit-backdrop-filter:none; border-color:var(--line); }
}
.room #messages { gap: 8px; }
.room .date-line { background: var(--side); padding: 5px 12px; font-size: .75rem; font-weight: 600; }
.message-row { position: relative; }
.room .message-row .avatar { border-radius: 50%; margin-block-end: 4px; }
.room .bubble {
  position: relative;
  padding: 10px 13px 5px;
  border-radius: 18px 18px 18px 7px;
  box-shadow: inset 0 0 0 1px var(--chat-border);
}
.room .own .bubble { background: var(--chat-own); border-radius: 18px 18px 7px 18px; }
.room .message-copy { font-size: .975rem; line-height: 1.46; }
.room .message-footer { margin-inline-end: -4px; gap: 6px; }
.swipe-reply-target { touch-action: pan-y pinch-zoom; }
.swipe-reply-mark {
  display: grid;
  place-items: center;
  position: absolute;
  right: 3px;
  top: 50%;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  transform: translateY(-50%);
  color: var(--blue);
  background: var(--side);
  opacity: 0;
  pointer-events: none;
}
.swiping-reply .swipe-reply-mark { opacity: .7; }
.swipe-reply-ready .swipe-reply-mark { opacity: 1; background: var(--blue); color: var(--on-accent); }
.compose-area { grid-row: 3; }
.room .composer {
  padding: 4px;
  gap: 2px;
  border-color: var(--chat-border);
  border-radius: 26px;
  box-shadow: 0 2px 6px #0001;
}
.room .composer:focus-within { border-color: var(--tint); }
.room .composer .send { border-radius: 50%; background: var(--blue); color: var(--on-accent); }
#reply-draft { border-radius: 17px; padding: 4px 5px 4px 11px; gap: 9px; }
#reply-draft .reply-draft-mark {
  display: grid;
  flex: 0 0 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  color: var(--blue);
  background: var(--active);
}
.reply-draft-copy { display: grid; flex: 1; min-width: 0; gap: 1px; }
.reply-draft-copy strong { color: var(--blue); font-size: .78rem; }
.reply-draft-copy span { color: var(--ink); font-size: .87rem; }
.reply-draft-copy strong, .reply-draft-copy span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (max-width: 690px) {
  .room { --room-bar-height: var(--mobile-header); }
  .room-head { padding-inline: max(8px,env(safe-area-inset-left)) max(8px,env(safe-area-inset-right)); }
  .room .timeline { padding-inline: max(12px,env(safe-area-inset-left)) max(12px,env(safe-area-inset-right)); }
  .room .message-menu-button { min-width: 44px; min-height: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .swiping-reply .swipe-reply-mark { z-index: 1; }
}

.forward-contact {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  text-align: start;
  text-decoration: underline;
  text-underline-offset: .2em;
}

@media (max-width: 690px) {
  :root {
    --phone-bar: #f7fafb;
    --phone-line: #d7e2e8;
    --phone-selected: #dcecf7;
    --phone-ink: #14365e;
    --phone-press: #e7f0f5;
    --phone-shadow: 0 8px 26px #1623341a;
    overscroll-behavior-x: auto;
  }
  :root[data-theme=dark] {
    --phone-bar: #202a31;
    --phone-line: #38454d;
    --phone-selected: #253e53;
    --phone-ink: #a7d6ff;
    --phone-press: #2b3944;
    --phone-shadow: 0 8px 26px #0005;
  }
  body { overscroll-behavior-x: auto; }
  .workspace {
    --screen-motion: 220ms;
    --ease-drawer: cubic-bezier(.22,.74,.24,1);
    --mobile-header: calc(60px + env(safe-area-inset-top));
    background: var(--side);
    height: var(--keyboard-height,100vh);
    height: var(--keyboard-height,100dvh);
  }
  .workspace.mobile-room.keyboard-open {
    position: fixed;
    inset: var(--keyboard-top,0px) 0 auto;
  }
  .workspace.mobile-room.keyboard-open .compose-area { padding-bottom: 6px; }
  .workspace .topbar, .room .room-head, .workspace #sections-nav,
  .workspace .popover, dialog:not(.admin-dialog) {
    background: var(--phone-bar);
    border-color: var(--phone-line);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .workspace .topbar {
    padding-inline: max(16px,env(safe-area-inset-left)) max(12px,env(safe-area-inset-right));
    border-bottom: 1px solid var(--phone-line);
  }
  .workspace .topbar .brand img { width: clamp(88px,24vw,110px); }
  .workspace .top-actions > .icon-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: none;
    color: var(--phone-ink);
  }
  .top-actions .connection { margin-inline-end: 0; }
  .top-actions { gap: 0; }
  .inbox .inbox-head { padding: 14px 18px 10px; }
  .inbox .inbox-head h1 { font-size: 30px; font-weight: 720; letter-spacing: -.035em; }
  .inbox .inbox-head .add-chat { background: var(--blue); color: var(--on-accent); min-width: 44px; min-height: 44px; }
  .inbox .search { border-radius: 15px; margin-inline: 16px; }
  #folders { margin-inline: 16px; }
  #folders button { min-height: 40px; }
  #chat-list .chat-item { min-height: 76px; }
  .chat-preview { line-height: 1.35; }
  .room, .room .timeline, #chat-list, #directory, #preferences, #contact-card { touch-action: pan-y pinch-zoom; }
  #sections-nav {
    inset-inline: max(16px,env(safe-area-inset-left)) max(16px,env(safe-area-inset-right));
    inset-block-end: max(10px,env(safe-area-inset-bottom));
    padding: 4px;
    border: 1px solid var(--phone-line);
    border-radius: 24px;
    box-shadow: var(--phone-shadow);
  }
  #sections-nav::before { background: var(--phone-selected); border-radius: 19px; transition-duration: 220ms; }
  #sections-nav button { min-height: 48px; color: var(--muted); font-size: .75rem; }
  #sections-nav button > * { pointer-events: none; }
  #sections-nav button[aria-current=page] { color: var(--phone-ink); }
  #sections-nav svg { width: 22px; height: 22px; }
  .room-head .icon-button { min-width: 44px; min-height: 44px; }
  .room .room-identity h2 { font-size: 17px; }
  .room .bubble { padding: 10px 12px 5px; }
  .room .message-copy { font-size: 1rem; line-height: 1.5; }
  .room .compose-area { padding-inline: max(10px,env(safe-area-inset-left)) max(10px,env(safe-area-inset-right)); padding-bottom: max(8px,env(safe-area-inset-bottom)); }
  .room .composer .icon-button { width: 44px; height: 44px; }
  .workspace .popover { box-shadow: var(--phone-shadow); }
  .forward-contact { min-height: 36px; }

  @supports (((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) and (background: color-mix(in srgb, white, transparent))) {
    .workspace .topbar, .room .room-head, .workspace #sections-nav,
    .workspace .popover, dialog:not(.admin-dialog) {
      background: color-mix(in srgb,var(--phone-bar) 88%,transparent);
      -webkit-backdrop-filter: blur(16px) saturate(125%);
      backdrop-filter: blur(16px) saturate(125%);
    }
  }
  @media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
    .workspace .topbar, .room .room-head, .workspace #sections-nav,
    .workspace .popover, dialog:not(.admin-dialog) {
      background: var(--phone-bar);
      -webkit-backdrop-filter: none;
      backdrop-filter: none;
    }
  }
  @media (prefers-reduced-motion: no-preference) {
    .layout.in-room .room { transform: translateX(var(--back-drag,0px)); }
    .layout.dragging-back .room { transition: none; }
    .layout.dragging-back .inbox { visibility: visible; }
    .workspace.mobile-room:has(.layout.dragging-back) .topbar { visibility: visible; }
  }
  @media (prefers-reduced-motion: reduce) {
    #sections-nav::before { transition: none; }
  }
}
