:root {
  --ink: #18201d;
  --muted: #69716e;
  --line: #d7ded9;
  --panel: #ffffff;
  --panel-soft: #f6f8f4;
  --road: #26332f;
  --clay: #b85c38;
  --green: #3e7354;
  --amber: #b7791f;
  --red: #a53e36;
  --blue: #335f7f;
  --shadow: 0 18px 40px rgba(38, 51, 47, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #edf1ed;
  color: var(--ink);
}

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

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

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 32px;
  height: 100vh;
  padding: 28px;
  color: #f5f8f3;
  background:
    linear-gradient(180deg, rgba(24, 32, 29, 0.92), rgba(24, 32, 29, 0.98)),
    repeating-linear-gradient(90deg, transparent 0 38px, rgba(255, 255, 255, 0.04) 38px 39px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: var(--clay);
  font-weight: 850;
  letter-spacing: 0;
}

.brand-block h1,
.topbar h2,
.panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand-block h1 {
  font-size: 1.45rem;
}

.brand-block p,
.rail-footer,
.eyebrow {
  color: rgba(245, 248, 243, 0.72);
}

.brand-block p {
  margin: 4px 0 0;
  font-size: 0.9rem;
  line-height: 1.35;
}

.steps {
  display: grid;
  gap: 8px;
}

.step-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 9px 10px;
  color: rgba(245, 248, 243, 0.74);
  border-radius: 8px;
  text-decoration: none;
}

.step-link span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(245, 248, 243, 0.8);
  font-size: 0.76rem;
  font-weight: 800;
}

.step-link.active,
.step-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.rail-footer {
  display: grid;
  gap: 12px;
  margin-top: auto;
  font-size: 0.86rem;
}

.workspace {
  display: grid;
  gap: 22px;
  align-content: start;
  padding: 28px clamp(18px, 3vw, 44px) 42px;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  min-height: 132px;
  padding: 26px;
}

.topbar h2 {
  max-width: 720px;
  font-size: clamp(1.7rem, 3.2vw, 3.35rem);
  line-height: 1.02;
}

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

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(112px, 1fr));
  gap: 10px;
  min-width: 370px;
}

.summary-strip div,
.target-card {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

.summary-strip span,
.target-card strong {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 1.25rem;
  text-transform: none;
}

.panel {
  padding: 24px;
}

.panel[hidden] {
  display: none;
}

.intake-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid rgba(51, 95, 127, 0.28);
  border-radius: 8px;
  background: rgba(51, 95, 127, 0.08);
}

.intake-banner strong,
.intake-banner span {
  display: block;
}

.intake-banner span {
  margin-top: 3px;
  color: var(--muted);
}

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

.panel h3 {
  font-size: 1.3rem;
}

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

.onboarding-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.onboarding-step {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.onboarding-step span {
  display: block;
  margin-bottom: 8px;
  color: var(--clay);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.onboarding-step strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1rem;
}

.onboarding-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.42;
}

.wizard-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.wizard-strip div {
  min-height: 68px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.wizard-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.wizard-strip strong {
  display: block;
  margin-top: 6px;
  color: var(--amber);
  font-size: 0.95rem;
}

.wizard-strip div.complete strong {
  color: var(--green);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  color: var(--ink);
  border: 1px solid #c7d0ca;
  border-radius: 7px;
  background: #fbfcfa;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(62, 115, 84, 0.14);
}

.wide-field {
  grid-column: span 4;
}

.platform-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.guide-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  line-height: 1.45;
}

.guide-card strong {
  display: block;
  margin-bottom: 4px;
}

.basemap-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
}

.secondary-grid {
  margin-top: 18px;
}

.basemap-status {
  display: grid;
  gap: 10px;
}

.base-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  line-height: 1.45;
}

.base-card strong,
.section-label {
  display: block;
  margin-bottom: 7px;
}

.base-card span {
  color: var(--muted);
}

.base-card.stop {
  border-color: rgba(165, 62, 54, 0.34);
  background: rgba(165, 62, 54, 0.06);
}

.base-card.warn {
  border-color: rgba(183, 121, 31, 0.34);
  background: rgba(183, 121, 31, 0.08);
}

.base-card.good {
  border-color: rgba(62, 115, 84, 0.34);
  background: rgba(62, 115, 84, 0.08);
}

.section-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.worksheet-label {
  margin-top: 16px;
}

.recipe-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.recipe-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.recipe-table th,
.recipe-table td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.recipe-table th {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.recipe-table td:first-child {
  width: 22%;
  font-weight: 850;
}

.primary-button,
.ghost-button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 850;
}

.primary-button {
  color: #ffffff;
  background: var(--green);
}

.ghost-button {
  color: var(--ink);
  border-color: var(--line);
  background: #ffffff;
}

.rail .ghost-button {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  width: fit-content;
  padding: 0 11px;
  border-radius: 999px;
  background: rgba(62, 115, 84, 0.12);
  color: var(--green);
  font-weight: 850;
}

.rail .status-pill {
  color: #f5f8f3;
  background: rgba(255, 255, 255, 0.1);
}

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

.checklist label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 58px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  line-height: 1.35;
}

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

.plan-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.4fr);
  gap: 18px;
}

.target-grid,
.recommendations {
  display: grid;
  gap: 10px;
}

.target-card strong {
  font-size: 1.35rem;
}

.recommendation {
  padding: 14px;
  border-left: 5px solid var(--green);
  border-radius: 8px;
  background: var(--panel-soft);
  line-height: 1.45;
}

.recommendation.warning {
  border-color: var(--amber);
}

.recommendation.blocker {
  border-color: var(--red);
}

.recommendation strong {
  display: block;
  margin-bottom: 4px;
}

.workflow-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.workflow-board.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0;
}

.workflow-step {
  min-height: 126px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.workflow-step strong {
  display: block;
  margin-bottom: 7px;
}

.workflow-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.42;
}

.workflow-step.locked {
  border-color: rgba(165, 62, 54, 0.28);
  background: rgba(165, 62, 54, 0.05);
}

.workflow-step.ready {
  border-color: rgba(62, 115, 84, 0.32);
  background: rgba(62, 115, 84, 0.07);
}

.log-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 18px;
}

.chart-card,
.log-summary,
.analysis-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.chart-card {
  min-height: 320px;
  padding: 14px;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
}

.log-summary {
  padding: 16px;
}

.empty-state {
  display: grid;
  place-content: center;
  min-height: 260px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.file-button {
  position: relative;
  color: #ffffff;
  background: var(--blue);
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.analysis-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
}

.analysis-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

.analysis-table th,
.analysis-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.analysis-table th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.journal-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.journal-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.journal-entry {
  display: grid;
  grid-template-columns: minmax(130px, 0.25fr) minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.journal-entry time {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.journal-entry p {
  margin: 3px 0;
  line-height: 1.38;
}

.package-box {
  min-height: 330px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.86rem;
  line-height: 1.48;
}

.shared-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.75fr) minmax(0, 1.25fr);
  gap: 18px;
}

.shared-create,
.share-link-box,
.intake-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.share-link-box {
  margin-top: 6px;
  background: #ffffff;
}

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

.intake-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.intake-card h4 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.intake-card p {
  margin: 2px 0;
  color: var(--muted);
  font-size: 0.88rem;
}

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

.metric {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.metric span:first-child {
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(62, 115, 84, 0.12);
  color: var(--green);
  font-weight: 850;
}

.badge.warn {
  background: rgba(183, 121, 31, 0.14);
  color: var(--amber);
}

.badge.stop {
  background: rgba(165, 62, 54, 0.12);
  color: var(--red);
}

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

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

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

  .rail-footer {
    display: none;
  }

  .topbar,
  .plan-layout,
  .log-grid,
  .basemap-grid,
  .platform-guide,
  .journal-form,
  .shared-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .summary-strip {
    min-width: 0;
  }

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

  .onboarding-flow {
    grid-template-columns: 1fr;
  }

  .wizard-strip,
  .workflow-board,
  .workflow-board.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wide-field {
    grid-column: span 2;
  }
}

@media (max-width: 680px) {
  .rail,
  .workspace,
  .panel,
  .topbar {
    padding: 18px;
  }

  .steps,
  .summary-strip,
  .form-grid,
  .checklist,
  .onboarding-flow,
  .wizard-strip,
  .workflow-board,
  .workflow-board.compact {
    grid-template-columns: 1fr;
  }

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

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .intake-banner,
  .intake-card {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .primary-button,
  .ghost-button,
  .file-button {
    width: 100%;
  }
}
