:root {
  --bg: #f5f6f8;
  --card: #fff;
  --text: #1d2330;
  --muted: #6b7280;
  --line: #e3e6eb;
  --accent: #2f5bea;
  --good: #1f9d55;
  --ok: #c58a00;
  --bad: #d64545;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; display: flex; gap: 10px; align-items: baseline; }

header { background: var(--card); border-bottom: 1px solid var(--line); padding: 14px 24px 0; }
.title { display: flex; align-items: center; gap: 12px; }
.settings, .row, .toolbar, .load { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.settings input[type="number"] { width: 60px; }
.load .progress { width: 220px; }

main { padding: 20px 24px; max-width: 1400px; }
footer { padding: 12px 24px 24px; color: var(--muted); font-size: 12px; }

.tabs { display: flex; gap: 4px; margin-top: 12px; }
.tabs button { border: none; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--muted); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.count { background: var(--line); border-radius: 10px; padding: 1px 7px; font-size: 12px; color: var(--text); }

.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }

input, select, textarea, button, .button {
  font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: inherit;
}
textarea { resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
button, .button { cursor: pointer; background: #f0f2f5; }
button:hover, .button:hover { background: #e6e9ee; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.danger { color: var(--bad); }
.small-btn { padding: 3px 8px; font-size: 12px; font-weight: normal; }
label { display: inline-flex; gap: 6px; align-items: center; }
.checks { display: flex; flex-wrap: wrap; gap: 12px; }

.badge { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--line); }
.badge.good { background: #dcf3e5; color: var(--good); }
.badge.bad { background: #fbe1e1; color: var(--bad); }
.muted { color: var(--muted); }
.small { font-size: 12px; margin: 0; }
.error { color: var(--bad); }

.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.progress.big { height: 12px; border-radius: 6px; }
.progress.big > div { background: linear-gradient(90deg, var(--accent), #5b8cff); }
.loading .progress.big > div {
  background-image: linear-gradient(45deg, rgba(255,255,255,.25) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.25) 50%, rgba(255,255,255,.25) 75%, transparent 75%), linear-gradient(90deg, var(--accent), #5b8cff);
  background-size: 24px 24px, 100% 100%;
  animation: stripes 1s linear infinite;
}
@keyframes stripes { to { background-position: 24px 0, 0 0; } }

.loader { margin: 12px 0 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #f8f9fc; display: flex; flex-direction: column; gap: 8px; max-width: 900px; }
.loader.done { border-color: #b9e3c8; background: #f1faf4; }
.loader.done .progress.big > div { background: var(--good); }
.loader.failed { border-color: #f1c0c0; background: #fdf3f3; }
.loader-head { display: flex; justify-content: space-between; align-items: baseline; }
.loader-pct { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.loader-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; font-size: 12px; }
.steps li { flex: 1; padding: 4px 8px; border-radius: 6px; background: var(--line); color: var(--muted); text-align: center; }
.steps li.active { background: var(--accent); color: #fff; font-weight: 600; }
.steps li.complete { background: #dcf3e5; color: var(--good); }
.steps li.complete::before { content: "✓ "; }
.steps li.skipped { opacity: .45; text-decoration: line-through; }

.result { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.result-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.result .big { font-size: 22px; font-weight: 700; }
.result details { margin-top: 6px; font-size: 12px; }
.result ul { margin: 4px 0; padding-left: 18px; }
.save { display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }

.table-wrap { overflow: auto; max-height: 520px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { position: sticky; top: 0; background: var(--card); font-size: 12px; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.subject { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.actions { white-space: nowrap; }
td.actions button { padding: 2px 8px; font-size: 12px; }
tr.best td { background: #eef7f1; font-weight: 600; }
td.good { color: var(--good); }
td.ok { color: var(--ok); }
td.bad { color: var(--bad); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.stat .v { font-size: 20px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--muted); }
.bar { height: 8px; background: var(--accent); border-radius: 4px; min-width: 2px; opacity: .7; }
