/* ЕФС «Наш бизнес» internal CRM styles (v4).
   Unified colored header (#3655a8) spans both sidebar and main content. */

@import url("../../../colors_and_type.css");

:root {
  --efs-navy:        #1B2238;   /* sidebar bg */
  --efs-navy-dark:   #11162A;   /* active item bg */
  --efs-navy-soft:   #232A45;   /* hover */
  --efs-navy-edge:   #2D3554;   /* dividers */
  --efs-yellow:      #FFC820;   /* accent */
  --efs-yellow-soft: #F5B900;
  --efs-content-bg:  #F4F5F7;
  --efs-blue:        #3655A8;   /* unified header */
  --efs-blue-dark:   #2C4790;
  --efs-blue-edge:   #2A4280;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--efs-content-bg);
  color: var(--fg);
  font-family: var(--font-text);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }

#root { height: 100vh; }
.efs-app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.efs-body {
  flex: 1;
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 0;
  position: relative;
}

/* ============ Unified top header (over sidebar + main) ============ */
.efs-topbar {
  background: var(--efs-blue);
  border-bottom: 1px solid var(--efs-blue-edge);
  display: grid;
  grid-template-columns: 248px 1fr auto;
  align-items: center;
  height: 64px;
  gap: 16px;
  padding-right: 24px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 110;
}

/* Brand block — sits over the sidebar column */
.efs-brand {
  display: flex; align-items: center; gap: 12px;
  height: 100%;
  padding: 0 20px;
  border-right: 1px solid var(--efs-blue-edge);
  min-width: 0;
}
.efs-brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
}
.efs-brand-mark img {
  width: 36px; height: 36px;
  object-fit: contain;
  display: block;
}
.efs-brand-text {
  display: inline-flex; align-items: baseline; gap: 6px;
  color: #fff;
}
.efs-brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
}
.efs-brand-dot { color: rgba(255,255,255,0.45); font-size: 14px; }
.efs-brand-sub {
  font-family: var(--font-text);
  font-weight: 500;
  font-size: 14px;
  color: rgba(255,255,255,0.88);
}

/* Search field — sits inside the blue header. The «Найти» button
   lives at the trailing edge of the same pill on every breakpoint. */
.efs-search {
  position: relative;
  max-width: 720px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 10px;
  padding: 0 6px 0 14px;
  height: 44px;
  margin-left: 8px;
  transition: background 120ms, border-color 120ms, box-shadow 120ms;
}
.efs-search:hover { background: rgba(255,255,255,0.18); }
.efs-search:focus-within {
  background: #fff;
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.18);
}
.efs-search:focus-within .efs-search-ico { color: var(--fg-secondary); }
.efs-search:focus-within .efs-search-input { color: var(--fg); }
.efs-search:focus-within .efs-search-input::placeholder { color: var(--fg-tertiary); }
.efs-search-ico { width: 16px; height: 16px; color: rgba(255,255,255,0.85); flex-shrink: 0; transition: color 120ms; }
.efs-search-input {
  flex: 1;
  min-width: 0;
  border: 0; outline: 0;
  background: transparent;
  font-size: 14px;
  color: #fff;
  font-family: inherit;
  transition: color 120ms;
}
.efs-search-input::placeholder { color: rgba(255,255,255,0.66); }

/* «Найти» — single in-field button, two visual states.
   .is-idle  — translucent, blends with the search pill.
   .is-active — solid white with dark text and a forward-arrow. */
.efs-find {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 120ms, color 120ms, box-shadow 120ms;
}
.efs-find.is-idle {
  background: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.78);
}
.efs-find.is-idle:hover { background: rgba(255,255,255,0.26); color: #fff; }
.efs-search:focus-within .efs-find.is-idle {
  background: rgba(54,85,168,0.10);
  color: var(--efs-blue);
}
.efs-search:focus-within .efs-find.is-idle:hover {
  background: rgba(54,85,168,0.18);
}
.efs-find.is-active {
  background: #fff;
  color: var(--efs-blue);
  padding-right: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.10);
}
.efs-find.is-active:hover { background: #F0F2FA; box-shadow: 0 4px 14px rgba(0,0,0,0.18); }
.efs-find-ico { width: 14px; height: 14px; }

/* Hamburger — hidden on desktop */
.efs-burger { display: none; }

/* Manager profile — right cluster (mirrors ai-ved) */
.efs-profile {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 4px 14px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  flex-shrink: 0;
}
.efs-profile-meta { text-align: right; min-width: 0; }
.efs-profile-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; }
.efs-profile-role { font-size: 11px; color: rgba(255,255,255,0.72); white-space: nowrap; }
.efs-avatar {
  width: 32px; height: 32px;
  border-radius: 999px;
  background: #fff;
  color: var(--efs-blue);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* === Cross-demo navigation hint ===
   Both ЕФС-back (ai-ved) and «Перейти в ЕФС» (СберБизнес) use this look,
   so the two demo-only hops feel like the same control on every screen. */

/* ============ Sidebar ============ */
.efs-sidebar {
  background: var(--efs-navy);
  color: rgba(255,255,255,0.78);
  display: flex; flex-direction: column;
  padding: 0;
  overflow: hidden;
}

/* Sidebar drawer scrim (mobile only — toggled inline) */
.efs-rail-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,22,26,0.42);
  z-index: 95;
  animation: scrimIn 200ms cubic-bezier(0.2,0,0,1);
}
.efs-rail-scrim.open { display: block; }
@keyframes scrimIn { from { opacity: 0; } to { opacity: 1; } }
.efs-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 0;
  display: flex; flex-direction: column;
  gap: 2px;
}
.efs-section-label {
  text-transform: none;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.42);
  padding: 14px 20px 4px;
}
.efs-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px 9px 20px;
  color: rgba(255,255,255,0.76);
  font-size: 14px;
  position: relative;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.efs-item:hover { background: var(--efs-navy-soft); color: #fff; }
.efs-item.active {
  background: var(--efs-navy-dark);
  color: var(--efs-yellow);
  font-weight: 500;
}
.efs-item-bar {
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: transparent;
  border-radius: 0 3px 3px 0;
}
.efs-item.active .efs-item-bar { background: var(--efs-yellow); }
.efs-item i,
.efs-item svg {
  width: 18px; height: 18px;
  color: rgba(255,255,255,0.62);
  flex-shrink: 0;
}
.efs-item.active i, .efs-item.active svg { color: var(--efs-yellow); }

.efs-foot {
  border-top: 1px solid var(--efs-navy-edge);
  padding: 10px 20px 12px;
  display: flex; align-items: center; gap: 10px;
}
.efs-foot-item {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  color: rgba(255,255,255,0.52);
  cursor: pointer;
}
.efs-foot-item i, .efs-foot-item svg { width: 16px; height: 16px; }
.efs-collapse {
  width: 32px; height: 32px;
  border: 0; background: transparent;
  color: rgba(255,255,255,0.46);
  border-radius: 8px;
  cursor: pointer;
}
.efs-collapse:hover { background: var(--efs-navy-soft); color: #fff; }
.efs-collapse i, .efs-collapse svg { width: 16px; height: 16px; }

/* ============ Main content ============ */
.efs-main {
  overflow-y: auto;
  padding: 28px 32px 56px;
}
.page-heading { max-width: 1080px; }
.ph-eyebrow {
  font-size: 12px; font-weight: 500;
  color: var(--fg-secondary);
  margin-bottom: 6px;
}
.ph-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
}
.ph-sub {
  font-size: 14px; line-height: 20px;
  color: var(--fg-secondary);
  margin: 0;
  max-width: 720px;
}

.hint-row {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--info-bg);
  color: var(--info);
  border-radius: 12px;
  padding: 10px 14px;
  margin: 20px 0 24px;
  font-size: 13px;
  line-height: 18px;
  max-width: 1080px;
}
.hint-row i, .hint-row svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

/* ============ Client list ============ */
.cli-list { max-width: 1080px; }
.cli-list-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}
.cli-list-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  margin: 0;
}
.cli-list-sub {
  font-size: 13px;
  color: var(--fg-secondary);
  margin: 6px 0 0;
  max-width: 540px;
}
.cli-list-stats { display: flex; gap: 24px; }
.cli-stat-v {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.cli-stat-l {
  font-size: 11px; font-weight: 500;
  color: var(--fg-secondary);
  margin-top: 2px;
}

.cli-rows {
  display: flex; flex-direction: column;
  gap: 8px;
}
.cli-row {
  display: grid;
  grid-template-columns: 1fr 200px 220px;
  align-items: center;
  gap: 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 120ms, border-color 120ms, box-shadow 120ms, transform 120ms;
}
.cli-row:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
}
.cli-row:active { transform: translateY(1px); }
.cli-row.flash {
  border-color: var(--efs-blue);
  background: #F0F3FB;
  animation: flashRow 1s ease-out;
}
@keyframes flashRow {
  0% { box-shadow: 0 0 0 0 rgba(54,85,168,0.4); }
  100% { box-shadow: 0 0 0 8px rgba(54,85,168,0); }
}
.cli-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--fg);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.cli-meta {
  font-size: 13px;
  color: var(--fg-secondary);
  margin: 4px 0 10px;
}
.cli-dot { margin: 0 4px; color: var(--fg-tertiary); }
.pot-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
}
.pot-pill.high { background: #E8EDF8; color: var(--efs-blue); }
.pot-pill.high .pot-dot { background: var(--efs-blue); }
.pot-pill.mid  { background: var(--warning-bg); color: #B85D00; }
.pot-pill.mid  .pot-dot { background: var(--warning); }
.pot-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.cli-inn-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--fg-secondary);
}
.cli-inn {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 18px;
  color: var(--fg);
  margin-top: 4px;
  letter-spacing: 0.02em;
}

.cli-right {
  display: flex; align-items: center; gap: 10px;
  justify-content: flex-end;
}
.cli-copy-hint {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px;
  color: var(--fg-tertiary);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cli-copy-hint i, .cli-copy-hint svg { width: 12px; height: 12px; flex-shrink: 0; }
.cli-copy-hint span { overflow: hidden; text-overflow: ellipsis; }
.cli-copy-text-short { display: none; }
.cli-chev { width: 16px; height: 16px; color: var(--fg-tertiary); }
.cli-row:hover .cli-chev { color: var(--efs-blue); transform: translateX(2px); transition: transform 120ms; }

/* ============ Toast ============ */
.efs-toast {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--n-900);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-3);
  z-index: 100;
  animation: toastIn 200ms cubic-bezier(0.2,0,0,1);
}
.efs-toast i, .efs-toast svg { width: 16px; height: 16px; color: #6F8DD3; }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ============ Scrollbars ============ */
.efs-main::-webkit-scrollbar { width: 8px; }
.efs-main::-webkit-scrollbar-thumb { background: var(--n-200); border-radius: 999px; }
.efs-nav::-webkit-scrollbar { width: 6px; }
.efs-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 999px; }

/* ============ Responsive ============
   Контентные брейкпоинты. 320px — нижняя граница, ничего не должно
   ломаться. Шапка и сайдбар адаптируются параллельно. */

@media (max-width: 1200px) {
  .efs-main { padding: 24px 24px 48px; }
  .cli-row { grid-template-columns: 1fr 180px 200px; gap: 14px; }
}

/* — Планшеты/нетбуки ≤1024: сайдбар становится drawerом, бургер виден.
     Режим «иконочный rail без подписей» убран — непонятный без hover-tooltip. */
@media (max-width: 1024px) {
  .efs-topbar {
    grid-template-columns: auto 1fr auto;
    height: 56px;
    padding: 0 12px 0 0;
    gap: 10px;
  }
  .efs-brand {
    padding: 0 10px 0 8px;
    border-right: 0;
    gap: 10px;
  }
  .efs-burger {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border: 0;
    background: transparent;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
  }
  .efs-burger:hover { background: rgba(255,255,255,0.14); }
  .efs-burger i, .efs-burger svg { width: 22px; height: 22px; }
  .efs-brand-mark { width: 28px; height: 28px; flex-shrink: 0; }
  .efs-brand-mark img { width: 28px; height: 28px; }
  .efs-brand-text { display: inline-flex; }

  /* Sidebar → off-canvas drawer (под sticky-хедером) */
  .efs-body { grid-template-columns: 1fr; }
  .efs-sidebar {
    display: flex;
    position: fixed;
    top: 56px; left: 0; bottom: 0;
    width: 280px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 220ms cubic-bezier(0.2,0,0,1);
    box-shadow: 0 16px 48px rgba(0,0,0,0.30);
    padding: 0;
  }
  .efs-sidebar.open { transform: translateX(0); }
  .efs-rail-scrim { top: 56px; }
  .efs-item { justify-content: flex-start; padding: 10px 20px; }
  .efs-item span:last-of-type { display: inline; }
  .efs-section-label { display: block; }
  .efs-foot-item span { display: inline; }
  .efs-foot { justify-content: flex-start; }

  /* Manager pill — без подписи, одна аватарка */
  .efs-profile-meta { display: none; }
  .efs-profile { padding: 3px; background: transparent; border-color: transparent; }

  .efs-search { padding: 0 6px 0 10px; }
  .efs-search-input { font-size: 13px; }
  .efs-find { padding: 0 14px; height: 32px; font-size: 12px; }

  /* Card layout — 2 columns; copy hint stays but compresses to short text */
  .cli-row { grid-template-columns: 1fr 200px; gap: 12px; }
  .cli-right .cli-copy-hint { display: inline-flex; }
  .cli-copy-text { display: none; }
  .cli-copy-text-short { display: inline; }
}

/* — Смартфоны. */
@media (max-width: 768px) {
  .efs-app { height: auto; min-height: 100vh; }
  .efs-topbar {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "brand search";
    height: 56px;
    padding: 0 12px 0 0;
    gap: 10px;
    align-items: center;
  }
  .efs-brand {
    grid-area: brand;
    padding: 0 10px 0 8px;
    border-right: 0;
    gap: 8px;
  }
  .efs-brand-mark { display: none; }
  /* Оставляем «ЕФС» видимым на смартфоне (как в ai-ved), скрываем только
     подпись «· Наш бизнес» — её всё равно не влезет с длинными названиями. */
  .efs-brand-text { display: inline-flex; }
  .efs-brand-sub { display: none; }
  .efs-brand-dot { display: none; }
  .efs-brand { min-width: 0; }
  .efs-brand-name { font-size: 16px; }
  .efs-search { margin-left: 6px; padding: 0 4px 0 10px; gap: 6px; min-width: 0; }
  .efs-profile { display: none; }

  /* Search expands; in-field «Найти» по тем же правилам, что и на десктопе */
  .efs-search {
    grid-area: search;
    margin-left: 0;
    height: 40px;
    padding: 0 6px 0 12px;
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.26);
  }
  .efs-search-ico { color: rgba(255,255,255,0.88); }
  .efs-find { height: 30px; padding: 0 14px; font-size: 12px; }
  .efs-find.is-active { padding-right: 10px; }

  /* Sidebar drawer уже включён на ≤1024; здесь только основные блоки макета */
  .efs-main { padding: 18px 14px 32px; }
  .ph-title { font-size: 24px; }
  .ph-sub { font-size: 13px; }

  .cli-list-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .cli-list-stats { gap: 16px; }
  .cli-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
  }
  .cli-right { justify-content: flex-start; }
  .cli-chev { display: none; }
  .cli-right .cli-copy-hint { display: inline-flex; }
  .cli-copy-text { display: none; }
  .cli-copy-text-short { display: inline; }
}

@media (max-width: 480px) {
  .efs-topbar { padding: 0 10px 0 0; }
  .efs-brand { padding: 0 6px 0 6px; }
  .efs-brand-name { font-size: 15px; }
  .efs-search-input { font-size: 13px; }
  .efs-search { padding: 0 4px 0 10px; }
  .efs-find { height: 28px; padding: 0 10px; font-size: 11px; }
  .efs-find.is-active { padding-right: 8px; }

  .ph-title { font-size: 22px; }
  .cli-name { font-size: 15px; }
  .cli-inn { font-size: 16px; }

  /* — Карточка адаптируется и не обрезается на сверхузких экранах */
  .cli-list { width: 100%; min-width: 0; }
  .cli-row { padding: 12px; gap: 8px; min-width: 0; }
  .cli-left, .cli-mid, .cli-right { min-width: 0; }
  .cli-name { word-break: break-word; overflow-wrap: anywhere; }
  .cli-meta { font-size: 12px; flex-wrap: wrap; }
  .pot-pill { font-size: 11px; padding: 3px 8px 3px 7px; }
  .cli-inn { font-size: 15px; word-break: break-all; }
  .cli-copy-text-short { font-size: 11px; }
}

/* — Сверхузкие экраны (< 364px): дополнительная компрессия,
     чтобы карточка не обрезалась контейнером. */
@media (max-width: 363px) {
  .efs-topbar { gap: 6px; padding: 0 8px 0 0; }
  .efs-brand { padding: 0 4px; }
  .efs-brand-name { font-size: 14px; }
  .efs-burger { width: 32px; height: 32px; }
  .efs-search { height: 36px; padding: 0 4px 0 8px; margin-left: 2px; }
  .efs-search-ico { width: 14px; height: 14px; }
  .efs-find { height: 26px; padding: 0 8px; font-size: 11px; }
  .efs-find.is-active .efs-find-ico { display: none; }

  .efs-main { padding: 14px 10px 24px; }
  .ph-title { font-size: 20px; }
  .ph-sub { font-size: 12px; }

  .cli-list-head { gap: 10px; }
  .cli-list-stats { gap: 12px; }
  .cli-stat-v { font-size: 18px; }

  .cli-row {
    padding: 12px 10px;
    border-radius: 12px;
  }
  .cli-name { font-size: 14px; line-height: 1.25; }
  .cli-meta { font-size: 11px; line-height: 1.35; margin: 3px 0 8px; }
  .cli-meta .cli-dot { display: none; }
  .cli-meta > span { display: block; }
  .pot-pill { font-size: 10px; padding: 2px 7px 2px 6px; }
  .cli-inn-label { font-size: 9px; }
  .cli-inn { font-size: 14px; }
  .cli-copy-text-short { font-size: 10px; }
  .cli-copy-hint i, .cli-copy-hint svg { width: 11px; height: 11px; }
}

