/* =========================================================================
   Ruangin — "Your Space. Your Conversation."
   Palette from the brief: navy #101B2B, lime #A6F36A, white, light gray #F2F5F7.
   Layout language from the reference: glowing gradient header panels with
   rounded bottoms, big two-tone headings, story-row avatars, glass bubbles.
   ========================================================================= */
:root {
  --navy: #101B2B;
  --navy-2: #16253A;
  --navy-3: #1E3150;
  --navy-line: rgba(255, 255, 255, .08);
  --lime: #A6F36A;
  --lime-2: #8EE04F;
  --lime-ink: #10230A;
  --teal: #3FC8B5;
  --white: #FFFFFF;
  --gray: #F2F5F7;
  --gray-2: #E3E8EE;
  --gray-3: #C9D1DB;
  --ink: #0F1A28;
  --ink-2: #4B5B70;
  --ink-3: #7D8B9E;
  --red: #FF5D6C;
  --amber: #FFC14D;
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 26px;
  --r-xl: 34px;
  --shadow: 0 10px 30px -12px rgba(9, 18, 32, .35);
  --shadow-lg: 0 30px 80px -24px rgba(5, 12, 24, .6);
  --font: ui-sans-serif, -apple-system, "SF Pro Display", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --glow: radial-gradient(120% 90% at 0% 0%, rgba(166, 243, 106, .30) 0%, rgba(166, 243, 106, 0) 45%),
          radial-gradient(90% 80% at 100% 10%, rgba(63, 200, 181, .35) 0%, rgba(63, 200, 181, 0) 55%),
          radial-gradient(120% 120% at 50% 120%, rgba(56, 104, 255, .35) 0%, rgba(56, 104, 255, 0) 60%),
          linear-gradient(160deg, #1d3554 0%, #142640 55%, #0f1e33 100%);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--navy); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.muted-dark { color: rgba(255, 255, 255, .62); }
.small { font-size: 13px; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.lime { color: var(--lime); }
.ic { flex: none; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

/* ---------- Brand ---------- */
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-word { font-weight: 800; font-size: 22px; letter-spacing: -0.04em; color: #fff; }
.brand-word i, .landing-foot i { color: var(--lime); font-style: normal; }
.brand-mark svg { display: block; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 11px 20px; font-weight: 650; font-size: 15px; text-decoration: none; transition: transform .12s ease, background .15s ease, box-shadow .15s ease; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--lime); color: var(--lime-ink); box-shadow: 0 8px 24px -10px rgba(166, 243, 106, .7); }
.btn-primary:hover { background: #B6F985; }
.btn-ghost { background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .16); }
.btn-ghost:hover { background: rgba(255, 255, 255, .14); }
.auth-card .btn-ghost, .sheet .btn-ghost, .card .btn-ghost { background: var(--gray); color: var(--ink); border-color: var(--gray-2); }
.btn-glass { background: rgba(255, 255, 255, .12); color: #fff; backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, .14); }
.btn-dark { background: var(--navy); color: #fff; }
.btn-dark:hover { background: var(--navy-3); }
.btn-light { background: var(--gray); color: var(--ink); border: 1px solid var(--gray-2); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-ghost { background: rgba(255, 93, 108, .1); color: #D63447; }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 26px; font-size: 16px; }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-xs { padding: 6px 11px; font-size: 12.5px; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: inherit; text-decoration: none; }
.icon-btn:hover { background: rgba(127, 127, 127, .14); }

/* ---------- Forms ---------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field > span em { font-weight: 400; color: var(--ink-3); font-style: normal; }
.field small { font-size: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input[type=text], input[type=search], input[type=password], input:not([type]), textarea, select {
  width: 100%; border: 1.5px solid var(--gray-2); background: var(--gray); border-radius: 14px; padding: 12px 14px; outline: none; transition: border-color .15s, background .15s, box-shadow .15s; color: var(--ink);
}
input:focus, textarea:focus, select:focus { border-color: var(--navy); background: #fff; box-shadow: 0 0 0 4px rgba(166, 243, 106, .35); }
textarea { resize: vertical; min-height: 44px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 6px 8px; border-radius: 8px; }
.seg { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.seg legend { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.seg label { display: block; }
.seg input { position: absolute; opacity: 0; }
.seg label span { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-radius: 14px; border: 1.5px solid var(--gray-2); background: var(--gray); cursor: pointer; font-weight: 550; }
.seg input:checked + span { border-color: var(--navy); background: #fff; box-shadow: inset 0 0 0 1px var(--navy); }
.seg input:focus-visible + span { outline: 2px solid var(--lime); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 100; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100% - 24px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 16px; border-radius: 16px; background: #fff; color: var(--ink); box-shadow: var(--shadow-lg); border-left: 5px solid var(--navy); font-size: 14px; animation: toast-in .25s ease; }
.toast span { flex: 1; overflow-wrap: anywhere; }
.toast-success { border-left-color: var(--lime-2); }
.toast-error { border-left-color: var(--red); }
.toast-info { border-left-color: var(--teal); }
.toast-x { border: 0; background: transparent; color: var(--ink-3); padding: 2px; border-radius: 6px; }
.toast.is-leaving { opacity: 0; transform: translateY(-6px); transition: .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
.alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.alert-error { background: #FFECEE; color: #9b1c2b; }

/* ---------- Dialog sheets ---------- */
dialog.sheet { border: 0; padding: 22px; border-radius: var(--r-lg); width: min(460px, calc(100% - 24px)); max-height: calc(100dvh - 40px); overflow: auto; background: #fff; color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.sheet::backdrop { background: rgba(6, 12, 22, .6); backdrop-filter: blur(4px); }
dialog.sheet[open] { animation: sheet-in .22s ease; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.sheet > * + * { margin-top: 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { font-size: 21px; }
@media (max-width: 640px) {
  dialog.sheet { margin: auto 0 0; width: 100%; max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: calc(22px + var(--safe-b)); }
  @keyframes sheet-in { from { transform: translateY(40px); opacity: .4; } }
}
.copy-field { display: flex; gap: 8px; }
.copy-field input { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.copy-field .btn { flex: none; }
.danger-zone { border-top: 1px solid var(--gray-2); padding-top: 14px; }
.danger-zone summary { cursor: pointer; color: #D63447; font-weight: 600; font-size: 14px; }
.danger-zone .form { margin-top: 12px; }

/* =========================================================================
   AUTH (login / register / join / install) — glowing navy with white card
   ========================================================================= */
.auth-body { min-height: 100dvh; background: var(--navy); position: relative; overflow-x: hidden; }
.auth-glow, .landing-glow { position: fixed; inset: -20% -10% auto; height: 80vh; background: var(--glow); filter: blur(10px); opacity: .9; pointer-events: none; border-radius: 0 0 50% 50%; }
.auth-wrap { position: relative; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 16px 24px; gap: 22px; }
.auth-top { display: flex; justify-content: center; }
.auth-card { width: min(420px, 100%); background: #fff; border-radius: var(--r-xl); padding: 30px 26px; box-shadow: var(--shadow-lg); display: grid; gap: 16px; }
.auth-card-wide { width: min(560px, 100%); }
.auth-title { font-size: 30px; font-weight: 800; letter-spacing: -0.035em; }
.auth-switch { text-align: center; font-size: 14px; color: var(--ink-2); }
.auth-switch a, .auth-card a { color: var(--ink); font-weight: 650; text-decoration-color: var(--lime-2); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.auth-hint { text-align: center; font-size: 12.5px; }
.auth-foot { color: rgba(255, 255, 255, .5); font-size: 12.5px; }
.auth-foot a { color: rgba(255, 255, 255, .75); }
.invite-chip { display: flex; align-items: center; gap: 10px; background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 14px; font-size: 14px; }
.invite-chip svg { color: var(--lime); }
.invite-chip strong { color: var(--lime); }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 14px; }
.checklist .ok { color: #2d7a12; } .checklist .bad { color: #c22; }
.join-tile { display: flex; justify-content: center; }
.eyebrow-dark { font-size: 13px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }
.join-meta { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.join-meta img { border-radius: 50%; }
.auth-card.center { text-align: center; justify-items: center; }
.auth-card.center form { width: 100%; }

/* Avatars */
.avatar { border-radius: 50%; object-fit: cover; background: var(--gray); flex: none; }
.avatar-xl { width: 76px; height: 76px; box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--lime); }
.avatar-xxl { width: 112px; height: 112px; box-shadow: 0 0 0 5px var(--navy), 0 0 0 8px var(--lime); }
.avatar-current { display: flex; align-items: center; gap: 16px; padding: 14px; background: var(--gray); border-radius: 18px; }
.avatar-details summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); padding: 4px 0; }
.avatar-details[open] summary { margin-bottom: 10px; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; max-height: 300px; overflow: auto; padding: 4px; margin: 0 -4px 10px; }
.avatar-opt { position: relative; display: grid; justify-items: center; gap: 3px; padding: 6px 2px; border-radius: 14px; cursor: pointer; font-size: 11px; color: var(--ink-2); transition: background .15s; }
.avatar-opt:hover { background: var(--gray); }
.avatar-opt input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-opt img { width: 52px; height: 52px; border-radius: 50%; transition: transform .15s, box-shadow .15s; }
.avatar-opt input:checked ~ img { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--navy); transform: scale(1.04); }
.avatar-opt input:checked ~ span { color: var(--ink); font-weight: 700; }
.avatar-opt input:focus-visible ~ img { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--lime); }

/* =========================================================================
   LANDING
   ========================================================================= */
.bare-body { background: var(--navy); color: #fff; min-height: 100dvh; }
.landing { position: relative; overflow: hidden; max-width: 1180px; margin: 0 auto; padding: 0 22px; }
.landing-glow { position: absolute; inset: -30% -30% auto; height: 900px; }
.landing-nav { position: relative; display: flex; justify-content: space-between; align-items: center; padding: 22px 0; gap: 12px; }
.landing-nav nav { display: flex; gap: 8px; }
.hero { position: relative; display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: center; padding: 50px 0 80px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); }
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 12px var(--lime); }
.hero-title { font-size: clamp(44px, 6.6vw, 82px); font-weight: 850; letter-spacing: -0.05em; line-height: .98; margin: 22px 0 18px; }
.hero-sub { font-size: 18px; color: rgba(255, 255, 255, .72); max-width: 470px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.hero-avatars { display: flex; align-items: center; margin-top: 30px; font-size: 13px; color: rgba(255, 255, 255, .6); }
.hero-avatars .stack { margin-right: -10px; box-shadow: 0 0 0 3px var(--navy); }
.hero-avatars span { margin-left: 22px; }
.hero-phones { position: relative; height: 560px; }
.phone { position: absolute; width: 260px; height: 520px; border-radius: 42px; background: #0b1422; padding: 10px; box-shadow: var(--shadow-lg), inset 0 0 0 1.5px rgba(255, 255, 255, .08); overflow: hidden; display: flex; flex-direction: column; }
.phone-back { left: 0; top: 30px; transform: rotate(-5deg); }
.phone-front { right: 0; top: 0; transform: rotate(4deg); }
.phone-glow { background: var(--glow); border-radius: 32px; padding: 42px 16px 18px; display: grid; gap: 12px; }
.phone-front .phone-glow { flex: 1; align-content: start; }
.mini-search { display: flex; gap: 6px; align-items: center; font-size: 10px; background: rgba(255, 255, 255, .14); padding: 7px 10px; border-radius: 99px; color: rgba(255, 255, 255, .7); }
.mini-hello { font-size: 25px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.mini-hello span { color: var(--lime); }
.mini-stories { display: flex; gap: 8px; }
.mini-story { width: 34px; height: 34px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(166, 243, 106, .9); }
.mini-story.add { display: grid; place-items: center; background: rgba(166, 243, 106, .2); color: var(--lime); border: 1.5px dashed var(--lime); box-shadow: none; }
.mini-list { list-style: none; padding: 14px 8px; margin: 0; display: grid; gap: 14px; }
.mini-list li { display: flex; gap: 9px; align-items: center; }
.mini-list img { border-radius: 50%; }
.mini-list span { display: grid; font-size: 11px; line-height: 1.25; min-width: 0; }
.mini-list em { font-style: normal; color: rgba(255, 255, 255, .5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-chat-head { display: flex; align-items: center; gap: 7px; font-size: 18px; line-height: .95; margin-bottom: 4px; }
.mini-chat-head img { border-radius: 50%; }
.mini-chat-head strong { color: var(--lime); letter-spacing: -.03em; }
.mini-bubble { font-size: 10.5px; padding: 8px 11px; border-radius: 14px; max-width: 82%; }
.mini-bubble.in { background: rgba(255, 255, 255, .14); justify-self: start; border-bottom-left-radius: 4px; }
.mini-bubble.out { background: var(--lime); color: var(--lime-ink); justify-self: end; border-bottom-right-radius: 4px; font-weight: 550; }
.mini-composer { display: flex; justify-content: space-between; align-items: center; margin: 12px 6px 6px; padding: 5px 5px 5px 14px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .14); font-size: 11px; color: rgba(255, 255, 255, .5); }
.mini-composer b { width: 28px; height: 28px; border-radius: 50%; background: var(--lime); color: var(--navy); display: grid; place-items: center; }
.how { position: relative; padding: 30px 0 50px; }
.how h2, .feature-grid h2 { font-size: 34px; font-weight: 800; letter-spacing: -.04em; margin-bottom: 22px; }
.how-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.how-steps li, .feature { background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .09); border-radius: var(--r-lg); padding: 24px; }
.step-n { font-size: 13px; font-weight: 800; color: var(--lime); letter-spacing: .1em; }
.how-steps h3, .feature h3 { font-size: 20px; margin: 10px 0 6px; }
.how-steps p, .feature p { color: rgba(255, 255, 255, .62); font-size: 14.5px; }
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding-bottom: 60px; }
.f-ic { width: 42px; height: 42px; border-radius: 14px; background: var(--lime); color: var(--navy); display: grid; place-items: center; }
.landing-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 26px 0 34px; border-top: 1px solid var(--navy-line); color: rgba(255, 255, 255, .55); font-size: 14px; }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 20px; }
  .hero-phones { height: 520px; max-width: 520px; width: 100%; margin: 0 auto; }
  .how-steps { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .hero-phones { height: 440px; transform: scale(.82); transform-origin: top center; margin-bottom: -60px; }
  .phone { width: 230px; }
  .feature-grid { grid-template-columns: 1fr; }
  .landing-nav .btn-ghost { display: none; }
  .field-row { grid-template-columns: 1fr; }
  .auth-card { padding: 26px 20px; border-radius: 28px; }
}

/* =========================================================================
   APP SHELL (signed in) — dark like the reference
   ========================================================================= */
.app-body { color: #fff; height: 100dvh; overflow: hidden; }
.shell { display: grid; grid-template-columns: 76px 1fr; height: 100dvh; }
.shell.has-list { grid-template-columns: 76px 370px 1fr; }
.rail { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 0; border-right: 1px solid var(--navy-line); background: #0c1524; }
.rail-brand { margin-bottom: 18px; }
.rail-link { width: 56px; display: grid; justify-items: center; gap: 3px; padding: 9px 0 7px; border-radius: 16px; border: 0; background: transparent; color: rgba(255, 255, 255, .55); text-decoration: none; font-size: 10.5px; font-weight: 600; }
.rail-link:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.rail-link.is-active { color: var(--lime); background: rgba(166, 243, 106, .1); }
.rail-spacer { flex: 1; }
.rail-me img { border-radius: 50%; box-shadow: 0 0 0 2px var(--navy), 0 0 0 4px rgba(166, 243, 106, .7); }
.listpane { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--navy-line); background: var(--navy); }
.mainpane { min-width: 0; min-height: 0; overflow: auto; position: relative; }
.tabbar { display: none; }

/* Glow header (left screen of reference) */
.glow-head { background: var(--glow); border-radius: 0 0 var(--r-xl) var(--r-xl); padding: 20px 18px 18px; display: grid; gap: 16px; box-shadow: 0 20px 40px -24px rgba(0, 0, 0, .7); flex: none; }
.search-pill { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 999px; background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .7); backdrop-filter: blur(8px); }
.search-pill input { background: transparent; border: 0; padding: 11px 0; color: #fff; box-shadow: none; border-radius: 0; }
.search-pill input:focus { background: transparent; box-shadow: none; }
.search-pill input::placeholder { color: rgba(255, 255, 255, .55); }
.hello { font-size: 34px; font-weight: 800; letter-spacing: -0.045em; line-height: 1.02; }
.hello span { color: var(--lime); }
.story-row { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 2px; margin: 0 -18px; padding-left: 18px; padding-right: 18px; scrollbar-width: none; }
.story-row::-webkit-scrollbar { display: none; }
.story { flex: none; display: grid; justify-items: center; gap: 6px; text-decoration: none; color: #fff; border: 0; background: none; padding: 0; width: 62px; }
.story-ring { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 0 0 2px rgba(255, 255, 255, .35); }
.story.has-unread .story-ring { box-shadow: 0 0 0 2.5px var(--lime), 0 0 18px rgba(166, 243, 106, .45); }
.story-new .story-ring { background: rgba(166, 243, 106, .18); color: var(--lime); box-shadow: none; border: 2px dashed rgba(166, 243, 106, .8); }
.story-label { font-size: 11.5px; font-weight: 600; max-width: 62px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-tile { display: inline-grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--tile-bg) 70%, white), var(--tile-bg) 60%, color-mix(in srgb, var(--tile-bg) 80%, black)); color: var(--tile-fg); font-weight: 800; letter-spacing: -.02em; flex: none; box-shadow: inset 0 -3px 8px rgba(0, 0, 0, .12); }

.room-list { flex: 1; overflow-y: auto; padding: 10px 10px 90px; }
.room-row { display: flex; gap: 12px; align-items: center; padding: 11px 10px; border-radius: 18px; text-decoration: none; color: #fff; transition: background .15s; }
.room-row:hover { background: rgba(255, 255, 255, .05); }
.room-row.is-active { background: rgba(166, 243, 106, .1); box-shadow: inset 0 0 0 1px rgba(166, 243, 106, .25); }
.room-row-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.room-row-top, .room-row-bottom { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.room-row-top strong { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-row .ts { font-size: 11.5px; color: rgba(255, 255, 255, .45); flex: none; }
.preview { font-size: 13.5px; color: rgba(255, 255, 255, .5); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--lime); color: var(--lime-ink); font-size: 11.5px; font-weight: 800; display: inline-grid; place-items: center; }
.badge-red { background: var(--red); color: #fff; margin-left: auto; }
.pill-mini { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: rgba(255, 255, 255, .5); }
.empty-list { text-align: center; padding: 40px 18px; display: grid; gap: 10px; justify-items: center; }
.empty-list p:first-child { font-size: 18px; font-weight: 700; }
.empty-list .muted { color: rgba(255, 255, 255, .5); }
.no-match { text-align: center; padding: 20px; color: rgba(255, 255, 255, .5); }

/* Desktop welcome pane */
.welcome-pane { height: 100%; display: grid; place-items: center; padding: 30px; background: radial-gradient(60% 60% at 50% 40%, rgba(166, 243, 106, .07), transparent 70%); }
.welcome-card { text-align: center; display: grid; gap: 16px; justify-items: center; max-width: 440px; }
.welcome-avatars { display: flex; }
.welcome-avatars .stack { margin: 0 -8px; box-shadow: 0 0 0 4px var(--navy); }
.welcome-card h2 { font-size: 38px; font-weight: 800; letter-spacing: -.045em; }

/* =========================================================================
   CHAT ROOM (right screen of reference)
   ========================================================================= */
.chat { height: 100%; display: flex; flex-direction: column; }
.chat-glow { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--glow); border-radius: 0 0 var(--r-xl) var(--r-xl); box-shadow: 0 24px 50px -30px rgba(0, 0, 0, .8); overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 12px; background: linear-gradient(180deg, rgba(16, 27, 43, .55), rgba(16, 27, 43, 0)); position: relative; z-index: 2; }
.back-btn { color: #fff; margin-left: -8px; }
.chat-title { flex: 1; min-width: 0; }
.chat-title h1 { font-size: 26px; font-weight: 850; letter-spacing: -0.045em; line-height: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sub { border: 0; background: none; padding: 4px 0 0; color: rgba(255, 255, 255, .62); font-size: 13px; display: inline-flex; align-items: center; gap: 3px; }
.chat-sub:hover { color: #fff; }
.chat-actions { display: flex; gap: 6px; }
.pill-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 13px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .1); color: #fff; font-size: 13.5px; font-weight: 600; backdrop-filter: blur(8px); }
.pill-btn:hover { background: rgba(255, 255, 255, .18); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 4px 16px 18px; overscroll-behavior: contain; scroll-behavior: auto; }
.chat-older { display: flex; justify-content: center; padding: 6px 0 10px; }
.chat-intro { text-align: center; display: grid; justify-items: center; gap: 8px; padding: 30px 20px 24px; color: rgba(255, 255, 255, .75); }
.chat-intro h2 { color: #fff; font-size: 22px; }
.chat-intro p { max-width: 360px; }
.messages { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px; }
.day-sep { align-self: center; margin: 14px 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; color: rgba(255, 255, 255, .7); background: rgba(16, 27, 43, .35); padding: 5px 12px; border-radius: 99px; backdrop-filter: blur(6px); }
.msg { display: flex; align-items: flex-end; gap: 8px; max-width: min(78%, 560px); }
.msg.is-first { margin-top: 8px; }
.msg-avatar { width: 30px; height: 30px; flex: none; }
.msg-avatar img { width: 30px; height: 30px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }
.msg:not(.is-last) .msg-avatar img { visibility: hidden; }
.bubble { position: relative; padding: 9px 13px 7px; border-radius: 20px; background: rgba(255, 255, 255, .13); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); color: #fff; border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 8px 20px -14px rgba(0, 0, 0, .6); cursor: default; }
.msg.is-first .bubble { border-top-left-radius: 20px; }
.msg:not(.is-last) .bubble { border-bottom-left-radius: 8px; }
.msg:not(.is-first) .bubble { border-top-left-radius: 8px; }
.msg.is-last .bubble { border-bottom-left-radius: 6px; }
.bubble-name { display: block; font-size: 12px; font-weight: 750; color: var(--lime); margin-bottom: 2px; }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.38; }
.bubble-time { display: block; text-align: right; font-size: 10.5px; opacity: .6; margin-top: 2px; }
.msg.own { align-self: flex-end; flex-direction: row-reverse; }
.msg.own .msg-avatar { display: none; }
.msg.own .bubble { background: var(--lime); color: var(--lime-ink); border-color: transparent; box-shadow: 0 10px 22px -14px rgba(166, 243, 106, .9); }
.msg.own .bubble { border-radius: 20px; }
.msg.own:not(.is-last) .bubble { border-bottom-right-radius: 8px; }
.msg.own:not(.is-first) .bubble { border-top-right-radius: 8px; }
.msg.own.is-last .bubble { border-bottom-right-radius: 6px; }
.msg.own .bubble-time { opacity: .55; }
.msg.is-deleted .bubble { background: transparent; border: 1px dashed rgba(255, 255, 255, .3); color: rgba(255, 255, 255, .6); font-style: italic; box-shadow: none; backdrop-filter: none; }
.msg.own.is-deleted .bubble { border-color: rgba(166, 243, 106, .5); color: rgba(166, 243, 106, .8); }
.msg.is-pending .bubble { opacity: .6; }
.msg.is-failed .bubble { box-shadow: 0 0 0 2px var(--red); }
.msg-more { align-self: center; opacity: 0; border: 0; background: rgba(255, 255, 255, .1); color: #fff; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; transition: opacity .15s; }
.msg:hover .msg-more, .msg-more:focus-visible { opacity: 1; }
@media (hover: none) { .msg-more { opacity: .55; background: transparent; } }
.msg-menu { position: fixed; z-index: 60; background: #fff; color: var(--ink); border-radius: 16px; padding: 6px; box-shadow: var(--shadow-lg); display: grid; min-width: 170px; }
.msg-menu button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; background: none; border-radius: 10px; text-align: left; font-weight: 550; font-size: 14px; }
.msg-menu button:hover { background: var(--gray); }
.msg-menu .danger { color: #D63447; }
.chat-loading { display: flex; justify-content: center; gap: 6px; padding: 30px; }
.chat-loading span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .6); animation: blink 1s infinite; }
.chat-loading span:nth-child(2) { animation-delay: .15s; } .chat-loading span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: .2; transform: translateY(-3px); } }
.jump-new { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); border: 0; border-radius: 99px; padding: 8px 16px; background: var(--lime); color: var(--lime-ink); font-weight: 700; font-size: 13px; box-shadow: var(--shadow); z-index: 3; }

.composer { flex: none; display: flex; align-items: flex-end; gap: 8px; margin: 14px 16px calc(14px + var(--safe-b)); padding: 6px 6px 6px 18px; border-radius: 28px; border: 1.5px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .04); position: relative; transition: border-color .15s; }
.composer:focus-within { border-color: rgba(166, 243, 106, .6); }
.composer textarea { flex: 1; background: transparent; border: 0; color: #fff; padding: 11px 0; resize: none; max-height: 140px; min-height: 0; line-height: 1.35; border-radius: 0; box-shadow: none; }
.composer textarea:focus, .composer textarea:focus-visible { background: transparent; box-shadow: none; outline: none; }
.search-pill input:focus-visible, .search-box input:focus-visible { outline: none; }
.composer textarea::placeholder { color: rgba(255, 255, 255, .45); }
.send-btn { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--lime); color: var(--lime-ink); display: grid; place-items: center; transition: transform .12s, opacity .15s; }
.send-btn:disabled { opacity: .35; }
.send-btn:not(:disabled):hover { transform: scale(1.05); }
.char-count { position: absolute; right: 64px; top: -20px; font-size: 11px; color: rgba(255, 255, 255, .55); }
.char-count.over { color: var(--red); }
.member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 60vh; overflow: auto; }
.member-list li { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; }
.member-list li:hover { background: var(--gray); }
.member-list img { width: 40px; height: 40px; border-radius: 50%; }
.member-list .m-name { flex: 1; font-weight: 600; }
.member-list .m-tag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--navy); color: var(--lime); }
.member-list .m-you { background: var(--gray-2); color: var(--ink-2); }

/* =========================================================================
   PROFILE / content pages inside the app shell
   ========================================================================= */
.page-wrap { max-width: 980px; margin: 0 auto; padding: 30px 22px 110px; }
.page-title { font-size: 34px; font-weight: 850; letter-spacing: -.045em; }
.profile-hero { display: flex; align-items: center; gap: 24px; padding: 28px; border-radius: var(--r-xl); background: var(--glow); margin-bottom: 20px; }
.stat-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.stat-chips span { padding: 6px 12px; border-radius: 99px; background: rgba(255, 255, 255, .1); font-size: 13px; }
.stat-chips strong { color: var(--lime); }
.profile-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; }
.card { background: #fff; color: var(--ink); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow); }
.card-title { font-size: 19px; font-weight: 750; margin-bottom: 2px; }
.card .form { gap: 14px; }
.card > * + * { margin-top: 12px; }
.prose h2 { font-size: 19px; margin: 22px 0 8px; }
.prose p, .prose li { color: inherit; opacity: .85; line-height: 1.6; }
.prose ul { padding-left: 20px; display: grid; gap: 6px; margin: 0; }
.page-wrap.prose { max-width: 720px; }
.page-wrap.prose .muted { color: rgba(255, 255, 255, .55); }

/* =========================================================================
   ERROR
   ========================================================================= */
.error-page { min-height: 100dvh; display: grid; place-items: center; padding: 20px; position: relative; }
.error-card { position: relative; text-align: center; display: grid; gap: 12px; justify-items: center; max-width: 440px; }
.error-code { font-size: 96px; font-weight: 900; letter-spacing: -.06em; color: var(--lime); line-height: 1; margin-top: 20px; }
.error-card h1 { font-size: 28px; }
.error-card .muted { color: rgba(255, 255, 255, .65); }
.row-gap { display: flex; gap: 10px; margin-top: 8px; }

/* =========================================================================
   RESPONSIVE — mobile app feel
   ========================================================================= */
@media (max-width: 1100px) { .shell.has-list { grid-template-columns: 76px 320px 1fr; } }
@media (max-width: 860px) {
  .shell, .shell.has-list { grid-template-columns: 1fr; }
  .rail { display: none; }
  .page-home .mainpane { display: none; }
  .page-room .listpane { display: none; }
  .listpane { border-right: 0; }
  .tabbar { position: fixed; z-index: 30; left: 14px; right: 14px; bottom: calc(12px + var(--safe-b)); display: flex; justify-content: space-around; align-items: center; height: 64px; border-radius: 26px; background: rgba(12, 21, 36, .86); backdrop-filter: blur(16px); border: 1px solid rgba(255, 255, 255, .08); box-shadow: var(--shadow-lg); }
  .tabbar a { display: grid; justify-items: center; gap: 2px; color: rgba(255, 255, 255, .55); text-decoration: none; font-size: 11px; font-weight: 600; width: 80px; }
  .tabbar a.is-active { color: var(--lime); }
  .tab-new { width: 52px; height: 52px; border-radius: 18px; border: 0; background: var(--lime); color: var(--lime-ink); display: grid; place-items: center; box-shadow: 0 10px 24px -8px rgba(166, 243, 106, .8); }
  .profile-grid { grid-template-columns: 1fr; }
  .profile-hero { flex-direction: column; text-align: center; }
  .stat-chips { justify-content: center; }
  .chat-actions .pill-btn span { display: none; }
  .chat-actions .pill-btn { width: 38px; padding: 0; justify-content: center; }
  .chat-tile { display: none; }
}
@media (min-width: 861px) { .back-btn { display: none; } }
@media (max-width: 420px) {
  .chat-title h1 { font-size: 22px; }
  .hello { font-size: 30px; }
  .msg { max-width: 86%; }
}

/* =========================================================================
   ADMIN — premium minimal SaaS on light surfaces
   ========================================================================= */
.admin-body { background: var(--gray); color: var(--ink); min-height: 100dvh; }
.admin-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100dvh; }
.admin-side { background: var(--navy); color: #fff; padding: 22px 16px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100dvh; }
.admin-badge { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: 11.5px; font-weight: 700; color: var(--lime); background: rgba(166, 243, 106, .12); padding: 5px 10px; border-radius: 99px; letter-spacing: .03em; }
.admin-nav { display: grid; gap: 3px; }
.admin-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: rgba(255, 255, 255, .65); font-weight: 600; font-size: 14.5px; }
.admin-nav a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.admin-nav a.is-active { color: var(--lime-ink); background: var(--lime); }
.admin-side-foot { margin-top: auto; display: grid; gap: 12px; font-size: 13.5px; }
.admin-side-foot a { display: flex; align-items: center; gap: 6px; color: rgba(255, 255, 255, .65); text-decoration: none; }
.admin-me { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--navy-line); }
.admin-me img { border-radius: 50%; }
.admin-main { padding: 26px 30px 60px; min-width: 0; display: grid; gap: 18px; align-content: start; }
.admin-head h1 { font-size: 30px; font-weight: 850; letter-spacing: -.04em; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card { background: #fff; border-radius: 20px; padding: 18px; border: 1px solid var(--gray-2); display: grid; gap: 4px; }
.stat-card p { font-size: 13px; color: var(--ink-3); font-weight: 600; margin-top: 8px; }
.stat-card strong { font-size: 34px; font-weight: 850; letter-spacing: -.04em; }
.stat-card small { font-size: 12.5px; color: var(--ink-3); }
.stat-ic { width: 38px; height: 38px; border-radius: 12px; background: var(--gray); display: grid; place-items: center; color: var(--navy); }
.stat-card-dark { background: var(--navy); color: #fff; border-color: var(--navy); }
.stat-card-dark .stat-ic { background: var(--lime); }
.stat-card-dark p, .stat-card-dark small { color: rgba(255, 255, 255, .6); }
.stat-card-dark a { color: var(--lime); text-decoration: none; font-weight: 600; }
.admin-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; }
.panel { background: #fff; border-radius: 20px; border: 1px solid var(--gray-2); padding: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-head h2 { font-size: 16px; font-weight: 750; }
.panel-head a { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; height: 180px; align-items: end; }
.bar-col { display: grid; grid-template-rows: auto 1fr auto; height: 100%; justify-items: center; gap: 4px; }
.bar-col .bar { align-self: end; width: 100%; max-width: 26px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--lime), var(--lime-2)); min-height: 2px; }
.bar-col:last-child .bar { background: var(--navy); }
.bar-val { font-size: 10.5px; color: var(--ink-3); align-self: end; }
.bar-x { font-size: 11px; color: var(--ink-3); }
.simple-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.simple-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.simple-list a { flex: 1; font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.simple-list .num { font-weight: 750; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--gray); color: var(--ink-2); text-transform: capitalize; white-space: nowrap; }
.tag-active { background: #E9FBD9; color: #2f6b0e; }
.tag-closed { background: #FFF4D6; color: #8a5a00; }
.tag-disabled, .tag-blocked { background: #FFE4E7; color: #b11c30; }
.tag-dark { background: var(--navy); color: var(--lime); text-transform: none; }
.report-list, .mod-list { list-style: none; padding: 0; margin: 0; display: grid; }
.report-list li, .mod-list li { display: flex; gap: 12px; align-items: flex-start; padding: 14px 4px; border-top: 1px solid var(--gray-2); }
.report-list li:first-child, .mod-list li:first-child { border-top: 0; }
.report-list img, .mod-list img { border-radius: 50%; }
.report-main, .mod-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.report-meta { font-size: 13px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.report-meta a { color: var(--ink); font-weight: 600; }
.report-meta .ts { color: var(--ink-3); }
.report-body, .mod-body { font-size: 14.5px; overflow-wrap: anywhere; background: var(--gray); padding: 10px 12px; border-radius: 4px 14px 14px 14px; }
.is-deleted .mod-body, .report-body.is-deleted { opacity: .55; text-decoration: line-through; }
.mod-list li.is-reported { background: linear-gradient(90deg, rgba(255, 93, 108, .06), transparent 60%); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.row-actions form { margin: 0; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-box { flex: 1; min-width: 220px; max-width: 420px; display: flex; align-items: center; gap: 8px; background: #fff; border: 1.5px solid var(--gray-2); border-radius: 14px; padding: 0 12px; color: var(--ink-3); }
.search-box input { border: 0; background: transparent; padding: 10px 0; box-shadow: none; }
.search-box input:focus { box-shadow: none; background: transparent; }
.toolbar select { width: auto; background: #fff; padding: 9px 12px; }
.seg-tabs { display: inline-flex; background: #fff; border: 1.5px solid var(--gray-2); border-radius: 12px; padding: 3px; }
.seg-tabs input { position: absolute; opacity: 0; }
.seg-tabs span { display: block; padding: 6px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg-tabs input:checked + span { background: var(--navy); color: #fff; }
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; padding: 14px 14px 10px; border-bottom: 1px solid var(--gray-2); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--gray); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #FAFBFC; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.is-muted td { opacity: .6; }
.table a { color: var(--ink); text-decoration: none; }
.table .ts { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user img { border-radius: 50%; }
.inline-select select { padding: 6px 10px; border-radius: 10px; font-size: 13px; width: auto; }
.empty { padding: 26px; text-align: center; }
.pager { display: flex; gap: 14px; justify-content: center; align-items: center; font-size: 14px; }
.pager a { font-weight: 650; color: var(--ink); }
@media (max-width: 1100px) { .stat-grid { grid-template-columns: 1fr 1fr; } .admin-grid { grid-template-columns: 1fr; } }
@media (max-width: 780px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; padding: 14px; gap: 10px; }
  .admin-nav { grid-auto-flow: column; overflow-x: auto; }
  .admin-nav a { white-space: nowrap; }
  .admin-side-foot { display: none; }
  .admin-main { padding: 18px 14px 50px; }
  .report-list li, .mod-list li { flex-wrap: wrap; }
  .row-actions { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
