/* ========== ГЛОБАЛЬНЫЕ СТИЛИ v4.0 (БРЕНД ТН — ТРАНСПОРТНАЯ НАУКА) ========== */
:root {
  --app-bg: #F8FAFC;
  --app-surface: #FFFFFF;
  --app-surface-hover: #F1F5F9;
  --app-border: #E2E8F0;
  --app-border-light: #F1F5F9;
  --app-text: #0F172A;
  --app-text-muted: #64748B;
  --app-text-light: #94A3B8;
  --app-primary: #0A0A0A;
  --app-primary-lighter: #F8FAFC;
  --app-accent: #2563EB;
  --app-success: #059669;
  --app-warning: #D97706;
  --app-radius: 14px;
  --app-radius-sm: 8px;
  --app-shadow: 0 4px 24px rgba(0,0,0,0.06);
  --app-shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
  --app-font: 'Inter', 'Mulish', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Системная тёмная тема */
@media (prefers-color-scheme: dark) {
  :root {
    --app-bg: #0B1120;
    --app-surface: #151D2E;
    --app-surface-hover: #1E293B;
    --app-border: #1E293B;
    --app-border-light: #334155;
    --app-text: #F8FAFC;
    --app-text-muted: #94A3B8;
    --app-text-light: #64748B;
    --app-primary: #FFFFFF;
    --app-accent: #3B82F6;
    --app-success: #34D399;
    --app-warning: #FBBF24;
    --app-shadow: 0 4px 24px rgba(0,0,0,0.4);
    --app-shadow-lg: 0 12px 40px rgba(0,0,0,0.6);
  }
}

/* Глобальные настройки */
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body { background: var(--app-bg); color: var(--app-text); line-height: 1.5; overflow-x: hidden; }
* { box-sizing: border-box; }
button, input, select { font-family: inherit; }

/* ========== ЗАГЛУШКА: ОБЁРТКА И МАКЕТ ========== */
.ts-wrapper {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  display: grid; place-items: center;
  background: var(--app-bg);
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
}
.ts-wrapper input, .ts-wrapper button, .ts-domain { -webkit-user-select: text; user-select: text; }

/* Заблюренный слой */
.ts-blur {
  position: absolute; inset: 0;
  backdrop-filter: blur(32px) saturate(140%);
  -webkit-backdrop-filter: blur(32px) saturate(140%);
  background: rgba(var(--app-bg), 0.35);
  z-index: 10;
  pointer-events: none;
}

/* Интерактивный домен */
.ts-foreground {
  position: relative; z-index: 20;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 20px; text-align: center;
  max-width: 90vw;
}

/* === ЛОГОТИП БРЕНДА «ТН» === */
.ts-logo {
  display: flex; align-items: center; gap: 0;
  padding: 8px 24px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 16px;
  box-shadow: var(--app-shadow);
  transition: var(--transition);
  cursor: pointer;
  overflow: hidden;
  position: relative;
}
.ts-logo:hover { transform: translateY(-2px); box-shadow: var(--app-shadow-lg); border-color: var(--app-primary); }

.ts-logo-badge {
  width: 48px; height: 48px;
  background: var(--app-primary);
  color: var(--app-bg);
  border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 900; font-size: 20px;
  letter-spacing: -1px;
  position: relative;
  flex-shrink: 0;
}
/* Флаг России — тонкая полоса внизу лого */
.ts-logo-badge::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 6px;
  display: flex;
  background: linear-gradient(180deg,
    #FFFFFF 0%, #FFFFFF 33.33%,
    #0039A6 33.33%, #0039A6 66.66%,
    #D52B1E 66.66%, #D52B1E 100%
  );
  border-radius: 0 0 10px 10px;
}

.ts-logo-text {
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--app-text);
  margin-left: 12px;
  line-height: 1.2;
}
.ts-logo-text span {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--app-text-muted);
  text-transform: none;
  letter-spacing: 0.5px;
}

.ts-domain {
  font-size: clamp(2.2rem, 6vw, 4.5rem);
  font-weight: 900; line-height: 1.1; letter-spacing: -0.03em;
  margin: 8px 0 0;
  background: linear-gradient(135deg, var(--app-text) 0%, var(--app-text-muted) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  cursor: text; position: relative;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease;
  user-select: text;
}
.ts-domain:hover {
  transform: scale(1.025) translateY(-2px);
  filter: drop-shadow(0 12px 20px rgba(var(--app-text), 0.15));
}
.ts-domain::after {
  content: ''; position: absolute; bottom: -6px; left: 50%; width: 0; height: 3px;
  background: linear-gradient(90deg, var(--app-primary), var(--app-accent));
  border-radius: 2px; transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateX(-50%);
}
.ts-domain:hover::after { width: 80%; }

.ts-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--app-text-muted); font-weight: 500; margin-top: 4px;
  letter-spacing: 0.02em;
}

/* Статус разработки */
.ts-status {
  margin-top: 10px;
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--app-text-muted);
  font-weight: 500; letter-spacing: 0.02em;
  padding: 6px 14px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 40px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.ts-status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--app-warning);
  animation: pulse-status 2s infinite;
}
@keyframes pulse-status {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(217,119,6,0.4); }
  50% { opacity: 0.6; transform: scale(1.3); box-shadow: 0 0 0 6px rgba(217,119,6,0); }
}
@media (prefers-reduced-motion: reduce) {
  .ts-status-dot { animation: none; opacity: 0.8; }
}

/* ========== МАКЕТ ДАШБОРДА (ПОД БЛЮРОМ) ========== */
.ts-dashboard {
  position: absolute; top: -40px; left: -40px;
  width: calc(100% + 80px); height: calc(100% + 80px);
  background: var(--app-surface);
  border-radius: 24px; box-shadow: var(--app-shadow-lg);
  border: 1px solid var(--app-border);
  display: grid; grid-template-columns: 240px 1fr;
  overflow: hidden;
  z-index: 1;
  transform: scale(1.04);
  opacity: 0.95;
  pointer-events: none;
}
@media (max-width: 900px) { .ts-dashboard { grid-template-columns: 70px 1fr; } }

/* Сайдбар */
.db-sidebar { background: var(--app-bg); border-right: 1px solid var(--app-border); padding: 20px; display: flex; flex-direction: column; gap: 24px; }
.db-nav { display: flex; flex-direction: column; gap: 10px; }
.db-nav-item { height: 36px; border-radius: 8px; background: var(--app-border-light); position: relative; overflow: hidden; }
.db-nav-item.active { background: var(--app-surface-hover); }
.db-nav-item:nth-child(1) { width: 90%; } .db-nav-item:nth-child(2) { width: 80%; } .db-nav-item:nth-child(3) { width: 85%; } .db-nav-item:nth-child(4) { width: 70%; }
.db-user { margin-top: auto; height: 44px; border-radius: 12px; background: var(--app-surface); border: 1px solid var(--app-border); display: flex; align-items: center; gap: 10px; padding: 0 12px; }
.db-avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--app-accent), var(--app-primary)); }

/* Основная область */
.db-main { padding: 20px 24px; display: flex; flex-direction: column; gap: 20px; }
.db-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.db-search { height: 38px; width: 280px; border-radius: 20px; background: var(--app-bg); border: 1px solid var(--app-border); }
.db-actions { display: flex; gap: 12px; }
.db-btn { height: 36px; width: 100px; border-radius: 20px; background: var(--app-primary); }
.db-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--app-surface); border: 1px solid var(--app-border); }

.db-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .db-grid { grid-template-columns: 1fr; } .db-search { width: 100%; } }

.db-card { background: var(--app-bg); border: 1px solid var(--app-border); border-radius: 16px; padding: 16px; min-height: 140px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
.db-card.wide { grid-column: span 2; min-height: 200px; }
.db-title { height: 10px; width: 35%; background: var(--app-border); border-radius: 6px; margin-bottom: 12px; }
.db-metric { height: 24px; width: 45%; background: var(--app-text); border-radius: 6px; margin-bottom: 6px; opacity: 0.85; }
.db-sub { height: 8px; width: 60%; background: var(--app-text-muted); border-radius: 4px; opacity: 0.6; }
.db-bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 60px; margin-top: 16px; }
.db-bar { flex: 1; background: var(--app-primary); opacity: 0.4; border-radius: 4px; }
.db-bar:nth-child(odd) { background: var(--app-accent); opacity: 0.6; }
.db-table { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.db-row { display: grid; grid-template-columns: 3fr 1fr 1fr 0.5fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--app-border); }
.db-cell { height: 8px; background: var(--app-text-muted); border-radius: 4px; opacity: 0.4; }
.db-cell.short { width: 40%; opacity: 0.3; }
.db-badge { height: 18px; width: 60px; background: var(--app-success); opacity: 0.3; border-radius: 12px; align-self: center; }
.db-btn-sm { height: 24px; width: 40px; background: var(--app-primary); opacity: 0.2; border-radius: 6px; align-self: center; }