:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #202124;
  --muted: #6b665d;
  --line: #ddd7c8;
  --nav: #16302b;
  --nav-soft: #24433d;
  --accent: #d56f3e;
  --accent-2: #2f6f8f;
  --ok: #3b7f5b;
  --warn: #b36b1f;
  --danger: #b44848;
  --shadow: 0 18px 45px rgba(39, 35, 27, 0.12);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: 0;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--nav);
  color: #f8f3e7;
  padding: 22px 18px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
}

.brand h1,
.workspace h2,
.inspector h3 {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.15;
}

.eyebrow {
  margin: 0 0 4px;
  color: inherit;
  opacity: 0.72;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.project-switcher {
  margin-bottom: 18px;
}

label {
  display: block;
  margin-bottom: 7px;
  color: inherit;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  outline: none;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 126px;
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(47, 111, 143, 0.14);
}

.project-switcher input {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.project-switcher input::placeholder {
  color: rgba(255, 255, 255, 0.58);
}

.section-nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.nav-button:hover,
.nav-button.active {
  background: var(--nav-soft);
  border-color: rgba(255, 255, 255, 0.12);
}

.nav-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  font-weight: 800;
}

.nav-title {
  display: block;
  font-weight: 800;
}

.nav-meta {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.nav-percent {
  font-size: 12px;
  font-weight: 800;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar,
.summary-band,
.content-grid {
  max-width: 1360px;
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.workspace h2 {
  font-size: 30px;
  line-height: 1.1;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 13px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.icon-button.ghost {
  border-color: var(--line);
  background: var(--surface-strong);
  color: var(--ink);
}

.text-button {
  width: 100%;
  border-color: rgba(180, 72, 72, 0.22);
  background: #fff6f3;
  color: var(--danger);
}

.summary-band {
  display: grid;
  grid-template-columns: max-content 1fr max-content;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-item {
  display: grid;
  gap: 2px;
}

.summary-item.right {
  text-align: right;
}

.summary-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-item strong {
  font-size: 24px;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8e2d4;
}

.progress-track.small {
  height: 8px;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--ok), var(--accent));
  transition: width 180ms ease;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.form-panel,
.inspector {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-panel {
  padding: 22px;
}

.section-intro {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.section-description {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.status-badge {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status-badge.pass {
  border-color: rgba(59, 127, 91, 0.28);
  background: #eef8f1;
  color: var(--ok);
}

.status-badge.needs-fix {
  border-color: rgba(179, 107, 31, 0.28);
  background: #fff7e8;
  color: var(--warn);
}

.form-fields {
  display: grid;
  gap: 18px;
  padding-top: 18px;
}

.field-block {
  display: grid;
  gap: 8px;
}

.field-help {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.inspector {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 0;
  overflow: hidden;
}

.inspector-section {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.inspector-section:last-child {
  border-bottom: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h3 {
  font-size: 15px;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

#stageStatus {
  margin-top: 12px;
}

.checklist {
  display: grid;
  gap: 10px;
}

.check-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.check-item input {
  width: 18px;
  min-height: 18px;
  margin-top: 1px;
  accent-color: var(--ok);
}

.danger-zone p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  transform: translateY(18px);
  opacity: 0;
  max-width: min(420px, calc(100vw - 40px));
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

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

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

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

  .inspector {
    position: static;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 16px;
  }

  .topbar,
  .section-intro,
  .summary-band {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .section-nav {
    grid-template-columns: 1fr;
  }

  .summary-item.right {
    text-align: left;
  }

  .workspace h2 {
    font-size: 24px;
  }
}
