:root {
  --bg: #15120d;
  --panel: #1e1a14;
  --border: #392f22;
  --text: #f3ede2;
  --muted: #ab9c86;
  --accent: #6f8db3;
  --gold: #c99a4a;
  --ready: #2ecc71;
  --at-risk: #f5a623;
  --flagged: #e74c3c;
  --unknown: #6b7a89;
  --font-head: "Fraunces", Georgia, serif;
  --font-body: "Public Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent);
  color: var(--bg);
  border-radius: 8px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 15px;
}

h1 { margin: 0; font-size: 21px; font-family: var(--font-head); font-weight: 600; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.stack-info { position: relative; }
.stack-info summary {
  list-style: none;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  font-style: italic;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.stack-info summary::-webkit-details-marker { display: none; }
.stack-info summary:hover { color: var(--text); border-color: var(--accent); }
.stack-info[open] summary { color: var(--accent); border-color: var(--accent); }
.stack-popover {
  position: absolute;
  right: 0;
  top: 30px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  z-index: 10;
}

main { max-width: 960px; margin: 0 auto; padding: 24px 20px 60px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 20px;
}

.panel h2 { margin-top: 0; font-size: 17px; font-family: var(--font-head); font-weight: 600; }

label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }

textarea, input[type="text"], input[type="password"], input[type="datetime-local"] {
  width: 100%;
  background: #100d09;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}

textarea:focus, input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.char-counter { margin-top: 4px; font-size: 11px; color: var(--muted); text-align: right; }
.char-counter.char-counter-warn { color: var(--at-risk); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

button {
  margin-top: 20px;
  background: var(--accent);
  color: #12100c;
  border: none;
  border-radius: 8px;
  padding: 12px 22px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
button:disabled { opacity: 0.6; cursor: wait; }

.status-log {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  min-height: 20px;
}
.status-log div { padding: 2px 0; }
.status-log div::before { content: "> "; color: var(--accent); }
.status-log .cursor {
  display: inline-block;
  width: 7px;
  height: 13px;
  margin-left: 2px;
  background: var(--accent);
  vertical-align: -2px;
  animation: cursorBlink 1s steps(1) infinite;
}
@keyframes cursorBlink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .status-log .cursor { animation: none; }
}

.agent-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 960px) { .agent-cards { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .agent-cards { grid-template-columns: 1fr; } }

.agent-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  background: #100d09;
  animation: cardReveal 0.45s ease both;
}
@keyframes cardReveal {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .agent-card, .final-banner { animation: none; }
}
.agent-card h3 { margin: 0 0 10px; font-size: 14.5px; font-family: var(--font-head); font-weight: 600; color: var(--accent); display: flex; align-items: center; gap: 8px; }
.model-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}
.card-subtitle { font-size: 12px; color: var(--muted); margin: 0 0 10px; }
.detected-by {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin-top: 3px;
}

.verdict-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
  background: var(--unknown);
}
.verdict-badge.FLAGGED, .verdict-badge.NOT_FEASIBLE { background: var(--flagged); }
.verdict-badge.NO_RED_FLAGS_FOUND, .verdict-badge.FEASIBLE { background: var(--ready); color: #06210f; }
.verdict-badge.INSUFFICIENT_INFO, .verdict-badge.UNKNOWN { background: var(--unknown); }

dl { margin: 8px 0; }
dt { font-size: 11px; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
dd { margin: 2px 0 0; font-size: 13px; }

.evidence-block {
  margin: 10px 0;
  padding: 10px 12px;
  border-left: 3px solid var(--gold);
  background: rgba(201, 154, 74, 0.12);
  border-radius: 4px;
  font-size: 13px;
}
.evidence-block strong { color: var(--gold); }

.flag-item {
  font-size: 12px;
  padding: 6px 8px;
  margin-top: 6px;
  background: rgba(245, 166, 35, 0.1);
  border-left: 3px solid var(--at-risk);
  border-radius: 4px;
}

.reasoning { font-size: 12.5px; color: var(--muted); margin-top: 10px; }

.final-banner {
  margin-top: 20px;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid var(--border);
  animation: cardReveal 0.5s ease both;
}
.final-status {
  font-size: 26px;
  font-family: var(--font-head);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.final-status.READY { color: var(--ready); }
.final-status.AT_RISK { color: var(--at-risk); }
.final-status.FLAGGED { color: var(--flagged); }
#final-reason { font-size: 14px; margin: 10px auto 0; max-width: 560px; }
.case-id { color: var(--muted); font-size: 11px; margin-top: 8px; font-family: var(--font-mono); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; }
