:root {
  color-scheme: light;
  --bg: #edf2f6;
  --panel: #ffffff;
  --text: #101828;
  --muted: #5e6b82;
  --line: #d6dee8;
  --soft-line: #e8edf3;
  --accent: #15796b;
  --accent-dark: #0f5e53;
  --soft-accent: #e8f4f1;
  --good: #17834f;
  --mid: #d49320;
  --low: #c35239;
  --missing: #8b96a7;
  --danger-bg: #fff0f0;
  --danger-text: #a33434;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(100%, 420px);
}

.login-panel,
.summary-panel,
.tool-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 38px rgba(16, 24, 40, 0.07);
}

.login-panel {
  padding: 32px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin-bottom: 20px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 2.6rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.3rem;
}

.muted {
  color: var(--muted);
  line-height: 1.45;
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 0.92rem;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  color: var(--text);
  background: #fbfcfd;
  font-weight: 600;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(23, 108, 99, 0.14);
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.secondary-button:hover {
  background: #eef2f6;
}

.error-message {
  margin: 20px 0 0;
  border: 1px solid #f2b8b8;
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--danger-bg);
  color: var(--danger-text);
  font-weight: 650;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px clamp(20px, 5vw, 56px);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.2rem);
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.dashboard-layout {
  display: grid;
  gap: 16px;
  width: min(1180px, calc(100% - 40px));
  margin: 18px auto 32px;
}

.summary-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
}

.tool-panel {
  display: grid;
  grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
}

.scan-form {
  display: grid;
  align-content: start;
  gap: 15px;
  padding: 22px 24px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfc 100%);
}

.form-heading h2,
.results-header h2 {
  margin-bottom: 6px;
}

.form-heading .muted,
.results-header .muted {
  margin-bottom: 0;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.status-text {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.status-text.is-error {
  color: var(--danger-text);
}

.results-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
  padding: 24px;
}

.results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--soft-line);
}

.results-header strong {
  color: var(--text);
}

.rank-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 12px;
  min-width: 190px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.rank-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rank-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.legend-good {
  background: var(--good);
}

.legend-mid {
  background: var(--mid);
}

.legend-low {
  background: var(--low);
}

.legend-missing {
  background: var(--missing);
}

.map-panel {
  overflow: hidden;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #f8fafc;
}

#rank-map {
  width: 100%;
  height: 390px;
}

.rank-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.rank-metrics article {
  display: grid;
  gap: 6px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.rank-metrics span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.rank-metrics strong {
  color: var(--text);
  font-size: 1.45rem;
  line-height: 1;
}

.top-results {
  width: min(100%, 720px);
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.top-results h3 {
  margin: 0;
  font-size: 1rem;
}

.top-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.top-results-header span {
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--soft-accent);
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.top-results ol {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style-position: inside;
}

.top-results li {
  padding: 10px 0;
  border-top: 1px solid var(--soft-line);
}

.top-results li::marker {
  color: var(--muted);
  font-weight: 800;
}

.top-results li strong,
.top-results li span {
  display: inline;
}

.top-results li strong {
  margin-left: 4px;
}

.top-results li span {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
  padding-left: 24px;
}

.empty-results p {
  margin: 8px 0 0;
  color: var(--muted);
}

@media (max-width: 720px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-panel,
  .tool-panel {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    display: grid;
  }

  .scan-form {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .results-header {
    display: grid;
  }

  .rank-legend {
    justify-content: flex-start;
  }

  .rank-metrics {
    grid-template-columns: 1fr;
  }
}
