:root {
  --bg: #0a0c0f;
  --surface: #12161b;
  --surface-2: #181d24;
  --surface-3: #1f252e;
  --border: #252c36;
  --border-strong: #333c49;

  --text: #e8ecf1;
  --text-dim: #9aa5b4;
  --text-faint: #6b7483;

  --accent: #4f8cff;
  --accent-dim: #2d5bb0;

  --critical: #ff5f56;
  --critical-bg: rgba(255, 95, 86, 0.12);
  --warning: #ffb340;
  --warning-bg: rgba(255, 179, 64, 0.12);
  --notice: #6ea8fe;
  --notice-bg: rgba(110, 168, 254, 0.12);
  --pass: #3ddc97;
  --pass-bg: rgba(61, 220, 151, 0.12);

  --radius: 10px;
  --radius-sm: 6px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px 80px;
}

/* Header */
.header {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  margin-bottom: 28px;
}
.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}
.brand h1 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand p {
  font-size: 12px;
  color: var(--text-faint);
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card + .card {
  margin-top: 16px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 14px;
}

/* Form */
.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.field .hint {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 6px;
  line-height: 1.5;
}
input[type='text'],
input[type='number'],
textarea,
select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}
textarea {
  min-height: 130px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
  white-space: pre;
  overflow-x: auto;
}
.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
}
.checkbox input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: #3b7bf0;
}
.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-3);
}
.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* Progress */
.bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
  margin: 12px 0 8px;
}
.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  transition: width 0.3s ease;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-faint);
  gap: 12px;
}
.progress-url {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Score */
.score-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}
.score-grid .stat {
  flex: 1 1 110px;
  min-width: 110px;
}
.score-ring {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
}
.score-ring .inner {
  position: absolute;
  inset: 8px;
  background: var(--surface);
  border-radius: 50%;
  display: grid;
  place-items: center;
  line-height: 1.1;
}
.score-ring b {
  font-size: 28px;
  font-weight: 700;
  display: block;
}
.score-ring small {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.stat b {
  display: block;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}
.stat span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
.stat.critical b { color: var(--critical); }
.stat.warning b { color: var(--warning); }
.stat.notice b { color: var(--notice); }
.stat.pass b { color: var(--pass); }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: 24px 0 16px;
  overflow-x: auto;
}
.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-faint);
  padding: 9px 14px;
  border-radius: 0;
  white-space: nowrap;
}
.tab:hover { color: var(--text-dim); }
.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.tab .count {
  font-size: 11px;
  color: var(--text-faint);
  margin-left: 6px;
}

/* Filters */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  align-items: center;
}
.filters input[type='text'],
.filters select {
  width: auto;
  min-width: 150px;
  flex: 0 1 auto;
  padding: 7px 10px;
  font-size: 13px;
}
.filters .grow { flex: 1 1 200px; }

/* Issue list */
.issue {
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 13px 15px;
  margin-bottom: 9px;
}
.issue.critical { border-left-color: var(--critical); }
.issue.warning { border-left-color: var(--warning); }
.issue.notice { border-left-color: var(--notice); }
.issue-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.issue-msg {
  font-weight: 600;
  flex: 1 1 320px;
  font-size: 13.5px;
}
.issue-fix {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 6px;
}
.issue-url {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 7px;
  word-break: break-all;
}
.issue-detail {
  margin-top: 9px;
  padding: 9px 11px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
  max-height: 190px;
  overflow: auto;
}
.issue-detail div { word-break: break-all; }

.pill {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
}
.pill.critical { background: var(--critical-bg); color: var(--critical); }
.pill.warning { background: var(--warning-bg); color: var(--warning); }
.pill.notice { background: var(--notice-bg); color: var(--notice); }
.pill.pass { background: var(--pass-bg); color: var(--pass); }
.pill.muted { background: var(--surface-3); color: var(--text-faint); }

/* Table */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  white-space: nowrap;
}
thead th {
  background: var(--surface-2);
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
}
thead th:hover { color: var(--text-dim); }
tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
td.url {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.bad { color: var(--critical); font-weight: 600; }
.warn { color: var(--warning); font-weight: 600; }
.good { color: var(--pass); }

.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-faint);
  font-size: 13px;
}

.note {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.error {
  background: var(--critical-bg);
  border: 1px solid var(--critical);
  color: #ffb3ae;
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 13px;
  margin-bottom: 14px;
}

.kv {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px 16px;
  font-size: 13px;
}
.kv dt { color: var(--text-faint); }
.kv dd { color: var(--text); word-break: break-all; }

.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  flex-wrap: wrap;
}
.recent-item:last-child { border-bottom: none; }

details summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  user-select: none;
  padding: 4px 0;
}
details summary:hover { color: var(--text); }
details[open] summary { margin-bottom: 10px; }

@media (max-width: 640px) {
  .score-ring { margin: 0 auto 4px; }
  .score-grid .stat { flex: 1 1 calc(50% - 7px); min-width: 0; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
}

/* Login */
.login {
  max-width: 340px;
  margin: 60px auto;
}
.hidden { display: none !important; }
