/* ModbusBB user manual (manual.html) */
.man-header .byline { color: var(--muted); font-size: .9rem; margin-top: 8px; }
.man-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.man-cover { display: none; }

.man-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 40px; align-items: start; padding-top: 32px; padding-bottom: 60px; }
.man-toc { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; background: var(--card); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; padding: 16px 14px; font-size: .88rem; }
.man-toc summary { font-weight: 700; color: var(--brand); cursor: pointer; margin-bottom: 8px; }
.man-toc ol { list-style: none; margin: 0; padding: 0; }
.man-toc li { margin: 0; }
.man-toc a { display: block; padding: 5px 8px; border-radius: 8px; color: var(--muted); text-decoration: none; line-height: 1.35; }
.man-toc a:hover, .man-toc a:focus-visible { color: #fff; background: rgba(70,181,255,.12); }

.man-body { min-width: 0; }
.man-chapter { padding: 8px 0 36px; border-bottom: 1px solid rgba(255,255,255,.06); margin-bottom: 28px; scroll-margin-top: 84px; }
.man-chapter h2 { font-size: 1.8rem; margin-bottom: 16px; }
.man-chapter h3 { font-size: 1.2rem; margin: 30px 0 12px; color: var(--brand); scroll-margin-top: 84px; }
.man-chapter p, .man-chapter li { color: var(--muted); line-height: 1.75; }
.man-chapter p { margin-bottom: 14px; }
.man-chapter strong { color: #fff; }
.man-chapter a { color: var(--brand); }
.man-top { text-align: right; font-size: .85rem; margin-top: 12px; }

.man-list { margin: 0 0 16px 22px; }
.man-list li { margin-bottom: 6px; }

.man-steps { counter-reset: step; list-style: none; margin: 0 0 18px; padding: 0; }
.man-steps li { counter-increment: step; position: relative; padding: 10px 14px 10px 52px; margin-bottom: 8px; background: var(--card); border: 1px solid rgba(255,255,255,.06); border-radius: 10px; }
.man-steps li::before { content: counter(step); position: absolute; left: 12px; top: 9px; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #0e1324; font-weight: 700; text-align: center; line-height: 28px; font-size: .9rem; }

.man-legend { counter-reset: mark; list-style: none; margin: 4px 0 22px; padding: 0; }
.man-legend li { counter-increment: mark; position: relative; padding: 4px 0 4px 40px; margin-bottom: 4px; }
.man-legend li::before { content: counter(mark); position: absolute; left: 0; top: 5px; width: 26px; height: 26px; border-radius: 50%; background: #e53935; color: #fff; font-weight: 700; text-align: center; line-height: 26px; font-size: .85rem; border: 2px solid #fff; box-sizing: border-box; }

.man-fig { max-width: var(--w, 100%); }
.man-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 10px 0 20px; }
.man-grid2 .man-fig { margin: 0; }

.man-table { margin: 10px 0 22px; overflow-x: auto; }
.man-table table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.man-table th, .man-table td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.man-table th { color: #fff; background: rgba(70,181,255,.12); }
.man-table td { color: var(--muted); }
.man-cli-table td:first-child { white-space: nowrap; color: #fff; font-weight: 600; }
.man-cli-table td:last-child code { white-space: normal; word-break: break-word; }

.man-note { background: rgba(0,212,170,.08); border: 1px solid rgba(0,212,170,.35); border-radius: 12px; padding: 14px 18px; margin: 16px 0 22px; }
.man-note p { margin: 0; }
.man-note .man-note-title { font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.man-info { background: rgba(70,181,255,.08); border-color: rgba(70,181,255,.35); }
.man-info .man-note-title { color: var(--brand); }
.man-warn { background: rgba(255,167,38,.08); border-color: rgba(255,167,38,.45); }
.man-warn .man-note-title { color: var(--warning); }

.man-code { margin: 10px 0 18px; }
.man-chapter kbd { display: inline-block; padding: 1px 7px; border: 1px solid rgba(255,255,255,.25); border-bottom-width: 2px; border-radius: 6px; font-size: .82rem; color: #fff; background: rgba(255,255,255,.06); font-family: Consolas, monospace; }
.man-glossary .glossary-item { margin-bottom: 10px; }
.man-chapter .faq-details { margin-bottom: 10px; }

@media (max-width: 960px) {
    .man-layout { grid-template-columns: 1fr; gap: 20px; }
    .man-toc { position: static; max-height: none; }
    .man-toc details:not([open]) { margin: 0; }
    .man-grid2 { grid-template-columns: 1fr; }
}

@media print {
    @page { size: A4; margin: 16mm 14mm 18mm;
        @bottom-center { content: counter(page); font: 9pt "Segoe UI", Arial, sans-serif; color: #666; }
        @bottom-right { content: "ModbusBB 2.0.1 User Manual"; font: 8pt "Segoe UI", Arial, sans-serif; color: #999; } }
    @page :first { @bottom-center { content: none; } @bottom-right { content: none; } }
    html, body { background: #fff !important; color: #111 !important; }
    .navbar, .footer, .skip-link, .man-toc, .man-actions, .man-top, .breadcrumbs, .shot-zoom-hint, .lightbox { display: none !important; }
    .man-cover { display: flex !important; flex-direction: column; align-items: center; justify-content: center; height: 250mm; text-align: center; break-after: page; }
    .man-cover img { width: 46mm; height: 46mm; margin-bottom: 10mm; }
    .man-cover-title { font-size: 44pt; font-weight: 800; color: #0b5cad; margin: 0; }
    .man-cover-sub { font-size: 24pt; color: #222; margin: 4mm 0 14mm; }
    .man-cover-ver, .man-cover-org { font-size: 13pt; color: #444; margin: 2mm 0; }
    .man-header { padding: 0 !important; background: none !important; break-after: avoid; }
    .man-header h1 { color: #0b5cad !important; font-size: 24pt; }
    .man-header p { color: #333 !important; }
    .man-layout { display: block; padding: 0; }
    .wrap { max-width: none !important; padding: 0 !important; }
    .man-chapter { break-before: page; border: 0; padding: 0; margin: 0; }
    .man-body > .man-chapter:first-child { break-before: auto; margin-top: 8mm; }
    .man-chapter p, .man-chapter li { orphans: 3; widows: 3; }
    .comparison-table, .comparison-table table, .comparison-table thead, .comparison-table tbody, .comparison-table tr,
    .comparison-table td, .glossary-item, .glossary-list, .faq-details, .faq-details summary, .page-header {
        background: #fff !important; box-shadow: none !important; border-color: #ccd6e2 !important; }
    .comparison-table { border: 1px solid #ccd6e2 !important; border-radius: 6px; }
    .glossary-item { border: 0 !important; padding: 2px 0 !important; }
    .faq-details summary, .glossary-item dt { color: #000 !important; }
    .man-chapter h2 { color: #0b5cad !important; font-size: 20pt; }
    .man-chapter h3 { color: #0b5cad !important; break-after: avoid; }
    .man-chapter p, .man-chapter li, .man-table td, .man-chapter dd { color: #222 !important; }
    .man-chapter strong, .man-chapter dt { color: #000 !important; }
    .man-chapter a { color: #0b5cad !important; text-decoration: none; }
    .man-steps li, .man-note { background: #f5f8fc !important; border-color: #c9d6e6 !important; break-inside: avoid; }
    .man-steps li::before { background: #0b5cad !important; color: #fff !important; }
    .man-table th { background: #e7eef8 !important; color: #000 !important; }
    .man-table th, .man-table td { border-bottom: 1px solid #ccd6e2 !important; }
    .man-table tr { break-inside: avoid; }
    .man-fig, .shot { break-inside: avoid; max-width: 100% !important; }
    .shot img { box-shadow: none !important; border: 1px solid #bbb !important; max-height: 200mm; width: auto !important; max-width: 100% !important; }
    .shot-zoom { border: 0; background: none; padding: 0; }
    .shot figcaption { color: #555 !important; }
    .code-block, .man-code pre { background: #f3f3f3 !important; color: #111 !important; border: 1px solid #ccc !important; white-space: pre-wrap; }
    .man-chapter kbd { color: #000 !important; border-color: #888 !important; background: #f3f3f3 !important; }
    .man-chapter .faq-details { break-inside: avoid; }
    .man-chapter details > *:not(summary) { display: block !important; }
    .man-grid2 { display: block; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
