/* ═══════════════════════════════════════════════════════════
   AVTARIUM - Unified Theme v3.0
   ═══════════════════════════════════════════════════════════ */

:root {
  /* ══════ COLORS ══════ */
  --bg-deep: #060a10;
  --bg-main: #0a0f18;
  --bg-card: #0f1520;
  --bg-card-hover: #141c2a;
  --border: #1a2535;
  --mint: #00D9A5;
  --mint-glow: rgba(0, 217, 165, 0.2);
  --mint-soft: rgba(0, 217, 165, 0.1);
  --text: #cbd5e1;
  --text-secondary: #8b9cb3;
  --text-muted: #5a6a7f;
  --ozon-blue: #005bff;
  --wb-purple: #cb11ab;

  /* ══════ ALIASES ══════ */
  --bg: var(--bg-main);
  --bg-elevated: var(--bg-card);
  --card: var(--bg-card);
  --card-hover: var(--bg-card-hover);
  --line: var(--border);
  --line-strong: #243045;
  --muted: var(--text-muted);
  --muted-dark: #475569;
  --mint-hover: #00f5c4;
  --mint-subtle: var(--mint-soft);

  /* ══════ SECONDARY ══════ */
  --blue: #3b82f6;
  --blue-glow: rgba(59, 130, 246, 0.3);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;

  /* ══════ SPACING ══════ */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* ══════ RADIUS ══════ */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 9999px;

  /* ══════ SHADOWS ══════ */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 20px var(--mint-glow);

  /* ══════ TYPOGRAPHY ══════ */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', Consolas, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
}

/* ══════ LIGHT THEME ══════ */
[data-theme="light"] {
  --bg-deep: #f1f5f9;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border: rgba(15, 23, 42, 0.1);
  --line-strong: rgba(15, 23, 42, 0.15);
  --text: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --muted-dark: #94a3b8;
  --mint: #059669;
  --mint-hover: #047857;
  --mint-glow: rgba(5, 150, 105, 0.2);
  --mint-soft: rgba(5, 150, 105, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --bg: var(--bg-main);
  --bg-elevated: var(--bg-card);
  --card: var(--bg-card);
  --card-hover: var(--bg-card-hover);
  --line: var(--border);
  --muted: var(--text-muted);
  --mint-subtle: var(--mint-soft);
}

/* ══════ RESET ══════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-main);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ══════ LAYOUT ══════ */
.container { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 var(--space-5); }
.container-sm { max-width: 640px; }
.container-md { max-width: 900px; }
.container-lg { max-width: 1200px; }

/* ══════ TYPOGRAPHY ══════ */
h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.25; color: var(--text); }
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-mint { color: var(--mint); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

/* ══════ SCROLLBAR ══════ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ══════ ANIMATIONS ══════ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
@keyframes spin { to { transform: rotate(360deg); } }
.animate-fadeIn { animation: fadeIn 0.3s ease-out; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-spin { animation: spin 0.8s linear infinite; }
.fade-in { animation: fadeIn 0.4s ease-out; }

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 0.625rem 1.25rem;
  font-size: var(--text-sm); font-weight: 600; line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--mint); color: var(--bg-deep); border-color: var(--mint); }
.btn-primary:hover:not(:disabled) { background: var(--mint-hover); border-color: var(--mint-hover); box-shadow: 0 8px 30px var(--mint-glow); transform: translateY(-2px); }

.btn-secondary { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-card-hover); border-color: var(--text-muted); }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: rgba(255,255,255,0.05); }

.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover:not(:disabled) { border-color: var(--mint); color: var(--mint); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #dc2626; border-color: #dc2626; }

.btn-sm { padding: 0.4rem 0.875rem; font-size: var(--text-xs); }
.btn-lg { padding: 0.875rem 1.75rem; font-size: var(--text-base); }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-icon.btn-sm { width: 32px; height: 32px; }

.btn-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.btn-group { display: flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.btn-group .btn:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-5);
  transition: all 0.2s;
}
.card:hover { border-color: var(--line-strong); }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: var(--text-lg); font-weight: 600; }

.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-5);
  min-height: 180px;
  position: relative;
  transition: all 0.2s;
}
.module-card:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.module-card.locked { opacity: 0.6; }
.module-card.locked::after { content: '🔒'; position: absolute; top: var(--space-3); right: var(--space-3); font-size: 1.25rem; }

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-5);
}
.kpi-card .metric-value { font-size: var(--text-3xl); font-weight: 800; color: var(--text); line-height: 1; }
.kpi-card .metric-label { font-size: var(--text-sm); color: var(--text-muted); margin-top: var(--space-2); }

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-5);
  position: relative;
}
.metric-card::after {
  content: '';
  position: absolute; bottom: 0; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--mint) 0%, transparent 100%);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.metric-value { font-size: var(--text-2xl); font-weight: 700; color: var(--text); }
.metric-label { font-size: var(--text-sm); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.metric-sub { font-size: var(--text-sm); color: var(--text-muted); }
.metric-change { font-size: 0.75rem; color: var(--mint); margin-top: 0.25rem; }
.metric-change.negative { color: var(--danger); }

.shop-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-5);
  transition: all 0.2s;
}
.shop-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.shop-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: var(--space-4); }
.shop-name { font-size: var(--text-xl); font-weight: 600; color: var(--text); }
.shop-meta { font-size: var(--text-sm); color: var(--text-muted); }
.shop-stats { display: flex; gap: var(--space-4); margin-top: var(--space-4); }
.shop-actions { display: flex; gap: var(--space-2); margin-top: var(--space-5); flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════ */
.form-group { margin-bottom: var(--space-5); }
.form-label { display: block; margin-bottom: var(--space-2); font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); }
.form-input, .form-select, .form-textarea, .form-control {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: var(--text-sm);
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  transition: all 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus, .form-control:focus {
  outline: none;
  border-color: var(--mint);
  box-shadow: 0 0 0 3px var(--mint-soft);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-hint { margin-top: var(--space-1); font-size: var(--text-xs); color: var(--text-muted); }
.form-error { color: var(--danger); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}
.form-section h3 { margin: 0 0 var(--space-5); padding-bottom: var(--space-3); border-bottom: 1px solid var(--border); }
.form-actions { display: flex; gap: var(--space-3); margin-top: var(--space-5); }

.contact-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3rem;
}
.contact-form h2 { font-size: 1.5rem; margin-bottom: 2rem; }

/* ═══════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 0.25rem 0.5rem;
  font-size: var(--text-xs); font-weight: 600;
  border-radius: var(--r-full);
  border: 1px solid transparent;
}
.badge-success { background: rgba(34,197,94,0.15); color: var(--success); border-color: rgba(34,197,94,0.3); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); border-color: rgba(245,158,11,0.3); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); border-color: rgba(239,68,68,0.3); }
.badge-info { background: rgba(14,165,233,0.15); color: var(--info); border-color: rgba(14,165,233,0.3); }
.badge-mint { background: var(--mint-soft); color: var(--mint); border-color: rgba(0,217,165,0.3); }

.platform-badge { display: inline-block; padding: 2px 8px; border-radius: var(--r-sm); font-size: var(--text-xs); font-weight: 600; }
.platform-badge.ozon { background: rgba(0,91,255,0.15); color: var(--ozon-blue); }
.platform-badge.wb { background: rgba(203,17,171,0.15); color: var(--wb-purple); }

.chip {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 6px 10px;
  border-radius: var(--r-full);
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--text-muted); }
.chip.active { background: var(--mint-soft); border-color: var(--mint); color: var(--mint); }

.feature-tag {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--mint-soft);
  color: var(--mint);
  padding: 0.35rem 0.75rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 1rem;
  width: fit-content;
}

/* ═══════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════ */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); background: var(--bg-card); }
.table tbody tr:hover { background: rgba(255,255,255,0.02); }
.table-modern { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); }
.table-zebra tbody tr:nth-child(odd) { background: rgba(255,255,255,0.02); }

/* ═══════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════ */
.alert { padding: var(--space-4); border-radius: var(--r-md); border: 1px solid; font-size: var(--text-sm); margin-bottom: var(--space-4); }
.alert-success { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.3); color: var(--success); }
.alert-warning { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); color: var(--warning); }
.alert-danger, .alert-error { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: var(--danger); }
.alert-info { background: rgba(14,165,233,0.1); border-color: rgba(14,165,233,0.3); color: var(--info); }

/* ═══════════════════════════════════════════════════════════
   FILTERS
   ═══════════════════════════════════════════════════════════ */
.filters-container { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-5); }
.filter-tab {
  padding: 0.5rem 1rem;
  font-size: var(--text-sm); font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.15s;
}
.filter-tab:hover { color: var(--text); border-color: var(--text-muted); }
.filter-tab.active { color: var(--mint); background: var(--mint-soft); border-color: var(--mint); }
.pill-filter { border-radius: var(--r-full); }

  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: var(--space-5);
}
.profile-section-header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.profile-section-title { font-size: var(--text-lg); font-weight: 600; }
.profile-section-body { padding: var(--space-5); }

/* ═══════════════════════════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════════════════════════ */
.topnav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(15, 21, 32, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 var(--space-5);
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
}
.nav-brand { display: flex; align-items: center; gap: var(--space-2); text-decoration: none; }
.nav-brand .wordmark { font-size: var(--text-xl); font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.nav-left { display: flex; align-items: center; gap: var(--space-4); }
.nav-back {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: all 0.15s;
}
.nav-back:hover { color: var(--text); border-color: var(--text-muted); background: rgba(255,255,255,0.04); }

/* Nav Links - Desktop */
.nav-links { display: flex; gap: var(--space-1); }
.nav-link {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 0.5rem 0.875rem;
  font-size: var(--text-sm); font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--r-md);
  transition: all 0.15s;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-link.active { color: var(--mint); background: var(--mint-soft); }
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-aux { display: flex; align-items: center; gap: var(--space-2); }

/* Theme Toggle */
.nav-theme {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.nav-theme:hover { border-color: var(--mint); color: var(--mint); }
.theme-icon--dark { display: none; }
[data-theme="light"] .theme-icon--light { display: none; }
[data-theme="light"] .theme-icon--dark { display: block; }

/* Profile Dropdown */
.nav-profile { position: relative; }
.nav-profile__trigger {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 4px; padding-right: var(--space-2);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.nav-profile__trigger:hover { border-color: var(--text-muted); }
.nav-profile__avatar {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  background: linear-gradient(135deg, var(--mint), var(--blue));
  color: #000;
  font-size: var(--text-xs); font-weight: 600;
  border-radius: var(--r-sm);
}
.nav-profile__dropdown {
  display: none;
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-2);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
}
.nav-profile__dropdown.open { display: block; }
.nav-profile__info { padding: var(--space-2) var(--space-3); }
.nav-profile__email { font-size: var(--text-xs); color: var(--text-muted); }
.nav-profile__divider { height: 1px; background: var(--border); margin: var(--space-2) 0; }
.nav-profile__item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-radius: var(--r-md);
  transition: all 0.15s;
}
.nav-profile__item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-profile__item--danger:hover { color: var(--danger); background: rgba(239,68,68,0.1); }
.nav-profile__item svg { width: 16px; height: 16px; }

/* Burger Menu */
.nav-burger {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  width: 32px; height: 32px; padding: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
}
.nav-burger span { display: block; width: 100%; height: 2px; background: var(--text-muted); border-radius: 1px; transition: all 0.15s; }
.nav-burger[aria-expanded="true"] span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-burger[aria-expanded="true"] span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ═══════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════ */
.back-link {
  display: inline-flex; align-items: center; gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
  transition: color 0.15s;
}
.back-link:hover { color: var(--text); }

.empty-state {
  text-align: center;
  padding: var(--space-7);
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--r-lg);
}

.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

.show { display: block; }
.hidden { display: none; }

/* Grid */
.grid { display: grid; gap: var(--space-5); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* Flex */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }

/* Spacing */
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }

/* Text */
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE (mobile-first, от большого к малому)
   ═══════════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile */
@media (max-width: 768px) {
  .container { padding: 0 var(--space-4); }
  
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  
  /* Nav: скрываем ссылки, показываем бургер */
  .nav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: var(--space-4);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    z-index: 999;
  }
  .nav-links.open { display: flex; }
  .nav-link { padding: 0.75rem var(--space-4); width: 100%; }
  .nav-burger { display: flex; }
  
  .profile-header { flex-direction: column; text-align: center; }
}

/* ═══════════════════════════════════════════════════════════
   PROFILE
   ═══════════════════════════════════════════════════════════ */
.profile-container {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-4);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-6);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  margin-bottom: var(--space-6);
  min-height: 120px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mint), var(--blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  flex-shrink: 0;
}

.profile-info { flex: 1; }
.profile-info h1 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-xl);
  font-weight: 600;
}
.profile-info .email {
  color: var(--text-muted);
  font-size: var(--text-sm);
}



.profile-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  margin-bottom: var(--space-6);
  overflow: hidden;
}

.profile-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.profile-section-title {
  font-size: var(--text-base);
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.profile-section-body {
  padding: var(--space-6);
}

.profile-section-danger {
  border-color: rgba(239, 68, 68, 0.3);
}

.profile-section-danger .profile-section-header {
  background: rgba(239, 68, 68, 0.05);
}

/* Profile Items */
.security-item,
.notification-item,
.danger-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}

.security-item:last-child,
.notification-item:last-child,
.danger-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.security-item:first-child,
.notification-item:first-child,
.danger-item:first-child {
  padding-top: 0;
}

.security-info h3,
.notification-info h3,
.danger-info h3 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
}

.security-info p,
.notification-info p,
.danger-info p {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Sessions Table */
.sessions-table {
  width: 100%;
  border-collapse: collapse;
}

.sessions-table th,
.sessions-table td {
  padding: var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}

.sessions-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sessions-table tr:last-child td {
  border-bottom: none;
}

.session-current {
  background: var(--mint-soft);
}

.session-current td:first-child {
  border-left: 3px solid var(--mint);
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 500;
}

.status-enabled {
  background: var(--mint-soft);
  color: var(--mint);
}

.status-disabled {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.2s;
}

.toggle-switch.active {
  background: var(--mint);
  border-color: var(--mint);
}

.toggle-switch.active::after {
  left: 22px;
  background: white;
}

@media (max-width: 640px) {
  .profile-header {
    flex-direction: column;
    text-align: center;
    gap: var(--space-4);
  }
  
  .profile-nav {
    gap: 0;
  }
  
  .profile-nav a {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
  }
  
  .sessions-table {
    font-size: var(--text-xs);
  }
  
  .sessions-table th,
  .sessions-table td {
    padding: var(--space-2);
  }
}


/* ═══════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════ */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin-bottom: var(--space-4); }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-label { font-size: var(--text-sm); font-weight: 600; color: var(--text); }
.form-hint { font-size: var(--text-xs); color: var(--text-muted); margin-top: -var(--space-1); }
.form-input {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  transition: all 0.2s;
}
.form-input:focus { outline: none; border-color: var(--mint); background: var(--bg-deep); }
.form-input:disabled { opacity: 0.6; cursor: not-allowed; }

/* ═══════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════ */
.table-wrapper { overflow-x: auto; }
.sessions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.sessions-table thead { background: var(--bg-main); }
.sessions-table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.sessions-table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
}
.sessions-table tbody tr { transition: background 0.2s; }
.sessions-table tbody tr:hover { background: var(--bg-card-hover); }
.sessions-table tbody tr.session-current { background: rgba(0, 217, 165, 0.08); }
.sessions-table tbody tr.session-current td { border-bottom-color: var(--mint-glow); }

.device-icon { margin-right: var(--space-2); font-size: var(--text-lg); }
.ip-cell, .date-cell { color: var(--text-muted); font-family: var(--font-mono); font-size: var(--text-xs); }
.action-cell { text-align: right; }

.btn-icon-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-2);
  font-size: var(--text-lg);
  transition: color 0.2s;
  border-radius: var(--r-md);
}
.btn-icon-delete:hover { color: var(--danger); background: rgba(239, 68, 68, 0.1); }

/* ═══════════════════════════════════════════════════════════
   BADGES & STATUS
   ═══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  padding: 0.25rem 0.75rem;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--r-full);
  white-space: nowrap;
}
.badge-primary { background: var(--mint-subtle); color: var(--mint); }

.status-badge {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--r-md);
  white-space: nowrap;
}
.status-enabled { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.status-disabled { background: rgba(107, 114, 128, 0.15); color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════
   SECURITY & DANGER ITEMS
   ═══════════════════════════════════════════════════════════ */
.security-item, .danger-item, .notification-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: var(--space-4);
}
.security-item:last-child, .danger-item:last-child, .notification-item:last-child { margin-bottom: 0; }

.security-info h3, .danger-info h3, .notification-info h3 {
  margin: 0 0 var(--space-1) 0;
  font-size: var(--text-base);
}
.security-info p, .danger-info p, .notification-info p {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.security-status, .danger-status, .notification-status {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-shrink: 0;
}

.danger-item { border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.02); }

.empty-state {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════
   TOGGLE SWITCH
   ═══════════════════════════════════════════════════════════ */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  transition: 0.3s;
}
.toggle-slider:before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 3px;
  background-color: var(--text-muted);
  border-radius: var(--r-full);
  transition: 0.3s;
}
input:checked + .toggle-slider {
  background-color: var(--mint);
  border-color: var(--mint);
}
input:checked + .toggle-slider:before {
  transform: translateX(22px);
  background-color: var(--bg-deep);
}


/* ═══════════════════════════════════════════════════════════
   PROFILE PAGE - REDESIGN
   ═══════════════════════════════════════════════════════════ */
.profile-page {
  min-height: 100vh;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(0, 217, 165, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(99, 102, 241, 0.03) 0%, transparent 50%),
    var(--bg-main);
  padding: var(--space-8) var(--space-4);
}

.profile-container {
  max-width: 960px;
  margin: 0 auto;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-8);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  margin-bottom: var(--space-6);
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mint), var(--blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-3xl);
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  flex-shrink: 0;
}

.profile-info h1 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-2xl);
  font-weight: 600;
}

.profile-info .email {
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.profile-meta {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 500;
}

.badge-role {
  background: var(--mint-soft);
  color: var(--mint);
}

.badge-org {
  background: rgba(99, 102, 241, 0.1);
  color: #818cf8;
}

.badge-plan {
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
}

/* Nav с иконками */
.profile-nav {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  margin-bottom: var(--space-6);
  overflow-x: auto;
}

.profile-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--r-lg);
  transition: all 0.15s;
  white-space: nowrap;
}

.profile-nav a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.profile-nav a.active {
  color: var(--mint);
  background: var(--mint-soft);
}

.profile-nav a svg {
  opacity: 0.7;
}

.profile-nav a.active svg {
  opacity: 1;
}

/* Grid layout */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

@media (max-width: 768px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

/* Sections */
.profile-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
}

.profile-section:not(:last-child) {
  margin-bottom: var(--space-6);
}

.profile-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.profile-section-title {
  font-size: var(--text-base);
  font-weight: 600;
  margin: 0;
}

.profile-section-body {
  padding: var(--space-6);
}

.profile-section-danger {
  border-color: rgba(239, 68, 68, 0.2);
}

.profile-section-danger .profile-section-header {
  background: rgba(239, 68, 68, 0.03);
}

/* Info Grid */
.info-grid {
  display: grid;
  gap: var(--space-4);
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.info-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.info-label {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.info-value {
  font-weight: 500;
}

/* Security/Notification Items */
.security-item,
.notification-item,
.danger-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
  gap: var(--space-4);
}

.security-item:last-child,
.notification-item:last-child,
.danger-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.security-item:first-child,
.notification-item:first-child,
.danger-item:first-child {
  padding-top: 0;
}

.security-info h3,
.notification-info h3,
.danger-info h3 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
}

.security-info p,
.notification-info p,
.danger-info p {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.security-status,
.notification-actions {
  display: flex;
  align-items: center;
}

/* Sessions */
.sessions-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.session-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-main);
  border-radius: var(--r-lg);
  border: 1px solid transparent;
}

.session-item.session-current {
  background: var(--mint-soft);
  border-color: rgba(0, 217, 165, 0.2);
}

.session-icon {
  color: var(--text-muted);
}

.session-info {
  flex: 1;
}

.session-device {
  font-size: var(--text-sm);
  margin-bottom: var(--space-1);
}

.session-meta {
  display: flex;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch-label {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

.toggle-switch-label input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  transition: all 0.2s;
}

.toggle-switch-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.2s;
}

.toggle-switch-label input:checked + .toggle-switch-slider {
  background: var(--mint);
  border-color: var(--mint);
}

.toggle-switch-label input:checked + .toggle-switch-slider::before {
  transform: translateX(22px);
  background: white;
}

/* Billing Card */
.billing-card {
  background: linear-gradient(135deg, rgba(0, 217, 165, 0.05), rgba(99, 102, 241, 0.05));
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--space-6);
}

.billing-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
}

.billing-card-header h3 {
  font-size: var(--text-xl);
  font-weight: 700;
  margin: 0;
}

.billing-price {
  text-align: right;
}

.price-amount {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--mint);
}

.price-currency {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.billing-desc {
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.billing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-5);
}

.billing-features li {
  padding: var(--space-2) 0;
  padding-left: var(--space-6);
  position: relative;
  color: var(--text-secondary);
}

.billing-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--mint);
  font-weight: 600;
}

/* Modal */
.modal {
  padding: 0;
  border: none;
  border-radius: var(--r-xl);
  background: var(--bg-card);
  box-shadow: var(--shadow-xl);
  max-width: 400px;
  width: 90%;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  padding: var(--space-6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
}

.modal-header h3 {
  margin: 0;
  font-size: var(--text-lg);
}

.modal-close {
  background: none;
  border: none;
  font-size: var(--text-2xl);
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

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

@media (max-width: 640px) {
  .profile-header {
    flex-direction: column;
    text-align: center;
    padding: var(--space-6);
  }
  
  .profile-meta {
    justify-content: center;
  }
  
  .profile-nav {
    padding: var(--space-2);
  }
  
  .profile-nav a {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
  }
  
  .profile-nav a svg {
    display: none;
  }
}
