/* ===== RESET & ROOT ===== */
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

#app-shell {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ===== SERVER RAIL (far left) ===== */
.server-rail {
  width: 66px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 4px;
  flex-shrink: 0;
  overflow-y: auto;
}
.server-rail::-webkit-scrollbar { width: 0; }

.srv-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--sidebar-hover-bg);
  border: 2px solid transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 15px; font-weight: 800;
  color: var(--sidebar-text);
  transition: all 0.18s;
  flex-shrink: 0;
  position: relative;
  font-family: 'DM Serif Display', serif;
  letter-spacing: -0.02em;
  overflow: hidden;
}
.srv-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.srv-icon:hover {
  border-radius: 14px;
  color: var(--sidebar-active);
  border-color: var(--accent2);
  background: var(--sidebar-active-bg);
}
.srv-icon.active {
  border-radius: 14px;
  border-color: var(--accent2);
  color: var(--sidebar-active);
  background: var(--sidebar-active-bg);
}
/* Active pip */
.srv-icon.active::before {
  content: '';
  position: absolute;
  left: -9px; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 60%;
  background: var(--accent2);
  border-radius: 0 3px 3px 0;
}
.srv-notif {
  position: absolute;
  bottom: 0; right: 0;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--sidebar-bg);
}
.srv-divider {
  width: 28px; height: 1.5px;
  background: var(--sidebar-border);
  border-radius: 1px;
  flex-shrink: 0;
  margin: 3px 0;
}
.srv-add {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: none;
  border: 2px dashed var(--sidebar-border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--sidebar-text);
  font-size: 23px; line-height: 1;
  transition: all 0.18s; flex-shrink: 0;
}
.srv-add:hover { border-color: var(--green); color: var(--green); border-radius: 14px; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  border-right: 1px solid var(--sidebar-border);
  position: relative;
}

.sidebar-top {
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.wordmark {
  font-family: 'DM Serif Display', serif;
  font-size: 23px;
  color: rgba(255,255,255,0.9);
  letter-spacing: -0.02em;
  line-height: 1;
}
.wordmark span {
  color: var(--accent2);
  font-style: italic;
}

.workspace-name {
  font-size: 12px;
  color: rgba(255,255,255,0.28);
  font-family: 'DM Mono', monospace;
  margin-top: 3px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Channels list */
.channels-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
  min-height: 0;
}
.channels-scroll::-webkit-scrollbar { width: 0; }

.ch-section-label {
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.22);
  padding: 10px 16px 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ch-section-label button {
  background: none; border: none;
  color: rgba(255,255,255,0.22);
  font-size: 18px; cursor: pointer;
  line-height: 1; transition: color 0.15s;
  padding: 0 2px;
}
.ch-section-label button:hover { color: var(--accent2); }

.ch-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px 5px 12px;
  margin: 1px 6px;
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 15px;
  font-weight: 500;
  border-radius: 6px;
  border-left: none;
  transition: all 0.15s;
  position: relative;
}
.ch-item:hover { color: var(--sidebar-active); background: var(--sidebar-hover-bg); }
.ch-item.active {
  color: var(--sidebar-active);
  background: var(--sidebar-active-bg);
  font-weight: 500;
}
.ch-item .ch-hash {
  font-family: 'DM Mono', monospace;
  font-size: 14px; opacity: 0.75;
  flex-shrink: 0; width: 14px; text-align: center;
}
.ch-item .ch-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.ch-unread { width: 7px; height: 7px; border-radius: 50%; background: var(--amber-light); flex-shrink: 0; }
.ch-live {
  font-size: 10px; font-family: 'DM Mono', monospace;
  background: var(--green); color: white;
  padding: 1px 5px; border-radius: 3px;
  letter-spacing: 0.06em; text-transform: uppercase;
}

/* ===== VOICE CONTROLS PANEL (above user strip) ===== */
.voice-controls-panel {
  border-top: 1px solid var(--sidebar-border);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

/* Status bar: shown when in voice, shows channel name + leave */
.vc-status-bar {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: rgba(58,158,106,0.12);
  border: 1px solid rgba(58,158,106,0.3);
  border-radius: 7px;
  font-size: 13px;
  font-family: 'DM Mono', monospace;
  color: var(--green);
}
.vc-status-bar.visible { display: flex; }
.vc-status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: vcpulse 1.8s ease infinite;
  flex-shrink: 0;
}
@keyframes vcpulse { 0%,100%{opacity:1} 50%{opacity:0.3} }
.vc-status-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vc-leave-btn {
  background: none; border: none;
  color: var(--red); cursor: pointer;
  font-size: 16px; padding: 2px 4px;
  border-radius: 4px; line-height: 1;
  transition: all 0.15s;
}
.vc-leave-btn:hover { background: rgba(217,79,61,0.15); }

/* Icon button row */
.vc-btn-row {
  display: flex;
  gap: 5px;
  align-items: center;
}

.vc-btn-row-share {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--sidebar-border);
}
.vc-btn {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  padding: 0;
  height: 54px;
  min-height: 54px;
  max-height: 54px;
  box-sizing: border-box;
  background: var(--sidebar-hover-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--sidebar-text);
  transition: all 0.17s;
  font-family: 'DM Sans', sans-serif;
}
.vc-btn:hover { background: var(--sidebar-active-bg); color: var(--sidebar-active); border-color: rgba(255,255,255,0.15); }
.vc-btn .vci { font-size: 18px; line-height: 1; }
.vc-btn .vcl { font-size: 10px; font-family: 'DM Mono', monospace; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.7; }

/* Active states */
.vc-btn.vc-active-voice { background: rgba(58,158,106,0.15); border-color: rgba(58,158,106,0.4); color: var(--green); }
.vc-btn.vc-active-cam   { background: rgba(74,128,196,0.15); border-color: rgba(74,128,196,0.4); color: var(--blue); }
.vc-btn.vc-active-screen{ background: rgba(212,116,42,0.15); border-color: rgba(212,116,42,0.4); color: var(--amber); }
.vc-btn.vc-muted        { background: rgba(217,79,61,0.12);  border-color: rgba(217,79,61,0.35);  color: var(--red); }
.vc-btn.vc-deafened     { background: rgba(217,79,61,0.12);  border-color: rgba(217,79,61,0.35);  color: var(--red); }

/* Bottom user strip */
.sidebar-foot {
  padding: 8px 10px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
}
.my-avatar {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
  flex-shrink: 0;
}
.my-name { color: rgba(255,255,255,0.85); font-size: 16px; font-weight: 500; line-height: 1.2; }
.my-status {
  color: rgba(255,255,255,0.28); font-size: 13px;
  font-family: 'DM Mono', monospace;
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  border-radius: 4px; padding: 1px 3px; margin-left: -3px;
  transition: background 0.13s, color 0.13s;
}
.my-status:hover { background: var(--sidebar-hover-bg); color: rgba(255,255,255,0.6); }

.status-picker {
  position: absolute;
  bottom: 100%; left: 8px; right: 8px;
  background: var(--paper2);
  border: 1px solid var(--rule);
  border-radius: 9px;
  padding: 4px;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.25);
  z-index: 300;
  animation: ctxIn 0.1s ease;
}
.status-picker-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px; border-radius: 6px;
  font-size: 14px; color: var(--ink3);
  cursor: pointer; transition: background 0.1s;
}
.status-picker-item:hover { background: var(--paper3); color: var(--ink); }
.status-dot-pick {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.foot-btn {
  background: none; border: none;
  color: rgba(255,255,255,0.28);
  font-size: 17px; cursor: pointer;
  padding: 4px; border-radius: 4px;
  transition: all 0.15s; line-height: 1;
}
.foot-btn:hover { color: rgba(255,255,255,0.9); background: var(--sidebar-hover-bg); }

/* ===== MAIN ===== */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
}

/* Channel bar at top — the key UI */
.channel-bar {
  background: var(--paper);
  border-bottom: 1.5px solid var(--rule);
  flex-shrink: 0;
}

.channel-bar-top {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 20px;
  height: 52px;
  border-bottom: 1px solid var(--rule);
}

.channel-title-area {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.channel-title {
  font-family: 'DM Serif Display', serif;
  font-size: 21px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-topic {
  font-size: 14px;
  color: var(--ink3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  padding-left: 10px;
  border-left: 1px solid var(--rule);
  margin-left: 2px;
}


/* Live people row — shown when someone is in voice */
.live-row {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 0 20px 10px;
  flex-wrap: wrap;
}
.live-row.visible { display: flex; }
.live-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 5px;
  border-radius: 20px;
  background: var(--paper2);
  border: 1px solid var(--rule);
  font-size: 14px;
  color: var(--ink3);
  font-weight: 500;
}
.live-pill .pill-av {
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: white;
  flex-shrink: 0;
}
.live-pill.speaking {
  border-color: var(--green);
  background: rgba(58,158,106,0.1);
}
.live-indicator {
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  color: var(--green);
  font-weight: 500;
  letter-spacing: 0.04em;
  animation: blink 1.8s ease infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }


/* ── Wordmark in top tab bar ─────────────────────────────────────────────── */
.tabs-divider {
  width: 1px;
  height: 20px;
  background: var(--sidebar-border);
  flex-shrink: 0;
  margin: 0 6px;
}
/* sidebar-top display:none removed */

/* ── Voice in channel sidebar ─────────────────────────────────────────────── */
.ch-voice-btn {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 13px;
  opacity: 0.35;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  flex-shrink: 0;
  color: var(--sidebar-text);
}
.ch-item:hover .ch-voice-btn { opacity: 1; color: white; }
.ch-item:hover .ch-voice-btn:hover { opacity: 1; color: white; background: var(--sidebar-hover-bg); }
.ch-voice-btn.active { opacity: 1; }

.ch-voice-users {
  padding: 2px 0 6px 40px;
  border-left: 2px solid var(--green);
  margin-left: 20px;
}
.ch-voice-user {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 8px 3px 6px;
  font-size: 14px;
  color: var(--sidebar-text);
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s;
}
.ch-voice-user:hover { background: var(--sidebar-hover-bg); }
.ch-voice-user.is-speaking .ch-voice-av {
  box-shadow: 0 0 0 2px var(--green);
}
.ch-voice-user.is-speaking .ch-voice-name {
  color: var(--green);
}
.ch-voice-av {
  width: 20px; height: 20px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: white;
  font-family: 'DM Serif Display', serif;
  flex-shrink: 0;
  transition: box-shadow 0.15s;
}
.ch-voice-name { font-size: 14px; color: var(--sidebar-text); transition: color 0.15s; }
.ch-voice-muted { font-size: 12px; opacity: 0.6; }
.ch-vol-slider {
  width: 52px;
  height: 3px;
  accent-color: var(--accent);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.ch-voice-user:hover .ch-vol-slider { opacity: 1; }

/* ── Notification bell ───────────────────────────────────────────────────────*/
.notif-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  position: relative;
  color: var(--sidebar-text);
  transition: background 0.13s;
  line-height: 1;
}
.notif-btn:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-active); }
.notif-btn.has-notifs { color: var(--amber-light); }

/* ── Panel toggle buttons (Members / Friends / Notifs) ───────────────────────*/
.sidebar-panel-btns {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 6px 8px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.panel-toggle-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 7px;
  color: var(--ink3);
  transition: background 0.13s, color 0.13s;
  line-height: 1;
  position: relative;
}
.panel-toggle-btn:hover { background: var(--paper2); color: var(--ink); }
.panel-toggle-btn.active { background: var(--paper3); color: var(--ink); }

.notif-badge {
  position: absolute;
  top: -2px; right: -2px;
  min-width: 16px; height: 16px;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 800;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  font-family: 'DM Mono', monospace;
  border: 2px solid var(--sidebar-bg);
}

/* ── Channel mention badge ───────────────────────────────────────────────────*/
.ch-mention-badge {
  min-width: 14px; height: 14px;
  background: var(--red);
  color: white;
  font-size: 9px;
  font-weight: 800;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  font-family: 'DM Mono', monospace;
  margin-left: auto;
  flex-shrink: 0;
}

/* ── Tab notification badges ─────────────────────────────────────────────────*/
.tab-notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 14px; height: 14px;
  background: var(--red);
  color: white;
  font-size: 9px;
  font-weight: 800;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  font-family: 'DM Mono', monospace;
  pointer-events: none;
}

/* ── Notification panel ──────────────────────────────────────────────────────*/
.notif-panel {
  position: absolute;
  top: 40px; right: 0;
  width: 320px;
  background: var(--paper);
  border: 1.5px solid var(--rule);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  z-index: 500;
  overflow: hidden;
}
.np-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.np-mark-all {
  background: none; border: none;
  font-size: 13px; color: var(--accent2);
  cursor: pointer; font-family: 'DM Sans', sans-serif;
}
.np-mark-all:hover { text-decoration: underline; }
.np-list { max-height: 380px; overflow-y: auto; }
.np-list::-webkit-scrollbar { width: 4px; }
.np-list::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 2px; }
.np-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--rule);
  transition: background 0.12s;
  opacity: 0.45;
  position: relative;
}
.np-row:hover { background: var(--paper2); opacity: 1; }
.np-unread { background: var(--paper2); opacity: 1; }
.np-unread:hover { background: var(--paper3); }
.np-icon { font-size: 21px; flex-shrink: 0; margin-top: 1px; }
.np-body { flex: 1; min-width: 0; }
.np-text { font-size: 15px; color: var(--ink); line-height: 1.4; }
.np-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 3px;
}
.np-time { font-size: 12px; color: var(--ink3); font-family: 'DM Mono', monospace; }
.np-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 5px;
}
.np-del {
  display: none;
  background: none; border: none;
  color: var(--ink3); font-size: 12px;
  cursor: pointer; padding: 1px 4px;
  border-radius: 4px; line-height: 1;
  transition: color 0.12s, background 0.12s;
  flex-shrink: 0;
}
.np-row:hover .np-del { display: block; }
.np-del:hover { color: var(--red); background: rgba(226,75,74,0.1); }
.np-empty { padding: 24px 16px; text-align: center; color: var(--ink3); font-size: 15px; }
.np-loading { padding: 16px; text-align: center; color: var(--ink3); font-size: 14px; }

/* ── Voice icons in sidebar ──────────────────────────────────────────────────*/
.ch-voice-icons { margin-left: auto; display: flex; gap: 3px; }
.ch-voice-icon {
  font-size: 13px; cursor: pointer;
  opacity: 0.7; border-radius: 4px;
  padding: 1px 3px;
  transition: opacity 0.13s, background 0.13s;
}
.ch-voice-icon:hover { opacity: 1; background: var(--sidebar-hover-bg); }
.ch-voice-icon.screen, .ch-voice-icon.cam { color: var(--accent2); opacity: 1; }

/* ── Stream viewer popup ─────────────────────────────────────────────────────*/
.stream-viewer-modal {
  background: #000;
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  width: 90vw;
  max-width: 1200px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
  overflow: hidden;
}
.sv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-weight: 700;
  font-size: 15px;
  color: rgba(255,255,255,0.9);
  flex-shrink: 0;
  background: #111;
}
.sv-body {
  flex: 1;
  background: #000;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.sv-body video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  flex: 1;
  min-height: 0;
}

/* ── Group settings bar ──────────────────────────────────────────────────────*/
/* ── Group header ────────────────────────────────────────────────────────────*/
.group-header-row {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  height: 52px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--sidebar-border);
  position: relative;
}
.group-header-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: var(--paper2);
  overflow: hidden;
}
.group-header-icon img {
  width: 100%; height: 100%; object-fit: cover;
}
.group-header-info {
  flex: 1; min-width: 0;
}
.group-header-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--sidebar-text);
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.group-header-meta {
  font-size: 10px;
  color: var(--sidebar-text);
  opacity: 0.35;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 1px;
}
.group-header-menu-btn {
  background: none; border: none;
  color: var(--sidebar-text);
  opacity: 0.4;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: opacity 0.13s, background 0.13s;
  line-height: 1;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}
.group-header-menu-btn:hover { opacity: 1; background: var(--sidebar-hover-bg); }

.group-header-menu {
  position: absolute;
  top: 100%; left: 14px; right: 14px;
  background: var(--paper2);
  border: 1px solid var(--rule);
  border-radius: 9px;
  padding: 4px;
  z-index: 300;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  animation: ctxIn 0.1s ease;
}
.group-header-menu-item {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--ink3);
  cursor: pointer;
  transition: background 0.1s;
  display: flex; align-items: center; gap: 8px;
}
.group-header-menu-item:hover { background: var(--paper3); color: var(--ink); }

/* ── Group settings modal ────────────────────────────────────────────────────*/
.modal-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink3);
  font-family: 'DM Mono', monospace;
  display: block;
  margin-bottom: 6px;
}
.modal-input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  background: var(--paper2);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  outline: none;
  box-sizing: border-box;
}
.modal-input:focus { border-color: var(--accent); }
.modal-btn-primary {
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.modal-btn-primary:hover { opacity: 0.85; }
.modal-btn-secondary {
  padding: 8px 16px;
  background: var(--paper2);
  color: var(--ink3);
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all 0.15s;
}
.modal-btn-secondary:hover { background: var(--paper3); }
.modal-btn-danger {
  padding: 8px 16px;
  background: none;
  color: var(--red);
  border: 1.5px solid var(--red);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all 0.15s;
}
.modal-btn-danger:hover { background: var(--red); color: white; }
.gs-vis-btn {
  flex: 1;
  padding: 8px;
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  background: none;
  color: var(--ink3);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.gs-vis-btn:hover { background: var(--paper2); color: var(--ink); }
.gs-vis-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

/* ── Channel drag reorder ────────────────────────────────────────────────────*/
.ch-item[draggable="true"] { cursor: grab; }
.ch-item[draggable="true"]:active { cursor: grabbing; }
.ch-item.dragging { opacity: 0.4; }
.ch-item.drag-over {
  background: var(--accent);
  opacity: 0.7;
  border-radius: 6px;
}

/* ── Subchannel indicator ────────────────────────────────────────────────────*/
.ch-sub-indicator {
  width: 14px;
  flex-shrink: 0;
  display: inline-block;
  color: var(--ink3);
  font-size: 12px;
  opacity: 0.5;
  line-height: 1;
}

/* ── Channel children collapse ───────────────────────────────────────────────*/
.ch-children { overflow: hidden; }
.ch-children.collapsed { display: none; }

/* ===== CATEGORIES ===== */
.cat-node { user-select: none; }
.cat-divider {
  height: 1px;
  background: var(--sidebar-border);
  margin: 6px 10px;
}
.cat-header {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px 2px;
  cursor: pointer;
  border-radius: 5px;
  transition: background 0.12s;
}
.cat-header:hover { background: var(--sidebar-hover-bg); }
.cat-toggle {
  font-size: 8px;
  color: var(--ink3);
  flex-shrink: 0;
  width: 10px;
}
.cat-name {
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  color: var(--sidebar-text);
  opacity: 0.75;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cat-add-btn {
  background: none; border: none;
  color: var(--ink3); cursor: pointer;
  font-size: 16px; line-height: 1;
  padding: 0 2px; border-radius: 3px;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s;
}
.cat-header:hover .cat-add-btn { opacity: 1; }
.cat-add-btn:hover { color: var(--ink); }
.cat-channels { padding-left: 0; }
.cat-dragging { opacity: 0.4; }
.cat-drag-over > .cat-header { background: var(--sidebar-active-bg); }
.cat-top-drop {
  height: 4px; margin: 2px 10px;
  border-radius: 2px;
  transition: all 0.15s;
}
.cat-top-drop-active {
  height: 8px;
  background: var(--accent2);
  opacity: 0.6;
}


/* ===== RESIZABLE SIDEBAR ===== */
.sidebar { position: relative; }
.sidebar-resize-handle {
  position: absolute;
  top: 0;
  left: calc(var(--sidebar-w) - 3px);
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 100;
  background: transparent;
  transition: background 0.15s;
}
.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
  background: var(--accent2);
  opacity: 0.5;
}

/* ===== SPLIT VIEW ===== */
#chat-view {
  display: flex !important;
  flex-direction: row !important;
  flex: 1;
  overflow: hidden;
}

.split-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

#pane-primary {
  flex: 1;
  min-width: 300px;
}

#pane-secondary {
  flex: 1;
  min-width: 300px;
  flex-direction: row;
  border-left: 2px solid var(--rule);
}

.split-pane-secondary {
  border-left: 2px solid var(--rule);
}

/* Focus highlight — shown when voice/cam/stream active in that pane */
.split-pane.split-focused > .channel-bar {
  border-top: 2px solid var(--accent2);
}

.split-close-btn {
  background: none; border: none;
  color: var(--ink3); cursor: pointer;
  font-size: 14px; padding: 4px 6px;
  border-radius: 5px;
  transition: color 0.12s, background 0.12s;
}
.split-close-btn:hover { color: var(--red); background: rgba(226,75,74,0.1); }

/* Pane divider */
.split-divider {
  width: 4px;
  background: var(--rule);
  flex-shrink: 0;
  cursor: col-resize;
  transition: background 0.15s;
  display: none;
}
.split-divider:hover { background: var(--accent2); }

/* Split view — inactive pane's selected channel is dimmer than active pane */
.split-pane-inactive .ch-item.active,
.split-pane-inactive .ch-item[data-active="true"] {
  background: var(--sidebar-hover-bg);
  opacity: 0.7;
}

/* Secondary sidebar right-edge resize handle */
.sidebar-resize-handle-right {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 100;
  background: transparent;
  transition: background 0.15s;
}
.sidebar-resize-handle-right:hover,
.sidebar-resize-handle-right.dragging {
  background: var(--accent2);
  opacity: 0.5;
}

/* Split view — active pane channel is full brightness, inactive is dimmed */
#pane-secondary.split-pane-inactive .ch-item.active,
#pane-primary.split-pane-inactive .ch-item.active {
  background: var(--sidebar-hover-bg) !important;
  opacity: 0.6;
}
