/* ══════════════════════════════════════════════════════════════════════════
   Кабинет менеджеров рефералки. Базовый стиль — app.css «Прямой линии»
   (цвета, шрифты, карточки, чипы, кнопки). Здесь только новые блоки.
   ══════════════════════════════════════════════════════════════════════════ */

.demo {
  display: flex;
  gap: 2px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
}
.demo button {
  background: none;
  border: 0;
  color: var(--faint);
  font-family: inherit;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 999px;
  cursor: pointer;
}
.demo button.on {
  background: rgba(209, 224, 90, 0.16);
  color: var(--lime);
}
.demo[hidden] {
  display: none;
}

/* ---------- поля анкеты ---------- */
.fbox {
  height: 56px;
  display: flex;
}
.checks {
  display: grid;
  gap: 10px;
}
.opt .box {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #0b0b0c;
  transition: 0.2s;
}
.opt.sel .box {
  background: var(--lime);
  border-color: var(--lime);
  box-shadow: 0 0 10px rgba(209, 224, 90, 0.55);
}
.rules {
  display: flex;
  flex-direction: column;
  gap: 10px;
  counter-reset: r;
}
.rule {
  display: flex;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-opt);
  background: rgba(237, 234, 226, 0.035);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--sand);
}
.rule::before {
  counter-increment: r;
  content: counter(r);
  flex: 0 0 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--lime);
  border: 1px solid rgba(209, 224, 90, 0.4);
  background: rgba(209, 224, 90, 0.08);
}

/* ---------- вкладки кабинета ---------- */
.tabs {
  flex: 0 0 auto;
  margin-bottom: 12px;
}
.sec {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 700;
  margin: 4px 0 -2px;
}

/* ---------- блок личной ссылки ---------- */
.linkcard {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(209, 224, 90, 0.3);
  border-radius: 20px;
  background: rgba(209, 224, 90, 0.06);
  animation: enter 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.linkmain {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.linklbl {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--lime);
  font-weight: 700;
}
.linkurl {
  width: 100%;
  text-align: left;
  background: rgba(11, 11, 12, 0.45);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--sand);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-all;
  cursor: pointer;
  transition: 0.2s;
}
.linkurl:hover {
  border-color: rgba(209, 224, 90, 0.42);
}
.linkurl small {
  display: block;
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--faint);
}
.linkurl.done small {
  color: var(--lime);
}
.linkacts {
  display: flex;
  gap: 6px;
}
.linkacts .act {
  flex: 1;
  height: 38px;
}
.qrthumb {
  flex: 0 0 104px;
  width: 104px;
  align-self: stretch;
  border-radius: 16px;
  border: 1px solid var(--line-2);
  background: #edeae2;
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: transform 0.15s;
}
.qrthumb:active {
  transform: scale(0.97);
}
.qrthumb img {
  width: 100%;
  aspect-ratio: 1;
  display: block;
}
.qrthumb span {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #0b0b0c;
  opacity: 0.6;
}

/* ---------- раскрытый QR ---------- */
.ovl {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(11, 11, 12, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom, 0px));
  animation: fadein 0.25s ease both;
}
@keyframes fadein {
  from {
    opacity: 0;
  }
}
.ovlbox {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: enter 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.qrbig {
  background: #edeae2;
  border-radius: 26px;
  padding: 20px;
  box-shadow: 0 30px 80px -30px rgba(209, 224, 90, 0.5);
}
.qrbig img {
  width: 100%;
  aspect-ratio: 1;
  display: block;
}
.qrcap {
  text-align: center;
  font-size: 12px;
  color: var(--mist);
  word-break: break-all;
}
.ovlbox .acts .act {
  height: 46px;
  font-size: 13.5px;
}

/* ---------- воронка ---------- */
.funnel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fstep {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  overflow: hidden;
  background: rgba(237, 234, 226, 0.025);
}
.fstep i {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, rgba(209, 224, 90, 0.2), rgba(209, 224, 90, 0.07));
  border-right: 1px solid rgba(209, 224, 90, 0.35);
  transform-origin: left;
  animation: grow 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes grow {
  from {
    transform: scaleX(0);
  }
}
.fstep div {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.fstep b {
  font-family: var(--f-display);
  font-size: 18px;
  line-height: 1;
  min-width: 34px;
  font-variant-numeric: tabular-nums;
}
.fstep span {
  flex: 1;
  font-size: 12.5px;
  color: var(--sand);
}
.fstep em {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: var(--lime);
  font-variant-numeric: tabular-nums;
}

/* ---------- график по дням ---------- */
.chart {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 12px 8px;
  background: rgba(237, 234, 226, 0.025);
}
.chart .spark {
  height: 64px;
}
.chart .spark i {
  transform-origin: bottom;
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes rise {
  from {
    transform: scaleY(0);
  }
}
.axis {
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  color: var(--faint);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* ---------- путь человека ---------- */
.tl {
  list-style: none;
  margin: 0;
  padding: 0 0 0 14px;
  border-left: 1px solid var(--line-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tl li {
  position: relative;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--sand);
}
.tl li::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  border: 1px solid var(--line-2);
}
.tl li.key::before {
  background: var(--lime);
  border-color: var(--lime);
  box-shadow: 0 0 8px rgba(209, 224, 90, 0.7);
}
.tl time {
  display: block;
  font-size: 10.5px;
  color: var(--faint);
  font-weight: 700;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}
.tl small {
  display: block;
  color: var(--mist);
  font-size: 11.5px;
  margin-top: 2px;
}

.tag.ok {
  background: rgba(209, 224, 90, 0.15);
  color: var(--lime);
}
.tag.wait {
  background: rgba(237, 234, 226, 0.08);
  color: var(--mist);
}
.tag.hot {
  background: rgba(250, 135, 107, 0.16);
  color: #fa876b;
}
.tag.off {
  background: rgba(224, 138, 122, 0.12);
  color: #e08a7a;
}

/* ---------- сравнение менеджеров ---------- */
.mrow {
  display: grid;
  grid-template-columns: 1fr repeat(3, 44px);
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(237, 234, 226, 0.03);
  font-size: 13px;
}
.mrow.hd {
  border: 0;
  background: none;
  padding: 0 12px;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 700;
}
.mrow b {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mrow span {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.roles {
  display: grid;
  gap: 6px;
}
.roles .act {
  width: 100%;
}
.empty {
  padding: 22px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--faint);
  border: 1px dashed var(--line-2);
  border-radius: 16px;
}

/* ---------- всплывашка ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 60;
  background: var(--lime);
  color: #0b0b0c;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 14px 38px -12px rgba(209, 224, 90, 0.7);
  animation: toast 1.8s ease both;
  pointer-events: none;
  white-space: nowrap;
}
@keyframes toast {
  0% {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  12%,
  80% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
  }
}

/* ---------- внутри Telegram ---------- */
/* telegram-web-app.js сам выставляет --tg-*-safe-area-inset-* на <html>;
   в обычном (не полноэкранном) режиме они нулевые. */
html.in-tg .card {
  padding-top: calc(14px + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  padding-bottom: calc(14px + var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
}
html,
body {
  overscroll-behavior: none;
}
html.in-tg body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
html.in-tg input {
  -webkit-user-select: text;
  user-select: text;
}

/* ---------- телефон: код страны + маска ---------- */
.phonebox {
  gap: 8px;
}
.cc {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 12px;
  background: rgba(237, 234, 226, 0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--sand);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.cc i {
  font-style: normal;
  font-size: 10px;
  color: var(--faint);
}
.cc select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  font-size: 16px;
  cursor: pointer;
}
.cc:focus-within {
  border-color: rgba(209, 224, 90, 0.5);
}

/* ---------- компактная шапка кабинетов ---------- */
.rail[hidden] {
  display: none;
}
.head.cab {
  gap: 6px;
  padding-bottom: 12px;
}
.head.cab .title {
  min-height: 0;
  font-size: 26px;
  line-height: 1.15;
}
.who {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--faint);
}
.who .tag {
  font-size: 11px;
}

/* ---------- тень при прокрутке ---------- */
/* Верх списка плавно уходит в прозрачность по мере прокрутки (--f: 0…1 из rm.js).
   На самом верху маска полностью прозрачна для глаза: ничего не закрыто. */
.scene .body.top {
  --f: 0;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, calc(1 - var(--f))) 0, #000 36px);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, calc(1 - var(--f))) 0, #000 36px);
}
.scene .head {
  position: relative;
}
.scene .chips.tabs {
  position: relative;
  z-index: 1;
}

/* Смена вкладки: список мягко проявляется, шапка и вкладки неподвижны. */
.scene .body.swap {
  animation: swapIn 0.2s ease-out both;
}
@keyframes swapIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- вкладка «Набор» ---------- */
.rectext {
  height: auto;
  min-height: 0;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.45;
  border-radius: 14px;
  resize: none;
  white-space: pre-wrap;
}
.chips.tabs {
  gap: 5px;
}
.chips.tabs .chip {
  padding: 7px 11px;
}
.rechint {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--faint);
  margin-top: -4px;
}
.recimg {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(237, 234, 226, 0.04);
}
.recimg img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
}
.recadd {
  width: 100%;
  height: 46px;
  border-style: dashed;
}
.recmain .act,
.recwide {
  height: 46px;
}
.recwide {
  width: 100%;
}
.recreset {
  align-self: center;
  margin-bottom: 8px;
}

/* ---------- переключатель темы в шапке кабинета ---------- */
.head.cab .title {
  padding-right: 46px;
}
.themebtn {
  position: absolute;
  top: 14px;
  right: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: rgba(237, 234, 226, 0.04);
  color: var(--mist);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.themebtn:active {
  transform: scale(0.92);
}
.themebtn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.themebtn .i-moon {
  display: none;
}
html.light .themebtn .i-sun {
  display: none;
}
html.light .themebtn .i-moon {
  display: block;
}

/* ---------- ровный фон в кабинетах ---------- */
/* Плавающие цветные пятна (.amb) за кабинетом отвлекают — там фон сплошной. */
html.cab .amb {
  display: none;
}

/* ---------- статусы команды (вкладка «Менеджеры» у руководителя) ----------
   жёлтый — нужно рассмотреть, зелёный — принят, голубой — заморожен, красный — отклонён */
.s-wait { --st: #f5c84b; --st-bg: rgba(245, 200, 75, 0.14); --st-line: rgba(245, 200, 75, 0.42); }
.s-ok { --st: #5ed39a; --st-bg: rgba(94, 211, 154, 0.13); --st-line: rgba(94, 211, 154, 0.36); }
.s-ice { --st: #79c3ff; --st-bg: rgba(121, 195, 255, 0.13); --st-line: rgba(121, 195, 255, 0.38); }
.s-no { --st: #ff6b6b; --st-bg: rgba(255, 107, 107, 0.13); --st-line: rgba(255, 107, 107, 0.38); }
.lead.st::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--st);
}
.lead.st.open {
  border-color: var(--st-line);
  background: var(--st-bg);
}
.lead.st.s-wait {
  border-color: var(--st-line);
}
.stag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  color: var(--st);
  background: var(--st-bg);
}
.stag i,
.sdot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--st);
  flex: 0 0 auto;
}
.lead.st.s-wait .stag i,
.stalert .sdot {
  animation: stPulse 1.6s ease-in-out infinite;
}
@keyframes stPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--st-line); }
  50% { box-shadow: 0 0 0 5px rgba(0, 0, 0, 0); }
}
.srole {
  font-size: 11.5px;
  color: var(--mist);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stchips {
  margin-bottom: 12px;
}
.stchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.stchip.on {
  background: var(--st-bg);
  color: var(--st);
  border-color: var(--st-line);
}
.tbadge {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: #f5c84b;
  color: #0b0b0c;
  font-size: 10.5px;
  font-weight: 800;
  vertical-align: 1px;
}
.stalert {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 13px 14px;
  border-radius: 18px;
  border: 1px solid var(--st-line);
  background: var(--st-bg);
  color: var(--sand);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.stalert b {
  display: block;
  font-size: 14px;
  color: var(--st);
}
.stalert small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--mist);
}
.stalert .go {
  margin-left: auto;
  color: var(--st);
  font-size: 16px;
}
