:root {
  color-scheme: light dark;
  --bg: #f6f5f3;
  --panel: #ffffff;
  --text: #1c1b1a;
  --muted: #666361;
  --accent: #f68e56; /* nod to the Lib Dem orange/gold */
  --accent-dark: #c96a2e;
  --border: #e2e0dc;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181a;
    --panel: #212225;
    --text: #f1efec;
    --muted: #a2a09c;
    --border: #34353a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.wrap {
  width: 100%;
  max-width: 720px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

h1 {
  font-size: 1.3rem;
  margin: 0 0 4px;
}

.sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 20px;
}

.logout {
  font-size: 0.85rem;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}

.query-box {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

input[type="text"], input[type="password"] {
  flex: 1;
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}

button.primary {
  font-size: 1rem;
  padding: 12px 18px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #1c1b1a;
  font-weight: 600;
  cursor: pointer;
}

button.primary:hover { background: var(--accent-dark); color: #fff; }
button.primary:disabled { opacity: 0.6; cursor: default; }

.tier {
  margin-bottom: 20px;
}

.tier-heading {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--text);
}

details.tier > summary.tier-heading {
  cursor: pointer;
  list-style: none;
}

details.tier > summary.tier-heading::-webkit-details-marker {
  display: none;
}

details.tier > summary.tier-heading::before {
  content: "▸ ";
  color: var(--muted);
}

details.tier[open] > summary.tier-heading::before {
  content: "▾ ";
}

.tier-count {
  color: var(--muted);
  font-weight: 400;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 12px;
}

.card h3 {
  margin: 0 0 2px;
  font-size: 1.05rem;
}

.meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tag {
  font-size: 0.78rem;
  background: rgba(246, 142, 86, 0.15);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.evidence {
  font-size: 0.87rem;
  color: var(--muted);
  line-height: 1.4;
}

.hint, .empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.summary {
  margin-bottom: 22px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
}

.stat-label {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 2px;
}

.coverage {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--panel);
}

.coverage summary {
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--muted);
}

.bar-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr 28px;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.bar-label {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  background: rgba(246, 142, 86, 0.12);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}

.bar-fill {
  background: var(--accent);
  height: 100%;
  border-radius: 4px;
}

.bar-count {
  color: var(--muted);
  text-align: right;
}

.login-panel {
  max-width: 360px;
  margin: 15vh auto 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  text-align: center;
}

.login-panel form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.error {
  color: #d94141;
  font-size: 0.88rem;
  min-height: 1.2em;
}
