* { box-sizing: border-box; }
:root {
  --bg: #f4f7fb;
  --bg-accent: #e8eefc;
  --card: rgba(255,255,255,.82);
  --card-border: rgba(148,163,184,.22);
  --text: #0f172a;
  --muted: #64748b;
  --primary: #1d4ed8;
  --primary-2: #1e40af;
  --success: #166534;
  --error: #991b1b;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1000px 420px at 100% -10%, #dbeafe 0%, transparent 60%),
    radial-gradient(850px 360px at -20% 0%, #e2e8f0 0%, transparent 55%),
    var(--bg);
}

.container { max-width: 1080px; margin: 0 auto; padding: 1rem; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 1.5rem;
  row-gap: .6rem;
  align-items: center;
  margin-bottom: 1rem;
}
.hero > div:first-child { align-self: center; }
h1 {
  margin: .1rem 0 .3rem;
  letter-spacing: -.02em;
  line-height: 1.15;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
}
.subtitle {
  color: var(--muted);
  margin: 0;
  font-size: .97rem;
  max-width: 62ch;
  line-height: 1.4;
}

.hero-badges {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  justify-content: end;
  align-content: center;
  gap: .38rem 1rem;
  min-width: 390px;
  color: #475569;
  font-size: .82rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  font-weight: 500;
  color: inherit;
  cursor: default;
  user-select: none;
  white-space: nowrap;
}

.card {
  background: var(--card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow:
    0 12px 34px rgba(15,23,42,.08),
    0 2px 8px rgba(15,23,42,.04);
  margin-bottom: 1rem;
}
.card h2 {
  margin: 0;
  padding: 1rem 1.05rem 0;
  font-size: 1.04rem;
  line-height: 1.25;
  color: #111827;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px,1fr));
  gap: .85rem;
  padding: 1rem;
}
label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; color:#334155; }
input, button {
  padding: .68rem .72rem;
  border-radius: 10px;
  border: 1px solid #d3dbe8;
  font-size: .97rem;
  background: #fff;
}
input:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96,165,250,.2), 0 1px 2px rgba(2,6,23,.05);
}
button {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  border: none;
  cursor: pointer;
  align-self: end;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(29,78,216,.28);
  transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
}
button:hover { filter: brightness(1.02); transform: translateY(-1px); }
button:active { transform: translateY(0); }

.preexisting-field { display:flex; align-items:center; gap:.6rem; margin-top:.25rem; }
.preexisting-field input[type="checkbox"] { width: 20px; height: 20px; accent-color:var(--primary); margin:0; }
.preexisting-field span { line-height:1.2; }

.results-table-wrap { overflow-x: auto; }
.results-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: .75rem;
  padding: 1rem 1.05rem .45rem;
}
.results-head h2 { padding: 0; }
.results-head p {
  margin: 0;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.25;
  text-align: right;
}

.results-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.results-table th, .results-table td {
  padding: .9rem 1.05rem;
  border-bottom: 1px solid #e7edf6;
  text-align: left;
  vertical-align: top;
}
.results-table th {
  background: rgba(248,250,252,.8);
  font-size: .84rem;
  letter-spacing: .01em;
  color: #475569;
  text-transform: uppercase;
  font-weight: 700;
  padding-top: .72rem;
  padding-bottom: .72rem;
}
.results-table tbody tr:not(.loading):hover { background: rgba(248,250,252,.8); }

.action-col-hidden { display: none; }
.retry-icon-btn {
  background: transparent;
  border: none;
  color: #dc2626;
  font-size: 1.08rem;
  padding: .2rem .35rem;
  cursor: pointer;
  line-height: 1;
  box-shadow: none;
}
.retry-icon-btn:hover { color: #b91c1c; transform: none; }

.status { font-weight: 600; color:#64748b; }
.provider-details { margin-top: .45rem; font-size: .8rem; color: #475569; }
.provider-details summary {
  cursor: pointer;
  color: #1e3a8a;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  list-style: none;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: .2rem .55rem;
}
.provider-details summary::-webkit-details-marker { display: none; }
.provider-details summary::before { content: '▸'; font-size: .72rem; color: #1d4ed8; transform: translateY(-.5px); }
.provider-details[open] summary::before { content: '▾'; }
.provider-details-list {
  margin-top: .45rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: .45rem .6rem;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.65);
}
.provider-details-list p { margin: 0; line-height: 1.42; padding: .3rem 0; border-bottom: 1px dashed #e2e8f0; }
.provider-details-list p:last-child { border-bottom: none; padding-bottom: .15rem; }
.provider-details-list strong { color: #0f172a; }

.result { color: #0f172a; font-weight: 700; }
.results-table tr.loading {
  background: linear-gradient(90deg, #ffffff 0%, #f3f4f6 50%, #ffffff 100%);
  background-size: 250% 100%;
  animation: pulseRow 1.2s linear infinite;
}
.results-table tr.loading .status::before { content:'⏳ '; }
.results-table tr.success .status { color: var(--success); }
.results-table tr.error .status { color: var(--error); }
@keyframes pulseRow { 0%{ background-position: 100% 0;} 100%{ background-position: -100% 0;} }

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .hero-badges {
    grid-template-columns: repeat(2, max-content);
    justify-content: start;
    min-width: 0;
  }
}

@media (max-width: 700px) {
  .container { padding: .75rem; }
  .card { border-radius: 14px; }
  .form-grid { grid-template-columns: 1fr; gap: .72rem; }
  button { width: 100%; }
  .card h2 { padding: .9rem .8rem 0; }
  .results-head {
    flex-direction: column;
    gap: .28rem;
    align-items: flex-start;
    padding: .9rem .8rem .4rem;
  }
  .results-head p { text-align: left; }
  .results-table { min-width: 0; table-layout: fixed; }
  .results-table th:nth-child(1), .results-table td:nth-child(1) { width: 64%; }
  .results-table th:nth-child(2), .results-table td:nth-child(2) { width: 36%; text-align: right; }
  .results-table th, .results-table td { padding: .74rem .58rem; font-size: .9rem; }
  .status { display:block; margin-top: .2rem; font-size: .78rem; line-height: 1.25; }
  .hero-badges { grid-template-columns: 1fr; gap: .25rem; }
}
