/* ═══════════════════════════════════════════════════════════════
   MESHCUE — Nana Banana 2 Theme
   Premium dark glassmorphic · Cyan / Indigo / Purple glow
   AI Shield · Rewards · Family Mesh · Bluetooth
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg-primary: #060a13;
  --bg-secondary: #0c1220;
  --bg-card: rgba(12, 18, 32, 0.65);
  --bg-card-hover: rgba(12, 18, 32, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.14);

  --text-primary: #e8edf5;
  --text-secondary: #8b9bb8;
  --text-muted: #546280;

  /* Nana Banana 2 Glow Palette */
  --accent: #06d6a0;
  /* primary green-cyan  */
  --accent-dim: rgba(6, 214, 160, 0.12);
  --accent-glow: rgba(6, 214, 160, 0.35);
  --accent-bright: #34eed0;
  --cyan: #06b6d4;
  --cyan-dim: rgba(6, 182, 212, 0.12);
  --cyan-glow: rgba(6, 182, 212, 0.35);
  --indigo: #6366f1;
  --indigo-dim: rgba(99, 102, 241, 0.12);
  --indigo-glow: rgba(99, 102, 241, 0.35);
  --purple: #8b5cf6;
  --purple-dim: rgba(139, 92, 246, 0.12);
  --purple-glow: rgba(139, 92, 246, 0.35);

  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --info: #3b82f6;

  /* Neon edge gradients */
  --neon-edge: linear-gradient(90deg, var(--cyan), var(--indigo), var(--purple));
  --neon-glow: linear-gradient(135deg, var(--cyan), var(--indigo), var(--purple));

  --sidebar-width: 220px;
  --radius: 14px;
  --radius-sm: 10px;
  --blur: 40px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
  display: flex;
  position: relative;
}

/* Animated mesh grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(6, 182, 212, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse at 60% 80%, rgba(139, 92, 246, 0.04) 0%, transparent 60%);
  animation: bg-drift 20s ease-in-out infinite alternate;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.04;
  background-image:
    linear-gradient(rgba(6, 182, 212, 0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6, 182, 212, 0.3) 1px, transparent 1px);
  background-size: 60px 60px;
}

@keyframes bg-drift {
  0% {
    background-position: 0% 0%;
  }

  100% {
    background-position: 100% 100%;
  }
}

/* ─── Sidebar ─── */

#sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: rgba(8, 12, 24, 0.85);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-right: 1px solid rgba(99, 102, 241, 0.1);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 24px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.1);
  margin-bottom: 24px;
}

.brand-icon {
  font-size: 22px;
  color: var(--cyan);
  text-shadow: 0 0 20px var(--cyan-glow);
}

.brand-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, var(--cyan), var(--indigo));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.nav-link.active {
  color: var(--cyan);
  background: var(--cyan-dim);
  border-left: 3px solid var(--cyan);
  box-shadow: -4px 0 16px rgba(6, 182, 212, 0.15);
}

.nav-link.active svg {
  filter: drop-shadow(0 0 6px var(--cyan-glow));
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.node-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan-glow);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    box-shadow: 0 0 4px var(--cyan-glow);
  }

  50% {
    box-shadow: 0 0 14px var(--cyan-glow);
  }
}

/* ─── Main Content ─── */

#content {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  padding: 32px 40px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  position: relative;
  z-index: 1;
}

#content::-webkit-scrollbar {
  width: 6px;
}

#content::-webkit-scrollbar-track {
  background: transparent;
}

#content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Headers ─── */

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.view-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-badge {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 20px;
  font-family: 'SF Mono', monospace;
}

.header-actions {
  display: flex;
  gap: 8px;
}

/* ─── Cards ─── */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  transition: var(--transition);
  position: relative;
}

/* NB2 neon top-edge border */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: var(--neon-edge);
  opacity: 0.4;
  border-radius: 1px;
  transition: opacity var(--transition);
}

.card:hover {
  border-color: rgba(99, 102, 241, 0.15);
  background: var(--bg-card-hover);
  box-shadow: 0 4px 30px rgba(6, 182, 212, 0.05);
}

.card:hover::before {
  opacity: 0.8;
}

.card-wide {
  margin-bottom: 16px;
}

.card-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ─── AI Shield Banner ─── */

.card-shield {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08), rgba(99, 102, 241, 0.04));
  border-color: rgba(6, 182, 212, 0.2);
  position: relative;
  overflow: hidden;
}

.card-shield::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--cyan-glow) 0%, transparent 70%);
  opacity: 0.3;
  pointer-events: none;
}

.shield-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.shield-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.shield-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 10px var(--accent-glow));
}

.shield-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 2px;
}

.shield-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.shield-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shield-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  min-width: 50px;
}

/* ─── Toggle Switch ─── */

.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: var(--transition);
}

.toggle input:checked+.toggle-slider {
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-glow);
}

.toggle input:checked+.toggle-slider::before {
  transform: translateX(20px);
  background: #fff;
}

/* ─── Storage Gauge ─── */

.card-storage {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gauge-container {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 8px 0 12px;
}

.gauge-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge-bg {
  stroke: var(--border);
}

.gauge-fill {
  stroke: var(--cyan);
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 0 6px var(--cyan-glow));
}

.gauge-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.gauge-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.gauge-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.gauge-footer {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ─── Stat Cards ─── */

.stat-value {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.card-mesh .stat-value {
  background: linear-gradient(135deg, var(--cyan), var(--accent-bright));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.mesh-mini {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.credit-label {
  font-size: 11px;
  color: var(--text-muted);
}

.credit-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  float: right;
}

/* ─── Info Card ─── */

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.info-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.info-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.mono {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
}

/* ─── Buttons ─── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-primary {
  background: var(--neon-glow);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 12px;
}

.btn-primary:hover {
  box-shadow: 0 0 24px var(--cyan-glow), 0 0 60px rgba(99, 102, 241, 0.15);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: rgba(99, 102, 241, 0.15);
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: rgba(6, 182, 212, 0.3);
  background: var(--cyan-dim);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.1);
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

/* ─── Drop Zone ─── */

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  margin-bottom: 20px;
  transition: var(--transition);
  cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.drop-zone.drag-over {
  transform: scale(1.01);
}

.drop-zone-content p {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-muted);
}

.drop-sub {
  font-size: 12px !important;
  color: var(--accent) !important;
  opacity: 0.7;
}

/* ─── Upload Progress ─── */

.upload-progress {
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px var(--accent-glow);
}

.progress-text {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── File List ─── */

.file-list-empty,
.peer-list-empty,
.device-list-empty {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.file-item:last-child {
  border-bottom: none;
}

.file-item:hover {
  background: var(--bg-glass);
}

.file-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
  font-size: 14px;
}

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

.file-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.file-actions {
  display: flex;
  gap: 8px;
}

.file-btn {
  padding: 6px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition);
}

.file-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.file-btn.delete:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* ─── Credits ─── */

.card-credits {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(16, 185, 129, 0.02));
  border-color: rgba(16, 185, 129, 0.15);
}

.credits-grid {
  display: flex;
  align-items: center;
  gap: 24px;
}

.credit-block {
  flex: 1;
  text-align: center;
}

.credit-amount {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.credit-positive {
  color: var(--accent);
}

.credit-negative {
  color: var(--warning);
}

.credit-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.credit-divider {
  width: 1px;
  height: 48px;
  background: var(--border);
}

/* ─── Mesh Bar ─── */

.mesh-bar-container {
  margin-top: 8px;
}

.mesh-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.mesh-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: 4px;
  transition: width 0.5s ease;
  box-shadow: 0 0 8px var(--accent-glow);
}

.mesh-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Invite Card ─── */

.card-invite {
  border-color: rgba(139, 92, 246, 0.2);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.06), rgba(139, 92, 246, 0.02));
}

.invite-code-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

.invite-code-box code {
  flex: 1;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  color: var(--purple);
  word-break: break-all;
}

/* ─── Peer List ─── */

.peer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.peer-item:last-child {
  border-bottom: none;
}

.peer-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.peer-dot.online {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

.peer-dot.offline {
  background: var(--danger);
}

.peer-dot.discovered {
  background: var(--warning);
}

.peer-info {
  flex: 1;
}

.peer-id {
  font-size: 13px;
  font-weight: 500;
  font-family: 'SF Mono', monospace;
}

.peer-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.peer-stats {
  text-align: right;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ─── Rewards & Achievements ─── */

.rewards-grid {
  grid-template-columns: repeat(3, 1fr);
}

.reward-points {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.achievements {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.achievement {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.achievement:hover {
  background: var(--bg-glass);
}

.achievement.locked {
  opacity: 0.4;
}

.achievement.unlocked {
  opacity: 1;
}

.achievement-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  flex-shrink: 0;
}

.achievement.unlocked .achievement-icon {
  background: var(--accent-dim);
  box-shadow: 0 0 12px var(--accent-glow);
}

.achievement-info {
  flex: 1;
}

.achievement-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.achievement-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Bluetooth Card ─── */

.card-bluetooth {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(59, 130, 246, 0.02));
  border-color: rgba(59, 130, 246, 0.2);
}

.card-bluetooth .shield-icon {
  filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.4));
}

.card-bluetooth .shield-title {
  color: var(--info);
}

.card-bluetooth .shield-status {
  color: var(--info);
}

/* ─── QR Code ─── */

.qr-container {
  display: flex;
  justify-content: center;
  padding: 20px;
}

.qr-container img {
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.qr-loading {
  color: var(--text-muted);
  font-size: 14px;
}

/* ─── Danger Card ─── */

.card-danger {
  border-color: rgba(239, 68, 68, 0.15);
}

/* ─── Install Banner ─── */

.card-install {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.06), rgba(139, 92, 246, 0.02));
  border-color: rgba(139, 92, 246, 0.2);
}

.card-install .shield-icon {
  filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.4));
}

.card-install .shield-title {
  color: var(--purple);
}

/* ─── Responsive ─── */

@media (max-width: 768px) {
  #sidebar {
    width: 60px;
    padding: 16px 8px;
  }

  .brand-text,
  .nav-link span,
  .sidebar-footer span {
    display: none;
  }

  .sidebar-brand {
    justify-content: center;
    padding: 0 0 16px;
  }

  .nav-link {
    justify-content: center;
    padding: 10px;
  }

  #content {
    padding: 20px 16px;
  }

  .view-header h1 {
    font-size: 22px;
  }

  .card-grid {
    grid-template-columns: 1fr 1fr;
  }

  .rewards-grid {
    grid-template-columns: 1fr;
  }

  .credits-grid {
    flex-direction: column;
    gap: 12px;
  }

  .credit-divider {
    width: 48px;
    height: 1px;
  }

  .shield-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .header-actions {
    flex-direction: column;
  }
}

/* ─── Mesh Topology Canvas ─── */

.card-topology {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.03), rgba(59, 130, 246, 0.03));
  border-color: rgba(16, 185, 129, 0.1);
  overflow: hidden;
}

#mesh-canvas {
  width: 100%;
  height: 320px;
  display: block;
  border-radius: var(--radius-sm);
}

/* ─── Pool Storage Bars ─── */

.pool-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pool-bar-item {
  padding: 8px 0;
}

.pool-bar-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.pool-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.pool-amount {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'SF Mono', monospace;
}

.pool-total {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-secondary);
}

.pool-total strong {
  color: var(--accent-bright);
  font-size: 16px;
}

/* ─── Approval Cards ─── */

.card-approval {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(245, 158, 11, 0.02));
  border-color: rgba(245, 158, 11, 0.25);
  animation: pulse-border 2s infinite;
}

.card-approval .shield-title {
  color: var(--warning);
}

@keyframes pulse-border {

  0%,
  100% {
    border-color: rgba(245, 158, 11, 0.15);
  }

  50% {
    border-color: rgba(245, 158, 11, 0.35);
  }
}

.pending-peer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.pending-peer:last-child {
  border-bottom: none;
}

.pending-peer-info {
  flex: 1;
}

.pending-peer-id {
  font-size: 13px;
  font-weight: 600;
  font-family: 'SF Mono', monospace;
}

.pending-peer-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.pending-peer-actions {
  display: flex;
  gap: 8px;
}

/* ─── File Source Selector ─── */

.select-source {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.select-source:hover {
  border-color: var(--border-hover);
}

.select-source:focus {
  outline: none;
  border-color: var(--accent);
}

/* ─── Device Manager ─── */

.card-this-device {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.06), rgba(16, 185, 129, 0.01));
  border-color: rgba(16, 185, 129, 0.15);
}

.device-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.device-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--cyan-dim);
  border: 2px solid var(--cyan);
  flex-shrink: 0;
}

.device-avatar.device-self {
  background: linear-gradient(135deg, var(--cyan-dim), rgba(6, 182, 212, 0.25));
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.2);
}

.device-avatar.device-peer {
  background: var(--indigo-dim);
  border-color: var(--indigo);
}

.device-info {
  flex: 1;
}

.device-name {
  font-weight: 600;
  font-size: 15px;
}

.device-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.device-os {
  color: var(--text-secondary);
}

.device-stats {
  display: flex;
  gap: 20px;
}

.device-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.device-stat-value {
  font-size: 15px;
  font-weight: 700;
}

.device-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.device-status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.device-status-badge.online {
  background: var(--cyan-dim);
  color: var(--cyan);
}

.device-status-badge.offline {
  background: var(--danger-dim);
  color: var(--danger);
}

.device-status-badge.pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.device-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.device-item:last-child {
  border-bottom: none;
}

/* Add Device Form */

.add-device-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.input {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  font-size: 13px;
  font-family: var(--font);
  transition: var(--transition);
  flex: 1;
  min-width: 120px;
}

.input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15), 0 0 12px rgba(6, 182, 212, 0.1);
}

.input-sm {
  max-width: 80px;
  flex: 0;
}

/* ─── Quick View Modal ─── */

/* ─── Ensure modals respect hidden attribute ─── */
#share-overlay[hidden],
#quickview-overlay[hidden] {
  display: none !important;
}

.quickview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.quickview-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 860px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0;
  position: relative;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.quickview-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  z-index: 10;
  transition: var(--transition);
}

.quickview-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.quickview-content {
  padding: 24px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quickview-content img {
  max-width: 100%;
  max-height: 65vh;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.quickview-content pre {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  overflow-x: auto;
  max-height: 60vh;
}

.quickview-content video,
.quickview-content audio {
  max-width: 100%;
  border-radius: var(--radius-sm);
}

.quickview-content audio {
  width: 100%;
}

.quickview-meta {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.quickview-meta-item {}

.quickview-meta-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.quickview-meta-value {
  font-size: 13px;
  margin-top: 2px;
}

.quickview-actions {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.redundancy-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.redundancy-1x {
  background: var(--danger-dim);
  color: var(--danger);
}

.redundancy-2x {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.redundancy-3x {
  background: var(--accent-dim);
  color: var(--accent-bright);
}

/* ─── Share Modal ─── */

.share-modal {
  max-width: 500px;
}

.share-content {
  padding: 32px 24px;
}

.share-content h3 {
  font-size: 20px;
  margin-bottom: 12px;
}

.share-expiry {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.share-expiry label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ─── Activity Feed ─── */

.activity-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-bright);
}

.activity-feed {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.activity-icon.upload {
  background: var(--accent-dim);
}

.activity-icon.mesh {
  background: rgba(59, 130, 246, 0.15);
}

.activity-icon.device {
  background: var(--purple-dim);
}

.activity-icon.share {
  background: rgba(245, 158, 11, 0.15);
}

.activity-icon.system {
  background: rgba(255, 255, 255, 0.05);
}

.activity-text {
  flex: 1;
}

.activity-title {
  font-size: 13px;
  font-weight: 500;
}

.activity-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.activity-preview {
  max-height: 220px;
  overflow-y: auto;
}

.activity-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 24px 0;
}

/* ─── Mesh Health Rings ─── */

.health-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  text-align: center;
}

.health-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.health-ring {
  width: 64px;
  height: 64px;
  position: relative;
}

.health-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.health-ring span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  font-weight: 700;
}

.health-ring-bg {
  stroke: rgba(255, 255, 255, 0.06);
}

.health-ring-fill {
  stroke: var(--accent);
  transition: stroke-dasharray 0.6s ease;
}

.health-fill-blue {
  stroke: #3b82f6;
}

.health-fill-purple {
  stroke: #8b5cf6;
}

.health-fill-amber {
  stroke: #f59e0b;
}

.health-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─── Sync Folders ─── */

.sync-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.sync-item:last-child {
  border-bottom: none;
}

.sync-icon {
  font-size: 20px;
}

.sync-info {
  flex: 1;
}

.sync-path {
  font-size: 13px;
  font-family: 'SF Mono', monospace;
}

.sync-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.sync-status {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.sync-status.synced {
  background: var(--accent-dim);
  color: var(--accent-bright);
}

.sync-status.syncing {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.sync-empty {
  font-size: 13px;
  color: var(--text-muted);
  padding: 12px 0;
}

/* ─── File Redundancy Badges ─── */

.file-item {
  position: relative;
}

.file-redundancy {
  position: absolute;
  top: 8px;
  right: 80px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

@media (max-width: 768px) {
  .health-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .device-row {
    flex-wrap: wrap;
  }

  .device-stats {
    width: 100%;
    justify-content: space-around;
  }

  .quickview-modal {
    max-height: 85vh;
  }

  .add-device-form {
    flex-direction: column;
  }

  .input-sm {
    max-width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════════
   BLE (Bluetooth Low Energy) Pairing UI
   ═══════════════════════════════════════════════════════════════ */

.btn-ble {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
}

.btn-ble:hover {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}

.btn-ble:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-ble.scanning {
  animation: ble-glow 1.5s ease-in-out infinite;
}

@keyframes ble-glow {

  0%,
  100% {
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.2);
  }

  50% {
    box-shadow: 0 0 24px rgba(59, 130, 246, 0.5);
  }
}

/* BLE Scan Card */
.card-ble-scan {
  border: 1px solid rgba(59, 130, 246, 0.2);
  background: rgba(59, 130, 246, 0.05);
}

.ble-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 4px 0;
}

.ble-icon-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ble-icon-svg {
  position: relative;
  z-index: 2;
  color: #3b82f6;
}

.ble-pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(59, 130, 246, 0.4);
  transform: translate(-50%, -50%);
  animation: ble-pulse 2s ease-out infinite;
}

.ble-pulse-ring.delay-1 {
  animation-delay: 0.5s;
}

.ble-pulse-ring.delay-2 {
  animation-delay: 1s;
}

.scanning-done .ble-pulse-ring {
  animation: none;
  opacity: 0;
}

@keyframes ble-pulse {
  0% {
    width: 24px;
    height: 24px;
    opacity: 1;
    border-width: 2px;
  }

  100% {
    width: 60px;
    height: 60px;
    opacity: 0;
    border-width: 1px;
  }
}

.ble-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.ble-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* BLE Device List */
.ble-device-list {
  margin-top: 16px;
}

.ble-device-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  transition: all var(--transition);
}

.ble-device-item:hover {
  border-color: rgba(59, 130, 246, 0.3);
  background: var(--bg-card-hover);
}

.ble-device-item.is-self {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.05);
}

.ble-device-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.ble-device-icon.ble-method {
  background: rgba(59, 130, 246, 0.15);
}

.ble-device-icon.mdns-method {
  background: rgba(139, 92, 246, 0.15);
}

.ble-device-icon.self-method {
  background: var(--accent-dim);
}

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

.ble-device-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ble-device-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.ble-signal {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
  margin-right: 8px;
}

.ble-signal-bar {
  width: 3px;
  border-radius: 1px;
  background: var(--text-muted);
  transition: all var(--transition);
}

.ble-signal-bar.active {
  background: #3b82f6;
}

.ble-signal-bar:nth-child(1) {
  height: 4px;
}

.ble-signal-bar:nth-child(2) {
  height: 8px;
}

.ble-signal-bar:nth-child(3) {
  height: 12px;
}

.ble-signal-bar:nth-child(4) {
  height: 16px;
}

.ble-signal.excellent .ble-signal-bar {
  background: var(--accent);
}

.ble-signal.good .ble-signal-bar:nth-child(-n+3) {
  background: var(--accent);
}

.ble-signal.fair .ble-signal-bar:nth-child(-n+2) {
  background: var(--warning);
}

.ble-signal.weak .ble-signal-bar:nth-child(1) {
  background: var(--danger);
}

.ble-signal.self .ble-signal-bar {
  background: var(--accent);
}

.btn-pair {
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-pair:hover {
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}

.btn-pair:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-pair.paired {
  background: var(--accent);
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════
   LOGIN WALL
   ═══════════════════════════════════════════════════════════════ */

.login-wall {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(6, 182, 212, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
}

.login-wall.hidden { display: none; }

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 32px;
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-brand-icon {
  width: 56px;
  height: 56px;
  font-size: 28px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--neon-glow);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-brand h1 {
  font-size: 28px;
  font-weight: 700;
  background: var(--neon-glow);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 8px;
}

.login-tagline {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
}

/* Auth Forms */
.auth-form {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.auth-form.active {
  display: flex;
}

.auth-form h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px;
  text-align: center;
}

.auth-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
  box-sizing: border-box;
}

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

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

.auth-btn {
  width: 100%;
  padding: 12px;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 600;
}

.auth-error {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-dim);
  color: var(--danger);
  font-size: 13px;
  text-align: center;
}

.auth-error.hidden { display: none; }

.auth-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
}

.auth-links a {
  color: var(--text-secondary);
  font-size: 13px;
  text-decoration: none;
  transition: color var(--transition);
}

.auth-links a:hover { color: var(--accent); }

.auth-desc {
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
  margin: 0;
}

.auth-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
  color: var(--text-secondary);
}

.auth-loading.hidden { display: none; }

.auth-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════
   MESSAGES VIEW
   ═══════════════════════════════════════════════════════════════ */

.msg-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  height: calc(100vh - 80px);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.msg-sidebar {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.msg-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.msg-tab {
  flex: 1;
  padding: 12px 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border-bottom: 2px solid transparent;
}

.msg-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.msg-tab:hover { color: var(--text-primary); }

.msg-conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.msg-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Chat area */
.msg-chat-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.msg-chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 14px;
}

.msg-chat-active {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.msg-chat-active.hidden { display: none; }

.msg-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 18, 32, 0.4);
  flex-shrink: 0;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--indigo-dim);
  color: var(--indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.msg-chat-header-info { flex: 1; }

.msg-chat-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.msg-chat-status {
  font-size: 12px;
  color: var(--text-muted);
}

.msg-participants {
  font-size: 11px;
  color: var(--text-muted);
}

.msg-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Message bubbles (rendered by social.js) */
.msg-messages .dm-bubble,
.msg-messages .dm-bubble-self {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.msg-messages .dm-bubble {
  align-self: flex-start;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.msg-messages .dm-bubble-self {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--indigo-dim), var(--cyan-dim));
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: var(--text-primary);
  border-bottom-right-radius: 4px;
}

/* Reply bar */
.msg-reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-glass);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.msg-reply-bar.hidden { display: none; }

.msg-reply-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 0 4px;
}

/* Typing indicator */
.msg-typing {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.msg-typing.hidden { display: none; }

.msg-typing-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingDot 1.4s infinite;
}

.msg-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.msg-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* Input bar */
.msg-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: rgba(12, 18, 32, 0.4);
  flex-shrink: 0;
}

.msg-input {
  flex: 1;
  padding: 10px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}

.msg-input:focus {
  border-color: var(--accent);
}

.msg-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.msg-send-btn:hover {
  background: var(--accent-bright);
  transform: scale(1.05);
}

/* Message Overlays */
.msg-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
}

.msg-overlay.hidden { display: none; }

.msg-overlay-card {
  width: 100%;
  max-width: 400px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.msg-overlay-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text-primary);
}

.msg-overlay-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
}

.msg-search-results {
  max-height: 240px;
  overflow-y: auto;
}

/* Conversation list items (rendered by social.js) */
.msg-conv-item,
.thread-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.msg-conv-item:hover,
.thread-item:hover {
  background: var(--bg-card-hover);
}

.msg-conv-item.active,
.thread-item.active {
  background: var(--accent-dim);
}

/* ═══════════════════════════════════════════════════════════════
   PROFILE VIEW
   ═══════════════════════════════════════════════════════════════ */

.profile-container {
  padding: 0;
  min-height: calc(100vh - 80px);
}

.profile-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--text-muted);
  font-size: 14px;
}

.profile-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--indigo));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  margin: 0 auto;
}

/* Sidebar profile link */
.nav-link-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  transition: all var(--transition);
}

.nav-link-profile:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.profile-avatar-small {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--indigo));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Logout button */
.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-logout:hover {
  color: var(--danger);
  background: var(--danger-dim);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Messages
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .msg-layout {
    grid-template-columns: 1fr;
    height: calc(100vh - 60px);
  }

  .msg-sidebar {
    border-right: none;
    max-height: 40vh;
  }

  .login-container {
    padding: 20px;
  }
}