:root {
  --brand: #5B3A29;
  --bg: #f4f2ee;
  --card-bg: #ffffff;
  --text: #2c2c2a;
  --muted: #666666;
  --border: #e3ded4;
  --goat: #5B3A29;
  --pig: #3B6E8F;
  --accepted: #2E7D32;
  --rejected: #A32D2D;
  --bar: #3B6E8F;
}

* { box-sizing: border-box; }
body {
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
.hidden { display: none !important; }

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 24px;
  background: var(--brand);
  color: #fff;
}
.app-header h1 { font-size: 18px; margin: 0; }
.generated-at { font-size: 12px; opacity: 0.8; }

main {
  max-width: 960px;
  margin: 24px auto;
  padding: 0 16px 48px;
}

.state-message {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  font-size: 14px;
}
.state-message.error { color: var(--rejected); }

.card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.card h2 { font-size: 16px; margin: 0 0 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.tile {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.tile-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.tile-value { font-size: 24px; font-weight: 700; }
.tile-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.tile-sub .swatch { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }

/* Bar chart -- flat divs, not SVG: thin bars, rounded ends, direct value
   labels, a single sequential hue for magnitude (see dataviz color rules). */
.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 48px;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}
.bar-row .bar-label {
  text-align: right;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track { background: #eee6da; border-radius: 4px; height: 14px; overflow: hidden; }
.bar-fill { background: var(--bar); height: 100%; border-radius: 4px; }
.bar-value { color: var(--muted); font-size: 12.5px; }
.chart-empty { color: var(--muted); font-size: 13px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
td { padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tr.row-loc { cursor: pointer; }
tr.row-loc:hover { background: #faf8f4; }
.loc-cell { display: flex; align-items: center; gap: 6px; }
.twisty { display: inline-block; width: 12px; color: var(--muted); font-size: 11px; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
}
.badge-good { background: #eaf3de; color: var(--accepted); }
.badge-bad { background: #f7e6e6; color: var(--rejected); }
.badge-neutral { background: #f1efe8; color: var(--muted); }
