body.tool-page { max-width: 1400px; }

header h1 { font-size: 1.5rem; }

.toolbar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.btn.accent {
  background: var(--success);
  border-color: var(--success);
  color: var(--on-accent);
  font-weight: 600;
}
.btn.accent:hover:not(:disabled) { filter: brightness(1.05); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.small { padding: 0.25rem 0.6rem; font-size: 0.8rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.stat-card .value { font-size: 1.75rem; font-weight: 700; }
.stat-card .label { color: var(--muted); font-size: 0.8rem; margin-top: 0.25rem; }

h2 { font-size: 1.1rem; margin: 1.5rem 0 0.25rem; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.75rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--surface); color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge.pending { background: var(--bg-subtle); color: var(--muted); }
.badge.in_progress { background: var(--warn-bg); color: var(--warn); }
.badge.analysed, .badge.done { background: var(--success-bg); color: var(--success); }
.badge.error { background: var(--danger-bg); color: var(--danger); }

.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

#report-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  width: min(900px, 92vw);
  max-height: 85vh;
  padding: 0;
}

#report-dialog header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

#report-dialog h3 { margin: 0; font-size: 1rem; }

#report-body {
  margin: 0;
  padding: 1rem 1.25rem;
  overflow: auto;
  max-height: calc(85vh - 4rem);
  white-space: pre-wrap;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
}

#report-dialog::backdrop { background: rgba(15, 23, 42, 0.35); }

.empty { color: var(--muted); text-align: center; padding: 1.5rem; }

.muted-sm { color: var(--muted); font-size: 0.75rem; }
.path-hint { color: var(--muted); font-size: 0.7rem; margin-top: 0.25rem; word-break: break-all; }
.link, a.link code { color: var(--accent); text-decoration: none; font-weight: 600; }
.link:hover, a.link:hover code { text-decoration: underline; }

.topic-pills { display: flex; gap: 0.35rem; margin-top: 0.35rem; flex-wrap: wrap; }
.pill { font-size: 0.7rem; padding: 0.1rem 0.4rem; border-radius: 4px; background: var(--bg); border: 1px solid var(--border); }
.pill.news { border-color: #4a7ab8; }
.pill.assess { border-color: #6bc48a; }
.pill.other { border-color: #8b9cb3; }

a.btn.small { text-decoration: none; display: inline-block; line-height: 1.4; }

.btn.icon {
  padding: 0.15rem 0.45rem;
  min-width: 2rem;
  font-size: 0.75rem;
  line-height: 1.2;
}

.run-detail td {
  background: var(--bg-subtle);
  padding: 0 !important;
}

.run-detail-inner {
  padding: 0.75rem 1rem 1rem 2rem;
}

.group-block {
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.group-block.skipped {
  padding: 0.75rem 1rem;
  color: var(--muted);
}

.group-head {
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
}

.group-totals {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
}

.sub-table {
  width: 100%;
  font-size: 0.8rem;
}

.sub-table th, .sub-table td {
  padding: 0.4rem 0.6rem;
}

.sub-empty {
  padding: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.check-label input {
  cursor: pointer;
  accent-color: var(--success);
}

.prompt-panel,
.paths-panel,
.gaps-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.prompt-panel h2,
.paths-panel h2,
.gaps-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.period-cursor {
  margin-bottom: 0.75rem;
}

#analysis-prompt {
  width: 100%;
  margin: 0.5rem 0 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 9rem;
}

.prompt-actions,
.path-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.path-link {
  word-break: break-all;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}

.copy-status {
  color: var(--success);
  font-size: 0.8rem;
  font-weight: 600;
}

.muted-status {
  color: var(--muted);
  font-weight: 500;
}

.prompt-panel code {
  font-size: 0.8rem;
  color: var(--accent);
}

.run-row { cursor: default; }

.analysed-row {
  opacity: 0.72;
}

.analysed-collapse-row td {
  background: var(--bg-subtle);
  padding: 0.5rem 0.75rem !important;
  border-bottom: 1px solid var(--border);
}

.analysed-toggle-btn {
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 1rem 1.5rem;
  margin-bottom: 0.25rem;
}

.section-head h2 {
  margin: 0;
}

.collapse-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.collapse-toggle input {
  accent-color: var(--accent);
  cursor: pointer;
}

.chart-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem 1.25rem;
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.chart-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.chart-wrap {
  position: relative;
  width: 100%;
  margin-top: 0.75rem;
  overflow-x: auto;
}

#coverage-chart {
  display: block;
  width: 100%;
  max-width: 100%;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-top: 1rem;
  font-size: 0.85rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-swatch {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-name {
  color: var(--text);
}

.legend-total {
  color: var(--muted);
  font-size: 0.8rem;
}
