:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --ink: #172033;
  --muted: #5d6b82;
  --line: #e4e9f0;
  --brand: #0f766e;
  --brand-dark: #0b5b55;
  --ok: #157a3a;
  --warn: #9a6700;
  --danger: #b42318;
  --info: #175cd3;
  --shadow: 0 10px 30px rgba(23, 32, 51, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

a { color: var(--brand-dark); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 24px; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.brand { font-weight: 700; font-size: 20px; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav span { align-self: center; padding: 0 6px; }
.nav a, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  text-decoration: none;
  background: #e8eef2;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
}
.nav a.active, .btn.primary { background: var(--brand); color: #fff; }
.btn.ok { background: #d1fadf; color: #085d32; }
.btn.warn { background: #fef0c7; color: #7a4500; }
.btn.danger { background: #fee4e2; color: #912018; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin: 0 0 12px; font-size: 16px; }
.metric { font-size: 28px; font-weight: 700; }
.muted { color: var(--muted); font-size: 13px; }
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; }
.flash.ok { background: #d1fadf; }
.flash.error { background: #fee4e2; }

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #e8eef2;
}
.badge.collecting_urls, .badge.parsing_pages, .badge.checking_grammar, .badge.pending { background: #d1e9ff; color: #1849a9; }
.badge.completed, .badge.checked, .badge.done, .badge.applied { background: #d1fadf; color: #085d32; }
.badge.paused_quota, .badge.paused_manual, .badge.warn { background: #fef0c7; color: #7a4500; }
.badge.failed, .badge.cancelled, .badge.rejected { background: #fee4e2; color: #912018; }
.badge.ignored, .badge.skipped { background: #eaecf0; color: #475467; }
.badge.new { background: #f4ebff; color: #6941c6; }
.badge.in_progress { background: #fef0c7; color: #7a4500; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.field { margin-bottom: 14px; }
.text-block {
  white-space: pre-line;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  max-height: 360px;
  overflow: auto;
  line-height: 1.45;
}
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login .card { width: min(420px, 92vw); }
.progress {
  height: 8px;
  background: #e8eef2;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}
.progress > span { display: block; height: 100%; background: var(--brand); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot.on { background: #12b76a; }
.dot.off { background: #f04438; }
.issue-orig { color: #912018; }
.issue-fix { color: #085d32; }
.block-card { margin-bottom: 16px; }
.block-head {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.issue-row {
  border-top: 1px solid var(--line);
  padding: 10px 0 0;
  margin-top: 10px;
}
.pager {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 16px;
}
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .top { flex-direction: column; align-items: flex-start; }
}
