@font-face { font-family: "Inter"; src: url("../assets/fonts/Inter-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../assets/fonts/Inter-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../assets/fonts/Inter-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../assets/fonts/Inter-Bold.ttf") format("truetype"); font-weight: 700 900; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../assets/fonts/Vazirmatn-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Vazirmatn"; src: url("../assets/fonts/Vazirmatn-Medium.ttf") format("truetype"); font-weight: 500 600; font-display: swap; unicode-range: U+0600-06FF, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Vazirmatn"; src: url("../assets/fonts/Vazirmatn-Bold.ttf") format("truetype"); font-weight: 700 900; font-display: swap; unicode-range: U+0600-06FF, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; }

:root {
  --bg: #0c0d12; --bg-2: #111218; --panel: #15171f; --panel-2: #1a1d26; --panel-3: #20242f;
  --line: #20242f; --line-2: #2a2f3d; --line-3: #3a4052;
  --ink: #f2f4f8; --ink-2: #c9cedb; --ink-3: #98a0b3; --ink-4: #6d7488; --ink-5: #545a6b;
  --accent: #5b8def; --accent-2: #8b7cf6; --accent-hover: #6f9bf2; --accent-ink: #fff; --accent-soft: rgba(91, 141, 239, .16);
  --ok: #3fb27f; --warn: #e3b341; --bad: #e5534b; --live: #e5534b; --idle: #e3b341; --dnd: #e5534b;
  --glow: rgba(91, 141, 239, .28);
  --shadow: 0 18px 50px -12px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255, 255, 255, .04);
  --r-xs: 6px; --r-sm: 8px; --r: 10px; --r-md: 12px; --r-lg: 14px; --r-xl: 18px; --r-2xl: 22px;
  --font: "Inter", "Vazirmatn", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #e9ecf3; --bg-2: #f1f3f8; --panel: #ffffff; --panel-2: #f4f6fa; --panel-3: #e3e7ef;
  --line: #e3e7ef; --line-2: #d5dae5; --line-3: #bcc3d2;
  --ink: #12141b; --ink-2: #353a49; --ink-3: #5d6477; --ink-4: #8a91a3; --ink-5: #a3a9b8;
  --accent: #3f74e0; --accent-2: #7461ee; --accent-hover: #2f63cf; --accent-soft: rgba(63, 116, 224, .12);
  --glow: rgba(63, 116, 224, .18);
  --shadow: 0 18px 50px -14px rgba(30, 40, 80, .35), 0 0 0 1px rgba(20, 30, 60, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #e9ecf3; --bg-2: #f1f3f8; --panel: #ffffff; --panel-2: #f4f6fa; --panel-3: #e3e7ef;
    --line: #e3e7ef; --line-2: #d5dae5; --line-3: #bcc3d2;
    --ink: #12141b; --ink-2: #353a49; --ink-3: #5d6477; --ink-4: #8a91a3; --ink-5: #a3a9b8;
    --accent: #3f74e0; --accent-2: #7461ee; --accent-hover: #2f63cf; --accent-soft: rgba(63, 116, 224, .12);
    --glow: rgba(63, 116, 224, .18);
    --shadow: 0 18px 50px -14px rgba(30, 40, 80, .35), 0 0 0 1px rgba(20, 30, 60, .06);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; overflow: hidden; -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
button { touch-action: manipulation; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
p { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: var(--r); border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none;
  transition: background .15s, transform .12s, box-shadow .15s;
}
.btn:hover { background: var(--accent-hover); box-shadow: 0 8px 22px -10px var(--accent); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn svg { width: 18px; height: 18px; }
.btn--block { width: 100%; }
.btn--tall { height: 44px; }
.btn--ghost { background: var(--panel-3); color: var(--ink); }
.btn--ghost:hover { background: var(--line-2); box-shadow: none; }
.btn--danger { background: var(--bad); }
.btn--danger:hover { background: var(--bad); filter: brightness(1.1); box-shadow: none; }
.btn--ok { background: var(--ok); }
.btn--ok:hover { background: var(--ok); filter: brightness(1.08); box-shadow: none; }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn.is-busy span { visibility: hidden; }
.btn.is-busy { position: relative; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite;
}
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: 9px; border: 0; background: transparent; color: var(--ink-3); cursor: pointer;
  transition: background .15s, color .15s, transform .12s;
}
.icon-btn:hover { background: var(--panel-3); color: var(--ink); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.is-on { color: var(--bad); }
.icon-btn.is-active { color: var(--accent); background: var(--accent-soft); }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; display: inline-block;
}
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: var(--r-xs); letter-spacing: .3px; }
.pill--live { background: var(--bad); color: #fff; }
.pill--live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.logo {
  width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 18px -6px var(--accent);
}
.logo svg { width: 20px; height: 20px; color: #fff; stroke: #fff; stroke-width: 2.2; }

.boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(4px); } }
@keyframes sheet-up { from { transform: translateY(100%); } }

/* tooltip */
.tip {
  position: fixed; left: 0; top: 0; z-index: 200; pointer-events: none; max-width: 240px;
  background: #06070a; color: #fff; padding: 7px 10px; border-radius: var(--r-sm); font-size: 12.5px; line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5); opacity: 0; transform: translateY(3px); transition: opacity .12s, transform .12s;
}
.tip.is-shown { opacity: 1; transform: none; }
.tip small { display: block; color: #98a0b3; font-size: 11.5px; margin-top: 1px; }
.tip kbd { font: 600 10.5px var(--font); background: #20242f; border: 1px solid #3a4052; border-radius: 4px; padding: 0 4px; margin-left: 4px; color: #c9cedb; }

/* popover menus and mobile sheets */
.menu-layer { position: fixed; inset: 0; z-index: 70; }
.pop {
  position: fixed; z-index: 71; min-width: 220px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow: auto;
  background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 6px;
  animation: pop .16s cubic-bezier(.3, 1.3, .5, 1); transform-origin: var(--origin, top left);
}
.pop--card { padding: 0; width: 310px; overflow: hidden; }
.mi {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-sm);
  background: none; font-size: 13.5px; color: var(--ink-2); text-align: left; cursor: pointer;
}
.mi:hover { background: var(--accent); color: #fff; }
.mi svg { width: 18px; height: 18px; }
.mi .mi__kb { margin-left: auto; font-size: 11.5px; color: var(--ink-4); }
.mi:hover .mi__kb { color: rgba(255, 255, 255, .8); }
.mi.is-danger { color: var(--bad); }
.mi.is-danger:hover { background: var(--bad); color: #fff; }
.mi.is-sel::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.mi:hover.is-sel::after { background: #fff; }
.mi .mi__dot, .statusbtn .mi__dot { width: 10px; height: 10px; flex: none; margin: 0 4px; }
.msep { height: 1px; background: var(--line); margin: 5px 6px; }
.mhead { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-4); padding: 8px 10px 4px; }
.sheet-bg { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .5); display: flex; align-items: flex-end; animation: fade .2s; }
.sheet {
  width: 100%; max-height: 85dvh; overflow: auto; background: var(--panel); color: var(--ink);
  border-radius: 24px 24px 0 0; padding: 8px 12px calc(20px + env(safe-area-inset-bottom));
  animation: sheet-up .25s cubic-bezier(.2, .9, .3, 1);
}
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto 12px; }
.sheet .mi { font-size: 15px; padding: 12px 10px; }
.sheet .mi:hover { background: var(--panel-2); color: var(--ink); }
.sheet .mi.is-danger:hover { background: var(--panel-2); color: var(--bad); }
.sheet .mi:hover.is-sel::after { background: var(--accent); }

/* profile card */
.pc__banner { height: 64px; background: linear-gradient(135deg, hsl(var(--h) 55% 46%), hsl(calc(var(--h) + 50) 55% 40%)); }
.pc__banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc__body { padding: 0 16px 14px; }
.pc__av { margin-top: -32px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.pc__av .av { width: 72px; height: 72px; font-size: 28px; box-shadow: 0 0 0 5px var(--panel); }
.pc__av .av-wrap { --ring: var(--panel); }
.pc__av .av-wrap .pres { width: 22px; height: 22px; border-width: 4px; }
.pc__role { margin-bottom: 4px; background: var(--accent-soft); color: var(--accent); }
.pc__name { font-size: 18px; font-weight: 800; margin-top: 8px; overflow-wrap: anywhere; }
.pc__handle { color: var(--ink-3); font-size: 13px; }
.pc__sec { margin-top: 12px; background: var(--bg-2); border-radius: var(--r); padding: 10px 12px; font-size: 13px; color: var(--ink-2); }
.pc__sec b { display: block; font-size: 11.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 3px; }
.pc__plat { display: flex; gap: 8px; flex-wrap: wrap; }
.pc__plat span { display: inline-flex; align-items: center; gap: 5px; }
.pc__plat svg { width: 15px; height: 15px; color: var(--ink-3); }
.pc__acts { display: flex; gap: 8px; margin-top: 12px; }
.pc__acts .btn { flex: 1; }
.sheet .pc__banner { margin: -8px -12px 0; border-radius: 22px 22px 0 0; }
.sheet .pc__body { padding: 0 4px 4px; }

/* ============ sign in ============ */
body:has(#auth:not([hidden])) { overflow: auto; }
.auth {
  min-height: 100%; min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(91, 141, 239, .18), transparent 60%),
    radial-gradient(800px 500px at 90% 90%, rgba(139, 124, 246, .16), transparent 60%), var(--bg);
}
.login {
  width: min(960px, 100%); min-height: 580px; display: grid; grid-template-columns: 1.05fr 1fr;
  background: var(--panel); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow);
}
.login__art {
  position: relative; padding: 36px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(150deg, #1d2a52 0%, #2b1f55 55%, #14182a 100%); color: #fff; overflow: hidden;
}
.login__art::before {
  content: ""; position: absolute; inset: -30%; filter: blur(60px); animation: spin 24s linear infinite;
  background: conic-gradient(from 200deg at 60% 40%, rgba(91, 141, 239, .35), rgba(139, 124, 246, .25), rgba(229, 83, 75, .12), rgba(91, 141, 239, .35));
}
.login__art > * { position: relative; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: .2px; color: inherit; }
.brand small { font-size: 11px; font-weight: 700; background: rgba(255, 255, 255, .16); padding: 2px 7px; border-radius: 6px; }
.login__art h1 { font-size: 32px; line-height: 1.15; letter-spacing: -.5px; margin: 0 0 10px; font-weight: 800; }
.login__art p { color: rgba(255, 255, 255, .75); max-width: 340px; }
.float { display: flex; flex-direction: column; gap: 10px; margin: 26px 0; }
.fcard {
  display: flex; align-items: center; gap: 10px; width: fit-content; padding: 10px 12px; border-radius: var(--r-lg);
  background: rgba(255, 255, 255, .08); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, .1);
  animation: bob 6s ease-in-out infinite;
}
.fcard:nth-child(2) { margin-left: 40px; animation-delay: -2s; }
.fcard:nth-child(3) { margin-left: 12px; animation-delay: -4s; }
.fcard:nth-child(4) { margin-left: 56px; animation-delay: -1s; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.fcard b { font-size: 13px; }
.fcard small { display: block; color: rgba(255, 255, 255, .65); font-size: 11.5px; }
.fcard .pill { margin-left: 6px; }
.av.fav { width: 34px; height: 34px; font-size: 14px; overflow: visible; background: linear-gradient(135deg, var(--g1), var(--g2)); }
.fav .st { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; border: 3px solid #2a2a4f; background: #2a2a4f; }
.wave { display: flex; gap: 2px; align-items: center; height: 16px; margin-left: 6px; }
.wave i { width: 3px; border-radius: 2px; background: var(--ok); animation: wv 1s ease-in-out infinite; }
.wave i:nth-child(2) { animation-delay: -.3s; } .wave i:nth-child(3) { animation-delay: -.6s; } .wave i:nth-child(4) { animation-delay: -.15s; }
@keyframes wv { 0%, 100% { height: 4px; } 50% { height: 15px; } }
.login__feat { display: flex; gap: 16px; font-size: 12.5px; color: rgba(255, 255, 255, .8); flex-wrap: wrap; }
.login__feat span { display: flex; gap: 6px; align-items: center; }
.login__feat svg { width: 16px; height: 16px; }

.login__form { position: relative; padding: 40px 44px; display: flex; flex-direction: column; }
.login__top { position: absolute; top: 14px; right: 14px; left: 44px; display: flex; justify-content: flex-end; align-items: center; }
.login__mlogo { display: none; }
.login__form h2 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.3px; }
.login__sub { color: var(--ink-3); margin: 0 0 22px; }
.tabs2 { position: relative; display: grid; grid-template-columns: 1fr 1fr; background: var(--panel-2); border-radius: 11px; padding: 4px; margin-bottom: 20px; }
.tabs2 button { position: relative; z-index: 1; height: 34px; border: 0; border-radius: var(--r-sm); background: none; font-weight: 600; color: var(--ink-3); cursor: pointer; transition: color .2s; }
.tabs2 button[aria-selected="true"] { color: var(--ink); }
.tabs2__thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: var(--r-sm); background: var(--line-2); transition: transform .25s cubic-bezier(.3, .7, .3, 1); }
.tabs2.is-right .tabs2__thumb { transform: translateX(100%); }
.auth__invite { margin: -6px 0 16px; padding: 10px 14px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--ink-2); font-size: 13px; font-weight: 500; }
.form { display: grid; gap: 14px; }
.login__form .form { gap: 0; }
.field { display: block; margin-bottom: 14px; }
.field > span:first-child { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field em { font-style: normal; font-weight: 500; color: var(--ink-4); }
.inp {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px; border-radius: var(--r);
  background: var(--bg); border: 1.5px solid var(--panel-3); transition: border-color .15s, box-shadow .15s;
}
.inp:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.inp.is-err { border-color: var(--bad); }
.inp > svg { width: 18px; height: 18px; color: var(--ink-4); }
.inp input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; padding: 0; }
.inp input::placeholder { color: var(--ink-4); }
.eye { display: grid; place-items: center; border: 0; background: none; color: var(--ink-4); cursor: pointer; padding: 0; }
.eye:hover { color: var(--ink); }
.eye svg { width: 18px; height: 18px; }
.check { display: flex; align-items: center; gap: 9px; margin: 4px 0 18px; padding: 0; border: 0; background: none; color: var(--ink-2); font-size: 13px; cursor: pointer; user-select: none; text-align: left; }
.check i { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-3); display: grid; place-items: center; transition: .15s; }
.check.is-on i { background: var(--accent); border-color: var(--accent); }
.check i svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 3; opacity: 0; }
.check.is-on i svg { opacity: 1; }
.strength { display: flex; gap: 4px; margin-top: 7px; }
.strength i { flex: 1; height: 4px; border-radius: 2px; background: var(--panel-3); transition: background .2s; }
.strength.s1 i:nth-child(-n+1) { background: var(--bad); }
.strength.s2 i:nth-child(-n+2) { background: var(--warn); }
.strength.s3 i:nth-child(-n+3) { background: var(--ok); }
.strength.s4 i { background: var(--ok); }
.form__error { display: flex; gap: 6px; align-items: flex-start; color: var(--bad); font-size: 13px; margin: -4px 0 12px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-4); font-size: 12px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--panel-3); }
.login__foot { margin-top: auto; padding-top: 18px; font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.login__foot svg { width: 18px; height: 18px; }
.login__foot a { font-weight: 600; }
.install-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-lg); background: var(--panel); margin-top: 14px; font-size: 13px; }
.install-row .logo { width: 34px; height: 34px; border-radius: 9px; }
.install-row .logo svg { width: 18px; height: 18px; }
.install-row div { flex: 1; min-width: 0; }
.install-row small { display: block; color: var(--ink-3); font-size: 12px; }

/* ============ app shell (desktop) ============ */
.shell {
  position: fixed; inset: 0; height: 100vh; height: 100dvh;
  display: grid; grid-template-columns: 72px 256px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  background: var(--bg);
}
.shell.has-members { grid-template-columns: 72px 256px minmax(0, 1fr) 240px; }
.rail {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0;
  background: var(--bg); overflow-y: auto; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail__sep { width: 32px; height: 2px; flex: none; border-radius: 2px; background: var(--panel-3); margin: 2px 0; }
.srv {
  position: relative; width: 48px; height: 48px; flex: none; border-radius: 16px; border: 0; padding: 0;
  display: grid; place-items: center; cursor: pointer; overflow: visible;
  background: var(--panel); color: var(--ink-2); font-weight: 700; font-size: 15px;
  transition: border-radius .2s, background .2s, color .2s, transform .12s;
}
.srv__face { width: 100%; height: 100%; border-radius: inherit; overflow: hidden; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, hsl(var(--h) 60% 52%), hsl(calc(var(--h) + 60) 60% 50%)); }
.srv__face img { width: 100%; height: 100%; object-fit: cover; }
.srv:hover, .srv.is-on { border-radius: 14px; }
.srv:active { transform: scale(.94); }
.srv::before {
  content: ""; position: absolute; left: -12px; top: 50%; width: 4px; height: 0;
  border-radius: 0 4px 4px 0; background: var(--ink); transform: translateY(-50%); transition: height .2s;
}
.srv:hover::before { height: 18px; }
.srv.is-unread::before { height: 8px; }
.srv.is-on::before { height: 36px; }
.srv--home { color: var(--accent); }
.srv--home.is-on, .srv--home:hover { background: var(--accent); color: #fff; }
.homebars { display: flex; align-items: center; gap: 4px; height: 16px; }
.homebars i { width: 4px; border-radius: 2px; background: currentColor; transition: height .2s ease; }
.homebars i:nth-child(1) { height: 8px; }
.homebars i:nth-child(2) { height: 15px; }
.homebars i:nth-child(3) { height: 11px; }
:is(.srv--home:hover, .srv--home.is-on) .homebars i:nth-child(1) { height: 14px; }
:is(.srv--home:hover, .srv--home.is-on) .homebars i:nth-child(2) { height: 9px; }
:is(.srv--home:hover, .srv--home.is-on) .homebars i:nth-child(3) { height: 16px; }
.srv .badge { position: absolute; right: -4px; bottom: -4px; box-shadow: 0 0 0 3px var(--bg); }
.srv--add { color: var(--ok); }
.srv--add:hover { background: var(--ok); color: #fff; }
.srv--discover { color: var(--accent); }
.srv--discover:hover, .srv--discover.is-on { background: var(--accent); color: #fff; }
.srv__voice { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ok); display: grid; place-items: center; box-shadow: 0 0 0 3px var(--bg); }
.srv__voice svg { width: 11px; height: 11px; stroke: #fff; stroke-width: 2.4; }

.side { display: flex; flex-direction: column; min-height: 0; background: var(--bg-2); border-radius: 14px 0 0 0; overflow: hidden; }
.side__list, .side__home { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 8px; overscroll-behavior: contain; }
.cat {
  display: flex; align-items: center; gap: 4px; width: 100%; padding: 14px 6px 5px; border: 0; background: none; cursor: pointer;
  color: var(--ink-4); font-size: 11.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; text-align: left;
}
.cat:hover { color: var(--ink-2); }
.cat svg { width: 12px; height: 12px; transition: transform .15s; }
.cat.is-collapsed svg { transform: rotate(-90deg); }
.ch {
  position: relative; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 0 8px; margin: 1px 0;
  border-radius: var(--r-sm); border: 0; background: none; cursor: pointer; color: var(--ink-3); text-align: left;
  transition: background .12s, color .12s;
}
.ch svg { width: 19px; height: 19px; color: var(--ink-4); }
.ch span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch:hover { background: var(--panel-2); color: var(--ink-2); }
.ch.is-on { background: var(--panel-3); color: var(--ink); }
.ch.is-on svg { color: var(--ink-2); }
.ch.is-unread { color: var(--ink); font-weight: 600; }
.ch.is-unread::before { content: ""; position: absolute; left: -8px; width: 4px; height: 8px; border-radius: 0 4px 4px 0; background: var(--ink); }
.ch.is-joined, .ch.is-joined svg { color: var(--ok); }
.ch .count { font-size: 11px; color: var(--ink-4); background: var(--panel-2); padding: 1px 6px; border-radius: var(--r-xs); }
.vlist { display: grid; gap: 1px; padding: 2px 0 6px 26px; }
.vstatus { padding: 0 0 2px 34px; color: var(--ink-4); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vuser { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 8px; border-radius: 7px; color: var(--ink-3); font-size: 13px; cursor: pointer; }
.vuser:hover { background: var(--panel-2); color: var(--ink); }
.vuser span.name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vuser svg { width: 15px; height: 15px; color: var(--ink-4); }
.vuser svg.is-bad { color: var(--bad); }
.vuser .live-tag { font-size: 9.5px; font-weight: 700; color: #fff; background: var(--bad); padding: 1px 5px; border-radius: 5px; }
.vuser.is-lost > .av { opacity: .5; }
.vuser.is-lost span.name { opacity: .6; }
.lost-dots { display: inline-flex; align-items: center; gap: 3px; flex: none; }
.lost-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--warn); opacity: .2; animation: lost-blink 1.2s infinite; }
.lost-dots i:nth-child(2) { animation-delay: .2s; } .lost-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes lost-blink { 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lost-dots i { animation: none; opacity: 1; } }

.av {
  --h: 220; position: relative; flex: none; display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%; overflow: hidden; user-select: none;
  background: linear-gradient(135deg, hsl(var(--h) 60% 52%), hsl(calc(var(--h) + 40) 58% 46%)); color: #fff; font-weight: 700; font-size: 13px;
}
.av img { width: 100%; height: 100%; object-fit: cover; }
.av > .av__live { display: none; position: absolute; inset: 0; }
:is(.av:hover, .av.is-live, .av.is-speaking, .is-speaking .av, [data-person]:hover .av) > .av__live { display: block; }
@media (prefers-reduced-motion: reduce) { .av > .av__live { display: none !important; } }
.av--xs { width: 22px; height: 22px; font-size: 10px; }
.av--sm { width: 26px; height: 26px; font-size: 11px; }
.av--lg { width: 40px; height: 40px; font-size: 16px; }
.av--xl { width: 84px; height: 84px; font-size: 32px; }
.av.is-speaking { box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 4px var(--ok); }
.av-wrap { --ring: var(--bg-2); position: relative; flex: none; display: inline-grid; }
.av-wrap .pres {
  position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px;
  border-radius: 50%; border: 3px solid var(--ring); background: var(--ring);
}
.av-wrap .av--xs + .pres, .av-wrap .av--sm + .pres { width: 10px; height: 10px; border-width: 2px; }
.av-wrap .av--lg + .pres { width: 15px; height: 15px; }
.av-wrap .av--xl + .pres { width: 24px; height: 24px; border-width: 5px; }

.callbar { flex: none; margin: 0 8px 8px; }
.callbar:empty { display: none; }
.callbar__row { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: var(--r-md); background: var(--panel); box-shadow: 0 0 0 1px var(--panel-3); }
.callbar__state { flex: 1; min-width: 0; line-height: 1.4; }
.callbar__state b { display: block; font-size: 13px; color: var(--ok); }
.callbar__state b.is-warn { color: var(--warn); }
.callbar__state span { display: block; font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.callbar__state span:hover { color: var(--ink); text-decoration: underline; }
.me { flex: none; display: flex; align-items: center; gap: 2px; margin: 0 8px 8px; padding: 8px; border-radius: var(--r-md); background: var(--bg); }
.me:empty { display: none; }
.me__open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 4px 6px;
  border: 0; border-radius: 9px; background: none; color: inherit; cursor: pointer; text-align: left;
}
.me__open .av-wrap { --ring: var(--bg); }
.me__open:hover { background: var(--panel-2); }
.me__who { flex: 1; min-width: 0; line-height: 1.3; }
.me__who b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me__who span { display: block; font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .icon-btn { width: 32px; height: 32px; }

.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); }
.main__head { height: 52px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 14px 0 18px; border-bottom: 1px solid var(--panel-3); }
.main__back { display: none; }
.main__title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.main__title > svg { color: var(--ink-4); }
.main__title > b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main__title .topic { min-width: 0; color: var(--ink-3); font-size: 13px; padding-left: 12px; margin-left: 2px; border-left: 1px solid var(--line-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main__title .auto-delete { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; flex: none; font-size: 12px; color: var(--ink-3); }
.main__title .auto-delete svg { width: 14px; height: 14px; }
.conn { font-size: 12px; color: var(--warn); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.main__body, .main__home { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.shell[data-mode="home"] .main__head, .shell[data-mode="home"] .main__body { display: none; }

.empty { margin: auto; display: grid; justify-items: center; gap: 12px; padding: 24px; text-align: center; max-width: 420px; }
.empty .big { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty .big svg { width: 30px; height: 30px; }
.empty h2 { font-size: 22px; }

/* chat */
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 0 8px; display: flex; flex-direction: column; overscroll-behavior: contain; }
.msgs__top { padding: 16px 18px 20px; display: grid; gap: 6px; justify-items: start; }
.msgs__top .big { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-3); color: var(--ink-2); }
.msgs__top .big svg { width: 30px; height: 30px; }
.msgs__top h2 { font-size: 24px; margin-top: 6px; }
.day { display: flex; align-items: center; gap: 10px; margin: 14px 18px; color: var(--ink-4); font-size: 11.5px; font-weight: 600; }
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--panel-3); }
.msg { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 14px; padding: 2px 18px; }
.msg:hover { background: rgba(0, 0, 0, .12); }
:root[data-theme="light"] .msg:hover { background: var(--panel-2); }
.msg--head { margin-top: 10px; padding-top: 4px; }
.msg__gutter { grid-row: span 2; }
.msg__gutter .av { cursor: pointer; margin-top: 2px; }
.msg__time-inline { font-size: 10.5px; color: var(--ink-4); opacity: 0; text-align: center; padding-top: 3px; white-space: nowrap; }
.msg:hover .msg__time-inline { opacity: 1; }
.msg__meta { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.msg__meta b { font-weight: 600; color: var(--ink); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg__meta b:hover { text-decoration: underline; }
.msg__meta time { font-size: 11.5px; color: var(--ink-4); flex: none; }
.msg__body { color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; text-align: start; margin-top: 1px; }
.msg__body .edited { font-size: 10.5px; color: var(--ink-4); margin-left: 4px; }
.msg--pending .msg__body { opacity: .55; }
.msg--failed .msg__body { color: var(--bad); }
.msg--system { color: var(--ink-3); font-size: 13.5px; }
.msg--system .msg__gutter { display: grid; place-items: center; color: var(--ok); }
.msg__reply { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 2px; min-width: 0; }
.msg__reply::before { content: ""; width: 28px; height: 10px; flex: none; border-left: 2px solid var(--line-2); border-top: 2px solid var(--line-2); border-radius: 6px 0 0 0; margin-left: -34px; margin-top: 8px; }
.msg__reply b { flex: none; color: var(--ink-2); font-weight: 600; }
.msg__reply span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.atts img { max-width: min(360px, 100%); max-height: 280px; border-radius: var(--r); cursor: zoom-in; display: block; }
.att-file { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--r-md); background: var(--panel-2); border: 1px solid var(--panel-3); }
.att-file--web { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px; width: min(340px, 100%); }
.att-file__head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.att-file__icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--r); background: var(--accent-soft); color: var(--accent); }
.att-file__info { display: flex; flex-direction: column; min-width: 0; }
.att-file__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file__size { font-size: 12.5px; color: var(--ink-3); }
.att-file__note { font-size: 13px; color: var(--ink-2); }
.att-file--web .btn { align-self: flex-start; }
.reacts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.react { display: inline-flex; gap: 5px; align-items: center; font-size: 12.5px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-sm); background: var(--panel-2); border: 1px solid var(--panel-3); color: var(--ink-2); }
.react.is-me { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.loader { display: grid; place-items: center; padding: 12px; }

.composer { flex: none; padding: 0 16px 16px; }
.composer__box { display: flex; align-items: flex-end; gap: 4px; padding: 6px 6px 6px 12px; border-radius: var(--r-md); background: var(--panel-2); box-shadow: 0 0 0 1px var(--panel-3); }
.composer__box:focus-within { box-shadow: 0 0 0 1px var(--accent); }
.composer textarea {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; resize: none; max-height: 200px;
  padding: 7px 2px; line-height: 1.45; color: var(--ink); unicode-bidi: plaintext;
}
.composer textarea::placeholder { color: var(--ink-4); }
.composer__send.icon-btn { background: var(--accent); color: #fff; }
.composer__send.icon-btn:hover { background: var(--accent-hover); color: #fff; }
.composer__typing { height: 20px; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); padding: 0 4px 2px; }
.composer__typing b { color: var(--ink-2); font-weight: 600; }
.dots { display: inline-flex; gap: 2px; }
.dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-3); animation: td 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes td { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }
.composer__locked { padding: 12px 14px; border-radius: var(--r-md); background: var(--panel-2); color: var(--ink-3); font-size: 13.5px; }

/* call (base; call.css refines) */
.call { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #08090c; color: #f2f4f8; }
:root[data-theme="light"] .call { background: #10121a; }
.call__grid { flex: 1; min-height: 0; display: grid; gap: 12px; align-content: center; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); overflow-y: auto; }
.call__notice { margin: 0 auto; padding: 8px 14px; border-radius: var(--r); background: rgba(227, 179, 65, .14); color: #f1c47a; font-size: 13px; text-align: center; max-width: 560px; }
.call__join { margin: auto; display: grid; justify-items: center; gap: 14px; text-align: center; padding: 24px; }
.call__join h2 { font-size: 22px; }
.call__join .avs { display: flex; justify-content: center; flex-wrap: wrap; max-width: 380px; padding-left: 12px; }
.call__join .avs .av { width: 56px; height: 56px; font-size: 22px; margin-left: -12px; box-shadow: 0 0 0 4px #08090c; }

/* members */
.members { display: flex; flex-direction: column; min-height: 0; background: var(--bg-2); }
.members__head { height: 52px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--panel-3); }
.members__head b { font-weight: 700; }
.members__head small { flex: 1; color: var(--ink-4); font-size: 12px; }
.shell.has-members .members__head { display: none; }
.members__list { flex: 1; overflow-y: auto; padding: 8px 8px 16px; overscroll-behavior: contain; }
.mem-group { display: flex; align-items: center; gap: 6px; padding: 16px 8px 6px; color: var(--ink-4); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.mem-group i { width: 8px; height: 8px; flex: none; border-radius: 50%; }
.mem { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0; border-radius: var(--r-sm); background: none; color: inherit; text-align: left; cursor: pointer; }
.mem:hover { background: var(--panel-2); }
.mem.is-offline { opacity: .45; }
.mem__who { flex: 1; min-width: 0; line-height: 1.35; }
.mem__name { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 13.5px; }
.mem__name b { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem__name .crown { width: 14px; height: 14px; color: var(--warn); }
.mem__sub { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem__sub.is-voice { color: var(--ok); }
.mem-more { padding: 8px; }
.pf { display: inline-grid; place-items: center; flex: none; color: var(--ink-4); }
.pf svg { width: 14px; height: 14px; stroke-width: 1.9; }
.pf[data-platform="lite"] { color: var(--accent-2); }

/* dialogs, toast */
.dialog { border: 0; border-radius: var(--r-xl); padding: 24px; width: min(420px, calc(100% - 32px)); background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(0, 0, 0, .6); }
.dialog[open] { animation: pop .2s cubic-bezier(.3, 1.3, .5, 1); }
.dialog h3 { font-size: 17px; }
.dialog input, .dialog select {
  width: 100%; height: 42px; padding: 0 12px; border-radius: var(--r); border: 1.5px solid var(--panel-3);
  background: var(--bg); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
.dialog input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.dialog label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.dialog .form__error { margin: 0; }
.dialog__actions { display: flex; gap: 8px; justify-content: flex-end; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); z-index: 300;
  display: flex; gap: 8px; align-items: center; padding: 10px 16px; border-radius: var(--r-md);
  background: #06070a; color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); font-size: 13px; animation: pop .2s;
}
.toast.is-error { background: #3a1513; }
.toast svg { width: 18px; height: 18px; color: var(--ok); }
.toast.is-error svg { color: var(--bad); }
.mpanel__page { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .85); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--r); }
[data-clean-reload].is-busy svg { animation: spin .8s linear infinite; }

.mpanel, .minibar, .tabbar { display: none; }

/* "You" page (mobile tab) */
.you { flex: 1; overflow: auto; padding-bottom: 16px; }
.you__banner { height: 120px; background: linear-gradient(120deg, #1d2a52, #2b1f55 60%, #5b3b8a); }
.you__banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.you__card { position: relative; margin: -44px 14px 0; }
.you__card .av-wrap { --ring: var(--bg-2); }
.you__card .av { width: 88px; height: 88px; font-size: 34px; box-shadow: 0 0 0 6px var(--bg-2); }
.you__card .av-wrap .pres { width: 26px; height: 26px; border-width: 5px; }
.you__card h2 { margin: 8px 0 0; font-size: 22px; overflow-wrap: anywhere; }
.you__handle { color: var(--ink-3); font-size: 13.5px; }
.statusbtn { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 10px; padding: 12px; border: 0; border-radius: var(--r-md); background: var(--panel); font-weight: 600; text-align: left; cursor: pointer; }
.statusbtn svg { margin-left: auto; width: 18px; height: 18px; color: var(--ink-4); }
.group { margin: 14px; background: var(--panel); border-radius: 16px; padding: 2px 12px; }
.srow { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 4px; border: 0; border-bottom: 1px solid var(--panel-3); background: none; font-size: 15px; text-align: left; cursor: pointer; color: var(--ink); }
.srow:last-child { border-bottom: 0; }
.srow__ic { width: 34px; height: 34px; flex: none; border-radius: var(--r); display: grid; place-items: center; background: var(--panel-3); color: var(--ink-2); }
.srow__ic svg { width: 19px; height: 19px; }
.srow > span:not(.srow__ic) { flex: 1; min-width: 0; }
.srow small { display: block; font-size: 12.5px; color: var(--ink-3); }
.srow > svg { color: var(--ink-4); width: 18px; height: 18px; }
.srow.is-danger, .srow.is-danger .srow__ic { color: var(--bad); }

/* ============ mobile ============ */
@media (max-width: 1099px) {
  .members {
    position: fixed; top: 0; bottom: 0; right: 0; z-index: 40; width: min(320px, 88vw);
    padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); box-shadow: var(--shadow);
    animation: members-in .24s cubic-bezier(.2, .8, .2, 1);
  }
  .shell.is-members-sheet .scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .5); animation: fade .2s ease; }
}
@keyframes members-in { from { transform: translateX(100%); } }

@media (max-width: 820px) {
  body { font-size: 15px; }
  .auth { padding: 0; place-items: stretch; background: radial-gradient(400px 300px at 0% 0%, rgba(91, 141, 239, .28), transparent 70%), radial-gradient(400px 300px at 100% 30%, rgba(139, 124, 246, .22), transparent 70%), var(--bg-2); }
  .login { display: flex; min-height: 100dvh; width: 100%; border-radius: 0; background: none; box-shadow: none; }
  .login__art { display: none; }
  .login__form { flex: 1; padding: calc(12px + env(safe-area-inset-top)) 22px calc(24px + env(safe-area-inset-bottom)); }
  .login__top { position: static; justify-content: space-between; margin: 0 0 18px; }
  .login__mlogo { display: grid; width: 56px; height: 56px; border-radius: 16px; }
  .login__mlogo svg { width: 30px; height: 30px; }
  .login__form h2 { font-size: 30px; letter-spacing: -.6px; line-height: 1.1; }
  .inp { height: 50px; border-radius: var(--r-lg); background: var(--panel); }
  .btn--tall, .login__form .btn--block { height: 50px; border-radius: var(--r-lg); font-size: 15px; }
  .login__foot { display: none; }
  .install-row { margin-top: auto; }
  .login__form .or + .btn { margin-bottom: 14px; }
  .inp input, .composer textarea, .dialog input { font-size: 16px; }

  .shell, .shell.has-members {
    grid-template-columns: 68px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto;
    --top: env(safe-area-inset-top);
  }
  .rail { grid-column: 1; grid-row: 1; padding: calc(8px + var(--top)) 0 8px; gap: 10px; }
  .srv { width: 46px; height: 46px; }
  .srv::before { left: -11px; }
  .side { grid-column: 2; grid-row: 1; background: var(--panel); border-radius: 20px 0 0 0; margin-top: var(--top); }
  .side .callbar, .side .me { display: none; }
  .ch { min-height: 42px; font-size: 15px; }
  .vuser { min-height: 34px; font-size: 14px; }
  .main, .mpanel { grid-column: 1 / -1; grid-row: 1; }
  .minibar { grid-column: 1 / -1; grid-row: 2; }
  .tabbar { grid-column: 1 / -1; grid-row: 3; }
  .shell:not([data-mtab="servers"]) .rail, .shell:not([data-mtab="servers"]) .side { display: none; }
  .shell[data-mscreen=""] .main, .shell:not([data-mscreen]) .main { display: none; }
  .shell[data-mtab="messages"] .mpanel, .shell[data-mtab="you"] .mpanel { display: flex; }
  .mpanel { flex-direction: column; min-height: 0; background: var(--bg-2); padding-top: var(--top); }
  .shell[data-mscreen="main"] :is(.rail, .side, .mpanel, .tabbar) { display: none !important; }
  .shell[data-mscreen="main"] .main { display: flex; grid-row: 1 / -1; }
  .shell[data-mscreen="main"][data-mode="server"] .main__head { display: flex; }

  .main__head { height: calc(52px + var(--top)); padding: var(--top) 10px 0 6px; gap: 6px; }
  .main__back { display: inline-grid; width: 40px; height: 40px; border-radius: 50%; }
  .main__head .icon-btn { width: 40px; height: 40px; border-radius: 50%; }
  .main__title > b { font-size: 16px; }
  .main__title .topic, .main__title .auto-delete { display: none; }
  .msg { padding: 3px 12px; column-gap: 10px; grid-template-columns: 36px minmax(0, 1fr); }
  .msg .av--lg { width: 36px; height: 36px; }
  .msg__reply::before { display: none; }
  .composer { padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); }
  .composer__box { border-radius: 22px; padding: 4px 4px 4px 14px; align-items: center; }
  .composer__send.icon-btn { width: 40px; height: 40px; border-radius: 50%; }

  .minibar:not([hidden]) {
    display: flex; align-items: center; gap: 10px; margin: 0 10px 8px; padding: 8px 8px 8px 12px; border-radius: var(--r-lg);
    background: var(--panel-3); box-shadow: 0 6px 20px rgba(0, 0, 0, .35); cursor: pointer; animation: fade .2s ease;
  }
  .main .minibar:not([hidden]) { margin-top: 4px; }
  .minibar__icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--ok); background: color-mix(in srgb, var(--ok) 15%, transparent); }
  .minibar__text { flex: 1; min-width: 0; line-height: 1.4; }
  .minibar__text b { display: block; font-size: 13px; color: var(--ok); }
  .minibar__text b.is-warn { color: var(--warn); }
  .minibar__text span { display: block; font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .minibar__btn { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--line-2); color: var(--ink); cursor: pointer; }
  .minibar__btn.is-off { color: var(--bad); }
  .minibar__btn--leave { background: var(--bad); color: #fff; }

  .tabbar { display: flex; flex: none; padding: 6px max(10px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); background: var(--bg-2); border-top: 1px solid var(--panel-3); }
  .tabbar button { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0 0; border: 0; background: none; color: var(--ink-4); font-size: 11px; font-weight: 600; cursor: pointer; }
  .tabbar__pill { width: 56px; height: 30px; border-radius: 15px; display: grid; place-items: center; transition: background .2s, color .2s; }
  .tabbar button[aria-current="page"] { color: var(--ink); }
  .tabbar button[aria-current="page"] .tabbar__pill { background: var(--accent-soft); color: var(--accent); }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar .av { width: 24px; height: 24px; font-size: 10px; }
  .tabbar .badge { position: absolute; top: 0; left: calc(50% + 6px); }
  .tabbar button.is-live .tabbar__pill::after { content: ""; position: absolute; top: 4px; left: calc(50% + 10px); width: 9px; height: 9px; border-radius: 50%; background: var(--ok); border: 2px solid var(--bg-2); }

  .mtop { height: 52px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 16px; }
  .mtop h1 { flex: 1; font-size: 24px; font-weight: 800; letter-spacing: -.4px; }
  .members__head { height: 56px; }
  .disc__pane { bottom: 0; }
}

@media (pointer: coarse) {
  .me .icon-btn { width: 40px; height: 44px; }
  .mem { min-height: 48px; }
  .dialog__actions .btn { min-height: 44px; }
}
@media (hover: none) {
  .msg:hover, .ch:hover:not(.is-on), .mem:hover, .me__open:hover, .vuser:hover { background: none; }
  .msg__time-inline { opacity: .6; }
}
@media (prefers-reduced-motion: reduce) {
  .login__art::before, .fcard, .wave i, .pill--live::before, .dots i { animation: none !important; }
}

.side__invite { margin-left: auto; width: 32px; height: 32px; }
.side__invite svg { width: 18px; height: 18px; }

.invd-dialog { width: min(520px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
.invd { gap: 12px; }
.invd__field { display: grid; gap: 7px; font-size: 13px; }
.invd__t { font-weight: 500; color: var(--ink-2); }
.invd__seg { display: flex; flex-wrap: wrap; gap: 6px; }
.invd__seg button { border: 1px solid transparent; background: var(--panel-3); color: var(--ink); padding: 4px 12px; border-radius: 9px; cursor: pointer; font-size: 13px; }
.invd__seg button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.invd__custom { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dialog .invd__num { width: 96px; }
.invd__or { display: flex !important; align-items: center; gap: 8px; flex-wrap: wrap; }
.dialog .invd__date { width: auto; }
.invd__radios { display: grid; gap: 6px; }
.invd__radio { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 11px; background: transparent; cursor: pointer; }
.invd__radio i { width: 16px; height: 16px; flex: none; margin-top: 2px; border-radius: 50%; border: 2px solid var(--ink-4); }
.invd__radio[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.invd__radio[aria-checked="true"] i { border: 5px solid var(--accent); }
.invd__radio b { display: block; font-size: 13.5px; }
.invd__radio small { display: block; color: var(--ink-3); font-size: 12px; }
.invd__radios.is-off .invd__radio { opacity: .5; cursor: default; }
.invd__select { width: 100%; height: 42px; padding: 0 12px; border-radius: var(--r); border: 1.5px solid var(--panel-3); background: var(--bg); color: var(--ink); font: inherit; }
.invd__result { display: flex; gap: 8px; align-items: center; padding: 6px 6px 6px 12px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--bg); }
.invd__result code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; font-family: Consolas, ui-monospace, monospace; }
.invd__sum { margin-top: -4px; }

.joind { display: grid; gap: 8px; justify-items: center; text-align: center; }
.joind__icon { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; overflow: hidden; font-size: 28px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.joind__icon img { width: 100%; height: 100%; object-fit: cover; }
.joind__stats { display: flex; gap: 6px; align-items: center; }
.joind__stats i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-4); margin-left: 6px; }
.joind__stats i.is-on { background: var(--ok); }
.joind__member { display: flex; gap: 6px; align-items: center; color: var(--ok); font-weight: 700; font-size: 13px; }
.joind .dialog__actions { width: 100%; justify-content: center; }

.scd-dialog { width: min(500px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
.scd { gap: 10px; }
.scd__title, .scd__lead { text-align: center; }
.scd__grp { margin-top: 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-4); }
.scd__list { display: grid; gap: 8px; }
.scd__opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--panel-2); color: var(--ink); text-align: left; cursor: pointer; font: inherit; transition: border-color .15s, background .15s; }
.scd__opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.scd__opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.scd__opt > svg { width: 18px; height: 18px; flex: none; color: var(--ink-4); }
.scd__ic { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 11px; font-size: 19px; background: color-mix(in srgb, var(--tpl, var(--accent)) 22%, transparent); }
.scd__ic--own { color: var(--accent); background: var(--accent-soft); }
.scd__ic svg { width: 18px; height: 18px; }
.scd__txt { display: grid; gap: 1px; min-width: 0; flex: 1; }
.scd__txt b { font-size: 14px; font-weight: 600; }
.scd__txt small { font-size: 12px; color: var(--ink-3); line-height: 1.4; }
.scd__counts { color: var(--ink-4) !important; font-variant-numeric: tabular-nums; }
.scd__state { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; border: 1px dashed var(--line-2); border-radius: var(--r-md); }
.scd__state--error { justify-content: space-between; color: var(--bad); }
.scd__togs { display: grid; }
.scd__tog { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.scd__tog.is-locked { color: var(--ink-3); }
.scd__tog .vsw:disabled { opacity: .55; cursor: default; }
.scd__sum { padding: 8px 12px; border-radius: var(--r); background: var(--panel-2); color: var(--ink-2); text-align: center; font-variant-numeric: tabular-nums; }
.scd .dialog__actions { flex-wrap: wrap; margin-top: 4px; }
.scd .dialog__actions .btn:first-child { margin-right: auto; }
