:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #0a63be;
  --bg: #f8fafc;
}

body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg); }

.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 0.75rem 0; }
.logo-mark { width: 36px; height: 36px; flex: none; }
.brand { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; color: var(--accent); }
.brand-sub { font-size: 0.78rem; color: var(--muted); }
.aws-badge { display: inline-flex; align-items: center; gap: 6px; background: #232f3e; color: #fff; font-size: 0.75rem; font-weight: 500; padding: 4px 9px; border-radius: 6px; white-space: nowrap; }

.stack-panel { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); text-align: center; }
.stack-card { margin-top: 0.75rem; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.25rem; text-align: left; }
.stack-group { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.5rem; }
.stack-tag { font-size: 0.8rem; padding: 0.2rem 0.55rem; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); color: #334155; }

.search-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.25rem; }
.search-alt { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.search-alt .btn { font-size: 0.9rem; }
#voiceBtn.active { color: #fff; background: #dc3545; border-color: #dc3545; }

.status { margin-top: 1rem; padding: 0.85rem 1rem; border-radius: 10px; background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

.result-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.5rem; }
.med-name { font-size: 1.5rem; font-weight: 700; margin: 0; }
.med-maker { color: var(--muted); font-size: 0.95rem; margin-top: 0.15rem; }
.sec-title { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin: 1.5rem 0 0.5rem; }
.result-card p, .result-card ul { margin-bottom: 0; color: #334155; }
.result-card ul { padding-left: 1.1rem; }
.result-card li { margin-bottom: 0.25rem; }
.result-card a { color: var(--accent); text-decoration: none; font-weight: 500; }
.result-card a:hover { text-decoration: underline; }

.panel-title { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.75rem; }
.similar-item {
  display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.9rem;
  transition: border-color 0.15s;
}
.similar-item:hover { border-color: #b6cde6; }
.similar-name { font-weight: 600; }
.similar-meta { font-size: 0.8rem; color: var(--muted); }

.disclaimer { margin-top: 1.5rem; font-size: 0.8rem; color: var(--muted); text-align: center; }

#spinnerOverlay {
  position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem;
  background: rgba(248, 250, 252, 0.85); color: var(--muted); font-weight: 500;
}
#spinnerOverlay[hidden] { display: none; }

@media (max-width: 575px) {
  .search-card { padding: 1rem; }
  #codeForm { flex-direction: column; }
  .search-alt .btn { flex: 1; }
  .result-card { padding: 1.1rem; }
  .med-name { font-size: 1.3rem; }
  .brand-sub { display: none; }
  .aws-badge { font-size: 0.7rem; padding: 3px 7px; }
}

/* Verification badge on each card */
.verify-panel { border: 1px solid var(--line); border-radius: 12px; padding: 0.75rem 0.9rem; margin: 0.9rem 0 0.4rem; background: #f8fafc; font-size: 0.88rem; }
.verify-panel.level-high { border-color: #86efac; background: #f0fdf4; }
.verify-panel.level-medium { border-color: #fcd34d; background: #fffbeb; }
.verify-panel.level-low { border-color: #fca5a5; background: #fef2f2; }
.verify-head { display: flex; gap: 0.6rem; align-items: flex-start; }
.verify-head i { font-size: 1.35rem; line-height: 1; }
.level-high .verify-head i { color: #15803d; } .level-medium .verify-head i { color: #b45309; } .level-low .verify-head i { color: #b91c1c; }
.verify-head b { display: block; }
.verify-head span { color: var(--muted); }
.verify-line { margin: 0.45rem 0 0; }
.verify-panel details { margin-top: 0.5rem; }
.verify-panel summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.claims { list-style: none; padding: 0; margin: 0.5rem 0 0; display: grid; gap: 0.4rem; }
.claim { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 0.45rem 0.6rem; }
.claim.contradicted { border-color: #fca5a5; }
.claim-verdict { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-right: 0.35rem; }
.claim.supported .claim-verdict { color: #15803d; } .claim.contradicted .claim-verdict { color: #b91c1c; }
.claim.not_in_label .claim-verdict, .claim.unchecked .claim-verdict { color: var(--muted); }
.claim-field { font-weight: 600; margin-right: 0.25rem; }
.claim blockquote, .contradictions blockquote { margin: 0.3rem 0 0; padding-left: 0.6rem; border-left: 3px solid var(--line); color: var(--muted); font-size: 0.82rem; }
.claim-note { display: block; color: #b45309; margin-top: 0.2rem; }

/* Tabs and Evaluation view */
.view-tabs .nav-link { color: var(--muted); }
.view-tabs .nav-link.active { background: var(--accent); color: #fff; }
.eval-view { display: grid; gap: 1rem; }
.eval-head h1 { font-size: 1.6rem; font-weight: 700; margin: 0.15rem 0 0.4rem; }
.eval-head p { color: var(--muted); margin: 0; max-width: 760px; }
.eyebrow { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin: 0; }
.eval-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; }
.eval-kpis div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem; }
.eval-kpis b { display: block; font-size: 1.5rem; }
.eval-kpis span { font-size: 0.78rem; color: var(--muted); }
.eval-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem; }
.eval-card h2 { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 0.75rem; }
.eval-method { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.35rem; font-size: 0.9rem; }
.eval-table { font-size: 0.85rem; margin: 0; }
.eval-table tr.row-wrong td, .eval-table tr.row-hallucinated td, .eval-table tr.row-missed td { background: #fef2f2; }
.eval-table tr.row-partial td { background: #fffbeb; }
.lvl { font-size: 0.72rem; font-weight: 700; padding: 0.1rem 0.45rem; border-radius: 999px; }
.lvl-high { background: #dcfce7; color: #166534; } .lvl-medium { background: #fef3c7; color: #92400e; } .lvl-low { background: #fee2e2; color: #991b1b; }
.contradictions { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.5rem; font-size: 0.88rem; }

/* Architecture tab */
.arch-wrap { overflow-x: auto; }
.arch-svg { width: 100%; min-width: 760px; height: auto; display: block; }
.a-title { font-size: 14px; font-weight: 700; fill: #0f172a; font-family: inherit; }
.a-sub { font-size: 11px; fill: #475569; font-family: inherit; }
.a-note { font-size: 11px; fill: #64748b; font-style: italic; font-family: inherit; }
.a-line { stroke: #64748b; stroke-width: 1.5; }
.a-line.dash { stroke-dasharray: 5 4; }
.arch-legend { list-style: none; margin: 0.75rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; font-size: 0.78rem; color: var(--muted); }
.arch-legend li { display: flex; align-items: center; gap: 0.35rem; }
.arch-legend span { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid; display: inline-block; }
.arch-legend .a-dash { width: 22px; height: 0; border: 0; border-top: 2px dashed #64748b; border-radius: 0; }
.decisions { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0.75rem; }
.decision { border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.8rem; background: #f8fafc; }
.decision b { font-size: 0.92rem; }
.decision p { margin: 0.3rem 0 0; font-size: 0.86rem; }
.decision .tradeoff { color: var(--muted); }
.decision .tradeoff span { font-weight: 600; color: #b45309; }
