:root {
  --bg: #eff5eb;
  --panel: rgba(255, 255, 255, 0.9);
  --ink: #182218;
  --muted: #506250;
  --line-green: #00b900;
  --line-green-deep: #07823f;
  --line-green-soft: rgba(6, 199, 85, 0.14);
  --accent-blue: #1472ff;
  --accent-red: #d3354b;
  --accent-gold: #c59c1b;
  --border: rgba(17, 54, 22, 0.12);
  --shadow: 0 18px 50px rgba(8, 46, 18, 0.12);
  --radius: 28px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09110b;
    --panel: rgba(12, 24, 14, 0.92);
    --ink: #f3f7f0;
    --muted: #9db09e;
    --line-green: #06c755;
    --line-green-deep: #43de85;
    --line-green-soft: rgba(6, 199, 85, 0.18);
    --border: rgba(151, 206, 160, 0.12);
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(6, 199, 85, 0.18), transparent 35%),
    linear-gradient(160deg, var(--bg), color-mix(in srgb, var(--bg) 74%, #ffffff 26%));
}

a {
  color: inherit;
}

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

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

.shell--centered {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.panel {
  width: 100%;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel--hero {
  text-align: left;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--line-green-deep);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.title {
  margin: 0 0 14px;
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  line-height: 1.05;
}

.body-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

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

.page-header__eyebrow {
  margin: 0 0 10px;
  color: var(--line-green-deep);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-header__title {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  line-height: 1.1;
}

.page-header__description {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.form-shell {
  display: grid;
  gap: 18px;
}

.field-group {
  display: grid;
  gap: 10px;
}

.field-group__label {
  font-weight: 700;
}

.field-control,
.field-textarea,
.field-select,
.action-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: inherit;
}

.field-control,
.field-select {
  padding: 0 16px;
}

.field-textarea {
  min-height: 148px;
  padding: 14px 16px;
  resize: vertical;
}

.field-hint,
.field-error,
.subtle-copy {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

.field-hint,
.subtle-copy {
  color: var(--muted);
}

.field-error {
  color: var(--accent-red);
}

.form-error-banner {
  display: none;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(211, 53, 75, 0.12);
  color: var(--accent-red);
  font-weight: 700;
}

.form-error-banner.is-visible {
  display: block;
}

.is-hidden {
  display: none !important;
}

.field-grid {
  display: grid;
  gap: 14px;
}

.choice-grid {
  display: grid;
  gap: 10px;
}

.choice-grid--stack {
  grid-template-columns: 1fr;
}

.choice-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.choice-card input {
  width: 20px;
  height: 20px;
  margin: 0;
}

.action-row {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.action-row--inline {
  grid-template-columns: minmax(0, 220px);
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 18px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  transition: transform 120ms ease, opacity 120ms ease, background-color 120ms ease;
}

.action-button:active {
  transform: translateY(1px);
}

.action-button--primary {
  background: linear-gradient(135deg, var(--line-green), var(--line-green-deep));
  color: #f8fff9;
  box-shadow: 0 14px 28px rgba(6, 199, 85, 0.18);
}

.action-button--secondary {
  background: transparent;
  border: 1px solid var(--border);
}

.status-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(155deg, var(--line-green-soft), rgba(255, 255, 255, 0.32));
}

.status-card__title {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.status-card__body {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.dashboard-grid {
  display: grid;
  gap: 16px;
}

.dashboard-section {
  display: grid;
  gap: 12px;
}

.dashboard-section__title {
  margin: 0;
  font-size: 1.05rem;
}

.dashboard-list {
  display: grid;
  gap: 10px;
}

.dashboard-link-card,
.metric-card {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  color: inherit;
  text-align: left;
}

.dashboard-link-card {
  display: grid;
  gap: 6px;
  cursor: pointer;
}

.dashboard-link-card--warn {
  border-color: rgba(197, 156, 27, 0.3);
  background: rgba(197, 156, 27, 0.12);
}

.dashboard-link-card__meta,
.metric-card__note {
  color: var(--muted);
  font-size: 0.95rem;
}

.metric-card {
  background: linear-gradient(135deg, rgba(6, 199, 85, 0.16), rgba(20, 114, 255, 0.08));
}

.metric-card__value {
  display: block;
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  line-height: 1.1;
}

.search-result {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.search-result__title,
.search-sources__title {
  margin: 0;
}

.search-answer,
.search-sources {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
}

.search-answer__body {
  margin: 0;
  line-height: 1.7;
}

.search-sources__list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.search-sources__link {
  color: var(--accent-blue);
  text-decoration: none;
}

.check-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.check-card input {
  width: 20px;
  height: 20px;
  margin: 0;
}

.spinner-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  gap: 14px;
  background: rgba(8, 16, 10, 0.35);
  backdrop-filter: blur(10px);
}

.spinner {
  width: 52px;
  height: 52px;
  border: 4px solid rgba(255, 255, 255, 0.22);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.spinner-label {
  margin: 0;
  color: #ffffff;
  font-weight: 700;
}

.toast-stack {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 20px;
  z-index: 1100;
  display: grid;
  gap: 10px;
}

.toast {
  padding: 14px 16px;
  border-radius: 18px;
  color: #ffffff;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.toast--info {
  background: var(--accent-blue);
}

.toast--success {
  background: var(--line-green-deep);
}

.toast--error {
  background: var(--accent-red);
}

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

@media (min-width: 720px) {
  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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