:root {
  --paper: #f5f1e8;
  --paper-2: #fbfaf6;
  --ink: #172329;
  --muted: #6d7c82;
  --line: #d6ddd9;
  --navy: #113843;
  --navy-2: #1d4c58;
  --green: #07977f;
  --green-dark: #007d69;
  --mint: #dcefeb;
  --orange: #f3683b;
  --white: #ffffff;
  --shadow: 0 14px 34px rgba(18, 48, 55, 0.10);
  --radius: 18px;
  --topbar-height: 80px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 5%, rgba(7,151,127,.08), transparent 24rem),
    var(--paper);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: var(--topbar-height);
  padding: 12px 28px;
  color: var(--white);
  background: rgba(17, 56, 67, .96);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--green);
  font-weight: 900;
}
.brand strong { font-size: 17px; letter-spacing: .02em; }
.brand span { color: rgba(255,255,255,.66); font-size: 12px; }

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.btn {
  border: 1px solid rgba(255,255,255,.20);
  border-radius: 10px;
  padding: 9px 14px;
  color: var(--white);
  background: rgba(255,255,255,.08);
  transition: .18s ease;
}
.btn:hover { transform: translateY(-1px); background: rgba(255,255,255,.14); }
.btn.primary { border-color: var(--orange); background: var(--orange); }
.btn.light { color: var(--navy); border-color: var(--line); background: var(--white); }

.page-shell {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-height));
}

.editor {
  position: sticky;
  top: var(--topbar-height);
  align-self: start;
  height: calc(100vh - var(--topbar-height));
  overflow: auto;
  padding: 24px 22px 40px;
  background: rgba(251,250,246,.88);
  border-right: 1px solid var(--line);
}

.editor h1 { margin: 0 0 8px; font-size: 22px; }
.editor-intro { margin: 0 0 22px; color: var(--muted); font-size: 13px; line-height: 1.65; }

.form-section { margin: 0 0 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-section:first-of-type { border-top: 0; padding-top: 0; }
.form-section h2 { margin: 0 0 13px; font-size: 13px; color: var(--green-dark); letter-spacing: .08em; }
.field { display: grid; gap: 7px; margin-bottom: 13px; }
.field label { font-size: 12px; font-weight: 700; color: #405259; }
.field small { color: var(--muted); line-height: 1.4; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid #cad4d0;
  border-radius: 10px;
  padding: 10px 11px;
  color: var(--ink);
  background: var(--white);
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(7,151,127,.11);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  font-size: 13px;
}
.switch { position: relative; width: 44px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; }
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #bdc9c5;
  transition: .2s ease;
}
.switch span::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: var(--white);
  transition: .2s ease;
}
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }

.report-wrap { min-width: 0; padding: 30px; }
.report {
  width: min(1180px, 100%);
  margin: 0 auto;
  background: var(--paper-2);
  border: 1px solid rgba(17,56,67,.12);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: visible;
}

.report-hero {
  position: relative;
  padding: 22px 32px 20px;
  color: var(--white);
  background:
    linear-gradient(130deg, rgba(7,151,127,.35), transparent 55%),
    var(--navy);
  border-radius: 24px 24px 0 0;
}
.report-sticky-head {
  position: sticky;
  top: var(--topbar-height);
  z-index: 14;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 8px 18px rgba(17,56,67,.08);
}
.report-hero::after {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  right: -100px;
  top: -170px;
  border-radius: 50%;
  border: 55px solid rgba(255,255,255,.055);
}
.eyebrow { margin: 0 0 16px; color: #74dbc8; font-size: 13px; font-weight: 800; letter-spacing: .12em; }
.report-hero h1 { max-width: 800px; margin: 0; font-size: clamp(25px, 3vw, 34px); line-height: 1.1; }
.customer-subtitle { margin: 7px 0 0; color: #83e2d0; font-size: 14px; font-weight: 700; }
.report-subtitle { max-width: 790px; margin: 0; color: rgba(255,255,255,.72); line-height: 1.7; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 24px; }
.hero-meta span {
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  color: rgba(255,255,255,.82);
  background: rgba(255,255,255,.07);
  font-size: 12px;
}

.section-guide {
  position: static;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 20px;
  overflow-x: auto;
  white-space: nowrap;
  background: #eef3ef;
  border-bottom: 1px solid var(--line);
}
.section-guide strong { margin-right: 4px; color: var(--navy); font-size: 12px; }
.section-guide a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid #d3ddd9;
  border-radius: 999px;
  color: #52656b;
  background: var(--white);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  transition: .18s ease;
}
.section-guide a:hover { color: var(--green-dark); border-color: var(--green); transform: translateY(-1px); }
.section-guide i {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: var(--white);
  background: var(--green);
  font-size: 10px;
  font-style: normal;
}
.section[id] { scroll-margin-top: 215px; }

.report-body { padding: 34px 44px 48px; }
.deployment-conclusion {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 15px 17px;
  border: 1px solid #c9dcd5;
  border-radius: 13px;
  background: #e8f2ee;
  font-size: 11px;
}
.deployment-conclusion strong { margin-right: 4px; color: var(--navy); }
.deployment-conclusion span { padding: 6px 9px; border-radius: 999px; color: var(--green-dark); background: var(--white); font-weight: 700; }
.section { margin-top: 42px; }
.section:first-child { margin-top: 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section-kicker { margin: 0 0 6px; color: var(--green-dark); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.section h2 { margin: 0; font-size: 25px; }
.section-note { max-width: 520px; color: var(--muted); font-size: 12px; line-height: 1.55; text-align: right; }
.section-action {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 9px 13px;
  border: 1px solid #acd6cd;
  border-radius: 10px;
  color: var(--green-dark);
  background: var(--mint);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  transition: .18s ease;
}
.section-action:hover { border-color: var(--green); transform: translateY(-1px); }

.summary-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.metric {
  min-height: 126px;
  padding: 18px;
  border-radius: 14px;
  background: var(--white);
  border: 1px solid var(--line);
}
.metric-label { color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin: 12px 0 6px; font-size: 20px; line-height: 1.25; }
.metric small { color: var(--green-dark); }

.responsibility-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.responsibility-card {
  min-height: 176px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
}
.responsibility-card span { color: var(--green-dark); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.responsibility-card h3 { margin: 12px 0 9px; font-size: 18px; }
.responsibility-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.access-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding: 13px 16px;
  border: 1px solid #c9dcd5;
  border-radius: 12px;
  background: #e8f2ee;
  font-size: 11px;
}
.access-strip strong { margin-right: 4px; color: var(--navy); }
.access-strip span { padding: 5px 8px; border-radius: 999px; color: var(--green-dark); background: var(--white); font-weight: 700; }
.access-strip em { margin-left: auto; color: var(--orange); font-style: normal; font-weight: 800; }
.architecture-subsection { margin-top: 28px; }
.subsection-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.subsection-heading h3 { margin: 0; font-size: 19px; }
.subsection-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.architecture-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 13px 15px;
  border: 1px solid #cddbd5;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  color: #53666c;
  background: #f0f4f1;
  font-size: 11px;
}
.architecture-note strong { color: var(--navy); margin-right: 3px; }
.architecture-note span::before { content: "•"; margin-right: 6px; color: var(--green); }
.security-boundary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--line);
}
.security-boundary div { padding: 15px 17px; background: var(--white); }
.security-boundary span { display: block; margin-bottom: 7px; color: var(--green-dark); font-size: 10px; font-weight: 800; letter-spacing: .06em; }
.security-boundary strong { display: block; font-size: 12px; line-height: 1.6; }

.architecture {
  padding: 24px;
  border-radius: var(--radius);
  background: #edf3ef;
  border: 1px solid #d1ded8;
}
.architecture-svg { padding: 12px; overflow-x: auto; background: #edf3ef; }
.architecture-svg svg { display: block; width: 100%; min-width: 820px; height: auto; }
.architecture-svg .zone { stroke-width: 1.5; }
.architecture-svg .customer-zone { fill: #f8faf8; stroke: #bfd2ca; }
.architecture-svg .api-zone { fill: #e3f1ed; stroke: #9dcbbf; }
.architecture-svg .zone-title { fill: #526a70; font-size: 14px; font-weight: 800; letter-spacing: .08em; }
.architecture-svg .svg-node rect { fill: #fff; stroke: #c9d6d1; stroke-width: 1.4; }
.architecture-svg .svg-node.primary rect { fill: #113843; stroke: #113843; }
.architecture-svg .svg-node.gateway rect { fill: #fff4ec; stroke: #f2a385; }
.architecture-svg .svg-node.model rect { fill: #fff; stroke: #07977f; stroke-width: 2.2; }
.architecture-svg .svg-node.soft rect { fill: #f6faf8; stroke: #b8d5cc; }
.architecture-svg .node-title { fill: #172329; font-size: 15px; font-weight: 800; }
.architecture-svg .node-copy { fill: #6d7c82; font-size: 12px; }
.architecture-svg .channel-copy { font-size: 9.5px; fill: #007d69; font-weight: 700; }
.architecture-svg .primary .node-title { fill: #fff; }
.architecture-svg .primary .node-copy { fill: rgba(255,255,255,.72); }
.architecture-svg .model-name { fill: #007d69; font-size: 11px; font-weight: 800; }
.architecture-svg .link { fill: none; stroke: #07977f; stroke-width: 2.4; }
.architecture-svg .api-link { stroke: #f3683b; }
.architecture-svg .dashed { stroke-dasharray: 7 6; }
.architecture-svg .link-label { fill: #b65332; font-size: 11px; font-weight: 700; }
.arch-grid {
  display: grid;
  grid-template-columns: 1fr 42px 1.05fr 42px 1.18fr 42px 1.12fr;
  align-items: stretch;
}
.arch-node {
  position: relative;
  min-height: 156px;
  padding: 18px;
  border: 1px solid #cbd7d2;
  border-radius: 14px;
  background: var(--white);
}
.arch-node.primary { color: var(--white); background: var(--navy); border-color: var(--navy); }
.arch-node.model { border: 2px solid var(--green); }
.arch-arrow { display: grid; place-items: center; color: var(--orange); font-size: 27px; font-weight: 800; }
.arch-tag { display: inline-flex; margin-bottom: 12px; padding: 4px 7px; border-radius: 999px; color: var(--green-dark); background: var(--mint); font-size: 10px; font-weight: 800; }
.arch-node.primary .arch-tag { color: #9df0df; background: rgba(255,255,255,.1); }
.arch-node h3 { margin: 0 0 9px; font-size: 16px; }
.arch-node p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.arch-node.primary p { color: rgba(255,255,255,.68); }
.security-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.security-row span { padding: 7px 9px; border-radius: 8px; color: #486158; background: rgba(255,255,255,.72); font-size: 11px; }

.model-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  padding: 22px;
  border-radius: var(--radius);
  color: var(--white);
  background: var(--navy);
}
.model-card h3 { margin: 4px 0 8px; font-size: 24px; }
.model-card p { margin: 0; color: rgba(255,255,255,.68); line-height: 1.6; }
.model-facts { display: grid; grid-template-columns: repeat(2, minmax(120px,1fr)); gap: 8px; min-width: 300px; }
.model-facts div { padding: 12px; border-radius: 10px; background: rgba(255,255,255,.08); }
.model-facts span { display: block; color: rgba(255,255,255,.55); font-size: 10px; }
.model-facts strong { display: block; margin-top: 5px; font-size: 13px; }

.process-flow {
  display: grid;
  grid-template-columns: 1fr 42px 1fr 42px 1fr;
  align-items: stretch;
}
.process-step {
  position: relative;
  min-height: 270px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--white);
}
.process-step.active { color: var(--white); border-color: var(--navy); background: var(--navy); }
.step-number {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--white);
  background: var(--green);
  font-weight: 900;
}
.process-step.active .step-number { color: var(--navy); background: #83e2d0; }
.step-owner { margin: 16px 0 5px; color: var(--green-dark); font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.process-step.active .step-owner { color: #83e2d0; }
.process-step h3 { margin: 0 0 14px; font-size: 18px; }
.process-step ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.process-step.active ul { color: rgba(255,255,255,.72); }
.step-done { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid #dce3e0; color: var(--green-dark); font-size: 11px; line-height: 1.55; }
.step-done b { display: block; color: var(--ink); }
.process-step.active .step-done { color: #9de8d9; border-top-color: rgba(255,255,255,.16); }
.process-step.active .step-done b { color: var(--white); }
.process-arrow { display: grid; place-items: center; color: var(--orange); font-size: 27px; font-weight: 900; }
.handoff-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  color: #50636a;
  background: #e8efeb;
  font-size: 11px;
}
.handoff-line strong { color: var(--ink); }
.handoff-line span { padding: 5px 8px; border-radius: 999px; background: var(--white); }

.prep-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.prep-grid article { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
.prep-grid article:last-child { color: var(--white); border-color: var(--navy); background: var(--navy); }
.prep-grid span { color: var(--green-dark); font-size: 11px; font-weight: 800; }
.prep-grid article:last-child span { color: #83e2d0; }
.prep-grid h3 { margin: 9px 0 10px; font-size: 17px; }
.prep-grid ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.85; }
.prep-grid article:last-child ul { color: rgba(255,255,255,.72); }

.validation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.validation-card { padding: 22px; border: 1px solid var(--line); border-radius: 15px; background: var(--white); }
.validation-card.value { border-color: #9dcfc4; background: #eaf4f0; }
.validation-card span { color: var(--green-dark); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.validation-card h3 { margin: 10px 0 12px; font-size: 18px; }
.validation-card ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.validation-note, .appendix-note { margin-top: 12px; padding: 13px 15px; border-radius: 11px; color: #596970; background: #eef1ed; font-size: 11px; line-height: 1.6; }
.validation-note strong { color: var(--navy); }
.token-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 12px; }

.resource-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.resource-table { width: 100%; border-collapse: collapse; min-width: 820px; background: var(--white); }
.resource-table th { padding: 13px 14px; color: var(--white); background: var(--navy); text-align: left; font-size: 12px; }
.resource-table td { padding: 14px; border-top: 1px solid #e1e6e3; vertical-align: top; font-size: 12px; line-height: 1.55; }
.resource-table tr:nth-child(even) td { background: #f2f5f2; }
.resource-table td:first-child { color: var(--green-dark); font-weight: 800; }
.responsibility-table { min-width: 920px; table-layout: fixed; }
.responsibility-table th:nth-child(1) { width: 14%; }
.responsibility-table th:nth-child(2) { width: 32%; }
.responsibility-table th:nth-child(3) { width: 32%; }
.responsibility-table th:nth-child(4) { width: 22%; }
.reuse { display: inline-flex; padding: 4px 7px; border-radius: 999px; color: var(--green-dark); background: var(--mint); font-weight: 800; }

.boundary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.boundary-card { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
.boundary-card h3 { margin: 0 0 9px; font-size: 15px; }
.boundary-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.boundary-card.warning { border-color: #f0c5b5; background: #fff5ef; }

.report-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 42px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--white);
  background: var(--navy);
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

.pdf-exporting .report-sticky-head { position: static; }
.pdf-exporting .report { width: 1180px; box-shadow: none; }
.pdf-exporting .section-guide { overflow: visible; }
.pdf-exporting .resource-table-wrap,
.pdf-exporting .architecture-svg { overflow: visible; }

@media (max-width: 1050px) {
  .page-shell { grid-template-columns: 310px minmax(0,1fr); }
  .report-wrap { padding: 18px; }
  .report-body { padding: 28px; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .prep-grid, .validation-grid, .security-boundary { grid-template-columns: 1fr; }
  .responsibility-grid { grid-template-columns: 1fr; }
  .arch-grid { grid-template-columns: 1fr; gap: 8px; }
  .arch-arrow { height: 28px; transform: rotate(90deg); }
  .model-card { grid-template-columns: 1fr; }
  .process-flow { grid-template-columns: 1fr; gap: 8px; }
  .process-arrow { height: 28px; transform: rotate(90deg); }
}

@media (max-width: 760px) {
  .topbar { position: sticky; padding: 14px 16px; align-items: flex-start; }
  .brand span { display: none; }
  .page-shell { display: block; }
  .editor { position: static; width: 100%; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .report-wrap { padding: 0; }
  .report { border-radius: 0; border-left: 0; border-right: 0; }
  .report-hero { padding: 24px 22px 20px; }
  .report-sticky-head { position: static; }
  .section-guide { position: static; padding: 10px 14px; }
  .report-body { padding: 24px 18px 38px; }
  .summary-grid, .boundary-grid, .token-grid { grid-template-columns: 1fr; }
  .section-heading { display: block; }
  .section-action { margin-top: 12px; }
  .section-note { margin-top: 8px; text-align: left; }
  .model-facts { min-width: 0; grid-template-columns: 1fr 1fr; }
  .report-footer { display: block; }
}

@media print {
  body { background: var(--white); }
  .topbar, .editor, .toast, .section-action { display: none !important; }
  .page-shell { display: block; }
  .report-wrap { padding: 0; }
  .report { width: 100%; border: 0; border-radius: 0; box-shadow: none; }
  .report-body { padding: 28px 34px; }
  .section { break-inside: avoid; }
  .resource-table-wrap { overflow: visible; }
}
