* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: #1f2937;
  background: #f6f7f9;
}

a { color: #0645ad; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: #0f172a;
  color: #fff;
}
.topbar .brand-wrap { display: flex; align-items: center; gap: 12px; }
.topbar .brand { color: #fff; font-weight: 700; font-size: 18px; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.topbar .brand img { display: block; }
.topbar nav { display: flex; align-items: center; gap: 18px; }
.topbar nav a { color: #e2e8f0; text-decoration: none; font-size: 14px; }
.topbar nav a:hover { color: #fff; }
.topbar .who {
  color: #cbd5e1; font-size: 13px; background: rgba(255, 255, 255, 0.12);
  border-radius: 999px; padding: 3px 10px;
}

.content { max-width: 1080px; margin: 28px auto; padding: 0 24px; }

.inline { display: inline; margin: 0; }
button.linklike {
  background: none; border: none; padding: 0; color: #e2e8f0;
  cursor: pointer; font: inherit; font-size: 14px;
}
button.linklike:hover { color: #fff; text-decoration: underline; }
button.linklike.danger { color: #9b1c1c; }
button.linklike.danger:hover { color: #7a1414; }

.flash { margin: 12px 0; }
.flash-info    { padding: 12px; border-radius: 6px; background: #e7f4ff; color: #0b5394; margin-bottom: 16px; }
.flash-error   { padding: 12px; border-radius: 6px; background: #fdeaea; color: #a11d1d; margin-bottom: 16px; }
.flash-success { padding: 12px; border-radius: 6px; background: #e9f9ee; color: #1d6b39; margin-bottom: 16px; }

.card {
  background: #fff; border: 1px solid #e4e7ec; border-radius: 10px;
  padding: 22px; margin-bottom: 20px;
}
.card h1 { margin: 0 0 6px; font-size: 22px; }
.card h2 { margin: 18px 0 8px; font-size: 17px; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.form-row input[type="text"],
.form-row input[type="password"],
.form-row input[type="url"],
.form-row input[type="number"] {
  width: 100%; max-width: 420px; padding: 9px 11px;
  border: 1px solid #cbd2da; border-radius: 6px; font-size: 15px;
}
.form-row textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cbd2da;
  border-radius: 6px; font-size: 14px; line-height: 1.5; font-family: ui-monospace, Menlo, monospace;
}

button.primary, .btn {
  background: #0f172a; color: #fff; border: none; border-radius: 6px;
  padding: 10px 16px; font-size: 15px; cursor: pointer;
}
button.primary:hover, .btn:hover { background: #1e293b; }
.btn-link { display: inline-block; text-decoration: none; }

table.data { width: 100%; border-collapse: collapse; background: #fff; }
table.data th, table.data td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid #eef1f5; font-size: 14px;
}
table.data th { background: #f2f4f7; font-weight: 600; }
table.data td.nowrap { white-space: nowrap; }

.card .chart { position: relative; width: 100%; }
.card .chart svg { display: block; width: 100%; height: auto; }
.card .chart .chart-point { cursor: pointer; }
.card .chart .chart-tip {
  position: absolute; transform: translate(-50%, -110%);
  background: #111827; color: #fff; padding: 4px 9px; border-radius: 5px;
  font-size: 12px; white-space: nowrap; pointer-events: none; z-index: 5;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.card .chart svg #daily-chart-guide { stroke: #94a3b8; stroke-width: 1; stroke-dasharray: 4 3; pointer-events: none; }
.card .chart svg #daily-chart-dot { fill: #0f6f8f; stroke: #fff; stroke-width: 2; pointer-events: none; }
.chart-toggle { display: flex; gap: 8px; margin: 14px 0 4px; font-size: 14px; }
.chart-toggle a {
  padding: 6px 12px; border: 1px solid #cbd2da; border-radius: 999px;
  color: #475569; text-decoration: none;
}
.chart-toggle a:hover { border-color: #0f6f8f; color: #0f6f8f; }
.chart-toggle a.active { background: #0f6f8f; border-color: #0f6f8f; color: #fff; font-weight: 600; }
table.data td a.title-col {
  display: block; max-width: 28ch; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
table.data tr:hover td { background: #f8fafc; }
table.data tr.active-row td { background: #e7f4ff; }
table.data tr.processing-row td { color: #9ca3af; font-style: italic; }

.pagination { display: flex; gap: 12px; align-items: center; margin: 16px 0; font-size: 14px; }

.search-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-row select, .search-row input[type="text"] {
  padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px;
}
.search-row input[type="text"] { min-width: 260px; }

table.data th a { color: #0f172a; text-decoration: none; }
table.data th a:hover { color: #0645ad; text-decoration: underline; }

.pager { display: flex; gap: 12px; align-items: center; margin-top: 16px; font-size: 14px; flex-wrap: wrap; }
.pager .disabled { opacity: 0.45; pointer-events: none; cursor: default; }
.page-links { display: flex; gap: 4px; align-items: center; }
.pager-page {
  display: inline-flex; align-items: center; justify-content: center; min-width: 28px;
  padding: 4px 8px; border-radius: 6px; color: #0f6f8f;
  text-decoration: none; font-size: 13px; border: 1px solid transparent;
}
.pager-page:hover { background: #0f6f8f; color: #fff; }
.pager-page.current { background: #0f6f8f; color: #fff; font-weight: 600; }
.pager-page.gap { color: #6b7280; pointer-events: none; }
.pager-count { color: #6b7280; }
.pager-per-page { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: #6b7280; font-size: 13px; }
.pager-per-page select { padding: 4px 6px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; background: #fff; }

.muted { color: #6b7280; font-size: 13px; }
.meta-line { color: #6b7280; font-size: 13px; margin: 4px 0; }
.url { word-break: break-all; color: #0645ad; }

.article-header h1 { font-size: 24px; line-height: 1.25; margin: 4px 0 0; word-break: break-word; }
.article-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.article-title-row .article-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; padding-top: 2px; }
.back-link { font-size: 13px; color: #475569; text-decoration: none; }
.back-link:hover { color: #0f6f8f; text-decoration: none; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px 20px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid #eef1f5; }
.meta-item { min-width: 0; }
.meta-item dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: #94a3b8; margin-bottom: 3px; }
.meta-item dd { margin: 0; font-size: 14px; color: #1f2937; }
.meta-item .url { word-break: break-all; color: #0645ad; }
.meta-item-url { grid-column: 1 / -1; }
.header-toolbar { margin-top: 16px; padding-top: 14px; border-top: 1px solid #eef1f5; }
.header-toolbar .reprocess-form { margin-top: 0; }

.reprocess-form { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.reprocess-form label { font-size: 13px; color: #6b7280; font-weight: 600; }
.reprocess-form select {
  padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px;
  max-width: 340px;
}
.reprocess-form .btn { padding: 8px 14px; font-size: 14px; }

article.article-body { white-space: pre-wrap; font-size: 15px; line-height: 1.6; }
.summary-box {
  padding: 22px; border-radius: 6px; background: #fdf6ec;
  border: 1px solid #f0d9b5; color: #333; line-height: 1.5; font-size: 15px;
  margin-bottom: 20px;
}
.summary-box .summary-label { color: #8a5a00; font-weight: 700; }
.finding { border-left: 3px solid #dc2626; padding: 8px 12px; margin: 10px 0; background: #fff8f7; }
.finding .category { font-weight: 700; color: #b91c1c; font-size: 13px; text-transform: uppercase; }
.finding .orig { color: #7f1d1d; }
.finding .sugg { color: #166534; }
.finding .exp { color: #374151; margin-top: 4px; }

.article-body mark.hr-finding-highlight {
  background: rgba(194, 37, 37, .18);
  border-bottom: 2px solid rgb(194, 37, 37);
  color: inherit;
  cursor: help;
  padding: 0;
}
.article-body mark.hr-finding-highlight:focus {
  outline: 2px solid rgb(194, 37, 37);
  outline-offset: 2px;
}
.hr-finding-popover {
  position: fixed; z-index: 2147483001; padding: 12px 14px; border-radius: 8px;
  background: #fff; color: #222; border: 1px solid #e0b4b4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22); font: 13px/1.45 system-ui, sans-serif;
  pointer-events: none; max-width: 340px;
}
.hr-finding-popover[hidden] { display: none; }
.hr-popover-label {
  margin-top: 8px; color: #a22626; font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
}
.hr-popover-label:first-child { margin-top: 0; }
.hr-popover-suggested { color: #1f6f38; font-weight: 600; }
.hr-popover-explanation { color: #444; }

.error-box { padding: 12px; border-radius: 6px; background: #fdeaea; color: #a11d1d; margin-bottom: 14px; }

.badge { display:inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.admin { background:#e0e7ff; color:#3730a3; }
