/* FHU Chat — Final Production UI (Neon Noir) */

:root {
  --bg: #040405;
  --bg-mesh-1: rgba(0, 232, 122, 0.09);
  --bg-mesh-2: rgba(0, 180, 255, 0.04);
  --surface: rgba(12, 12, 16, 0.78);
  --surface-solid: #0c0c10;
  --surface2: #14141a;
  --surface3: #1f1f28;
  --glass: rgba(18, 18, 24, 0.72);
  --border: rgba(255, 255, 255, 0.07);
  --border-accent: rgba(0, 232, 122, 0.28);
  --text: #f2f2f4;
  --text-muted: #8e8e9a;
  --accent: #00e87a;
  --accent-hover: #00c968;
  --accent-bright: #3dffa8;
  --accent-dim: rgba(0, 232, 122, 0.12);
  --accent-glow: rgba(0, 232, 122, 0.38);
  --accent-text: #021a0e;
  --danger: #ff4d6a;
  --success: #00e87a;
  --warning: #ffd24d;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --header-h: 58px;
  --composer-h: 68px;
  --nav-h: 0px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 32px rgba(0, 232, 122, 0.18);
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  min-height: 100dvh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 90% 60% at 15% -10%, var(--bg-mesh-1), transparent 55%),
    radial-gradient(ellipse 70% 50% at 95% 5%, var(--bg-mesh-2), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 110%, rgba(0, 232, 122, 0.06), transparent 55%),
    var(--bg);
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

input, select, textarea, button { font: inherit; }

a { color: inherit; text-decoration: none; }

.muted { color: var(--text-muted); }

/* ── Icon masks ── */
.icon-btn.i-menu::after,
.icon-btn.i-close::after,
.icon-btn.i-attach::after,
.icon-btn.i-back::after,
.send-btn.i-send::after,
.scroll-bottom-btn.i-down::after,
.sheet-nav .i-profile::after,
.sheet-nav .i-plus::after,
.sheet-nav .i-gear::after,
.sheet-nav .i-logout::after {
  content: "";
  display: block;
  background: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.icon-btn.i-menu,
.icon-btn.i-close,
.icon-btn.i-attach,
.icon-btn.i-back,
.send-btn.i-send,
.scroll-bottom-btn.i-down { font-size: 0; line-height: 0; }

.icon-btn.i-menu::after,
.icon-btn.i-back::after { width: 18px; height: 14px; }

.icon-btn.i-close::after { width: 14px; height: 14px; }
.icon-btn.i-attach::after { width: 18px; height: 18px; }
.send-btn.i-send::after { width: 18px; height: 18px; }
.scroll-bottom-btn.i-down::after { width: 16px; height: 16px; }

.icon-btn.i-menu::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M4 7h16M4 12h16M4 17h16'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M4 7h16M4 12h16M4 17h16'/%3E%3C/svg%3E");
}

.icon-btn.i-close::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
}

.icon-btn.i-attach::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48'/%3E%3C/svg%3E");
}

.send-btn.i-send::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M3.4 20.6l17.2-8.6L3.4 3.4l2.5 7.5 7.5 2.5-7.5 2.5-2.5 7.5z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M3.4 20.6l17.2-8.6L3.4 3.4l2.5 7.5 7.5 2.5-7.5 2.5-2.5 7.5z'/%3E%3C/svg%3E");
}

.scroll-bottom-btn.i-down::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M5 12l7 7 7-7'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M5 12l7 7 7-7'/%3E%3C/svg%3E");
}

.icon-btn.i-back::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 18l-6-6 6-6'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 18l-6-6 6-6'/%3E%3C/svg%3E");
}

.sheet-nav .nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  font-size: 0;
}

.sheet-nav .i-profile::after,
.sheet-nav .i-plus::after,
.sheet-nav .i-gear::after,
.sheet-nav .i-logout::after {
  width: 1.2rem;
  height: 1.2rem;
}

.sheet-nav .i-profile::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4 3.6-7 8-7s8 3 8 7'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4 3.6-7 8-7s8 3 8 7'/%3E%3C/svg%3E");
}

.sheet-nav .i-plus::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
}

.sheet-nav .i-gear::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42'/%3E%3C/svg%3E");
}

.sheet-nav .i-logout::after {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4M16 17l5-5-5-5M21 12H9'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4M16 17l5-5-5-5M21 12H9'/%3E%3C/svg%3E");
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 48px;
  padding: 0.72rem 1.15rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.14s ease, background 0.18s ease, box-shadow 0.18s ease;
  touch-action: manipulation;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  color: var(--accent-text);
  box-shadow: 0 4px 18px var(--accent-glow);
}

.btn-primary:hover { box-shadow: 0 6px 24px var(--accent-glow); }

.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
}

.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: var(--accent-text); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
}

.btn-sm { min-height: 40px; padding: 0.48rem 0.9rem; font-size: 0.84rem; }
.btn-block { width: 100%; }

.btn-icon {
  width: 44px;
  min-width: 44px;
  padding: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.icon-btn:active {
  background: var(--surface3);
  transform: scale(0.96);
}

.send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  min-width: 46px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent-bright), var(--accent));
  color: var(--accent-text);
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 20px var(--accent-glow);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

.send-btn:active {
  transform: scale(0.94);
  box-shadow: 0 2px 12px var(--accent-glow);
}

/* ── Forms ── */
label, .field-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0.95rem 0 0.42rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

label:first-of-type, .field-label:first-child { margin-top: 0; }

.field-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.82rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea { min-height: 96px; resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ── Alerts & badges ── */
.alert {
  padding: 0.82rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  margin-bottom: 0.75rem;
}

.alert-error {
  background: rgba(255, 77, 106, 0.1);
  color: #ff8fa3;
  border: 1px solid rgba(255, 77, 106, 0.28);
}

.alert-success {
  background: var(--accent-dim);
  color: var(--accent-bright);
  border: 1px solid var(--border-accent);
}

.badge {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-banned { background: rgba(255, 77, 106, 0.14); color: var(--danger); }
.badge-muted { background: rgba(255, 210, 77, 0.14); color: var(--warning); }

.role-tag {
  display: inline-block;
  font-size: 0.66rem;
  padding: 0.14rem 0.48rem;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent-bright);
  border: 1px solid var(--border-accent);
}

/* ── Avatars ── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface3);
  border: 1px solid var(--border-accent);
  overflow: hidden;
  flex-shrink: 0;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar:has(img) .avatar-initials { display: none; }
.avatar-sm { width: 38px; height: 38px; font-size: 0.68rem; }
.avatar-md { width: 34px; height: 34px; font-size: 0.62rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1rem; }
.avatar-xl { width: 92px; height: 92px; font-size: 1.45rem; }

/* ── Login ── */
.login-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(1.5rem + var(--safe-top)) 1.35rem calc(1.5rem + var(--safe-bottom));
}

.login-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.25rem 0 2rem;
}

.login-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin-bottom: 1.35rem;
  filter: drop-shadow(0 10px 32px var(--accent-glow));
}

.login-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 2.6rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.login-title span {
  display: block;
  margin-top: 0.2rem;
  background: linear-gradient(90deg, var(--accent-bright), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-tagline {
  margin-top: 0.85rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.login-card {
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 1.45rem;
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.login-card .btn-primary { width: 100%; margin-top: 1.3rem; }

.pwa-install-help {
  margin-top: 0.85rem;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.pwa-install-help[hidden] { display: none; }

.pwa-install-title {
  font-weight: 700;
  color: var(--accent-bright);
  margin-bottom: 0.45rem;
  font-size: 0.88rem;
}

.pwa-install-steps {
  margin: 0.35rem 0 0 1.1rem;
  padding: 0;
}

.pwa-install-steps li { margin-bottom: 0.28rem; }

.pwa-install-note { margin-bottom: 0.45rem; }

/* ── App shell (chat) ── */
.app-shell {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: transparent;
  overflow: hidden;
  position: relative;
}

.app-shell::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
  z-index: 10;
  pointer-events: none;
}

.app-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: calc(0.55rem + var(--safe-top)) 0.85rem 0.55rem;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid var(--border);
  min-height: calc(var(--header-h) + var(--safe-top));
}

.header-main {
  flex: 1;
  min-width: 0;
  padding: 0.12rem 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.header-title-btn,
.header-subtitle-btn {
  background: none;
  border: none;
  text-align: left;
  color: inherit;
  cursor: pointer;
  padding: 0;
  width: 100%;
  min-width: 0;
}

.header-main h1 {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-main p {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.1rem;
}

.status-pill {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.status-pill.live {
  background: var(--accent-dim);
  color: var(--accent-bright);
  border-color: var(--border-accent);
  box-shadow: 0 0 12px rgba(0, 232, 122, 0.2);
}

.status-pill.reconnecting {
  background: rgba(255, 210, 77, 0.12);
  color: var(--warning);
  border-color: rgba(255, 210, 77, 0.3);
}

.status-pill.off {
  background: var(--surface3);
  color: var(--text-muted);
}

.chat-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-scroll-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-scroll-wrap.moderation-muted .msg-list {
  filter: blur(6px);
  opacity: 0.72;
  transition: filter 0.35s ease, opacity 0.35s ease;
}

.chat-scroll-wrap.moderation-banned .msg-list {
  filter: blur(12px);
  opacity: 0.45;
  transition: filter 0.35s ease, opacity 0.35s ease;
}

.moderation-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  pointer-events: none;
}

.moderation-overlay[hidden] { display: none; }

.moderation-banner {
  pointer-events: auto;
  width: min(100%, 340px);
  text-align: center;
  padding: 1.45rem 1.2rem;
  border-radius: 20px;
  background: rgba(4, 4, 5, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.moderation-banner.muted-state { border-color: rgba(255, 210, 77, 0.45); }
.moderation-banner.banned-state { border-color: rgba(255, 77, 106, 0.5); }

.moderation-icon {
  display: block;
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0.55rem;
}

.moderation-title {
  font-family: var(--font-display);
  font-size: 1.38rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.38rem;
  color: var(--text);
}

.moderation-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.composer.composer-muted,
.composer.composer-banned {
  transition: opacity 0.35s ease, filter 0.35s ease;
}

.composer.composer-muted {
  opacity: 0.5;
  filter: grayscale(0.85);
}

.composer.composer-banned {
  opacity: 0.38;
  filter: grayscale(1);
}

.composer.composer-muted .composer-row,
.composer.composer-banned .composer-row { pointer-events: none; }

.composer.composer-muted textarea,
.composer.composer-muted .attach-btn,
.composer.composer-muted .send-btn,
.composer.composer-banned textarea,
.composer.composer-banned .attach-btn,
.composer.composer-banned .send-btn {
  background: var(--surface3);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

.msg-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.msg-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.92rem;
  padding: 2.5rem 1.25rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin: 0.5rem;
  background: rgba(255, 255, 255, 0.02);
}

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: 90%;
  animation: msgIn 0.28s var(--ease-spring);
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-row.mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-bubble {
  padding: 0.62rem 0.88rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  min-width: 0;
  box-shadow: var(--shadow-sm);
}

.msg-row.mine .msg-bubble {
  background: linear-gradient(145deg, rgba(0, 232, 122, 0.18), rgba(0, 232, 122, 0.08));
  border-color: var(--border-accent);
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 20px rgba(0, 232, 122, 0.12);
}

.msg-row:not(.mine) .msg-bubble {
  border-bottom-left-radius: 6px;
}

.msg-row.msg-highlight .msg-bubble {
  box-shadow: 0 0 0 2px var(--accent-glow), var(--shadow-sm);
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  font-size: 0.66rem;
  color: var(--text-muted);
  margin-bottom: 0.18rem;
}

.msg-meta-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  overflow: hidden;
}

.msg-author {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent-bright);
  font-weight: 700;
  font-size: 0.7rem;
}

.msg-time {
  flex-shrink: 0;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  opacity: 0.85;
}

.msg-meta-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.08rem;
}

.msg-edit-btn,
.msg-delete-btn,
.msg-reply-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 0.82rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.45;
  touch-action: manipulation;
  transition: opacity 0.12s ease, background 0.12s ease;
}

.msg-edit-btn:active { opacity: 1; background: var(--accent-dim); }
.msg-delete-btn:active { opacity: 1; background: rgba(255, 77, 106, 0.15); }
.msg-reply-btn:active { opacity: 1; background: var(--accent-dim); }

.msg-body {
  font-size: 0.94rem;
  word-break: break-word;
  line-height: 1.45;
}

.msg-link {
  color: var(--accent-bright);
  text-decoration: underline;
  word-break: break-all;
}

.msg-mention {
  display: inline;
  border: none;
  padding: 0;
  background: none;
  color: var(--accent-bright);
  font-weight: 700;
  cursor: pointer;
  font: inherit;
}

.msg-mention.me {
  background: var(--accent-dim);
  border-radius: 4px;
  padding: 0 0.18rem;
}

.msg-image-link { display: block; margin-bottom: 0.38rem; }

.msg-image {
  display: block;
  max-width: min(260px, 100%);
  border-radius: 14px;
  border: 1px solid var(--border);
}

.msg-text + .msg-image-link,
.msg-image-link + .msg-text { margin-top: 0.38rem; }

.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.32rem;
  margin-top: 0.42rem;
}

.msg-reaction {
  border: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 999px;
  padding: 0.16rem 0.52rem;
  font-size: 0.76rem;
  line-height: 1.35;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.msg-reaction.mine {
  border-color: var(--border-accent);
  background: var(--accent-dim);
}

.msg-reaction-add {
  min-width: 28px;
  text-align: center;
  color: var(--text-muted);
  font-weight: 700;
}

.msg-reaction-picker { display: inline-flex; gap: 0.22rem; }
.msg-reaction-picker[hidden] { display: none; }

.msg-reaction-pick {
  border: 1px solid var(--border);
  background: var(--surface-solid);
  border-radius: 10px;
  padding: 0.12rem 0.38rem;
  font-size: 0.95rem;
  cursor: pointer;
}

.msg-reply-quote {
  display: block;
  width: 100%;
  margin-bottom: 0.42rem;
  padding: 0.38rem 0.55rem;
  border: none;
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
}

.msg-reply-quote strong {
  display: block;
  font-size: 0.66rem;
  color: var(--accent-bright);
  margin-bottom: 0.12rem;
}

.msg-reply-quote span {
  display: block;
  font-size: 0.74rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-reply-quote.deleted span { font-style: italic; }

.msg-date-divider {
  align-self: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.28rem 0.8rem;
  margin: 0.4rem 0;
  background: var(--surface2);
  border-radius: 999px;
  border: 1px solid var(--border);
}

.load-older-btn {
  align-self: center;
  margin: 0.2rem auto 0.4rem;
  padding: 0.48rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.load-older-btn:active:not(:disabled) { background: var(--surface3); }
.load-older-btn:disabled { opacity: 0.6; cursor: default; }

.scroll-bottom-btn {
  position: absolute;
  right: 0.9rem;
  bottom: 0.85rem;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border-accent);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--accent-bright);
  cursor: pointer;
  z-index: 5;
  touch-action: manipulation;
  box-shadow: var(--shadow-sm), var(--shadow-glow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.scroll-bottom-btn:active { transform: scale(0.94); }

.typing-indicator {
  flex-shrink: 0;
  padding: 0.38rem 0.9rem 0;
  font-size: 0.74rem;
  color: var(--text-muted);
  font-style: italic;
  min-height: 1.3rem;
}

.typing-indicator[hidden] { display: none; }

/* ── Composer ── */
.composer {
  position: relative;
  flex-shrink: 0;
  padding: 0.65rem 0.85rem calc(0.65rem + var(--safe-bottom));
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
}

.composer form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
}

.attach-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  min-height: 42px;
  border-radius: 14px;
}

.composer input,
.composer textarea {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  max-height: 128px;
  border-radius: 24px;
  padding: 0.68rem 1.05rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  resize: none;
  overflow-y: auto;
  line-height: 1.38;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.composer textarea:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.reply-preview {
  display: flex;
  align-items: center;
  gap: 0.48rem;
  margin-bottom: 0.55rem;
  padding: 0.48rem 0.6rem;
  border-radius: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}

.reply-preview[hidden] { display: none; }

.reply-preview-jump {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  padding: 0;
}

.reply-preview-label {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--accent-bright);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.reply-preview-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.image-preview {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
  padding: 0.48rem;
  border-radius: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
}

.image-preview img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 10px;
}

.image-preview[hidden] { display: none; }

.mention-menu {
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: calc(100% + 0.4rem);
  max-height: 190px;
  overflow-y: auto;
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  z-index: 20;
}

.mention-menu[hidden] { display: none; }

.mention-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  padding: 0.72rem 0.9rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.mention-item:active { background: var(--surface2); }
.mention-item .muted { font-size: 0.74rem; }

.msg-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.52rem;
}

.msg-edit-input {
  width: 100%;
  min-height: 42px;
  border-radius: 12px;
  padding: 0.58rem 0.78rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 0.94rem;
}

.msg-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.42rem;
}

.msg-edit-cancel,
.msg-edit-save {
  min-height: 34px;
  padding: 0.38rem 0.78rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.msg-edit-save {
  background: var(--accent-dim);
  border-color: var(--border-accent);
  color: var(--accent-bright);
}

.avatar-btn {
  border: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  flex-shrink: 0;
  transition: transform 0.12s ease;
}

.avatar-btn:active { transform: scale(0.94); }

/* ── Image lightbox ── */
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.image-lightbox[hidden] { display: none; }

.image-lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.image-lightbox-close {
  position: absolute;
  top: calc(0.8rem + var(--safe-top, 0px));
  right: 0.8rem;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* ── Toast ── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.1rem + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 400;
  padding: 0.58rem 1rem;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-accent);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: var(--shadow-md), var(--shadow-glow);
  max-width: calc(100% - 2rem);
  text-align: center;
}

.toast[hidden] { display: none; }

/* ── Bottom sheet ── */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.sheet-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85dvh;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(1.15);
  -webkit-backdrop-filter: blur(24px) saturate(1.15);
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.34s var(--ease-spring);
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.4);
}

.sheet-backdrop.open .sheet { transform: translateY(0); }

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  margin: 0.7rem auto 0.3rem;
}

.sheet-head {
  padding: 0.55rem 1.1rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.sheet-head h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sheet-bio {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.38rem;
  line-height: 1.4;
}

.sheet-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.channel-list { list-style: none; }

.channel-list li {
  display: flex;
  align-items: center;
  gap: 0.78rem;
  padding: 0.92rem 1.05rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.12s ease;
}

.channel-list li:active { background: var(--surface2); }

.channel-list li.active {
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
}

.ch-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border-radius: 14px;
  font-size: 1rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.channel-list li.active .ch-icon {
  background: linear-gradient(145deg, var(--accent-bright), var(--accent));
  color: var(--accent-text);
  border-color: transparent;
}

.ch-info { min-width: 0; flex: 1; }

.ch-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.ch-name {
  display: block;
  font-weight: 600;
  font-size: 0.94rem;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-time {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--text-muted);
  font-weight: 600;
}

.ch-desc {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.12rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-nav {
  border-top: 1px solid var(--border);
  padding: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.sheet-nav a,
.sheet-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.22rem;
  min-width: 74px;
  padding: 0.68rem 0.52rem;
  border-radius: 14px;
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.12s ease, color 0.12s ease;
}

.sheet-nav a:active,
.sheet-nav button:active {
  background: var(--surface2);
  color: var(--text);
}

.online-sheet { max-height: 75dvh; }

.online-user-list { list-style: none; }

.online-empty {
  padding: 1.35rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.online-user-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.58rem;
  text-align: left;
  padding: 0.88rem 1.05rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
}

.online-user-btn:active { background: var(--surface2); }

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--accent-glow);
}

.user-sheet { max-height: 55dvh; }

.user-profile-card {
  padding: 1.1rem 1.3rem 1.6rem;
  text-align: center;
}

.user-profile-card h3 {
  margin-top: 0.9rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}

.user-profile-card .muted {
  margin-top: 0.22rem;
  font-size: 0.82rem;
}

.user-profile-roles {
  margin-top: 0.68rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  justify-content: center;
}

.user-profile-status {
  display: flex;
  justify-content: center;
  gap: 0.42rem;
  margin-top: 0.68rem;
  flex-wrap: wrap;
}

.user-profile-actions {
  display: flex;
  justify-content: center;
  gap: 0.52rem;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}

.user-profile-actions[hidden] { display: none; }

.status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.22rem 0.58rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.status-badge.muted {
  background: rgba(255, 210, 77, 0.12);
  color: var(--warning);
}

.status-badge.banned {
  background: rgba(255, 77, 106, 0.12);
  color: var(--danger);
}

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 300;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop.open { display: flex; }

.modal {
  width: 100%;
  max-height: 92dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--glass);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--border);
  padding: 1.1rem 1.1rem calc(1.1rem + var(--safe-bottom));
  animation: slideUp 0.3s var(--ease-spring);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 1rem;
}

.manage-section {
  margin-top: 1.3rem;
  padding-top: 1.3rem;
  border-top: 1px solid var(--border);
}

.manage-heading {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 0.68rem;
  font-weight: 700;
}

.manage-list { display: flex; flex-direction: column; gap: 0.52rem; }

.manage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.78rem;
  padding: 0.78rem;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.manage-item-name { font-weight: 600; font-size: 0.92rem; }

.manage-item-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.role-checkboxes { display: flex; flex-direction: column; gap: 0.48rem; }

.role-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.62rem;
  padding: 0.72rem;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.12s ease;
}

.role-checkbox:has(input:checked) {
  border-color: var(--border-accent);
  background: var(--accent-dim);
}

.role-checkbox input { width: auto; min-height: auto; margin-top: 0.15rem; accent-color: var(--accent); }
.role-checkbox small { display: block; color: var(--text-muted); font-size: 0.76rem; margin-top: 0.1rem; }

/* ── Dashboard / settings ── */
.page-shell {
  min-height: 100dvh;
  padding-bottom: calc(1.5rem + var(--safe-bottom));
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.68rem;
  padding: calc(0.58rem + var(--safe-top)) 0.9rem 0.58rem;
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  flex: 1;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
}

.page-content { padding: 1.05rem 0.9rem; }

.settings-card {
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.settings-section {
  padding: 1.05rem;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-child { border-bottom: none; }

.settings-section h2 {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.78rem;
  font-weight: 700;
}

.avatar-editor {
  display: flex;
  align-items: center;
  gap: 1.05rem;
}

.avatar-actions { display: flex; flex-direction: column; gap: 0.48rem; }

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.58rem 0;
  font-size: 0.9rem;
}

.info-row span:first-child { color: var(--text-muted); }

.settings-section .btn-primary { width: 100%; margin-top: 0.78rem; }

/* ── Admin ── */
.admin-layout { padding: 0 0 calc(1rem + var(--safe-bottom)); }

.admin-tabs {
  display: flex;
  gap: 0.38rem;
  padding: 0.68rem 0.9rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky;
  top: calc(54px + var(--safe-top));
  z-index: 40;
}

.admin-tab {
  flex-shrink: 0;
  min-height: 40px;
  padding: 0.48rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.admin-tab.active {
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  color: var(--accent-text);
  border-color: transparent;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.admin-panel { display: none; padding: 0.9rem; }
.admin-panel.active { display: block; }

.admin-section {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.05rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.admin-section h2 {
  font-family: var(--font-display);
  font-size: 1.02rem;
  margin-bottom: 0.38rem;
  font-weight: 700;
}

.section-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.45;
}

.form-grid { display: flex; flex-direction: column; gap: 0.18rem; }
.form-grid .btn-primary { margin-top: 0.78rem; }

.data-table-wrap { display: none; }

.card-list { display: flex; flex-direction: column; gap: 0.68rem; }

.admin-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.48rem;
}

.admin-card-header strong { font-size: 0.94rem; }

.admin-card-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  margin-bottom: 0.62rem;
}

.admin-card-actions { display: flex; flex-wrap: wrap; gap: 0.48rem; }

/* ── Desktop ── */
@media (min-width: 768px) {
  .login-page {
    align-items: center;
    justify-content: center;
    flex-direction: row;
    gap: 3.5rem;
    padding: 2.5rem;
  }

  .login-hero { flex: none; padding: 0; }
  .login-card { width: 400px; flex-shrink: 0; }

  .app-shell,
  .page-shell {
    max-width: 480px;
    margin: 0 auto;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: 0 0 80px rgba(0, 232, 122, 0.08), var(--shadow-md);
  }

  .sheet {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
  }

  .sheet-backdrop.open .sheet {
    transform: translateX(-50%) translateY(0);
  }

  .modal {
    max-width: 480px;
    border-radius: 22px;
    margin-bottom: 2rem;
  }

  .modal-backdrop.open {
    align-items: center;
    padding: 1rem;
  }
}