:root {
  --ink: #0b1420;
  --ink-soft: #1a2a3a;
  --paper: #f3f6f4;
  --mist: rgba(243, 246, 244, 0.72);
  --teal: #1ec8a5;
  --teal-deep: #0e8f74;
  --navy: #0a1f33;
  --navy-mid: #12304a;
  --warn: #d4a017;
  --danger: #c4493a;
  --ok: #2a9d6a;
  --muted: #6b7c8c;
  --line: rgba(10, 31, 51, 0.12);
  --radius: 14px;
  --font-display: "Outfit", sans-serif;
  --font-mono: "Fragment Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-display);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(30, 200, 165, 0.28), transparent 55%),
    radial-gradient(900px 600px at 95% 8%, rgba(18, 48, 74, 0.35), transparent 50%),
    linear-gradient(165deg, #e8f1ef 0%, #f3f6f4 42%, #dce8e4 100%);
  animation: atmosphere-drift 18s ease-in-out infinite alternate;
}

@keyframes atmosphere-drift {
  from { transform: scale(1) translateY(0); }
  to { transform: scale(1.03) translateY(-1.5%); }
}

.site-header .tesla-login {
  margin-left: auto;
}

.site-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 1.25rem clamp(1.25rem, 4vw, 3rem);
}

.brand {
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
  color: var(--navy);
  text-decoration: none;
}

.brand-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

main {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2rem) 4rem;
}

.hero {
  min-height: calc(100vh - 5.5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 0 3rem;
}

.brand-mark {
  margin: 0 0 0.75rem;
  font-size: clamp(2.8rem, 9vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 0.95;
  color: var(--navy);
}

.hero h1 {
  margin: 0;
  max-width: 14ch;
  font-size: clamp(1.6rem, 4.2vw, 2.35rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink-soft);
}

.lede {
  margin: 1rem 0 2rem;
  max-width: 38ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.lookup-form {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr auto;
  gap: 0.75rem;
  align-items: end;
}

@media (max-width: 720px) {
  .lookup-form {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--navy-mid);
}

.field em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
}

.field input {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(30, 200, 165, 0.2);
}

.cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.15rem;
  padding: 0.9rem 1.35rem;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-deep) 100%);
  color: #06241c;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.cta:hover:not(:disabled) {
  filter: brightness(1.05);
}

.cta:active:not(:disabled) {
  transform: scale(0.97);
}

.cta:disabled {
  opacity: 0.7;
  cursor: wait;
}

.cta.loading .cta-label {
  opacity: 0;
}

.cta-spinner {
  position: absolute;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid rgba(6, 36, 28, 0.25);
  border-top-color: #06241c;
  border-radius: 50%;
  opacity: 0;
}

.cta.loading .cta-spinner {
  opacity: 1;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.form-error {
  margin: 0.85rem 0 0;
  color: var(--danger);
  font-size: 0.92rem;
}

.demo-chip {
  margin-top: 1.25rem;
  align-self: flex-start;
  border: 0;
  background: transparent;
  color: var(--navy-mid);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 0;
}

.report[hidden],
.hero[hidden] {
  display: none !important;
}

.report {
  padding: 1rem 0 2rem;
  animation: report-enter 0.55s ease both;
}

@keyframes report-enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.report-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.text-btn {
  border: 0;
  background: transparent;
  color: var(--teal-deep);
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.schema-meta {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.report-header .eyebrow {
  margin: 0 0 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.report-header h2 {
  margin: 0 0 1.25rem;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  letter-spacing: -0.04em;
  color: var(--navy);
}

.identity-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 0;
}

@media (max-width: 720px) {
  .identity-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.identity-grid dt {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.identity-grid dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  word-break: break-all;
}

.section-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 0.35rem;
  margin: 1.75rem 0 1rem;
  padding: 0.4rem;
  background: rgba(243, 246, 244, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow-x: auto;
}

.section-tabs a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: var(--navy-mid);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}

.section-tabs a:hover,
.section-tabs a.active {
  background: var(--navy);
  color: #eef7f3;
}

.panel {
  margin-bottom: 1.25rem;
  padding: 1.35rem 1.4rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel h3 {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.panel .muted,
.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.subhead {
  margin: 1.4rem 0 0.7rem;
  font-size: 0.95rem;
}

.fade-in {
  animation: fade-up 0.5s ease both;
}

.fade-in:nth-of-type(2) { animation-delay: 0.05s; }
.fade-in:nth-of-type(3) { animation-delay: 0.1s; }
.fade-in:nth-of-type(4) { animation-delay: 0.15s; }
.fade-in:nth-of-type(5) { animation-delay: 0.2s; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.range-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.method-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(10, 31, 51, 0.08);
  color: var(--navy-mid);
}

.method-badge.telematics {
  background: rgba(30, 200, 165, 0.18);
  color: var(--teal-deep);
}

.connect-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.cta-secondary {
  min-height: 2.5rem;
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
}

.text-btn.danger {
  color: var(--danger);
}

.connect-status {
  margin: 0 0 1.1rem;
}

.range-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 1.5rem;
  align-items: center;
}

@media (max-width: 640px) {
  .range-layout {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

.score-block h3 {
  margin-top: 0.75rem;
}

.score-ring {
  --score: 0;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    conic-gradient(var(--teal) calc(var(--score) * 1%), rgba(10, 31, 51, 0.1) 0);
  position: relative;
  transition: --score 0.8s ease;
  animation: ring-pop 0.7s ease both;
}

.score-ring::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: #fff;
}

.score-ring span {
  position: relative;
  z-index: 1;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--navy);
}

@keyframes ring-pop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.range-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.stat {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(10, 31, 51, 0.04);
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.stat strong {
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.disclaimer {
  margin: 1.1rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.risk-chip {
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.risk-chip .label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
  text-transform: capitalize;
}

.risk-chip .status {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
}

.risk-chip.ok .status { color: var(--ok); }
.risk-chip.warn .status { color: var(--warn); }
.risk-chip.danger .status { color: var(--danger); }
.risk-chip.unknown .status { color: var(--muted); }

.risk-chip .note {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.coverage-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.coverage-pill {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  background: rgba(10, 31, 51, 0.06);
  color: var(--navy-mid);
}

.coverage-pill.completed,
.coverage-pill.success { background: rgba(42, 157, 106, 0.15); color: #1a6b47; }
.coverage-pill.failed { background: rgba(196, 73, 58, 0.14); color: #8a2f24; }
.coverage-pill.not_checked { opacity: 0.7; }

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.stack-item {
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.stack-item strong {
  display: block;
  margin-bottom: 0.25rem;
}

.stack-item p {
  margin: 0.2rem 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.stack-item .meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.empty-state {
  padding: 1rem;
  border-radius: 12px;
  background: rgba(10, 31, 51, 0.04);
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer {
  padding: 1.5rem clamp(1.25rem, 4vw, 3rem) 2.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.site-footer p {
  margin: 0;
}
