:root {
  --bg: #f4f7f2;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d8e0d4;
  --accent: #126b57;
  --accent-dark: #0b4b3e;
  --warn: #a65f00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef4ec;
}

.login-shell {
  width: min(420px, 100%);
}

.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 18px 50px rgba(31, 41, 51, 0.12);
}

.login-brand {
  margin-bottom: 24px;
}

.login-form button {
  width: 100%;
}

.login-error {
  min-height: 20px;
  margin-top: 12px;
  color: #a32929;
  font-size: 13px;
}

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

.sidebar {
  padding: 20px;
  border-right: 1px solid var(--line);
  background: #eef4ec;
}

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

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

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

.brand p,
.eyebrow,
.panel label,
.status-strip span {
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.panel h2 {
  font-size: 15px;
  margin-bottom: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  font: inherit;
  color: var(--ink);
  background: #fbfdf9;
}

textarea {
  resize: vertical;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toggle-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.toggle-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}

.toggle-row input {
  width: auto;
}

button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #f7faf5;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

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

.topbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.topbar h2 {
  font-size: 28px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 6px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 12px;
  width: min(680px, 100%);
}

.status-strip div {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

.status-strip span,
.status-strip strong {
  display: block;
}

.status-strip strong {
  font-size: 14px;
  margin-top: 4px;
}

.quick-start {
  background: #e7f4ef;
  border: 1px solid #b8d8cb;
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.quick-start h2 {
  font-size: 22px;
  color: var(--accent-dark);
}

.quick-start p:last-child {
  font-size: 14px;
  line-height: 1.5;
}

.data-source-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.data-source-panel h2 {
  font-size: 20px;
}

.data-source-panel p:last-child {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

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

.metric-card,
.action-panel,
.allocation-panel,
.capital-panel,
.lab-panel,
.journal-panel,
.readiness-panel,
.checklist-panel,
.target-plan-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-card {
  min-height: 118px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  gap: 8px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card span {
  font-size: 12px;
  font-weight: 800;
}

.metric-card strong {
  font-size: 24px;
  line-height: 1.1;
}

.metric-card small {
  font-size: 12px;
  line-height: 1.35;
}

.action-panel {
  padding: 16px 18px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.action-panel h2 {
  font-size: 20px;
}

.action-panel ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

.allocation-panel {
  margin-bottom: 18px;
  overflow: hidden;
}

.allocation-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.allocation-head h2 {
  font-size: 20px;
}

.allocation-head span {
  color: var(--accent-dark);
  background: #e7f4ef;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.allocation-table {
  display: grid;
}

.allocation-row {
  display: grid;
  grid-template-columns: 1.2fr 0.7fr repeat(3, minmax(82px, 0.8fr)) 1.15fr 0.9fr;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  font-size: 13px;
}

.allocation-row:last-child {
  border-bottom: none;
}

.allocation-header {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #fbfdf9;
}

.allocation-row.muted {
  color: var(--muted);
  grid-template-columns: 1fr;
}

.checklist-panel {
  margin-bottom: 18px;
  overflow: hidden;
}

.checklist-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.checklist-head h2 {
  font-size: 20px;
}

.checklist-items {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.checklist-item {
  min-height: 108px;
  padding: 14px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  border-right: 1px solid var(--line);
  border-top: 4px solid var(--muted);
}

.checklist-item:last-child {
  border-right: none;
}

.checklist-item.pass {
  border-top-color: var(--accent);
}

.checklist-item.warn {
  border-top-color: var(--warn);
}

.checklist-item.block {
  border-top-color: #a32929;
}

.checklist-item strong {
  font-size: 13px;
}

.checklist-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.capital-panel {
  margin-bottom: 18px;
  overflow: hidden;
}

.capital-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.capital-head h2 {
  font-size: 20px;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.scenario-row {
  min-height: 108px;
  padding: 16px;
  border-right: 1px solid var(--line);
  display: grid;
  align-content: space-between;
  gap: 8px;
}

.scenario-row:last-child {
  border-right: none;
}

.scenario-row span,
.scenario-row small {
  color: var(--muted);
  font-size: 12px;
}

.scenario-row strong {
  font-size: 22px;
}

.lab-panel {
  margin-bottom: 18px;
  overflow: hidden;
}

.lab-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lab-head h2 {
  font-size: 20px;
}

.lab-head span {
  color: var(--accent-dark);
  background: #e7f4ef;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.lab-table {
  display: grid;
}

.lab-row {
  display: grid;
  grid-template-columns: 1.35fr repeat(5, minmax(96px, 1fr));
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  font-size: 13px;
}

.lab-row:last-child {
  border-bottom: none;
}

.lab-header {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #fbfdf9;
}

.lab-row.muted {
  color: var(--muted);
  grid-template-columns: 1fr;
}

.journal-panel {
  margin-bottom: 18px;
  overflow: hidden;
}

.readiness-panel {
  margin-bottom: 18px;
  overflow: hidden;
}

.target-plan-panel {
  margin-bottom: 18px;
  overflow: hidden;
}

.target-plan-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.target-plan-head h2 {
  font-size: 20px;
}

.target-plan-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.target-plan-grid div {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.target-plan-grid div:last-child {
  border-right: none;
}

.target-plan-grid span {
  color: var(--muted);
  font-size: 12px;
}

.target-plan-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.target-plan-actions {
  margin: 0;
  padding: 14px 18px 14px 34px;
  font-size: 13px;
  line-height: 1.55;
}

.readiness-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.readiness-head h2 {
  font-size: 20px;
}

.readiness-head span {
  color: white;
  background: var(--accent);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.readiness-body {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}

.readiness-body > div {
  padding: 16px;
  border-right: 1px solid var(--line);
}

.readiness-body > div:last-child {
  border-right: none;
}

.readiness-body span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.readiness-body strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.readiness-body ul {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
}

.journal-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.journal-head h2 {
  font-size: 20px;
}

.journal-head span {
  color: var(--accent-dark);
  background: #e7f4ef;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.journal-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.journal-metrics div {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.journal-metrics div:last-child {
  border-right: none;
}

.journal-metrics span,
.equity-curve span {
  color: var(--muted);
  font-size: 12px;
}

.journal-metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.equity-curve {
  height: 180px;
  padding: 16px;
  display: flex;
  align-items: end;
  gap: 8px;
}

.curve-bar {
  flex: 1;
  min-width: 18px;
  border-radius: 6px 6px 0 0;
  background: var(--accent);
  position: relative;
}

.curve-bar span {
  position: absolute;
  left: 50%;
  bottom: -20px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.report-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: calc(100vh - 150px);
  overflow: hidden;
}

.report-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.report-head h2 {
  font-size: 20px;
}

.state-pill {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  background: #e7f4ef;
  color: var(--accent-dark);
}

.state-pill.error {
  background: #fff4e5;
  color: var(--warn);
}

pre {
  margin: 0;
  padding: 18px;
  white-space: pre-wrap;
  word-break: break-word;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .topbar,
  .quick-start,
  .data-source-panel,
  .status-strip,
  .dashboard-panel,
  .action-panel,
  .checklist-items,
  .scenario-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .checklist-item {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .scenario-row {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .lab-head,
  .lab-row,
  .journal-head,
  .journal-metrics,
  .readiness-head,
  .readiness-body,
  .target-plan-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .journal-metrics div,
  .readiness-body > div,
  .target-plan-grid div {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}
