:root {
  --bg: #050a14;
  --bg-grid: rgba(56, 189, 248, 0.035);
  --surface: rgba(11, 19, 36, 0.92);
  --surface-2: #0f1b33;
  --surface-3: #142443;
  --border: rgba(56, 189, 248, 0.14);
  --border-strong: rgba(56, 189, 248, 0.34);
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --primary: #0ea5e9;
  --primary-2: #2563eb;
  --primary-glow: rgba(14, 165, 233, 0.25);
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.16);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.16);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.16);
  --purple: #a855f7;
  --sidebar-w: 260px;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.42);
}

body.light {
  --bg: #eef4fb;
  --bg-grid: rgba(14, 165, 233, 0.06);
  --surface: rgba(255, 255, 255, 0.95);
  --surface-2: #f8fafc;
  --surface-3: #e2e8f0;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(14, 165, 233, 0.45);
  --text: #0f172a;
  --text-dim: #475569;
  --shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

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

body {
  font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 10%, rgba(14, 165, 233, 0.16), transparent 36%),
    radial-gradient(circle at 85% 88%, rgba(37, 99, 235, 0.12), transparent 36%),
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 34px 34px, 34px 34px;
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.55;
}

.hidden { display: none !important; }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(56, 189, 248, 0.25); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(56, 189, 248, 0.45); }

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  backdrop-filter: blur(18px);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  z-index: 40;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.sb-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
}

.sb-brand-info { min-width: 0; }
.sb-brand-name {
  font-weight: 800;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-brand-sub {
  font-size: 11px;
  color: var(--primary);
  direction: ltr;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  padding: 8px 10px 6px;
  letter-spacing: 0.3px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: right;
}

.nav-item:hover {
  background: rgba(56, 189, 248, 0.08);
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 6px 20px var(--primary-glow);
}

.nav-icon { font-size: 16px; width: 22px; text-align: center; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sb-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sb-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--success);
  background: var(--surface-2);
}
.sb-user-meta { min-width: 0; }
.sb-user-name { font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-status { font-size: 11px; color: var(--success); display: flex; align-items: center; gap: 5px; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.online { background: var(--success); box-shadow: 0 0 8px var(--success); }
.dot.idle { background: var(--warning); }
.dot.dnd { background: var(--danger); }
.dot.offline { background: #64748b; }

/* Main Layout */
.main-shell {
  margin-right: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 24px;
  background: rgba(5, 10, 20, 0.72);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

body.light .topbar { background: rgba(255, 255, 255, 0.82); }

.topbar-right, .topbar-left { display: flex; align-items: center; gap: 10px; }

.global-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 6px 14px;
  width: 380px;
  max-width: 44vw;
  cursor: pointer;
  transition: border-color 0.2s;
}
.global-search:hover { border-color: var(--border-strong); }
.global-search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  width: 100%;
  cursor: pointer;
}
.global-search kbd {
  font-size: 11px;
  background: var(--surface-3);
  color: var(--text-dim);
  padding: 2px 7px;
  border-radius: 6px;
  font-family: monospace;
  white-space: nowrap;
}

.pill-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.badge-mini {
  background: rgba(14, 165, 233, 0.2);
  color: var(--primary);
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
}

.pill-btn, .icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 99px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.icon-btn { width: 34px; height: 34px; padding: 0; border-radius: 10px; font-size: 15px; }
.pill-btn:hover, .icon-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn.danger-soft { color: var(--danger); border-color: rgba(239, 68, 68, 0.35); background: var(--danger-soft); }

.mobile-only { display: none; }

.alert-banner {
  margin: 14px 24px 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fde68a;
  font-size: 13px;
}

.content {
  padding: 20px 24px 40px;
  max-width: 1540px;
  width: 100%;
  margin: 0 auto;
}

/* Cards & Headers */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 18px;
}

.page-header h1 { font-size: 20px; font-weight: 900; }
.page-header p { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.btn-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 8px; }
.btn-xs { padding: 4px 9px; font-size: 11px; border-radius: 7px; }
.btn-block { width: 100%; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.08); }

.btn-warning { background: var(--warning); color: #0f172a; }
.btn-warning:hover { filter: brightness(1.08); }

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

.btn-ghost {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--border-strong); background: var(--surface-3); }

.btn-danger-soft {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}
.btn-danger-soft:hover { background: var(--danger); color: #fff; }

.btn-success-soft {
  background: var(--success-soft);
  border-color: rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}
.btn-success-soft:hover { background: var(--success); color: #fff; }

.btn-warning-soft {
  background: var(--warning-soft);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fcd34d;
}
.btn-warning-soft:hover { background: var(--warning); color: #0f172a; }

.btn-info-soft {
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(14, 165, 233, 0.35);
  color: #7dd3fc;
}
.btn-info-soft:hover { background: var(--primary); color: #fff; }

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

/* Hero Banner (Home) */
.hero-banner {
  background: linear-gradient(125deg, #0284c7 0%, #0ea5e9 45%, #1d4ed8 100%);
  border-radius: 20px;
  padding: 26px 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: #fff;
  box-shadow: 0 16px 40px rgba(14, 165, 233, 0.32);
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.2), transparent 55%);
  pointer-events: none;
}

.hero-content { position: relative; z-index: 1; max-width: 680px; }
.hero-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.hero-pill {
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  padding: 3px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
}
.hero-content h1 { font-size: 26px; font-weight: 900; margin-bottom: 6px; }
.hero-content p { font-size: 13px; opacity: 0.92; margin-bottom: 16px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-white { background: #fff; color: #0369a1; }
.btn-white:hover { background: #f0f9ff; }
.btn-glass { background: rgba(255, 255, 255, 0.18); color: #fff; border: 1px solid rgba(255, 255, 255, 0.35); }
.btn-glass:hover { background: rgba(255, 255, 255, 0.28); }

.hero-badge-card {
  position: relative;
  z-index: 1;
  background: rgba(6, 15, 32, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 220px;
}
.hero-badge-card img {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

/* Grids */
.kpi-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-grid-6 {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 15px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kpi-label { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.kpi-val { font-size: 22px; font-weight: 900; margin-top: 2px; }
.kpi-sub { font-size: 11px; color: var(--text-dim); }
.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  background: rgba(14, 165, 233, 0.14);
  color: var(--primary);
  flex-shrink: 0;
}
.kpi-icon.green { background: var(--success-soft); color: var(--success); }
.kpi-icon.amber { background: var(--warning-soft); color: var(--warning); }
.kpi-icon.purple { background: rgba(168, 85, 247, 0.16); color: var(--purple); }
.kpi-icon.red { background: var(--danger-soft); color: var(--danger); }

.grid-2-uneven {
  display: grid;
  grid-template-columns: 1.75fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.grid-5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

/* Section Card Header */
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.card-title { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.card-sub { font-size: 12px; color: var(--text-dim); }

/* Progress Bar */
.progress-track {
  height: 7px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
  margin-top: 6px;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), #38bdf8);
  transition: width 0.35s ease;
}
.progress-fill.green { background: linear-gradient(90deg, #10b981, #34d399); }
.progress-fill.amber { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.progress-fill.purple { background: linear-gradient(90deg, #8b5cf6, #c084fc); }

/* 7-Day Bar Chart */
.chart-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  padding: 14px 4px;
  align-items: end;
}
.bar-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.bar-total { font-size: 13px; font-weight: 800; }
.bar-delta { font-size: 10px; padding: 1px 6px; border-radius: 99px; font-weight: 700; }
.bar-delta.up { background: var(--success-soft); color: var(--success); }
.bar-delta.down { background: var(--danger-soft); color: var(--danger); }
.bar-delta.flat { background: rgba(148, 163, 184, 0.14); color: var(--text-dim); }
.bar-pillar-wrap { height: 74px; width: 22px; display: flex; align-items: flex-end; background: rgba(255,255,255,0.03); border-radius: 8px; overflow: hidden; }
.bar-pillar {
  width: 100%;
  border-radius: 8px;
  background: linear-gradient(180deg, #38bdf8, #2563eb);
  min-height: 16px;
  transition: height 0.35s;
}
.bar-pillar.green { background: linear-gradient(180deg, #34d399, #059669); }
.bar-pillar.red { background: linear-gradient(180deg, #f87171, #dc2626); }
.bar-day { font-size: 11px; color: var(--text-dim); font-weight: 700; }

.recent-feed-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.feed-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.feed-user { display: flex; align-items: center; gap: 7px; min-width: 0; }
.feed-user img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.feed-user span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }

/* Quick Modules List (Home) */
.quick-mod-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
}
.quick-mod-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.quick-mod-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(14, 165, 233, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.quick-mod-name { font-size: 13px; font-weight: 800; }
.quick-mod-state { font-size: 11px; color: var(--text-dim); }

/* Presence Studio */
.presence-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  align-items: start;
}
.discord-preview-card {
  background: #111622;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  overflow: hidden;
  color: #f8fafc;
}
.dp-banner { height: 64px; background: linear-gradient(120deg, #0ea5e9, #1d4ed8); }
.dp-body { padding: 0 16px 16px; position: relative; }
.dp-avatar-wrap { position: relative; display: inline-block; margin-top: -32px; }
.dp-avatar { width: 64px; height: 64px; border-radius: 50%; border: 4px solid #111622; object-fit: cover; background: #1e293b; }
.dp-status-dot { position: absolute; bottom: 4px; left: 4px; width: 16px; height: 16px; border-radius: 50%; border: 3px solid #111622; }
.dp-name { font-size: 16px; font-weight: 900; margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.dp-app-tag { font-size: 10px; background: #5865f2; color: #fff; padding: 1px 6px; border-radius: 5px; font-weight: 800; }
.dp-activity-box {
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
}
.dp-act-type { font-size: 10px; text-transform: uppercase; letter-spacing: 0.7px; color: #94a3b8; font-weight: 800; }
.dp-act-text { font-size: 13px; font-weight: 700; margin-top: 3px; color: #38bdf8; }

.option-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.opt-pill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 7px 13px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s;
}
.opt-pill.active {
  background: rgba(14, 165, 233, 0.2);
  border-color: var(--primary);
  color: #fff;
}
body.light .opt-pill.active { color: #0369a1; }

/* Circular Gauges */
.gauges-row { display: flex; justify-content: space-around; gap: 10px; margin-top: 12px; }
.gauge-item { text-align: center; }
.gauge-svg { width: 78px; height: 78px; transform: rotate(-90deg); }
.gauge-bg { fill: none; stroke: var(--surface-3); stroke-width: 7; }
.gauge-fg { fill: none; stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; }
.gauge-wrap { position: relative; width: 78px; height: 78px; margin: 0 auto 6px; }
.gauge-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 900; }

/* Health Checklist */
.health-list { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.health-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface-2);
}

/* Top Roles Bars */
.role-bar-row { margin-bottom: 10px; }
.role-bar-top { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; margin-bottom: 4px; }

/* Owner Tasks */
.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
  font-size: 12px;
}
.task-item.done span { text-decoration: line-through; opacity: 0.55; }

/* Quick Bottom Tiles */
.quick-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.18s;
  color: var(--text);
  font-family: inherit;
  text-align: right;
}
.quick-tile:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.quick-tile.highlight {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-color: transparent;
}

/* Forms & Inputs */
.input, .select, .textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 13px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.18s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); }
.textarea { min-height: 92px; resize: vertical; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--text-dim); margin-bottom: 5px; }

/* Filter Bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

/* Channel Cards */
.category-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.channel-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.18s;
}
.channel-card:hover { border-color: var(--border-strong); }
.ch-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.ch-name { font-size: 14px; font-weight: 800; word-break: break-word; }
.ch-id { font-size: 11px; color: var(--text-dim); font-family: monospace; cursor: pointer; }
.ch-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}
.ch-badge.text { background: rgba(14, 165, 233, 0.16); color: #38bdf8; }
.ch-badge.voice { background: var(--success-soft); color: var(--success); }
.ch-badge.announcement { background: var(--warning-soft); color: var(--warning); }
.ch-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }

/* Role Cards */
.role-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.role-top { display: flex; align-items: center; gap: 9px; min-width: 0; }
.role-dot { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 8px currentColor; }
.role-name { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Member Cards */
.member-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.member-head { display: flex; align-items: center; gap: 10px; }
.member-avatar-wrap { position: relative; flex-shrink: 0; }
.member-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.member-status { position: absolute; bottom: 0; left: 0; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--surface-2); }
.role-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.role-tag { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px; border: 1px solid; }

/* Bot Modules Cards */
.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s;
}
.module-card.active-mod { border-color: rgba(16, 185, 129, 0.35); }
.module-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.mod-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.mod-icon-lg {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(14, 165, 233, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.mod-status-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 99px;
}
.mod-status-pill.on { background: var(--success-soft); color: var(--success); border: 1px solid rgba(16,185,129,0.35); }
.mod-status-pill.off { background: rgba(100,116,139,0.18); color: var(--text-dim); border: 1px solid rgba(100,116,139,0.3); }
.mod-desc { font-size: 12px; color: var(--text-dim); line-height: 1.6; }
.mod-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.mod-stat-chip {
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 8px;
  color: var(--text-dim);
}
.mod-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; }

/* Live Console */
.console-box {
  background: #040812;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  overflow: hidden;
  margin-top: 18px;
}
.console-top {
  background: #0a1222;
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.console-dots { display: flex; gap: 6px; }
.console-dots span { width: 11px; height: 11px; border-radius: 50%; }
.console-body {
  height: 230px;
  overflow-y: auto;
  padding: 12px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  direction: ltr;
  text-align: left;
}
.console-line { margin-bottom: 4px; white-space: pre-wrap; word-break: break-word; color: #cbd5e1; }
.console-line.warn { color: #fbbf24; }
.console-line.error { color: #f87171; }
.console-time { color: #64748b; margin-right: 8px; }

/* Logs Timeline */
.log-row {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-right: 3px solid var(--primary);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.log-title { font-size: 14px; font-weight: 800; }
.log-details { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.log-time { font-size: 11px; color: var(--text-dim); white-space: nowrap; }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 16, 0.78);
  backdrop-filter: blur(8px);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal {
  background: #0b1324;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  width: 100%;
  max-width: 760px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
body.light .modal { background: #ffffff; }
.modal.modal-md { max-width: 560px; }
.modal.modal-lg { max-width: 900px; }
.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body { padding: 18px 20px; overflow-y: auto; }

/* Tabs inside Modals / Pages */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.tab-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 7px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.tab-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-color: transparent;
}

/* Toggle Switch */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  margin-bottom: 8px;
}
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #334155;
  border-radius: 99px;
  transition: 0.2s;
}
.slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  right: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider::before { transform: translateX(-20px); }

/* Search Results */
.search-results { margin-top: 12px; max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
}
.search-item:hover { border-color: var(--primary); }

/* Login Overlay */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 20, 0.94);
  backdrop-filter: blur(16px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 390px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow);
}
.login-logo { font-size: 46px; margin-bottom: 10px; }
.login-card h2 { font-size: 20px; font-weight: 900; margin-bottom: 6px; }
.login-card p { font-size: 13px; color: var(--text-dim); margin-bottom: 18px; }
.login-card input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  margin-bottom: 12px;
}
.login-error { margin-top: 10px; color: #f87171; font-size: 13px; font-weight: 700; }

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #0f1b33;
  color: #f8fafc;
  border: 1px solid var(--border-strong);
  border-right: 4px solid var(--primary);
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow);
  animation: slideIn 0.22s ease;
}
.toast.success { border-right-color: var(--success); }
.toast.error { border-right-color: var(--danger); }

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

.loading-state {
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-dim);
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 1280px) {
  .kpi-grid-6 { grid-template-columns: repeat(3, 1fr); }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .main-shell { margin-right: 0; }
  .mobile-only { display: inline-flex; }
  .grid-2-uneven, .grid-2, .presence-grid { grid-template-columns: 1fr; }
  .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .recent-feed-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .kpi-grid-4, .kpi-grid-6, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .global-search { width: 170px; }
  .global-search kbd { display: none; }
}
