/* Ads Rehub (бывш. Ads Hub) — рабочий инструмент: плотные таблицы, спокойные цвета,
   цифры выровнены по правому краю и набраны моноширинными цифрами. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #15181e;
  --muted: #6b7280;
  --line: #e4e7ec;
  --accent: #2f5bea;
  --accent-ink: #ffffff;
  --ok: #16794c;
  --ok-bg: #e5f5ec;
  --warn: #b45309;
  --warn-bg: #fdf1e2;
  --bad: #b42318;
  --bad-bg: #fde8e7;
  --radius: 10px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 18px 0 4px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
small { font-size: 12px; }

/* Каркас */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.nav { background: #11151c; color: #c9ced8; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.nav__brand { color: #fff; font-weight: 700; font-size: 17px; padding: 0 10px 18px; }
.nav nav { display: flex; flex-direction: column; gap: 2px; }
.nav__link { color: #c9ced8; padding: 8px 10px; border-radius: 8px; }
.nav__link:hover { background: #1d232d; text-decoration: none; }
.nav__link--active { background: var(--accent); color: #fff; }
.nav__foot { margin-top: auto; padding: 10px; font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.nav__foot .link { color: #c9ced8; }
.main { padding: 28px 32px 60px; min-width: 0; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; }
  .nav__brand { padding: 0 12px 0 0; }
  .nav nav { flex-direction: row; flex-wrap: wrap; }
  .nav__foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .main { padding: 20px 16px 40px; }
}

/* Заголовок страницы и фильтры */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 0; }
.filters, .actions { display: flex; gap: 8px; flex-wrap: wrap; }
select, input[type=text], input[type=email], input[type=password], input[type=url], textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); min-width: 0;
}
select:focus, input:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.btn:hover { text-decoration: none; border-color: #c8ccd4; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: #2549c4; border-color: #2549c4; }
.btn--danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn--block { width: 100%; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link--danger { color: var(--bad); margin-top: 12px; }

/* Показатели */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat__label { color: var(--muted); font-size: 12px; }
.stat strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); }
.stat--muted strong { color: var(--muted); }
.stat--accent { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.stat--accent strong { color: var(--accent); }
.hint { margin: -8px 0 16px; }
.row--warn td { background: var(--warn-bg); }

/* Вкладки уровней и хлебные крошки */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tab { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab--active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.crumbs { color: var(--muted); margin: 0 0 10px; }

/* Таблицы */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); background: #fafbfc; }
.table tbody tr:hover { background: #fafbff; }
.table tfoot td { font-weight: 700; border-bottom: 0; background: #fafbfc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.label { white-space: normal; min-width: 200px; }
.table td.label small { display: block; }

/* Метки */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef0f4; color: #374151; white-space: nowrap; }
.badge--google { background: #e8f0fe; color: #1a56c4; }
.badge--meta { background: #e9ecfd; color: #3b3fbf; }
.badge--chatgpt { background: #e6f6f1; color: #0f7a5a; }
.badge--accepted { background: var(--ok-bg); color: var(--ok); }
.badge--pending { background: var(--warn-bg); color: var(--warn); }
.badge--failed { background: var(--bad-bg); color: var(--bad); }

/* Карточки и формы */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card--danger { border-color: var(--bad-bg); }
.card > p:last-child { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.form { display: flex; flex-direction: column; gap: 14px; max-width: 560px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 600; font-size: 13px; }
.form__actions { display: flex; gap: 8px; }
.code { background: #11151c; color: #e5e7eb; padding: 12px 14px; border-radius: 8px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: 6px 0 0; }
.secret summary { cursor: pointer; color: var(--accent); }
.pairs { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.pairs dt { color: var(--muted); }
.pairs dd { margin: 0; word-break: break-all; }
.timeline { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 8px; }

.flash { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; }
.flash--notice { background: var(--ok-bg); color: var(--ok); }
.flash--alert { background: var(--bad-bg); color: var(--bad); }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px; text-align: center; }

/* Вход */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.auth { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.auth__title { margin: 0; }
.auth__lead { color: var(--muted); margin: 4px 0 20px; }

/* Рекламные аккаунты */
.checks { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.checks li::before { display: inline-block; width: 18px; font-weight: 700; }
.checks li.ok::before { content: "✓"; color: var(--ok); }
.checks li.bad::before { content: "✗"; color: var(--bad); }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.field--inline { flex-direction: row; align-items: center; gap: 8px; }
.table--compact { max-width: 360px; }
.table--compact td { padding: 6px 10px; }

/* Библиотека объявлений */
.filters--bar { margin-bottom: 14px; }
.export-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.badge--angle { background: #f1ecfd; color: #5b3cc4; }
.badge--status-draft { background: #eef0f4; color: #374151; }
.badge--status-approved { background: var(--ok-bg); color: var(--ok); }
.badge--status-exported { background: #e8f0fe; color: #1a56c4; }
.badge--status-archived { background: #f3f4f6; color: var(--muted); }
.hypothesis { background: var(--surface); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 0 0 16px; }
.issues { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.issue { padding: 8px 10px; border-radius: 8px; }
.issue--error { background: var(--bad-bg); color: var(--bad); }
.issue--warning { background: var(--warn-bg); color: var(--warn); }
.ok-text { color: var(--ok); }
.small { font-size: 12px; }
.stats--inline { margin: 0 0 8px; }
.form--wide { max-width: 980px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
fieldset.field { border: 0; padding: 0; margin: 0; }
fieldset.field legend { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.counted { position: relative; }
.counted input, .counted textarea { width: 100%; padding-right: 56px; }
.counted__n { position: absolute; right: 10px; top: 9px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.counted.soft-over .counted__n { color: var(--warn); }
.counted.over .counted__n { color: var(--bad); font-weight: 700; }
.counted.over input, .counted.over textarea { border-color: var(--bad); }
.counted-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 8px; }
.counted + .counted { margin-top: 8px; }
.counted-grid .counted + .counted { margin-top: 0; }
.angle-picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px; }
.angle-pick { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.angle-pick span { display: flex; flex-direction: column; gap: 2px; }
.copy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.copy-card header { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.copy-card__code { font-weight: 700; }
.btn--sm { padding: 5px 10px; font-size: 12px; }

/* Превью объявлений */
.preview { font-family: Arial, sans-serif; }
.preview--google .preview__ad { display: flex; gap: 8px; align-items: center; font-size: 12px; color: #202124; }
.preview__sponsored { font-weight: 700; }
.preview__url { color: #4d5156; }
.preview--google .preview__title { color: #1a0dab; font-size: 18px; line-height: 1.3; margin: 4px 0; }
.preview--google .preview__text { color: #4d5156; font-size: 13px; line-height: 1.5; }
.preview--meta { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; max-width: 420px; background: #fff; }
.preview__page { display: flex; gap: 8px; align-items: center; padding: 10px 12px 0; font-size: 13px; }
.preview__page small { color: var(--muted); margin-left: auto; }
.preview__avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.preview__body { padding: 6px 12px; font-size: 14px; }
.preview__body p { margin: 0 0 6px; }
.preview__image { aspect-ratio: 1.91 / 1; background: repeating-linear-gradient(45deg, #eef0f4, #eef0f4 10px, #e4e7ec 10px, #e4e7ec 20px); display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.preview__footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; background: #f0f2f5; }
.preview__footer div { display: flex; flex-direction: column; min-width: 0; }
.preview__footer small { color: #65676b; font-size: 11px; }
.btn--disabled { opacity: .45; cursor: not-allowed; }
.badge--stage-approved { background: #e8f0fe; color: #1a56c4; }
.badge--stage-issued { background: var(--ok-bg); color: var(--ok); }
.badge--stage-rejected { background: #f3f4f6; color: var(--muted); }
.badge--stage-in_progress { background: var(--warn-bg); color: var(--warn); }
.preview--chatgpt { max-width: 520px; font-family: system-ui, sans-serif; }
.preview__answer { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.preview__card { display: flex; gap: 12px; border: 1px solid var(--line); border-radius: 14px; padding: 10px; background: #fff; }
.preview__thumb { width: 84px; height: 84px; flex: none; border-radius: 10px; overflow: hidden; background: repeating-linear-gradient(45deg, #eef0f4, #eef0f4 8px, #e4e7ec 8px, #e4e7ec 16px); display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.preview__thumb img { width: 100%; height: 100%; object-fit: cover; }
.preview__card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; }
.preview__card-text small { font-size: 11px; display: flex; align-items: center; gap: 4px; }
.preview__avatar--sm { width: 16px; height: 16px; font-size: 9px; }

/* Публичный сайт adsrehub.com */
.public { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.public__head { display: flex; justify-content: space-between; align-items: center; padding: 24px 0; gap: 12px; }
.public__head nav { display: flex; gap: 16px; align-items: center; }
.public__brand { font-weight: 800; font-size: 20px; color: var(--ink); }
.public__main { padding: 24px 0 60px; }
.public__hero h1 { font-size: clamp(30px, 5vw, 48px); line-height: 1.1; margin: 20px 0 16px; }
.public__lead { font-size: 18px; line-height: 1.6; color: var(--muted); max-width: 720px; }
.public__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 40px 0; }
.public__grid article, .public__card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.public__grid p, .public__card li, .public__doc p, .public__doc li { line-height: 1.6; }
.public__doc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.public__doc h2 { margin-top: 24px; }
.public__foot { border-top: 1px solid var(--line); padding: 20px 0 40px; color: var(--muted); font-size: 13px; }
