* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1c2528;
  background: #f4f6f1;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid #253339;
  border-radius: 6px;
  background: #253339;
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: #172125;
}

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

input,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #b8c3bf;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: #1c2528;
}

textarea {
  resize: vertical;
}

a {
  color: #1f628a;
}

.shell {
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.hidden {
  display: none !important;
}

.auth h1 {
  margin: 0 0 20px;
  font-size: 28px;
}

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

.panel,
.workspace,
.profile-summary {
  border: 1px solid #d2dad6;
  border-radius: 8px;
  background: #fff;
}

.panel {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.panel h2 {
  margin: 0;
  font-size: 18px;
}

.message {
  min-height: 24px;
  color: #8a1f1f;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #cad2cf;
  padding-bottom: 14px;
}

.status {
  margin-left: 12px;
  color: #51645d;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.workspace {
  margin-top: 16px;
  padding: 16px;
}

.profile-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding: 14px;
}

.summary-title {
  font-weight: 750;
}

.summary-meta {
  margin-top: 4px;
  color: #586b64;
  font-size: 13px;
}

.discovery-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.discovery-head h1 {
  margin: 0;
  font-size: 22px;
}

.step-label {
  margin-bottom: 12px;
  color: #52645d;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.onboarding-form {
  display: grid;
  gap: 13px;
}

.field {
  display: grid;
  gap: 6px;
  font-weight: 650;
}

.field.compact {
  font-size: 13px;
}

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

.wizard {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(23 32 38 / 48%);
}

.wizard-panel {
  width: min(820px, 100%);
  max-height: min(860px, 92vh);
  overflow: auto;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 50px rgb(0 0 0 / 25%);
  padding: 18px;
}

.wizard-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid #d9e1dd;
  padding-bottom: 12px;
}

.wizard-head h2 {
  margin: 0;
}

.wizard-form {
  display: grid;
  gap: 16px;
  padding-top: 16px;
}

.wizard-step {
  display: grid;
  gap: 12px;
}

.goal-set {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  border: 1px solid #d9e1dd;
  border-radius: 8px;
  padding: 10px;
}

.goal-set legend {
  padding: 0 4px;
  font-weight: 650;
}

.goal-set input,
.advanced input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

.profile-card {
  margin-top: 14px;
  border-top: 1px solid #d9e1dd;
  padding-top: 14px;
}

.profile-head {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  align-items: center;
}

.profile-head img {
  width: 54px;
  height: 54px;
  border-radius: 8px;
}

.profile-name {
  font-weight: 750;
}

.profile-meta,
.repo-list,
.coverage,
.result-meta,
.event-log {
  color: #586b64;
  font-size: 13px;
}

.repo-list {
  margin: 12px 0 0;
  padding-left: 18px;
}

.coverage {
  min-height: 44px;
  border: 1px solid #d9e1dd;
  border-radius: 8px;
  background: #f8faf7;
  padding: 12px;
}

.coverage.ok {
  border-color: #a8cfb3;
  background: #edf8ef;
  color: #234b30;
}

.coverage.warn {
  border-color: #e2c28f;
  background: #fff7e8;
  color: #6d4418;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.action-grid button.active {
  border-color: #1f6f9f;
  background: #1f6f9f;
}

.advanced {
  border-top: 1px solid #d9e1dd;
  padding-top: 10px;
}

.advanced label {
  display: inline-block;
  margin: 10px 14px 0 0;
}

.advanced input[type="number"] {
  width: 90px;
}

.command {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.notice {
  min-height: 24px;
  margin: 12px 0;
  border: 1px solid #e2c28f;
  border-radius: 8px;
  background: #fff7e8;
  padding: 10px 12px;
  color: #764814;
}

.notice.ok {
  border-color: #b8d1be;
  background: #edf7ef;
  color: #255335;
}

.output {
  display: grid;
  gap: 10px;
}

.empty,
.result {
  border: 1px solid #d6ddda;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.empty {
  color: #5d6d66;
}

.result-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.result-title {
  overflow-wrap: anywhere;
  font-weight: 750;
}

.score {
  color: #566760;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.result-meta {
  margin-top: 6px;
}

.result-detail {
  margin-top: 8px;
  color: #36464b;
  font-size: 14px;
  line-height: 1.35;
}

.feedback {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.feedback button {
  min-height: 32px;
  background: #eef2f0;
  color: #26343b;
}

.event-log {
  margin-top: 18px;
  border-top: 1px solid #d9e1dd;
  padding-top: 12px;
}

.event-log ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
}

pre {
  overflow: auto;
  max-height: 420px;
  border-radius: 8px;
  padding: 12px;
  background: #172026;
  color: #edf3ef;
}

@media (max-width: 940px) {
  .auth-grid {
    grid-template-columns: 1fr;
  }

  .action-grid,
  .source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .shell {
    padding: 14px;
  }

  .topbar,
  .result-head,
  .profile-summary,
  .discovery-head,
  .wizard-head {
    align-items: stretch;
    flex-direction: column;
  }

  .action-grid,
  .source-grid,
  .goal-set,
  .command {
    grid-template-columns: 1fr;
  }
}
