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

:root {
  --bg: #070f1a;
  --bg2: #0c1729;
  --bg3: #111f35;
  --navy: #02294c;
  --accent: #0ea5e9;
  --accent2: #38bdf8;
  --gold: #f59e0b;
  --green: #22c55e;
  --red: #ef4444;
  --purple: #8b5cf6;
  --white: #ffffff;
  --t1: rgba(255,255,255,0.90);
  --t2: rgba(255,255,255,0.60);
  --t3: rgba(255,255,255,0.35);
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --radius: 12px;
}

html, body { height: 100%; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--t1);
  display: flex;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3 { font-family: 'Syne', sans-serif; }

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #0369a1);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 14px;
  color: white;
}

.sidebar-brand {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 16px;
}

.sidebar-brand span { color: var(--accent); }

.school-selector {
  margin: 14px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.school-selector:hover { border-color: var(--accent); }

.school-dot {
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(1.3)} }

.school-name { font-size: 12px; font-weight: 500; flex: 1; }
.school-arrow { font-size: 11px; color: var(--t3); }

.nav-section {
  padding: 6px 12px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--t3);
  margin-top: 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  margin: 1px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--t2);
  font-size: 13.5px;
  font-weight: 400;
  position: relative;
  user-select: none;
}

.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--t1); }

.nav-item.active {
  background: rgba(14,165,233,0.12);
  color: var(--accent2);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 2.5px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  margin-left: -8px;
}

.nav-icon { font-size: 16px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
  min-width: 20px;
  text-align: center;
}

.nav-badge.red { background: var(--red); }
.nav-badge.gold { background: var(--gold); }

.sidebar-bottom {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.2s;
}

.user-card:hover { background: rgba(255,255,255,0.04); }

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--t3); }

/* ===================== MAIN ===================== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* TOPBAR */
.topbar {
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  flex: 1;
  max-width: 360px;
}

.topbar-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--t1);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  flex: 1;
}

.topbar-search input::placeholder { color: var(--t3); }

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

.icon-btn {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  color: var(--t2);
  font-size: 16px;
  transition: all 0.2s;
  position: relative;
}

.icon-btn:hover { background: var(--bg3); color: var(--t1); }

.icon-btn .notif-dot {
  position: absolute;
  top: 6px; right: 7px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--bg2);
}

.topbar-title {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--t1);
}

/* CONTENT AREA */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: none;
}

.content-area.active { display: block; }

/* ===================== DASHBOARD VIEW ===================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: var(--border2); }

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-label {
  font-size: 12px;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.stat-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 30px;
  font-weight: 700;
  color: var(--t1);
  letter-spacing: -1px;
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  margin-top: 4px;
}

.trend-up { color: var(--green); }
.trend-down { color: var(--red); }

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.card-action {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
}

.card-body { padding: 16px 20px; }

/* Chart bars */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  padding-bottom: 8px;
}

.bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: rgba(14,165,233,0.3);
  transition: background 0.2s;
  cursor: pointer;
  min-height: 4px;
}

.bar:hover { background: var(--accent); }
.bar.active { background: var(--accent); }

.bar-label {
  font-size: 10px;
  color: var(--t3);
  text-align: center;
}

/* Activity feed */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

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

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

.act-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 2px;
}

.act-text { font-size: 13px; color: var(--t2); flex: 1; }
.act-text strong { color: var(--t1); font-weight: 500; }
.act-time { font-size: 11px; color: var(--t3); white-space: nowrap; margin-top: 2px; }

/* Pie-like donut */
.donut-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.donut-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.donut-color { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.donut-name { font-size: 13px; flex: 1; }
.donut-val { font-size: 13px; font-weight: 500; }
.donut-pct { font-size: 11px; color: var(--t3); }
.donut-bar-wrap { width: 100%; height: 4px; background: var(--border); border-radius: 2px; margin-top: 2px; }
.donut-bar-fill { height: 100%; border-radius: 2px; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--t3);
  font-weight: 600;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
}

.status-pill.active { background: rgba(34,197,94,0.12); color: #4ade80; }
.status-pill.pending { background: rgba(245,158,11,0.12); color: #fbbf24; }
.status-pill.inactive { background: rgba(239,68,68,0.12); color: #f87171; }
.status-pill.new { background: rgba(14,165,233,0.12); color: var(--accent2); }

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-av {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.action-btns { display: flex; gap: 6px; }

.btn-sm {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  border: none;
  transition: all 0.15s;
}

.btn-sm-outline {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--t2);
}

.btn-sm-outline:hover { color: var(--t1); border-color: var(--t2); }

.btn-sm-primary {
  background: rgba(14,165,233,0.15);
  color: var(--accent2);
}

.btn-sm-primary:hover { background: rgba(14,165,233,0.25); }

.btn-sm-danger {
  background: rgba(239,68,68,0.12);
  color: #f87171;
}

.btn-sm-danger:hover { background: rgba(239,68,68,0.22); }

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.page-sub { font-size: 13px; color: var(--t3); margin-top: 2px; }

.btn-add {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.2s;
}

.btn-add:hover { background: var(--accent2); }

.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-select {
  padding: 8px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--t2);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  outline: none;
}

.filter-input {
  padding: 8px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--t1);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  flex: 1;
  min-width: 200px;
}

.filter-input::placeholder { color: var(--t3); }

/* ===================== CHAT VIEW ===================== */
.chat-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

.channel-list {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.channel-section-title {
  padding: 10px 14px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--t3);
  font-weight: 600;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: 6px;
  margin: 1px 8px;
  transition: all 0.15s;
  color: var(--t2);
  font-size: 13px;
}

.channel-item:hover { background: rgba(255,255,255,0.04); color: var(--t1); }
.channel-item.active { background: rgba(14,165,233,0.12); color: var(--accent2); }

.channel-hash { color: var(--t3); font-size: 14px; }
.channel-badge { margin-left: auto; background: var(--accent); color: white; border-radius: 100px; font-size: 10px; font-weight: 700; padding: 1px 6px; }

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

.chat-header-bar {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg2);
}

.chat-header-title { font-weight: 600; font-size: 14px; }
.chat-header-desc { font-size: 12px; color: var(--t3); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-msg-group {
  display: flex;
  gap: 12px;
  padding: 6px 0;
}

.chat-msg-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.chat-msg-content { flex: 1; }

.chat-msg-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.chat-msg-name { font-size: 13px; font-weight: 600; }
.chat-msg-time { font-size: 11px; color: var(--t3); }

.chat-msg-role {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 100px;
  font-weight: 600;
}

.chat-bubble {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--t2);
  padding: 2px 0;
}

.chat-bubble.mine {
  background: rgba(14,165,233,0.1);
  border: 1px solid rgba(14,165,233,0.15);
  padding: 10px 14px;
  border-radius: 4px 12px 12px 12px;
  display: inline-block;
  max-width: 500px;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  font-size: 12px;
  color: var(--t3);
}

.typing-dots { display: flex; gap: 3px; align-items: center; }
.typing-dot {
  width: 6px; height: 6px;
  background: var(--t3);
  border-radius: 50%;
  animation: typing 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-4px)} }

.chat-input-bar {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}

.chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 10px 14px;
}

.chat-input-wrap input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--t1);
  font-size: 13.5px;
  font-family: 'DM Sans', sans-serif;
}

.chat-input-wrap input::placeholder { color: var(--t3); }

.chat-tools { display: flex; gap: 6px; align-items: center; }

.chat-tool-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--t3);
  font-size: 16px;
  transition: color 0.2s;
  padding: 2px;
}

.chat-tool-btn:hover { color: var(--t1); }

.chat-send-btn {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  font-size: 14px;
  transition: background 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:hover { background: var(--accent2); }

/* ===================== MODAL ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 16px;
  width: 90%;
  max-width: 520px;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.2s;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  color: var(--t3);
  font-size: 20px;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
}

.modal-close:hover { color: var(--t1); }

.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--t2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  padding: 11px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--t1);
  font-size: 13.5px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus { border-color: rgba(14,165,233,0.5); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-cancel {
  padding: 9px 20px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--t2);
  font-size: 13px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}

.btn-submit {
  padding: 9px 20px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.2s;
}

.btn-submit:hover { background: var(--accent2); }

/* ===================== EMPTY / MISC ===================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--t3);
}

.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 14px; }

/* scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Responsive */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
