:root {
  color-scheme: light;
  --bg: #edf3ef;
  --paper: #ffffff;
  --paper-soft: #f8faf8;
  --ink: #17211d;
  --muted: #64736c;
  --line: #d3ddd6;
  --line-strong: #a9b9ae;
  --green: #2f7d61;
  --green-dark: #1e5945;
  --amber: #b98523;
  --blue: #426a94;
  --red: #b85a4c;
  --shadow: 0 18px 50px rgb(23 33 29 / 0.08);
  --shadow-soft: 0 12px 30px rgb(23 33 29 / 0.06);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.76), transparent 24rem),
    linear-gradient(90deg, rgb(66 106 148 / 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgb(66 106 148 / 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 4.5rem 4.5rem, 4.5rem 4.5rem, auto;
}

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

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 30;
  transform: translateY(-140%);
  background: var(--ink);
  color: white;
  padding: 0.7rem 0.9rem;
  border-radius: 6px;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
  padding: 0 1.35rem;
  background: rgb(248 250 248 / 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand,
.app-nav {
  display: inline-flex;
  align-items: center;
}

.brand {
  gap: 0.7rem;
  text-decoration: none;
  font-weight: 800;
}

.brand-mark {
  position: relative;
  width: 1.85rem;
  height: 1.85rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--paper) 0 0.3rem, transparent 0.32rem),
    conic-gradient(from 230deg, var(--green) 0 33%, var(--amber) 33% 58%, var(--blue) 58% 82%, transparent 82% 100%);
}

.brand-mark span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.7rem;
  height: 2px;
  background: var(--ink);
  transform: translateY(-50%) rotate(-35deg);
  transform-origin: left center;
}

.app-nav {
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.app-nav::-webkit-scrollbar {
  display: none;
}

.app-nav a {
  flex: 0 0 auto;
  padding: 0.56rem 0.82rem;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 750;
}

.app-nav a:hover,
.app-nav a:focus-visible {
  color: var(--ink);
  background: rgb(23 33 29 / 0.07);
}

.planner-app {
  padding: 0 1.35rem 4rem;
}

.planner-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(18rem, 0.62fr);
  gap: 2rem;
  align-items: end;
  max-width: 94rem;
  margin: 0 auto;
  padding: 1.5rem 0 1rem;
}

.planner-intro h1,
.panel-heading h2,
.export-heading h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.04;
}

.planner-intro h1 {
  max-width: 34ch;
  font-size: 3rem;
  font-weight: 850;
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.planner-intro-note {
  color: var(--muted);
  line-height: 1.55;
  font-size: 1rem;
}

.planner-intro-note p {
  margin: 0 0 0.9rem;
}

.planner-intro-note a {
  display: inline-flex;
  align-items: center;
  min-height: 2.35rem;
  padding: 0 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 750;
}

.planner-shell {
  display: grid;
  grid-template-columns: minmax(16rem, 0.7fr) minmax(26rem, 1.36fr) minmax(22rem, 0.86fr);
  gap: 1rem;
  align-items: start;
  max-width: 94rem;
  margin: 0 auto;
}

.step-rail,
.form-panel,
.brief-panel,
.export-panel {
  min-width: 0;
}

.step-rail,
.form-panel,
.brief-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.step-rail {
  position: sticky;
  top: 5rem;
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.preset-control {
  display: grid;
  gap: 0.55rem;
}

.preset-control label,
.brief-status span,
.field span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.preset-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
}

.preset-row select,
.preset-row button,
.reset-button,
.preview-heading button,
.export-actions button {
  min-height: 2.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--paper-soft);
  font-weight: 800;
}

.preset-row select {
  width: 100%;
  padding: 0 0.7rem;
}

.preset-row button,
.reset-button,
.preview-heading button,
.export-actions button {
  padding: 0 0.85rem;
}

.step-list {
  display: grid;
  gap: 0.55rem;
}

.step-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 0.15rem 0.7rem;
  width: 100%;
  padding: 0.8rem;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
}

.step-button span {
  grid-row: 1 / 3;
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgb(47 125 97 / 0.12);
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 850;
}

.step-button strong,
.step-button small {
  min-width: 0;
}

.step-button strong {
  font-size: 0.98rem;
}

.step-button small {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.step-button:hover,
.step-button:focus-visible,
.step-button.is-active {
  border-color: var(--line-strong);
  background: var(--paper-soft);
}

.step-button.is-active span {
  background: var(--green);
  color: white;
}

.reset-button {
  color: var(--red);
  background: rgb(184 90 76 / 0.07);
}

.form-panel {
  padding: 1.05rem;
}

.step-panel {
  animation: panel-in 180ms ease both;
}

.panel-heading {
  display: grid;
  gap: 0.25rem;
  padding: 0.15rem 0 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}

.panel-heading h2,
.export-heading h2 {
  font-size: 1.55rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.field {
  display: grid;
  gap: 0.48rem;
}

.field-wide {
  grid-column: 1 / -1;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
  padding: 0.72rem 0.78rem;
  line-height: 1.45;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.field textarea {
  min-height: 7.2rem;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--green);
  background: white;
  box-shadow: 0 0 0 3px rgb(47 125 97 / 0.14);
}

.brief-panel {
  position: sticky;
  top: 5rem;
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.brief-status {
  display: grid;
  gap: 0.65rem;
}

.brief-status > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.brief-status strong {
  font-size: 1.7rem;
}

.completion-track {
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgb(23 33 29 / 0.1);
}

.completion-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--amber));
  transition: width 180ms ease;
}

.ring-map {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 12% 20%, rgb(47 125 97 / 0.12), transparent 32%),
    radial-gradient(circle at 90% 8%, rgb(185 133 35 / 0.13), transparent 26%),
    var(--paper-soft);
  overflow: hidden;
}

.ring-map svg {
  display: block;
  width: 100%;
  height: auto;
}

.ring-path {
  fill: none;
  stroke: rgb(23 33 29 / 0.24);
  stroke-width: 4;
  stroke-linecap: round;
}

.ring-node circle {
  fill: var(--paper);
  stroke: var(--line-strong);
  stroke-width: 3;
}

.ring-node text {
  text-anchor: middle;
  font-weight: 850;
  font-size: 0.95rem;
  fill: var(--muted);
}

.ring-node.is-filled circle {
  fill: var(--green);
  stroke: var(--green-dark);
}

.ring-node.is-filled text {
  fill: white;
}

.brief-preview {
  display: grid;
  gap: 0.7rem;
}

.preview-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.preview-heading .eyebrow {
  margin: 0;
}

.preview-heading button,
.export-actions button,
.preset-row button {
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.preview-heading button:hover,
.preview-heading button:focus-visible,
.export-actions button:hover,
.export-actions button:focus-visible,
.preset-row button:hover,
.preset-row button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--ink);
  background: white;
}

.brief-preview pre {
  max-height: 34rem;
  overflow: auto;
  margin: 0;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101715;
  color: #eef7f0;
  font: 0.86rem/1.58 "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.export-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  max-width: 94rem;
  margin: 1rem auto 0;
  padding: 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.export-heading {
  min-width: 0;
}

.export-heading .eyebrow {
  margin-bottom: 0.35rem;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
}

.export-actions button:first-child {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  max-width: min(26rem, calc(100vw - 2rem));
  margin: 0;
  padding: 0.8rem 0.95rem;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(0.5rem);
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
}

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

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(0.35rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .planner-shell {
    grid-template-columns: minmax(14rem, 0.55fr) minmax(24rem, 1.2fr);
  }

  .brief-panel {
    position: static;
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .app-bar {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.75rem 1rem;
  }

  .planner-app {
    padding-inline: 1rem;
  }

  .planner-intro,
  .planner-shell,
  .export-panel {
    grid-template-columns: 1fr;
  }

  .planner-intro h1 {
    font-size: 2.25rem;
  }

  .step-rail {
    position: static;
  }

  .step-list {
    grid-template-columns: repeat(5, minmax(10rem, 1fr));
    overflow-x: auto;
    padding-bottom: 0.2rem;
    scrollbar-width: thin;
  }

  .step-button {
    min-width: 10rem;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .export-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .planner-intro h1 {
    font-size: 2rem;
  }

  .panel-heading h2,
  .export-heading h2 {
    font-size: 1.32rem;
  }

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

  .export-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .export-actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
