:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --panel-2: #eef2f6;
  --text: #172026;
  --muted: #66727d;
  --line: #d8dee4;
  --strong: #0f5f5c;
  --strong-2: #137a74;
  --accent: #b45f06;
  --danger: #b3261e;
  --ok: #237a3b;
  --shadow: 0 14px 32px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 288px 1fr;
}

.sidebar {
  background: #172026;
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.brand span {
  color: #b9c5ce;
  font-size: 13px;
}

.plan-actions,
.nav-list {
  display: grid;
  gap: 8px;
}

.primary,
.secondary,
.ghost,
.danger {
  min-height: 38px;
  border-radius: 7px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 650;
}

.primary {
  background: var(--strong);
  color: #fff;
}

.primary:hover {
  background: var(--strong-2);
}

.secondary {
  background: #e8f3f2;
  color: #0f5f5c;
  border: 1px solid #b9d7d3;
}

.ghost {
  background: transparent;
  color: inherit;
  border: 1px solid var(--line);
}

.danger {
  background: #fff0ed;
  color: var(--danger);
  border: 1px solid #f2c7c1;
}

.sidebar .ghost {
  color: #fff;
  border-color: #384651;
}

.plan-select {
  width: 100%;
  min-height: 40px;
  border-radius: 7px;
  border: 1px solid #384651;
  color: #fff;
  background: #202c34;
  padding: 8px;
}

.nav-item {
  text-align: left;
  color: #d6dee5;
  background: transparent;
  border-radius: 7px;
  padding: 10px 11px;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: center;
}

.nav-item:hover,
.nav-item.active {
  background: #26343d;
  color: #fff;
}

.nav-index {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  background: #34444f;
  border-radius: 999px;
  font-size: 12px;
}

.progress-box {
  border: 1px solid #384651;
  border-radius: 8px;
  padding: 12px;
  color: #d6dee5;
  margin-top: auto;
}

.progress-line {
  height: 8px;
  background: #34444f;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-fill {
  height: 100%;
  background: #50b6ae;
  width: 0;
}

.sidebar-credit {
  color: #93a4b0;
  font-size: 12px;
  line-height: 1.35;
  border-top: 1px solid #384651;
  padding-top: 12px;
}

.main {
  padding: 28px;
  min-width: 0;
}

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

.topbar h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.topbar p {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 820px;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workspace {
  display: block;
}

.section,
.method-strip,
.summary-band {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.section {
  padding: 22px;
}

.section h3,
.method-strip h3 {
  margin: 0 0 7px;
  font-size: 19px;
}

.section-note {
  color: var(--muted);
  margin: 0 0 18px;
}

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

.field {
  display: grid;
  gap: 6px;
}

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

label {
  font-weight: 650;
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 7px;
  padding: 10px 11px;
  min-height: 40px;
}

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

.hint {
  color: var(--muted);
  font-size: 12px;
}

.repeat-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.item-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.ai-panel {
  margin-bottom: 14px;
  border-color: #b9d7d3;
  background: #fbfefd;
}

.step-controls {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.step-controls span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.step-controls button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

.simulation-result div {
  background: #f7f9fa;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
}

.simulation-result strong {
  display: block;
  font-size: 18px;
}

.simulation-result span {
  color: var(--muted);
  font-size: 12px;
}

.item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.item-title {
  font-weight: 750;
}

.mini-btn {
  background: var(--panel-2);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 9px;
  min-height: 32px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--text);
}

.tab.active {
  background: #e8f3f2;
  border-color: #9fcac5;
  color: #0f5f5c;
  font-weight: 700;
}

.score-grid {
  display: grid;
  gap: 10px;
}

.score-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.scale button {
  min-height: 32px;
  border-radius: 5px;
  background: #edf1f4;
  color: var(--text);
}

.scale button.active {
  background: var(--strong);
  color: #fff;
}

.method-strip {
  padding: 14px 16px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: 140px minmax(180px, 1fr) minmax(180px, 1fr) minmax(260px, 2fr);
  gap: 14px;
  align-items: center;
}

.metric {
  display: grid;
  gap: 7px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.method-strip h3 {
  margin: 0;
}

.method-strip .insights {
  display: grid;
  gap: 4px;
}

.method-strip .insights li {
  padding-top: 3px;
  padding-bottom: 3px;
}

.meter {
  height: 10px;
  background: #edf1f4;
  border-radius: 999px;
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  background: var(--strong);
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
}

.status.low {
  background: #fff0ed;
  color: var(--danger);
}

.status.mid {
  background: #fff4df;
  color: #8a4b00;
}

.status.high {
  background: #e8f4ec;
  color: var(--ok);
}

.insights {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.insights li {
  border-left: 3px solid var(--accent);
  padding: 6px 0 6px 10px;
  color: #34424c;
}

.matrix {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 8px;
}

.matrix th,
.matrix td {
  border: 1px solid var(--line);
  padding: 8px;
  vertical-align: top;
  background: #fff;
}

.matrix th {
  background: #edf1f4;
  text-align: left;
  font-size: 13px;
}

.matrix textarea {
  border: 0;
  padding: 4px;
  min-height: 88px;
}

.report {
  display: grid;
  gap: 18px;
}

.report-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.report-block h3 {
  margin-top: 0;
}

.report-actions {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  display: grid;
  gap: 12px;
}

.report-actions h3 {
  margin: 0;
}

.report-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.report-buttons button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.final-document {
  font-size: 15px;
  line-height: 1.55;
}

.final-document h4 {
  margin: 20px 0 8px;
  font-size: 18px;
}

.final-document p {
  margin: 10px 0;
}

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

.report-value {
  background: #f7f9fa;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  white-space: pre-wrap;
}

.empty {
  color: var(--muted);
  font-style: italic;
}

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

.scenario-details {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}

.scenario-details summary {
  cursor: pointer;
  font-weight: 750;
}

.bottom-ai-action {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.help-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  margin-top: 14px;
}

.help-block h4 {
  margin: 0 0 8px;
  font-size: 17px;
}

.help-block p {
  margin: 8px 0;
  color: #34424c;
  line-height: 1.55;
}

.help-block ul {
  margin: 8px 0 0;
  padding-left: 22px;
  color: #34424c;
  line-height: 1.55;
}

.help-block li + li {
  margin-top: 6px;
}

.danger-zone {
  margin-top: 22px;
  border: 1px solid #f2c7c1;
  border-radius: 8px;
  background: #fff8f7;
  padding: 16px;
}

.danger-zone h4 {
  margin: 0 0 6px;
}

.danger-zone p {
  margin: 0 0 12px;
  color: #6f3a34;
}

.summary-card {
  border-left: 4px solid var(--strong);
  padding-left: 12px;
}

.summary-card strong {
  display: block;
  font-size: 22px;
}

.summary-card span {
  color: var(--muted);
  font-size: 13px;
}

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

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

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

@media (max-width: 760px) {
  .main {
    padding: 18px;
  }

  .topbar,
  .item-head {
    flex-direction: column;
    align-items: stretch;
  }

  .form-grid,
  .report-grid,
  .simulation-result,
  .summary-band {
    grid-template-columns: 1fr;
  }

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

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .top-actions,
  .method-strip,
  .tabs,
  .no-print {
    display: none !important;
  }

  .app-shell,
  .workspace {
    display: block;
  }

  .main {
    padding: 0;
  }

  .section,
  .report-block,
  .summary-band {
    box-shadow: none;
    border-color: #bbb;
    break-inside: avoid;
  }
}
