/* Technická reference používá stejné barvy a rozměry jako ostatní pomůcky. */
.modbus-rvd-page { padding: var(--layout-gap); }
.modbus-rvd-page p { margin: 10px 0; }
.modbus-rvd-page a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.modbus-lead { color: var(--text-secondary); }
.modbus-note { padding: 10px 12px; border-left: 3px solid var(--primary); background: var(--bg); color: var(--text-secondary); }
.modbus-quick-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.modbus-quick-nav button { padding: 7px 11px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-raised); color: var(--link); cursor: pointer; }
.modbus-quick-nav button:hover { border-color: var(--field-border); background: var(--surface-hover); }
.modbus-reference-section { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line); }
.modbus-reference-section h3, .modbus-registers h3 { margin: 0 0 12px; font-size: 19px; }
.modbus-reference-section ul, .modbus-reference-section ol { padding-left: 24px; }
.modbus-reference-section li + li { margin-top: 7px; }
.modbus-small-scroll { max-width: 100%; overflow-x: auto; }
.modbus-small-table { width: 100%; min-width: 540px; border-collapse: collapse; text-align: left; }
.modbus-small-table th, .modbus-small-table td { border: 1px solid var(--line); vertical-align: top; white-space: pre-line; }
.modbus-small-table thead { background: var(--navy); color: var(--text-secondary); }
.modbus-small-table tbody th { font-weight: 600; color: var(--heading); }
.modbus-code { overflow-x: auto; padding: 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--text); font-family: Consolas, monospace; }
.modbus-bus-figure { margin: 14px 0; }
.modbus-bus-drawing { display: block; width: 100%; min-width: 600px; height: auto; background: var(--navy); border: 1px solid var(--line); border-radius: 5px; }
.modbus-bus-figure figcaption { margin-top: 8px; color: var(--muted); }

/* Filtry zůstávají mimo posuvnou tabulku, aby šly použít i na telefonu. */
.modbus-registers { container-type: inline-size; margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line); }
.modbus-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 12px; margin: 18px 0 10px; }
.modbus-filters label { display: grid; gap: 4px; min-width: 0; font-weight: 700; }
.modbus-filters .modbus-search { grid-column: 1 / -1; }
.modbus-filters input, .modbus-filters select { width: 100%; min-width: 0; min-height: 40px; padding: 7px 10px; border: 1px solid var(--field-border); border-radius: 4px; background: var(--bg); color: var(--text); font: inherit; font-weight: 400; }
.modbus-filters button { justify-self: start; min-height: 40px; }
#modbus-register-count { color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* Všech 338 řádků je dostupných bez stránkování; hlavička a adresa zůstávají viditelné. */
.modbus-register-scroll { max-width: 100%; max-height: 76vh; overflow: auto; border: 1px solid var(--line); border-radius: 5px; scrollbar-color: var(--field-border) var(--bg); }
.modbus-register-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.modbus-register-table caption { text-align: left; padding: 10px; font-weight: 700; color: var(--heading); background: var(--bg); }
.modbus-register-table th, .modbus-register-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.modbus-register-table thead th { position: sticky; top: 0; z-index: 2; background: var(--navy); color: var(--text-secondary); text-align: left; box-shadow: 0 1px 0 var(--line); }
.modbus-register-table th:first-child { width: 80px; position: sticky; left: 0; }
.modbus-register-table thead th:first-child { z-index: 3; }
/* Krátké hodnoty mají úzké sloupce; popis využije všechnu zbývající šířku panelu. */
.modbus-register-table thead th:nth-child(2) { width: auto; }
.modbus-register-table thead th:nth-child(3) { width: 56px; }
.modbus-register-table thead th:nth-child(4) { width: 112px; }
/* Název Měřítko se musí vejít celý na jeden řádek i s odsazením buňky. */
.modbus-register-table thead th:nth-child(5) { width: 72px; white-space: nowrap; }
.modbus-register-table thead th:nth-child(6) { width: 46px; }
.modbus-register-table thead th:nth-child(n+7) { width: 44px; }
.modbus-register-table tbody th { z-index: 1; color: var(--heading); font-weight: 700; background: var(--surface); text-align: left; font-variant-numeric: tabular-nums; }
.modbus-register-table tbody tr:nth-child(even), .modbus-register-table tbody tr:nth-child(even) th { background: var(--bg); }
.modbus-register-table tbody tr:hover, .modbus-register-table tbody tr:hover th { background: var(--surface-hover); }
.modbus-register-hex { display: block; color: var(--muted); font-weight: 400; }
.modbus-register-name { display: block; color: var(--heading); }
.modbus-register-group { display: block; margin-bottom: 3px; color: var(--muted); font-size: 12px; }
.modbus-register-note { margin: 5px 0 0 !important; color: var(--text-secondary); white-space: pre-line; }
.modbus-access { white-space: nowrap; font-weight: 700; }
.modbus-access--write { color: var(--success); }
.modbus-access--limited { color: var(--accent); }
/* Pod 600 px dostupného panelu se řádek zalomí do přehledu registru.
   Hodnoty zůstávají celé dostupné; vodorovný přesah nezakrýváme ořezem. */
@container (max-width: 600px) {
    .modbus-register-table, .modbus-register-table caption, .modbus-register-table tbody { display: block; width: 100%; }
    .modbus-register-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .modbus-register-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px; gap: 8px 12px; border-top: 1px solid var(--line); }
    .modbus-register-table tbody th, .modbus-register-table tbody td { display: block; min-width: 0; padding: 0; border: 0; }
    .modbus-register-table tbody th:first-child { position: static; width: auto; grid-column: 1 / -1; }
    .modbus-register-table tbody td:nth-child(2) { grid-column: 1 / -1; }
    .modbus-register-table tbody td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; color: var(--muted); font-weight: 400; }
    .modbus-register-hex { display: inline; margin-left: 8px; }
}
@media (max-width: 640px) {
    .modbus-filters { grid-template-columns: minmax(0, 1fr); }
    .modbus-register-scroll { max-height: 70vh; }
}
