:root {
  --bg: #f5f2eb;
  --ink: #1e2a33;
  --muted: #5e6a73;
  --surface: #ffffff;
  --surface-soft: #f8f7f3;
  --line: #d7d9d4;
  --brand: #0a7a67;
  --brand-soft: #d6f1ec;
  --accent: #f4c66d;
  --danger: #b4493f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 10%, #e8ede3, transparent 35%),
    radial-gradient(circle at 80% 10%, #f8e6cf, transparent 33%),
    var(--bg);
}

.bg-layer {
  position: fixed;
  inset: 0;
  background: linear-gradient(130deg, rgba(10, 122, 103, 0.08), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.app-shell {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.app-header {
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
}

.subhead {
  margin: 6px 0 0;
  color: var(--muted);
}

.status-panel,
.view-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(30, 42, 51, 0.05);
}

.status-panel {
  padding: 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.tech-settings {
  min-width: 260px;
  color: var(--muted);
}

.tech-settings summary {
  cursor: pointer;
  font-weight: 600;
}

.tech-settings label {
  display: block;
  margin-top: 8px;
}

.tech-settings input {
  margin-top: 6px;
}

.view-panel {
  padding: 18px;
}

.step-shell {
  display: grid;
  gap: 14px;
}

.step-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.step-title {
  margin: 0;
  font-size: 1.28rem;
}

.step-copy {
  margin: 8px 0 0;
  color: var(--muted);
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--ink);
}

button {
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  padding: 10px 14px;
}

button:hover {
  opacity: 0.92;
}

button.secondary {
  background: #dde6df;
  color: #2c4036;
}

button.ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--brand);
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.progress-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: #dbe4dc;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2ea889, #0a7a67);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--brand-soft);
  color: #0d5f52;
}

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

.rubric-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-soft);
}

.rubric-card.selected {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.rubric-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.rubric-range {
  margin: 0;
  font-weight: 700;
}

.rubric-copy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.score-btn {
  min-width: 72px;
}

.score-btn.active {
  background: #0d5f52;
}

.current-choice {
  color: var(--muted);
  font-size: 0.9rem;
}

.review-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
}

.review-head {
  margin: 0;
  padding: 10px 12px;
  background: #f1f5ef;
  font-size: 1rem;
}

.review-item {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line);
}

.review-score {
  font-weight: 700;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 10px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.84rem;
}

.stat-value {
  font-size: 1.28rem;
  font-weight: 700;
}

.behaviour-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.behaviour-row {
  display: grid;
  grid-template-columns: 230px 1fr 42px;
  gap: 8px;
  align-items: center;
}

.track {
  background: #dbe4dc;
  border-radius: 999px;
  height: 10px;
}

.fill {
  background: linear-gradient(90deg, #2ea889, #0a7a67);
  height: 100%;
  border-radius: 999px;
}

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

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

.app-footer {
  margin-top: 10px;
  text-align: right;
}

.app-footer a {
  color: var(--brand);
  font-size: 0.9rem;
}

.admin-shell {
  display: grid;
  gap: 12px;
}

.admin-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 12px;
}

.admin-section h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

textarea.mono {
  min-height: 260px;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
}

@media (max-width: 860px) {
  .grid-2,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .review-item {
    grid-template-columns: 1fr;
  }

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

  .status-panel {
    flex-direction: column;
  }

  .tech-settings {
    width: 100%;
  }
}
