/* Партнерський кабінет HelperCRM — в стиле CRM: светло-серый фон, белые скруглённые
   блоки, синие «таблетки», цветные плашки статусов, даты 25.11.26, суммы в грн.
   Адаптивно: меню слева от 1024 px, ниже — верхняя панель и выезжающее меню;
   таблицы на телефоне превращаются в карточки. */

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #2b2d33;
  --muted: #666b75;        /* серый CRM, затемнён до контраста 4.5:1 */
  --link: #1366e0;
  --line: #eceef2;
  --head: #eef0f4;
  --blue: #176ef0;
  --blue-hover: #0f5fd6;
  --blue-soft: #e8f0fe;
  --active: #cdeefd;
  --pill: #eceef1;
  --ok: #6fcf72;
  --ok-text: #1f7a32;
  --ok-soft: #e5f6e6;
  --wait: #f6c935;
  --wait-text: #8a6100;
  --wait-soft: #fdf4d6;
  --info: #56c4f1;
  --info-text: #0b6d99;
  --info-soft: #e2f5fd;
  --bad: #f2776a;
  --bad-text: #b3322a;
  --bad-soft: #fde9e7;
  --violet: #c26cf0;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(23, 33, 54, .04);
  --sidebar: 272px;
  --font: Roboto, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }
ul { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(23, 110, 240, .35); outline-offset: 2px; }

.icon { width: 22px; height: 22px; flex: none; }
.logo { width: 40px; height: 40px; flex: none; display: block; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* --- Кнопки ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 24px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-weight: 500; font-size: 16px; line-height: 1.2; text-align: center;
  cursor: pointer; text-decoration: none !important;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn .icon { width: 20px; height: 20px; }
.btn--pill { border-radius: 999px; }
.btn--block { width: 100%; }
.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: var(--blue-hover); }
.btn--outline { background: #fff; color: var(--link); border-color: #dfe3ea; }
.btn--outline:hover { border-color: #cfd9ea; background: #fbfcff; }
.btn:disabled, .btn[aria-disabled="true"] {
  background: var(--pill); color: #a3a8b1; border-color: transparent; cursor: not-allowed;
}
.btn--google { background: #fff; color: var(--text); border-color: #dadce0; }
.btn--google:hover { background: #f8f9fb; }
.btn--apple { background: #000; color: #fff; }
.btn--apple:hover { background: #222; }
.btn__mark {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid #dadce0; font-weight: 700; font-size: 14px; color: var(--blue);
}
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--link); cursor: pointer;
}
.icon-btn:hover { background: var(--blue-soft); }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 500; }
.link-arrow .icon { width: 18px; height: 18px; }

/* --- Каркас ------------------------------------------------------------ */
.shell { min-height: 100vh; }
.main { padding: 16px 16px 40px; max-width: 1240px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 8px 0 16px;
  background: rgba(245, 246, 248, .92); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__brand { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; color: var(--text); }
.topbar__brand .logo { width: 32px; height: 32px; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: min(86vw, var(--sidebar)); padding: 12px;
  display: flex; flex-direction: column; gap: 6px; overflow-y: auto;
  background: var(--bg);
  transform: translateX(-100%); transition: transform .22s ease;
}
.drawer-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .18); }
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(20, 24, 33, .38); }
.drawer-open { overflow: hidden; }

.side-block { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 12px; }
.side-brand__logo { display: block; }
.side-brand__btn { flex: 1; min-height: 46px; padding: 0 12px; font-size: 16px; }
.side-row { display: flex; gap: 6px; }
.side-id { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 60px; padding: 8px 16px; min-width: 0; }
.side-id__name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-id__code { font-size: 14px; color: var(--muted); }
.side-id__copy { width: 52px; border: 0; color: #a3a8b1; cursor: pointer; display: grid; place-items: center; }
.side-id__copy:hover { color: var(--blue); }
.side-nav { display: flex; flex-direction: column; gap: 6px; }
.side-nav__item {
  display: flex; align-items: center; gap: 14px; min-height: 50px; padding: 0 14px;
  color: var(--text); text-decoration: none !important;
}
.side-nav__item .icon { color: var(--blue); }
.side-nav__item:hover { background: #f0f7fe; }
.side-nav__item.is-active { background: var(--active); }

@media (min-width: 1024px) {
  .topbar, .scrim, .side-brand__close { display: none !important; }
  .sidebar { transform: none; width: var(--sidebar); padding: 16px 12px 16px 16px; box-shadow: none !important; }
  .main { margin-left: var(--sidebar); padding: 24px 32px 48px 24px; }
}
@media (max-width: 1023.98px) {
  .side-brand__btn { display: none; }
  .side-brand { justify-content: space-between; }
}

/* --- Заголовок страницы ----------------------------------------------- */
.page-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 4px 0 20px;
}
.page-head h1 { font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
.page-head__action { display: none; }
@media (min-width: 720px) {
  .page-head h1 { font-size: 34px; }
  .page-head__action { display: inline-flex; }
}

/* --- Карточки --------------------------------------------------------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 16px;
}
.card__title { font-size: 20px; font-weight: 700; margin-bottom: 14px; }
@media (min-width: 720px) {
  .card { padding: 24px; }
  .card__title { font-size: 22px; }
}

.notice {
  margin-bottom: 16px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--wait-soft); color: var(--wait-text); font-size: 15px;
}
.notice--error { background: var(--bad-soft); color: var(--bad-text); }

/* Шапка с условиями */
.hero { display: grid; gap: 18px; }
.hero h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.hero p { color: var(--muted); }
.rates { display: grid; gap: 10px; }
.rate {
  display: grid; grid-template-columns: 40px 1fr auto; grid-template-areas: "icon label value" "icon note value";
  align-items: center; column-gap: 12px; padding: 12px 14px;
  background: var(--bg); border-radius: var(--radius-sm);
}
.rate__icon { grid-area: icon; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); }
.rate__icon .icon { width: 20px; height: 20px; }
.rate__label { grid-area: label; font-weight: 500; }
.rate__note { grid-area: note; font-size: 14px; color: var(--muted); }
.rate__value { grid-area: value; font-size: 22px; font-weight: 700; color: var(--link); white-space: nowrap; }
@media (min-width: 720px) {
  .hero h2 { font-size: 24px; }
  .rates { grid-template-columns: repeat(3, 1fr); }
  .rate { grid-template-columns: 1fr; grid-template-areas: "icon" "label" "value" "note"; row-gap: 4px; padding: 16px; }
  .rate__icon { margin-bottom: 6px; }
  .rate__value { font-size: 30px; }
}

/* Ссылка */
.link-row { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.link-row__buttons { display: flex; gap: 10px; }
.link-row__buttons .btn { flex: 1; }
.link-field {
  flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0;
  min-height: 52px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff;
}
.link-field__icon { color: var(--muted); display: grid; }
.link-field input {
  flex: 1; width: 100%; min-width: 0; border: 0; outline: 0; background: transparent;
  font: 500 17px/1.2 var(--font); color: var(--text); text-overflow: ellipsis;
}
@media (min-width: 720px) {
  .link-row { flex-direction: row; }
  .link-row__buttons .btn { flex: none; }
}

/* Деньги */
.money { display: grid; gap: 12px; margin-bottom: 16px; }
.money .card { margin: 0; }
.money-card { display: flex; flex-direction: column; gap: 4px; }
.money-card__title { color: var(--muted); font-size: 15px; }
.money-card__amount { font-size: 28px; line-height: 1.2; font-weight: 700; white-space: nowrap; }
.money-card__note { font-size: 14px; color: var(--muted); }
.money-card--accent .money-card__amount { color: var(--link); }
.money-card--bonus .money-card__amount { color: #9b3fd4; }
.money-card--pending .money-card__amount { color: var(--wait-text); }
@media (max-width: 559.98px) {
  .money { grid-template-columns: 1fr 1fr; gap: 10px; }
  .money-card { padding: 14px; }
  .money-card__title { font-size: 14px; }
  .money-card__amount { font-size: clamp(18px, 5.2vw, 22px); overflow-wrap: anywhere; }
  .money-card__note { font-size: 13px; line-height: 1.35; }
}
@media (min-width: 560px) { .money { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) {
  .money { grid-template-columns: repeat(4, 1fr); }
  .money-card__amount { font-size: 26px; }
}

/* Вывод и тариф */
.actions { display: grid; gap: 14px; }
.actions__buttons { display: flex; flex-direction: column; gap: 10px; }
.actions__text { display: grid; gap: 4px; }
.hint { font-weight: 500; color: var(--wait-text); }
@media (min-width: 720px) {
  .actions { grid-template-columns: auto 1fr; align-items: center; gap: 24px; }
  .actions__buttons { flex-direction: row; }
}

/* Статистика */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 12px;
  background: var(--bg); border-radius: var(--radius-sm); min-width: 0;
}
.stat__value { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat__label { font-size: 13px; color: var(--muted); }
@media (min-width: 720px) {
  .stat { padding: 18px 20px; }
  .stat__value { font-size: 32px; }
  .stat__label { font-size: 15px; }
}

/* Вкладки — как «Головна / Звіт по послугах…» в «Аналітиці» */
.tabs {
  display: flex; gap: 10px; margin: 24px 0 14px; padding-bottom: 14px;
  border-bottom: 1px solid #e3e6eb; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; display: inline-flex; align-items: center; min-height: 46px; padding: 0 22px;
  border-radius: 999px; background: var(--pill); color: var(--text);
  font-weight: 500; text-decoration: none !important; white-space: nowrap;
}
.tab:hover { background: #e2e5ea; }
.tab.is-active { background: var(--blue); color: #fff; }
@media (min-width: 720px) { .tab { min-height: 52px; padding: 0 26px; font-size: 18px; } }
.js .panel:not(.is-active) { display: none; }
.panel { margin-bottom: 16px; scroll-margin-top: 150px; }
#link { scroll-margin-top: 76px; }
@media (min-width: 1024px) { .panel { scroll-margin-top: 100px; } #link { scroll-margin-top: 16px; } }

/* Таблицы — как «Клієнти» в CRM */
.table-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 16px 18px; background: var(--head); color: var(--muted);
  font-size: 15px; font-weight: 400; text-align: left;
}
.table td { padding: 16px 18px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #f7f9fc; }
.table .num { text-align: right; }
.table__main { font-weight: 500; }
.op__title { display: block; }
.op__sub { display: block; font-size: 14px; color: var(--muted); font-weight: 400; }
.amount { display: block; white-space: nowrap; font-weight: 500; }
.amount + .amount { font-size: 14px; font-weight: 400; }
.amount--plus { color: var(--ok-text); }
.amount--minus { color: var(--text); }
.amount--bonus { color: #9b3fd4; }
.amount--pending { color: var(--wait-text); }
.amount--cancelled { color: var(--muted); text-decoration: line-through; }
.amount--zero { color: var(--muted); }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 6px;
  font-size: 14px; line-height: 1.4; white-space: nowrap;
}
.badge--ok { background: var(--ok-soft); color: var(--ok-text); }
.badge--wait { background: var(--wait-soft); color: var(--wait-text); }
.badge--info { background: var(--info-soft); color: var(--info-text); }
.badge--muted { background: var(--pill); color: #646a74; }
.badge--bad { background: var(--bad-soft); color: var(--bad-text); }

@media (max-width: 719.98px) {
  .table-card { background: transparent; box-shadow: none; overflow: visible; }
  .table thead { display: none; }
  .table, .table tbody { display: block; }
  .table tr {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto); gap: 6px 12px;
    padding: 14px 16px; margin-bottom: 10px;
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  }
  .table td { display: block; padding: 0; border: 0; }
  .table td[data-label="Дата"], .table td[data-label="Дата реєстрації"] { grid-column: 2; grid-row: 1; font-size: 14px; color: var(--muted); text-align: right; }
  .table .table__main { grid-column: 1; grid-row: 1; }
  .table td[data-label="Статус"] { grid-column: 1; grid-row: 2; align-self: center; }
  .table td.num { grid-column: 2; grid-row: 2; text-align: right; }
  .table .badge { white-space: normal; }
  .table .amount { white-space: normal; }
  .table tbody tr:hover { background: var(--card); }
}

/* Пустое состояние */
.empty { display: grid; justify-items: center; gap: 8px; padding: 32px 20px; text-align: center; }
.empty__icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); }
.empty__title { font-size: 18px; font-weight: 700; }
.empty .btn { margin-top: 8px; }

.page-foot { margin-top: 8px; }

/* --- Вход, телефон, правила для гостя -------------------------------- */
.plain { min-height: 100vh; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth__card { width: 100%; max-width: 440px; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 28px 22px; }
.auth__card--wide { max-width: 760px; }
.auth__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none !important; }
.auth__title { font-size: 26px; line-height: 1.2; font-weight: 700; }
.auth__rates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.auth__rates li { display: grid; gap: 2px; padding: 12px 10px; border-radius: var(--radius-sm); background: var(--bg); }
.auth__rates strong { font-size: 20px; color: var(--link); white-space: nowrap; }
.auth__rates span { font-size: 13px; color: var(--muted); line-height: 1.3; }
.auth__buttons { display: grid; gap: 10px; }
@media (max-width: 359.98px) {
  .auth__rates { grid-template-columns: minmax(0, 1fr); }
  .auth__rates li { grid-template-columns: auto minmax(0, 1fr); align-items: baseline; column-gap: 10px; }
}
.sso { display: flex; justify-content: center; min-height: 44px; }
.sso > div { margin: 0 auto; }
.step { font-size: 14px; font-weight: 500; color: var(--link); }
@media (min-width: 560px) { .auth__card { padding: 36px 36px 32px; } }

.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.field { display: grid; gap: 6px; }
.field__label { font-size: 15px; }
.field__control {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 14px;
  border: 1px solid #dfe2e7; border-radius: 6px; background: #fff;
}
.field__control:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23, 110, 240, .15); }
.field__control.is-invalid { border-color: var(--bad); }
.field__icon { color: var(--muted); }
.field__control input {
  flex: 1; width: 100%; min-width: 0; border: 0; outline: 0; background: transparent;
  font: 400 18px/1.2 var(--font); color: var(--text);
}
.field__control input::placeholder { color: #b5bac3; }
.field__error { color: var(--bad-text); font-size: 14px; margin-top: -6px; }

.rules { display: grid; gap: 20px; margin-bottom: 8px; }
.rules__section h2 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.rules__section ul { display: grid; gap: 6px; }
.rules__section li { position: relative; padding-left: 18px; }
.rules__section li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }

/* Всплывающее «Скопійовано» */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translateX(-50%); padding: 12px 20px; border-radius: 999px;
  background: #2b2d33; color: #fff; font-size: 15px; box-shadow: 0 6px 24px rgba(0, 0, 0, .2);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
