:root {
  color-scheme: light;
  --ink: #183047;
  --muted: #5f7181;
  --line: #d8e2e9;
  --soft: #f4f7f9;
  --brand: #0b6b64;
  --brand-dark: #07544f;
  --brand-soft: #e7f5f2;
  --blue-soft: #edf4fb;
  --warning: #9a5b08;
  --warning-soft: #fff6e7;
  --shadow: 0 14px 36px rgba(27, 53, 72, 0.1);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; color: var(--ink); background: #eef3f5; font-size: 16px; line-height: 1.72; }
a { color: var(--brand-dark); }
button, input, select { font: inherit; }
code { padding: 0.12em 0.38em; border-radius: 5px; background: #edf1f4; color: #9b3344; font-family: Consolas, "Courier New", monospace; font-size: 0.92em; }

.skip-link { position: fixed; top: 8px; left: 8px; z-index: 20; padding: 8px 12px; background: #fff; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

.guide-hero { color: #fff; background: linear-gradient(120deg, #123b4c 0%, #0b6b64 64%, #31827a 100%); }
.guide-hero-inner { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 54px 0 48px; }
.eyebrow, .section-kicker { margin: 0 0 6px; font-size: 13px; font-weight: 700; letter-spacing: 0.12em; }
.eyebrow { color: #bfe8e1; }
.guide-hero h1 { margin: 0; font-size: clamp(34px, 4vw, 52px); line-height: 1.18; letter-spacing: -0.025em; }
.hero-summary { max-width: 780px; margin: 18px 0 14px; color: #e8f4f2; font-size: 18px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px 28px; color: #cce6e2; font-size: 14px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.guide-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 8px 18px; border: 1px solid rgba(255,255,255,0.58); border-radius: 8px; color: #fff; background: transparent; text-decoration: none; cursor: pointer; }
.guide-button.primary { border-color: #fff; color: var(--brand-dark); background: #fff; font-weight: 700; }
.guide-button:focus-visible, .guide-toc a:focus-visible, summary:focus-visible, .back-to-top:focus-visible { outline: 3px solid #ffd16a; outline-offset: 3px; }

.guide-layout { display: grid; grid-template-columns: minmax(220px, 260px) minmax(0, 1fr); gap: 28px; width: min(1420px, calc(100% - 48px)); margin: 30px auto 54px; align-items: start; }
.guide-toc { position: sticky; top: 20px; padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.guide-toc > strong { display: block; margin-bottom: 10px; font-size: 18px; }
.guide-toc ol { margin: 0; padding-left: 22px; }
.guide-toc li { margin: 5px 0; color: #91a0aa; }
.guide-toc a { display: inline-block; color: var(--ink); text-decoration: none; }
.guide-toc a:hover, .guide-toc a[aria-current="location"] { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.toc-tip { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

.guide-content { min-width: 0; }
.guide-section { margin-bottom: 22px; padding: 30px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); scroll-margin-top: 20px; }
.guide-section.accent { border-top: 5px solid var(--brand); }
.section-heading { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.section-number { display: grid; flex: 0 0 46px; width: 46px; height: 46px; place-items: center; border-radius: 50%; color: #fff; background: var(--brand); font-weight: 800; }
.section-kicker { color: var(--brand); }
.section-heading h2 { margin: 0; font-size: 28px; line-height: 1.25; }
.section-collapse-button { margin-left: auto; padding: 6px 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--brand-dark); background: #fff; cursor: pointer; }
.guide-section.is-collapsed > :not(.section-heading) { display: none; }
.guide-section.is-collapsed .section-heading { margin-bottom: 0; }
.subheading { margin: 26px 0 12px; font-size: 19px; }
.lead { margin: -4px 0 20px; color: var(--muted); }
.screenshot-note { margin: 16px 0 0; color: var(--muted); font-size: 13px; }

.shot-grid { display: grid; gap: 18px; margin-top: 24px; }
.shot-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.compact-shot-grid { grid-template-columns: 1fr !important; margin-top: 14px; }
.guide-shot { margin: 0; overflow: hidden; border: 1px solid #cfdbe2; border-radius: 12px; background: #fff; box-shadow: 0 10px 26px rgba(27, 53, 72, 0.09); }
.shot-frame { position: relative; overflow: hidden; border-bottom: 1px solid #dce5ea; background: #e9eff2; cursor: zoom-in; --mark-x: 63%; --mark-y: 8%; --mark-w: 31%; --mark-h: 18%; }
.shot-frame img { display: block; width: 100%; height: auto; }
.shot-annotations { display: none; }
.mark-box { fill: rgba(217, 45, 32, 0.055); stroke: #d92d20; stroke-width: 5; vector-effect: non-scaling-stroke; }
.mark-dot { fill: #d92d20; stroke: #fff; stroke-width: 4; vector-effect: non-scaling-stroke; }
.mark-number { fill: #fff; font-family: Arial, sans-serif; font-size: 32px; font-weight: 800; text-anchor: middle; }
.shot-frame::after { content: ""; position: absolute; left: var(--mark-x); top: var(--mark-y); width: var(--mark-w); height: var(--mark-h); border: 4px solid #d92d20; border-radius: 10px; background: rgba(217, 45, 32, 0.04); pointer-events: none; }
.shot-frame::before { content: "1"; position: absolute; z-index: 2; left: calc(var(--mark-x) - 13px); top: calc(var(--mark-y) - 13px); display: grid; width: 30px; height: 30px; place-items: center; border: 3px solid #fff; border-radius: 50%; color: #fff; background: #d92d20; box-shadow: 0 2px 8px rgba(77, 18, 12, 0.28); font: 800 16px/1 Arial, sans-serif; pointer-events: none; }
.shot-frame:focus-visible { outline: 4px solid #ffd16a; outline-offset: 4px; }
.guide-shot[data-topic="select-template"] .shot-frame { --mark-x: 55%; --mark-y: 45%; --mark-w: 40%; --mark-h: 32%; }
.guide-shot[data-topic="derive"] .shot-frame { --mark-x: 23%; --mark-y: 17%; --mark-w: 54%; --mark-h: 66%; }
.guide-shot[data-topic="structure"] .shot-frame { --mark-x: 24%; --mark-y: 4%; --mark-w: 70%; --mark-h: 24%; }
.guide-shot[data-topic="batch-xlsx"] .shot-frame { --mark-x: 9%; --mark-y: 8%; --mark-w: 82%; --mark-h: 78%; }
.guide-shot[data-topic="formula-rules"] .shot-frame { --mark-x: 8%; --mark-y: 7%; --mark-w: 84%; --mark-h: 80%; }
.guide-shot[data-topic="validate-publish"] .shot-frame { --mark-x: 24%; --mark-y: 8%; --mark-w: 48%; --mark-h: 22%; }
.guide-shot[data-topic="bom-results"] .shot-frame { --mark-x: 24%; --mark-y: 8%; --mark-w: 70%; --mark-h: 50%; }
.guide-shot figcaption { display: grid; gap: 4px; padding: 13px 16px 15px; }
.guide-shot figcaption strong { color: var(--ink); font-size: 16px; }
.guide-shot figcaption span { color: var(--muted); font-size: 14px; line-height: 1.62; }
.compact-shot-grid .guide-shot figcaption { padding: 11px 13px 13px; }
.compact-shot-grid .guide-shot figcaption strong { font-size: 15px; }
.compact-shot-grid .guide-shot figcaption span { font-size: 13px; }

body.lightbox-open { overflow: hidden; }
.guide-lightbox[hidden] { display: none; }
.guide-lightbox { position: fixed; inset: 0; z-index: 1000; display: grid; padding: 28px; place-items: center; background: rgba(7, 27, 38, 0.86); }
.guide-lightbox-panel { display: grid; grid-template-rows: auto minmax(0, 1fr); width: min(1500px, 100%); height: min(92vh, 980px); overflow: hidden; border-radius: 14px; background: #fff; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42); }
.guide-lightbox-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.guide-lightbox-header h2 { margin: 0; font-size: 20px; }
.guide-lightbox-close { min-height: 42px; padding: 7px 15px; border: 1px solid #aebdc7; border-radius: 8px; color: #fff; background: var(--brand); cursor: pointer; font-weight: 700; }
.guide-lightbox-close:focus-visible { outline: 4px solid #ffd16a; outline-offset: 3px; }
.guide-lightbox-scroll { overflow: auto; padding: 18px; overscroll-behavior: contain; background: #e6ecef; }
.guide-lightbox-scroll .shot-frame { width: max-content; min-width: 100%; border: 1px solid #c8d4db; border-radius: 10px; cursor: default; }
.guide-lightbox-scroll .shot-frame img { width: auto; min-width: min(1400px, calc(100vw - 110px)); max-width: none; height: auto; }

.step-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.step-list li { display: grid; grid-template-columns: 42px 1fr; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfd; }
.step-list li > span { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 9px; color: var(--brand); background: var(--brand-soft); font-weight: 800; }
.step-list strong, .safety-list strong { font-size: 17px; }
.step-list p, .safety-list p { margin: 3px 0 0; color: var(--muted); }

.card-grid, .detail-grid, .rule-grid, .compare-grid { display: grid; gap: 14px; }
.card-grid.two, .compare-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rule-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.info-card, .detail-grid > div, .rule-grid article, .compare-grid article { padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfd; }
.info-card h3, .rule-grid h3, .compare-grid h3 { margin: 0 0 8px; font-size: 18px; }
.info-card p, .detail-grid p, .rule-grid p, .compare-grid p { margin: 0; color: var(--muted); }
.info-card ul { margin: 8px 0 0; padding-left: 20px; }

details { margin: 12px 0; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfd; }
summary { padding: 14px 18px; cursor: pointer; color: var(--ink); font-weight: 700; }
.details-body { padding: 0 18px 16px; }
.details-body p, .details-body ul { margin: 0; }
.check-list { padding-left: 20px; }
.check-list li + li { margin-top: 7px; }

.status { display: inline-flex; margin-bottom: 9px; padding: 3px 9px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.status.preview { color: #185a82; background: var(--blue-soft); }
.status.saved { color: var(--brand-dark); background: var(--brand-soft); }
.notice { margin-top: 18px; padding: 16px 18px; border-left: 4px solid; border-radius: 7px; }
.notice p { margin: 4px 0 0; }
.notice.safe { border-color: var(--brand); background: var(--brand-soft); }
.notice.warning { border-color: #d58a22; background: var(--warning-soft); color: #714710; }
.notice.info { border-color: #3c79a5; background: var(--blue-soft); }

.operation-table-wrap { overflow-x: auto; }
.operation-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.operation-table th, .operation-table td { padding: 12px 14px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.operation-table th { background: var(--soft); }
.compact-steps, .instruction-list { margin: 0; padding-left: 24px; }
.compact-steps li + li, .instruction-list li + li { margin-top: 8px; }

.flow-strip { display: flex; align-items: stretch; gap: 8px; margin-bottom: 20px; overflow-x: auto; }
.flow-strip span { display: grid; min-width: 132px; padding: 12px; place-items: center; border-radius: 8px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; text-align: center; }
.flow-strip i { display: grid; place-items: center; color: #8da0aa; font-style: normal; }

.status-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.status-row > div { padding: 15px; border: 1px solid var(--line); border-radius: 9px; }
.status-row p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.dot { display: inline-block; width: 10px; height: 10px; margin-right: 7px; border-radius: 50%; }
.dot.gray, .dot.muted { background: #8c9aa5; }
.dot.blue { background: #347db0; }
.dot.green { background: var(--brand); }

.field-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.field-chips span { padding: 6px 11px; border: 1px solid #b9d7d2; border-radius: 999px; color: var(--brand-dark); background: var(--brand-soft); }
.faq-list details:first-child { margin-top: 0; }
.safety-section { border-top: 5px solid #d58a22; }
.safety-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.safety-list li { display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 16px; border-radius: 9px; background: var(--warning-soft); }
.safety-list li > span { color: var(--warning); font-weight: 800; }
.guide-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 4px; color: var(--muted); }
.guide-footer p { margin: 0; }
.back-to-top { position: fixed; right: 22px; bottom: 22px; display: grid; width: 44px; height: 44px; place-items: center; border-radius: 50%; color: #fff; background: var(--brand); box-shadow: var(--shadow); text-decoration: none; font-size: 22px; }

@media (max-width: 1050px) {
  .guide-layout { grid-template-columns: 1fr; }
  .guide-toc { position: static; }
  .guide-toc ol { columns: 2; }
  .rule-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  body { font-size: 15px; }
  .guide-hero-inner, .guide-layout { width: min(100% - 28px, 1420px); }
  .guide-hero-inner { padding: 38px 0 34px; }
  .guide-layout { margin-top: 16px; }
  .guide-section { padding: 20px 16px; }
  .guide-toc ol { columns: 1; }
  .card-grid.two, .detail-grid, .rule-grid, .compare-grid, .safety-list, .status-row, .shot-grid.two { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; }
  .section-heading h2 { font-size: 24px; }
  .hero-actions .guide-button { width: 100%; }
  .guide-footer { align-items: flex-start; flex-direction: column; }
  .guide-lightbox { padding: 8px; }
  .guide-lightbox-panel { height: 96vh; border-radius: 10px; }
  .guide-lightbox-header { align-items: flex-start; padding: 10px 12px; }
  .guide-lightbox-header h2 { font-size: 17px; }
  .guide-lightbox-scroll { padding: 8px; }
  .guide-lightbox-scroll .shot-frame img { min-width: 1050px; }
}

@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 10.5pt; }
  .guide-hero { color: #132f43; background: #fff; border-bottom: 2px solid #173f50; }
  .guide-hero-inner { width: 100%; padding: 0 0 16px; }
  .eyebrow, .hero-summary, .hero-meta { color: #334f61; }
  .hero-actions, .guide-toc, .back-to-top, .skip-link, .section-collapse-button, .guide-lightbox { display: none !important; }
  .guide-layout { display: block; width: 100%; margin: 16px 0 0; }
  .guide-section { break-inside: auto; margin: 0 0 12px; padding: 16px; box-shadow: none; }
  .section-heading { margin-bottom: 10px; }
  .section-number { color: #173f50; background: #fff; border: 1px solid #173f50; }
  details { break-inside: avoid; }
  details > *:not(summary) { display: block !important; }
  .guide-shot { break-inside: avoid; box-shadow: none; }
  .shot-grid { gap: 10px; margin-top: 14px; }
  .shot-grid.two { grid-template-columns: 1fr; }
  .guide-shot figcaption { padding: 8px 10px 10px; }
  .guide-shot figcaption strong { font-size: 10pt; }
  .guide-shot figcaption span { font-size: 8.5pt; }
  .mark-box, .mark-dot, .shot-frame::before, .shot-frame::after { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .guide-footer { border-top: 1px solid #bbb; }
}
