/* ==================== БАЗОВЫЕ ПЕРЕМЕННЫЕ ==================== */
:root {
  --bg: #0b1120;
  --bg-elevated: #111827;
  --card: #161f33;
  --card-border: rgba(148, 163, 184, 0.15);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #6366f1;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --tg: #2aabee;
  --radius: 16px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --topbar-h: 64px;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ==================== СТРАНИЦЫ КАБИНЕТА И АВТОРИЗАЦИИ (ФИКСАЦИЯ НА МОБИЛЬНЫХ) ==================== */
body.app-page {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

@media (max-width: 900px) {
  body.app-page {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: manipulation;
  }
}

/* ==================== ЛЕНДИНГ (index.html) ==================== */
body.landing-page {
  overflow-x: hidden;
  line-height: 1.55;
}

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(11, 17, 32, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-border);
  padding-top: var(--safe-top);
}

.header-inner {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.header-brand-text {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.18s;
}

.header-link:hover, .header-link.active {
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.burger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--bg-elevated);
  cursor: pointer;
}

.burger-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.mobile-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px 22px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--card-border);
  animation: fadeSlideUp 0.2s ease;
}

.mobile-menu-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  padding: 8px 4px;
}

.mobile-menu-cta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

@media (max-width: 860px) {
  .header-nav { display: none; }
  .header-actions .btn { display: none; }
  .burger-btn { display: inline-flex; }
}

/* HERO */
.hero-section {
  padding: 64px 0 72px;
  background: radial-gradient(circle at 80% 10%, rgba(59, 130, 246, 0.2), transparent 45%),
              radial-gradient(circle at 10% 80%, rgba(99, 102, 241, 0.16), transparent 45%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 40px;
  align-items: center;
}

@media (max-width: 940px) {
  .hero-section { padding: 40px 0 52px; }
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 18px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.22);
}

.hero-title {
  margin: 0 0 16px;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.text-gradient {
  background: linear-gradient(135deg, #60a5fa, #818cf8, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  margin: 0 0 26px;
  font-size: 16px;
  color: var(--text-muted);
  max-width: 560px;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-buttons.center { justify-content: center; }

.btn-lg {
  padding: 13px 22px;
  font-size: 15px;
  border-radius: 12px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--card-border);
}

.hero-metric strong {
  display: block;
  font-size: 22px;
  font-weight: 800;
}

.hero-metric span {
  font-size: 12px;
  color: var(--text-muted);
}

/* Превью-окно в Hero */
.preview-window {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.45);
}

.preview-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--card-border);
}

.preview-dots { display: flex; gap: 6px; }
.preview-dots span { width: 10px; height: 10px; border-radius: 50%; background: rgba(148, 163, 184, 0.35); }
.preview-url { font-size: 12px; color: var(--text-muted); font-family: ui-monospace, monospace; }
.preview-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }

.preview-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.preview-kpi {
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px;
}
.preview-kpi small { display: block; font-size: 11px; color: var(--text-muted); }
.preview-kpi strong { font-size: 16px; font-weight: 800; }
.preview-kpi strong.green { color: var(--success); }
.preview-kpi strong.blue { color: #60a5fa; }
.preview-kpi strong.red { color: var(--danger); }

.preview-list { display: flex; flex-direction: column; gap: 8px; }
.preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
}
.preview-row-title { font-size: 13px; font-weight: 700; }
.preview-row-sub { font-size: 11px; color: var(--text-muted); }

.preview-tg-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(42, 171, 238, 0.12);
  border: 1px solid rgba(42, 171, 238, 0.35);
}
.preview-tg-icon { font-size: 20px; }
.preview-tg-title { font-size: 12px; font-weight: 700; color: #7dd3fc; }
.preview-tg-text { font-size: 12px; color: var(--text); margin-top: 2px; }

/* Секции лендинга */
.landing-section {
  padding: 72px 0;
  scroll-margin-top: 76px;
}

.landing-section.alt-bg {
  background: rgba(17, 24, 39, 0.65);
  border-top: 1px solid var(--card-border);
  border-bottom: 1px solid var(--card-border);
}

.section-head {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 42px;
}

.section-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #60a5fa;
  margin-bottom: 8px;
}

.section-title {
  margin: 0 0 12px;
  font-size: clamp(24px, 3.6vw, 36px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-subtitle {
  margin: 0 auto;
  font-size: 15px;
  color: var(--text-muted);
}

.section-subtitle.left { margin: 0 0 20px; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

.feature-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(59, 130, 246, 0.45);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
}

.feature-card h3 { margin: 0 0 8px; font-size: 17px; }
.feature-card p { margin: 0 0 16px; font-size: 14px; color: var(--text-muted); flex: 1; }
.feature-link { color: #60a5fa; text-decoration: none; font-size: 13px; font-weight: 700; }
.feature-link:hover { text-decoration: underline; }

.roles-grid, .pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 18px;
}

.role-showcase-card, .pricing-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.pricing-card.featured {
  border-color: var(--primary);
  box-shadow: 0 18px 40px rgba(59, 130, 246, 0.16);
}

.pricing-tag {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
}

.role-badge-lg {
  display: inline-flex;
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.14);
  color: #93c5fd;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 12px;
}

.role-showcase-card h3 { margin: 0 0 12px; font-size: 20px; }

.check-list {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.check-list li {
  position: relative;
  padding-left: 22px;
  font-size: 14px;
  color: var(--text-muted);
}

.check-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 800;
}

.motivation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
}

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

.league-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pricing-name { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.pricing-price { font-size: 32px; font-weight: 800; margin-bottom: 8px; }
.pricing-price span { font-size: 14px; font-weight: 500; color: var(--text-muted); }

/* FAQ */
.faq-container { max-width: 780px; }
.faq-list { display: flex; flex-direction: column; gap: 10px; }

.faq-item {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  overflow: hidden;
}

.faq-trigger {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 18px 20px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  text-align: left;
}

.faq-plus {
  font-size: 20px;
  color: var(--primary);
  transition: transform 0.2s;
}

.faq-item.open .faq-plus { transform: rotate(45deg); }

.faq-answer {
  display: none;
  padding: 0 20px 18px;
  font-size: 14px;
  color: var(--text-muted);
}

.faq-item.open .faq-answer {
  display: block;
  animation: fadeSlideUp 0.2s ease;
}

/* CTA & Footer */
.cta-section { padding: 36px 0 72px; }

.cta-banner {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(99, 102, 241, 0.18));
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 24px;
  padding: 40px 24px;
  text-align: center;
}

.cta-banner h2 { margin: 0 0 10px; font-size: clamp(22px, 3.5vw, 32px); }
.cta-banner p { margin: 0 0 24px; color: var(--text-muted); }

.site-footer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--card-border);
  padding: 48px 0 calc(28px + var(--safe-bottom));
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 28px;
  margin-bottom: 32px;
}

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

.footer-note { font-size: 13px; color: var(--text-muted); max-width: 320px; }
.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-col h4 { margin: 0 0 6px; font-size: 14px; }
.footer-col a { color: var(--text-muted); text-decoration: none; font-size: 13px; }
.footer-col a:hover { color: var(--text); }

.footer-bottom {
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ==================== УТИЛИТЫ И АНИМАЦИИ ==================== */
.hidden { display: none !important; }
.mt-12 { margin-top: 12px; }
.mb-8 { margin-bottom: 8px; }
.mb-14 { margin-bottom: 14px; }
.pointer { cursor: pointer; }
.stack-10 { display: flex; flex-direction: column; gap: 10px; }
.row-actions, .quick-links { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.animate-fade-up { animation: fadeSlideUp 0.28s cubic-bezier(0.22, 1, 0.36, 1) both; }
.animate-modal { animation: modalPop 0.22s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ==================== АВТОРИЗАЦИЯ (auth.html) ==================== */
.auth-screen {
  position: fixed;
  inset: 0;
  height: 100dvh;
  background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.18), transparent 45%),
              radial-gradient(circle at bottom left, rgba(99, 102, 241, 0.16), transparent 45%),
              var(--bg);
  display: flex;
  flex-direction: column;
}

.auth-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(20px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

.back-home-link {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
}
.back-home-link:hover { color: var(--text); }

.brand-header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.brand-logo.small { width: 38px; height: 38px; border-radius: 11px; font-size: 14px; }
.brand-title { margin: 0; font-size: 22px; font-weight: 800; }
.brand-subtitle { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-elevated);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 18px;
}

.auth-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 10px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.auth-tab.active { background: var(--primary); color: #fff; }
.auth-form { display: flex; flex-direction: column; gap: 14px; animation: fadeSlideUp 0.22s ease; }
.role-selector { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.role-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--card-border);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.role-card input { display: none; }
.role-card.active { border-color: var(--primary); background: rgba(59, 130, 246, 0.15); }
.role-icon { font-size: 20px; }
.role-name { font-size: 12px; font-weight: 600; }

.demo-box { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--card-border); }
.demo-title { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; text-align: center; }
.demo-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* ==================== ОБОЛОЧКА КАБИНЕТА ==================== */
.app-shell { display: flex; width: 100%; height: 100dvh; overflow: hidden; }

.sidebar {
  width: 256px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 20px;
  border-bottom: 1px solid var(--card-border);
  text-decoration: none;
  color: var(--text);
}

.sidebar-title { font-weight: 800; font-size: 17px; }
.sidebar-role { font-size: 12px; color: var(--primary); font-weight: 600; }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 6px; margin-top: 16px; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.18s, color 0.18s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.nav-item.active { background: rgba(59, 130, 246, 0.16); color: #60a5fa; }

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; overflow: hidden; }

.topbar {
  min-height: calc(var(--topbar-h) + var(--safe-top));
  padding: calc(10px + var(--safe-top)) 18px 10px;
  background: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-titles { min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.page-title { margin: 0; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tg-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(42, 171, 238, 0.16);
  color: #7dd3fc;
  border: 1px solid rgba(42, 171, 238, 0.3);
}

.preview-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.app-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 18px;
}

.bottom-nav {
  display: none;
  flex-shrink: 0;
  background: rgba(17, 24, 39, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--card-border);
  padding: 6px 6px calc(6px + var(--safe-bottom));
}

.mobile-only { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .mobile-only { display: inline-flex; }
  .app-main { padding: 14px 12px 20px; }
  .bottom-nav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
  .bnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    border-radius: 10px;
    text-decoration: none;
  }
  .bnav-item .bnav-icon { font-size: 18px; line-height: 1; }
  .bnav-item.active { color: #60a5fa; background: rgba(59, 130, 246, 0.14); }
}

/* ==================== UI-КОМПОНЕНТЫ КАБИНЕТА ==================== */
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 12px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card-title { margin: 0 0 12px; font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

.stat-card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 14px; transition: transform 0.18s; }
.stat-card:hover { transform: translateY(-2px); }
.stat-label { font-size: 12px; color: var(--text-muted); }
.stat-value { font-size: 22px; font-weight: 800; margin-top: 4px; }
.stat-value.green { color: var(--success); }
.stat-value.red { color: var(--danger); }
.stat-value.blue { color: #60a5fa; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--text-muted); font-weight: 600; }

.field input, .field select, .field textarea, .date-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 12px;
  font-size: 16px;
  outline: none;
  font-family: inherit;
}
.date-input { width: auto; padding: 6px 10px; font-size: 14px; }
.field input:focus, .field select:focus, .field textarea:focus, .date-input:focus { border-color: var(--primary); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s, background 0.18s;
}
.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 11px; font-size: 12px; border-radius: 8px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #052e16; }
.btn-danger { background: rgba(239, 68, 68, 0.16); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); }
.btn-telegram { background: var(--tg); color: #fff; }
.btn-ghost { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }

.chip-btn {
  padding: 8px 6px;
  border-radius: 9px;
  border: 1px solid var(--card-border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.chip-btn:hover { border-color: var(--primary); }

.list { display: flex; flex-direction: column; gap: 10px; }

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  flex-wrap: wrap;
}
.list-row-main { min-width: 0; flex: 1; }
.list-row-title { font-weight: 600; font-size: 14px; }
.list-row-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.norm-card { padding: 12px; border-radius: 12px; background: var(--bg-elevated); border: 1px solid var(--card-border); }
.norm-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.progress-track { width: 100%; height: 8px; border-radius: 999px; background: rgba(148, 163, 184, 0.14); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.5s ease; }

.badge { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-green { background: rgba(16, 185, 129, 0.16); color: #34d399; }
.badge-red { background: rgba(239, 68, 68, 0.16); color: #f87171; }
.badge-amber { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
.badge-blue { background: rgba(59, 130, 246, 0.16); color: #60a5fa; }

.status-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.status-pill {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.status-pill.active-present { background: rgba(16, 185, 129, 0.22); color: #34d399; border-color: #10b981; }
.status-pill.active-late { background: rgba(245, 158, 11, 0.22); color: #fbbf24; border-color: #f59e0b; }
.status-pill.active-sick { background: rgba(59, 130, 246, 0.22); color: #60a5fa; border-color: #3b82f6; }
.status-pill.active-absent { background: rgba(239, 68, 68, 0.22); color: #f87171; border-color: #ef4444; }

.form-inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.tg-link-box { background: rgba(42, 171, 238, 0.08); border: 1px dashed rgba(42, 171, 238, 0.45); border-radius: 14px; padding: 14px; margin-top: 12px; animation: fadeSlideUp 0.2s ease; }
.code-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); padding: 8px 10px; border-radius: 8px; font-size: 12px; word-break: break-all; margin: 8px 0; border: 1px solid var(--card-border); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--card-border); border-radius: 18px; padding: 18px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-header h3 { margin: 0; font-size: 17px; }
.icon-close { border: none; background: transparent; color: var(--text-muted); font-size: 24px; cursor: pointer; }

.toast-container { position: fixed; top: calc(14px + var(--safe-top)); right: 14px; left: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 200; }
.toast { background: #1e293b; color: #fff; border: 1px solid var(--card-border); padding: 10px 16px; border-radius: 12px; font-size: 13px; font-weight: 600; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4); animation: toastIn 0.22s ease; }

/* Предотвращение мелькания шаблона верстки до загрузки реальных данных с сервера */
html.is-loading body.app-page .app-shell {
  opacity: 0;
  visibility: hidden;
}
body.app-page .app-shell {
  transition: opacity 0.16s ease;
}
