:root {
  --bg: #FAFAFA;
  --card: #FFFFFF;
  --dark: #1A1A1A;
  --border: #EBEBEB;
  --border2: #D4D4D4;
  --text: #1A1A1A;
  --text2: #6B6B6B;
  --text3: #999999;
  --accent: #5ADF6C;
  --accent-rgb: 90,223,108;
  --accent-light: rgba(90,223,108,0.08);
  --accent-mid: rgba(90,223,108,0.15);
  --success: #16A34A;
  --success-light: rgba(22,163,74,0.08);
  --danger: #DC2626;
  --danger-light: rgba(220,38,38,0.08);
  --warn: #D97706;
  --warn-light: rgba(217,119,6,0.08);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.10);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.15);
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --pill: 999px;
  --sidebar-w: 64px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
  --t: 0.15s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}

/* === LOGIN === */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
#login-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; width: 100%; }
.login-card {
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent); display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; color: var(--dark);
  margin: 0 auto 24px;
}
.login-title { font-size: 22px; font-weight: 800; text-align: center; letter-spacing: -0.5px; }
.login-subtitle { font-size: 13px; color: var(--text2); text-align: center; margin: 4px 0 28px; }
.login-field { margin-bottom: 12px; }
.login-field input {
  width: 100%; padding: 12px 16px; border-radius: var(--r);
  border: 1px solid var(--border); font-size: 14px; font-family: var(--font);
  background: var(--bg); color: var(--text); outline: none;
  transition: border var(--t), box-shadow var(--t);
}
.login-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.btn-login {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 12px; border-radius: var(--r); border: none;
  background: var(--dark); color: #fff; font-size: 14px; font-weight: 600;
  font-family: var(--font); cursor: pointer; transition: opacity var(--t); margin-top: 8px;
}
.btn-login:hover { opacity: 0.85; }
.login-error { margin-top: 12px; color: var(--danger); font-size: 13px; text-align: center; }

/* === SIDEBAR (icon-only 64px) === */
.sidebar {
  position: fixed; top: 0; left: 0; width: var(--sidebar-w); height: 100vh;
  background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  z-index: 100; padding: 0;
}
.sidebar-brand { padding: 16px 0; display: flex; justify-content: center; width: 100%; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent); display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: var(--dark);
}
.sidebar-nav { flex: 1; padding: 8px 0; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; overflow-y: auto; }
.nav-divider { width: 28px; height: 1px; background: var(--border); margin: 8px 0; flex-shrink: 0; }
.nav-item {
  width: 44px; height: 44px; border-radius: 12px;
  border: none; background: transparent; color: var(--text3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--t); position: relative; flex-shrink: 0;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg); color: var(--text2); }
.nav-item.active { background: var(--accent-light); color: var(--accent); }
.nav-item[title]:hover::after {
  content: attr(title); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: var(--dark); color: #fff; font-size: 12px; font-weight: 500; font-family: var(--font);
  padding: 5px 10px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 200;
}
.sidebar-footer { padding: 8px 0 16px; display: flex; justify-content: center; width: 100%; border-top: 1px solid var(--border); }

/* === MAIN LAYOUT === */
.main-wrap { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 50; height: 56px;
  background: rgba(250,250,250,0.8); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.course-tabs { display: flex; background: var(--border); border-radius: 8px; padding: 2px; }
.course-tab {
  padding: 6px 16px; border-radius: 6px; border: none; background: transparent;
  font-size: 12px; font-weight: 600; font-family: var(--font);
  cursor: pointer; color: var(--text2); transition: all var(--t); letter-spacing: 0.3px;
}
.course-tab:hover { color: var(--text); }
.course-tab.active { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }
.group-select {
  padding: 6px 28px 6px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); font-size: 12px; font-family: var(--font);
  color: var(--text); cursor: pointer; outline: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='8' height='5' viewBox='0 0 8 5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%23999' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.topbar-btn {
  padding: 6px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); font-size: 12px; font-weight: 500; font-family: var(--font);
  color: var(--text2); cursor: pointer; transition: all var(--t);
  display: flex; align-items: center; gap: 6px;
}
.topbar-btn:hover { border-color: var(--border2); color: var(--text); }
.topbar-avatar {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--accent-mid); color: var(--accent);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--t);
}
.topbar-avatar:hover { background: var(--accent); color: var(--dark); }

/* === PAGE === */
.page-content { padding: 28px 28px 40px; flex: 1; }
.page-wrap { max-width: 1100px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.page-subtitle { font-size: 13px; color: var(--text2); margin-top: 2px; }

/* === STATS (Dashboard) === */
.stats-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--card); border-radius: var(--r); padding: 18px 20px;
  box-shadow: var(--shadow-sm); transition: box-shadow var(--t);
}
.stat:hover { box-shadow: var(--shadow-md); }
.stat-val { font-size: 28px; font-weight: 800; font-family: var(--mono); line-height: 1; letter-spacing: -1px; }
.stat-lbl { font-size: 11px; color: var(--text2); margin-top: 6px; font-weight: 500; }
.stat-val.green { color: var(--success); }
.stat-val.red { color: var(--danger); }
.stat-val.accent { color: var(--accent); }
.stat-val.warn { color: var(--warn); }

/* === GRADE DISTRIBUTION (Dashboard visualization) === */
.chart-section {
  background: var(--card); border-radius: var(--r-lg); padding: 24px;
  box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.chart-title { font-size: 14px; font-weight: 700; margin-bottom: 16px; }
.grade-bars { display: flex; flex-direction: column; gap: 8px; }
.grade-bar-row { display: flex; align-items: center; gap: 12px; }
.grade-bar-label { width: 24px; font-size: 14px; font-weight: 800; font-family: var(--mono); text-align: center; }
.grade-bar-track { flex: 1; height: 28px; background: var(--bg); border-radius: 6px; overflow: hidden; position: relative; }
.grade-bar-fill { height: 100%; border-radius: 6px; transition: width 0.4s ease; display: flex; align-items: center; padding-left: 10px; min-width: 0; }
.grade-bar-fill span { font-size: 12px; font-weight: 700; font-family: var(--mono); color: #fff; white-space: nowrap; }
.grade-bar-count { font-size: 13px; font-weight: 600; font-family: var(--mono); width: 28px; text-align: right; color: var(--text2); }
.bar-A { background: #16a34a; }
.bar-B { background: #22c55e; }
.bar-C { background: #d97706; }
.bar-D { background: #ea580c; }
.bar-F { background: #dc2626; }

/* component bars */
.comp-bars { display: flex; gap: 4px; height: 32px; border-radius: 6px; overflow: hidden; background: var(--bg); }
.comp-bar { height: 100%; display: flex; align-items: center; justify-content: center; transition: width 0.4s; }
.comp-bar span { font-size: 10px; font-weight: 700; color: #fff; white-space: nowrap; }
.comp-legend { display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap; }
.comp-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); }
.comp-legend-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

/* === ATTENTION (Dashboard) === */
.attention-section {
  background: var(--card); border-radius: var(--r-lg); padding: 24px;
  box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.attention-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.attention-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.attention-card {
  background: var(--bg); border-radius: var(--r); padding: 14px 16px;
  border-left: 3px solid var(--danger); transition: all var(--t); cursor: pointer;
}
.attention-card:hover { box-shadow: var(--shadow-md); }
.attention-card.warn { border-left-color: var(--warn); }
.attention-card.ok { border-left-color: var(--success); }
.attention-card-name { font-size: 13px; font-weight: 600; }
.attention-card-team { font-size: 11px; color: var(--text3); margin-top: 2px; }
.attention-card-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.attention-card-pts { font-size: 13px; font-weight: 700; font-family: var(--mono); }

/* === QUICK ACTIONS (Dashboard) === */
.quick-actions { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }

/* === FILTERS === */
.filters { display: flex; align-items: center; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text3); pointer-events: none; }
.search-box input {
  padding: 8px 14px 8px 34px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); font-size: 13px; font-family: var(--font);
  color: var(--text); outline: none; min-width: 200px;
  transition: border var(--t), box-shadow var(--t);
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.chip {
  padding: 6px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--text2); font-size: 12px; font-weight: 500;
  font-family: var(--font); cursor: pointer; transition: all var(--t); white-space: nowrap;
}
.chip:hover { border-color: var(--border2); color: var(--text); }
.chip.active { background: var(--dark); color: #fff; border-color: var(--dark); }
.chip.on { background: var(--accent-light); color: var(--accent); border-color: rgba(var(--accent-rgb), 0.25); }

/* === TABLE (compact 4-col) === */
.tbl-wrap { background: var(--card); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  background: var(--bg); padding: 10px 16px; text-align: left;
  font-weight: 600; color: var(--text2); font-size: 11px; letter-spacing: 0.4px;
  text-transform: uppercase; border-bottom: 1px solid var(--border);
  white-space: nowrap; user-select: none; transition: color var(--t);
}
.tbl thead th.sortable { cursor: pointer; }
.tbl thead th.sortable:hover { color: var(--text); }
.tbl thead th.sorted-asc::after { content: ' \2191'; color: var(--accent); }
.tbl thead th.sorted-desc::after { content: ' \2193'; color: var(--accent); }
.tbl thead th.no-sort { cursor: default; }
.tbl tbody td {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background 0.1s; cursor: pointer; }
.tbl tbody tr:hover { background: rgba(0,0,0,0.015); }
.tbl tbody tr.selected { background: var(--accent-light); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 4px; align-items: center; }

/* status dot */
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 2px; flex-shrink: 0; }
.status-dot.student { background: var(--success); }
.status-dot.free { background: var(--border2); }

/* inline detail row */
.detail-row td { padding: 0 !important; border-bottom: 1px solid var(--border); }
.detail-row:hover { background: transparent !important; cursor: default !important; }

/* === BADGES === */
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-gray { background: var(--bg); color: var(--text2); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-warn { background: var(--warn-light); color: var(--warn); }
.badge-accent { background: var(--accent-light); color: var(--accent); }
.badge-llm { background: var(--danger-light); color: var(--danger); }
.grade-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; border-radius: 8px;
  font-size: 14px; font-weight: 800; font-family: var(--mono);
}
.grade-A { background: rgba(22,163,74,0.1); color: #16a34a; }
.grade-B { background: rgba(34,197,94,0.1); color: #22c55e; }
.grade-C { background: rgba(217,119,6,0.1); color: #d97706; }
.grade-D { background: rgba(234,88,12,0.1); color: #ea580c; }
.grade-F { background: rgba(220,38,38,0.1); color: #dc2626; }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: none;
  font-size: 13px; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: all var(--t); white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--dark); }
.btn-primary:hover { filter: brightness(0.92); }
.btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--border2); }
.btn-danger { background: var(--danger-light); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text2); padding: 6px 10px; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 11px; border-radius: 6px; }
.btn-add {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: none;
  background: var(--dark); color: #fff;
  font-size: 13px; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: all var(--t);
}
.btn-add:hover { opacity: 0.85; }
.btn-icon {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--text3);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--t); font-size: 12px; font-family: var(--mono);
  font-weight: 700; flex-shrink: 0;
}
.btn-icon:hover { background: var(--bg); border-color: var(--border); color: var(--text); }
.btn-icon.accent { color: var(--accent); }
.btn-icon.accent:hover { background: var(--accent-light); border-color: rgba(var(--accent-rgb),0.2); }

/* === PROGRESS BAR === */
.pbar { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; flex: 1; min-width: 40px; }
.pbar-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }

/* === DETAIL SECTION (expanded under row) === */
.detail-section {
  background: var(--card); border-radius: 0;
  overflow: hidden; animation: slideDown 0.25s ease-out;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.detail-inner { padding: 20px 24px 24px; }
.detail-header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.detail-avatar {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent-mid); display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: var(--accent); flex-shrink: 0;
}
.detail-name { font-size: 16px; font-weight: 700; }
.detail-meta { font-size: 12px; color: var(--text2); margin-top: 2px; }
.detail-scores { display: flex; gap: 0; margin-bottom: 20px; background: var(--bg); border-radius: var(--r); overflow: hidden; }
.detail-score { flex: 1; padding: 14px 16px; text-align: center; border-right: 1px solid var(--border); }
.detail-score:last-child { border-right: none; }
.detail-score-val { font-size: 20px; font-weight: 800; font-family: var(--mono); }
.detail-score-lbl { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }
.detail-threshold { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding: 12px 16px; background: var(--bg); border-radius: var(--r); }
.detail-threshold-label { font-size: 12px; color: var(--text2); font-weight: 500; }
.detail-threshold-bar { flex: 1; }
.detail-threshold-bar .pbar { height: 6px; border-radius: 3px; }
.detail-threshold-bar .pbar-fill { border-radius: 3px; }
.detail-threshold-pts { font-size: 13px; font-weight: 700; font-family: var(--mono); }
.detail-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.detail-tab {
  padding: 10px 16px; border: none; background: transparent;
  font-size: 13px; font-weight: 600; font-family: var(--font);
  color: var(--text3); cursor: pointer; position: relative; transition: color var(--t);
}
.detail-tab:hover { color: var(--text2); }
.detail-tab.active { color: var(--accent); }
.detail-tab.active::after {
  content: ''; position: absolute; bottom: -1px; left: 16px; right: 16px;
  height: 2px; background: var(--accent); border-radius: 1px;
}
.detail-content { }
.d-item { display: flex; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.d-item:last-child { border-bottom: none; }
.d-item .label { flex: 1; color: var(--text); }
.d-item .pts { font-weight: 600; font-family: var(--mono); margin-left: 12px; }
.del-btn {
  width: 26px; height: 26px; border-radius: 6px; border: none;
  background: transparent; color: var(--text3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; margin-left: 8px; transition: all var(--t); font-size: 12px; flex-shrink: 0;
}
.del-btn:hover { background: var(--danger-light); color: var(--danger); }
.add-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 0; border: none; background: transparent;
  color: var(--text3); font-size: 12px; font-family: var(--font);
  cursor: pointer; transition: color var(--t); margin-top: 6px;
}
.add-link:hover { color: var(--accent); }
.detail-close {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: var(--bg); color: var(--text3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--t); flex-shrink: 0;
}
.detail-close:hover { background: var(--border); color: var(--text); }

/* === TOGGLE === */
.toggle {
  width: 38px; height: 22px; border-radius: 11px; border: none;
  background: var(--border2); cursor: pointer; position: relative;
  transition: background 0.25s; flex-shrink: 0;
}
.toggle.active { background: var(--accent); }
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
}
.toggle.active::after { transform: translateX(16px); }

/* === CLASS CARD === */
.class-card {
  background: var(--card); border-radius: var(--r-lg); padding: 20px;
  box-shadow: var(--shadow-sm); transition: all var(--t); cursor: pointer;
}
.class-card:hover { box-shadow: var(--shadow-md); }
.class-code { font-size: 28px; font-weight: 800; color: var(--accent); letter-spacing: -1px; font-family: var(--mono); }
.class-theme { font-size: 14px; font-weight: 600; margin-top: 4px; }
.class-date { font-size: 12px; color: var(--text2); margin-top: 2px; }
.class-att { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--text2); }
.class-att .cnt { font-weight: 700; color: var(--text); }

/* === ATTENDANCE === */
.att-section {
  background: var(--card); border-radius: var(--r-lg);
  margin-top: 16px; overflow: hidden; animation: slideDown 0.25s ease-out;
  box-shadow: var(--shadow-sm);
}
.att-header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.att-header-title { font-size: 15px; font-weight: 700; }
.att-header-info { font-size: 12px; color: var(--text2); }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px; padding: 16px 24px; }
.att-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-radius: 8px; transition: background var(--t); }
.att-item:hover { background: var(--bg); }
.att-name { font-weight: 500; font-size: 13px; }
.att-team { font-size: 11px; color: var(--text3); }
.att-item.free-listener { opacity: 0.45; }
.att-free-label { font-size: 9px; color: var(--text3); margin-left: 4px; }

/* === CARDS (Teams, etc) === */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card {
  background: var(--card); border-radius: var(--r-lg); padding: 20px;
  box-shadow: var(--shadow-sm); transition: all var(--t);
}
.card:hover { box-shadow: var(--shadow-md); }

/* === CASE === */
.case-card {
  background: var(--card); border-radius: var(--r); padding: 16px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm); transition: all var(--t);
}
.case-card:hover { box-shadow: var(--shadow-md); }
.case-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.case-student { font-weight: 600; font-size: 13px; }
.case-date { font-size: 11px; color: var(--text3); }
.case-text {
  font-size: 13px; line-height: 1.6; white-space: pre-wrap;
  max-height: 120px; overflow-y: auto; padding: 10px 12px;
  background: var(--bg); border-radius: 8px; margin-bottom: 10px;
}
.case-grade { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.inline-input {
  width: 50px; padding: 4px 8px; border: 1.5px solid var(--accent); border-radius: 6px;
  font-size: 12px; font-family: var(--mono); text-align: center; outline: none; background: var(--card);
}

/* === PROXY === */
.proxy-card {
  background: var(--card); border-radius: var(--r-lg); padding: 32px;
  max-width: 400px; box-shadow: var(--shadow-sm);
}
.proxy-status { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.proxy-dot-wrap {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); flex-shrink: 0;
}
.proxy-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; transition: background 0.3s, box-shadow 0.3s; }
.proxy-dot.on { background: var(--success); box-shadow: 0 0 10px rgba(22,163,74,0.5); }
.proxy-dot.off { background: var(--danger); box-shadow: 0 0 10px rgba(220,38,38,0.5); }
.proxy-dot.checking { background: var(--warn); animation: pdPulse 1.2s ease-in-out infinite; }
@keyframes pdPulse { 0%,100% { opacity: 1; box-shadow: 0 0 6px rgba(217,119,6,0.4); } 50% { opacity: 0.4; box-shadow: 0 0 2px rgba(217,119,6,0.2); } }
.proxy-label { font-size: 18px; font-weight: 700; }
.proxy-sub { font-size: 12px; color: var(--text2); }
.proxy-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.proxy-row-label { font-size: 14px; font-weight: 600; }
.proxy-actions { display: flex; gap: 8px; }
.proxy-info { font-size: 11px; color: var(--text3); margin-top: 16px; }

/* === SETTINGS === */
.settings-block {
  background: var(--card); border-radius: var(--r-lg); padding: 24px;
  margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.settings-block-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.s-group { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.s-group:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.s-group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.s-group-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.s-db-list { display: flex; flex-direction: column; gap: 6px; }
.s-db-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--bg); border-radius: 8px; }
.s-db-item:hover { background: var(--border); }
.s-db-label { font-weight: 600; font-size: 13px; }
.s-db-info { font-size: 11px; color: var(--text3); margin-top: 2px; }
.s-db-actions { display: flex; gap: 4px; }

/* === MODAL === */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.2);
  backdrop-filter: blur(8px); z-index: 200;
  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-card {
  background: var(--card); border-radius: var(--r-xl); padding: 28px;
  width: 100%; max-width: 460px; max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: translateY(10px) scale(0.98); transition: transform 0.2s ease;
}
.modal-overlay.open .modal-card { transform: translateY(0) scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: var(--bg); color: var(--text3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--t);
}
.modal-close:hover { background: var(--border); color: var(--text); }

/* === FORMS === */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px; border-radius: 8px;
  border: 1px solid var(--border); font-size: 14px; font-family: var(--font);
  color: var(--text); background: var(--card); outline: none;
  transition: border var(--t), box-shadow var(--t);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.form-textarea { min-height: 64px; resize: vertical; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

/* === TOAST === */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 6px; }
.toast {
  background: var(--dark); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s ease-out, toastOut 0.2s ease-in 2.6s forwards;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-6px); } }

/* === LOADING === */
.ld { display: flex; align-items: center; justify-content: center; min-height: 200px; }
.spinner { width: 24px; height: 24px; border: 2.5px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text2); }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* === HAMBURGER (hidden on desktop) === */
.topbar-hamburger {
  display: none;
  width: 36px; height: 36px; border-radius: 8px; border: none;
  background: transparent; color: var(--text); cursor: pointer;
  align-items: center; justify-content: center; transition: background var(--t);
}
.topbar-hamburger:hover { background: var(--bg); }

/* === SIDEBAR OVERLAY === */
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.3);
  z-index: 99; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.sidebar-overlay.open { opacity: 1; pointer-events: all; }

.sidebar.open-mobile { transform: translateX(0); }

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; }
  .sidebar.open-mobile { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .topbar-hamburger { display: flex; }
  .page-content { padding: 16px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .cards { grid-template-columns: 1fr; }
  .attention-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .stats-row { grid-template-columns: 1fr; }
  .filters { flex-direction: column; align-items: stretch; }
  .search-box input { min-width: 0; width: 100%; }
  .form-row { flex-direction: column; }
  .attention-grid { grid-template-columns: 1fr; }
}
