:root {
  --teal: #0d9488;
  --teal-dark: #0f766e;
  --teal-bg: #f0fdfa;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f6f8fa;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #059669;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- шапка ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.topbar-in {
  max-width: 1100px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 18px; height: 58px;
}
.logo {
  font-size: 20px; font-weight: 800; letter-spacing: .2px; color: var(--ink);
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.logo:hover { text-decoration: none; }
.logo .dot { color: var(--teal); }
.logo-badge {
  background: linear-gradient(135deg, var(--teal), #14b8a6);
  color: #fff; border-radius: 9px; width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 900;
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  padding: 7px 12px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 14px;
}
.nav a:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--teal-bg); color: var(--teal-dark); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.userchip { font-size: 13.5px; color: var(--muted); }
.userchip b { color: var(--ink); }

/* ---------- контейнер ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 26px 20px 60px; width: 100%; flex: 1; }
.wrap-narrow { max-width: 480px; }
h1.page { font-size: 24px; margin: 0 0 18px; font-weight: 800; }
.sub { color: var(--muted); font-size: 14px; }

/* ---------- карточки ---------- */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .05);
}
.card h2 { margin: 0 0 12px; font-size: 17px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid-side { grid-template-columns: minmax(300px, 420px) 1fr; }
@media (max-width: 760px) { .grid-side { grid-template-columns: 1fr; } }

/* ---------- баланс-виджет ---------- */
.balance-hero {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 55%, #14b8a6 100%);
  color: #fff; border-radius: var(--radius); padding: 24px; margin-bottom: 18px;
  display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-end;
}
.balance-hero .bh-item .lbl { font-size: 13px; opacity: .82; }
.balance-hero .bh-item .val { font-size: 30px; font-weight: 800; line-height: 1.15; }
.balance-hero .bh-item .val.small { font-size: 21px; }
.balance-hero .actions { margin-left: auto; }

/* ---------- статистика ---------- */
.stat { text-align: left; }
.stat .num { font-size: 26px; font-weight: 800; }
.stat .lbl { color: var(--muted); font-size: 13px; }

/* ---------- офферы ---------- */
.offer-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow .15s, transform .15s;
}
.offer-card:hover { box-shadow: 0 8px 24px rgba(16,24,40,.09); transform: translateY(-2px); }
.offer-top { display: flex; align-items: center; gap: 12px; }
.offer-ico {
  width: 46px; height: 46px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  background: var(--teal-bg);
}
.offer-title { font-weight: 700; font-size: 16px; }
.offer-partner { color: var(--muted); font-size: 13px; }
.offer-desc { color: #374151; font-size: 13.5px; flex: 1; }
.offer-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.payout {
  font-size: 19px; font-weight: 800; color: var(--teal-dark);
  background: var(--teal-bg); border-radius: 9px; padding: 3px 10px;
}
.tag {
  font-size: 12px; color: var(--muted); background: var(--bg);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px;
}

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--teal); color: #fff; font-weight: 700; font-size: 14px;
  border: none; border-radius: 10px; padding: 10px 18px; cursor: pointer;
  transition: background .12s;
}
.btn:hover { background: var(--teal-dark); text-decoration: none; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-outline { background: #fff; color: var(--teal-dark); border: 1.5px solid var(--teal); }
.btn-outline:hover { background: var(--teal-bg); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-white { background: #fff; color: var(--teal-dark); }
.btn-white:hover { background: var(--teal-bg); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- формы ---------- */
label.f { display: block; font-weight: 600; font-size: 13.5px; margin: 14px 0 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 10px 13px; font-size: 15px; font-family: inherit;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  outline: none; transition: border-color .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); }
textarea { resize: vertical; min-height: 90px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.checkline { display: flex; gap: 9px; align-items: flex-start; margin: 14px 0; font-size: 13.5px; color: #374151; }
.checkline input { margin-top: 3px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- алерты ---------- */
.alert { border-radius: 10px; padding: 12px 15px; font-size: 14px; margin-bottom: 14px; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert ul { margin: 4px 0 0 18px; padding: 0; }

/* ---------- таблицы ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: .4px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 10px; border-bottom: 1px solid #f1f3f5; vertical-align: top; }
.tbl tr:hover td { background: #fafbfc; }
.tbl .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- бейджи статусов ---------- */
.badge { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved, .badge-done { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-muted { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

/* ---------- копируемая ссылка ---------- */
.copybox {
  display: flex; gap: 8px; align-items: center;
  background: var(--bg); border: 1.5px dashed var(--teal); border-radius: 10px; padding: 9px 12px;
}
.copybox code { font-size: 13.5px; word-break: break-all; flex: 1; color: var(--teal-dark); }

/* ---------- фильтры ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.filters input[type=text] { max-width: 260px; }
.filters select { width: auto; }

/* ---------- промо ---------- */
.promo {
  background: linear-gradient(135deg, #111827, #1f2937);
  color: #fff; border-radius: var(--radius); padding: 22px; margin-bottom: 18px;
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
}
.promo .big { font-size: 21px; font-weight: 800; }
.promo .sub { color: #d1d5db; }

/* ---------- auth ---------- */
.auth-wrap { max-width: 440px; margin: 30px auto; width: 100%; padding: 0 20px 60px; }
.auth-hero { text-align: center; margin-bottom: 22px; }
.auth-hero .logo { justify-content: center; font-size: 26px; }
.auth-hero p { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.auth-links { text-align: center; font-size: 13.5px; margin-top: 14px; color: var(--muted); }

/* ---------- документы ---------- */
.doc-body h1 { font-size: 22px; }
.doc-body h2 { font-size: 17px; margin-top: 24px; }
.doc-body p, .doc-body li { font-size: 14px; color: #374151; }
.doc-note {
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  border-radius: 10px; padding: 10px 14px; font-size: 13px;
}
.doc-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

/* ---------- админ ---------- */
.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.subnav a { padding: 6px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.subnav a:hover { background: var(--bg); text-decoration: none; }
.subnav a.active { background: var(--ink); color: #fff; }

.footer {
  border-top: 1px solid var(--line); background: #fff; margin-top: auto;
}
.footer-in {
  max-width: 1100px; margin: 0 auto; padding: 18px 20px;
  display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted);
}
.footer-in a { color: var(--muted); }

.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.small { font-size: 12.5px; color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.inline-form { display: inline; }
