body { font-family: Inter, Arial, sans-serif; margin: 0; background: #f4f7fc; color: #10213b; }
.top { background: #fff; border-bottom: 1px solid #e6ebf2; position: sticky; top: 0; z-index: 20; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.top-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; gap: 12px; }
.logo { font-weight: 700; color: #2c57e2; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }
.logo .site-logo-wrap { display: inline-flex; align-items: center; flex-shrink: 0; max-width: 200px; line-height: 0; }
.logo .site-logo-img { max-height: 34px; max-width: 200px; width: auto; height: auto; object-fit: contain; vertical-align: middle; display: block; }
.logo-with-img span { color: inherit; }
.nav { display: flex; gap: 10px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: #1e355f; padding: 8px 12px; border-radius: 10px; }
.nav a.active, .nav a:hover { background: #eaf0ff; color: #2c57e2; }
.card { background: #fff; border: 1px solid #e7edf7; border-radius: 16px; padding: 16px; box-shadow: 0 6px 14px rgba(0,0,0,.03); }
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.kpi h3 { margin: 0; color: #64748b; font-size: 13px; }
.kpi p { margin: 8px 0 0; font-size: 22px; font-weight: 700; }
.page { padding: 18px 0 80px; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 14px; overflow: hidden; }
th, td { text-align: left; border-bottom: 1px solid #edf1f7; padding: 12px; font-size: 14px; }
th { background: #f8faff; color: #51627f; }
form .row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
label { display: block; font-size: 13px; margin-bottom: 6px; color: #4d5d78; }
input, select, textarea { width: 100%; border: 1px solid #d7dfec; border-radius: 10px; padding: 10px 11px; box-sizing: border-box; }
.btn { border: 0; border-radius: 10px; padding: 10px 14px; cursor: pointer; background: #2c57e2; color: #fff; text-decoration: none; display: inline-block; }
.btn.secondary { background: #eef3ff; color: #2c57e2; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.flash { margin-bottom: 12px; border-radius: 10px; padding: 10px; }
.flash.success { background: #eafaf1; color: #0c7a43; }
.flash.error { background: #ffeded; color: #bb1d1d; }
.mobile-nav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid #dbe4f2; padding: 8px; display: none; z-index: 30; }
.mobile-nav a { flex: 1; text-align: center; color: #4c5f83; text-decoration: none; font-size: 12px; }
@media (max-width: 860px) {
  .grid-4, .grid-2, form .row { grid-template-columns: 1fr; }
  .nav { display: none; }
  .mobile-nav { display: flex; }
}

/* Единый сайдбар (fullCanvas): доп. блоки как в шаблонах */
.sidebar {
  display: flex;
  flex-direction: column;
}
.sidebar-user-chip {
  margin-top: auto;
}

.sidebar .nav-badge {
  margin-left: auto;
  background: #244160;
  padding: 2px 8px;
  border-radius: 30px;
  font-size: 11px;
  color: #e8f0ff;
  font-weight: 600;
}
.sidebar-sub-widget {
  margin: 8px 10px 16px;
  padding: 12px 12px 14px;
  border-radius: 14px;
  background: linear-gradient(145deg, #132032 0%, #0d1725 100%);
  border: 1px solid #22303e;
  font-size: 12px;
}
.sidebar-sub-line {
  color: #e2e8f0;
  line-height: 1.35;
}
.sidebar-sub-line.ok { color: #86efac; font-weight: 600; }
.sidebar-sub-line.bad { color: #fca5a5; font-weight: 600; }
.sidebar-sub-line.muted { color: #94a3b8; margin-top: 4px; font-size: 11px; }
.sidebar-sub-btn {
  display: block;
  margin-top: 10px;
  text-align: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: #2469f0;
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 12px;
}
.sidebar-sub-btn:hover { filter: brightness(1.05); }

.nav-divider {
  margin: 20px 0 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #3f5570;
  padding-left: 12px;
}
.user-chip {
  margin-top: auto;
  background: #0d1725;
  border-radius: 30px;
  padding: 12px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #22303e;
}
.user-chip .avatar {
  width: 38px;
  height: 38px;
  background: #2b4b77;
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* Сайдбар CRM: логотип-картинка без лишнего зазора и «разъезда» flex */
.sidebar .logo-area {
  align-items: center;
}
.sidebar .logo-icon {
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar .logo-icon:has(.site-logo-img) {
  background: transparent;
  width: auto;
  max-width: 168px;
  height: auto;
  min-height: 38px;
}
.sidebar .logo-icon .site-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  line-height: 0;
}
.sidebar .logo-icon .site-logo-img {
  max-height: 40px;
  max-width: 168px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.sidebar .logo-text {
  flex: 1;
  min-width: 0;
  color: #fff;
}
.sidebar .logo-text span {
  color: #6a85a8;
}
