@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Montserrat:wght@600;700;800&display=swap');

:root {
  color-scheme: dark;
  --nx-bg: #080910;
  --nx-surface: #121522;
  --nx-border: rgba(180, 174, 218, .14);
  --nx-text: #F4F2FF;
  --nx-text-muted: #A5A4B8;
  --nx-primary: #7C3AED;
  --nx-accent: #22D3EE;
  --nx-font-heading: 'Montserrat', sans-serif;
  --nx-font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(ellipse at 82% 0%, rgba(91,33,182,.15), transparent 34rem), var(--nx-bg);
  color: var(--nx-text);
  font-family: var(--nx-font-body);
  line-height: 1.55;
  min-height: 100vh;
}

/* Типографика */
h1, h2, h3, h4, .logo-text, .kpi-value, .price-val, .price-name {
  font-family: var(--nx-font-heading) !important;
  letter-spacing: -0.02em;
  color: white;
}

/* --- ОБЩИЙ LAYOUT (Сайдбар + Контент) --- */
body.has-sidebar { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: rgba(18, 21, 34, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--nx-border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
}

.sidebar .brand-logo {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; margin-bottom: 40px;
}
.sidebar .brand-logo img { height: 32px; width: auto; }

.sidebar .nav-item {
  display: block; padding: 12px 16px; border-radius: 12px;
  color: var(--nx-text-muted); text-decoration: none;
  margin-bottom: 8px; transition: 0.2s; cursor: pointer;
  font-weight: 500; font-size: 15px;
}
.sidebar .nav-item:hover, 
.sidebar .nav-item.active {
  background: rgba(124, 58, 237, 0.15);
  color: white;
  border: 1px solid rgba(124, 58, 237, 0.3);
}

.main-content {
  flex: 1; padding: 40px; overflow-y: auto;
  position: relative; z-index: 5;
}

/* --- ФОНОВОЕ СВЕЧЕНИЕ --- */
.glow-bg {
  position: fixed; top: -10%; right: -10%;
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(124,58,237,0.12) 0%, transparent 60%);
  filter: blur(80px); z-index: 1; pointer-events: none;
}

/* --- КОМПОНЕНТЫ --- */
.nx-panel {
  background: rgba(25, 29, 45, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--nx-border);
  border-radius: 22px;
  box-shadow: 0 18px 60px rgba(0,0,0,.38);
  padding: 28px;
}

.nx-button-primary {
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(110deg,#6D28D9,#8B5CF6);
  color: white; border: none;
  padding: 14px 24px; border-radius: 999px;
  font-family: var(--nx-font-heading); font-size: 15px; font-weight: 700;
  cursor: pointer; transition: 0.2s; text-decoration: none;
  box-shadow: 0 8px 24px rgba(109,40,217,0.25);
}
.nx-button-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(109,40,217,0.4);
  text-decoration: none;
}

.nx-input {
  width: 100%; padding: 14px 16px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--nx-border);
  border-radius: 12px; color: white;
  font-family: var(--nx-font-body); font-size: 15px;
  outline: none; transition: 0.2s;
}
.nx-input:focus {
  border-color: var(--nx-primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}

/* Карточки записей/клиентов */
.card {
  background: rgba(18, 21, 34, 0.6);
  border: 1px solid var(--nx-border);
  border-radius: 16px; padding: 20px; margin-bottom: 12px;
  transition: 0.2s;
}
.card:hover { border-color: rgba(124, 58, 237, 0.4); }

/* KPI карточки */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 40px; }
.kpi-card { background: rgba(18, 21, 34, 0.6); padding: 24px; border-radius: 16px; border: 1px solid var(--nx-border); }
.kpi-title { color: var(--nx-text-muted); font-size: 14px; margin-bottom: 8px; font-weight: 500; }
.kpi-value { font-size: 34px; font-weight: 800; color: white; }

/* Мобильная адаптация */
@media (max-width: 768px) {
  body.has-sidebar { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--nx-border); padding: 16px; flex-direction: row; overflow-x: auto; gap: 12px; align-items: center; }
  .sidebar .brand-logo { margin-bottom: 0; margin-right: 16px; }
  .sidebar .nav-item { margin-bottom: 0; white-space: nowrap; padding: 8px 12px; font-size: 14px; }
  .main-content { padding: 20px; }
}

/* --- Мобильная навигация (PWA) --- */
@media (max-width: 768px) {
  body.has-sidebar { padding-left: 0 !important; padding-bottom: 70px !important; }
  .sidebar { display: none !important; }
  
  .mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: rgba(12, 14, 24, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--nx-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
  }
  
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--nx-text-muted);
    font-size: 10px;
    gap: 4px;
    transition: 0.2s;
  }
  
  .mobile-nav-item.active { color: var(--nx-primary); }
  .mobile-nav-icon { font-size: 20px; }
  
  /* Адаптация конструктора */
  .workspace { top: 60px; }
  .sidebar { width: 100%; height: 120px; top: auto; bottom: 65px; flex-direction: row; padding: 10px; overflow-x: auto; }
  .canvas { left: 0; bottom: 185px; }
  .node { width: 180px; }
}
