:root {
  --ink: #1c2430;
  --muted: #5d6b7c;
  --line: #e4e8ee;
  --paper: #f3f5f7;
  --card: #ffffff;
  --accent: #123044;
  --accent-ink: #ffffff;
  --mobile: #0f6b4c;
  --mobile-bg: #e7f4ee;
  --warn: #8a5a12;
  --warn-bg: #f8f1e3;
  --shadow: 0 1px 2px rgba(18, 48, 68, 0.04);
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}

.top, .search, .status, #result {
  width: min(920px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

.top {
  padding: 40px 0 8px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 500; }

h1 {
  margin: 0;
  font-size: 40px;
  letter-spacing: -0.03em;
}

.lede {
  max-width: 58ch;
  margin: 10px 0 0;
  color: var(--muted);
}

.search { margin-top: 28px; }

.search label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
}

.search-row {
  display: flex;
  gap: 8px;
}

input[type="text"], input:not([type]) , #applicationId {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #cfd6df;
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font: 16px var(--sans);
}

#applicationId:focus {
  outline: 2px solid #9eb4c6;
  border-color: var(--accent);
}

button, .copy {
  height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 15px var(--sans);
  cursor: pointer;
}

button:disabled { opacity: 0.6; cursor: wait; }

.copy {
  height: 34px;
  padding: 0 12px;
  background: transparent;
  color: var(--accent);
  border: 1px solid #cfd6df;
  font-size: 13px;
  font-weight: 600;
}

.copy:hover, button:hover { filter: brightness(1.05); }

.status {
  min-height: 24px;
  margin-top: 14px;
  color: #8d2f2f;
  font-size: 14px;
}

.status.quiet { color: var(--muted); }

#result { padding-bottom: 64px; }

.sheet {
  margin-top: 8px;
  padding: 28px 28px 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.identity {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.identity h2 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -0.02em;
}

.meta, .sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 20px;
  margin: 16px 0 0;
}

.facts dt {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.facts dd {
  margin: 0;
  font-size: 14px;
}

.score {
  min-width: 92px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #f4f7fa;
  text-align: right;
}

.score b {
  display: block;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
}

.score span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.counts {
  display: flex;
  gap: 18px;
  margin: 18px 0 6px;
  color: var(--muted);
  font-size: 14px;
}

.counts strong { color: var(--ink); font-weight: 600; }

.notice {
  margin: 16px 0 22px;
  color: var(--muted);
}

section { margin: 8px 0 22px; }

section h3 {
  margin: 18px 0 10px;
  font-size: 22px;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 16px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.number, .email-value, .pin {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.number { font-size: 20px; }

.email-value { font-size: 16px; }

.kind, .tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--mobile-bg);
  color: var(--mobile);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  vertical-align: 3px;
}

.tag.warn { background: var(--warn-bg); color: var(--warn); }

.tag.neutral { background: #eef2f6; color: #3d4d5e; }

.address-lines {
  margin: 0;
  max-width: 62ch;
  font-size: 16px;
  line-height: 1.5;
}

.place {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0 0;
}

.where { color: var(--ink); font-size: 14px; }

.pin { font-weight: 600; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  padding: 3px 8px;
  border-radius: 999px;
  background: #f3f6f8;
  color: #314152;
  font-size: 12px;
  line-height: 1.45;
}

.chip.warn { background: var(--warn-bg); color: var(--warn); }

.reading {
  margin: 0;
  font-size: 16px;
}

.reading.steady { color: var(--mobile); }
.reading.watch { color: var(--warn); }
.reading.stress { color: #8d2f2f; }
.reading.empty { color: var(--muted); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.stat {
  padding: 12px;
  border-radius: 10px;
  background: #f6f8fa;
}

.stat b {
  display: block;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
}

.stat span, .stat small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.risk-note {
  margin: 10px 0 0;
  color: var(--ink);
  font-size: 14px;
}

.capacity { margin-top: 14px; }

.account {
  padding: 12px 0 4px;
  border-top: 1px solid var(--line);
}

.account-name {
  font-size: 16px;
  font-weight: 600;
}

.account-facts, .account-delay {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.account-delay { color: var(--ink); }

.closed-accounts {
  margin-top: 16px;
}

.closed-accounts summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
}

.also {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.subhead {
  margin: 22px 0 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.empty {
  margin: 0;
  padding: 14px 0 6px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.section-head h3 { margin-bottom: 0; }

@media (max-width: 640px) {
  h1 { font-size: 32px; }
  .identity { flex-direction: column; }
  .score { text-align: left; }
  .sheet { padding: 20px 16px 4px; }
  .search-row, .section-head { flex-direction: column; align-items: stretch; }
  .section-head { align-items: flex-start; }
  .stats { grid-template-columns: 1fr 1fr; }
  button { width: 100%; }
  .copy { width: auto; }
  .row { grid-template-columns: 1fr; }
}
