/* ============= Glassmorphism Design System ============= */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg-grad-1: #0a0a1a;
  --bg-grad-2: #1a0a2e;
  --bg-grad-3: #16213e;
  --bg-grad-4: #0f3460;

  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-bg-hover: rgba(255, 255, 255, 0.1);
  --glass-bg-active: rgba(255, 255, 255, 0.14);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-strong: rgba(255, 255, 255, 0.2);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --glass-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --glass-blur: 20px;

  --text: #f0f2f8;
  --text-soft: #c8ccd6;
  --muted: #8a8f9e;
  --muted-2: #5e6373;

  --brand: #7c5cff;
  --brand-2: #5b8bff;
  --brand-glow: rgba(124, 92, 255, 0.5);
  --pink: #ff5cb9;
  --pink-glow: rgba(255, 92, 185, 0.4);
  --green: #2bdf8a;
  --green-glow: rgba(43, 223, 138, 0.4);
  --yellow: #ffc857;
  --red: #ff4d6d;
  --cyan: #4dd0e1;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-grad-1);
  overflow: hidden;
  position: relative;
}

/* Animated gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 0% 0%, rgba(124, 92, 255, 0.35), transparent 50%),
    radial-gradient(ellipse 70% 60% at 100% 0%, rgba(255, 92, 185, 0.25), transparent 50%),
    radial-gradient(ellipse 80% 70% at 50% 100%, rgba(43, 223, 138, 0.18), transparent 50%),
    radial-gradient(ellipse 60% 50% at 100% 100%, rgba(91, 139, 255, 0.2), transparent 50%),
    linear-gradient(135deg, #0a0a1a 0%, #1a0a2e 50%, #16213e 100%);
  z-index: -2;
  animation: bgShift 20s ease-in-out infinite alternate;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(124, 92, 255, 0.08) 0, transparent 1px),
    radial-gradient(circle at 80% 70%, rgba(255, 92, 185, 0.08) 0, transparent 1px),
    radial-gradient(circle at 50% 50%, rgba(91, 139, 255, 0.06) 0, transparent 1px);
  background-size: 60px 60px, 80px 80px, 100px 100px;
  z-index: -1;
  pointer-events: none;
  opacity: 0.6;
}

@keyframes bgShift {
  0% { filter: hue-rotate(0deg); transform: scale(1); }
  50% { filter: hue-rotate(15deg); transform: scale(1.05); }
  100% { filter: hue-rotate(-10deg); transform: scale(1); }
}

/* ============= Glassmorphism surfaces ============= */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius);
}
.glass-strong {
  background: rgba(20, 20, 35, 0.7);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid var(--glass-border-strong);
  box-shadow: var(--glass-shadow-lg);
  border-radius: var(--radius-lg);
}

/* ============= Layout ============= */
.app {
  display: flex;
  height: 100vh;
  padding: 12px;
  gap: 12px;
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar:hover { width: 270px; }

.sidebar .head {
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  font-weight: 700;
  font-size: 16px;
  gap: 10px;
  border-bottom: 1px solid var(--glass-border);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.15), rgba(255, 92, 185, 0.1));
}
.sidebar .head .logo {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--pink));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 16px;
  box-shadow: 0 4px 12px var(--brand-glow);
}
.sidebar .head .status-dot {
  margin-left: auto;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green-glow);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}
.nav .cat {
  padding: 12px 16px 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin: 2px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-soft);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}
.nav-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--brand), var(--pink));
  border-radius: 0 3px 3px 0;
  opacity: 0;
  transform: translateX(-3px);
  transition: all 0.2s;
}
.nav-item:hover {
  background: var(--glass-bg-hover);
  color: var(--text);
  transform: translateX(2px);
}
.nav-item.on {
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.2), rgba(255, 92, 185, 0.1));
  color: #fff;
  box-shadow: 0 4px 12px rgba(124, 92, 255, 0.15);
}
.nav-item.on::before { opacity: 1; transform: translateX(0); }
.nav-item i { width: 20px; font-size: 16px; text-align: center; }
.nav-item .badge {
  margin-left: auto;
  background: linear-gradient(135deg, var(--brand), var(--pink));
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 2px 6px var(--brand-glow);
}

.user {
  height: 60px;
  background: rgba(10, 10, 20, 0.5);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 10px;
  flex-shrink: 0;
  border-top: 1px solid var(--glass-border);
}
.user .av {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--pink));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  position: relative;
  box-shadow: 0 4px 12px var(--brand-glow);
}
.user .av .dot {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--bg-grad-1);
  box-shadow: 0 0 8px var(--green-glow);
}
.user .info { flex: 1; min-width: 0; }
.user .info .name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user .info .status { font-size: 11px; color: var(--green); }
.user .info .status.off { color: var(--red); }

/* ============= Main area ============= */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.top {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
  background: rgba(20, 20, 35, 0.3);
}
.top .vi {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--pink));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 16px;
  box-shadow: 0 4px 12px var(--brand-glow);
}
.top h3 { font-size: 18px; font-weight: 700; }
.top .desc {
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--glass-border);
  font-size: 13px;
  color: var(--muted);
}
.top .top-actions { margin-left: auto; display: flex; gap: 8px; }

.body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scroll-behavior: smooth;
}
.body::-webkit-scrollbar { width: 8px; }
.body::-webkit-scrollbar-track { background: transparent; }
.body::-webkit-scrollbar-thumb {
  background: var(--glass-border-strong);
  border-radius: 4px;
}
.body::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

.view { display: none; animation: fadeIn 0.3s ease; }
.view.on { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============= Cards ============= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255, 255, 255, 0.05) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--glass-border-strong);
  box-shadow: var(--glass-shadow-lg);
}
.card:hover::before { opacity: 1; }
.card .h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card .h .t {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.card .h .ic {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.card .h .ic.blue {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.3), rgba(124, 92, 255, 0.1));
  color: var(--brand);
  box-shadow: 0 0 20px rgba(124, 92, 255, 0.2);
}
.card .h .ic.green {
  background: linear-gradient(135deg, rgba(43, 223, 138, 0.3), rgba(43, 223, 138, 0.1));
  color: var(--green);
  box-shadow: 0 0 20px rgba(43, 223, 138, 0.2);
}
.card .h .ic.pink {
  background: linear-gradient(135deg, rgba(255, 92, 185, 0.3), rgba(255, 92, 185, 0.1));
  color: var(--pink);
  box-shadow: 0 0 20px rgba(255, 92, 185, 0.2);
}
.card .h .ic.yellow {
  background: linear-gradient(135deg, rgba(255, 200, 87, 0.3), rgba(255, 200, 87, 0.1));
  color: var(--yellow);
  box-shadow: 0 0 20px rgba(255, 200, 87, 0.2);
}
.card .h .ic.cyan {
  background: linear-gradient(135deg, rgba(77, 208, 225, 0.3), rgba(77, 208, 225, 0.1));
  color: var(--cyan);
  box-shadow: 0 0 20px rgba(77, 208, 225, 0.2);
}
.card .v {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, #c8ccd6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}
.card .c { font-size: 11px; color: var(--green); margin-top: 4px; font-weight: 600; }
.card .c.off { color: var(--red); }

/* ============= Server Cards ============= */
.srv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.srv-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.srv-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--brand) 0%, var(--pink) 100%);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: -1;
}
.srv-card:hover {
  transform: translateY(-2px);
  border-color: var(--glass-border-strong);
  box-shadow: var(--glass-shadow-lg);
}
.srv-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.srv-icon.a {
  background: linear-gradient(135deg, #7c5cff 0%, #5b8bff 100%);
  box-shadow: 0 4px 16px var(--brand-glow);
}
.srv-icon.b {
  background: linear-gradient(135deg, #ff5cb9 0%, #ff8a5c 100%);
  box-shadow: 0 4px 16px var(--pink-glow);
}
.srv-icon .live {
  position: absolute;
  bottom: -4px; right: -4px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--bg-grad-1);
  box-shadow: 0 0 8px var(--green-glow);
  animation: pulse 2s infinite;
}
.srv-info h4 { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.srv-info p { font-size: 12px; color: var(--muted); }
.srv-count { margin-left: auto; text-align: right; }
.srv-count .n {
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, #fff, #c8ccd6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.srv-count .l { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ============= Sections ============= */
.sec-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.sec-h .t {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sec-h .t::before {
  content: '';
  display: block;
  width: 4px; height: 20px;
  background: linear-gradient(180deg, var(--brand), var(--pink));
  border-radius: 2px;
}

/* ============= Pair Cards ============= */
.pair-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.pair-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 18px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.pair-card:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: var(--glass-border-strong);
  box-shadow: 0 12px 32px rgba(124, 92, 255, 0.15);
}
.pair-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.pair-id {
  font-size: 10px;
  font-weight: 700;
  color: var(--brand);
  background: rgba(124, 92, 255, 0.15);
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}
.pair-lbl { font-size: 10px; color: var(--muted); }
.pair-body { text-align: center; }
.pair-av {
  width: 72px; height: 72px;
  border-radius: 50%;
  margin: 0 auto 10px;
  overflow: hidden;
  cursor: pointer;
  border: 3px solid transparent;
  background: linear-gradient(135deg, var(--brand), var(--pink)) padding-box,
              linear-gradient(135deg, var(--brand), var(--pink)) border-box;
  transition: transform 0.3s;
}
.pair-av:hover { transform: scale(1.05) rotate(2deg); }
.pair-av img { width: 100%; height: 100%; object-fit: cover; }
.pair-av .fb {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #fff;
}
.pair-name { font-size: 15px; font-weight: 600; }
.pair-tag { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.pair-servs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--glass-border);
}
.pair-servs > div {
  flex: 1;
  text-align: center;
  padding: 8px;
  border-radius: 8px;
}
.pair-servs > div:first-child { background: rgba(124, 92, 255, 0.1); }
.pair-servs > div:last-child { background: rgba(255, 92, 185, 0.1); }
.pair-servs .sn { font-size: 10px; color: var(--muted); }
.pair-servs .sd { font-size: 12px; font-weight: 600; }

/* ============= Meta / Search ============= */
.meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.meta h2 { font-size: 22px; font-weight: 800; }
.meta .total { font-size: 13px; color: var(--muted); }
.search {
  width: 100%;
  padding: 12px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--text);
  font-size: 14px;
  margin-bottom: 16px;
  outline: none;
  transition: all 0.2s;
  font-family: var(--font);
}
.search:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.15);
  background: var(--glass-bg-hover);
}
.search::placeholder { color: var(--muted-2); }

/* ============= Member list ============= */
.mlist { display: flex; flex-direction: column; gap: 8px; }
.mcard {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  transition: all 0.2s;
  cursor: pointer;
}
.mcard:hover {
  background: var(--glass-bg-hover);
  transform: translateX(4px);
  border-color: var(--glass-border-strong);
}
.mav {
  width: 40px; height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid transparent;
  background: linear-gradient(135deg, var(--brand), var(--pink)) padding-box,
              linear-gradient(135deg, var(--brand), var(--pink)) border-box;
}
.mav img { width: 100%; height: 100%; object-fit: cover; }
.mav .fb {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 16px;
}
.minfo { flex: 1; min-width: 0; }
.mname { font-size: 14px; font-weight: 600; }
.mtag { font-size: 11px; color: var(--muted); }

/* ============= Empty / Loading ============= */
.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}
.empty i { font-size: 56px; margin-bottom: 12px; opacity: 0.4; }
.empty h3 { font-size: 16px; font-weight: 600; color: var(--text-soft); }
.empty p { font-size: 13px; }
.loading {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: s 0.8s linear infinite;
  display: inline-block;
}
@keyframes s { to { transform: rotate(360deg); } }

/* ============= Buttons ============= */
.btn {
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  font-family: var(--font);
  white-space: nowrap;
}
.btn-p {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 4px 12px var(--brand-glow);
}
.btn-p:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--brand-glow);
}
.btn-p:active { transform: translateY(0); }
.btn-s {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--text-soft);
  border: 1px solid var(--glass-border);
}
.btn-s:hover { background: var(--glass-bg-hover); color: var(--text); }
.btn-pink {
  background: linear-gradient(135deg, var(--pink), #ff8a5c);
  color: #fff;
  box-shadow: 0 4px 12px var(--pink-glow);
}
.btn-green {
  background: linear-gradient(135deg, var(--green), #5ce0a3);
  color: #0a1f15;
  box-shadow: 0 4px 12px var(--green-glow);
}
.btn-red {
  background: linear-gradient(135deg, var(--red), #ff7a8a);
  color: #fff;
}
.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: 10px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============= Messages view ============= */
.msg-layout {
  display: flex;
  gap: 16px;
  height: calc(100vh - 180px);
}
.msg-side {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg-ch-list {
  flex: 1;
  overflow-y: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 6px;
}
.ch-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-soft);
  font-size: 13px;
  transition: all 0.2s;
  margin: 2px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ch-item:hover { background: var(--glass-bg-hover); color: var(--text); }
.ch-item.on {
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.25), rgba(255, 92, 185, 0.1));
  color: #fff;
}
.ch-item .ch-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ch-item .ch-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--brand);
  background: rgba(124, 92, 255, 0.15);
  padding: 2px 8px;
  border-radius: 6px;
}
.msg-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.msg-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.msg-toolbar input, .msg-toolbar select {
  flex: 1;
  min-width: 140px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: var(--font);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.msg-toolbar input:focus, .msg-toolbar select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.15);
}
.msg-toolbar select { cursor: pointer; }
.msg-toolbar select option { background: #1a1a2e; color: var(--text); }
.msg-info { font-size: 13px; color: var(--muted); white-space: nowrap; }
.msg-view {
  flex: 1;
  overflow-y: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 8px 0;
}
.msg-row {
  display: flex;
  gap: 12px;
  padding: 4px 16px;
  border-radius: 4px;
  transition: background 0.15s;
}
.msg-row:hover { background: var(--glass-bg-hover); }
.msg-row .msg-av {
  width: 40px; height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}
.msg-row .msg-av img { width: 100%; height: 100%; object-fit: cover; }
.msg-row .msg-av .fb {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 16px;
}
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg-author {
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.msg-author:hover { color: var(--brand); }
.msg-time { font-size: 11px; color: var(--muted); }
.msg-content {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
}
.msg-mention {
  color: var(--brand);
  background: rgba(124, 92, 255, 0.15);
  padding: 0 4px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}
.msg-mention:hover { background: rgba(124, 92, 255, 0.3); }

/* ============= Attachments ============= */
.msg-attach {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.msg-attach img {
  max-width: 320px;
  max-height: 240px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s;
  border: 1px solid var(--glass-border);
}
.msg-attach img:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.attach-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-soft);
  font-size: 12px;
  text-decoration: none;
  transition: all 0.2s;
}
.attach-link:hover {
  background: var(--glass-bg-hover);
  color: var(--text);
  transform: translateY(-1px);
}
.attach-link.audio {
  background: linear-gradient(135deg, rgba(255, 92, 185, 0.15), rgba(255, 138, 92, 0.1));
  border-color: rgba(255, 92, 185, 0.3);
  color: var(--pink);
}
.attach-link i { font-size: 14px; }

/* Audio player */
.audio-player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.1), rgba(255, 92, 185, 0.05));
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  min-width: 280px;
}
.audio-player audio {
  flex: 1;
  height: 32px;
  filter: invert(0.85) hue-rotate(180deg);
}

/* ============= AI view ============= */
.ai-layout {
  display: flex;
  gap: 16px;
  height: calc(100vh - 180px);
}
.ai-side {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-side textarea {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  resize: none;
  font-family: var(--font);
  min-height: 140px;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.ai-side textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.15);
}
.ai-side .ai-hint { font-size: 12px; color: var(--muted); padding: 0 4px; }
.ai-btns { display: flex; gap: 8px; }
.ai-btns button { flex: 1; justify-content: center; }
.ai-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ai-msgs {
  flex: 1;
  overflow-y: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ai-msg {
  display: flex;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius);
  animation: fadeIn 0.3s;
  border: 1px solid var(--glass-border);
}
.ai-msg.user {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.15), rgba(91, 139, 255, 0.08));
}
.ai-msg.assistant {
  background: linear-gradient(135deg, rgba(43, 223, 138, 0.08), rgba(77, 208, 225, 0.05));
}
.ai-msg .ai-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.ai-msg.user .ai-icon {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 4px 12px var(--brand-glow);
}
.ai-msg.assistant .ai-icon {
  background: linear-gradient(135deg, var(--green), var(--cyan));
  color: #0a1f15;
  box-shadow: 0 4px 12px var(--green-glow);
}
.ai-body { flex: 1; min-width: 0; }
.ai-name { font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.ai-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
}
.ai-text a {
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1px dashed var(--brand);
}
.ai-text a:hover { color: var(--pink); border-color: var(--pink); }
.ai-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  gap: 8px;
}
.ai-empty i { font-size: 56px; opacity: 0.4; }
.ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  color: var(--muted);
  font-size: 13px;
}
.ai-loading .spinner { width: 20px; height: 20px; }
.ai-error {
  padding: 14px 18px;
  background: rgba(255, 77, 109, 0.1);
  border: 1px solid rgba(255, 77, 109, 0.3);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 13px;
}
.ai-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ai-tools span {
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--glass-bg);
  color: var(--text-soft);
  border: 1px solid var(--glass-border);
  font-weight: 600;
}

/* ============= Voice page ============= */
.voice-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  height: calc(100vh - 180px);
}
.voice-list {
  overflow-y: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
}
.voice-ch {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.voice-ch.connected {
  border-color: var(--green);
  box-shadow: 0 0 24px rgba(43, 223, 138, 0.2);
}
.voice-ch.connected::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: linear-gradient(180deg, var(--green), var(--cyan));
}
.voice-ch-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.voice-ch-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--pink));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 18px;
  box-shadow: 0 4px 12px var(--brand-glow);
}
.voice-ch.connected .voice-ch-icon {
  background: linear-gradient(135deg, var(--green), var(--cyan));
  box-shadow: 0 4px 12px var(--green-glow);
  animation: pulse 2s infinite;
}
.voice-ch-info { flex: 1; }
.voice-ch-name { font-size: 15px; font-weight: 700; }
.voice-ch-meta { font-size: 11px; color: var(--muted); }
.voice-ch-actions { display: flex; gap: 6px; }
.voice-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.voice-member {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  font-size: 12px;
}
.voice-member .vm-av {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--pink));
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}
.voice-member.muted { opacity: 0.6; }

/* Voice recorder */
.voice-recorder {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: fit-content;
}
.voice-recorder h3 {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rec-status {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  font-size: 13px;
  text-align: center;
  color: var(--muted);
}
.rec-status.recording {
  background: linear-gradient(135deg, rgba(255, 77, 109, 0.15), rgba(255, 92, 185, 0.08));
  border-color: var(--red);
  color: var(--red);
  animation: pulse 1.5s infinite;
}
.rec-btn {
  width: 80px; height: 80px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--brand), var(--pink));
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  box-shadow: 0 8px 24px var(--brand-glow);
  transition: all 0.2s;
}
.rec-btn:hover { transform: scale(1.05); }
.rec-btn.recording {
  background: linear-gradient(135deg, var(--red), var(--pink));
  animation: pulse 1s infinite;
}
.rec-select, .rec-target {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: var(--font);
  width: 100%;
  cursor: pointer;
}
.rec-select option, .rec-target option {
  background: #1a1a2e;
  color: var(--text);
}
.rec-select:focus, .rec-target:focus {
  border-color: var(--brand);
}
.rec-audio {
  width: 100%;
  height: 40px;
  filter: invert(0.85) hue-rotate(180deg);
}

/* ============= Send Message page ============= */
.send-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  height: calc(100vh - 180px);
}
.send-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 12px;
}
.send-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}
.send-target-select, .send-mentions-input {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--bg-grad-1);
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: var(--font);
  width: 100%;
}
.send-target-select option, .send-mentions-input option {
  background: #1a1a2e;
  color: var(--text);
}
.send-target-select:focus, .send-mentions-input:focus {
  border-color: var(--brand);
}
.send-textarea {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--bg-grad-1);
  color: var(--text);
  font-size: 14px;
  outline: none;
  resize: none;
  font-family: var(--font);
  min-height: 200px;
  line-height: 1.5;
}
.send-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.15);
}
.send-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.send-toolbar-info { font-size: 12px; color: var(--muted); }
.send-ch-cat {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 4px 4px;
}
.send-ch-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-soft);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.send-ch-item:hover { background: var(--glass-bg-hover); color: var(--text); }
.send-ch-item.on {
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.2), rgba(255, 92, 185, 0.1));
  color: #fff;
}
.send-ch-item i { font-size: 12px; opacity: 0.6; }
.send-ch-item .ch-topic { font-size: 10px; color: var(--muted); margin-left: auto; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mention-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.mention-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.2), rgba(91, 139, 255, 0.1));
  border: 1px solid rgba(124, 92, 255, 0.3);
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
}
.mention-pill .x {
  cursor: pointer;
  opacity: 0.6;
  font-size: 10px;
}
.mention-pill .x:hover { opacity: 1; }

.bot-status-banner {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.bot-status-banner .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
}
.bot-status-banner.off .dot { background: var(--red); box-shadow: 0 0 8px rgba(255, 77, 109, 0.5); }
.bot-status-banner.off { color: var(--red); }

/* ============= Modal ============= */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
}
.modal-overlay.on { display: flex; }
.modal {
  background: var(--glass-bg);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-lg);
  width: 560px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--glass-shadow-lg);
  position: relative;
  animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--glass-border);
}
.modal-av {
  width: 72px; height: 72px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 3px solid transparent;
  background: linear-gradient(135deg, var(--brand), var(--pink)) padding-box,
              linear-gradient(135deg, var(--brand), var(--pink)) border-box;
}
.modal-av img { width: 100%; height: 100%; object-fit: cover; }
.modal-av .fb {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #fff;
}
.modal-info .mn { font-size: 20px; font-weight: 700; }
.modal-info .mt { font-size: 13px; color: var(--muted); }
.modal-body { padding: 20px 24px 24px; }
.modal-body .ms {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
  margin: 12px 0 8px;
  letter-spacing: 0.05em;
}
.modal-body .ms:first-child { margin-top: 0; }
.modal-srv {
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 10px 14px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.modal-srv .msn { font-size: 14px; font-weight: 600; }
.modal-srv .msd { font-size: 11px; color: var(--muted); }
.modal-srv .msr {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.modal-srv .msr span {
  background: rgba(124, 92, 255, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-soft);
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-soft);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
}
.modal-close:hover { background: var(--glass-bg-hover); color: var(--text); }

/* ============= Toast ============= */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-lg);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 360px;
  animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast.success { border-color: rgba(43, 223, 138, 0.4); }
.toast.success i { color: var(--green); }
.toast.error { border-color: rgba(255, 77, 109, 0.4); }
.toast.error i { color: var(--red); }
.toast.info i { color: var(--brand); }

/* ============= Mobile nav ============= */
.mnav {
  display: none;
  position: fixed;
  bottom: 12px;
  left: 12px;
  right: 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  z-index: 100;
  padding: 8px 4px;
  box-shadow: var(--glass-shadow-lg);
}
.mnav a {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  color: var(--muted);
  text-decoration: none;
  font-size: 10px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.mnav a:hover, .mnav a.on {
  color: #fff;
  background: var(--glass-bg-hover);
}
.mnav a i { display: block; font-size: 18px; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .ai-layout, .msg-layout, .voice-layout, .send-layout {
    grid-template-columns: 1fr;
    flex-direction: column;
    height: auto;
  }
  .ai-side, .msg-side, .send-side { width: 100%; max-height: 300px; }
  .mnav { display: flex; }
  .body { padding-bottom: 90px; }
  .app { padding: 8px; gap: 8px; }
  .body { padding: 16px; }
}
