:root {
  --surface: #fcfcfb;
  --card: #ffffff;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --line: #e1e0d9;
  --accent: #2a78d6;
  --ok: #0ca30c;
  --bad: #d03b3b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #131312;
    --card: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --line: #2c2c2a;
    --accent: #3987e5;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px 16px 48px;
  background: var(--surface);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.wrap { max-width: 680px; margin: 0 auto; }

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
}

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 4px; }
h2.sub { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
}

.card.narrow { max-width: 420px; margin: 12vh auto 0; }

label {
  display: block;
  margin: 16px 0 0;
  color: var(--ink-2);
  font-size: 13px;
}

input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: transparent;
}

textarea { resize: vertical; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.row { margin-top: 20px; }

button {
  padding: 10px 18px;
  border-radius: 9px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

button.primary { background: var(--accent); color: #fff; }
button.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
button:hover { filter: brightness(1.06); }

form.inline { display: inline-block; margin-top: 14px; }

.muted { color: var(--muted); font-size: 13px; }
.foot { text-align: center; margin-top: 24px; }

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
}
.alert.ok { background: rgba(12, 163, 12, .12); color: var(--ok); }
.alert.error { background: rgba(208, 59, 59, .12); color: var(--bad); }

.status {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 14px;
}
.status.ok b { color: var(--ok); }
.status.bad b { color: var(--bad); }
.status .muted { margin-left: 8px; }

/* --- страница объявлений --- */
.row-between { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.inline-row { display: flex; align-items: flex-end; gap: 12px; margin-top: 14px; }
.inline-label { margin: 0; }
.inline-label input { width: 110px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 18px 0; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; }
.tile b { display: block; font-size: 18px; }
.tile span { color: var(--muted); font-size: 12px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--ink-2); text-decoration: none; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td a { color: var(--ink); text-decoration: none; }
td a:hover { color: var(--accent); }

tr.bad-row { background: rgba(208, 59, 59, .07); }
tr.warn-row { background: rgba(236, 131, 90, .09); }

.verdict { font-weight: 500; white-space: nowrap; }
.v-bad { color: var(--bad); }
.v-warn { color: #ec835a; }
.v-ok { color: var(--ok); }

tr.good-row { background: rgba(12, 163, 12, .08); }
.v-muted { color: var(--muted); }

/* --- широкая страница отчёта --- */
.wrap.wide { max-width: 1600px; }

.wide-table { width: 100%; table-layout: fixed; font-size: 13px; }
.wide-table th, .wide-table td { padding: 8px 6px; }
.wide-table th { white-space: nowrap; }
.wide-table td { word-break: break-word; }
.wide-table .col-title { width: 30%; }
.wide-table .col-verdict { width: 17%; }
.wide-table td.nowrap { white-space: nowrap; }
.small { font-size: 11.5px; line-height: 1.35; }

/* колонки цифр — компактные и по правому краю */
.wide-table th:not(.col-title):not(.col-verdict),
.wide-table td:not(.col-title):not(.col-verdict) { text-align: right; }
.wide-table th:nth-child(2), .wide-table td:nth-child(2) { text-align: left; }

/* --- фильтры --- */
.filter-form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 12px; }
.filter-grid label { margin: 0; }
.filter-actions { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.checkbox { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 13px; color: var(--ink-2); }
.checkbox input { width: auto; margin: 0; }

/* --- пагинация --- */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 18px; }
.pager .chip { min-width: 34px; text-align: center; }

@media (max-width: 900px) {
  .wide-table { table-layout: auto; font-size: 12px; }
  .wide-table .col-title { width: auto; }
}

.hint { margin: 12px 0 0; }
