:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #edf1ef;
  color: #121b1d;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(237, 241, 239, 0.96)),
    #edf1ef;
}

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

button {
  border: 0;
  cursor: pointer;
}

.shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 26px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  border-bottom: 1px solid #d4dedb;
  padding-bottom: 20px;
}

.eyebrow {
  margin: 0 0 7px;
  color: #28695e;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 7px;
  font-size: 36px;
  line-height: 1.12;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.25;
}

h3 {
  color: #0f1719;
}

h4 {
  margin-bottom: 10px;
  color: #263335;
  font-size: 14px;
}

.subtitle {
  margin-bottom: 0;
  color: #607073;
  font-size: 15px;
}

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

.top-actions span,
.confidence,
.panel-title span {
  border-radius: 999px;
  background: #e4efec;
  color: #276257;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.app-grid {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
  padding-top: 20px;
}

.flow-panel,
.config-card,
.optimization-card,
.plan,
.report {
  border: 1px solid #d8e1de;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 34px rgba(22, 38, 41, 0.06);
}

.flow-panel {
  position: sticky;
  top: 20px;
  align-self: stretch;
  padding: 16px;
}

.panel-title,
.config-bar,
.section-title,
.report-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.workflow-steps {
  display: grid;
  gap: 12px;
  margin: 18px 0;
  padding: 0;
  list-style: none;
}

.workflow-steps li {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border-radius: 7px;
  cursor: pointer;
  padding-left: 13px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.workflow-steps li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: calc(100% - 12px);
  max-height: 44px;
  border-radius: 999px;
  background: #dce5e2;
  transform: translateY(-50%);
}

.workflow-steps li:hover {
  background: #f4f8f7;
}

.workflow-steps li:focus-visible {
  outline: 3px solid rgba(29, 89, 83, 0.16);
  outline-offset: 2px;
}

.workflow-steps li > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #eef4f2;
  color: #5d6f72;
  font-size: 13px;
  font-weight: 850;
}

.workflow-steps strong {
  display: block;
  color: #192426;
  font-size: 14px;
}

.workflow-steps p {
  margin: 3px 0 0;
  color: #6a777a;
  font-size: 12px;
  line-height: 1.45;
}

.workflow-steps li.is-active {
  background: #f4f8f7;
}

.workflow-steps li.is-active::before {
  background: #1d5953;
}

.workflow-steps li.is-active > span {
  background: #1d5953;
  color: #ffffff;
}

.workflow-steps li.is-complete > span {
  background: #dcebe7;
  color: #1d5953;
}

.side-summary {
  border-top: 1px solid #e2e9e7;
  padding-top: 15px;
}

.summary-list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.summary-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #edf2f1;
  padding-bottom: 8px;
}

.summary-list span {
  color: #6e7a7d;
  font-size: 12px;
}

.summary-list strong {
  color: #1d2a2d;
  font-size: 13px;
  text-align: right;
}

.stage {
  display: grid;
  gap: 16px;
}

.config-card {
  overflow: hidden;
}

.config-bar {
  padding: 16px;
}

.summary-chips {
  display: flex;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}

.summary-chips span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border: 1px solid #d8e4e1;
  border-radius: 999px;
  background: #f6f9f8;
  color: #2e3d40;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 720;
}

.summary-chips b {
  color: #6f7d80;
  font-weight: 760;
}

.config-actions {
  display: flex;
  gap: 9px;
  align-items: center;
}

.config-fields {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  border-top: 1px solid #e1e8e6;
  padding: 16px;
  background: #fbfcfc;
}

.applied-optimization {
  border-top: 1px solid #f0d3bd;
  background: #fff8f1;
  padding: 14px 16px;
}

.applied-optimization > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.applied-optimization h3 {
  margin: 0;
  color: #8f3f0b;
  font-size: 15px;
}

.applied-optimization p:last-child {
  margin: 0;
  color: #5f4b3e;
  line-height: 1.65;
  font-size: 13px;
}

.config-fields label:nth-last-child(-n + 2) {
  grid-column: span 5;
}

.template-strip {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 14px;
  border-top: 1px solid #e1e8e6;
  padding: 16px;
  background: #f8fbfa;
}

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

.template-list button {
  border: 1px solid #d4e0dc;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  text-align: left;
}

.template-list button:hover {
  border-color: #93bdb5;
  background: #f1f7f5;
}

.template-list strong {
  display: block;
  color: #172426;
  font-size: 14px;
  line-height: 1.35;
}

.template-list span {
  display: block;
  margin-top: 6px;
  color: #657376;
  font-size: 12px;
  line-height: 1.45;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 0;
  color: #3d494c;
  font-size: 13px;
  font-weight: 730;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid #cbd8d5;
  border-radius: 7px;
  padding: 10px 11px;
  background: #ffffff;
  color: #162022;
  outline: none;
}

select:focus,
input:focus,
textarea:focus {
  border-color: #2f7b6d;
  box-shadow: 0 0 0 3px rgba(47, 123, 109, 0.14);
}

textarea {
  min-height: 76px;
  resize: vertical;
}

button[type="submit"],
.orange-action,
.secondary-action,
.ghost-action,
.toggle-details {
  border-radius: 7px;
  font-weight: 820;
  white-space: nowrap;
}

button[type="submit"] {
  padding: 10px 13px;
  background: #173f43;
  color: #ffffff;
}

button[type="submit"]:hover {
  background: #102f32;
}

.orange-action,
button[type="submit"].orange-action {
  border: 1px solid #c8631b;
  background: #c8631b;
  color: #ffffff;
  padding: 10px 13px;
  box-shadow: 0 8px 18px rgba(200, 99, 27, 0.16);
}

.orange-action:disabled,
button[type="submit"].orange-action:disabled {
  border-color: #d5cbc4;
  background: #d8cec7;
  color: #766b65;
  box-shadow: none;
  cursor: not-allowed;
}

.orange-action:hover,
button[type="submit"].orange-action:hover {
  background: #a94f12;
  border-color: #a94f12;
}

.orange-action:disabled:hover,
button[type="submit"].orange-action:disabled:hover {
  border-color: #d5cbc4;
  background: #d8cec7;
}

.secondary-action,
.ghost-action,
.toggle-details {
  border: 1px solid #c5d2cf;
  background: #ffffff;
  color: #173f43;
  padding: 9px 12px;
}

.secondary-action:hover,
.ghost-action:hover,
.toggle-details:hover {
  background: #edf4f2;
}

.section-title {
  margin-bottom: 14px;
}

.section-title p {
  margin: 0;
  color: #697578;
  font-size: 13px;
}

.optimization-card {
  padding: 16px;
}

.section-note {
  margin: 10px 0 0;
  color: #667376;
  font-size: 13px;
  line-height: 1.6;
}

.optimization-history-card {
  border-top: 1px solid #e5ece9;
  margin-top: 18px;
  padding-top: 16px;
}

.optimization-history {
  display: grid;
  gap: 10px;
}

.history-empty {
  border: 1px dashed #c8d6d2;
  border-radius: 8px;
  background: #fbfcfc;
  color: #6a777a;
  padding: 16px;
  font-size: 13px;
}

.history-item {
  border: 1px solid #e0e6e4;
  border-radius: 8px;
  background: #ffffff;
  padding: 13px;
}

.history-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 8px;
}

.history-head strong {
  display: block;
  color: #172426;
  font-size: 14px;
}

.history-head span {
  display: block;
  margin-top: 3px;
  color: #697679;
  font-size: 12px;
}

.history-head em {
  border-radius: 999px;
  background: #eef4f2;
  color: #276257;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  padding: 5px 8px;
  white-space: nowrap;
}

.history-item p {
  margin: 0 0 10px;
  color: #48575a;
  font-size: 13px;
  line-height: 1.6;
}

.plans {
  display: grid;
  gap: 12px;
}

.empty {
  border: 1px dashed #bccac7;
  border-radius: 8px;
  padding: 46px 24px;
  background: rgba(255, 255, 255, 0.72);
  color: #657174;
  text-align: center;
}

.plan {
  overflow: hidden;
}

.plan.is-open {
  border-color: #9fc5bc;
}

.plan-summary {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 16px;
}

.rank {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: #173f43;
  color: #ffffff;
  font-size: 14px;
  font-weight: 850;
}

.plan-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 9px;
}

.plan-meta span {
  border-radius: 999px;
  background: #eef3f2;
  color: #536164;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 750;
}

.plan-meta .score {
  background: #fff0dd;
  color: #a25316;
}

.plan h3 {
  margin-bottom: 8px;
  font-size: 20px;
  line-height: 1.38;
}

.hook,
.why,
.platform-fit {
  color: #4d5b5e;
  line-height: 1.65;
}

.hook {
  margin-bottom: 0;
}

.plan-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.select-row {
  display: flex;
  grid-template-columns: none;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.select-row input {
  width: 18px;
  height: 18px;
  accent-color: #2f7b6d;
}

.plan-details {
  border-top: 1px solid #e0e8e5;
  padding: 16px;
  background: #fbfcfc;
}

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

.excerpt-block {
  border: 1px solid #dce6e3;
  border-radius: 8px;
  background: #ffffff;
  margin-top: 14px;
  padding: 14px;
}

.excerpt-block > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.excerpt-block h4 {
  margin-bottom: 0;
}

.excerpt-block span {
  border-radius: 999px;
  background: #eef4f2;
  color: #617073;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 780;
}

.excerpt-copy p {
  margin-bottom: 10px;
  color: #344144;
  line-height: 1.78;
}

.excerpt-copy p:last-child {
  margin-bottom: 0;
}

ol,
ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.score-item {
  border: 1px solid #d9e2df;
  border-radius: 7px;
  background: #ffffff;
  padding: 10px;
}

.score-item span {
  display: block;
  color: #718083;
  font-size: 12px;
  font-weight: 750;
}

.score-item strong {
  display: block;
  margin-top: 4px;
  color: #173f43;
  font-size: 19px;
}

.risk {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}

.risk span {
  border-radius: 999px;
  background: #fff0e8;
  color: #8b431d;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 760;
}

.feedback-block {
  border-top: 1px solid #e1e8e6;
  padding-top: 14px;
}

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

.notes {
  margin-top: 12px;
}

.report {
  margin-top: 18px;
  padding: 18px;
}

.report .eyebrow {
  margin-bottom: 4px;
}

.report h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.report-grid {
  margin: 16px 0;
}

.report-actions {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

pre {
  overflow: auto;
  border: 1px solid #dce5e2;
  border-radius: 7px;
  background: #f4f7f6;
  padding: 12px;
  color: #344143;
  white-space: pre-wrap;
}

[hidden],
.hidden {
  display: none;
}

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

  .flow-panel {
    position: static;
    align-self: start;
  }

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

  .side-summary {
    display: none;
  }

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

  .config-fields label:nth-last-child(-n + 2) {
    grid-column: span 2;
  }

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

@media (max-width: 820px) {
  .shell {
    padding: 18px;
  }

  .topbar,
  .config-bar,
  .section-title,
  .report-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .config-actions,
  .report-actions {
    justify-content: space-between;
  }

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

  .plan-summary {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .plan-actions {
    grid-column: 1 / -1;
    grid-template-columns: auto auto;
    justify-content: space-between;
    justify-items: start;
  }

  .detail-grid,
  .report-grid,
  .score-grid,
  .feedback-grid,
  .template-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 31px;
  }

  .workflow-steps,
  .config-fields,
  .detail-grid,
  .report-grid,
  .score-grid,
  .feedback-grid,
  .template-list {
    grid-template-columns: 1fr;
  }

  .config-fields label:nth-last-child(-n + 2) {
    grid-column: span 1;
  }

  .plan-summary {
    grid-template-columns: 1fr;
  }

  .rank {
    width: 30px;
    height: 30px;
  }
}
