/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast), border-color var(--t-fast);
  letter-spacing: .1px;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; }

.btn--primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 2px rgba(30,63,143,.25);
}
.btn--primary:hover:not(:disabled) {
  background: var(--brand-dark);
  box-shadow: 0 2px 6px rgba(30,63,143,.30);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn--ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); border-color: #c4c9d4; }

.btn--danger {
  background: var(--red);
  color: #fff;
}
.btn--danger:hover:not(:disabled) { background: var(--red-dark); }

.btn--outline-green {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--brand);
}
.btn--outline-green:hover:not(:disabled) { background: var(--brand-light); }

.btn--sm  { padding: 4px 10px; font-size: 12px; }
.btn--lg  { padding: 10px 20px; font-size: 14px; }
.btn--full { width: 100%; justify-content: center; }

/* Icon-only */
.btn--icon {
  padding: 0;
  width: 32px; height: 32px;
  justify-content: center;
}
.btn--icon svg { width: 16px; height: 16px; }

/* ── Form fields ─────────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .1px;
}

.field__input, .field__select, .field__textarea {
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field__input:focus, .field__select:focus, .field__textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.field__input::placeholder, .field__textarea::placeholder { color: var(--text-muted); }

.field__hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.field__error {
  font-size: 11.5px;
  color: var(--red);
  margin-top: 1px;
}

/* ── Checkbox / Toggle ───────────────────────────────────────────────────── */
input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: var(--brand);
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 3px;
}

/* ── Login card ──────────────────────────────────────────────────────────── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg-app);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 36px 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-logo {
  text-align: center;
  padding-bottom: 4px;
}

.login-logo img {
  height: 32px;
  margin: 0 auto;
  filter: none;
}

.login-title {
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary);
  margin-top: -6px;
}

.login-error {
  background: var(--red-light);
  border: 1px solid #f5c6c3;
  color: var(--red);
  border-radius: var(--radius);
  padding: 9px 13px;
  font-size: 13px;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-med);
  backdrop-filter: blur(2px);
}
.modal-overlay--visible { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  transform: translateY(10px) scale(.985);
  transition: transform var(--t-med), opacity var(--t-med);
  opacity: 0;
}
.modal--visible { transform: none; opacity: 1; }

.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.modal__title { font-size: 14.5px; font-weight: 700; letter-spacing: -.1px; }
.modal__close {
  color: var(--text-muted);
  font-size: 15px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--t-fast), color var(--t-fast);
}
.modal__close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal__body {
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-stripe);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px; right: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  max-width: 320px;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity var(--t-med), transform var(--t-med);
  pointer-events: all;
  border-left: 3px solid transparent;
}
.toast--visible { opacity: 1; transform: none; }

.toast--success { background: #f0fdf4; color: #14532d; border-color: var(--brand); }
.toast--error   { background: var(--red-light); color: #7f1d1d; border-color: var(--red); }
.toast--info    { background: var(--blue-light); color: var(--blue); border-color: var(--blue); }

/* ── Roles / Settings ────────────────────────────────────────────────────── */
.roles-wrap { display: flex; flex-direction: column; gap: 12px; }

.role-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}

.role-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.role-card__name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.role-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--bg-app);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.role-badge--admin { background: var(--brand-light); color: var(--brand-dark); border-color: #b7e0aa; }

.perm-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 14px;
}

.perm-row {
  display: grid;
  grid-template-columns: 140px 110px 110px;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
}
.perm-row:hover { background: var(--bg-hover); }

.perm-label {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.perm-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
}
.perm-toggle:has(input:disabled) { opacity: .45; cursor: not-allowed; }

/* ── Section tabs (horizontal nav within a page) ─────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tab:hover { color: var(--text-primary); }
.tab--active { color: var(--brand); border-color: var(--brand); font-weight: 600; }

/* Наборы прав в карточке роли */
.role-presets { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.role-presets__l { font-size: 12px; color: var(--text-muted, #6b7280); margin-right: 2px; }
.role-preset {
  border: 1px solid var(--border, #e5e7eb); background: #fff; cursor: pointer;
  border-radius: 999px; padding: 3px 10px; font-size: 12px;
}
.role-preset:hover { border-color: #9ca3af; }
.role-preset--on { background: #111827; color: #fff; border-color: #111827; }

/* ── Результативность предложения (.eff) ──────────────────────────────────
   Одна метка для списка кампаний и доски оферов: сколько прибыли дали сверх
   базы. Деньги крупно, доля и незакрытый период — мелко под ними.
   Цвет несёт вывод: дал — зелёный, съел — красный, сдвиг в пределах обычного
   разброса — серый, чтобы не читался как результат. */
.eff {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.eff b  { font-size: 12.5px; font-weight: 600; }
.eff em { font-style: normal; font-size: 9.5px; color: var(--text-muted); margin-top: 1px; }
.eff--up   b { color: var(--brand); }
.eff--down b { color: var(--red); }
.eff--flat b { color: var(--text-secondary); }
.eff--none   { color: var(--text-muted); }

/* В таблице кампаний колонка эффекта прижата вправо: числа сравнивают
   столбиком, а не взглядом по строке. */
.camp-eff { text-align: right; }

/* Эффект-ссылка: провал в статистику оффера */
a.eff--link { text-decoration: none; cursor: pointer; }
a.eff--link:hover { outline: 1px solid currentColor; outline-offset: 1px; }
