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

:root {
  --bg: #f5f5fa;
  --bg-card: rgba(255,255,255,0.85);
  --surface: #ffffff;
  --surface-hover: #f0f0f5;
  --border: #e2e4e9;
  --text: #1a1a2e;
  --text-dim: #6b7280;
  --text-mute: #9ca3af;
  --accent: #7c3aed;
  --accent2: #d946ef;
  --accent3: #0891b2;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --nav-bg: rgba(255,255,255,0.92);
  --input-bg: #f3f4f6;
  --input-border: #d1d5db;
  --gradient-1: linear-gradient(135deg, #7c3aed, #6366f1);
  --gradient-2: linear-gradient(135deg, #d946ef, #ec4899);
  --gradient-3: linear-gradient(135deg, #0891b2, #3b82f6);
  --gradient-4: linear-gradient(135deg, #d97706, #dc2626);
  --gradient-5: linear-gradient(135deg, #059669, #047857);
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* Subtle background */
.stars {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(124,58,237,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(99,102,241,0.03) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 80%, rgba(6,182,212,0.03) 0%, transparent 40%);
}

/* Navbar */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center;
  padding: 0 20px; height: 56px; gap: 8px;
}

.logo {
  font-size: 16px; font-weight: 700;
  background: var(--gradient-1); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}

.nav-links { display: flex; gap: 2px; margin-left: 20px; flex: 1; overflow-x: auto; }
.nav-links a {
  padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 500;
  color: var(--text-dim); text-decoration: none; transition: all 0.15s;
  white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(124,58,237,0.08); color: #7c3aed;
}
.nav-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.teacher-badge {
  font-size: 12px; padding: 4px 10px; border-radius: 6px;
  background: rgba(124,58,237,0.08); color: #7c3aed; white-space: nowrap;
}

/* Layout */
.page-wrapper { position: relative; z-index: 1; padding-top: 72px; }
.page-container { max-width: 1280px; margin: 0 auto; padding: 0 20px 40px; }

/* Section headers */
.page-header { padding: 24px 0 20px; }
.page-title { font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.page-sub { font-size: 13px; color: var(--text-dim); }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; transition: all 0.15s;
}
.stat-card:hover { background: var(--surface-hover); }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.stat-label { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.stat-icon { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-change { font-size: 11px; margin-top: 2px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; margin-bottom: 16px; transition: all 0.15s;
}
.card:hover { background: var(--surface-hover); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-action { font-size: 12px; color: var(--accent); cursor: pointer; background: none; border: none; padding: 4px 8px; border-radius: 6px; }
.card-action:hover { background: rgba(139,92,246,0.1); }

/* Grid layout */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 12px; color: var(--text-dim); font-weight: 500; font-size: 12px; border-bottom: 1px solid var(--border); }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
tr:hover td { background: rgba(124,58,237,0.03); }

/* Tags */
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 4px;
  font-size: 11px; font-weight: 500;
}
.tag-purple { background: rgba(124,58,237,0.1); color: #7c3aed; }
.tag-green { background: rgba(5,150,105,0.1); color: #059669; }
.tag-yellow { background: rgba(217,119,6,0.1); color: #b45309; }
.tag-red { background: rgba(220,38,38,0.1); color: #dc2626; }
.tag-cyan { background: rgba(8,145,178,0.1); color: #0891b2; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 8px; font-size: 13px; font-weight: 500;
  border: none; cursor: pointer; transition: all 0.15s; text-decoration: none;
}
.btn-primary { background: var(--gradient-1); color: #fff; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-hover); border-color: var(--accent); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; }

/* Inputs */
textarea, input, select {
  background: var(--input-bg); border: 1px solid var(--input-border);
  border-radius: 8px; padding: 10px 14px; color: var(--text); font-size: 13px;
  width: 100%; transition: all 0.15s; font-family: inherit;
}
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(139,92,246,0.1); }
textarea::placeholder { color: #3f3f46; }
select { 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='%238b8b9e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* Agent Cards */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 24px; }
.agent-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; cursor: pointer; transition: all 0.15s;
}
.agent-card:hover { background: var(--surface-hover); transform: translateY(-2px); }
.agent-card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.agent-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.agent-name { font-size: 14px; font-weight: 600; }
.agent-role { font-size: 11px; color: var(--text-dim); }
.agent-desc { font-size: 12px; color: var(--text-dim); line-height: 1.6; }
.agent-status { font-size: 11px; display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.status-dot.online { background: var(--success); }
.status-dot.busy { background: var(--warning); }

/* Alerts / Warning items */
.alert-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 6px;
  font-size: 13px; border: 1px solid transparent;
}
.alert-item.warning { background: rgba(245,158,11,0.06); border-color: rgba(245,158,11,0.15); }
.alert-item.danger { background: rgba(239,68,68,0.06); border-color: rgba(239,68,68,0.15); }
.alert-item.info { background: rgba(6,182,212,0.06); border-color: rgba(6,182,212,0.15); }
.alert-item.success { background: rgba(16,185,129,0.06); border-color: rgba(16,185,129,0.15); }
.alert-icon { font-size: 16px; flex-shrink: 0; }
.alert-text { flex: 1; }
.alert-meta { font-size: 11px; color: var(--text-mute); margin-top: 2px; }

/* Analysis / Student detail */
.student-header { display: flex; align-items: center; gap: 16px; padding: 20px 0; }
.student-avatar {
  width: 56px; height: 56px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #fff;
}
.student-info h2 { font-size: 20px; font-weight: 700; }
.student-info p { font-size: 13px; color: var(--text-dim); }

/* Radar chart placeholder */
.radar-placeholder {
  width: 100%; height: 240px; border-radius: 8px;
  background: var(--input-bg); display: flex; align-items: center;
  justify-content: center; color: var(--text-mute); font-size: 13px;
  border: 1px dashed var(--border);
}

/* Tab nav */
.tab-nav { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab-btn { padding: 8px 16px; font-size: 13px; font-weight: 500; color: var(--text-dim);
  background: none; border: none; cursor: pointer; border-bottom: 2px solid transparent;
  transition: all 0.15s; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: #7c3aed; border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Message bubbles */
.msg-bubble {
  padding: 12px 16px; border-radius: 12px; margin-bottom: 8px;
  font-size: 13px; line-height: 1.7;
}
.msg-bubble.ai { background: rgba(124,58,237,0.04); border: 1px solid rgba(124,58,237,0.12); }
.msg-bubble.user { background: #f3f4f6; border: 1px solid var(--border); }
.msg-label { font-size: 11px; font-weight: 600; margin-bottom: 4px; }
.msg-label.ai { color: #7c3aed; }
.msg-label.user { color: var(--text-dim); }

/* Knowledge base */
.kb-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.kb-item:last-child { border-bottom: none; }
.kb-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; cursor: pointer; }
.kb-title:hover { color: #c4b5fd; }
.kb-meta { font-size: 11px; color: var(--text-mute); display: flex; gap: 12px; }
.kb-summary { font-size: 12px; color: var(--text-dim); margin-top: 4px; line-height: 1.6; }

/* Loading */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Chat input area */
.chat-area { margin-top: 16px; }
.chat-input-row { display: flex; gap: 8px; }
.chat-input-row textarea { flex: 1; min-height: 44px; max-height: 120px; resize: vertical; }
.chat-send { width: 44px; height: 44px; flex-shrink: 0; }

/* Quick actions */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.quick-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 10px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; transition: all 0.15s;
  text-decoration: none; color: var(--text);
}
.quick-item:hover { background: var(--surface-hover); border-color: rgba(139,92,246,0.2); transform: translateY(-1px); }
.quick-icon { font-size: 22px; }
.quick-label { font-size: 12px; font-weight: 500; text-align: center; }

/* Multi-agent talk area */
.conversation { max-height: 400px; overflow-y: auto; padding-right: 4px; }
.conversation::-webkit-scrollbar { width: 4px; }
.conversation::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.3); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: #fff; border-radius: 16px; width: 90%; max-width: 600px;
  max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal::-webkit-scrollbar { width: 4px; }
.modal::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Mobile responsive */
@media (max-width: 640px) {
  .nav-links { margin-left: 8px; }
  .teacher-badge { font-size: 0; padding: 4px; }
  .teacher-badge::before { content: '👩‍🏫'; font-size: 16px; }
  .page-title { font-size: 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* Footer */
.footer { text-align: center; padding: 24px 0; font-size: 12px; color: var(--text-mute); border-top: 1px solid var(--border); margin-top: 32px; }
