:root {
  --brand-primary: #010080;
  --brand-primary-soft: #1a1a99;
  --brand-primary-tint: #e9e9f6;
  --brand-accent: #a5c844;
  --brand-accent-dark: #8fb030;
  --brand-accent-tint: #f1f6e0;
  --text: #111;
  --text-muted: #666;
  --border: #e5e5e5;
  --bg: #fafafa;
  --bg-card: #ffffff;
}

* { box-sizing: border-box; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("https://rsms.me/inter/font-files/Inter-roman.var.woff2") format("woff2");
}

.app {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static !important;
    height: auto !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
  }
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: white;
  border-right: 1px solid var(--border);
  padding: 1.5rem 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.brand-logo {
  max-width: 100%;
  max-height: 56px;
  display: block;
}
.brand-logo-fallback {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--brand-primary);
  letter-spacing: -.01em;
  line-height: 1.2;
}
.brand-logo-fallback small {
  display: block;
  font-weight: 500;
  font-size: .7rem;
  color: var(--text-muted);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-top: .15rem;
}

.sidebar-header h2 {
  margin: 0 0 .25rem;
  font-size: .95rem;
  font-weight: 600;
  color: var(--brand-primary);
}
.small { font-size: .8rem; }
.muted { color: var(--text-muted); margin-top: 0; }

.pills {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin: 1rem 0 1.5rem;
}
.pill {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .7rem;
  background: #f6f6fa;
  border-radius: 999px;
  font-size: .82rem;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.pill.active   { background: var(--brand-accent-tint); border-color: var(--brand-accent); color: #4d6618; }
.pill.empty    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.pill.skipped  { background: #f4f4f5; border-color: #e4e4e7; color: var(--text-muted); opacity: .75; }
.pill.idle     { background: var(--brand-primary-tint); border-color: #c5c5e8; color: var(--brand-primary); }
.pill.failed   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.pill.no_key   { background: #f4f4f5; border-color: #e4e4e7; opacity: .65; color: var(--text-muted); }
.pill.pending  { background: transparent; border-color: #e4e4e7; opacity: .55; font-style: italic; color: var(--text-muted); }

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-green   { background: var(--brand-accent); box-shadow: 0 0 0 3px var(--brand-accent-tint); }
.dot-blue    { background: var(--brand-primary); box-shadow: 0 0 0 3px var(--brand-primary-tint); }
.dot-amber   { background: #f59e0b; box-shadow: 0 0 0 3px #fef3c7; }
.dot-red     { background: #ef4444; box-shadow: 0 0 0 3px #fecaca; }
.dot-grey    { background: #a1a1aa; }
.dot-pending { background: transparent; border: 1px dashed #a1a1aa; }

.legend {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid #f0f0f0;
  font-size: .72rem;
  color: var(--text-muted);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: .25rem 0;
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.75rem 4rem;
  width: 100%;
}

/* Forms are easier to read when constrained — keep at ~720px even though main is wider */
form {
  max-width: 720px;
}

header h1 {
  margin: 0 0 .25rem;
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--brand-primary);
  letter-spacing: -.015em;
}

form {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 2px rgba(1, 0, 128, 0.03);
}
label { display: block; margin-bottom: 1rem; }
label span {
  display: block;
  margin-bottom: .35rem;
  font-size: .85rem;
  font-weight: 500;
  color: #333;
}
input {
  width: 100%;
  padding: .65rem .8rem;
  border: 1px solid #d4d4d8;
  border-radius: 7px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-tint);
}
.row { display: flex; gap: 1rem; }
.half { flex: 1; }

button {
  background: var(--brand-accent);
  color: white;
  border: none;
  padding: .75rem 1.4rem;
  border-radius: 7px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: .01em;
  transition: background .15s, transform .05s;
}
button:hover { background: var(--brand-accent-dark); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }

section { margin-top: 1.5rem; }
.hidden { display: none; }

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 1100px) {
  .result-grid { grid-template-columns: 1fr; }
}

.result-col {
  display: flex;
  flex-direction: column;
}
.col-heading {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .5rem;
}
.col-heading h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--brand-primary);
  letter-spacing: -.01em;
}
.col-tag {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: .15rem .5rem;
  border-radius: 4px;
}
.tag-john {
  background: var(--brand-primary-tint);
  color: var(--brand-primary);
}
.tag-ai {
  background: var(--brand-accent-tint);
  color: #4d6618;
}

#johns-panel {
  background: var(--bg-card);
  padding: 1.25rem 1.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(1, 0, 128, 0.03);
  flex: 1;
  font-size: .92rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
#johns-panel.empty-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-style: italic;
  color: var(--text-muted);
}
.johns-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: .8rem;
  color: var(--text-muted);
  margin: 0 0 .9rem;
  padding-bottom: .75rem;
  border-bottom: 1px dashed #e0e0e8;
}
.johns-meta span strong { color: #333; }
.johns-body {
  margin: 0;
  white-space: pre-wrap;
}

#status {
  padding: .75rem 1rem;
  background: var(--brand-primary-tint);
  border-left: 3px solid var(--brand-primary);
  border-radius: 6px;
  font-size: .92rem;
  color: var(--brand-primary);
}
#status.error { background: #fef2f2; border-left-color: #dc2626; color: #991b1b; }

#summary-panel {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(1, 0, 128, 0.03);
}
#summary-panel h3 {
  margin: 1.25rem 0 .35rem;
  font-size: .82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand-primary);
}
#summary-panel h3:first-child { margin-top: 0; }
#summary-panel p { margin: 0 0 .75rem; }

.val-figures {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-soft) 100%);
  border-radius: 8px;
  margin-bottom: 1.25rem;
  color: white;
}
.val-figures .fig { flex: 1; }
.val-figures .fig-label {
  font-size: .72rem;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .25rem;
}
.val-figures .fig-value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.01em;
}
.val-figures .fig-value.confidence { font-size: 1.1rem; text-transform: capitalize; }

pre {
  background: #f4f4f5;
  padding: .85rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: .78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}

#compare h2 {
  font-size: 1.1rem;
  color: var(--brand-primary);
  margin-bottom: .25rem;
}

#result h2 {
  font-size: 1.2rem;
  color: var(--brand-primary);
  margin-bottom: .75rem;
}

details summary {
  cursor: pointer;
  margin-top: 1rem;
  font-size: .85rem;
  color: var(--brand-primary);
  font-weight: 500;
}
details[open] summary { margin-bottom: .5rem; }
