/* Билдлига — общая дизайн-система (кабинет клиента и админка). Светлая, спокойная, плотная. */
:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --line: #e8e7e2;
  --line-strong: #d9d8d2;
  --ink: #15171c;
  --ink-2: #3b3f47;
  --muted: #6d717a;
  --faint: #9a9da4;
  --accent: #3050f0;
  --accent-ink: #1f3bd0;
  --accent-soft: #eef1ff;
  --ok: #0f9d6b;
  --ok-soft: #e7f6ef;
  --warn: #b7791f;
  --warn-soft: #fdf5e6;
  --bad: #d93b30;
  --bad-soft: #fdecea;
  --ozon: #005bff;
  --wb: #a3179e;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 22, 28, 0.04), 0 4px 16px rgba(20, 22, 28, 0.04);
  --shadow-lg: 0 12px 40px rgba(20, 22, 28, 0.12);
  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 750; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 10px; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.ok-text { color: var(--ok); }
.bad-text { color: var(--bad); }
.warn-text { color: var(--warn); }
.strike { text-decoration: line-through; }
.mt { margin-top: 24px; }
.hidden { display: none !important; }

/* Кнопки */
.btn, button { font: inherit; font-weight: 650; border-radius: var(--radius-sm); border: 1px solid transparent; padding: 9px 16px; cursor: pointer; background: var(--ink); color: #fff; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; display: inline-flex; align-items: center; gap: 8px; line-height: 1.2; white-space: nowrap; }
.btn:hover, button:hover { background: #2a2d35; }
button:disabled { opacity: .45; cursor: default; }
.btn-accent { background: var(--accent); }
.btn-accent:hover { background: var(--accent-ink); }
.btn-ghost, button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover, button.secondary:hover { background: var(--surface-2); border-color: var(--faint); }
button.danger { background: var(--surface); color: var(--bad); border-color: #f1c9c5; }
button.danger:hover { background: var(--bad-soft); }
button.small, .btn.small { padding: 6px 11px; font-size: 13px; }
button.link, .linklike { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 600; }
button.link:hover { background: none; color: var(--accent-ink); }

/* Формы */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 12px 0 6px; }
input, select, textarea { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; margin: 12px 0; cursor: pointer; }
.check input { margin-top: 2px; flex: none; }
.field .muted { margin-top: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 20px; }
.error { color: var(--bad); font-size: 13px; margin-top: 8px; min-height: 1em; }

/* Карточки */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 16px; }
.subcard { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; background: var(--surface-2); margin: 12px 0; }
.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.bar h2 { margin-right: 8px; }
.spacer { flex: 1; }

/* Сегментированный переключатель */
.tabs { display: inline-flex; background: #efeee9; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.tabs button { background: transparent; color: var(--ink-2); border: 0; padding: 6px 12px; font-weight: 600; border-radius: 8px; font-size: 13px; }
.tabs button:hover { background: rgba(255,255,255,.6); }
.tabs button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* Бейджи */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 650; padding: 2px 9px; border-radius: 999px; background: #efeee9; color: var(--ink-2); white-space: nowrap; }
.badge.ok, .badge.connected, .badge.active { background: var(--ok-soft); color: var(--ok); }
.badge.bad, .badge.invalid_credentials, .badge.expired, .badge.suspended { background: var(--bad-soft); color: var(--bad); }
.badge.warn, .badge.rate_limited, .badge.expiring, .badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.scheduled { background: var(--accent-soft); color: var(--accent); }
.mp-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.mp-dot.ozon { background: var(--ozon); }
.mp-dot.wildberries { background: var(--wb); }

/* Таблицы */
.table-scroll { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfbf9; }
table.compact td { padding: 8px 10px; }

/* Плитки метрик */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 14px 0; }
.tile { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--surface); }
.tile-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile-value { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile-note { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Уведомления */
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 100; max-width: 420px; font-weight: 600; animation: rise .2s ease-out; }
.toast.bad { background: var(--bad); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.notice { border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border: 1px solid; }
.notice.warn { background: var(--warn-soft); border-color: #f3dfb8; color: #6d4a10; }
.notice.bad { background: var(--bad-soft); border-color: #f4c6c2; color: #8a2019; }
.notice.info { background: var(--accent-soft); border-color: #d6ddff; color: #1d2f94; }
.notice.ok { background: var(--ok-soft); border-color: #bfe6d4; color: #0b5e41; }

/* Модальное окно */
.modal-back { position: fixed; inset: 0; background: rgba(21, 23, 28, .35); display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; z-index: 50; overflow-y: auto; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; padding: 24px; }
.modal.wide { max-width: 760px; }
.modal h2 { margin-bottom: 6px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Логотип */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -0.03em; color: var(--ink); }
.brand img { width: 30px; height: 30px; }
.brand small { font-weight: 600; font-size: 12px; color: var(--muted); letter-spacing: 0; }
