:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.15);
  
  /* Light mode dynamic gradient mesh */
  --bg-color1: #f1f5f9;
  --bg-color2: #e2e8f0;
  --bg-color3: #cbd5e1;
  
  --panel: rgba(255, 255, 255, 0.6);
  --panel-2: rgba(255, 255, 255, 0.4);
  --border: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  
  --radius: 12px;
  --radius-lg: 20px;
  --radius-bubble: 14px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --sidebar-w: 340px;
}

[data-theme="dark"] {
  --primary: #60a5fa;
  --primary-dark: #3b82f6;
  --primary-light: rgba(96, 165, 250, 0.15);
  
  /* Dark mode dynamic gradient mesh */
  --bg-color1: #0f172a;
  --bg-color2: #1e293b;
  --bg-color3: #020617;
  
  --panel: rgba(30, 41, 59, 0.6);
  --panel-2: rgba(15, 23, 42, 0.5);
  --border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  
  --text: #f8fafc;
  --text-2: #cbd5e1;
  --text-3: #64748b;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  height: 100dvh;
  -webkit-font-smoothing: antialiased;
  
  /* Animated gradient background */
  background: linear-gradient(120deg, var(--bg-color1), var(--bg-color2), var(--bg-color3), var(--bg-color1));
  background-size: 300% 300%;
  animation: gradientBG 20s ease infinite;
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

/* Glassmorphism Shell */
.shell {
  display: flex;
  height: 96dvh;
  max-width: 1400px;
  margin: 2dvh auto;
  background: var(--panel);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

@media (max-width: 1440px) {
  .shell {
    margin: 0;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--panel-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: margin-left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.sidebar.collapsed {
  margin-left: calc(0px - var(--sidebar-w));
}

.sidebar-head {
  padding: 28px 24px 22px;
  background: transparent;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}
.logo h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.logo p {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav-btn {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  padding: 14px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-btn:hover {
  background: var(--panel);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.nav-btn:active { transform: scale(0.98); }
.nav-btn.active { background: var(--panel); font-weight: 600; color: var(--primary); }
.nav-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; background: transparent !important; }
.nav-btn svg { flex-shrink: 0; }
.nav-btn.danger { color: #ef4444; }
.nav-btn.danger:hover { background: rgba(239, 68, 68, 0.1); }
.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 6px;
}
.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  padding: 4px 14px;
  font-weight: 700;
}
.sidebar-footer {
  padding: 16px 20px;
  font-size: 12px;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  text-align: center;
  background: transparent;
  flex-shrink: 0;
}
.sidebar-footer a {
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
.sidebar-footer a:hover {
  color: var(--primary);
}

/* ── Workspace ── */
.workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
}
.topbar {
  height: 68px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  z-index: 10;
}
.peer-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}
.topbar-info { flex: 1; min-width: 0; }
.topbar-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-status {
  font-size: 13px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}
.status-dot.live {
  background: #10b981;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-light);
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.topbar-actions {
  display: none;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); transform: scale(1.05); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* ── Content Area ── */
.content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ── Setup ── */
.setup {
  flex: 1;
  overflow-y: auto;
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: center;
  animation: viewFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.setup-inner {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.welcome {
  text-align: center;
  padding: 16px 0;
}
.welcome h2 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -0.03em;
}
.welcome p {
  font-size: 16px;
  color: var(--text-2);
  max-width: 460px;
  margin: 0 auto;
  line-height: 1.6;
}

.role-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.role-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  color: var(--text);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.03);
}
.role-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.1);
  transform: translateY(-4px);
}
.role-btn:active { transform: scale(0.98); }
.role-btn.sel {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
}
.role-btn .icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--primary);
  transition: background 0.3s;
}
.role-btn.sel .icon { background: #fff; }
[data-theme="dark"] .role-btn.sel .icon { background: var(--panel); }
.role-btn b {
  display: block;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}
.role-btn span {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
}

.step { display: none; flex-direction: column; gap: 16px; }
.step.on { display: flex; animation: viewFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.step-card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
}
.step-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.step-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.invite-share {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px;
  align-items: start;
}
@media (max-width: 600px) {
  .invite-share { grid-template-columns: 1fr; justify-items: center; }
}
.qr-wrap { text-align: center; }
.qr-frame {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: inline-block;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}
.qr-frame canvas {
  display: block;
  width: 180px;
  height: 180px;
  image-rendering: pixelated;
}
.qr-frame.qr-fail {
  width: 214px;
  height: 214px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
}
.qr-fail-msg {
  font-size: 13px;
  color: var(--text-2);
  padding: 16px;
  text-align: center;
  line-height: 1.5;
}
.qr-label {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 14px;
  font-weight: 600;
}

.code-wrap { min-width: 0; width: 100%; position: relative; }
.setup {
  max-width: 520px;
  width: 100%;
  margin: auto 0;
}

/* IP Warning Pill */
.ip-warning {
  margin-left: auto;
  margin-right: 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: help;
  backdrop-filter: blur(10px);
}
.ip-warning:hover {
  background: rgba(239, 68, 68, 0.2);
}
.ip-tooltip {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 240px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-2);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-5px);
  transition: all 0.2s;
  text-align: left;
  line-height: 1.5;
  font-weight: 400;
}
.ip-warning:hover .ip-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.code-wrap label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 16px;
  resize: vertical;
  min-height: 120px;
  word-break: break-all;
  line-height: 1.6;
  transition: all 0.2s ease;
}
textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--primary-light);
}
textarea[readonly] { color: var(--text-2); }

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.btn {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.1); }
.btn:active { transform: scale(0.97); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.hint { font-size: 13px; color: var(--text-3); }
.copied {
  font-size: 13px;
  color: #10b981;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: viewFadeIn 0.3s ease;
}

/* ── Chat ── */
.chat { flex: 1; display: none; flex-direction: column; min-height: 0; }
.chat.on { display: flex; animation: viewFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1); }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 8%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: transparent;
}
.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }
[data-theme="dark"] .messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); }

.msg-row {
  display: flex;
  margin-bottom: 4px;
  animation: bounceUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}
@keyframes bounceUp {
  from { opacity: 0; transform: translateY(15px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.msg-row.me { justify-content: flex-end; }
.msg-row.them { justify-content: flex-start; }

.bubble-wrap {
  max-width: 65%;
  display: flex;
  flex-direction: column;
}
.msg-row.me .bubble-wrap { align-items: flex-end; }
.msg-row.them .bubble-wrap { align-items: flex-start; }

.bubble {
  padding: 10px 14px 12px;
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.bubble-text { white-space: pre-wrap; }

.msg-row.me .bubble {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
}
.msg-row.them .bubble {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
}

.bubble-img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 6px;
  display: block;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.bubble-file {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.1);
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  font-weight: 600;
  margin-top: 4px;
  transition: transform 0.2s, background 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.bubble-file:hover {
  transform: translateY(-2px);
  background: var(--panel-2);
}
.msg-row.me .bubble-file:hover {
  background: rgba(255,255,255,0.2);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}
.progress-info strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.progress-bar-wrap {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.1s linear;
}
.msg-row.me .progress-bar-wrap { background: rgba(0,0,0,0.15); }
.msg-row.me .progress-bar { background: #fff; }

.msg-copy-btn {
  background: rgba(0,0,0,0.05);
  border: none;
  border-radius: 50%;
  color: inherit;
  opacity: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: all 0.2s ease;
  margin-right: 6px;
}
.setup-view {
  position: relative;
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px;
  background: transparent;
  overflow-y: auto;
}
.msg-row.me .msg-copy-btn { background: rgba(255,255,255,0.2); }
.bubble-wrap:hover .msg-copy-btn { opacity: 0.8; }
.msg-copy-btn:hover { opacity: 1 !important; transform: scale(1.1); }

.bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  float: right;
  margin-left: 16px;
  position: relative;
  top: 4px;
}
.bubble-time {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
}
.msg-row.me .bubble-time { color: rgba(255, 255, 255, 0.7); }

.sys {
  align-self: center;
  margin: 16px 0;
  max-width: 85%;
  text-align: center;
}
.sys-pill {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12.5px;
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  line-height: 1.45;
  backdrop-filter: blur(8px);
}
.sys-pill strong { color: var(--text); font-weight: 700; }

/* ── Composer ── */
.composer {
  flex-shrink: 0;
  padding: 16px 24px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  gap: 12px;
  z-index: 10;
}
#attachBtn {
  margin-bottom: 2px;
}
.composer-box {
  flex: 1;
  background: var(--panel-2);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  min-height: 48px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}
.composer-box:focus-within {
  border-color: var(--primary);
  background: var(--panel);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.1);
}
.composer textarea {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  min-width: 0;
  resize: none;
  padding: 0;
  max-height: 120px;
  overflow-y: auto;
  height: 22px; 
  line-height: 1.45;
}
.composer textarea:focus {
  outline: none;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.composer textarea::placeholder { color: var(--text-3); font-weight: 400; }
.composer textarea:disabled { opacity: 0.5; }

.send-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.send-btn:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-2px) scale(1.05); box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4); }
.send-btn:active:not(:disabled) { transform: scale(0.95); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; background: var(--panel-2); color: var(--text-3); }

/* ── Docs page ── */
.docs {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.docs.on { display: flex; animation: viewFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.docs-header {
  padding: 24px 32px 20px;
  background: transparent;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  gap: 20px;
}
.docs-back {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: all 0.2s ease;
}
.docs-back:hover { transform: translateX(-4px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); background: var(--primary); color: #fff; }
.docs-header-text { flex: 1; }
.docs-header h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.docs-header p {
  font-size: 15px;
  color: var(--text-2);
}
.docs-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 32px 48px;
}
.docs-inner {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.doc-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
  transition: transform 0.3s ease;
}
.doc-card:hover { transform: translateY(-2px); }
.doc-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.doc-card h3 .doc-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.doc-card p, .doc-card li {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.6;
}
.doc-card ul, .doc-card ol {
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.doc-card li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.doc-card ul li::before {
  content: "✓";
  color: var(--primary);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.doc-card ol { counter-reset: step; }
.doc-card ol li { counter-increment: step; }
.doc-card ol li::before {
  content: counter(step);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0;
}

@media (max-width: 900px) {
  .shell { margin: 0; height: 100dvh; border-radius: 0; border: none; }
  .sidebar {
    position: absolute;
    width: 100%;
    --sidebar-w: 100%;
    z-index: 100;
    height: 100%;
    background: var(--panel);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    box-shadow: none;
  }
  .sidebar.collapsed {
    margin-left: -100%;
  }
  .sidebar-head { padding: 20px 16px 16px; }
  .nav-btn { padding: 16px 20px; font-size: 16px; margin-bottom: 4px; }
  .topbar { padding: 0 16px; height: 64px; }
  .topbar-actions { display: flex; }
  .role-pick { grid-template-columns: 1fr; }
  .messages { padding: 16px 4%; }
  .bubble-wrap { max-width: 85%; }
  .docs-header, .docs-body { padding: 16px; }
  .setup { padding: 20px 16px; }
  .mobile-close-btn { display: flex !important; width: 44px; height: 44px; justify-content: center; align-items: center; border-radius: 50%; background: var(--panel-2); border: none; }
}

@media (max-width: 480px) {
  .welcome h2 { font-size: 26px; }
  .welcome p { font-size: 15px; }
  .step-card { padding: 20px; }
  .composer { padding: 12px; }
  .bubble-wrap { max-width: 92%; }
  #publicIpTxt { display: none; }
  .ip-warning { padding: 8px; border-radius: 50%; }
}
