/* ============================================================
   ASTRO — app.css
   ============================================================ */

:root, [data-theme="ultra"] {
  --bg: #000000;
  --bg-soft: #050506;
  --panel: #0b0b0e;
  --panel-2: #111114;
  --panel-3: #17171b;
  --panel-4: #202026;
  --rail: #000000;
  --rail-2: #050506;
  --sidebar: #050506;
  --main: #000000;
  --header-bg: rgba(0, 0, 0, 0.86);
  --composer-bg: #050506;
  --input-bg: rgba(255, 255, 255, 0.06);
  --hover: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f2f3f5;
  --muted: #a3a6ad;
  --dim: #72757e;
  --accent: #5865f2;
  --accent-2: #7983f5;
  --accent-ink: #ffffff;
  --accent-soft: rgba(88, 101, 242, 0.16);
  --accent-line: rgba(88, 101, 242, 0.45);
  --danger: #ff5f6d;
  --danger-soft: rgba(255, 95, 109, 0.12);
  --ok: #57e39b;
  --ok-soft: rgba(87, 227, 155, 0.12);
  --bubble: #0e0e12;
  --bubble-line: var(--hover);
  --bubble-mine: #4752c4;
  --bubble-mine-ink: #ffffff;
  --modal: #0b0b0e;
  --modal-2: #050506;
  --toast: #111114;
  --star: rgba(255, 255, 255, 0.6);
  --glow: rgba(255, 255, 255, 0.14);
  --icon-1: #1b1b21;
  --icon-2: #0c0c0f;
  --call-bg: #000000;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.78);
  --font: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Inter", "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "SF Mono", Consolas, monospace;
  color-scheme: dark;
}

[data-theme="dark"] {
  --bg: #313338;
  --bg-soft: var(--panel-2);
  --panel: #313338;
  --panel-2: #2b2d31;
  --panel-3: #383a40;
  --panel-4: #404249;
  --rail: #1e1f22;
  --rail-2: #1e1f22;
  --sidebar: #2b2d31;
  --main: #313338;
  --header-bg: rgba(49, 51, 56, 0.95);
  --composer-bg: #313338;
  --input-bg: #383a40;
  --hover: rgba(255, 255, 255, 0.055);
  --line: #3f4147;
  --line-2: #4e5058;
  --text: #dbdee1;
  --muted: #949ba4;
  --dim: #6d6f78;
  --accent: #5865f2;
  --accent-2: #7983f5;
  --accent-ink: #ffffff;
  --accent-soft: rgba(88, 101, 242, 0.16);
  --accent-line: rgba(88, 101, 242, 0.45);
  --danger: #f23f43;
  --danger-soft: rgba(242, 63, 67, 0.14);
  --ok: #23a55a;
  --ok-soft: rgba(35, 165, 90, 0.14);
  --bubble: var(--panel-2);
  --bubble-line: #3f4147;
  --bubble-mine: #4752c4;
  --bubble-mine-ink: #ffffff;
  --modal: #313338;
  --modal-2: var(--panel-2);
  --toast: #1e1f22;
  --star: rgba(255, 255, 255, 0.5);
  --glow: var(--line-2);
  --icon-1: #313338;
  --icon-2: #1e1f22;
  --call-bg: #1e1f22;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-soft: #f2f3f5;
  --panel: #ffffff;
  --panel-2: #f2f3f5;
  --panel-3: #e3e5e8;
  --panel-4: #d7d9dd;
  --rail: #e3e5e8;
  --rail-2: #e3e5e8;
  --sidebar: #f2f3f5;
  --main: #ffffff;
  --header-bg: rgba(255, 255, 255, 0.92);
  --composer-bg: #ffffff;
  --input-bg: #f2f3f5;
  --hover: rgba(6, 6, 7, 0.045);
  --line: #e3e5e8;
  --line-2: #d4d7dc;
  --text: #060607;
  --muted: #5c5e66;
  --dim: #80848e;
  --accent: #5865f2;
  --accent-2: #4752c4;
  --accent-ink: #ffffff;
  --accent-soft: rgba(88, 101, 242, 0.1);
  --accent-line: rgba(88, 101, 242, 0.35);
  --danger: #d92d3e;
  --danger-soft: rgba(217, 45, 62, 0.1);
  --ok: #0d9a63;
  --ok-soft: rgba(13, 154, 99, 0.1);
  --bubble: #f2f3f5;
  --bubble-line: #e3e5e8;
  --bubble-mine: #5865f2;
  --bubble-mine-ink: #ffffff;
  --modal: #ffffff;
  --modal-2: #f2f3f5;
  --toast: #ffffff;
  --star: rgba(6, 6, 7, 0.35);
  --glow: rgba(6, 6, 7, 0.1);
  --icon-1: #f2f3f5;
  --icon-2: #e3e5e8;
  --call-bg: #f2f3f5;
  --shadow: 0 24px 70px rgba(20, 20, 30, 0.16);
  color-scheme: light;
}

* { box-sizing: border-box; }
*::selection { background: var(--accent-soft); color: var(--text); }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body { overflow: hidden; }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
svg { display: block; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); background-clip: content-box; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  0% { opacity: 0; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent); }
  50% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--accent) 0%, transparent); }
}

/* ============================ brand ============================ */
.brand-mark { width: 54px; height: 54px; object-fit: contain; filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.45)); }


/* ============================ buttons ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 11px 18px;
  font-weight: 650;
  font-size: 14px;
  letter-spacing: -0.01em;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, filter 0.15s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent) 55%, var(--accent));
  color: var(--accent-ink);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 22%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 14px 40px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn-primary b { font-size: 17px; transition: transform 0.2s ease; }
.btn-primary:hover b { transform: translateX(3px); }
.btn-ghost { background: var(--panel-3); border-color: var(--line-2); color: var(--text); }
.btn-ghost:hover { background: var(--panel-4); }
.btn-outline { border-color: var(--accent-line); color: var(--accent-2); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.btn-outline:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 20%, transparent); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 12.5px; border-radius: 10px; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn.loading span { opacity: 0.65; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 17px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.accent { background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 20px; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 25%, transparent); }
.icon-btn.accent:hover { background: var(--accent-2); color: var(--accent-ink); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover { background: var(--danger-soft); }
.link { color: var(--accent-2); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }

/* ============================ avatars ============================ */
.avatar {
  --ac: var(--accent);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 21px;
  line-height: 1;
  background:
    radial-gradient(120% 120% at 25% 10%, color-mix(in srgb, var(--ac) 32%, transparent), transparent 65%),
    linear-gradient(150deg, var(--icon-1), var(--icon-2) 70%);
  border: 1px solid color-mix(in srgb, var(--ac) 30%, var(--line));
  box-shadow: inset 0 1px 0 var(--hover);
  overflow: hidden;
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 30px; height: 30px; font-size: 15px; border-radius: 9px; }
.avatar.md { width: 44px; height: 44px; font-size: 22px; }
.avatar.lg { width: 64px; height: 64px; font-size: 32px; border-radius: 18px; }
.avatar.xl { width: 92px; height: 92px; font-size: 46px; border-radius: 26px; }
.avatar .presence {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--dim);
  border: 2px solid var(--panel);
}
.avatar.online .presence { background: var(--ok); box-shadow: 0 0 8px rgba(87, 227, 155, 0.7); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge.gold { background: var(--accent-soft); color: var(--accent-2); border: 1px solid var(--accent-line); }
.badge.green { background: var(--ok-soft); color: var(--ok); border: 1px solid rgba(87, 227, 155, 0.25); }

/* ============================ intro ============================ */
.intro {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  background: #000000;
  color: #ffffff;
  overflow: hidden;
  transition: opacity 0.7s ease, visibility 0.7s;
}
.intro.done { opacity: 0; visibility: hidden; pointer-events: none; }
.intro-stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: .9;
}
.intro-grid {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,.55), transparent),
    radial-gradient(1px 1px at 70% 65%, rgba(255,255,255,.4), transparent),
    radial-gradient(1.5px 1.5px at 45% 20%, rgba(255,255,255,.65), transparent),
    radial-gradient(1px 1px at 85% 35%, rgba(255,255,255,.35), transparent),
    radial-gradient(1.5px 1.5px at 30% 80%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 60% 45%, rgba(255,255,255,.3), transparent);
  background-size: 260px 260px, 380px 380px, 520px 520px, 320px 320px, 460px 460px, 280px 280px;
  opacity: 0;
  animation: introStars 2.4s ease .2s both;
}
@keyframes introStars { from { opacity: 0; transform: scale(1.08); } to { opacity: .7; transform: none; } }
.intro-glow {
  position: absolute;
  width: 640px;
  height: 640px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(88,101,242,.22), rgba(88,101,242,.06) 42%, transparent 70%);
  filter: blur(18px);
  animation: introGlow 2.8s ease-out both;
}
@keyframes introGlow { from { opacity: 0; transform: scale(.55); } 45% { opacity: 1; } to { opacity: .75; transform: scale(1); } }
.intro-rings { position: absolute; width: 580px; height: 580px; display: grid; place-items: center; opacity: .55; }
.intro-rings i {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 50%;
  inset: 0;
  animation: ringSpin 18s linear infinite;
}
.intro-rings i:nth-child(1) { inset: 0; border-style: dashed; border-color: rgba(88,101,242,.28); }
.intro-rings i:nth-child(2) { inset: 64px; border-color: rgba(255,255,255,.08); animation-duration: 24s; animation-direction: reverse; }
.intro-rings i:nth-child(3) { inset: 128px; border-color: rgba(88,101,242,.16); animation-duration: 13s; }
@keyframes ringSpin { to { transform: rotate(360deg); } }

.intro-stage { position: relative; display: flex; flex-direction: column; align-items: center; z-index: 2; }
.intro-mark { width: min(44vw, 310px); filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.7)); }
.intro-logo {
  width: 100%;
  height: auto;
  display: block;
  animation: introLogo 1.15s cubic-bezier(.2,.9,.25,1.1) .15s both, introFloat 7s ease-in-out 1.4s infinite;
}
@keyframes introLogo {
  0% { opacity: 0; transform: scale(.8) translateY(18px); filter: blur(12px) brightness(.5); }
  65% { opacity: 1; filter: blur(0) brightness(1.1); }
  100% { opacity: 1; transform: none; filter: drop-shadow(0 0 24px rgba(255,255,255,.12)); }
}
@keyframes introFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.intro-word {
  display: flex;
  gap: clamp(4px, 1.2vw, 12px);
  margin-top: 16px;
  font-size: clamp(44px, 8vw, 88px);
  font-weight: 800;
  letter-spacing: .18em;
  line-height: 1;
  padding-left: .18em;
}
.intro-word span {
  display: block;
  opacity: 0;
  transform: translateY(26px) rotateX(-70deg);
  color: #f6f7f9;
  text-shadow: 0 0 40px rgba(88,101,242,.28), 0 18px 30px rgba(0,0,0,.6);
  animation: wordIn .6s cubic-bezier(.2,.9,.25,1.15) both;
}
.intro-word span:nth-child(1) { animation-delay: 1.55s; }
.intro-word span:nth-child(2) { animation-delay: 1.65s; }
.intro-word span:nth-child(3) { animation-delay: 1.75s; }
.intro-word span:nth-child(4) { animation-delay: 1.85s; }
.intro-word span:nth-child(5) { animation-delay: 1.95s; color: var(--accent-2); }
@keyframes wordIn { to { opacity: 1; transform: none; } }
.intro-tag {
  margin-top: 14px;
  color: #a3a6ad;
  font-size: clamp(11px, 1.3vw, 14px);
  letter-spacing: .26em;
  text-transform: uppercase;
  opacity: 0;
  animation: fadeUp .7s ease 2.2s both;
}
.intro-bar {
  width: 210px;
  height: 2px;
  margin-top: 30px;
  background: rgba(255,255,255,.08);
  border-radius: 99px;
  overflow: hidden;
}
.intro-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2)); animation: barFill 2.6s ease-in-out .6s both; }
@keyframes barFill { to { width: 100%; } }
.intro-skip {
  position: absolute;
  right: 26px;
  bottom: 26px;
  color: #6d6f78;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
}
.intro-skip:hover { color: #fff; background: rgba(255,255,255,.06); }
.intro-sound {
  position: absolute;
  top: calc(20px + env(safe-area-inset-top, 0px));
  right: 22px;
  z-index: 3;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: #b5bac1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.13);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.intro-sound:hover { color: #fff; background: rgba(255, 255, 255, 0.13); border-color: rgba(255, 255, 255, 0.24); }
.intro-sound.off { opacity: 0.55; }
.intro-sound.off:hover { opacity: 0.9; }
.intro-copyright { position: absolute; left: 26px; bottom: 26px; color: #484b53; font-size: 11px; letter-spacing: .2em; }

/* ============================ auth ============================ */
.auth {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow-y: auto;
  color: var(--text);
  background:
    radial-gradient(900px 600px at 50% 0%, var(--glow), transparent 65%),
    var(--bg);
}
.auth.done { opacity: 0; }
.auth-stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  animation: fadeIn 1.4s ease both;
}
.auth-grid { display: none; }
.auth-orbs i { position: fixed; border-radius: 50%; filter: blur(100px); opacity: .28; pointer-events: none; }
.auth-orbs i:nth-child(1) { width: 500px; height: 500px; background: var(--accent); top: -220px; left: -140px; }
.auth-orbs i:nth-child(2) { width: 420px; height: 420px; background: #7c4dff; bottom: -220px; right: -120px; opacity: .16; }
.auth-orbs i:nth-child(3) { width: 220px; height: 220px; background: #4f8cff; top: 48%; left: 52%; opacity: .1; }

.auth-theme-toggle {
  position: fixed;
  top: calc(18px + env(safe-area-inset-top, 0px));
  right: 22px;
  z-index: 5;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  color: var(--muted);
  font-size: 18px;
  display: grid;
  place-items: center;
  backdrop-filter: blur(12px);
  transition: .15s;
}
.auth-theme-toggle:hover { color: var(--text); border-color: var(--accent-line); transform: rotate(18deg); }

.auth-shell {
  position: relative;
  z-index: 2;
  width: min(500px, calc(100% - 32px));
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 26px;
  padding: clamp(30px, 8vh, 86px) 0 48px;
}
.auth-hero {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.auth-brand .brand-mark { display: none; }
.auth-brand p {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .24em;
  text-transform: uppercase;
  margin-top: 4px;
}
.auth-art {
  position: relative;
  width: clamp(150px, 22vw, 210px);
  height: clamp(150px, 22vw, 210px);
  display: grid;
  place-items: center;
}
.auth-art-glow {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 65%);
  filter: blur(20px);
}
.auth-art-mark {
  position: relative;
  z-index: 2;
  width: 92%;
  height: 92%;
  object-fit: contain;
  filter: drop-shadow(0 18px 34px rgba(0,0,0,.45));
  animation: floaty 7s ease-in-out infinite;
}
html[data-theme="light"] .auth-art-mark {
  filter: invert(1) drop-shadow(0 18px 34px rgba(20, 20, 30, 0.18));
}
.auth-orbit {
  position: absolute;
  inset: 4%;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  transform: scaleY(.36) rotate(-24deg);
  opacity: .7;
}
.auth-orbit.orbit-2 { inset: 16%; border-color: var(--accent-line); transform: scaleY(.3) rotate(26deg); opacity: .45; }

.auth-card {
  position: relative;
  width: 100%;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line-2);
  border-radius: 24px;
  padding: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  animation: cardIn .7s cubic-bezier(.2,.9,.25,1) .15s both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(20px) scale(.99); } to { opacity: 1; transform: none; } }
.auth-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 55%, transparent), transparent 32%, transparent 72%, var(--line-2));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--panel-2);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 24px;
}
.auth-tabs button {
  padding: 10px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  transition: .18s;
}
.auth-tabs button.active { background: var(--panel-3); color: var(--text); box-shadow: 0 4px 14px rgba(0,0,0,.16); }
.auth-tabs button:hover { color: var(--text); }

.auth-form { display: flex; flex-direction: column; gap: 14px; animation: fadeIn .3s ease; }
.form-head { margin-bottom: 4px; }
.form-head h2 { font-size: 25px; letter-spacing: -.035em; font-weight: 750; }
.form-head p { margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--line-2);
  border-radius: 11px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input-wrap:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-wrap input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
  height: 45px;
}
.input-wrap input::placeholder { color: var(--dim); }
.input-wrap.has-prefix .prefix { padding-left: 14px; color: var(--dim); font-weight: 700; }
.input-wrap.has-prefix input { padding-left: 6px; }
.input-wrap.invalid { border-color: var(--danger); }
.input-wrap.valid { border-color: var(--ok); }
.input-status { padding-right: 14px; font-size: 15px; }
.eye-btn { padding: 0 14px; height: 100%; color: var(--dim); font-size: 15px; }
.eye-btn:hover { color: var(--text); }
.hint { font-size: 11px; color: var(--dim); line-height: 1.4; }
.hint.ok { color: var(--ok); }
.hint.bad { color: var(--danger); }

.strength { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.strength i { height: 3px; flex: 1; border-radius: 99px; background: var(--line); transition: background .25s; }
.strength small { font-size: 10.5px; color: var(--dim); margin-left: 6px; white-space: nowrap; }
.strength.weak i:nth-child(1) { background: var(--danger); }
.strength.fair i:nth-child(-n + 2) { background: var(--accent); }
.strength.good i { background: var(--ok); }

.form-error { min-height: 0; font-size: 12.5px; color: var(--danger); line-height: 1.45; }
.form-error:not(:empty) { padding: 9px 11px; background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent); border-radius: 9px; }
.legal { font-size: 11px; color: var(--dim); line-height: 1.55; text-align: center; margin-top: 2px; }
.pin-lock { font-size: 26px; margin-bottom: 8px; }

.auth-foot {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 0 16px 26px;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: .06em;
}
.auth-foot .dot { color: var(--line-2); }

/* ============================ app layout ============================ */

/* ============================ app layout ============================ */
.app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: 74px 334px minmax(0, 1fr);
  background: var(--bg);
  overflow: hidden;
  animation: fadeIn 0.4s ease both;
}
.app.has-details { grid-template-columns: 74px 334px minmax(0, 1fr) 310px; }

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 0 16px;
  background: linear-gradient(180deg, var(--rail), var(--rail));
  border-right: 1px solid var(--line);
  z-index: 5;
}
.rail-brand { width: 44px; height: 44px; margin-bottom: 10px; border-radius: 11px; overflow: hidden; }
.rail-brand img { width: 100%; height: 100%; object-fit: contain; display: block; }
html[data-theme="light"]:not([data-sidebar-dark="1"]) .rail-brand img { filter: invert(1); }
.rail-nav { display: flex; flex-direction: column; gap: 6px; width: 100%; align-items: center; }
.rail-spacer { flex: 1; }
.rail-btn {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 19px;
  color: var(--muted);
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.rail-btn:hover { background: var(--hover); color: var(--text); }
.rail-btn.active { background: var(--accent-soft); color: var(--accent-2); }
.rail-btn.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 60%, transparent);
}
.rail-btn span { filter: saturate(0.9); }
.rail-add { border: 1px dashed var(--line-2); color: var(--dim); }
.rail-add:hover { border-color: var(--accent-line); color: var(--accent-2); background: var(--accent-soft); }
.rail-badge {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid var(--rail);
}
.rail-avatar { width: 40px; height: 40px; border-radius: 13px; overflow: hidden; margin-top: 4px; border: 1px solid var(--line-2); background: var(--panel-2); }
.rail-avatar .avatar { width: 100%; height: 100%; border-radius: 0; border: 0; }

/* sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, var(--panel), var(--sidebar));
  border-right: 1px solid var(--line);
  position: relative;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 18px 12px; }
.side-title { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; }
.side-sub { font-size: 11px; color: var(--dim); margin-top: 3px; letter-spacing: 0.02em; }
.sidebar-search { display: flex; align-items: center; gap: 8px; margin: 0 14px 12px; padding: 0 12px; background: var(--input-bg); border: 1px solid var(--line); border-radius: 11px; }
.sidebar-search span { color: var(--dim); font-size: 17px; }
.sidebar-search input { flex: 1; min-width: 0; height: 38px; border: 0; outline: 0; background: none; font-size: 13px; }
.sidebar-search input::placeholder { color: var(--dim); }
.sidebar-search kbd { font-family: var(--mono); font-size: 9.5px; color: var(--dim); border: 1px solid var(--line); border-radius: 4px; padding: 2px 4px; }
.side-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0 8px 8px; }
.pane { display: flex; flex-direction: column; gap: 4px; }
.pane-section-title { display: flex; align-items: center; justify-content: space-between; padding: 16px 10px 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--dim); font-weight: 700; }
.pane-section-title b { color: var(--accent-2); font-size: 11px; }
.add-friend-cta { margin: 4px 0 10px; }

.conv-list { display: flex; flex-direction: column; gap: 2px; }
.conv-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 13px;
  border: 1px solid transparent;
  transition: background 0.14s, border-color 0.14s;
}
.conv-item:hover { background: var(--hover); }
.conv-item.active { background: linear-gradient(100deg, color-mix(in srgb, var(--accent) 10%, transparent), color-mix(in srgb, var(--accent) 3%, transparent)); border-color: color-mix(in srgb, var(--accent) 16%, transparent); }
.conv-item.active::after { content: ""; position: absolute; }
.conv-main { flex: 1; min-width: 0; }
.conv-line { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.conv-name { font-size: 13.5px; font-weight: 650; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.conv-time { font-size: 10px; color: var(--dim); flex: none; }
.conv-preview { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--dim); margin-top: 3px; white-space: nowrap; overflow: hidden; }
.conv-preview span { overflow: hidden; text-overflow: ellipsis; }
.conv-preview.mine::before { content: "você:"; color: var(--muted); flex: none; }
.conv-unread { flex: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: 10.5px; font-weight: 800; display: grid; place-items: center; }
.conv-call { color: var(--ok); font-size: 10px; }
.group-tag { font-size: 9px; color: var(--dim); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; letter-spacing: 0.06em; }

.friend-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; transition: background 0.15s; }
.friend-item:hover { background: var(--hover); }
.friend-main { flex: 1; min-width: 0; }
.friend-name { font-size: 13px; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friend-sub { font-size: 11px; color: var(--dim); margin-top: 2px; }
.friend-sub.online { color: var(--ok); }
.friend-actions { display: flex; gap: 2px; }
.friend-actions .icon-btn { width: 30px; height: 30px; font-size: 14px; }
.request-card { margin: 6px 4px 4px; padding: 12px; border: 1px solid var(--accent-line); background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 10%, transparent), color-mix(in srgb, var(--accent) 2%, transparent)); border-radius: 13px; }
.request-top { display: flex; align-items: center; gap: 10px; }
.request-text { flex: 1; min-width: 0; font-size: 12.5px; }
.request-text b { display: block; font-size: 13px; }
.request-text span { color: var(--muted); font-size: 11px; }
.request-actions { display: flex; gap: 6px; margin-top: 10px; }
.request-actions .btn { flex: 1; }
.section-label { padding: 16px 10px 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--dim); font-weight: 700; }

.group-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; }
.group-item:hover { background: var(--hover); }
.group-item .group-meta { flex: 1; min-width: 0; }
.group-item strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-item span { font-size: 11px; color: var(--dim); }

.me-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 8px;
  border-radius: 15px;
  background: linear-gradient(150deg, var(--hover), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line);
}
.me-info { flex: 1; min-width: 0; }
.me-info strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-info span { display: block; font-size: 11px; color: var(--dim); margin-top: 2px; }
.me-info .badge { margin-top: 5px; }

.empty-mini { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 30px 20px; gap: 8px; }
.empty-mini-art { font-size: 38px; filter: grayscale(0.25); }
.empty-mini h3 { font-size: 15px; }
.empty-mini p { font-size: 12px; color: var(--dim); line-height: 1.5; max-width: 220px; }

/* main */
.main { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: radial-gradient(900px 600px at 80% 0%, color-mix(in srgb, var(--accent) 5%, transparent), transparent 60%), var(--bg-soft); }
.empty-state {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 30px;
  max-width: 520px;
  animation: fadeUp 0.6s ease 0.1s both;
}
.empty-art { width: 150px; opacity: 0.92; filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5)); }
.empty-art img { width: 100%; height: auto; display: block; }
html[data-theme="light"] .empty-art { filter: drop-shadow(0 20px 40px rgba(20, 20, 30, 0.14)); }
html[data-theme="light"] .empty-art img { filter: invert(1); }
.empty-state h2 { margin-top: 14px; font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.04em; font-weight: 800; }
.empty-state h2 span { color: var(--accent); }
.empty-state p { color: var(--muted); font-size: 14px; margin-top: 8px; line-height: 1.55; }
.empty-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; justify-content: center; }
.empty-hints { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 26px; }
.empty-hints span { font-size: 11px; color: var(--dim); padding: 6px 10px; border: 1px solid var(--line); border-radius: 99px; background: rgba(255, 255, 255, 0.02); }

.conversation { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; animation: fadeIn 0.25s ease; }
.conv-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  min-height: 68px;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(18px);
  z-index: 4;
}
.back-btn { display: none; }
.conv-id { display: flex; align-items: center; gap: 11px; padding: 4px 6px; border-radius: 12px; text-align: left; flex: 1; min-width: 0; }
.conv-id:hover { background: var(--hover); }
.conv-title { min-width: 0; }
.conv-title h3 { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; }
.conv-title p { font-size: 11.5px; color: var(--dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-title p.online { color: var(--ok); }
.conv-actions { display: flex; gap: 2px; align-items: center; }
.call-btn { color: var(--muted); }
.call-btn:hover { color: var(--accent-2); background: var(--accent-soft); }

.messages-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px clamp(12px, 3vw, 36px) 10px;
  scroll-behavior: smooth;
}
.messages-inner { display: flex; flex-direction: column; gap: 2px; max-width: 1000px; margin: 0 auto; }

.date-divider { display: flex; align-items: center; gap: 14px; margin: 20px 6px 16px; color: var(--dim); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; }
.date-divider::before, .date-divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

.message { display: flex; gap: 9px; padding: 2px 2px 2px; position: relative; animation: msgIn 0.18s ease both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.message.grouped { margin-top: 0; }
.message.first { margin-top: 12px; }
.message .m-avatar { width: 32px; flex: none; padding-top: 2px; }
.message.grouped .m-avatar { visibility: hidden; }
.message .bubble-wrap { max-width: min(640px, 78%); display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.message.mine { flex-direction: row-reverse; }
.message.mine .bubble-wrap { align-items: flex-end; }
.message.mine .m-avatar { display: none; }
.m-head { display: flex; align-items: baseline; gap: 8px; margin: 0 4px 4px; }
.m-name { font-size: 11.5px; font-weight: 700; color: var(--accent-2); }
.m-time { font-size: 9.5px; color: var(--dim); }
.bubble {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px 15px 15px 15px;
  padding: 9px 13px;
  font-size: 13.8px;
  line-height: 1.48;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.message.first .bubble { border-radius: 4px 15px 15px 15px; }
.message.mine .bubble {
  background: var(--bubble-mine);
  border-color: color-mix(in srgb, var(--bubble-mine) 70%, var(--line-2));
  color: var(--bubble-mine-ink);
  border-radius: 15px 4px 15px 15px;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 11%, transparent);
}
.message.mine .bubble a { color: inherit; text-decoration: underline; }
.bubble.media { padding: 4px; background: var(--panel-2); overflow: hidden; }
.message.mine .bubble.media { background: var(--bubble-mine); border-color: var(--bubble-mine); }
.bubble.media .media-caption { padding: 8px 9px 5px; font-size: 13px; color: var(--text); }
.message.mine .bubble.media .media-caption { color: var(--bubble-mine-ink); }
.bubble.emoji-only { background: none; border: 0; padding: 0; font-size: 40px; line-height: 1.15; box-shadow: none; }
.message.mine .bubble.emoji-only { background: none; border: 0; }

.msg-media { display: block; max-width: 100%; border-radius: 11px; }
.msg-media.img { max-width: min(360px, 100%); max-height: 340px; object-fit: cover; cursor: zoom-in; }
.msg-media.video { width: min(420px, 100%); max-height: 340px; background: #000; }
.msg-media.audio { width: min(320px, 100%); height: 40px; margin: 3px; }
.file-card { display: flex; align-items: center; gap: 11px; padding: 9px 9px 9px 10px; min-width: 220px; }
.file-icon { width: 40px; height: 40px; border-radius: 11px; background: var(--hover); display: grid; place-items: center; font-size: 19px; flex: none; }
.file-meta { flex: 1; min-width: 0; }
.file-meta strong { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta span { font-size: 10.5px; color: var(--dim); }
.file-dl { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--line); color: var(--text); font-size: 14px; flex: none; }
.file-dl:hover { background: var(--line-2); }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  font-size: 11.5px;
  color: var(--muted);
  transition: 0.14s;
}
.reaction-pill b { font-size: 12.5px; font-weight: 600; color: var(--text); }
.reaction-pill.mine { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); }
.reaction-pill:hover { transform: translateY(-1px); border-color: var(--accent-line); }

.msg-tools {
  position: absolute;
  top: -12px;
  right: 12px;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  transition: 0.15s;
  z-index: 3;
}
.message.mine .msg-tools { right: auto; left: 12px; }
.message:hover .msg-tools { opacity: 1; pointer-events: auto; transform: none; }
.msg-tools button { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; font-size: 13px; color: var(--muted); }
.msg-tools button:hover { background: var(--line); color: var(--text); }

.system-msg { align-self: center; margin: 10px auto; text-align: center; font-size: 11.5px; color: var(--dim); background: var(--hover); border: 1px solid var(--line); padding: 5px 12px; border-radius: 99px; max-width: 80%; }

.typing { display: flex; align-items: center; gap: 8px; padding: 4px clamp(18px, 3vw, 40px) 8px; font-size: 11px; color: var(--dim); height: 26px; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); animation: typing 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.jump-latest {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-size: 11.5px;
  padding: 7px 12px;
  border-radius: 99px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  z-index: 4;
}
.loading-more { position: absolute; top: 8px; left: 0; right: 0; text-align: center; font-size: 10.5px; color: var(--dim); }

.composer-wrap { padding: 6px clamp(10px, 3vw, 30px) 10px; border-top: 1px solid var(--line); background: var(--composer-bg); backdrop-filter: blur(16px); }
.composer { display: flex; align-items: flex-end; gap: 4px; max-width: 1040px; margin: 0 auto; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 17px; padding: 6px 7px; transition: border-color 0.15s, box-shadow 0.15s; }
.composer:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 6%, transparent); }
.composer textarea {
  flex: 1;
  resize: none;
  border: 0;
  outline: 0;
  background: none;
  padding: 8px 5px;
  font-size: 14px;
  line-height: 1.45;
  max-height: 140px;
  min-height: 22px;
  color: var(--text);
}
.composer textarea::placeholder { color: var(--dim); }
.composer-btn { width: 34px; height: 34px; font-size: 16px; border-radius: 9px; margin-bottom: 1px; }
.send-btn {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--accent-ink);
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 22%, transparent);
  transition: 0.15s;
}
.send-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.send-btn:disabled { opacity: 0.35; pointer-events: none; }
.composer-hint { max-width: 1040px; margin: 5px auto 0; font-size: 9.5px; color: var(--dim); text-align: right; letter-spacing: 0.02em; }

.upload-bar { max-width: 1040px; margin: 0 auto 6px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--accent-line); border-radius: 12px; display: flex; flex-direction: column; gap: 5px; position: relative; }
.upload-info { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--muted); }
.upload-info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-info b { color: var(--accent-2); }
.upload-track { height: 3px; background: var(--line); border-radius: 99px; overflow: hidden; }
.upload-track i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.2s; }
.upload-bar .icon-btn { position: absolute; right: 4px; top: 4px; width: 26px; height: 26px; font-size: 11px; }

.drop-overlay { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(5, 6, 8, 0.78); backdrop-filter: blur(6px); border: 2px dashed var(--accent-line); border-radius: 8px; }
.drop-card { text-align: center; padding: 34px; }
.drop-icon { font-size: 42px; margin-bottom: 10px; }
.drop-card h3 { font-size: 20px; }
.drop-card p { color: var(--muted); font-size: 12.5px; margin-top: 6px; }

/* details */
.details {
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--main));
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: detailsIn 0.25s ease both;
}
@keyframes detailsIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.details-head { display: flex; align-items: center; justify-content: space-between; }
.details-head h3 { font-size: 14px; font-weight: 700; }
.details-profile { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 0 6px; text-align: center; }
.details-profile h4 { font-size: 17px; }
.details-profile p { font-size: 11.5px; color: var(--dim); }
.details-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.details-card h5 { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dim); margin-bottom: 8px; font-weight: 700; }
.detail-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 12.5px; }
.detail-row span { color: var(--dim); }
.detail-row b { color: var(--text); font-weight: 600; }
.detail-actions { display: flex; flex-direction: column; gap: 7px; }
.detail-actions .btn { justify-content: flex-start; }
.member-list { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; }
.member-item { display: flex; align-items: center; gap: 9px; padding: 6px 4px; border-radius: 9px; }
.member-item:hover { background: var(--hover); }
.member-item .m-name { flex: 1; min-width: 0; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-item .m-name span { display: block; font-size: 10px; color: var(--dim); }
.member-role { font-size: 9px; color: var(--accent-2); border: 1px solid var(--accent-line); padding: 1px 5px; border-radius: 4px; }
.invite-code { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.invite-code code { flex: 1; font-family: var(--mono); letter-spacing: 0.18em; font-size: 12px; padding: 8px; background: var(--input-bg); border: 1px dashed var(--line-2); border-radius: 8px; text-align: center; }

/* ============================ modals ============================ */
.modal-root { position: fixed; inset: 0; z-index: 400; pointer-events: none; }
.modal-root.open { pointer-events: auto; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 4, 6, 0.72); backdrop-filter: blur(8px); animation: fadeIn 0.2s ease; }
.modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100% - 28px));
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  background: linear-gradient(180deg, var(--modal), var(--modal-2));
  border: 1px solid var(--line-2);
  border-radius: 22px;
  box-shadow: var(--shadow);
  animation: modalIn 0.28s cubic-bezier(0.2, 0.9, 0.2, 1.05) both;
}
.modal.wide { width: min(860px, calc(100% - 28px)); }
@keyframes modalIn { from { opacity: 0; transform: translate(-50%, -47%) scale(0.97); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 12px; }
.modal-head .modal-title { flex: 1; }
.modal-head h3 { font-size: 18px; letter-spacing: -0.02em; }
.modal-head p { color: var(--dim); font-size: 12px; margin-top: 4px; line-height: 1.5; }
.modal-body { padding: 8px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 22px; }

.search-results { display: flex; flex-direction: column; gap: 3px; min-height: 48px; }
.search-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 11px; }
.search-user:hover { background: var(--hover); }
.search-user .su-main { flex: 1; min-width: 0; }
.search-user strong { display: block; font-size: 13px; }
.search-user span { display: block; font-size: 11px; color: var(--dim); }
.search-hint { text-align: center; color: var(--dim); font-size: 12px; padding: 18px; }

.friend-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.picker-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px 5px 5px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 12px; color: var(--muted); }
.picker-chip .avatar { width: 22px; height: 22px; border-radius: 6px; font-size: 11px; }
.picker-chip.selected { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-2); }
.picker-chip:hover { border-color: var(--line-2); }
.picker-list { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; padding: 4px; background: var(--input-bg); border: 1px solid var(--line); border-radius: 12px; }
.picker-row { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 8px; text-align: left; width: 100%; }
.picker-row:hover { background: var(--hover); }
.picker-row .pr-main { flex: 1; min-width: 0; font-size: 12.5px; }
.picker-row .pr-main span { display: block; font-size: 10.5px; color: var(--dim); }
.picker-check { width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--line-2); display: grid; place-items: center; font-size: 12px; color: transparent; }
.picker-row.selected .picker-check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 800; }

/* settings */
.settings-modal { display: grid; grid-template-columns: 190px 1fr; min-height: 470px; }
.settings-nav { border-right: 1px solid var(--line); padding: 20px 12px; background: var(--panel-2); display: flex; flex-direction: column; gap: 3px; }
.settings-nav h3 { font-size: 16px; padding: 0 10px 14px; letter-spacing: -0.02em; }
.settings-nav button { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px; font-size: 12.5px; color: var(--muted); text-align: left; }
.settings-nav button:hover { background: var(--hover); color: var(--text); }
.settings-nav button.active { background: var(--accent-soft); color: var(--accent-2); }
.settings-nav .nav-spacer { flex: 1; }
.settings-content { padding: 22px; max-height: calc(100vh - 120px); overflow-y: auto; }
.settings-pane { display: flex; flex-direction: column; gap: 16px; animation: fadeIn 0.2s ease; }
.settings-pane h4 { font-size: 16px; letter-spacing: -0.02em; }
.settings-pane > p { font-size: 12px; color: var(--dim); margin-top: -8px; line-height: 1.5; }

.profile-edit { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 15px; }
.profile-edit .pe-info { flex: 1; min-width: 150px; }
.profile-edit strong { display: block; font-size: 15px; }
.profile-edit span { font-size: 11.5px; color: var(--dim); }
.avatar-upload { position: relative; cursor: pointer; }
.avatar-upload .overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 18px; opacity: 0; transition: 0.15s; border-radius: inherit; }
.avatar-upload:hover .overlay { opacity: 1; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 7px; }
.avatar-option { aspect-ratio: 1; border-radius: 11px; border: 1px solid var(--line); background: var(--panel-2); display: grid; place-items: center; font-size: 21px; transition: 0.15s; }
.avatar-option:hover { border-color: var(--line-2); transform: translateY(-1px); }
.avatar-option.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 15%, transparent); }
.color-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; position: relative; }
.color-dot.selected { border-color: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18); }

.security-score { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, transparent), rgba(255, 255, 255, 0.02)); border: 1px solid var(--accent-line); }
.score-ring { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--score) * 33.3%), var(--line) 0); position: relative; flex: none; }
.score-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--icon-2); }
.score-ring b { position: relative; font-size: 17px; }
.security-score strong { display: block; font-size: 14px; }
.security-score span { font-size: 11px; color: var(--dim); }
.settings-block { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.settings-block-head { display: flex; align-items: center; gap: 10px; padding: 13px 14px; }
.settings-block-head .sb-main { flex: 1; }
.settings-block-head strong { display: block; font-size: 13px; }
.settings-block-head span { display: block; font-size: 11px; color: var(--dim); margin-top: 2px; line-height: 1.4; }
.settings-block-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.switch { width: 40px; height: 22px; border-radius: 99px; background: var(--line-2); position: relative; flex: none; transition: 0.2s; }
.switch::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: 0.2s; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 21px; background: var(--accent-ink); }
.session-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.session-row:last-child { border-bottom: 0; }
.session-row .s-main { flex: 1; min-width: 0; }
.session-row strong { display: block; font-size: 12px; }
.session-row span { display: block; font-size: 10.5px; color: var(--dim); margin-top: 2px; }
.event-row { display: flex; align-items: flex-start; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 11.5px; }
.event-row:last-child { border-bottom: 0; }
.event-row .ev-icon { font-size: 13px; }
.event-row .ev-main { flex: 1; }
.event-row strong { display: block; font-size: 11.5px; font-weight: 600; }
.event-row span { color: var(--dim); font-size: 10.5px; }
.form-row { display: flex; gap: 8px; }
.form-row .field { flex: 1; }
.empty-note { font-size: 11.5px; color: var(--dim); padding: 8px 0; line-height: 1.5; }
.empty-note.ok { color: var(--ok); }
.settings-advanced { border: 1px dashed var(--line-2); border-radius: 14px; padding: 0 12px; }
.settings-advanced > summary { cursor: pointer; list-style: none; padding: 12px 2px; font-size: 11.5px; color: var(--dim); display: flex; align-items: center; gap: 8px; }
.settings-advanced > summary::-webkit-details-marker { display: none; }
.settings-advanced > summary::before { content: "▸"; font-size: 10px; color: var(--accent-2); }
.settings-advanced[open] > summary::before { content: "▾"; }
.settings-advanced[open] { padding-bottom: 12px; }
.settings-advanced .settings-block { margin-top: 10px; }

/* call */
.call-stage {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: radial-gradient(1200px 800px at 50% 0%, #15181f, #050607 70%);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.25s ease;
}
.call-top { display: flex; align-items: center; gap: 12px; padding: 18px 24px; }
.call-top .call-title { flex: 1; }
.call-top h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.call-top p { font-size: 11px; color: var(--muted); margin-top: 3px; }
.call-top .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: pulse 2s infinite; }
.call-timer { font-family: var(--mono); font-size: 12px; color: var(--muted); background: var(--hover); border: 1px solid var(--line); padding: 5px 9px; border-radius: 7px; }
.call-grid { flex: 1; min-height: 0; display: grid; gap: 12px; padding: 8px 24px 12px; place-content: center; grid-auto-rows: minmax(0, 1fr); }
.call-grid.n1 { grid-template-columns: minmax(0, 1fr); }
.call-grid.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.call-grid.n3, .call-grid.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.call-grid.n5, .call-grid.n6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.call-grid.n7, .call-grid.n8, .call-grid.n9 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.call-tile {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(150deg, var(--panel-3), var(--panel));
  border: 1px solid var(--line-2);
  min-height: 160px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.call-tile.screen { border-color: var(--accent-line); }
.call-tile video { width: 100%; height: 100%; object-fit: cover; background: var(--bg); position: absolute; inset: 0; }
.call-tile.screen video { object-fit: contain; background: #000; }
.call-tile .tile-fallback { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.call-tile .tile-fallback .avatar { width: 76px; height: 76px; font-size: 38px; border-radius: 22px; }
.call-tile .tile-fallback span { font-size: 12px; color: var(--muted); }
.call-tile .tile-label { position: absolute; left: 12px; bottom: 10px; display: flex; align-items: center; gap: 6px; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(8px); padding: 4px 9px; border-radius: 7px; font-size: 11px; border: 1px solid var(--line); }
.call-tile .tile-state { display: inline-flex; gap: 4px; color: var(--muted); }
.call-tile .tile-state .off { color: var(--danger); }
.call-tile.speaking { border-color: rgba(87, 227, 155, 0.45); box-shadow: 0 0 0 2px rgba(87, 227, 155, 0.08); }

.call-controls { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 12px 20px 26px; flex-wrap: wrap; }
.call-ctrl {
  color: var(--text);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--line);
  border: 1px solid var(--line-2);
  font-size: 20px;
  transition: 0.15s;
  position: relative;
}
.call-ctrl:hover { background: var(--line-2); transform: translateY(-2px); }
.call-ctrl.off { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.call-ctrl.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); }
.call-ctrl.end { width: 64px; background: var(--danger); border-color: transparent; color: #fff; font-size: 23px; }
.call-ctrl.end:hover { background: var(--danger); }
.call-ctrl[disabled] { opacity: 0.35; pointer-events: none; }
.call-ctrl svg { width: 22px; height: 22px; display: block; }
.call-ctrl.end svg { width: 26px; height: 26px; }
.call-btn svg { width: 19px; height: 19px; display: block; }

.screen-preview-wrap {
  position: absolute;
  right: 24px;
  bottom: 112px;
  z-index: 6;
  width: min(300px, 28vw);
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line-2);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}
.screen-preview-wrap video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}
.screen-preview-head {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #fff;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.68), transparent);
}
.screen-preview-head .live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.call-ctrl .lbl { position: absolute; bottom: -19px; font-size: 9px; color: var(--dim); white-space: nowrap; }

.incoming-card {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 700;
  width: min(360px, calc(100% - 36px));
  border-radius: 20px;
  background: linear-gradient(160deg, var(--toast), var(--modal-2));
  border: 1px solid var(--accent-line);
  box-shadow: var(--shadow), 0 0 40px color-mix(in srgb, var(--accent) 8%, transparent);
  padding: 16px;
  animation: incomingIn 0.4s cubic-bezier(0.2, 0.9, 0.25, 1.1) both;
}
@keyframes incomingIn { from { opacity: 0; transform: translateX(24px) scale(0.97); } to { opacity: 1; transform: none; } }
.incoming-top { display: flex; align-items: center; gap: 12px; }
.incoming-top .avatar { animation: incomingPulse 1.6s ease-in-out infinite; }
@keyframes incomingPulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 28%, transparent); } 50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--accent) 0%, transparent); } }
.incoming-info { flex: 1; min-width: 0; }
.incoming-info strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.incoming-info span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.incoming-actions { display: flex; gap: 8px; margin-top: 14px; }
.incoming-actions .btn { flex: 1; }
.incoming-actions .accept { background: var(--ok); color: #062014; }
.incoming-actions .accept:hover { filter: brightness(1.06); }
.incoming-actions .decline { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }

/* emoji picker */
.emoji-pop {
  position: fixed;
  z-index: 500;
  width: 336px;
  max-width: calc(100vw - 20px);
  background: var(--modal);
  border: 1px solid var(--line-2);
  border-radius: 17px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: popIn 0.16s ease;
}
.emoji-pop-head { display: flex; padding: 7px; gap: 2px; border-bottom: 1px solid var(--line); }
.emoji-pop-head button { flex: 1; padding: 6px 0; border-radius: 7px; font-size: 15px; opacity: 0.55; }
.emoji-pop-head button:hover { background: var(--line); opacity: 1; }
.emoji-pop-head button.active { background: var(--accent-soft); opacity: 1; }
.emoji-search { padding: 7px 7px 0; }
.emoji-search input { width: 100%; height: 31px; border-radius: 8px; border: 1px solid var(--line); background: var(--input-bg); padding: 0 10px; font-size: 12px; outline: 0; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 1px; padding: 7px; max-height: 246px; overflow-y: auto; }
.emoji-grid button { aspect-ratio: 1; border-radius: 7px; font-size: 20px; display: grid; place-items: center; }
.emoji-grid button:hover { background: var(--line); transform: scale(1.08); }
.emoji-empty { grid-column: 1 / -1; text-align: center; color: var(--dim); font-size: 11.5px; padding: 20px; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 800; background: rgba(3, 4, 6, 0.92); backdrop-filter: blur(10px); display: grid; place-items: center; animation: fadeIn 0.2s ease; }
.lightbox-body { max-width: 92vw; max-height: 88vh; }
.lightbox-body img, .lightbox-body video { max-width: 92vw; max-height: 88vh; border-radius: 12px; box-shadow: var(--shadow); }
.lightbox-close { position: absolute; top: 18px; right: 20px; width: 40px; height: 40px; border-radius: 50%; background: var(--line); border: 1px solid var(--line-2); color: #fff; font-size: 15px; }
.lightbox-close:hover { background: var(--line-2); }

/* toasts */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 950; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 380px;
  padding: 11px 14px;
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  font-size: 12.5px;
  pointer-events: auto;
  animation: toastIn 0.28s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
.toast.out { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }
.toast .t-icon { flex: none; font-size: 15px; }
.toast .t-main { flex: 1; line-height: 1.4; }
.toast.success { border-color: rgba(87, 227, 155, 0.3); }
.toast.error { border-color: rgba(255, 95, 109, 0.35); }
.toast.info { border-color: var(--accent-line); }

/* misc */
.spinner { width: 15px; height: 15px; border: 2px solid var(--line-2); border-top-color: currentColor; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden-scroll { overflow: hidden; }

/* settings extras */
.modal-body > .settings-modal {
  margin: -8px -22px -22px;
  border-radius: 0 0 21px 21px;
  overflow: hidden;
  min-height: min(540px, calc(100vh - 230px));
}
.input-area {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  outline: none;
  resize: vertical;
  min-height: 78px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-area:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 8%, transparent); }
.input-area::placeholder { color: var(--dim); }
.settings-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.settings-form { display: flex; flex-direction: column; gap: 10px; }
.avatar-upload { display: inline-flex; border-radius: 26px; cursor: pointer; }
.avatar-upload .avatar { pointer-events: none; }
.security-score > div:nth-child(2) { flex: 1; min-width: 0; }
.settings-block-body .badge { vertical-align: middle; }
.settings-block-head .avatar.lg { width: 52px; height: 52px; font-size: 26px; border-radius: 15px; }
.settings-content { scrollbar-gutter: stable; }
.call-tile .tile-fallback .tile-note { font-size: 11px; color: var(--muted); }
.session-row .badge { margin-left: 5px; }
.pin-lock { animation: floaty 4s ease-in-out infinite; }

/* ============================ responsive ============================ */
@media (max-width: 1180px) {
  .app.has-details { grid-template-columns: 74px 320px minmax(0, 1fr); }
  .details { position: fixed; top: 0; right: 0; bottom: 0; width: min(340px, 90vw); z-index: 60; box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5); }
}

@media (max-width: 1000px) {
  .auth-shell { width: min(500px, calc(100% - 32px)); padding-top: clamp(28px, 7vh, 64px); gap: 22px; }
  .auth-hero { text-align: center; align-items: center; }
  .auth-features { display: none; }
  .auth-art { display: grid; }
  .auth-brand { justify-content: center; }
  .auth-card { max-width: 480px; width: 100%; margin: 0 auto; }
}

@media (max-width: 860px) {
  .app, .app.has-details { grid-template-columns: 1fr; }
  .rail {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 62px;
    flex-direction: row;
    padding: 0 10px;
    border-right: 0;
    border-top: 1px solid var(--line);
    background: var(--rail);
    backdrop-filter: blur(16px);
    z-index: 40;
  }
  .rail-brand { display: none; }
  .rail-nav { flex-direction: row; width: auto; gap: 2px; flex: 1; justify-content: center; }
  .rail-btn { width: 44px; height: 44px; }
  .rail-btn.active::before { display: none; }
  .rail-spacer { display: none; }
  .rail-add { margin-left: 4px; }
  .rail-avatar { margin-left: 4px; width: 36px; height: 36px; }
  .rail-badge { top: 0; right: 0; }
  .sidebar { height: calc(100vh - 62px); height: calc(100dvh - 62px); border-right: 0; }
  .main { position: fixed; inset: 0 0 62px 0; z-index: 30; transform: translateX(102%); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); visibility: hidden; }
  .app.chat-open .main { transform: none; visibility: visible; }
  .back-btn { display: inline-flex; }
  .conv-head { min-height: 60px; padding: 8px 10px; }
  .conv-actions .call-btn { width: 36px; height: 36px; }
  .details { bottom: 62px; width: 100vw; max-width: 100vw; }
  .composer-hint { display: none; }
  .messages { padding: 16px 12px 8px; }
  .message .bubble-wrap { max-width: 86%; }
  .toasts { bottom: 74px; right: 12px; left: 12px; align-items: stretch; }
  .toast { max-width: none; }
  .call-grid { padding: 6px 10px; gap: 8px; }
  .call-top { padding: 12px 16px; }
  .call-controls { padding-bottom: 22px; }
  .call-ctrl { width: 46px; height: 46px; font-size: 17px; }
  .call-ctrl.end { width: 58px; }
  .settings-modal { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; overflow-x: auto; padding: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .settings-nav h3 { display: none; }
  .settings-nav button { white-space: nowrap; }
  .settings-nav .nav-spacer { display: none; }
  .settings-content { max-height: calc(100vh - 220px); }
}

@media (max-width: 520px) {
  .auth-shell { width: calc(100% - 24px); padding-top: 28px; padding-bottom: 60px; }
  .auth-card { border-radius: 20px; padding: 20px; }
  .auth-brand h1 { font-size: 28px; }
  .form-head h2 { font-size: 22px; }
  .intro-word { font-size: 56px; }
  .intro-mark { width: 66vw; }
  .modal { border-radius: 18px; }
  .modal-body { padding: 6px 16px 18px; }
  .modal-head { padding: 16px 16px 10px; }
  .modal-foot { padding: 0 16px 18px; }
  .call-grid.n3, .call-grid.n4, .call-grid.n5, .call-grid.n6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .call-tile .tile-fallback .avatar { width: 52px; height: 52px; font-size: 26px; }
  .incoming-card { top: 10px; right: 10px; width: calc(100% - 20px); }
  .profile-edit { flex-direction: column; align-items: flex-start; }
}

/* ============================ mobile / PWA polish ============================ */
html, body { -webkit-tap-highlight-color: transparent; }
.side-scroll, .messages, .settings-content, .details, .modal-body { -webkit-overflow-scrolling: touch; }
button, .conv-item, .rail-btn, .rail-server, .settings-nav button, .icon-btn { touch-action: manipulation; }

.message.tools-open .msg-tools {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

@media (hover: none) {
  .msg-tools { top: -10px; right: 8px; }
  .message.mine .msg-tools { left: 8px; }
  .msg-tools button { width: 30px; height: 30px; font-size: 14px; }
}

@media (max-width: 860px) {
  .rail {
    height: calc(62px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .call-controls { gap: 7px; padding-left: 8px; padding-right: 8px; }
  .call-ctrl { width: 44px; height: 44px; }
  .call-ctrl.end { width: 54px; }
  .sidebar { height: calc(100vh - 62px - env(safe-area-inset-bottom, 0px)); height: calc(100dvh - 62px - env(safe-area-inset-bottom, 0px)); }
  .sidebar-head { padding-top: calc(20px + env(safe-area-inset-top, 0px)); }
  .sidebar-head { padding-left: calc(18px + env(safe-area-inset-left, 0px)); padding-right: calc(18px + env(safe-area-inset-right, 0px)); }
  .main { inset: 0 0 calc(62px + env(safe-area-inset-bottom, 0px)) 0; }
  .conv-head {
    min-height: calc(60px + env(safe-area-inset-top, 0px));
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    padding-left: calc(10px + env(safe-area-inset-left, 0px));
    padding-right: calc(10px + env(safe-area-inset-right, 0px));
  }
  .composer-wrap {
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
  }
  .rail {
    padding-left: calc(10px + env(safe-area-inset-left, 0px));
    padding-right: calc(10px + env(safe-area-inset-right, 0px));
  }
  .details {
    bottom: calc(62px + env(safe-area-inset-bottom, 0px));
    padding-top: calc(18px + env(safe-area-inset-top, 0px));
  }
  .toasts { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
  .incoming-card { top: calc(10px + env(safe-area-inset-top, 0px)); }
  .call-controls { padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
  .auth-shell { padding-top: calc(40px + env(safe-area-inset-top, 0px)); }
  .intro-skip { bottom: calc(26px + env(safe-area-inset-bottom, 0px)); }
  .intro-copyright { bottom: calc(26px + env(safe-area-inset-bottom, 0px)); }
  input, textarea, select, .input-wrap input, .input-area, .composer textarea { font-size: 16px !important; }
  .composer textarea { font-size: 16px; }
  .sidebar-search kbd { display: none; }
  .modal { max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); }
  .settings-content { max-height: calc(100vh - 230px); max-height: calc(100dvh - 230px); }
  .message .bubble-wrap { max-width: 88%; }
}

@media (max-width: 520px) {
  .auth-shell { padding-top: calc(28px + env(safe-area-inset-top, 0px)); }
  .message .bubble-wrap { max-width: 90%; }
  .conv-title h3 { font-size: 14.5px; }
  .conv-actions .call-btn { width: 34px; height: 34px; }
  .msg-media.img { max-height: 300px; }
  .settings-nav { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 520px) and (max-height: 720px) {
  .auth-shell { padding-top: calc(18px + env(safe-area-inset-top, 0px)); gap: 14px; }
  .auth-art { width: 104px; height: 104px; }
  .auth-brand p { margin-top: 0; }
  .auth-card { padding: 16px; }
}

@media (max-width: 940px) and (max-height: 520px) {
  .modal { max-height: calc(100vh - 14px); max-height: calc(100dvh - 14px); }
  .modal-head { padding: 10px 16px 7px; }
  .modal-head p { display: none; }
  .modal-head h3 { font-size: 16px; }
  .settings-modal { max-height: calc(100vh - 14px); max-height: calc(100dvh - 14px); }
  .settings-content { max-height: calc(100vh - 148px); max-height: calc(100dvh - 148px); }
  .auth-shell { padding-top: calc(14px + env(safe-area-inset-top, 0px)); gap: 12px; }
  .auth-art { width: 104px; height: 104px; }
  .intro-mark { width: 38vh; }
  .call-grid { padding: 4px 8px; }
}

/* mobile access */
.mobile-url {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.mobile-url:last-of-type { border-bottom: 0; }
.mobile-url .mu-main { flex: 1; min-width: 0; }
.mobile-url strong { display: block; font-size: 12.5px; }
.mobile-url span { display: block; font-size: 10.5px; color: var(--dim); margin-top: 2px; }
.mobile-url code {
  display: block;
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-2);
  word-break: break-all;
}
.mobile-url .icon-btn { flex: none; }
.mobile-note {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.5;
  background: var(--hover);
  border: 1px solid var(--line);
  color: var(--dim);
}
.mobile-note.ok { background: var(--ok-soft); border-color: rgba(87, 227, 155, 0.25); color: var(--ok); }
.mobile-note.warn { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); }

/* small phones */
button:focus { outline: none; }
button:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }

@media (max-width: 520px) {
  .conv-head { padding-left: 6px; padding-right: 6px; gap: 2px; }
  .conv-head .back-btn { width: 34px; height: 34px; }
  .conv-head .avatar { width: 36px; height: 36px; border-radius: 11px; font-size: 18px; }
  .conv-title h3 { display: block; font-size: 14px; }
  .conv-title h3 .group-tag { display: none; }
  .conv-title p { font-size: 10.5px; }
  .conv-id { gap: 7px; padding: 2px; }
  .conv-actions { gap: 0; }
  .conv-actions .icon-btn { width: 30px; height: 30px; font-size: 15px; }

  .auth-foot { flex-wrap: wrap; text-align: center; gap: 6px 10px; padding: 0 16px 26px; }
  .auth-foot .dot { display: none; }

  .settings-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 10px; overflow: visible; }
  .settings-nav h3, .settings-nav .nav-spacer, .settings-nav [data-settings-logout] { display: none; }
  .settings-nav button { flex-direction: column; justify-content: center; text-align: center; gap: 4px; padding: 8px 3px; font-size: 10.5px; line-height: 1.1; white-space: normal; }
  .settings-nav button span { font-size: 16px; }
}

@media (max-width: 860px) {
  .rail { background: var(--rail); backdrop-filter: none; }
  .conv-head { background: var(--header-bg); backdrop-filter: none; }
  .composer-wrap { background: var(--bg); backdrop-filter: none; }
}

/* ============================ server rail ============================ */
.rail-sep { width: 32px; height: 1px; background: var(--line); margin: 4px 0 6px; flex: none; }
.rail-servers {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  max-height: 32vh;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 0 1 auto;
  scrollbar-width: none;
}
.rail-servers::-webkit-scrollbar { display: none; }
.rail-server {
  position: relative;
  width: 48px;
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 16px;
  transition: transform 0.15s ease;
}
.rail-server:hover { transform: translateY(-1px); }
.rail-server-icon {
  --ac: var(--accent);
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 21px;
  line-height: 1;
  background:
    radial-gradient(120% 120% at 25% 10%, color-mix(in srgb, var(--ac) 32%, transparent), transparent 65%),
    linear-gradient(150deg, var(--icon-1), var(--icon-2) 70%);
  border: 1px solid color-mix(in srgb, var(--ac) 30%, var(--line));
  box-shadow: inset 0 1px 0 var(--hover);
  transition: border-radius 0.15s, box-shadow 0.15s;
  overflow: hidden;
}
.rail-server-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.rail-server:hover .rail-server-icon { border-radius: 12px; }
.rail-server.active .rail-server-icon { box-shadow: 0 0 0 2px var(--accent), 0 8px 18px color-mix(in srgb, var(--accent) 18%, transparent); }
.rail-server-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 2px solid var(--rail);
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.rail-server-call {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--ok);
  border: 2px solid var(--rail);
  box-shadow: 0 0 8px rgba(87, 227, 155, 0.7);
}
.rail-server-add {
  width: 44px;
  height: 44px;
  flex: none;
  margin: 2px 0 4px;
  border-radius: 14px;
  border: 1px dashed var(--line-2);
  color: var(--dim);
  font-size: 21px;
  display: grid;
  place-items: center;
  transition: 0.15s;
}
.rail-server-add:hover { border-color: var(--accent-line); color: var(--accent-2); background: var(--accent-soft); }

@media (max-width: 860px) {
  .rail-sep, .rail-servers, .rail-server-add { display: none; }
}

/* settings: my servers */
.server-edit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.server-edit-row:last-child { border-bottom: 0; }
.server-edit-row .se-main { flex: 1; min-width: 0; }
.server-edit-row strong { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-edit-row span { display: block; font-size: 10.5px; color: var(--dim); margin-top: 2px; }

.rail-server.active::before {
  content: "";
  position: absolute;
  left: -13px;
  top: 13px;
  bottom: 13px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 60%, transparent);
}

/* ============================ ASTRO appearance ============================ */
.empty-mini-art img { width: 44px; height: 44px; object-fit: contain; display: block; }
html[data-theme="light"] .empty-mini-art img { filter: invert(1); }
.appearance-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.appearance-row:last-child { border-bottom: 0; }
.appearance-row .sb-main { flex: 1; min-width: 0; }
.appearance-row strong { display: block; font-size: 12.5px; }
.appearance-row span { display: block; font-size: 11px; color: var(--dim); margin-top: 2px; line-height: 1.4; }
.appearance-label { margin: 16px 0 10px; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.theme-swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.theme-swatch {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 2px solid var(--line-2);
  position: relative;
  overflow: hidden;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.theme-swatch:hover { transform: translateY(-1px); border-color: var(--muted); }
.theme-swatch.light { background: #ffffff; }
.theme-swatch.dark { background: #313338; }
.theme-swatch.ultra { background: #000000; }
.theme-swatch.system {
  background: linear-gradient(135deg, #f2f3f5 0 50%, #1e1f22 50% 100%);
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 19px;
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
}
.theme-swatch.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-swatch .check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  display: none;
  place-items: center;
}
.theme-swatch.selected .check { display: grid; }
.theme-swatch .swatch-sync { position: relative; z-index: 1; }
button.switch { border: 0; padding: 0; }

/* sidebar dark option (light theme) */
html[data-theme="light"][data-sidebar-dark="1"] .rail,
html[data-theme="light"][data-sidebar-dark="1"] .sidebar {
  --text: #f2f3f5;
  --muted: #b5bac1;
  --dim: #949ba4;
  --panel: #2b2d31;
  --panel-2: #313338;
  --panel-3: #383a40;
  --panel-4: #404249;
  --line: #3f4147;
  --line-2: #4e5058;
  --hover: rgba(255, 255, 255, 0.05);
  --input-bg: #1e1f22;
  --icon-1: #313338;
  --icon-2: #1e1f22;
  color: var(--text);
}
html[data-theme="light"][data-sidebar-dark="1"] .rail { background: #1e1f22; }
html[data-theme="light"][data-sidebar-dark="1"] .sidebar { background: #2b2d31; border-color: #1e1f22; }
html[data-theme="light"][data-sidebar-dark="1"] .sidebar .me-card { background: #232428; border-color: #1e1f22; }
html[data-theme="light"][data-sidebar-dark="1"] .conv-item.active { background: var(--accent-soft); border-color: var(--accent-line); }
html[data-theme="light"][data-sidebar-dark="1"] .rail-brand { background: #000; }

/* small phones: settings nav com 5 itens */
@media (max-width: 520px) {
  .settings-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .settings-nav button { font-size: 9.4px; padding-left: 2px; padding-right: 2px; }
}

/* ============================ ASTRO perfil ============================ */
.me-status {
  display: block;
  font-size: 10.5px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.pe-status {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--accent-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-banner {
  position: relative;
  height: 116px;
  border-radius: 16px;
  border: 1px solid var(--line-2);
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.22), transparent 46%),
    linear-gradient(120deg, #5865f2, #7c3aed 52%, #0ea5e9);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  margin-bottom: 14px;
}
.profile-banner .pb-actions {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
}
.profile-banner .pb-actions .btn { border-color: rgba(255, 255, 255, 0.22); color: #fff; background: rgba(255, 255, 255, 0.1); }
.profile-banner .pb-actions .btn:hover { background: rgba(255, 255, 255, 0.2); }

.status-edit { display: flex; gap: 8px; }
.status-edit .input-wrap:first-child { flex: 0 0 78px; }
.status-edit input { text-align: center; }

.details-banner {
  height: 92px;
  margin: 12px 14px 0;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.2), transparent 46%),
    linear-gradient(120deg, #5865f2, #7c3aed 52%, #0ea5e9);
  background-size: cover;
  background-position: center;
}
.details-banner + .details-profile { padding-top: 12px; }
.detail-status {
  display: inline-block;
  font-size: 11.5px;
  color: var(--accent-2);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 99px;
  padding: 3px 10px;
  margin: 2px 0 2px;
}
.m-status {
  display: block;
  font-style: normal;
  font-size: 10.5px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================ server sidebar ============================ */
.sidebar.server-mode > .sidebar-head,
.sidebar.server-mode > .sidebar-search,
.sidebar.server-mode > .side-scroll { display: none; }
.server-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 0 8px 8px; }
.server-pane.hidden { display: none !important; }
.server-head { display: flex; align-items: center; gap: 8px; padding: 18px 8px 10px; }
.server-head .server-back { width: 32px; height: 32px; font-size: 16px; }
.server-head-main { flex: 1; min-width: 0; }
.server-head-main strong { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-head-main span { display: block; font-size: 10px; color: var(--dim); margin-top: 2px; }
.server-channel-scroll { flex: 1; overflow-y: auto; padding: 2px 2px 10px; }
.server-channel-section { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); font-weight: 700; padding: 12px 8px 6px; }
.channel-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 9px; border-radius: 9px; color: var(--muted); font-size: 13px; }
.channel-item:hover { background: var(--hover); color: var(--text); }
.channel-item.active { background: var(--accent-soft); color: var(--accent-2); }
.channel-hash { font-size: 15px; font-weight: 700; color: var(--dim); flex: none; }
.channel-item.active .channel-hash { color: var(--accent-2); }
.server-channel-add { margin: 0 4px 2px; padding: 9px; border: 1px dashed var(--line-2); border-radius: 10px; color: var(--dim); font-size: 12px; background: transparent; }
.server-channel-add:hover { color: var(--accent-2); border-color: var(--accent-line); }
.server-empty-note { padding: 18px 10px; font-size: 11.5px; color: var(--dim); line-height: 1.5; }

@media (max-width: 860px) {
  .screen-preview-wrap {
    width: min(220px, 48vw);
    right: 12px;
    bottom: calc(118px + env(safe-area-inset-bottom, 0px));
  }
}

/* ============================ server settings ============================ */
.server-settings-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.server-settings-tabs button { padding: 8px 12px; font-size: 12px; font-weight: 600; color: var(--dim); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.server-settings-tabs button:hover { color: var(--text); }
.server-settings-tabs button.active { color: var(--accent-2); border-color: var(--accent); }
.server-settings-body { max-height: min(58vh, 520px); overflow-y: auto; padding-right: 4px; }
.server-icon-edit { display: flex; align-items: center; gap: 16px; padding: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; }
.server-icon-preview .avatar { width: 84px; height: 84px; border-radius: 20px; font-size: 38px; }
.server-icon-copy { flex: 1; min-width: 0; }
.server-icon-copy strong { display: block; font-size: 12.5px; }
.server-icon-copy p { font-size: 10.5px; color: var(--dim); margin-top: 3px; line-height: 1.4; }
.server-icon-actions { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.server-channel-create { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.server-channel-create .input-wrap { flex: 1; }
.server-channel-edit-list { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.server-channel-edit-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); }
.server-channel-edit-row .input-plain { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; font-size: 12.5px; color: var(--text); padding: 5px 2px; }
.server-channel-edit-row .icon-btn { width: 30px; height: 30px; font-size: 13px; }
.role-editor { padding: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; }
.role-editor-title { font-size: 12px; font-weight: 700; margin-bottom: 9px; }
.role-editor-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.role-editor-row .input-wrap { flex: 1; min-width: 150px; }
.role-colors { flex: none; }
.role-manage { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); margin-top: 10px; }
.role-manage input { accent-color: var(--accent); }
.role-editor-actions { display: flex; gap: 8px; margin-top: 10px; }
.role-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.role-row:last-child { border-bottom: 0; }
.role-row strong { flex: 1; min-width: 0; font-size: 12.5px; }
.role-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 10%, transparent); }
.role-manage-badge { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-2); background: var(--accent-soft); border: 1px solid var(--accent-line); padding: 2px 6px; border-radius: 99px; }
.role-row .icon-btn { width: 30px; height: 30px; font-size: 13px; }
.role-member-row { display: flex; align-items: flex-start; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.role-member-row:last-child { border-bottom: 0; }
.role-member-name { flex: 0 0 120px; min-width: 0; font-size: 12px; }
.role-member-name span { display: block; font-size: 10px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-member-roles { flex: 1; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.role-check { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--muted); }
.role-check input { accent-color: var(--accent); }
.role-badge { display: inline-block; font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 99px; color: var(--rc); background: color-mix(in srgb, var(--rc) 16%, transparent); border: 1px solid color-mix(in srgb, var(--rc) 35%, transparent); margin-left: 4px; }

@media (max-width: 520px) {
  .server-icon-edit { flex-direction: column; align-items: flex-start; }
  .role-member-row { flex-wrap: wrap; }
  .role-member-name { flex-basis: 100%; }
}

/* ============================ mobile share ============================ */
.mobile-share { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.qr-box {
  width: 190px;
  height: 190px;
  padding: 8px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  flex: none;
}
.qr-box img { width: 100%; height: 100%; display: block; image-rendering: pixelated; border-radius: 8px; }
.qr-copy { flex: 1; min-width: 210px; }
.qr-copy strong { display: block; font-size: 12.5px; }
.qr-copy p { font-size: 11px; color: var(--dim); line-height: 1.55; margin-top: 4px; }
.qr-copy code { display: block; margin-top: 8px; font-size: 11px; color: var(--accent-2); word-break: break-all; }
.qr-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.invite-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--icon-2); }
.invite-box span { font-size: 10.5px; color: var(--dim); }
.invite-box code { margin: 0; font-size: 12.5px; letter-spacing: 1.5px; color: var(--accent-2); }
@media (max-width: 520px) {
  .qr-box { width: 150px; height: 150px; }
}

/* ============================ privacy ============================ */
.privacy-list { display: flex; flex-direction: column; gap: 9px; padding: 0; list-style: none; }
.privacy-list li { position: relative; padding-left: 16px; font-size: 11px; color: var(--muted); line-height: 1.55; }
.privacy-list li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--ok); }
.privacy-list b { color: var(--text); }
.privacy-list code { color: var(--accent-2); }
