:root {
  --bg: #eef3f8;
  --panel: #fff;
  --ink: #101820;
  --muted: #64748b;
  --line: #dbe4ee;
  --red: #e52629;
  --green: #10b981;
  --amber: #f59e0b;
  --blue: #06b6d4;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}
button { font: inherit; }
.portal-wrap {
  width: min(980px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 22px 0 36px;
}
.hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 14px;
  align-items: center;
  box-shadow: 0 16px 44px rgba(15, 23, 42, .08);
}
.hero img { width: 64px; height: 64px; object-fit: contain; }
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .72rem;
  font-weight: 800;
}
h1 { margin: 0; font-size: clamp(1.35rem, 4vw, 2rem); line-height: 1.08; }
.hero p { margin: 6px 0 0; color: var(--muted); font-size: .92rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.metric-card,
.note-card,
.portal-section,
.state-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.metric-card { padding: 14px; }
.metric-card .label { color: var(--muted); font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.metric-card strong { display: block; margin-top: 4px; font-size: .95rem; }
.note-card { padding: 14px; margin-bottom: 14px; }
.note-card p:last-child { margin-bottom: 0; white-space: pre-wrap; }
.cond-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.cond-box {
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  font-size: .75rem;
}
.cond-box strong { display: block; font-size: 1.2rem; color: var(--ink); }
.cond-box.ok { background: #dcfce7; color: #047857; border-color: #86efac; }
.cond-box.attention { background: #ffedd5; color: #c2410c; border-color: #fdba74; }
.cond-box.urgent { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.portal-section { overflow: hidden; margin-bottom: 10px; }
.portal-section-title {
  padding: 11px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: .8rem;
  font-weight: 900;
  text-transform: uppercase;
  color: #334155;
}
.portal-check-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid #eef2f7;
}
.portal-check-row:last-child { border-bottom: 0; }
.portal-check-row span:first-child { min-width: 0; }
.portal-check-row small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: .76rem;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: .72rem;
  font-weight: 900;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.status-ok { color: #047857; background: #dcfce7; border-color: #86efac; }
.status-attention { color: #c2410c; background: #ffedd5; border-color: #fdba74; }
.status-urgent { color: #dc2626; background: #fee2e2; border-color: #fca5a5; }
.status-pending { color: #b45309; background: #fef3c7; border-color: #fcd34d; }
.status-not_applicable { color: #64748b; background: #f1f5f9; border-color: #cbd5e1; }
.footer-note {
  text-align: center;
  margin-top: 22px;
  color: var(--muted);
  font-size: .8rem;
}
.state-card {
  width: min(420px, calc(100vw - 28px));
  margin: 12vh auto;
  padding: 26px;
  text-align: center;
}
.state-card img { width: 86px; margin-bottom: 14px; }
.state-card h1 { font-size: 1.35rem; }
.state-card p { color: var(--muted); }
.debug {
  margin-top: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  color: #94a3b8;
  font-size: .72rem;
  word-break: break-word;
}
@media (max-width: 720px) {
  .portal-wrap { width: min(100vw - 16px, 980px); padding-top: 8px; }
  .hero { grid-template-columns: 48px 1fr; align-items: start; }
  .hero img { width: 46px; height: 46px; }
  .hero .btn { grid-column: 1 / -1; width: 100%; }
  .summary-grid { grid-template-columns: 1fr; }
  .cond-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-check-row { grid-template-columns: 1fr; }
  .status-pill { justify-self: start; }
}
