:root {
  --paper: #f5f7fa;
  --paper-strong: #ffffff;
  --surface-muted: #eef2f6;
  --ink: #151b23;
  --muted: #586274;
  --line: #d8dee8;
  --line-strong: #aeb8c5;
  --green: #147a42;
  --green-soft: #e8f6ee;
  --amber: #9a6a05;
  --amber-soft: #fff6d8;
  --red: #b42318;
  --red-soft: #fff0ee;
  --blue: #235ea7;
  --blue-soft: #eaf2ff;
  --gray-soft: #f1f4f8;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: linear-gradient(180deg, #ffffff 0, var(--paper) 210px);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: "Aptos", "Avenir Next", "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 15px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 44px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 4px 0 18px;
}

.topbar h1,
.section-heading h2,
.card-title-row h2,
.later-panel h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.12;
  font-family: inherit;
  font-weight: 720;
}

.topbar h1 {
  font-size: 2.32rem;
  max-width: 620px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.scope-note {
  max-width: 360px;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.checker-grid,
.results-grid,
.provider-grid {
  display: grid;
  gap: 16px;
}

.checker-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
  align-items: stretch;
}

.scan-panel,
.summary-panel,
.fix-panel,
.result-panel,
.provider-panel,
.batch-panel,
.later-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
  box-shadow: var(--shadow);
}

.scan-panel,
.summary-panel,
.fix-panel,
.result-panel,
.provider-panel,
.batch-panel,
.later-panel {
  padding: 22px;
}

.section-heading {
  margin-bottom: 16px;
}

.section-heading h2,
.later-panel h2 {
  font-size: 1.28rem;
}

.field-label {
  display: block;
  margin: 15px 0 7px;
  font-size: 0.84rem;
  font-weight: 700;
}

.domain-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

input,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--paper-strong);
  color: var(--ink);
  padding: 0 14px;
  outline: none;
}

textarea {
  min-height: 116px;
  resize: vertical;
  padding-top: 12px;
  padding-bottom: 12px;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(35, 94, 167, 0.14);
}

.field-hint {
  min-height: 20px;
  margin: 6px 0 0;
  color: var(--red);
  font-size: 0.9rem;
}

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

.selector-chip,
.secondary-action,
.retry-action,
.primary-action {
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  padding: 0 13px;
  font-weight: 700;
}

.selector-chip,
.secondary-action,
.retry-action {
  background: var(--paper-strong);
  color: var(--ink);
}

.selector-chip:hover,
.secondary-action:hover,
.retry-action:hover {
  background: var(--gray-soft);
}

.selector-chip.active {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--blue);
}

.primary-action {
  border-color: #1f4f8f;
  background: var(--blue);
  color: var(--paper-strong);
  white-space: nowrap;
}

.primary-action:hover {
  background: #1b4d89;
}

.action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.summary-panel {
  display: flex;
  flex-direction: column;
}

.readiness-meter {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 1.46rem;
  font-weight: 720;
}

.meter-dot {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid currentColor;
}

.summary-copy {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.45;
}

.status-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 760;
}

.status-ready {
  color: var(--green);
}

.status-pill.status-ready,
.readiness-meter.status-ready {
  background: var(--green-soft);
  border-color: rgba(20, 122, 66, 0.24);
}

.status-attention,
.status-warn {
  color: var(--amber);
}

.status-pill.status-attention,
.status-pill.status-warn,
.readiness-meter.status-attention,
.readiness-meter.status-warn {
  background: var(--amber-soft);
  border-color: rgba(154, 106, 5, 0.24);
}

.status-missing,
.status-problem,
.status-failed {
  color: var(--red);
}

.status-pill.status-missing,
.status-pill.status-problem,
.status-pill.status-failed,
.readiness-meter.status-missing,
.readiness-meter.status-problem,
.readiness-meter.status-failed {
  background: var(--red-soft);
  border-color: rgba(180, 35, 24, 0.22);
}

.status-not_checked,
.status-unknown,
.status-loading {
  color: #526071;
}

.status-pill.status-unknown,
.status-pill.status-not_checked,
.status-pill.status-loading,
.readiness-meter.status-unknown,
.readiness-meter.status-not_checked,
.readiness-meter.status-loading {
  background: var(--gray-soft);
  border-color: var(--line);
}

.meter-dot.status-ready {
  background: var(--green);
  border-color: var(--green);
}

.meter-dot.status-attention,
.meter-dot.status-warn {
  background: var(--amber);
  border-color: var(--amber);
}

.meter-dot.status-missing,
.meter-dot.status-problem,
.meter-dot.status-failed {
  background: var(--red);
  border-color: var(--red);
}

.meter-dot.status-unknown,
.meter-dot.status-not_checked,
.meter-dot.status-loading {
  background: #8190a3;
  border-color: #8190a3;
}

.retry-action {
  width: fit-content;
  margin-top: 16px;
}

.hidden {
  display: none;
}

.fix-panel,
.provider-panel,
.batch-panel,
.later-panel,
.results-grid {
  margin-top: 16px;
}

.fix-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.fix-list li {
  line-height: 1.45;
}

.results-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-title-row h2 {
  font-size: 1.28rem;
}

.result-panel p,
.provider-card p,
.later-panel p {
  color: var(--muted);
  line-height: 1.45;
}

.record-box {
  min-height: 58px;
  max-height: 188px;
  overflow: auto;
  margin: 14px 0 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 12px;
  color: #26313f;
  font: 0.82rem/1.5 "SFMono-Regular", "Menlo", "Consolas", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.record-note {
  margin-bottom: 0;
  font-size: 0.88rem;
}

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

.alignment-list div,
.selector-result,
.provider-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--gray-soft);
}

.alignment-list div {
  padding: 9px 10px;
}

dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

dd {
  margin: 2px 0 0;
  font-weight: 800;
}

.selector-results {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.selector-result {
  padding: 12px;
}

.selector-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.selector-result strong {
  word-break: break-word;
}

.selector-result p {
  margin: 0;
}

.provider-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.provider-card {
  padding: 16px;
}

.provider-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.provider-card ul {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding-left: 18px;
}

.provider-card li {
  line-height: 1.38;
}

.batch-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.batch-intro {
  max-width: 680px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.batch-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.batch-table-wrap {
  width: 100%;
  margin-top: 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.batch-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: var(--paper-strong);
}

.batch-table th,
.batch-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.batch-table th {
  background: var(--surface-muted);
  color: #334155;
  font-size: 0.76rem;
  font-weight: 820;
  text-transform: uppercase;
}

.batch-table td {
  line-height: 1.4;
}

.batch-table tbody tr:last-child td {
  border-bottom: 0;
}

.batch-domain {
  font-weight: 780;
  word-break: break-word;
}

.batch-fix {
  min-width: 260px;
  color: var(--muted);
}

.batch-empty-row td {
  color: var(--muted);
  text-align: center;
}

.later-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.later-panel p {
  max-width: 660px;
  margin-bottom: 0;
}

.later-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: min(360px, calc(100% - 40px));
  min-height: 40px;
  border: 1px solid #0f172a;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper-strong);
  padding: 10px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 920px) {
  .topbar,
  .batch-header,
  .later-panel {
    align-items: start;
    flex-direction: column;
  }

  .batch-header {
    display: flex;
  }

  .checker-grid,
  .results-grid,
  .provider-grid {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    min-height: 280px;
  }

  .batch-actions,
  .later-actions {
    justify-content: start;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .topbar h1 {
    font-size: 1.56rem;
  }

  .section-heading h2,
  .later-panel h2 {
    font-size: 1.08rem;
  }

  .readiness-meter {
    font-size: 1.18rem;
  }

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

  .primary-action {
    width: 100%;
  }

  .scan-panel,
  .summary-panel,
  .fix-panel,
  .result-panel,
  .provider-panel,
  .batch-panel,
  .later-panel {
    padding: 16px;
  }

  .alignment-list {
    grid-template-columns: 1fr;
  }

  .action-strip,
  .selector-chips,
  .batch-actions,
  .later-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .batch-actions .primary-action,
  .batch-actions .secondary-action {
    width: 100%;
  }
}
