/* ══════════════════════════════════════════════════════════════════════════
   Кабинет менеджеров рефералки. Базовый стиль — 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;
}

/* ---------- тень при прокрутке ---------- */
.scene .body {
  transition: -webkit-mask-image 0.2s, mask-image 0.2s;
}
.scene.scrolled .body {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 28px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 28px);
}
.scene .head {
  position: relative;
}
.scene .head::after {
  content: "";
  position: absolute;
  left: -18px;
  right: -18px;
  bottom: -14px;
  height: 14px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.scene.scrolled .head::after {
  opacity: 1;
}
.scene .chips.tabs {
  position: relative;
  z-index: 1;
}

/* ---------- прелоадер ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: #0b0b0c;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}
.loader.on {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s ease;
}
.loader.soft {
  background: rgba(11, 11, 12, 0.62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.ld-mark {
  position: relative;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  animation: ldFloat 2.4s ease-in-out infinite;
}
.ld-mark svg {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: #121212;
  box-shadow: 0 10px 40px -10px rgba(209, 224, 90, 0.45), inset 0 0 0 1px rgba(237, 234, 226, 0.08);
}
.ld-ring {
  position: absolute;
  inset: 0;
  border-radius: 28px;
  background: conic-gradient(from 0deg, transparent 0 55%, rgba(209, 224, 90, 0.15) 70%, #d1e05a 98%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  padding: 2px;
  animation: ldSpin 1.1s linear infinite;
  filter: drop-shadow(0 0 6px rgba(209, 224, 90, 0.7));
}
.ld-bar {
  transform-box: fill-box;
  transform-origin: left center;
  animation: ldBar 1.4s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
.ld-txt {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
  color: transparent;
  background: linear-gradient(90deg, var(--faint) 0%, var(--faint) 35%, #d1e05a 50%, var(--faint) 65%, var(--faint) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: ldShine 1.6s linear infinite;
}
@keyframes ldSpin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes ldBar {
  0% {
    transform: scaleX(0.15);
  }
  50% {
    transform: scaleX(1);
  }
  100% {
    transform: scaleX(0.15);
  }
}
@keyframes ldShine {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -150% 0;
  }
}
@keyframes ldFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}
.head.cab .title .badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
  position: relative;
  top: -3px;
  font-family: var(--f-ui);
  font-size: 11px;
  letter-spacing: 0.08em;
}
