:root {
  --bg: #0b0d12;
  --panel: #12151c;
  --panel-2: #171b24;
  --border: #222836;
  --text: #e7ecf3;
  --muted: #8892a6;
  --accent: #6ee7b7;
  --accent-2: #22d3ee;
  --danger: #f87171;
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: radial-gradient(1200px 600px at 20% -20%, #142033 0%, transparent 60%), var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 24px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.brand .sub {
  color: var(--muted);
  font-size: 13px;
}
.brand .sub strong {
  color: var(--accent);
  font-weight: 600;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
button {
  font-family: var(--sans);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 120ms ease, border-color 120ms ease;
}
button:hover { background: #1d2330; border-color: #2a3345; }
button .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
button.link {
  background: transparent;
  border: none;
  color: var(--accent-2);
  padding: 0;
  font-size: 13px;
}
button.link:hover { text-decoration: underline; }

.status {
  color: var(--muted);
  font-size: 13px;
  min-width: 120px;
}
.status.error { color: var(--danger); }
.status.ok { color: var(--accent); }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 16px 18px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi .label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.kpi .value {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.kpi.primary {
  background: linear-gradient(160deg, rgba(110,231,183,0.08), rgba(34,211,238,0.06));
  border-color: rgba(110,231,183,0.25);
}
.kpi.primary .value { color: var(--accent); }

.grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
}
@media (max-width: 980px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.card-head .hint {
  color: var(--muted);
  font-size: 12px;
}
.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  background: rgba(34,211,238,0.12);
  color: var(--accent-2);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  vertical-align: middle;
}
.tag:empty { display: none; }

.table-wrap {
  max-height: 460px;
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead th {
  position: sticky;
  top: 0;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
tbody td, tfoot th {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
}
tbody tr {
  cursor: pointer;
  transition: background 100ms ease;
}
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody tr.active { background: rgba(34,211,238,0.07); }
.num { text-align: right; font-family: var(--mono); }
#by-project tbody td:first-child,
#detail tbody td:nth-child(2) { font-weight: 500; }

tfoot th {
  background: var(--panel-2);
  border-top: 1px solid var(--border);
  border-bottom: none;
  color: var(--text);
  font-size: 13px;
}

.foot {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
}
.foot a { color: var(--muted); }
.foot a:hover { color: var(--text); }

.hidden { display: none; }

.empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.bar {
  display: inline-block;
  height: 6px;
  background: var(--accent);
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}
