/* ===== IT-КУБ ПЛАТФОРМА — СТИЛИ v2 (тёмная + светлая тема) ===== */

:root, [data-theme="dark"] {
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --primary-light: #a78bfa;
  --secondary: #06b6d4;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #f43f5e;
  --warning: #f59e0b;

  --bg-body: #0a0e1a;
  --bg-gradient: radial-gradient(ellipse 80% 50% at 20% -10%, rgba(124,58,237,0.25), transparent),
                 radial-gradient(ellipse 60% 40% at 90% 10%, rgba(6,182,212,0.15), transparent),
                 #0a0e1a;
  --bg-card: rgba(23, 28, 48, 0.7);
  --bg-card-solid: #171c30;
  --bg-card-hover: rgba(34, 40, 65, 0.85);
  --bg-input: rgba(10, 14, 26, 0.6);
  --bg-sidebar: rgba(15, 19, 35, 0.85);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border: rgba(99, 102, 241, 0.15);
  --border-light: rgba(148, 163, 184, 0.25);
  --glass-blur: blur(16px);

  --rarity-common: #9ca3af;
  --rarity-uncommon: #10b981;
  --rarity-rare: #3b82f6;
  --rarity-epic: #a855f7;
  --rarity-legendary: #f59e0b;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 24px rgba(124,58,237,0.35);
  --gradient-brand: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
}

[data-theme="light"] {
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --primary-light: #7c3aed;
  --secondary: #0891b2;
  --success: #059669;
  --danger: #e11d48;

  --bg-body: #f1f5f9;
  --bg-gradient: radial-gradient(ellipse 80% 50% at 20% -10%, rgba(124,58,237,0.10), transparent),
                 radial-gradient(ellipse 60% 40% at 90% 10%, rgba(6,182,212,0.08), transparent),
                 #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-solid: #ffffff;
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-input: rgba(241, 245, 249, 0.8);
  --bg-sidebar: rgba(255, 255, 255, 0.9);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border: rgba(124, 58, 237, 0.15);
  --border-light: rgba(100, 116, 139, 0.3);

  --shadow: 0 8px 32px rgba(15,23,42,0.08);
  --shadow-glow: 0 0 24px rgba(124,58,237,0.15);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { opacity: 0.85; }

/* ===== LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 264px;
  background: var(--bg-sidebar);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.main-content {
  margin-left: 264px;
  flex: 1;
  padding: 32px;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar-logo { padding: 24px 20px 16px; border-bottom: 1px solid var(--border); }

.sidebar-logo .logo-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-cube {
  width: 40px; height: 40px;
  background: var(--gradient-brand);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 16px rgba(124,58,237,0.4);
}

.sidebar-logo .logo-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-weight: 400; }

.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar-link { display: flex; align-items: center; gap: 12px; flex: 1; border-radius: var(--radius-sm); transition: background 0.2s; padding: 4px; margin: -4px; }
.user-avatar-link:hover { background: var(--bg-card-hover); opacity: 1; }

.sidebar-user .user-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid var(--border-light);
}

.sidebar-user .user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user .user-info .user-name { font-weight: 700; font-size: 14px; color: var(--text-primary); }
.sidebar-user .user-info .user-role { font-size: 11px; color: var(--text-muted); }
.sidebar-user .edit-hint { font-size: 13px; color: var(--text-muted); margin-left: auto; }

.sidebar-nav { padding: 12px 0; flex: 1; }

.nav-section {
  padding: 10px 20px 6px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  margin: 2px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); opacity: 1; }

.nav-item.active {
  background: linear-gradient(135deg, rgba(124,58,237,0.25), rgba(6,182,212,0.12));
  color: var(--primary-light);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(124,58,237,0.3);
}

.nav-item .nav-icon { font-size: 18px; width: 24px; text-align: center; }

.sidebar-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 6px 8px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.theme-toggle:hover { border-color: var(--primary); }
.theme-toggle .theme-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); padding-left: 8px; }
.theme-toggle .theme-knob {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: transform 0.3s;
}

.sidebar-footer .logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.sidebar-footer .logout-btn:hover { color: var(--danger); background: rgba(244,63,94,0.1); }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 30px; font-weight: 800; color: var(--text-primary); margin-bottom: 4px; letter-spacing: -0.5px; }
.page-header .page-subtitle { color: var(--text-secondary); font-size: 15px; }

/* ===== CARDS (glassmorphism) ===== */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.25s;
  box-shadow: var(--shadow);
}

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

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.25s;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-brand);
  opacity: 0;
  transition: opacity 0.25s;
}

.stat-card:hover { border-color: var(--primary); box-shadow: var(--shadow-glow); transform: translateY(-3px); }
.stat-card:hover::before { opacity: 1; }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.stat-icon.purple { background: linear-gradient(135deg, rgba(124,58,237,0.3), rgba(124,58,237,0.1)); }
.stat-icon.blue   { background: linear-gradient(135deg, rgba(6,182,212,0.3), rgba(6,182,212,0.1)); }
.stat-icon.gold   { background: linear-gradient(135deg, rgba(245,158,11,0.3), rgba(245,158,11,0.1)); }
.stat-icon.green  { background: linear-gradient(135deg, rgba(16,185,129,0.3), rgba(16,185,129,0.1)); }

.stat-info .stat-value { font-size: 28px; font-weight: 800; color: var(--text-primary); line-height: 1; letter-spacing: -1px; }
.stat-info .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 5px; font-weight: 600; }

/* ===== XP BAR ===== */
.xp-bar-container {
  background: var(--bg-input);
  border-radius: 99px;
  height: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.xp-bar-fill {
  height: 100%;
  background: var(--gradient-brand);
  border-radius: 99px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 12px rgba(124,58,237,0.5);
}

.xp-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 2.2s infinite;
}

@keyframes shimmer { 100% { left: 100%; } }

.xp-info { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.xp-info .xp-text { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.xp-info .xp-percent { font-size: 13px; color: var(--primary-light); font-weight: 800; }

/* ===== LEVEL BADGE ===== */
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(124,58,237,0.25), rgba(6,182,212,0.15));
  border: 1px solid rgba(124,58,237,0.4);
  border-radius: 99px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-light);
}

/* ===== ACHIEVEMENTS ===== */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.achievement-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  transition: all 0.25s;
  cursor: default;
  position: relative;
}

.achievement-card:hover { transform: translateY(-4px) scale(1.02); box-shadow: var(--shadow); }
.achievement-card.locked { opacity: 0.4; filter: grayscale(1); }
.achievement-card.secret.locked .ach-icon,
.achievement-card.secret.locked .ach-name { filter: blur(4px); }

.achievement-card.rarity-common   { border-color: var(--rarity-common); }
.achievement-card.rarity-uncommon { border-color: var(--rarity-uncommon); }
.achievement-card.rarity-rare     { border-color: var(--rarity-rare); }
.achievement-card.rarity-epic     { border-color: var(--rarity-epic); box-shadow: 0 0 14px rgba(168,85,247,0.2); }
.achievement-card.rarity-legendary { border-color: var(--rarity-legendary); box-shadow: 0 0 16px rgba(245,158,11,0.35); }
.achievement-card.rarity-epic.locked, .achievement-card.rarity-legendary.locked { box-shadow: none; }

.ach-icon { font-size: 38px; margin-bottom: 10px; display: block; line-height: 1; }
.ach-icon img { width: 52px; height: 52px; object-fit: contain; border-radius: var(--radius-sm); }
.ach-name { font-size: 12px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; line-height: 1.3; }

.ach-rarity { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.8px; }
.ach-rarity.common   { color: var(--rarity-common); }
.ach-rarity.uncommon { color: var(--rarity-uncommon); }
.ach-rarity.rare     { color: var(--rarity-rare); }
.ach-rarity.epic     { color: var(--rarity-epic); }
.ach-rarity.legendary { color: var(--rarity-legendary); }

/* ===== PROJECTS ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}

.project-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.25s;
  box-shadow: var(--shadow);
}

.project-card:hover { border-color: var(--primary); transform: translateY(-4px); box-shadow: var(--shadow-glow); }

.project-cover {
  width: 100%;
  height: 145px;
  object-fit: cover;
  background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(6,182,212,0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
}

.project-cover img { width: 100%; height: 100%; object-fit: cover; }
.project-body { padding: 16px; }
.project-title { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.project-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.project-tag {
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 99px;
  font-weight: 700;
  background: rgba(124,58,237,0.18);
  color: var(--primary-light);
  border: 1px solid rgba(124,58,237,0.3);
}

/* ===== GROUP CHIPS ===== */
.group-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }

.group-chip {
  padding: 8px 18px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.group-chip:hover { border-color: var(--primary); color: var(--primary-light); opacity: 1; }

.group-chip.active {
  background: var(--gradient-brand);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(124,58,237,0.4);
}

/* ===== TIMELINE ===== */
.timeline { position: relative; padding-left: 36px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 14px; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  opacity: 0.4;
}

.timeline-item { position: relative; margin-bottom: 20px; }

.timeline-dot {
  position: absolute;
  left: -30px; top: 4px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-card-solid);
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  z-index: 1;
  box-shadow: 0 0 10px rgba(124,58,237,0.3);
}

.timeline-content {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  transition: all 0.2s;
}

.timeline-content:hover { border-color: var(--border-light); transform: translateX(4px); }
.timeline-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.timeline-desc { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.timeline-date { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s;
  outline: none;
  font-family: inherit;
}

.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.18); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control option { background: var(--bg-card-solid); }

/* Чекбокс-чипы направлений */
.direction-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.dir-check { position: relative; }
.dir-check input { position: absolute; opacity: 0; pointer-events: none; }
.dir-check label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.dir-check input:checked + label {
  background: var(--gradient-brand);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(124,58,237,0.4);
}

/* ===== EMOJI PICKER ===== */
.emoji-input-wrap { position: relative; }
.emoji-input-wrap .form-control { cursor: pointer; }

.emoji-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  display: none;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  width: 320px;
  max-height: 240px;
  overflow-y: auto;
}

.emoji-panel.open { display: grid; }

.emoji-panel button {
  background: none;
  border: none;
  font-size: 22px;
  padding: 6px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s;
}

.emoji-panel button:hover { background: var(--bg-card-hover); transform: scale(1.25); }

/* ===== AVATAR GALLERY ===== */
.avatar-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 14px;
}

.avatar-option {
  position: relative;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
}

.avatar-option:hover { transform: scale(1.08); border-color: var(--primary-light); }
.avatar-option.selected { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(124,58,237,0.25), var(--shadow-glow); }
.avatar-option img { width: 100%; height: 100%; object-fit: cover; }
.avatar-option .check-mark {
  position: absolute;
  bottom: 2px; right: 2px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border: 2px solid var(--bg-card-solid);
}
.avatar-option.inactive { opacity: 0.35; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  outline: none;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary { background: var(--gradient-brand); color: white; box-shadow: 0 4px 14px rgba(124,58,237,0.35); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124,58,237,0.5); opacity: 1; color: white; }

.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-light); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary-light); opacity: 1; }

.btn-success { background: rgba(16,185,129,0.15); color: var(--success); border: 1px solid var(--success); }
.btn-success:hover { background: var(--success); color: white; opacity: 1; }

.btn-danger { background: rgba(244,63,94,0.12); color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; opacity: 1; }

.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tr { transition: background 0.15s; }
.data-table tr:hover td { background: rgba(124,58,237,0.05); }
.data-table tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
}

.badge-primary { background: rgba(124,58,237,0.18); color: var(--primary-light); }
.badge-success { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger  { background: rgba(244,63,94,0.12); color: var(--danger); }
.badge-muted   { background: rgba(100,116,139,0.15); color: var(--text-muted); }

/* ===== ALERTS ===== */
.alert {
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: var(--glass-blur);
  animation: slideIn 0.3s ease;
}

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

.alert-success { background: rgba(16,185,129,0.12); border: 1px solid var(--success); color: var(--success); }
.alert-error   { background: rgba(244,63,94,0.1); border: 1px solid var(--danger); color: var(--danger); }
.alert-info    { background: rgba(124,58,237,0.12); border: 1px solid var(--primary); color: var(--primary-light); }

/* ===== LOGIN ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  pointer-events: none;
  animation: float 8s ease-in-out infinite;
}

.login-orb.orb-1 { width: 400px; height: 400px; background: rgba(124,58,237,0.4); top: -100px; left: -100px; }
.login-orb.orb-2 { width: 350px; height: 350px; background: rgba(6,182,212,0.3); bottom: -80px; right: -80px; animation-delay: 4s; }

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, -30px); }
}

.login-box {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 430px;
  position: relative;
  box-shadow: var(--shadow);
}

.login-theme-btn {
  position: absolute;
  top: 18px; right: 18px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px; height: 38px;
  font-size: 17px;
  cursor: pointer;
  transition: all 0.2s;
}
.login-theme-btn:hover { border-color: var(--primary); transform: rotate(20deg); }

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

.login-logo .cube-icon {
  width: 72px; height: 72px;
  background: var(--gradient-brand);
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 18px;
  box-shadow: 0 12px 40px rgba(124,58,237,0.5);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 12px 40px rgba(124,58,237,0.5); }
  50% { box-shadow: 0 12px 50px rgba(6,182,212,0.6); }
}

.login-logo h1 { font-size: 24px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
.login-logo p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 52px; margin-bottom: 16px; opacity: 0.7; }
.empty-state h3 { font-size: 18px; color: var(--text-secondary); margin-bottom: 8px; font-weight: 700; }
.empty-state p { font-size: 14px; }

/* ===== PROFILE HERO ===== */
.profile-hero {
  background: linear-gradient(135deg, rgba(124,58,237,0.18), rgba(6,182,212,0.08));
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.profile-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6,182,212,0.18), transparent 70%);
}

.profile-hero-inner { display: flex; align-items: center; gap: 24px; position: relative; }

.profile-avatar-lg {
  width: 88px; height: 88px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  box-shadow: 0 0 24px rgba(124,58,237,0.4);
}

.profile-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.profile-info .profile-nickname { font-size: 26px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
.profile-info .profile-meta { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.profile-info .profile-badges { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,8,18,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(6px);
}

[data-theme="light"] .modal-overlay { background: rgba(15,23,42,0.4); }

.modal-box {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: modalIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } }

.modal-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-light); margin-bottom: 24px; overflow-x: auto; }

.tab-btn {
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1px;
  white-space: nowrap;
  font-family: inherit;
}

.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active { color: var(--primary-light); border-bottom-color: var(--primary); }

/* ===== SECTION GRID ===== */
.section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* ===== SEARCH ===== */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  gap: 10px;
  transition: border-color 0.2s;
}

.search-bar:focus-within { border-color: var(--primary); }
.search-bar input { background: none; border: none; outline: none; color: var(--text-primary); font-size: 14px; flex: 1; font-family: inherit; }
.search-bar .search-icon { color: var(--text-muted); }

/* ===== MOBILE ===== */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 200;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-primary);
  box-shadow: var(--shadow);
}

/* Предотвращаем горизонтальный выход контента за пределы экрана */
html, body { max-width: 100%; overflow-x: hidden; }

@media (max-width: 768px) {
  .section-grid { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); width: 80vw; max-width: 300px; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 64px 14px 24px; max-width: 100vw; overflow-x: hidden; }

  /* Профиль-герой: вертикально, по центру */
  .profile-hero { padding: 22px 18px; }
  .profile-hero-inner { flex-direction: column; text-align: center; gap: 16px; }
  .profile-info .profile-nickname { font-size: 22px; }
  .profile-info .profile-badges { justify-content: center; }

  /* Сетки статистики и достижений */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 16px; gap: 12px; }
  .stat-icon { width: 44px; height: 44px; font-size: 20px; }
  .stat-info .stat-value { font-size: 22px; }
  .achievements-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .projects-grid { grid-template-columns: 1fr; }

  .mobile-menu-btn { display: flex; }
  .page-header h1 { font-size: 23px; }
  .emoji-panel { width: 280px; grid-template-columns: repeat(7, 1fr); }

  /* XP-бар: не даём подписи уехать */
  .xp-info { flex-wrap: wrap; gap: 4px; }

  /* Таблицы: горизонтальная прокрутка ВНУТРИ карточки, а не всей страницы */
  .card { padding: 16px; }
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;        /* таблица занимает всю ширину карточки */
    padding: 0 16px;
  }
  .data-table { min-width: 520px; }   /* читаемая ширина, скроллится свайпом */

  /* Чипы групп и вкладки — горизонтальный свайп без переноса */
  .group-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    margin: 0 -14px 16px;
    padding-left: 14px;
    padding-right: 14px;
  }
  .group-chip { flex-shrink: 0; }
  .tabs { flex-wrap: nowrap; }
  .tab-btn { flex-shrink: 0; }

  /* Заголовки с кнопкой: кнопка под заголовком, во всю ширину */
  .flex-between { gap: 12px; }
  .page-header.flex-between .btn,
  .flex-between > .btn { width: 100%; justify-content: center; }

  /* Модальные окна */
  .modal-box { padding: 22px 18px; }
  .section-grid { gap: 14px; }

  /* Формы поиска не вылезают */
  .search-bar { flex-wrap: wrap; }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
  .achievements-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-avatar-lg { width: 76px; height: 76px; font-size: 34px; }
}

/* ===== UTILS ===== */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; } .text-xs { font-size: 11px; }
.fw-bold { font-weight: 700; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary-color { color: var(--primary-light); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
