/* Конструктор бланка: стол с листом слева, панель зон справа. Цвета — из токенов темы; лист всегда белый (это бумага). */
.lhd .page-header { align-items: flex-start; gap: 16px; }
.lhd-sub { font-size: var(--text-sm); color: var(--text-muted); max-width: 460px; margin-top: 4px; }
.lhd-act { display: flex; gap: 8px; flex-wrap: nowrap; align-items: center; flex: none; }
.lhd-bar { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end; margin: 4px 0 14px; }
.lhd-f { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-xs); color: var(--text-muted); min-width: 0; }
.lhd-f > span { letter-spacing: .02em; }
.lhd-f input, .lhd-f select, .lhd-f textarea { font: inherit; font-size: var(--text-sm); color: var(--text-primary); background: var(--bg-secondary); border: 1px solid var(--border-default); border-radius: var(--radius-sm); padding: 6px 8px; }
.lhd-f input[type="color"] { padding: 2px; height: 32px; width: 56px; }
.lhd-f--name input { width: 240px; }
.lhd-f--wide { grid-column: 1 / -1; }
.lhd-f--chk { flex-direction: row; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--text-primary); }
.lhd-f--chk input { width: auto; }
.lhd-chk { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--text-primary); padding-bottom: 7px; }
.lhd-tabs { display: inline-flex; border: 1px solid var(--border-default); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-secondary); }
.lhd-tab { font: inherit; font-size: var(--text-sm); padding: 7px 14px; border: 0; background: transparent; color: var(--text-secondary); cursor: pointer; }
.lhd-tab + .lhd-tab { border-left: 1px solid var(--border-default); }
.lhd-tab.on { background: var(--accent-surface); color: var(--accent-primary); font-weight: 600; }
.lhd-tab:focus-visible, .lhd-key__b:focus-visible, .lhd-key__x:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: -2px; }
.lhd-tabs--s { display: flex; margin-bottom: 12px; }
.lhd-tabs--s .lhd-tab { flex: 1; }
.lhd-note { padding: 9px 12px; margin-bottom: 12px; border-radius: var(--radius-sm); background: var(--accent-surface); color: var(--text-primary); font-size: var(--text-sm); }

.lhd-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.lhd-desk { overflow: auto; max-height: calc(100vh - 230px); padding: 18px; border-radius: var(--radius-md); background: var(--bg-subtle); border: 1px solid var(--border-subtle); }
.lhd-sheet { position: relative; margin: 0 auto; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25), 0 10px 28px rgba(0, 0, 0, .14); outline: none; user-select: none; touch-action: none; overflow: hidden; }
.lhd-bg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.lhd-nobg { position: absolute; left: 12%; right: 12%; top: 46%; text-align: center; font-size: 12px; color: #8a949e; pointer-events: none; }
.lhd-pm { position: absolute; border: 1px dashed rgba(47, 111, 237, .55); pointer-events: none; }
.lhd-line { position: absolute; pointer-events: none; }
.lhd-z { position: absolute; box-sizing: border-box; border: 1px solid var(--zc); background: color-mix(in srgb, var(--zc) 14%, transparent); cursor: move; touch-action: none; }
.lhd-z.is-on { border-width: 2px; background: color-mix(in srgb, var(--zc) 22%, transparent); z-index: 5; }
.lhd-z__tag { position: absolute; left: -1px; top: -15px; max-width: 220px; padding: 1px 5px; font: 600 10px/13px var(--font-sans, system-ui); color: #fff; background: var(--zc); border-radius: 3px 3px 3px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; opacity: .92; }
.lhd-z.is-on .lhd-z__tag { opacity: 1; }
.lhd-z__txt { display: block; width: 100%; height: 100%; overflow: hidden; pointer-events: none; white-space: pre-wrap; }
.lhd-h { position: absolute; width: 9px; height: 9px; background: #fff; border: 2px solid var(--zc); border-radius: 2px; box-sizing: border-box; }
.lhd-h--n { left: calc(50% - 4.5px); top: -5px; cursor: ns-resize; } .lhd-h--s { left: calc(50% - 4.5px); bottom: -5px; cursor: ns-resize; }
.lhd-h--e { right: -5px; top: calc(50% - 4.5px); cursor: ew-resize; } .lhd-h--w { left: -5px; top: calc(50% - 4.5px); cursor: ew-resize; }
.lhd-h--ne { right: -5px; top: -5px; cursor: nesw-resize; } .lhd-h--sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.lhd-h--nw { left: -5px; top: -5px; cursor: nwse-resize; } .lhd-h--se { right: -5px; bottom: -5px; cursor: nwse-resize; }

.lhd-side { position: sticky; top: 12px; max-height: calc(100vh - 160px); overflow: auto; padding: 14px; border-radius: var(--radius-md); background: var(--bg-secondary); border: 1px solid var(--border-default); }
.lhd-ed, .lhd-sec { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border-subtle); }
.lhd-ed__t { font-size: var(--text-sm); font-weight: 700; margin-bottom: 8px; color: var(--text-primary); }
.lhd-ed__g { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.lhd-hint { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.45; margin-bottom: 12px; }
.lhd-grp { margin-bottom: 12px; }
.lhd-grp__t { display: flex; align-items: center; gap: 6px; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.lhd-grp__t i { width: 8px; height: 8px; border-radius: 2px; }
.lhd-key { display: flex; align-items: center; border-radius: var(--radius-sm); }
.lhd-key[draggable="true"] { cursor: grab; }
.lhd-key:hover { background: var(--bg-panel-hover); }
.lhd-key.sel { background: var(--accent-surface); }
.lhd-key__b { flex: 1; text-align: left; font: inherit; font-size: var(--text-sm); padding: 6px 8px; border: 0; background: transparent; color: var(--text-primary); cursor: pointer; }
.lhd-key:not(.has) .lhd-key__b { color: var(--text-secondary); }
.lhd-key__p { font-size: 11px; color: var(--accent-primary); padding-right: 8px; }
.lhd-key__x { border: 0; background: transparent; color: var(--text-muted); font-size: 17px; line-height: 1; padding: 4px 9px; cursor: pointer; border-radius: var(--radius-sm); }
.lhd-key__x:hover { color: var(--status-danger, #c0392b); }
.lhd-probs { margin: 6px 0 0; padding: 10px 10px 10px 26px; font-size: var(--text-xs); color: var(--status-warning, #8a5a00); background: color-mix(in srgb, var(--status-warning, #d9822b) 12%, transparent); border-radius: var(--radius-sm); line-height: 1.5; }
.lhd-ok { margin-top: 6px; font-size: var(--text-xs); color: var(--accent-primary); }
@media (max-width: 1100px) { .lhd-grid { grid-template-columns: 1fr; } .lhd-side { position: static; max-height: none; } .lhd-desk { max-height: none; } }
@media (prefers-reduced-motion: reduce) { .lhd * { transition: none !important; } }

/* узкие зоны подписываются только при наведении и выборе — иначе подписи наезжают друг на друга */
.lhd-z--sm .lhd-z__tag { display: none; }
.lhd-z--sm:hover .lhd-z__tag, .lhd-z--sm.is-on .lhd-z__tag { display: block; }
.lhd-z:hover { z-index: 6; }
