.demo-main { gap: 18px; }
.demo-main > * { min-width: 0; }
.demo-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  padding: 28px;
  border: 1px solid #b2ccff;
  border-radius: 10px;
  background: #eff8ff;
}
.demo-intro h1 { max-width: 760px; margin: 0 0 8px; font-size: clamp(1.7rem, 3vw, 2.5rem); line-height: 1.08; }
.demo-intro p { max-width: 760px; margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.55; }
.demo-intro-actions { display: flex; flex: 0 0 auto; gap: 9px; }
.demo-intro-actions .button { width: auto; white-space: nowrap; }
.demo-safety {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid #fedf89;
  border-radius: 8px;
  background: #fffaeb;
  color: #7a2e0e;
}
.demo-safety strong { flex: 0 0 auto; }
.demo-safety span { color: #93370d; line-height: 1.45; }
.demo-safety code, .tool-reference code, .scenario-list code {
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(16, 24, 40, .07);
  font: 600 .78rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.demo-parameters { padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.demo-parameters .demo-section-title { align-items: start; }
.demo-parameters .demo-section-title p { max-width: 820px; font-size: .82rem; line-height: 1.45; }
.stub-badge { flex: 0 0 auto; padding: 4px 8px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); font-size: .7rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.parameter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.parameter-grid label { display: grid; gap: 6px; color: var(--muted); font-size: .76rem; font-weight: 800; }
.parameter-grid input, .parameter-grid select { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
.parameter-grid input:focus, .parameter-grid select:focus { outline: 2px solid rgba(37, 99, 235, .18); border-color: var(--accent); }
.parameter-wide { grid-column: span 2; }
.crm-options { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 14px 0 0; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: 7px; background: var(--surface-subtle); }
.crm-options legend { padding: 0 5px; color: var(--muted); font-size: .72rem; font-weight: 850; text-transform: uppercase; }
.crm-options label { display: flex; align-items: center; gap: 7px; font-size: .8rem; font-weight: 750; }
.crm-options input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.demo-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.demo-summary article { min-width: 0; padding: 14px 16px; border-right: 1px solid var(--line-soft); }
.demo-summary article:last-child { border-right: 0; }
.demo-summary span, .demo-summary small { display: block; color: var(--muted); }
.demo-summary span { font-size: .72rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.demo-summary strong { display: block; margin: 5px 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
.demo-summary small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: .68rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; }
.report-showcase { display: grid; grid-template-columns: minmax(320px, 1.25fr) repeat(2, minmax(250px, .75fr)); gap: 14px; align-items: stretch; padding: 18px; border: 1px solid #b2ccff; border-radius: 10px; background: linear-gradient(105deg, #eff8ff 0%, #fff 72%); }
.report-showcase[hidden] { display: none; }
.report-showcase-copy { padding: 6px 10px 6px 4px; }
.report-showcase-copy > span, .report-type { color: var(--accent-ink); font-size: .7rem; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.report-showcase-copy h2 { margin: 5px 0 7px; font-size: 1.35rem; line-height: 1.15; }
.report-showcase-copy p { max-width: 620px; margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.5; }
.report-card { display: flex; flex-direction: column; min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 4px 12px rgba(16, 24, 40, .05); }
.report-card::before { content: "PDF"; align-self: end; display: grid; width: 34px; height: 26px; margin-bottom: -17px; place-items: center; border-radius: 4px; background: #f04438; color: #fff; font-size: .62rem; font-weight: 900; letter-spacing: .05em; }
.report-card strong { display: block; margin: 5px 0 4px; padding-right: 42px; font-size: .98rem; }
.report-card small { flex: 1; display: block; margin-bottom: 12px; color: var(--muted); line-height: 1.45; }
.report-card .button { width: 100%; font-size: .75rem; }
.demo-workspace { display: grid; grid-template-columns: minmax(320px, .8fr) minmax(280px, .7fr) minmax(360px, 1.15fr); min-height: 590px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.demo-steps, .demo-activity, .demo-output { min-width: 0; padding: 17px; }
.demo-activity, .demo-output { border-left: 1px solid var(--line-soft); }
.demo-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 30px; margin-bottom: 13px; }
.demo-section-title h2 { font-size: 1rem; }
.demo-section-title p { margin: 4px 0 0; color: var(--muted); }
#demo-state { color: var(--muted); font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.scenario-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.scenario-list li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 59px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.scenario-list li:last-child { border-bottom: 0; }
.step-number { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: #fff; font-size: .75rem; font-weight: 850; }
.scenario-list strong, .scenario-list small { display: block; }
.scenario-list strong { font-size: .86rem; }
.scenario-list small { margin-top: 3px; color: var(--muted); }
.scenario-list button { min-width: 48px; min-height: 29px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--accent-ink); cursor: pointer; font-size: .75rem; font-weight: 800; }
.scenario-list button:hover:not(:disabled) { border-color: var(--accent); background: var(--info-bg); }
.scenario-list button:disabled { cursor: not-allowed; opacity: .42; }
.scenario-list li.is-running .step-number { border-color: var(--accent); color: var(--accent); background: var(--info-bg); animation: demo-pulse 1s ease-in-out infinite; }
.scenario-list li.is-complete .step-number { border-color: var(--ok); color: #fff; background: var(--ok); }
.scenario-list li.is-complete .step-number::after { content: "✓"; }
.scenario-list li.is-complete .step-number { font-size: 0; }
.scenario-list li.is-complete .step-number::after { font-size: .8rem; }
.scenario-list li.is-error .step-number { border-color: var(--alert); color: var(--alert); background: var(--alert-bg); }
.report-button { margin-top: 14px; background: var(--ok-bg); color: var(--ok); border-color: #a6f4c5; }
.text-button { padding: 2px 0; border: 0; background: transparent; color: var(--accent-ink); cursor: pointer; font-size: .76rem; font-weight: 750; }
.timeline { position: relative; display: grid; gap: 13px; max-height: 510px; padding-left: 17px; overflow: auto; }
.timeline::before { content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: 1px; background: var(--line); }
.timeline-entry { position: relative; }
.timeline-entry::before { content: ""; position: absolute; top: 5px; left: -17px; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.timeline-entry.success::before { background: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
.timeline-entry.error::before { background: var(--alert); box-shadow: 0 0 0 1px var(--alert); }
.timeline-entry strong { display: block; font-size: .82rem; }
.timeline-entry span { color: var(--muted); font-size: .73rem; }
.timeline-entry p { margin: 3px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.4; }
.empty-log { color: var(--muted); }
.result-context { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.result-context strong { font-size: .84rem; }
.result-context span { color: var(--muted); font: .68rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; text-align: right; }
#result-json { height: 500px; margin: 0; padding: 14px; overflow: auto; border: 1px solid #1d2939; border-radius: 7px; background: #101828; color: #d1e9ff; font: .72rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
.tool-reference { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.tool-table-wrap { overflow-x: auto; }
.tool-reference table { width: 100%; border-collapse: collapse; }
.tool-reference th, .tool-reference td { padding: 10px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; font-size: .8rem; }
.tool-reference th { color: var(--muted); font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; }
.tool-reference tr:last-child td { border-bottom: 0; }
.sidebar-footer p { margin: 3px 0 0; color: #98a2b3; font-size: .75rem; line-height: 1.45; }
.demo-error { min-height: 0; }
body.demo-busy { cursor: progress; }
body.demo-busy button, body.demo-busy .report-button { pointer-events: none; }
@keyframes demo-pulse { 50% { box-shadow: 0 0 0 4px rgba(37, 99, 235, .14); } }
@media (prefers-reduced-motion: reduce) { .scenario-list li.is-running .step-number { animation: none; } }

@media (max-width: 1250px) {
  .parameter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-showcase { grid-template-columns: 1fr 1fr; }
  .report-showcase-copy { grid-column: 1 / -1; }
  .demo-workspace { grid-template-columns: minmax(300px, .8fr) minmax(360px, 1.2fr); }
  .demo-activity { border-left: 1px solid var(--line-soft); }
  .demo-output { grid-column: 1 / -1; border-top: 1px solid var(--line-soft); border-left: 0; }
  #result-json { height: 360px; }
}
@media (max-width: 800px) {
  .demo-intro { display: grid; padding: 20px; }
  .demo-intro-actions { flex-wrap: wrap; }
  .demo-summary { grid-template-columns: repeat(2, 1fr); }
  .demo-summary article { border-bottom: 1px solid var(--line-soft); }
  .demo-summary article:nth-child(2n) { border-right: 0; }
  .demo-summary article:last-child { border-bottom: 0; }
  .parameter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-showcase { grid-template-columns: 1fr; }
  .report-showcase-copy { grid-column: auto; }
  .demo-workspace { grid-template-columns: 1fr; }
  .demo-activity, .demo-output { grid-column: auto; border-top: 1px solid var(--line-soft); border-left: 0; }
  .tool-reference { padding: 13px; }
}
@media (max-width: 520px) {
  .demo-intro-actions { display: grid; }
  .demo-intro-actions .button { width: 100%; }
  .demo-safety { align-items: start; flex-direction: column; gap: 5px; }
  .demo-summary { grid-template-columns: 1fr; }
  .demo-summary article { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .parameter-grid { grid-template-columns: 1fr; }
  .parameter-wide { grid-column: auto; }
  .crm-options { display: grid; }
  .scenario-list li { grid-template-columns: 28px minmax(0, 1fr); }
  .scenario-list button { grid-column: 2; justify-self: start; }
}
