:root {
  --bg: #fafbfc;
  --card-bg: #ffffff;
  --text: #1a202c;
  --text-muted: #718096;
  --border: #e2e8f0;
  --primary: #4f8eff;
  --up: #16a34a;
  --down: #dc2626;
  --neutral: #94a3b8;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  transition: opacity 0.2s;
}
.logo:hover { opacity: 0.7; }

.site-header nav a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 16px;
  transition: color 0.2s;
}
.site-header nav a:hover { color: var(--primary); }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

.page-header {
  margin-bottom: 24px;
}
.page-header h1 {
  margin: 0 0 4px 0;
  font-size: 28px;
}
.period {
  color: var(--text-muted);
  font-size: 14px;
}

.site-url {
  margin-bottom: 16px;
}
.site-url a {
  color: var(--primary);
  font-size: 14px;
  text-decoration: none;
  word-break: break-all;
}
.site-url a:hover { text-decoration: underline; }

.commentary {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
  margin-bottom: 24px;
}
.commentary h2 {
  margin: 0 0 12px 0;
  font-size: 18px;
}
.commentary-body {
  white-space: pre-wrap;
  font-size: 14px;
}

.site-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.site-card .site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  border: none;
  padding: 0;
  position: static;
  margin-bottom: 8px;
}
.site-card h2 {
  margin: 0;
  font-size: 20px;
}
.site-history-link {
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
  transition: color 0.2s;
}
.site-history-link:hover { color: var(--primary); }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.metric-card {
  background: var(--bg);
  border-radius: 8px;
  padding: 14px 16px;
}
.metric-label {
  font-size: 12px;
  color: var(--text-muted);
}
.metric-value {
  font-size: 24px;
  font-weight: 700;
  margin: 4px 0;
}
.metric-delta {
  font-size: 12px;
  font-weight: 600;
}
.metric-delta.up { color: var(--up); }
.metric-delta.down { color: var(--down); }
.metric-delta.neutral { color: var(--neutral); }

.charts-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin: 20px 0;
}
.chart-container {
  background: var(--bg);
  border-radius: 8px;
  padding: 16px;
}
.chart-container h3 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}
.chart-container canvas {
  max-height: 280px;
}

.landing-table h3 {
  margin: 20px 0 8px 0;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--card-bg);
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
th {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}

.report-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.report-card {
  display: block;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s;
}
.report-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.report-date {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}
.report-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.report-comment {
  font-size: 13px;
  color: var(--text);
  margin: 8px 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.report-created {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 0;
}

.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 12px;
}

.page-footer {
  text-align: right;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 32px;
}

@media (max-width: 640px) {
  .container { padding: 16px 12px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .site-card { padding: 16px; }
}
