:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --card: #ffffff;
  --border: #e1e3e8;
  --text: #21232c;
  --muted: #6a6f7f;
  --primary: #017737;
  --primary-hover: #015f2c;
  --success: #017737;
  --danger: #c4232e;
  --focus: #317ae2;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1c22;
  --card: #24262e;
  --border: #3a3d47;
  --text: #e9eaee;
  --muted: #a3a6b2;
  --primary: #2ea05f;
  --primary-hover: #3bb46e;
  --success: #3bb46e;
  --danger: #f2777f;
  --focus: #6aa5ff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p {
  margin: 0;
}

.page {
  max-width: 800px;
  padding: 24px;
}

.page-header {
  margin-bottom: 16px;
}

h1 {
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
  margin-bottom: 4px;
}

h2 {
  font-size: 14px;
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

.notice {
  margin-bottom: 8px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
}

.row + .row {
  margin-top: 8px;
}

.row-text {
  flex: 1 1 240px;
  min-width: 0;
}

.status:not(:empty) {
  margin-top: 4px;
}

.status[data-tone="success"] {
  color: var(--success);
}

.status[data-tone="error"] {
  color: var(--danger);
}

.button {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 16px;
  border: 0;
  border-radius: 4px;
  background: var(--primary);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.button:hover:not(:disabled) {
  background: var(--primary-hover);
}

.button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button[aria-busy="true"] {
  cursor: progress;
}

.spinner {
  display: none;
  width: 12px;
  height: 12px;
  border: 2px solid rgb(255 255 255 / 40%);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.button[aria-busy="true"] .spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2s;
  }
}
