/* ============================================================
   ЧистыйЛист — Партнёрский кабинет  |  style.css
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w:   250px;
  --mobile-bar:  56px;
  --accent:      #4f8ef7;
  --accent-dark: #3d7ee8;
  --green:       #38e89a;
  --sidebar-bg:  #1a1f2e;
  --text:        #1a1f2e;
  --text2:       #6b7280;
  --border:      #e5e7eb;
  --bg:          #f0f2f7;
  --card:        #fff;
  --radius:      10px;
  --danger:      #e24b4a;
  --success:     #166534;
}

body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ============================================================
   АВТОРИЗАЦИЯ
   ============================================================ */
.auth-body { min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--sidebar-bg); }
.auth-wrap { width:100%; max-width:420px; padding:16px; }
.auth-box { background:#fff; border-radius:14px; padding:36px 32px; box-shadow:0 20px 60px rgba(0,0,0,.25); }
.auth-logo { text-align:center; margin-bottom:24px; }
.auth-logo__text { font-size:22px; font-weight:700; color:var(--text); }
.auth-logo__dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--green); margin-left:3px; vertical-align:middle; }
.auth-logo__sub { font-size:12px; color:var(--text2); margin-top:4px; }
.auth-tabs { display:flex; border-bottom:2px solid var(--border); margin-bottom:20px; }
.auth-tab { flex:1; padding:9px; background:none; border:none; border-bottom:2px solid transparent; margin-bottom:-2px; font-size:13px; font-weight:600; color:var(--text2); cursor:pointer; font-family:inherit; transition:all .15s; }
.auth-tab.active { color:var(--accent); border-bottom-color:var(--accent); }
.auth-form .cl-field { margin-bottom:12px; }
.auth-consent { font-size:11px; color:var(--text2); margin:10px 0 4px; line-height:1.6; }
.auth-consent a { color:var(--accent); }

/* ============================================================
   МОБИЛЬНАЯ ШАПКА
   ============================================================ */
.cl-mobile-bar {
  display: none;
  position: fixed; top:0; left:0; right:0;
  height: var(--mobile-bar);
  background: var(--sidebar-bg);
  z-index: 200;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.cl-mobile-bar__logo { color:#fff; font-weight:700; font-size:16px; text-decoration:none; }
.cl-mobile-bar__logo span { display:inline-block; width:7px; height:7px; border-radius:50%; background:var(--green); margin-left:3px; vertical-align:middle; }

/* БУРГЕР */
.cl-burger { background:none; border:none; cursor:pointer; padding:7px; display:flex; flex-direction:column; gap:5px; border-radius:6px; }
.cl-burger span { display:block; width:22px; height:2px; background:#fff; border-radius:2px; transition:all .25s; }
.cl-burger.open span:nth-child(1) { transform:translateY(7px) rotate(45deg); }
.cl-burger.open span:nth-child(2) { opacity:0; transform:scaleX(0); }
.cl-burger.open span:nth-child(3) { transform:translateY(-7px) rotate(-45deg); }

/* Оверлей */
.cl-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:99; }
.cl-overlay.show { display:block; }

/* ============================================================
   LAYOUT
   ============================================================ */
.cl-layout { display:flex; min-height:100vh; }

/* ============================================================
   САЙДБАР
   ============================================================ */
.cl-sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  overflow-y: auto;
}
.cl-sidebar__inner { padding:20px 16px 14px; flex:1; }

/* Лого */
.cl-sidebar__head { display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; }
.cl-logo { color:#fff; font-weight:700; font-size:17px; text-decoration:none; display:flex; align-items:center; }
.cl-logo__dot { display:inline-block; width:7px; height:7px; border-radius:50%; background:var(--green); margin-left:4px; }
.cl-logout-btn { background:rgba(255,255,255,.09); border:none; color:#a0aec0; font-size:11px; padding:5px 10px; border-radius:6px; cursor:pointer; text-decoration:none; font-family:inherit; transition:all .15s; }
.cl-logout-btn:hover { background:rgba(255,255,255,.16); color:#fff; }

/* Юзер-карточка */
.cl-usercard { display:flex; align-items:center; gap:10px; background:rgba(255,255,255,.07); border-radius:10px; padding:12px; margin-bottom:12px; text-decoration:none; }
.cl-avatar { width:38px; height:38px; border-radius:50%; background:var(--accent); display:flex; align-items:center; justify-content:center; color:#fff; font-weight:700; font-size:13px; flex-shrink:0; }
.cl-usercard__name { color:#fff; font-size:13px; font-weight:600; }
.cl-usercard__id { color:#a0aec0; font-size:11px; }

/* Баланс-карточка */
.cl-balance-card { background:rgba(255,255,255,.07); border-radius:8px; padding:10px 12px; display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.cl-balance-card__label { color:#a0aec0; font-size:11px; margin-bottom:2px; }
.cl-balance-card__val { color:var(--green); font-size:15px; font-weight:700; }
.cl-balance-card__btn { background:var(--accent); color:#fff; font-size:10px; padding:5px 9px; border-radius:5px; text-decoration:none; white-space:nowrap; transition:background .15s; }
.cl-balance-card__btn:hover { background:var(--accent-dark); }

/* Навигация */
.cl-nav { list-style:none; }
.cl-nav li a { display:block; padding:8px 10px; color:#a0aec0; text-decoration:none; font-size:12.5px; border-radius:7px; border-left:3px solid transparent; transition:all .15s; }
.cl-nav li a:hover { background:rgba(79,142,247,.13); color:#fff; }
.cl-nav li a.active { background:rgba(79,142,247,.18); color:#fff; border-left-color:var(--accent); padding-left:7px; }

/* Контакты */
.cl-sidebar__footer { padding:12px 16px 16px; border-top:1px solid rgba(255,255,255,.07); margin-top:auto; }
.cl-sidebar__footer div { color:#a0aec0; font-size:11px; margin-bottom:4px; }

/* ============================================================
   ОСНОВНОЙ КОНТЕНТ
   ============================================================ */
.cl-main { margin-left:var(--sidebar-w); flex:1; padding:28px; min-height:100vh; }
.cl-page-title { font-size:22px; font-weight:700; color:var(--text); margin-bottom:22px; }

/* ============================================================
   КАРТОЧКИ
   ============================================================ */
.cl-card { background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:22px; margin-bottom:18px; }
.cl-card__title { font-size:13px; font-weight:700; color:var(--text); padding-bottom:12px; border-bottom:1px solid var(--border); margin-bottom:16px; }

/* ============================================================
   ВИДЖЕТЫ
   ============================================================ */
.cl-widgets { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:24px; }
.cl-widget { background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:16px; }
.cl-widget__label { font-size:10px; font-weight:600; color:var(--text2); text-transform:uppercase; letter-spacing:.4px; margin-bottom:7px; }
.cl-widget__val { font-size:24px; font-weight:700; color:var(--text); margin-bottom:4px; }
.cl-widget__sub { font-size:11px; color:var(--text2); }

/* ============================================================
   ФОРМЫ
   ============================================================ */
.cl-form-grid   { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:12px; }
.cl-form-grid-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px; }
.cl-full { grid-column:1/-1; }
.cl-field { display:flex; flex-direction:column; gap:5px; }
.cl-field label { font-size:11px; font-weight:600; color:var(--text2); }
.cl-field input, .cl-field select, .cl-field textarea {
  border:1px solid var(--border); border-radius:7px; padding:8px 11px;
  font-size:12.5px; color:var(--text); font-family:inherit;
  outline:none; transition:border-color .15s; background:#fff; width:100%;
}
.cl-field input:focus, .cl-field select:focus { border-color:var(--accent); }
.cl-field input[readonly], .cl-field input[disabled] { background:#f9fafb; color:var(--text2); }
.cl-field input[type="file"] { padding:6px; cursor:pointer; }
.cl-save-row { display:flex; justify-content:flex-end; margin-top:14px; }
.cl-warning { background:#fffbeb; border-left:3px solid #f59e0b; border-radius:0 7px 7px 0; padding:10px 14px; font-size:11.5px; color:#92400e; margin:14px 0; line-height:1.6; }
.cl-ref-row { display:flex; gap:10px; align-items:flex-end; }
.cl-ref-row .cl-field { flex:1; }

/* Сканы паспорта */
.cl-scans { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:12px; }
.cl-scan-slot label { font-size:11px; font-weight:600; color:var(--text2); display:block; margin-bottom:5px; }
.cl-scan-status { font-size:11px; color:var(--text2); margin-top:5px; }
.cl-scan-status a { color:var(--accent); }

/* ============================================================
   КНОПКИ
   ============================================================ */
.cl-btn { border:none; border-radius:7px; padding:9px 20px; font-size:12.5px; font-weight:600; cursor:pointer; font-family:inherit; transition:all .15s; display:inline-flex; align-items:center; gap:6px; text-decoration:none; }
.cl-btn-primary { background:var(--accent); color:#fff; }
.cl-btn-primary:hover { background:var(--accent-dark); }
.cl-btn-outline { background:#fff; border:1px solid var(--border); color:var(--text); }
.cl-btn-outline:hover { border-color:var(--accent); color:var(--accent); }
.cl-btn-sm { padding:6px 13px; font-size:11.5px; }
.cl-btn-full { width:100%; justify-content:center; padding:11px; }
.cl-btn:disabled { opacity:.6; cursor:not-allowed; }

/* ============================================================
   ТАБЛИЦЫ
   ============================================================ */
.cl-table-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; }
.cl-table { width:100%; border-collapse:collapse; font-size:12.5px; }
.cl-table thead th { text-align:left; padding:9px 11px; border-bottom:2px solid var(--border); color:var(--text2); font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:.4px; white-space:nowrap; }
.cl-table tbody tr { border-bottom:1px solid #f3f4f6; transition:background .1s; }
.cl-table tbody tr:hover { background:#f8faff; }
.cl-table td { padding:10px 11px; color:var(--text); vertical-align:middle; }
.cl-empty td { text-align:center; color:var(--text2); font-size:12px; padding:28px; }

/* ============================================================
   БЕЙДЖИ
   ============================================================ */
.cl-badge { display:inline-block; padding:3px 9px; border-radius:5px; font-size:10.5px; font-weight:600; white-space:nowrap; }
.badge-new       { background:#e0e7ff; color:#3730a3; }
.badge-work      { background:#fef3c7; color:#92400e; }
.badge-deal      { background:#dcfce7; color:var(--success); }
.badge-rejected  { background:#fee2e2; color:#991b1b; }
.badge-duplicate { background:#f3f4f6; color:var(--text2); }
.badge-request   { background:#ffedd5; color:#9a3412; }
.badge-paid      { background:#dcfce7; color:var(--success); }

/* ============================================================
   ТУЛБАР
   ============================================================ */
.cl-toolbar { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-bottom:16px; }
.cl-toolbar__title { font-size:15px; font-weight:700; }
.cl-toolbar__right { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.cl-search { border:1px solid var(--border); border-radius:7px; padding:7px 11px 7px 32px; font-size:12px; font-family:inherit; outline:none; background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' fill='none' stroke='%239ca3af' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 10px center; transition:border-color .15s; width:180px; }
.cl-search:focus { border-color:var(--accent); }
.cl-date-input { border:1px solid var(--border); border-radius:7px; padding:7px 10px; font-size:12px; font-family:inherit; outline:none; background:#fff; transition:border-color .15s; width:130px; }
.cl-date-input:focus { border-color:var(--accent); }

/* ============================================================
   УВЕДОМЛЕНИЯ
   ============================================================ */
.cl-notice { padding:10px 14px; border-radius:7px; font-size:12.5px; margin-bottom:14px; display:none; }
.cl-notice.show { display:block; }
.cl-notice.success { background:#dcfce7; color:var(--success); border:1px solid #bbf7d0; }
.cl-notice.error   { background:#fee2e2; color:#991b1b; border:1px solid #fecaca; }

/* ============================================================
   БАЛАНС
   ============================================================ */
.cl-balance-hero { text-align:center; padding:48px 20px; }
.cl-balance-hero__icon   { font-size:52px; margin-bottom:16px; }
.cl-balance-hero__amount { font-size:40px; font-weight:700; margin-bottom:8px; }
.cl-balance-hero__hint   { font-size:13px; color:var(--text2); margin-bottom:28px; }

/* ============================================================
   FAQ
   ============================================================ */
.cl-faq-item { border-bottom:1px solid #f3f4f6; }
.cl-faq-q { padding:14px 0; display:flex; justify-content:space-between; align-items:center; cursor:pointer; font-size:13px; font-weight:600; user-select:none; }
.cl-faq-arr { color:var(--text2); transition:transform .2s; font-size:16px; flex-shrink:0; margin-left:10px; }
.cl-faq-q.open .cl-faq-arr { transform:rotate(180deg); }
.cl-faq-a { font-size:12.5px; color:var(--text2); line-height:1.8; padding:0 0 14px; display:none; }
.cl-faq-a.show { display:block; }

/* ============================================================
   КАРУСЕЛЬ
   ============================================================ */
.cl-carousel { position:relative; overflow:hidden; background:#f8faff; }
.cl-carousel__track { display:flex; transition:transform .35s ease; }
.cl-slide { min-width:100%; padding:36px 24px; text-align:center; }
.cl-slide__icon  { font-size:42px; margin-bottom:14px; }
.cl-slide__title { font-size:16px; font-weight:700; margin-bottom:8px; }
.cl-slide__text  { font-size:12.5px; color:var(--text2); line-height:1.7; max-width:440px; margin:0 auto; }
.cl-carousel__btn { position:absolute; top:50%; transform:translateY(-50%); background:#fff; border:1px solid var(--border); border-radius:50%; width:32px; height:32px; cursor:pointer; font-size:16px; display:flex; align-items:center; justify-content:center; }
.cl-carousel__btn--prev { left:10px; }
.cl-carousel__btn--next { right:10px; }
.cl-carousel__dots { display:flex; justify-content:center; gap:7px; padding:10px 0; }
.cl-dot { width:8px; height:8px; border-radius:50%; background:var(--border); border:none; cursor:pointer; transition:background .2s; }
.cl-dot.active { background:var(--accent); }

/* ============================================================
   УРОКИ
   ============================================================ */
.cl-lesson { display:flex; align-items:center; gap:14px; padding:13px 14px; border:1px solid var(--border); border-radius:8px; text-decoration:none; color:var(--text); transition:border-color .15s; margin-bottom:10px; }
.cl-lesson:hover { border-color:var(--accent); }
.cl-lesson__num { background:#e0e7ff; color:#3730a3; padding:7px 11px; border-radius:6px; font-size:12px; font-weight:700; flex-shrink:0; }
.cl-lesson__title { font-size:13px; font-weight:600; }
.cl-lesson-add { padding:13px; border:2px dashed var(--border); border-radius:8px; text-align:center; color:var(--text2); font-size:12px; }

/* ============================================================
   ПРАВИЛА
   ============================================================ */
.cl-rules-img { width:100%; border-radius:8px; margin-bottom:12px; display:block; }

/* ============================================================
   СТАТИСТИКА (реферальная)
   ============================================================ */
.cl-stat-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:14px; }
.cl-stat-item { background:#f4f6fb; border-radius:8px; padding:16px; }
.cl-stat-num  { font-size:28px; font-weight:700; margin-bottom:3px; }
.cl-stat-lbl  { font-size:11px; color:var(--text2); }

/* ============================================================
   МОДАЛЬНОЕ ОКНО
   ============================================================ */
.cl-modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.46); display:none; align-items:center; justify-content:center; z-index:999; }
.cl-modal-overlay.show { display:flex; }
.cl-modal { background:#fff; border-radius:13px; width:640px; max-width:95vw; max-height:90vh; overflow-y:auto; display:flex; position:relative; box-shadow:0 20px 60px rgba(0,0,0,.18); }
.cl-modal__left { background:#f4f7fb; padding:28px 24px; width:260px; flex-shrink:0; border-radius:13px 0 0 13px; }
.cl-modal__left h2 { font-size:15px; font-weight:700; margin-bottom:8px; }
.cl-modal__left p  { font-size:12px; color:var(--text2); margin-bottom:16px; line-height:1.7; }
.cl-modal__subtitle { font-size:11px; font-weight:700; margin-bottom:10px; }
.cl-check { font-size:12px; margin-bottom:9px; display:flex; gap:8px; line-height:1.5; }
.cl-check::before { content:'✓'; color:#1D9E75; font-weight:700; flex-shrink:0; }
.cl-modal__right { padding:28px 24px; flex:1; }
.cl-modal__right h2 { font-size:15px; font-weight:700; margin-bottom:18px; }
.cl-modal__right .cl-field { margin-bottom:12px; }
.cl-modal__consent { font-size:10.5px; color:var(--text2); margin-top:12px; line-height:1.6; }
.cl-modal__consent a { color:var(--accent); }
.cl-modal__close { position:absolute; top:14px; right:16px; background:none; border:none; font-size:22px; cursor:pointer; color:var(--text2); line-height:1; }
.cl-modal__close:hover { color:var(--text); }

/* ============================================================
   МОБИЛЬНАЯ АДАПТИВНОСТЬ
   ============================================================ */
@media (max-width: 1100px) {
  .cl-widgets { grid-template-columns:1fr 1fr; }
}

@media (max-width: 768px) {
  /* Показываем мобильную шапку */
  .cl-mobile-bar { display:flex; }

  /* Сайдбар скрыт, выезжает по бургеру */
  .cl-sidebar {
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 24px rgba(0,0,0,.3);
  }
  .cl-sidebar.open { transform:translateX(0); }

  /* Контент сдвигается под мобильную шапку */
  .cl-main { margin-left:0; padding:calc(var(--mobile-bar) + 16px) 16px 32px; }

  /* Виджеты — 2 колонки */
  .cl-widgets { grid-template-columns:1fr 1fr; gap:10px; margin-bottom:16px; }
  .cl-widget { padding:12px; }
  .cl-widget__val { font-size:20px; }

  /* Формы — 1 колонка */
  .cl-form-grid, .cl-form-grid-3 { grid-template-columns:1fr; }
  .cl-full { grid-column:1; }

  /* Сканы — 1 колонка */
  .cl-scans { grid-template-columns:1fr; }

  /* Тулбар — вертикально */
  .cl-toolbar { flex-direction:column; align-items:flex-start; }
  .cl-toolbar__right { width:100%; }
  .cl-search { width:100%; }
  .cl-date-input { flex:1; min-width:0; }
  #add-lead-btn { width:100%; justify-content:center; }

  /* Таблицы — горизонтальный скролл */
  .cl-table { min-width:520px; font-size:12px; }

  /* Реф. ссылка */
  .cl-ref-row { flex-direction:column; }
  .cl-ref-row .cl-btn { width:100%; justify-content:center; }

  /* Баланс */
  .cl-balance-hero { padding:32px 16px; }
  .cl-balance-hero__amount { font-size:30px; }

  /* Модалка снизу */
  .cl-modal-overlay { align-items:flex-end; }
  .cl-modal { flex-direction:column; width:100%; max-width:100%; max-height:92vh; border-radius:16px 16px 0 0; }
  .cl-modal__left { width:100%; border-radius:16px 16px 0 0; padding:20px 20px 14px; }
  .cl-modal__left p { display:none; }
  .cl-modal__right { padding:16px 20px 24px; }

  /* Карточки */
  .cl-card { padding:16px; margin-bottom:12px; }
  .cl-page-title { font-size:18px; margin-bottom:16px; }

  /* Карусель */
  .cl-slide { padding:24px 16px; }
  .cl-slide__icon { font-size:32px; }
  .cl-slide__title { font-size:14px; }
}

@media (max-width: 480px) {
  .cl-main { padding:calc(var(--mobile-bar) + 12px) 12px 28px; }
  .cl-widgets { grid-template-columns:1fr 1fr; gap:8px; }
  .cl-widget { padding:10px 12px; }
  .cl-widget__val { font-size:18px; }
  .cl-page-title { font-size:16px; margin-bottom:14px; }
  .cl-toolbar__right { flex-direction:column; }
  .cl-date-input { width:100%; }
  .cl-table { min-width:460px; font-size:11px; }
  .cl-balance-hero__amount { font-size:26px; }
  .cl-balance-hero__icon { font-size:40px; }
  .cl-stat-grid { grid-template-columns:1fr; }
  .cl-modal__right { padding:12px 16px 20px; }
  /* Авторизация — bottom sheet на маленьких экранах */
  .auth-body { align-items:flex-end; padding:0; }
  .auth-wrap { padding:0; max-width:100%; }
  .auth-box { border-radius:16px 16px 0 0; padding:24px 20px 32px; box-shadow:0 -8px 32px rgba(0,0,0,.15); }
}
