/* ============================================================================
   Кабинет партнёра. Сначала телефон: партнёры открывают кабинет с него.
   Цвета — только через токены, тёмная тема по настройке системы.
   Акцент и статусы те же, что в панели OPER (webapp/static/style.css).
   ============================================================================ */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f7;
  --border: #e3e6ec;
  --text: #151821;
  --muted: #5b6474;
  --muted-light: #8b94a6;
  --accent: #3d4ecc;
  --accent-hover: #3140ad;
  --accent-soft: #eaecfb;
  --accent-line: #c7ccf5;
  --green: #0d7d5a;
  --green-soft: #e4f4ee;
  --red: #c0392f;
  --red-soft: #fbeae8;
  --amber: #a8690a;
  --amber-soft: #fbf0dd;
  --hero-bg: #1b2140;
  --hero-text: #ffffff;
  --hero-muted: #b6bde0;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218;
    --surface: #171b24;
    --surface-2: #1e2330;
    --border: #2a3040;
    --text: #e8eaf0;
    --muted: #9aa3b5;
    --muted-light: #6f788a;
    --accent: #8792f2;
    --accent-hover: #a1aaf6;
    --accent-soft: #22284a;
    --accent-line: #39417a;
    --green: #4fcf9f;
    --green-soft: #12301f;
    --red: #f08a80;
    --red-soft: #3a1c19;
    --amber: #e6b25a;
    --amber-soft: #34280f;
    --hero-bg: #1e2550;
    --hero-muted: #aab2dc;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1 { font-size: 22px; line-height: 1.25; margin: 0 0 4px; font-weight: 700; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }
p { margin: 0 0 10px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── шапка и вкладки ─────────────────────────────────────────────────────── */
.top {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.top-in {
  max-width: 760px; margin: 0 auto; padding: 12px 16px 0;
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-weight: 700; font-size: 16px; color: var(--text); letter-spacing: -.01em; }
.brand span { color: var(--accent); }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); min-width: 0; }
.who b { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-btn {
  background: none; border: 0; padding: 0; font: inherit; color: var(--muted);
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.tabs { display: flex; gap: 4px; margin-top: 10px; overflow-x: auto; }
.tabs a {
  flex: 1 0 auto; text-align: center; padding: 9px 12px 10px; color: var(--muted);
  border-bottom: 2px solid transparent; font-weight: 500; font-size: 14px;
}
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }

main { max-width: 760px; margin: 0 auto; padding: 18px 16px 48px; }

/* ── карточки ────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.eyebrow {
  display: block; font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px;
}

/* главная цифра: сколько партнёр получит */
.hero {
  background: var(--hero-bg); color: var(--hero-text);
  border-radius: var(--radius); padding: 20px 18px 16px; margin-bottom: 14px;
}
.hero .eyebrow { color: var(--hero-muted); }
.hero-sum { font-size: 40px; line-height: 1.1; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.hero-note { color: var(--hero-muted); margin: 6px 0 0; font-size: 14px; }
.hero-split {
  display: flex; flex-wrap: wrap; gap: 12px 22px; margin: 16px 0 0; padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .14);
}
.hero-split div { min-width: 0; }
.hero-split dt { font-size: 12px; color: var(--hero-muted); }
.hero-split dd { margin: 2px 0 0; font-size: 17px; font-weight: 600; }
.hero-more { margin-left: auto; align-self: flex-end; }
.hero-more a { color: var(--hero-text); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }

/* грейд */
.grade-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grade-name { font-size: 20px; font-weight: 700; }
.grade-rate { font-size: 15px; color: var(--muted); }
.grade-rate b { color: var(--text); font-weight: 600; }
.next {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: var(--accent-soft); border: 1px solid var(--accent-line); font-size: 14px;
}
.next b { font-weight: 600; }
.meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin: 8px 0 4px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* плитки статистики */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.tile b { display: block; font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.tile span { font-size: 13px; color: var(--muted); }
@media (min-width: 620px) { .tiles { grid-template-columns: repeat(4, 1fr); } }

/* график: просмотры по дням */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 96px; }
.bars i {
  flex: 1; min-height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: .85;
}
.bars i.zero { background: var(--border); }
.bars-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted-light); margin-top: 6px; }

/* список роликов */
.vlist { list-style: none; margin: 0; padding: 0; }
.vlist li {
  display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
  padding: 12px 0; border-top: 1px solid var(--border);
}
.vlist li:first-child { border-top: 0; padding-top: 0; }
.vlist li:last-child { padding-bottom: 0; }
.v-main { min-width: 0; flex: 1; }
.v-title {
  display: block; color: var(--text); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.v-meta { font-size: 13px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.v-meta .up { color: var(--green); }
.v-side { text-align: right; flex: none; }
.v-sum { font-weight: 600; margin-top: 4px; }
.v-reason { font-size: 13px; color: var(--red); margin-top: 4px; }

.chip { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.chip.counted { background: var(--green-soft); color: var(--green); }
.chip.rejected { background: var(--red-soft); color: var(--red); }
.chip.over_limit, .chip.no_rate { background: var(--amber-soft); color: var(--amber); }
.chip.before { background: var(--surface-2); color: var(--muted); }

.more { display: block; text-align: center; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border); font-weight: 500; }

/* строки «подпись — сумма» (выплаты, расчёт сальдо) */
.rows { margin: 0; }
.rows div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.rows div:first-child { border-top: 0; padding-top: 0; }
.rows dt { color: var(--muted); }
.rows dd { margin: 0; font-weight: 500; text-align: right; }
.rows .total dt, .rows .total dd { color: var(--text); font-weight: 700; font-size: 17px; }

/* лестница грейдов */
.ladder { list-style: none; margin: 0; padding: 0; }
.ladder li { padding: 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; }
.ladder li.cur { border-color: var(--accent); background: var(--accent-soft); }
.ladder .l-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }
.ladder .l-req { font-size: 14px; color: var(--muted); margin-top: 4px; white-space: pre-line; }
.tag { font-size: 12px; font-weight: 500; color: var(--accent); margin-left: 6px; }

.rules { margin: 0; padding-left: 20px; }
.rules li { margin-bottom: 8px; }
.pre { white-space: pre-line; }
.foot { text-align: center; color: var(--muted-light); font-size: 13px; margin-top: 18px; }
.empty { color: var(--muted); text-align: center; padding: 18px 0 6px; }

/* ── формы: вход, пароль ─────────────────────────────────────────────────── */
.auth { max-width: 380px; margin: 0 auto; padding: 56px 16px; }
.auth .brand { display: block; font-size: 20px; margin-bottom: 20px; }
/* вход из Telegram идёт сам (static/tg.js): пока он идёт, форму не показываем */
.tg-wait { display: none; }
.tg-auto .tg-wait { display: block; }
.tg-auto .auth-form { display: none; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=password] {
  width: 100%; padding: 11px 12px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
input:focus { outline: 2px solid var(--accent-line); border-color: var(--accent); }
.btn {
  display: inline-block; width: 100%; margin-top: 18px; padding: 12px 16px;
  font: inherit; font-weight: 600; color: #fff; background: #3d4ecc;
  border: 0; border-radius: 10px; cursor: pointer;
}
.btn:hover { background: #3140ad; }
.alert { padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 4px; }
.alert.err { background: var(--red-soft); color: var(--red); }
.alert.ok { background: var(--green-soft); color: var(--green); }
